openfox 1.6.90 → 1.6.92
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-6A34RHDV.js → auto-compaction-7AGIGW6F.js} +7 -7
- package/dist/{chat-handler-6ATTKNZT.js → chat-handler-UPAEF6HR.js} +10 -10
- package/dist/{chunk-ZORPFD4C.js → chunk-2BS6LMIU.js} +507 -474
- package/dist/{chunk-N7W42N5Y.js → chunk-2TKN2X2A.js} +3 -3
- package/dist/{chunk-7WHJUQ4Y.js → chunk-7KO2BQFQ.js} +9 -8
- package/dist/{chunk-6GGYIEBM.js → chunk-7QG6LY5Q.js} +3 -3
- package/dist/{chunk-UEZDAB5X.js → chunk-ARJIHQ3S.js} +240 -143
- package/dist/{chunk-TLOL4I7K.js → chunk-BHZL3N2F.js} +3 -3
- package/dist/{chunk-WSRF5L3S.js → chunk-CHICEUV6.js} +3 -3
- package/dist/{chunk-RCECKE5L.js → chunk-PQCFNTFJ.js} +15 -9
- package/dist/{chunk-YNIAFX24.js → chunk-RJIPM7CO.js} +4 -4
- package/dist/{chunk-B5AP3RSV.js → chunk-RW25DL5R.js} +3 -3
- package/dist/{chunk-JDDNBK6T.js → chunk-WBQNIWAQ.js} +5 -5
- package/dist/{chunk-DF5BZBP6.js → chunk-XGJ7HDQ7.js} +2 -2
- package/dist/{chunk-6P5WQP6Y.js → chunk-YTPPQK55.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-HMMPXQ46.js → config-7XJQNOKX.js} +5 -5
- package/dist/{events-AQKDXJFK.js → events-K6AYMXFT.js} +3 -3
- package/dist/{orchestrator-YUAFANFC.js → orchestrator-M4WINFF3.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-4SOP4Q6S.js → processor-D4XQ5QMB.js} +5 -5
- package/dist/{protocol--8PKNwb_.d.ts → protocol-XRiJzlOK.d.ts} +1 -1
- package/dist/{provider-LDZFYLK6.js → provider-UO5PAZQQ.js} +7 -7
- package/dist/{runtime-config-CBJJJGBD.js → runtime-config-CYHDAC7W.js} +2 -2
- package/dist/{serve-YO7HQKUD.js → serve-Z5FNJUDT.js} +12 -12
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +10 -10
- package/dist/{service-TU4XSXYJ.js → service-3CLVG2HV.js} +20 -2
- package/dist/{settings-VTVOBDYG.js → settings-AYSWDZUI.js} +2 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-7MGUWXDP.js → tools-NFFQWH6M.js} +7 -7
- package/dist/{vision-fallback-WT66NURB.js → vision-fallback-GZZWU7CR.js} +2 -2
- package/dist/web/assets/{index-7tHnjaI4.css → index-CM0cLwa6.css} +2 -2
- package/dist/web/assets/index-SkaCnTiV.js +176 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-CdF408Qk.js +0 -158
- /package/dist/web/{workbox-8c29f6e4.js → workbox-7fc22fbe.js} +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
var l1=Object.defineProperty;var c1=(e,r,s)=>r in e?l1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var or=(e,r,s)=>c1(e,typeof r!="symbol"?r+"":r,s);function u1(e,r){for(var s=0;s<r.length;s++){const i=r[s];if(typeof i!="string"&&!Array.isArray(i)){for(const l in i)if(l!=="default"&&!(l in e)){const u=Object.getOwnPropertyDescriptor(i,l);u&&Object.defineProperty(e,l,u.get?u:{enumerable:!0,get:()=>i[l]})}}}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 l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&i(h)}).observe(document,{childList:!0,subtree:!0});function s(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(l){if(l.ep)return;l.ep=!0;const u=s(l);fetch(l.href,u)}})();function Zl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nd={exports:{}},La={};/**
|
|
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 Ex;function d1(){if(Ex)return La;Ex=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function s(i,l,u){var h=null;if(u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),"key"in l){u={};for(var c in l)c!=="key"&&(u[c]=l[c])}else u=l;return l=u.ref,{$$typeof:e,type:i,key:h,ref:l!==void 0?l:null,props:u}}return La.Fragment=r,La.jsx=s,La.jsxs=s,La}var jx;function h1(){return jx||(jx=1,Nd.exports=d1()),Nd.exports}var o=h1(),Td={exports:{}},We={};/**
|
|
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 Nx;function f1(){if(Nx)return We;Nx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),h=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),v=Symbol.iterator;function S(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function b(R,$,U){this.props=R,this.context=$,this.refs=y,this.updater=U||k}b.prototype.isReactComponent={},b.prototype.setState=function(R,$){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,$,"setState")},b.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function x(){}x.prototype=b.prototype;function _(R,$,U){this.props=R,this.context=$,this.refs=y,this.updater=U||k}var j=_.prototype=new x;j.constructor=_,C(j,b.prototype),j.isPureReactComponent=!0;var T=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function P(R,$,U){var ne=U.ref;return{$$typeof:e,type:R,key:$,ref:ne!==void 0?ne:null,props:U}}function O(R,$){return P(R.type,$,R.props)}function H(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function q(R){var $={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(U){return $[U]})}var W=/\/+/g;function G(R,$){return typeof R=="object"&&R!==null&&R.key!=null?q(""+R.key):$.toString(36)}function B(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(N,N):(R.status="pending",R.then(function($){R.status==="pending"&&(R.status="fulfilled",R.value=$)},function($){R.status==="pending"&&(R.status="rejected",R.reason=$)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function F(R,$,U,ne,Q){var ee=typeof R;(ee==="undefined"||ee==="boolean")&&(R=null);var X=!1;if(R===null)X=!0;else switch(ee){case"bigint":case"string":case"number":X=!0;break;case"object":switch(R.$$typeof){case e:case r:X=!0;break;case g:return X=R._init,F(X(R._payload),$,U,ne,Q)}}if(X)return Q=Q(R),X=ne===""?"."+G(R,0):ne,T(Q)?(U="",X!=null&&(U=X.replace(W,"$&/")+"/"),F(Q,$,U,"",function(re){return re})):Q!=null&&(H(Q)&&(Q=O(Q,U+(Q.key==null||R&&R.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+X)),$.push(Q)),1;X=0;var V=ne===""?".":ne+":";if(T(R))for(var ie=0;ie<R.length;ie++)ne=R[ie],ee=V+G(ne,ie),X+=F(ne,$,U,ee,Q);else if(ie=S(R),typeof ie=="function")for(R=ie.call(R),ie=0;!(ne=R.next()).done;)ne=ne.value,ee=V+G(ne,ie++),X+=F(ne,$,U,ee,Q);else if(ee==="object"){if(typeof R.then=="function")return F(B(R),$,U,ne,Q);throw $=String(R),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return X}function Z(R,$,U){if(R==null)return R;var ne=[],Q=0;return F(R,ne,"","",function(ee){return $.call(U,ee,Q++)}),ne}function Y(R){if(R._status===-1){var $=R._result;$=$(),$.then(function(U){(R._status===0||R._status===-1)&&(R._status=1,R._result=U)},function(U){(R._status===0||R._status===-1)&&(R._status=2,R._result=U)}),R._status===-1&&(R._status=0,R._result=$)}if(R._status===1)return R._result.default;throw R._result}var I=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},L={map:Z,forEach:function(R,$,U){Z(R,function(){$.apply(this,arguments)},U)},count:function(R){var $=0;return Z(R,function(){$++}),$},toArray:function(R){return Z(R,function($){return $})||[]},only:function(R){if(!H(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return We.Activity=m,We.Children=L,We.Component=b,We.Fragment=s,We.Profiler=l,We.PureComponent=_,We.StrictMode=i,We.Suspense=d,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,We.__COMPILER_RUNTIME={__proto__:null,c:function(R){return D.H.useMemoCache(R)}},We.cache=function(R){return function(){return R.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(R,$,U){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var ne=C({},R.props),Q=R.key;if($!=null)for(ee in $.key!==void 0&&(Q=""+$.key),$)!A.call($,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&$.ref===void 0||(ne[ee]=$[ee]);var ee=arguments.length-2;if(ee===1)ne.children=U;else if(1<ee){for(var X=Array(ee),V=0;V<ee;V++)X[V]=arguments[V+2];ne.children=X}return P(R.type,Q,ne)},We.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},We.createElement=function(R,$,U){var ne,Q={},ee=null;if($!=null)for(ne in $.key!==void 0&&(ee=""+$.key),$)A.call($,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(Q[ne]=$[ne]);var X=arguments.length-2;if(X===1)Q.children=U;else if(1<X){for(var V=Array(X),ie=0;ie<X;ie++)V[ie]=arguments[ie+2];Q.children=V}if(R&&R.defaultProps)for(ne in X=R.defaultProps,X)Q[ne]===void 0&&(Q[ne]=X[ne]);return P(R,ee,Q)},We.createRef=function(){return{current:null}},We.forwardRef=function(R){return{$$typeof:c,render:R}},We.isValidElement=H,We.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:Y}},We.memo=function(R,$){return{$$typeof:f,type:R,compare:$===void 0?null:$}},We.startTransition=function(R){var $=D.T,U={};D.T=U;try{var ne=R(),Q=D.S;Q!==null&&Q(U,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(N,I)}catch(ee){I(ee)}finally{$!==null&&U.types!==null&&($.types=U.types),D.T=$}},We.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},We.use=function(R){return D.H.use(R)},We.useActionState=function(R,$,U){return D.H.useActionState(R,$,U)},We.useCallback=function(R,$){return D.H.useCallback(R,$)},We.useContext=function(R){return D.H.useContext(R)},We.useDebugValue=function(){},We.useDeferredValue=function(R,$){return D.H.useDeferredValue(R,$)},We.useEffect=function(R,$){return D.H.useEffect(R,$)},We.useEffectEvent=function(R){return D.H.useEffectEvent(R)},We.useId=function(){return D.H.useId()},We.useImperativeHandle=function(R,$,U){return D.H.useImperativeHandle(R,$,U)},We.useInsertionEffect=function(R,$){return D.H.useInsertionEffect(R,$)},We.useLayoutEffect=function(R,$){return D.H.useLayoutEffect(R,$)},We.useMemo=function(R,$){return D.H.useMemo(R,$)},We.useOptimistic=function(R,$){return D.H.useOptimistic(R,$)},We.useReducer=function(R,$,U){return D.H.useReducer(R,$,U)},We.useRef=function(R){return D.H.useRef(R)},We.useState=function(R){return D.H.useState(R)},We.useSyncExternalStore=function(R,$,U){return D.H.useSyncExternalStore(R,$,U)},We.useTransition=function(){return D.H.useTransition()},We.version="19.2.4",We}var Tx;function Ql(){return Tx||(Tx=1,Td.exports=f1()),Td.exports}var z=Ql();const dn=Zl(z),p1=u1({__proto__:null,default:dn},[z]);var Ad={exports:{}},Oa={},Dd={exports:{}},Rd={};/**
|
|
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 Ax;function m1(){return Ax||(Ax=1,(function(e){function r(F,Z){var Y=F.length;F.push(Z);e:for(;0<Y;){var I=Y-1>>>1,L=F[I];if(0<l(L,Z))F[I]=Z,F[Y]=L,Y=I;else break e}}function s(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var Z=F[0],Y=F.pop();if(Y!==Z){F[0]=Y;e:for(var I=0,L=F.length,R=L>>>1;I<R;){var $=2*(I+1)-1,U=F[$],ne=$+1,Q=F[ne];if(0>l(U,Y))ne<L&&0>l(Q,U)?(F[I]=Q,F[ne]=Y,I=ne):(F[I]=U,F[$]=Y,I=$);else if(ne<L&&0>l(Q,Y))F[I]=Q,F[ne]=Y,I=ne;else break e}}return Z}function l(F,Z){var Y=F.sortIndex-Z.sortIndex;return Y!==0?Y:F.id-Z.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 h=Date,c=h.now();e.unstable_now=function(){return h.now()-c}}var d=[],f=[],g=1,m=null,v=3,S=!1,k=!1,C=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function j(F){for(var Z=s(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=F)i(f),Z.sortIndex=Z.expirationTime,r(d,Z);else break;Z=s(f)}}function T(F){if(C=!1,j(F),!k)if(s(d)!==null)k=!0,N||(N=!0,q());else{var Z=s(f);Z!==null&&B(T,Z.startTime-F)}}var N=!1,D=-1,A=5,P=-1;function O(){return y?!0:!(e.unstable_now()-P<A)}function H(){if(y=!1,N){var F=e.unstable_now();P=F;var Z=!0;try{e:{k=!1,C&&(C=!1,x(D),D=-1),S=!0;var Y=v;try{t:{for(j(F),m=s(d);m!==null&&!(m.expirationTime>F&&O());){var I=m.callback;if(typeof I=="function"){m.callback=null,v=m.priorityLevel;var L=I(m.expirationTime<=F);if(F=e.unstable_now(),typeof L=="function"){m.callback=L,j(F),Z=!0;break t}m===s(d)&&i(d),j(F)}else i(d);m=s(d)}if(m!==null)Z=!0;else{var R=s(f);R!==null&&B(T,R.startTime-F),Z=!1}}break e}finally{m=null,v=Y,S=!1}Z=void 0}}finally{Z?q():N=!1}}}var q;if(typeof _=="function")q=function(){_(H)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,G=W.port2;W.port1.onmessage=H,q=function(){G.postMessage(null)}}else q=function(){b(H,0)};function B(F,Z){D=b(function(){F(e.unstable_now())},Z)}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(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(F){switch(v){case 1:case 2:case 3:var Z=3;break;default:Z=v}var Y=v;v=Z;try{return F()}finally{v=Y}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(F,Z){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Y=v;v=F;try{return Z()}finally{v=Y}},e.unstable_scheduleCallback=function(F,Z,Y){var I=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?I+Y:I):Y=I,F){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=Y+L,F={id:g++,callback:Z,priorityLevel:F,startTime:Y,expirationTime:L,sortIndex:-1},Y>I?(F.sortIndex=Y,r(f,F),s(d)===null&&F===s(f)&&(C?(x(D),D=-1):C=!0,B(T,Y-I))):(F.sortIndex=L,r(d,F),k||S||(k=!0,N||(N=!0,q()))),F},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(F){var Z=v;return function(){var Y=v;v=Z;try{return F.apply(this,arguments)}finally{v=Y}}}})(Rd)),Rd}var Dx;function g1(){return Dx||(Dx=1,Dd.exports=m1()),Dd.exports}var Ld={exports:{}},cn={};/**
|
|
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 Rx;function x1(){if(Rx)return cn;Rx=1;var e=Ql();function r(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var i={d:{f:s,r:function(){throw Error(r(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(d,f,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:m==null?null:""+m,children:d,containerInfo:f,implementation:g}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,cn.createPortal=function(d,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(r(299));return u(d,f,null,g)},cn.flushSync=function(d){var f=h.T,g=i.p;try{if(h.T=null,i.p=2,d)return d()}finally{h.T=f,i.p=g,i.d.f()}},cn.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(d,f))},cn.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},cn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var g=f.as,m=c(g,f.crossOrigin),v=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:v,fetchPriority:S}):g==="script"&&i.d.X(d,{crossOrigin:m,integrity:v,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},cn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=c(f.as,f.crossOrigin);i.d.M(d,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(d)},cn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,m=c(g,f.crossOrigin);i.d.L(d,g,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},cn.preloadModule=function(d,f){if(typeof d=="string")if(f){var g=c(f.as,f.crossOrigin);i.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(d)},cn.requestFormReset=function(d){i.d.r(d)},cn.unstable_batchedUpdates=function(d,f){return d(f)},cn.useFormState=function(d,f,g){return h.H.useFormState(d,f,g)},cn.useFormStatus=function(){return h.H.useHostTransitionStatus()},cn.version="19.2.4",cn}var Lx;function Dv(){if(Lx)return Ld.exports;Lx=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(),Ld.exports=x1(),Ld.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 Ox;function b1(){if(Ox)return Oa;Ox=1;var e=g1(),r=Ql(),s=Dv();function i(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 l(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 h(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 c(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(i(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var a=t,p=n;;){var w=a.return;if(w===null)break;var E=w.alternate;if(E===null){if(p=w.return,p!==null){a=p;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===a)return d(w),t;if(E===p)return d(w),n;E=E.sibling}throw Error(i(188))}if(a.return!==p.return)a=w,p=E;else{for(var M=!1,K=w.child;K;){if(K===a){M=!0,a=w,p=E;break}if(K===p){M=!0,p=w,a=E;break}K=K.sibling}if(!M){for(K=E.child;K;){if(K===a){M=!0,a=E,p=w;break}if(K===p){M=!0,p=E,a=w;break}K=K.sibling}if(!M)throw Error(i(189))}}if(a.alternate!==p)throw Error(i(190))}if(a.tag!==3)throw Error(i(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,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function q(t){return t===null||typeof t!="object"?null:(t=H&&t[H]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function G(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===W?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case T:return"Suspense";case N:return"SuspenseList";case P:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case _: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:G(t.type)||"Memo";case A:n=t._payload,t=t._init;try{return G(t(n))}catch{}}return null}var B=Array.isArray,F=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},I=[],L=-1;function R(t){return{current:t}}function $(t){0>L||(t.current=I[L],I[L]=null,L--)}function U(t,n){L++,I[L]=t.current,t.current=n}var ne=R(null),Q=R(null),ee=R(null),X=R(null);function V(t,n){switch(U(ee,n),U(Q,t),U(ne,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Yg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Yg(n),t=Xg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}$(ne),U(ne,t)}function ie(){$(ne),$(Q),$(ee)}function re(t){t.memoizedState!==null&&U(X,t);var n=ne.current,a=Xg(n,t.type);n!==a&&(U(Q,t),U(ne,a))}function be(t){Q.current===t&&($(ne),$(Q)),X.current===t&&($(X),Ta._currentValue=Y)}var ve,Re;function Oe(t){if(ve===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",Re=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+t+Re}var ze=!1;function Ue(t,n){if(!t||ze)return"";ze=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={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 le=de}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(de){le=de}t.call(xe.prototype)}}else{try{throw Error()}catch(de){le=de}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(de){if(de&&le&&typeof de.stack=="string")return[de.stack,le.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=p.DetermineComponentFrameRoot(),M=E[0],K=E[1];if(M&&K){var J=M.split(`
|
|
44
|
-
`),oe=K.split(`
|
|
45
|
-
`);for(w=p=0;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;for(;w<oe.length&&!oe[w].includes("DetermineComponentFrameRoot");)w++;if(p===J.length||w===oe.length)for(p=J.length-1,w=oe.length-1;1<=p&&0<=w&&J[p]!==oe[w];)w--;for(;1<=p&&0<=w;p--,w--)if(J[p]!==oe[w]){if(p!==1||w!==1)do if(p--,w--,0>w||J[p]!==oe[w]){var he=`
|
|
46
|
-
`+J[p].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=p&&0<=w);break}}}finally{ze=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Oe(a):""}function Te(t,n){switch(t.tag){case 26:case 27:case 5:return Oe(t.type);case 16:return Oe("Lazy");case 13:return t.child!==n&&n!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return Oe("Activity");default:return""}}function pe(t){try{var n="",a=null;do n+=Te(t,a),a=t,t=t.return;while(t);return n}catch(p){return`
|
|
47
|
-
Error generating stack: `+p.message+`
|
|
48
|
-
`+p.stack}}var Ne=Object.prototype.hasOwnProperty,$e=e.unstable_scheduleCallback,Tt=e.unstable_cancelCallback,me=e.unstable_shouldYield,je=e.unstable_requestPaint,Me=e.unstable_now,ht=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Ae=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,At=e.log,Qe=e.unstable_setDisableYieldValue,Mt=null,Dt=null;function ue(t){if(typeof At=="function"&&Qe(t),Dt&&typeof Dt.setStrictMode=="function")try{Dt.setStrictMode(Mt,t)}catch{}}var Ee=Math.clz32?Math.clz32:zn,Ge=Math.log,lt=Math.LN2;function zn(t){return t>>>=0,t===0?32:31-(Ge(t)/lt|0)|0}var fe=256,ye=262144,Ce=4194304;function qe(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 st(t,n,a){var p=t.pendingLanes;if(p===0)return 0;var w=0,E=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var K=p&134217727;return K!==0?(p=K&~E,p!==0?w=qe(p):(M&=K,M!==0?w=qe(M):a||(a=K&~t,a!==0&&(w=qe(a))))):(K=p&~E,K!==0?w=qe(K):M!==0?w=qe(M):a||(a=p&~t,a!==0&&(w=qe(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 Fe(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function en(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 Pt(){var t=Ce;return Ce<<=1,(Ce&62914560)===0&&(Ce=4194304),t}function Gt(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function $s(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function gc(t,n,a,p,w,E){var M=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 K=t.entanglements,J=t.expirationTimes,oe=t.hiddenUpdates;for(a=M&~a;0<a;){var he=31-Ee(a),xe=1<<he;K[he]=0,J[he]=-1;var le=oe[he];if(le!==null)for(oe[he]=null,he=0;he<le.length;he++){var de=le[he];de!==null&&(de.lane&=-536870913)}a&=~xe}p!==0&&Df(t,p,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(M&~n))}function Df(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var p=31-Ee(n);t.entangledLanes|=n,t.entanglements[p]=t.entanglements[p]|1073741824|a&261930}function Rf(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var p=31-Ee(a),w=1<<p;w&n|t[p]&n&&(t[p]|=n),a&=~w}}function Lf(t,n){var a=n&-n;return a=(a&42)!==0?1:xc(a),(a&(t.suspendedLanes|n))!==0?0:a}function xc(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 bc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Of(){var t=Z.p;return t!==0?t:(t=window.event,t===void 0?32:vx(t.type))}function Mf(t,n){var a=Z.p;try{return Z.p=t,n()}finally{Z.p=a}}var zr=Math.random().toString(36).slice(2),tn="__reactFiber$"+zr,xn="__reactProps$"+zr,qs="__reactContainer$"+zr,vc="__reactEvents$"+zr,Z0="__reactListeners$"+zr,Q0="__reactHandles$"+zr,If="__reactResources$"+zr,qi="__reactMarker$"+zr;function yc(t){delete t[tn],delete t[xn],delete t[vc],delete t[Z0],delete t[Q0]}function Ws(t){var n=t[tn];if(n)return n;for(var a=t.parentNode;a;){if(n=a[qs]||a[tn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=rx(t);t!==null;){if(a=t[tn])return a;t=rx(t)}return n}t=a,a=t.parentNode}return null}function Vs(t){if(t=t[tn]||t[qs]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Wi(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function Gs(t){var n=t[If];return n||(n=t[If]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Xt(t){t[qi]=!0}var Bf=new Set,zf={};function fs(t,n){Ks(t,n),Ks(t+"Capture",n)}function Ks(t,n){for(zf[t]=n,t=0;t<n.length;t++)Bf.add(n[t])}var J0=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]*$"),Pf={},Hf={};function e_(t){return Ne.call(Hf,t)?!0:Ne.call(Pf,t)?!1:J0.test(t)?Hf[t]=!0:(Pf[t]=!0,!1)}function mo(t,n,a){if(e_(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var p=n.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function go(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 pr(t,n,a,p){if(p===null)t.removeAttribute(a);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+p)}}function Pn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ff(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function t_(t,n,a){var p=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var w=p.get,E=p.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,E.call(this,M)}}),Object.defineProperty(t,n,{enumerable:p.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function _c(t){if(!t._valueTracker){var n=Ff(t)?"checked":"value";t._valueTracker=t_(t,n,""+t[n])}}function Uf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),p="";return t&&(p=Ff(t)?t.checked?"true":"false":t.value),t=p,t!==a?(n.setValue(t),!0):!1}function xo(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 n_=/[\n"\\]/g;function Hn(t){return t.replace(n_,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Sc(t,n,a,p,w,E,M,K){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),n!=null?M==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Pn(n)):t.value!==""+Pn(n)&&(t.value=""+Pn(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?wc(t,M,Pn(n)):a!=null?wc(t,M,Pn(a)):p!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?t.name=""+Pn(K):t.removeAttribute("name")}function $f(t,n,a,p,w,E,M,K){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)){_c(t);return}a=a!=null?""+Pn(a):"",n=n!=null?""+Pn(n):a,K||n===t.value||(t.value=n),t.defaultValue=n}p=p??w,p=typeof p!="function"&&typeof p!="symbol"&&!!p,t.checked=K?t.checked:!!p,t.defaultChecked=!!p,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),_c(t)}function wc(t,n,a){n==="number"&&xo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Ys(t,n,a,p){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&&p&&(t[a].defaultSelected=!0)}else{for(a=""+Pn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,p&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function qf(t,n,a){if(n!=null&&(n=""+Pn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Pn(a):""}function Wf(t,n,a,p){if(n==null){if(p!=null){if(a!=null)throw Error(i(92));if(B(p)){if(1<p.length)throw Error(i(93));p=p[0]}a=p}a==null&&(a=""),n=a}a=Pn(n),t.defaultValue=a,p=t.textContent,p===a&&p!==""&&p!==null&&(t.value=p),_c(t)}function Xs(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var r_=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 Vf(t,n,a){var p=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?p?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":p?t.setProperty(n,a):typeof a!="number"||a===0||r_.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Gf(t,n,a){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,a!=null){for(var p in a)!a.hasOwnProperty(p)||n!=null&&n.hasOwnProperty(p)||(p.indexOf("--")===0?t.setProperty(p,""):p==="float"?t.cssFloat="":t[p]="");for(var w in n)p=n[w],n.hasOwnProperty(w)&&a[w]!==p&&Vf(t,w,p)}else for(var E in n)n.hasOwnProperty(E)&&Vf(t,E,n[E])}function Cc(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 s_=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"]]),i_=/^[\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 bo(t){return i_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function mr(){}var kc=null;function Ec(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zs=null,Qs=null;function Kf(t){var n=Vs(t);if(n&&(t=n.stateNode)){var a=t[xn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Sc(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="'+Hn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var p=a[n];if(p!==t&&p.form===t.form){var w=p[xn]||null;if(!w)throw Error(i(90));Sc(p,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)p=a[n],p.form===t.form&&Uf(p)}break e;case"textarea":qf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ys(t,!!a.multiple,n,!1)}}}var jc=!1;function Yf(t,n,a){if(jc)return t(n,a);jc=!0;try{var p=t(n);return p}finally{if(jc=!1,(Zs!==null||Qs!==null)&&(il(),Zs&&(n=Zs,t=Qs,Qs=Zs=null,Kf(n),t)))for(n=0;n<t.length;n++)Kf(t[n])}}function Vi(t,n){var a=t.stateNode;if(a===null)return null;var p=a[xn]||null;if(p===null)return null;a=p[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":(p=!p.disabled)||(t=t.type,p=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!p;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(i(231,n,typeof a));return a}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nc=!1;if(gr)try{var Gi={};Object.defineProperty(Gi,"passive",{get:function(){Nc=!0}}),window.addEventListener("test",Gi,Gi),window.removeEventListener("test",Gi,Gi)}catch{Nc=!1}var Pr=null,Tc=null,vo=null;function Xf(){if(vo)return vo;var t,n=Tc,a=n.length,p,w="value"in Pr?Pr.value:Pr.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(p=1;p<=M&&n[a-p]===w[E-p];p++);return vo=w.slice(t,1<p?1-p:void 0)}function yo(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 _o(){return!0}function Zf(){return!1}function bn(t){function n(a,p,w,E,M){this._reactName=a,this._targetInst=w,this.type=p,this.nativeEvent=E,this.target=M,this.currentTarget=null;for(var K in t)t.hasOwnProperty(K)&&(a=t[K],this[K]=a?a(E):E[K]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?_o:Zf,this.isPropagationStopped=Zf,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=_o)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=_o)},persist:function(){},isPersistent:_o}),n}var ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},So=bn(ps),Ki=m({},ps,{view:0,detail:0}),a_=bn(Ki),Ac,Dc,Yi,wo=m({},Ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lc,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!==Yi&&(Yi&&t.type==="mousemove"?(Ac=t.screenX-Yi.screenX,Dc=t.screenY-Yi.screenY):Dc=Ac=0,Yi=t),Ac)},movementY:function(t){return"movementY"in t?t.movementY:Dc}}),Qf=bn(wo),o_=m({},wo,{dataTransfer:0}),l_=bn(o_),c_=m({},Ki,{relatedTarget:0}),Rc=bn(c_),u_=m({},ps,{animationName:0,elapsedTime:0,pseudoElement:0}),d_=bn(u_),h_=m({},ps,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),f_=bn(h_),p_=m({},ps,{data:0}),Jf=bn(p_),m_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g_={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"},x_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function b_(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=x_[t])?!!n[t]:!1}function Lc(){return b_}var v_=m({},Ki,{key:function(t){if(t.key){var n=m_[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=yo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?g_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lc,charCode:function(t){return t.type==="keypress"?yo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?yo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),y_=bn(v_),__=m({},wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ep=bn(__),S_=m({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lc}),w_=bn(S_),C_=m({},ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),k_=bn(C_),E_=m({},wo,{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}),j_=bn(E_),N_=m({},ps,{newState:0,oldState:0}),T_=bn(N_),A_=[9,13,27,32],Oc=gr&&"CompositionEvent"in window,Xi=null;gr&&"documentMode"in document&&(Xi=document.documentMode);var D_=gr&&"TextEvent"in window&&!Xi,tp=gr&&(!Oc||Xi&&8<Xi&&11>=Xi),np=" ",rp=!1;function sp(t,n){switch(t){case"keyup":return A_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ip(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Js=!1;function R_(t,n){switch(t){case"compositionend":return ip(n);case"keypress":return n.which!==32?null:(rp=!0,np);case"textInput":return t=n.data,t===np&&rp?null:t;default:return null}}function L_(t,n){if(Js)return t==="compositionend"||!Oc&&sp(t,n)?(t=Xf(),vo=Tc=Pr=null,Js=!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 tp&&n.locale!=="ko"?null:n.data;default:return null}}var O_={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 ap(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!O_[t.type]:n==="textarea"}function op(t,n,a,p){Zs?Qs?Qs.push(p):Qs=[p]:Zs=p,n=hl(n,"onChange"),0<n.length&&(a=new So("onChange","change",null,a,p),t.push({event:a,listeners:n}))}var Zi=null,Qi=null;function M_(t){$g(t,0)}function Co(t){var n=Wi(t);if(Uf(n))return t}function lp(t,n){if(t==="change")return n}var cp=!1;if(gr){var Mc;if(gr){var Ic="oninput"in document;if(!Ic){var up=document.createElement("div");up.setAttribute("oninput","return;"),Ic=typeof up.oninput=="function"}Mc=Ic}else Mc=!1;cp=Mc&&(!document.documentMode||9<document.documentMode)}function dp(){Zi&&(Zi.detachEvent("onpropertychange",hp),Qi=Zi=null)}function hp(t){if(t.propertyName==="value"&&Co(Qi)){var n=[];op(n,Qi,t,Ec(t)),Yf(M_,n)}}function I_(t,n,a){t==="focusin"?(dp(),Zi=n,Qi=a,Zi.attachEvent("onpropertychange",hp)):t==="focusout"&&dp()}function B_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Co(Qi)}function z_(t,n){if(t==="click")return Co(n)}function P_(t,n){if(t==="input"||t==="change")return Co(n)}function H_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var En=typeof Object.is=="function"?Object.is:H_;function Ji(t,n){if(En(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),p=Object.keys(n);if(a.length!==p.length)return!1;for(p=0;p<a.length;p++){var w=a[p];if(!Ne.call(n,w)||!En(t[w],n[w]))return!1}return!0}function fp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function pp(t,n){var a=fp(t);t=0;for(var p;a;){if(a.nodeType===3){if(p=t+a.textContent.length,t<=n&&p>=n)return{node:a,offset:n-t};t=p}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=fp(a)}}function mp(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?mp(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function gp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=xo(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=xo(t.document)}return n}function Bc(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 F_=gr&&"documentMode"in document&&11>=document.documentMode,ei=null,zc=null,ea=null,Pc=!1;function xp(t,n,a){var p=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Pc||ei==null||ei!==xo(p)||(p=ei,"selectionStart"in p&&Bc(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),ea&&Ji(ea,p)||(ea=p,p=hl(zc,"onSelect"),0<p.length&&(n=new So("onSelect","select",null,n,a),t.push({event:n,listeners:p}),n.target=ei)))}function ms(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var ti={animationend:ms("Animation","AnimationEnd"),animationiteration:ms("Animation","AnimationIteration"),animationstart:ms("Animation","AnimationStart"),transitionrun:ms("Transition","TransitionRun"),transitionstart:ms("Transition","TransitionStart"),transitioncancel:ms("Transition","TransitionCancel"),transitionend:ms("Transition","TransitionEnd")},Hc={},bp={};gr&&(bp=document.createElement("div").style,"AnimationEvent"in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),"TransitionEvent"in window||delete ti.transitionend.transition);function gs(t){if(Hc[t])return Hc[t];if(!ti[t])return t;var n=ti[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in bp)return Hc[t]=n[a];return t}var vp=gs("animationend"),yp=gs("animationiteration"),_p=gs("animationstart"),U_=gs("transitionrun"),$_=gs("transitionstart"),q_=gs("transitioncancel"),Sp=gs("transitionend"),wp=new Map,Fc="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(" ");Fc.push("scrollEnd");function Xn(t,n){wp.set(t,n),fs(n,[t])}var ko=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)},Fn=[],ni=0,Uc=0;function Eo(){for(var t=ni,n=Uc=ni=0;n<t;){var a=Fn[n];Fn[n++]=null;var p=Fn[n];Fn[n++]=null;var w=Fn[n];Fn[n++]=null;var E=Fn[n];if(Fn[n++]=null,p!==null&&w!==null){var M=p.pending;M===null?w.next=w:(w.next=M.next,M.next=w),p.pending=w}E!==0&&Cp(a,w,E)}}function jo(t,n,a,p){Fn[ni++]=t,Fn[ni++]=n,Fn[ni++]=a,Fn[ni++]=p,Uc|=p,t.lanes|=p,t=t.alternate,t!==null&&(t.lanes|=p)}function $c(t,n,a,p){return jo(t,n,a,p),No(t)}function xs(t,n){return jo(t,null,null,n),No(t)}function Cp(t,n,a){t.lanes|=a;var p=t.alternate;p!==null&&(p.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,p=E.alternate,p!==null&&(p.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-Ee(a),t=E.hiddenUpdates,p=t[w],p===null?t[w]=[n]:p.push(n),n.lane=a|536870912),E):null}function No(t){if(50<Sa)throw Sa=0,Qu=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var ri={};function W_(t,n,a,p){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=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(t,n,a,p){return new W_(t,n,a,p)}function qc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function xr(t,n){var a=t.alternate;return a===null?(a=jn(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 kp(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 To(t,n,a,p,w,E){var M=0;if(p=t,typeof t=="function")qc(t)&&(M=1);else if(typeof t=="string")M=XS(t,a,ne.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case P:return t=jn(31,a,n,w),t.elementType=P,t.lanes=E,t;case C:return bs(a.children,w,E,n);case y:M=8,w|=24;break;case b:return t=jn(12,a,n,w|2),t.elementType=b,t.lanes=E,t;case T:return t=jn(13,a,n,w),t.elementType=T,t.lanes=E,t;case N:return t=jn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:M=10;break e;case x:M=9;break e;case j:M=11;break e;case D:M=14;break e;case A:M=16,p=null;break e}M=29,a=Error(i(130,t===null?"null":typeof t,"")),p=null}return n=jn(M,a,n,w),n.elementType=t,n.type=p,n.lanes=E,n}function bs(t,n,a,p){return t=jn(7,t,p,n),t.lanes=a,t}function Wc(t,n,a){return t=jn(6,t,null,n),t.lanes=a,t}function Ep(t){var n=jn(18,null,null,0);return n.stateNode=t,n}function Vc(t,n,a){return n=jn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var jp=new WeakMap;function Un(t,n){if(typeof t=="object"&&t!==null){var a=jp.get(t);return a!==void 0?a:(n={value:t,source:n,stack:pe(n)},jp.set(t,n),n)}return{value:t,source:n,stack:pe(n)}}var si=[],ii=0,Ao=null,ta=0,$n=[],qn=0,Hr=null,rr=1,sr="";function br(t,n){si[ii++]=ta,si[ii++]=Ao,Ao=t,ta=n}function Np(t,n,a){$n[qn++]=rr,$n[qn++]=sr,$n[qn++]=Hr,Hr=t;var p=rr;t=sr;var w=32-Ee(p)-1;p&=~(1<<w),a+=1;var E=32-Ee(n)+w;if(30<E){var M=w-w%5;E=(p&(1<<M)-1).toString(32),p>>=M,w-=M,rr=1<<32-Ee(n)+w|a<<w|p,sr=E+t}else rr=1<<E|a<<w|p,sr=t}function Gc(t){t.return!==null&&(br(t,1),Np(t,1,0))}function Kc(t){for(;t===Ao;)Ao=si[--ii],si[ii]=null,ta=si[--ii],si[ii]=null;for(;t===Hr;)Hr=$n[--qn],$n[qn]=null,sr=$n[--qn],$n[qn]=null,rr=$n[--qn],$n[qn]=null}function Tp(t,n){$n[qn++]=rr,$n[qn++]=sr,$n[qn++]=Hr,rr=n.id,sr=n.overflow,Hr=t}var nn=null,St=null,it=!1,Fr=null,Wn=!1,Yc=Error(i(519));function Ur(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw na(Un(n,t)),Yc}function Ap(t){var n=t.stateNode,a=t.type,p=t.memoizedProps;switch(n[tn]=t,n[xn]=p,a){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(a=0;a<Ca.length;a++)et(Ca[a],n);break;case"source":et("error",n);break;case"img":case"image":case"link":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"input":et("invalid",n),$f(n,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":et("invalid",n);break;case"textarea":et("invalid",n),Wf(n,p.value,p.defaultValue,p.children)}a=p.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||p.suppressHydrationWarning===!0||Gg(n.textContent,a)?(p.popover!=null&&(et("beforetoggle",n),et("toggle",n)),p.onScroll!=null&&et("scroll",n),p.onScrollEnd!=null&&et("scrollend",n),p.onClick!=null&&(n.onclick=mr),n=!0):n=!1,n||Ur(t,!0)}function Dp(t){for(nn=t.return;nn;)switch(nn.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:nn=nn.return}}function ai(t){if(t!==nn)return!1;if(!it)return Dp(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")||fd(t.type,t.memoizedProps)),a=!a),a&&St&&Ur(t),Dp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));St=nx(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));St=nx(t)}else n===27?(n=St,ns(t.type)?(t=bd,bd=null,St=t):St=n):St=nn?Gn(t.stateNode.nextSibling):null;return!0}function vs(){St=nn=null,it=!1}function Xc(){var t=Fr;return t!==null&&(Sn===null?Sn=t:Sn.push.apply(Sn,t),Fr=null),t}function na(t){Fr===null?Fr=[t]:Fr.push(t)}var Zc=R(null),ys=null,vr=null;function $r(t,n,a){U(Zc,n._currentValue),n._currentValue=a}function yr(t){t._currentValue=Zc.current,$(Zc)}function Qc(t,n,a){for(;t!==null;){var p=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,p!==null&&(p.childLanes|=n)):p!==null&&(p.childLanes&n)!==n&&(p.childLanes|=n),t===a)break;t=t.return}}function Jc(t,n,a,p){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var M=w.child;E=E.firstContext;e:for(;E!==null;){var K=E;E=w;for(var J=0;J<n.length;J++)if(K.context===n[J]){E.lanes|=a,K=E.alternate,K!==null&&(K.lanes|=a),Qc(E.return,a,t),p||(M=null);break e}E=K.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(i(341));M.lanes|=a,E=M.alternate,E!==null&&(E.lanes|=a),Qc(M,a,t),M=null}else M=w.child;if(M!==null)M.return=w;else for(M=w;M!==null;){if(M===t){M=null;break}if(w=M.sibling,w!==null){w.return=M.return,M=w;break}M=M.return}w=M}}function oi(t,n,a,p){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 M=w.alternate;if(M===null)throw Error(i(387));if(M=M.memoizedProps,M!==null){var K=w.type;En(w.pendingProps.value,M.value)||(t!==null?t.push(K):t=[K])}}else if(w===X.current){if(M=w.alternate,M===null)throw Error(i(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(Ta):t=[Ta])}w=w.return}t!==null&&Jc(n,t,a,p),n.flags|=262144}function Do(t){for(t=t.firstContext;t!==null;){if(!En(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function _s(t){ys=t,vr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function rn(t){return Rp(ys,t)}function Ro(t,n){return ys===null&&_s(t),Rp(t,n)}function Rp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},vr===null){if(t===null)throw Error(i(308));vr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else vr=vr.next=n;return a}var V_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,p){t.push(p)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},G_=e.unstable_scheduleCallback,K_=e.unstable_NormalPriority,Ht={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function eu(){return{controller:new V_,data:new Map,refCount:0}}function ra(t){t.refCount--,t.refCount===0&&G_(K_,function(){t.controller.abort()})}var sa=null,tu=0,li=0,ci=null;function Y_(t,n){if(sa===null){var a=sa=[];tu=0,li=sd(),ci={status:"pending",value:void 0,then:function(p){a.push(p)}}}return tu++,n.then(Lp,Lp),n}function Lp(){if(--tu===0&&sa!==null){ci!==null&&(ci.status="fulfilled");var t=sa;sa=null,li=0,ci=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function X_(t,n){var a=[],p={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){p.status="fulfilled",p.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(p.status="rejected",p.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),p}var Op=F.S;F.S=function(t,n){xg=Me(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Y_(t,n),Op!==null&&Op(t,n)};var Ss=R(null);function nu(){var t=Ss.current;return t!==null?t:vt.pooledCache}function Lo(t,n){n===null?U(Ss,Ss.current):U(Ss,n.pool)}function Mp(){var t=nu();return t===null?null:{parent:Ht._currentValue,pool:t}}var ui=Error(i(460)),ru=Error(i(474)),Oo=Error(i(542)),Mo={then:function(){}};function Ip(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Bp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(mr,mr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Pp(t),t;default:if(typeof n.status=="string")n.then(mr,mr);else{if(t=vt,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(p){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=p}},function(p){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=p}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Pp(t),t}throw Cs=n,ui}}function ws(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Cs=a,ui):a}}var Cs=null;function zp(){if(Cs===null)throw Error(i(459));var t=Cs;return Cs=null,t}function Pp(t){if(t===ui||t===Oo)throw Error(i(483))}var di=null,ia=0;function Io(t){var n=ia;return ia+=1,di===null&&(di=[]),Bp(di,t,n)}function aa(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Bo(t,n){throw n.$$typeof===v?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Hp(t){function n(se,te){if(t){var ae=se.deletions;ae===null?(se.deletions=[te],se.flags|=16):ae.push(te)}}function a(se,te){if(!t)return null;for(;te!==null;)n(se,te),te=te.sibling;return null}function p(se){for(var te=new Map;se!==null;)se.key!==null?te.set(se.key,se):te.set(se.index,se),se=se.sibling;return te}function w(se,te){return se=xr(se,te),se.index=0,se.sibling=null,se}function E(se,te,ae){return se.index=ae,t?(ae=se.alternate,ae!==null?(ae=ae.index,ae<te?(se.flags|=67108866,te):ae):(se.flags|=67108866,te)):(se.flags|=1048576,te)}function M(se){return t&&se.alternate===null&&(se.flags|=67108866),se}function K(se,te,ae,ge){return te===null||te.tag!==6?(te=Wc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae),te.return=se,te)}function J(se,te,ae,ge){var Be=ae.type;return Be===C?he(se,te,ae.props.children,ge,ae.key):te!==null&&(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&ws(Be)===te.type)?(te=w(te,ae.props),aa(te,ae),te.return=se,te):(te=To(ae.type,ae.key,ae.props,null,se.mode,ge),aa(te,ae),te.return=se,te)}function oe(se,te,ae,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==ae.containerInfo||te.stateNode.implementation!==ae.implementation?(te=Vc(ae,se.mode,ge),te.return=se,te):(te=w(te,ae.children||[]),te.return=se,te)}function he(se,te,ae,ge,Be){return te===null||te.tag!==7?(te=bs(ae,se.mode,ge,Be),te.return=se,te):(te=w(te,ae),te.return=se,te)}function xe(se,te,ae){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Wc(""+te,se.mode,ae),te.return=se,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return ae=To(te.type,te.key,te.props,null,se.mode,ae),aa(ae,te),ae.return=se,ae;case k:return te=Vc(te,se.mode,ae),te.return=se,te;case A:return te=ws(te),xe(se,te,ae)}if(B(te)||q(te))return te=bs(te,se.mode,ae,null),te.return=se,te;if(typeof te.then=="function")return xe(se,Io(te),ae);if(te.$$typeof===_)return xe(se,Ro(se,te),ae);Bo(se,te)}return null}function le(se,te,ae,ge){var Be=te!==null?te.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return Be!==null?null:K(se,te,""+ae,ge);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case S:return ae.key===Be?J(se,te,ae,ge):null;case k:return ae.key===Be?oe(se,te,ae,ge):null;case A:return ae=ws(ae),le(se,te,ae,ge)}if(B(ae)||q(ae))return Be!==null?null:he(se,te,ae,ge,null);if(typeof ae.then=="function")return le(se,te,Io(ae),ge);if(ae.$$typeof===_)return le(se,te,Ro(se,ae),ge);Bo(se,ae)}return null}function de(se,te,ae,ge,Be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return se=se.get(ae)||null,K(te,se,""+ge,Be);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return se=se.get(ge.key===null?ae:ge.key)||null,J(te,se,ge,Be);case k:return se=se.get(ge.key===null?ae:ge.key)||null,oe(te,se,ge,Be);case A:return ge=ws(ge),de(se,te,ae,ge,Be)}if(B(ge)||q(ge))return se=se.get(ae)||null,he(te,se,ge,Be,null);if(typeof ge.then=="function")return de(se,te,ae,Io(ge),Be);if(ge.$$typeof===_)return de(se,te,ae,Ro(te,ge),Be);Bo(te,ge)}return null}function De(se,te,ae,ge){for(var Be=null,ct=null,Le=te,Ye=te=0,rt=null;Le!==null&&Ye<ae.length;Ye++){Le.index>Ye?(rt=Le,Le=null):rt=Le.sibling;var ut=le(se,Le,ae[Ye],ge);if(ut===null){Le===null&&(Le=rt);break}t&&Le&&ut.alternate===null&&n(se,Le),te=E(ut,te,Ye),ct===null?Be=ut:ct.sibling=ut,ct=ut,Le=rt}if(Ye===ae.length)return a(se,Le),it&&br(se,Ye),Be;if(Le===null){for(;Ye<ae.length;Ye++)Le=xe(se,ae[Ye],ge),Le!==null&&(te=E(Le,te,Ye),ct===null?Be=Le:ct.sibling=Le,ct=Le);return it&&br(se,Ye),Be}for(Le=p(Le);Ye<ae.length;Ye++)rt=de(Le,se,Ye,ae[Ye],ge),rt!==null&&(t&&rt.alternate!==null&&Le.delete(rt.key===null?Ye:rt.key),te=E(rt,te,Ye),ct===null?Be=rt:ct.sibling=rt,ct=rt);return t&&Le.forEach(function(os){return n(se,os)}),it&&br(se,Ye),Be}function He(se,te,ae,ge){if(ae==null)throw Error(i(151));for(var Be=null,ct=null,Le=te,Ye=te=0,rt=null,ut=ae.next();Le!==null&&!ut.done;Ye++,ut=ae.next()){Le.index>Ye?(rt=Le,Le=null):rt=Le.sibling;var os=le(se,Le,ut.value,ge);if(os===null){Le===null&&(Le=rt);break}t&&Le&&os.alternate===null&&n(se,Le),te=E(os,te,Ye),ct===null?Be=os:ct.sibling=os,ct=os,Le=rt}if(ut.done)return a(se,Le),it&&br(se,Ye),Be;if(Le===null){for(;!ut.done;Ye++,ut=ae.next())ut=xe(se,ut.value,ge),ut!==null&&(te=E(ut,te,Ye),ct===null?Be=ut:ct.sibling=ut,ct=ut);return it&&br(se,Ye),Be}for(Le=p(Le);!ut.done;Ye++,ut=ae.next())ut=de(Le,se,Ye,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Le.delete(ut.key===null?Ye:ut.key),te=E(ut,te,Ye),ct===null?Be=ut:ct.sibling=ut,ct=ut);return t&&Le.forEach(function(o1){return n(se,o1)}),it&&br(se,Ye),Be}function bt(se,te,ae,ge){if(typeof ae=="object"&&ae!==null&&ae.type===C&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case S:e:{for(var Be=ae.key;te!==null;){if(te.key===Be){if(Be=ae.type,Be===C){if(te.tag===7){a(se,te.sibling),ge=w(te,ae.props.children),ge.return=se,se=ge;break e}}else if(te.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&ws(Be)===te.type){a(se,te.sibling),ge=w(te,ae.props),aa(ge,ae),ge.return=se,se=ge;break e}a(se,te);break}else n(se,te);te=te.sibling}ae.type===C?(ge=bs(ae.props.children,se.mode,ge,ae.key),ge.return=se,se=ge):(ge=To(ae.type,ae.key,ae.props,null,se.mode,ge),aa(ge,ae),ge.return=se,se=ge)}return M(se);case k:e:{for(Be=ae.key;te!==null;){if(te.key===Be)if(te.tag===4&&te.stateNode.containerInfo===ae.containerInfo&&te.stateNode.implementation===ae.implementation){a(se,te.sibling),ge=w(te,ae.children||[]),ge.return=se,se=ge;break e}else{a(se,te);break}else n(se,te);te=te.sibling}ge=Vc(ae,se.mode,ge),ge.return=se,se=ge}return M(se);case A:return ae=ws(ae),bt(se,te,ae,ge)}if(B(ae))return De(se,te,ae,ge);if(q(ae)){if(Be=q(ae),typeof Be!="function")throw Error(i(150));return ae=Be.call(ae),He(se,te,ae,ge)}if(typeof ae.then=="function")return bt(se,te,Io(ae),ge);if(ae.$$typeof===_)return bt(se,te,Ro(se,ae),ge);Bo(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(a(se,te.sibling),ge=w(te,ae),ge.return=se,se=ge):(a(se,te),ge=Wc(ae,se.mode,ge),ge.return=se,se=ge),M(se)):a(se,te)}return function(se,te,ae,ge){try{ia=0;var Be=bt(se,te,ae,ge);return di=null,Be}catch(Le){if(Le===ui||Le===Oo)throw Le;var ct=jn(29,Le,null,se.mode);return ct.lanes=ge,ct.return=se,ct}finally{}}}var ks=Hp(!0),Fp=Hp(!1),qr=!1;function su(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iu(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 Wr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Vr(t,n,a){var p=t.updateQueue;if(p===null)return null;if(p=p.shared,(dt&2)!==0){var w=p.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),p.pending=n,n=No(t),Cp(t,null,a),n}return jo(t,p,n,a),No(t)}function oa(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var p=n.lanes;p&=t.pendingLanes,a|=p,n.lanes=a,Rf(t,a)}}function au(t,n){var a=t.updateQueue,p=t.alternate;if(p!==null&&(p=p.updateQueue,a===p)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=M:E=E.next=M,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:p.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:p.shared,callbacks:p.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var ou=!1;function la(){if(ou){var t=ci;if(t!==null)throw t}}function ca(t,n,a,p){ou=!1;var w=t.updateQueue;qr=!1;var E=w.firstBaseUpdate,M=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var J=K,oe=J.next;J.next=null,M===null?E=oe:M.next=oe,M=J;var he=t.alternate;he!==null&&(he=he.updateQueue,K=he.lastBaseUpdate,K!==M&&(K===null?he.firstBaseUpdate=oe:K.next=oe,he.lastBaseUpdate=J))}if(E!==null){var xe=w.baseState;M=0,he=oe=J=null,K=E;do{var le=K.lane&-536870913,de=le!==K.lane;if(de?(nt&le)===le:(p&le)===le){le!==0&&le===li&&(ou=!0),he!==null&&(he=he.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var De=t,He=K;le=n;var bt=a;switch(He.tag){case 1:if(De=He.payload,typeof De=="function"){xe=De.call(bt,xe,le);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=He.payload,le=typeof De=="function"?De.call(bt,xe,le):De,le==null)break e;xe=m({},xe,le);break e;case 2:qr=!0}}le=K.callback,le!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[le]:de.push(le))}else de={lane:le,tag:K.tag,payload:K.payload,callback:K.callback,next:null},he===null?(oe=he=de,J=xe):he=he.next=de,M|=le;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;de=K,K=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=oe,w.lastBaseUpdate=he,E===null&&(w.shared.lanes=0),Zr|=M,t.lanes=M,t.memoizedState=xe}}function Up(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function $p(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Up(a[t],n)}var hi=R(null),zo=R(0);function qp(t,n){t=Tr,U(zo,t),U(hi,n),Tr=t|n.baseLanes}function lu(){U(zo,Tr),U(hi,hi.current)}function cu(){Tr=zo.current,$(hi),$(zo)}var Nn=R(null),Vn=null;function Gr(t){var n=t.alternate;U(It,It.current&1),U(Nn,t),Vn===null&&(n===null||hi.current!==null||n.memoizedState!==null)&&(Vn=t)}function uu(t){U(It,It.current),U(Nn,t),Vn===null&&(Vn=t)}function Wp(t){t.tag===22?(U(It,It.current),U(Nn,t),Vn===null&&(Vn=t)):Kr()}function Kr(){U(It,It.current),U(Nn,Nn.current)}function Tn(t){$(Nn),Vn===t&&(Vn=null),$(It)}var It=R(0);function Po(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||gd(a)||xd(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 _r=0,Ke=null,gt=null,Ft=null,Ho=!1,fi=!1,Es=!1,Fo=0,ua=0,pi=null,Z_=0;function Rt(){throw Error(i(321))}function du(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!En(t[a],n[a]))return!1;return!0}function hu(t,n,a,p,w,E){return _r=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,F.H=t===null||t.memoizedState===null?Nm:ju,Es=!1,E=a(p,w),Es=!1,fi&&(E=Gp(n,a,p,w)),Vp(t),E}function Vp(t){F.H=fa;var n=gt!==null&>.next!==null;if(_r=0,Ft=gt=Ke=null,Ho=!1,ua=0,pi=null,n)throw Error(i(300));t===null||Ut||(t=t.dependencies,t!==null&&Do(t)&&(Ut=!0))}function Gp(t,n,a,p){Ke=t;var w=0;do{if(fi&&(pi=null),ua=0,fi=!1,25<=w)throw Error(i(301));if(w+=1,Ft=gt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}F.H=Tm,E=n(a,p)}while(fi);return E}function Q_(){var t=F.H,n=t.useState()[0];return n=typeof n.then=="function"?da(n):n,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function fu(){var t=Fo!==0;return Fo=0,t}function pu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function mu(t){if(Ho){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Ho=!1}_r=0,Ft=gt=Ke=null,fi=!1,ua=Fo=0,pi=null}function mn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?Ke.memoizedState=Ft=t:Ft=Ft.next=t,Ft}function Bt(){if(gt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var n=Ft===null?Ke.memoizedState:Ft.next;if(n!==null)Ft=n,gt=t;else{if(t===null)throw Ke.alternate===null?Error(i(467)):Error(i(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Ft===null?Ke.memoizedState=Ft=t:Ft=Ft.next=t}return Ft}function Uo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function da(t){var n=ua;return ua+=1,pi===null&&(pi=[]),t=Bp(pi,t,n),n=Ke,(Ft===null?n.memoizedState:Ft.next)===null&&(n=n.alternate,F.H=n===null||n.memoizedState===null?Nm:ju),t}function $o(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return da(t);if(t.$$typeof===_)return rn(t)}throw Error(i(438,String(t)))}function gu(t){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var p=Ke.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(n={data:p.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Uo(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),p=0;p<t;p++)a[p]=O;return n.index++,a}function Sr(t,n){return typeof n=="function"?n(t):n}function qo(t){var n=Bt();return xu(n,gt,t)}function xu(t,n,a){var p=t.queue;if(p===null)throw Error(i(311));p.lastRenderedReducer=a;var w=t.baseQueue,E=p.pending;if(E!==null){if(w!==null){var M=w.next;w.next=E.next,E.next=M}n.baseQueue=w=E,p.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var K=M=null,J=null,oe=n,he=!1;do{var xe=oe.lane&-536870913;if(xe!==oe.lane?(nt&xe)===xe:(_r&xe)===xe){var le=oe.revertLane;if(le===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null}),xe===li&&(he=!0);else if((_r&le)===le){oe=oe.next,le===li&&(he=!0);continue}else xe={lane:0,revertLane:oe.revertLane,gesture:null,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},J===null?(K=J=xe,M=E):J=J.next=xe,Ke.lanes|=le,Zr|=le;xe=oe.action,Es&&a(E,xe),E=oe.hasEagerState?oe.eagerState:a(E,xe)}else le={lane:xe,revertLane:oe.revertLane,gesture:oe.gesture,action:oe.action,hasEagerState:oe.hasEagerState,eagerState:oe.eagerState,next:null},J===null?(K=J=le,M=E):J=J.next=le,Ke.lanes|=xe,Zr|=xe;oe=oe.next}while(oe!==null&&oe!==n);if(J===null?M=E:J.next=K,!En(E,t.memoizedState)&&(Ut=!0,he&&(a=ci,a!==null)))throw a;t.memoizedState=E,t.baseState=M,t.baseQueue=J,p.lastRenderedState=E}return w===null&&(p.lanes=0),[t.memoizedState,p.dispatch]}function bu(t){var n=Bt(),a=n.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=t;var p=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do E=t(E,M.action),M=M.next;while(M!==w);En(E,n.memoizedState)||(Ut=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,p]}function Kp(t,n,a){var p=Ke,w=Bt(),E=it;if(E){if(a===void 0)throw Error(i(407));a=a()}else a=n();var M=!En((gt||w).memoizedState,a);if(M&&(w.memoizedState=a,Ut=!0),w=w.queue,_u(Zp.bind(null,p,w,t),[t]),w.getSnapshot!==n||M||Ft!==null&&Ft.memoizedState.tag&1){if(p.flags|=2048,mi(9,{destroy:void 0},Xp.bind(null,p,w,a,n),null),vt===null)throw Error(i(349));E||(_r&127)!==0||Yp(p,n,a)}return a}function Yp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Uo(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Xp(t,n,a,p){n.value=a,n.getSnapshot=p,Qp(n)&&Jp(t)}function Zp(t,n,a){return a(function(){Qp(n)&&Jp(t)})}function Qp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!En(t,a)}catch{return!0}}function Jp(t){var n=xs(t,2);n!==null&&wn(n,t,2)}function vu(t){var n=mn();if(typeof t=="function"){var a=t;if(t=a(),Es){ue(!0);try{a()}finally{ue(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:t},n}function em(t,n,a,p){return t.baseState=a,xu(t,gt,typeof p=="function"?p:Sr)}function J_(t,n,a,p,w){if(Go(t))throw Error(i(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(M){E.listeners.push(M)}};F.T!==null?a(!0):E.isTransition=!1,p(E),a=n.pending,a===null?(E.next=n.pending=E,tm(n,E)):(E.next=a.next,n.pending=a.next=E)}}function tm(t,n){var a=n.action,p=n.payload,w=t.state;if(n.isTransition){var E=F.T,M={};F.T=M;try{var K=a(w,p),J=F.S;J!==null&&J(M,K),nm(t,n,K)}catch(oe){yu(t,n,oe)}finally{E!==null&&M.types!==null&&(E.types=M.types),F.T=E}}else try{E=a(w,p),nm(t,n,E)}catch(oe){yu(t,n,oe)}}function nm(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(p){rm(t,n,p)},function(p){return yu(t,n,p)}):rm(t,n,a)}function rm(t,n,a){n.status="fulfilled",n.value=a,sm(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,tm(t,a)))}function yu(t,n,a){var p=t.pending;if(t.pending=null,p!==null){p=p.next;do n.status="rejected",n.reason=a,sm(n),n=n.next;while(n!==p)}t.action=null}function sm(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function im(t,n){return n}function am(t,n){if(it){var a=vt.formState;if(a!==null){e:{var p=Ke;if(it){if(St){t:{for(var w=St,E=Wn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Gn(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){St=Gn(w.nextSibling),p=w.data==="F!";break e}}Ur(p)}p=!1}p&&(n=a[0])}}return a=mn(),a.memoizedState=a.baseState=n,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:im,lastRenderedState:n},a.queue=p,a=km.bind(null,Ke,p),p.dispatch=a,p=vu(!1),E=Eu.bind(null,Ke,!1,p.queue),p=mn(),w={state:n,dispatch:null,action:t,pending:null},p.queue=w,a=J_.bind(null,Ke,w,E,a),w.dispatch=a,p.memoizedState=t,[n,a,!1]}function om(t){var n=Bt();return lm(n,gt,t)}function lm(t,n,a){if(n=xu(t,n,im)[0],t=qo(Sr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var p=da(n)}catch(M){throw M===ui?Oo:M}else p=n;n=Bt();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,mi(9,{destroy:void 0},eS.bind(null,w,a),null)),[p,E,t]}function eS(t,n){t.action=n}function cm(t){var n=Bt(),a=gt;if(a!==null)return lm(n,a,t);Bt(),n=n.memoizedState,a=Bt();var p=a.queue.dispatch;return a.memoizedState=t,[n,p,!1]}function mi(t,n,a,p){return t={tag:t,create:a,deps:p,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Uo(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(p=a.next,a.next=t,t.next=p,n.lastEffect=t),t}function um(){return Bt().memoizedState}function Wo(t,n,a,p){var w=mn();Ke.flags|=t,w.memoizedState=mi(1|n,{destroy:void 0},a,p===void 0?null:p)}function Vo(t,n,a,p){var w=Bt();p=p===void 0?null:p;var E=w.memoizedState.inst;gt!==null&&p!==null&&du(p,gt.memoizedState.deps)?w.memoizedState=mi(n,E,a,p):(Ke.flags|=t,w.memoizedState=mi(1|n,E,a,p))}function dm(t,n){Wo(8390656,8,t,n)}function _u(t,n){Vo(2048,8,t,n)}function tS(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Uo(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function hm(t){var n=Bt().memoizedState;return tS({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function fm(t,n){return Vo(4,2,t,n)}function pm(t,n){return Vo(4,4,t,n)}function mm(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 gm(t,n,a){a=a!=null?a.concat([t]):null,Vo(4,4,mm.bind(null,n,t),a)}function Su(){}function xm(t,n){var a=Bt();n=n===void 0?null:n;var p=a.memoizedState;return n!==null&&du(n,p[1])?p[0]:(a.memoizedState=[t,n],t)}function bm(t,n){var a=Bt();n=n===void 0?null:n;var p=a.memoizedState;if(n!==null&&du(n,p[1]))return p[0];if(p=t(),Es){ue(!0);try{t()}finally{ue(!1)}}return a.memoizedState=[p,n],p}function wu(t,n,a){return a===void 0||(_r&1073741824)!==0&&(nt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=vg(),Ke.lanes|=t,Zr|=t,a)}function vm(t,n,a,p){return En(a,n)?a:hi.current!==null?(t=wu(t,a,p),En(t,n)||(Ut=!0),t):(_r&42)===0||(_r&1073741824)!==0&&(nt&261930)===0?(Ut=!0,t.memoizedState=a):(t=vg(),Ke.lanes|=t,Zr|=t,n)}function ym(t,n,a,p,w){var E=Z.p;Z.p=E!==0&&8>E?E:8;var M=F.T,K={};F.T=K,Eu(t,!1,n,a);try{var J=w(),oe=F.S;if(oe!==null&&oe(K,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=X_(J,p);ha(t,n,he,Rn(t))}else ha(t,n,p,Rn(t))}catch(xe){ha(t,n,{then:function(){},status:"rejected",reason:xe},Rn())}finally{Z.p=E,M!==null&&K.types!==null&&(M.types=K.types),F.T=M}}function nS(){}function Cu(t,n,a,p){if(t.tag!==5)throw Error(i(476));var w=_m(t).queue;ym(t,w,n,Y,a===null?nS:function(){return Sm(t),a(p)})}function _m(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:Y},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Sm(t){var n=_m(t);n.next===null&&(n=t.alternate.memoizedState),ha(t,n.next.queue,{},Rn())}function ku(){return rn(Ta)}function wm(){return Bt().memoizedState}function Cm(){return Bt().memoizedState}function rS(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Rn();t=Wr(a);var p=Vr(n,t,a);p!==null&&(wn(p,n,a),oa(p,n,a)),n={cache:eu()},t.payload=n;return}n=n.return}}function sS(t,n,a){var p=Rn();a={lane:p,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Go(t)?Em(n,a):(a=$c(t,n,a,p),a!==null&&(wn(a,t,p),jm(a,n,p)))}function km(t,n,a){var p=Rn();ha(t,n,a,p)}function ha(t,n,a,p){var w={lane:p,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Go(t))Em(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var M=n.lastRenderedState,K=E(M,a);if(w.hasEagerState=!0,w.eagerState=K,En(K,M))return jo(t,n,w,0),vt===null&&Eo(),!1}catch{}finally{}if(a=$c(t,n,w,p),a!==null)return wn(a,t,p),jm(a,n,p),!0}return!1}function Eu(t,n,a,p){if(p={lane:2,revertLane:sd(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Go(t)){if(n)throw Error(i(479))}else n=$c(t,a,p,2),n!==null&&wn(n,t,2)}function Go(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function Em(t,n){fi=Ho=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function jm(t,n,a){if((a&4194048)!==0){var p=n.lanes;p&=t.pendingLanes,a|=p,n.lanes=a,Rf(t,a)}}var fa={readContext:rn,use:$o,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};fa.useEffectEvent=Rt;var Nm={readContext:rn,use:$o,useCallback:function(t,n){return mn().memoizedState=[t,n===void 0?null:n],t},useContext:rn,useEffect:dm,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Wo(4194308,4,mm.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Wo(4194308,4,t,n)},useInsertionEffect:function(t,n){Wo(4,2,t,n)},useMemo:function(t,n){var a=mn();n=n===void 0?null:n;var p=t();if(Es){ue(!0);try{t()}finally{ue(!1)}}return a.memoizedState=[p,n],p},useReducer:function(t,n,a){var p=mn();if(a!==void 0){var w=a(n);if(Es){ue(!0);try{a(n)}finally{ue(!1)}}}else w=n;return p.memoizedState=p.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},p.queue=t,t=t.dispatch=sS.bind(null,Ke,t),[p.memoizedState,t]},useRef:function(t){var n=mn();return t={current:t},n.memoizedState=t},useState:function(t){t=vu(t);var n=t.queue,a=km.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Su,useDeferredValue:function(t,n){var a=mn();return wu(a,t,n)},useTransition:function(){var t=vu(!1);return t=ym.bind(null,Ke,t.queue,!0,!1),mn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var p=Ke,w=mn();if(it){if(a===void 0)throw Error(i(407));a=a()}else{if(a=n(),vt===null)throw Error(i(349));(nt&127)!==0||Yp(p,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,dm(Zp.bind(null,p,E,t),[t]),p.flags|=2048,mi(9,{destroy:void 0},Xp.bind(null,p,E,a,n),null),a},useId:function(){var t=mn(),n=vt.identifierPrefix;if(it){var a=sr,p=rr;a=(p&~(1<<32-Ee(p)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Fo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Z_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:ku,useFormState:am,useActionState:am,useOptimistic:function(t){var n=mn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Eu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:gu,useCacheRefresh:function(){return mn().memoizedState=rS.bind(null,Ke)},useEffectEvent:function(t){var n=mn(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},ju={readContext:rn,use:$o,useCallback:xm,useContext:rn,useEffect:_u,useImperativeHandle:gm,useInsertionEffect:fm,useLayoutEffect:pm,useMemo:bm,useReducer:qo,useRef:um,useState:function(){return qo(Sr)},useDebugValue:Su,useDeferredValue:function(t,n){var a=Bt();return vm(a,gt.memoizedState,t,n)},useTransition:function(){var t=qo(Sr)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:da(t),n]},useSyncExternalStore:Kp,useId:wm,useHostTransitionStatus:ku,useFormState:om,useActionState:om,useOptimistic:function(t,n){var a=Bt();return em(a,gt,t,n)},useMemoCache:gu,useCacheRefresh:Cm};ju.useEffectEvent=hm;var Tm={readContext:rn,use:$o,useCallback:xm,useContext:rn,useEffect:_u,useImperativeHandle:gm,useInsertionEffect:fm,useLayoutEffect:pm,useMemo:bm,useReducer:bu,useRef:um,useState:function(){return bu(Sr)},useDebugValue:Su,useDeferredValue:function(t,n){var a=Bt();return gt===null?wu(a,t,n):vm(a,gt.memoizedState,t,n)},useTransition:function(){var t=bu(Sr)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:da(t),n]},useSyncExternalStore:Kp,useId:wm,useHostTransitionStatus:ku,useFormState:cm,useActionState:cm,useOptimistic:function(t,n){var a=Bt();return gt!==null?em(a,gt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:gu,useCacheRefresh:Cm};Tm.useEffectEvent=hm;function Nu(t,n,a,p){n=t.memoizedState,a=a(p,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Tu={enqueueSetState:function(t,n,a){t=t._reactInternals;var p=Rn(),w=Wr(p);w.payload=n,a!=null&&(w.callback=a),n=Vr(t,w,p),n!==null&&(wn(n,t,p),oa(n,t,p))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var p=Rn(),w=Wr(p);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Vr(t,w,p),n!==null&&(wn(n,t,p),oa(n,t,p))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Rn(),p=Wr(a);p.tag=2,n!=null&&(p.callback=n),n=Vr(t,p,a),n!==null&&(wn(n,t,a),oa(n,t,a))}};function Am(t,n,a,p,w,E,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(p,E,M):n.prototype&&n.prototype.isPureReactComponent?!Ji(a,p)||!Ji(w,E):!0}function Dm(t,n,a,p){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,p),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,p),n.state!==t&&Tu.enqueueReplaceState(n,n.state,null)}function js(t,n){var a=n;if("ref"in n){a={};for(var p in n)p!=="ref"&&(a[p]=n[p])}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 Rm(t){ko(t)}function Lm(t){console.error(t)}function Om(t){ko(t)}function Ko(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(p){setTimeout(function(){throw p})}}function Mm(t,n,a){try{var p=t.onCaughtError;p(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function Au(t,n,a){return a=Wr(a),a.tag=3,a.payload={element:null},a.callback=function(){Ko(t,n)},a}function Im(t){return t=Wr(t),t.tag=3,t}function Bm(t,n,a,p){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=p.value;t.payload=function(){return w(E)},t.callback=function(){Mm(n,a,p)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){Mm(n,a,p),typeof w!="function"&&(Qr===null?Qr=new Set([this]):Qr.add(this));var K=p.stack;this.componentDidCatch(p.value,{componentStack:K!==null?K:""})})}function iS(t,n,a,p,w){if(a.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(n=a.alternate,n!==null&&oi(n,a,w,!0),a=Nn.current,a!==null){switch(a.tag){case 31:case 13:return Vn===null?al():a.alternate===null&&Lt===0&&(Lt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,p===Mo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([p]):n.add(p),td(t,p,w)),!1;case 22:return a.flags|=65536,p===Mo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([p])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([p]):a.add(p)),td(t,p,w)),!1}throw Error(i(435,a.tag))}return td(t,p,w),al(),!1}if(it)return n=Nn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,p!==Yc&&(t=Error(i(422),{cause:p}),na(Un(t,a)))):(p!==Yc&&(n=Error(i(423),{cause:p}),na(Un(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,p=Un(p,a),w=Au(t.stateNode,p,w),au(t,w),Lt!==4&&(Lt=2)),!1;var E=Error(i(520),{cause:p});if(E=Un(E,a),_a===null?_a=[E]:_a.push(E),Lt!==4&&(Lt=2),n===null)return!0;p=Un(p,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=Au(a.stateNode,p,t),au(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=Im(w),Bm(w,t,a,p),au(a,w),!1}a=a.return}while(a!==null);return!1}var Du=Error(i(461)),Ut=!1;function sn(t,n,a,p){n.child=t===null?Fp(n,null,a,p):ks(n,t.child,a,p)}function zm(t,n,a,p,w){a=a.render;var E=n.ref;if("ref"in p){var M={};for(var K in p)K!=="ref"&&(M[K]=p[K])}else M=p;return _s(n),p=hu(t,n,a,M,E,w),K=fu(),t!==null&&!Ut?(pu(t,n,w),wr(t,n,w)):(it&&K&&Gc(n),n.flags|=1,sn(t,n,p,w),n.child)}function Pm(t,n,a,p,w){if(t===null){var E=a.type;return typeof E=="function"&&!qc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,Hm(t,n,E,p,w)):(t=To(a.type,null,p,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Pu(t,w)){var M=E.memoizedProps;if(a=a.compare,a=a!==null?a:Ji,a(M,p)&&t.ref===n.ref)return wr(t,n,w)}return n.flags|=1,t=xr(E,p),t.ref=n.ref,t.return=n,n.child=t}function Hm(t,n,a,p,w){if(t!==null){var E=t.memoizedProps;if(Ji(E,p)&&t.ref===n.ref)if(Ut=!1,n.pendingProps=p=E,Pu(t,w))(t.flags&131072)!==0&&(Ut=!0);else return n.lanes=t.lanes,wr(t,n,w)}return Ru(t,n,a,p,w)}function Fm(t,n,a,p){var w=p.children,E=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((n.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,t!==null){for(p=n.child=t.child,w=0;p!==null;)w=w|p.lanes|p.childLanes,p=p.sibling;p=w&~E}else p=0,n.child=null;return Um(t,n,E,a,p)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Lo(n,E!==null?E.cachePool:null),E!==null?qp(n,E):lu(),Wp(n);else return p=n.lanes=536870912,Um(t,n,E!==null?E.baseLanes|a:a,a,p)}else E!==null?(Lo(n,E.cachePool),qp(n,E),Kr(),n.memoizedState=null):(t!==null&&Lo(n,null),lu(),Kr());return sn(t,n,w,a),n.child}function pa(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Um(t,n,a,p,w){var E=nu();return E=E===null?null:{parent:Ht._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&Lo(n,null),lu(),Wp(n),t!==null&&oi(t,n,p,!0),n.childLanes=w,null}function Yo(t,n){return n=Zo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function $m(t,n,a){return ks(n,t.child,null,a),t=Yo(n,n.pendingProps),t.flags|=2,Tn(n),n.memoizedState=null,t}function aS(t,n,a){var p=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(p.mode==="hidden")return t=Yo(n,p),n.lanes=536870912,pa(null,t);if(uu(n),(t=St)?(t=tx(t,Wn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Hr!==null?{id:rr,overflow:sr}:null,retryLane:536870912,hydrationErrors:null},a=Ep(t),a.return=n,n.child=a,nn=n,St=null)):t=null,t===null)throw Ur(n);return n.lanes=536870912,null}return Yo(n,p)}var E=t.memoizedState;if(E!==null){var M=E.dehydrated;if(uu(n),w)if(n.flags&256)n.flags&=-257,n=$m(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(Ut||oi(t,n,a,!1),w=(a&t.childLanes)!==0,Ut||w){if(p=vt,p!==null&&(M=Lf(p,a),M!==0&&M!==E.retryLane))throw E.retryLane=M,xs(t,M),wn(p,t,M),Du;al(),n=$m(t,n,a)}else t=E.treeContext,St=Gn(M.nextSibling),nn=n,it=!0,Fr=null,Wn=!1,t!==null&&Tp(n,t),n=Yo(n,p),n.flags|=4096;return n}return t=xr(t.child,{mode:p.mode,children:p.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Xo(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(i(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Ru(t,n,a,p,w){return _s(n),a=hu(t,n,a,p,void 0,w),p=fu(),t!==null&&!Ut?(pu(t,n,w),wr(t,n,w)):(it&&p&&Gc(n),n.flags|=1,sn(t,n,a,w),n.child)}function qm(t,n,a,p,w,E){return _s(n),n.updateQueue=null,a=Gp(n,p,a,w),Vp(t),p=fu(),t!==null&&!Ut?(pu(t,n,E),wr(t,n,E)):(it&&p&&Gc(n),n.flags|=1,sn(t,n,a,E),n.child)}function Wm(t,n,a,p,w){if(_s(n),n.stateNode===null){var E=ri,M=a.contextType;typeof M=="object"&&M!==null&&(E=rn(M)),E=new a(p,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Tu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=p,E.state=n.memoizedState,E.refs={},su(n),M=a.contextType,E.context=typeof M=="object"&&M!==null?rn(M):ri,E.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(Nu(n,a,M,p),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(M=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),M!==E.state&&Tu.enqueueReplaceState(E,E.state,null),ca(n,p,E,w),la(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),p=!0}else if(t===null){E=n.stateNode;var K=n.memoizedProps,J=js(a,K);E.props=J;var oe=E.context,he=a.contextType;M=ri,typeof he=="object"&&he!==null&&(M=rn(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",K=n.pendingProps!==K,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(K||oe!==M)&&Dm(n,E,p,M),qr=!1;var le=n.memoizedState;E.state=le,ca(n,p,E,w),la(),oe=n.memoizedState,K||le!==oe||qr?(typeof xe=="function"&&(Nu(n,a,xe,p),oe=n.memoizedState),(J=qr||Am(n,a,J,p,le,oe,M))?(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=p,n.memoizedState=oe),E.props=p,E.state=oe,E.context=M,p=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),p=!1)}else{E=n.stateNode,iu(t,n),M=n.memoizedProps,he=js(a,M),E.props=he,xe=n.pendingProps,le=E.context,oe=a.contextType,J=ri,typeof oe=="object"&&oe!==null&&(J=rn(oe)),K=a.getDerivedStateFromProps,(oe=typeof K=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(M!==xe||le!==J)&&Dm(n,E,p,J),qr=!1,le=n.memoizedState,E.state=le,ca(n,p,E,w),la();var de=n.memoizedState;M!==xe||le!==de||qr||t!==null&&t.dependencies!==null&&Do(t.dependencies)?(typeof K=="function"&&(Nu(n,a,K,p),de=n.memoizedState),(he=qr||Am(n,a,he,p,le,de,J)||t!==null&&t.dependencies!==null&&Do(t.dependencies))?(oe||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(p,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(p,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&le===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&le===t.memoizedState||(n.flags|=1024),n.memoizedProps=p,n.memoizedState=de),E.props=p,E.state=de,E.context=J,p=he):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&le===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&le===t.memoizedState||(n.flags|=1024),p=!1)}return E=p,Xo(t,n),p=(n.flags&128)!==0,E||p?(E=n.stateNode,a=p&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&p?(n.child=ks(n,t.child,null,w),n.child=ks(n,null,a,w)):sn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=wr(t,n,w),t}function Vm(t,n,a,p){return vs(),n.flags|=256,sn(t,n,a,p),n.child}var Lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ou(t){return{baseLanes:t,cachePool:Mp()}}function Mu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=Dn),t}function Gm(t,n,a){var p=n.pendingProps,w=!1,E=(n.flags&128)!==0,M;if((M=E)||(M=t!==null&&t.memoizedState===null?!1:(It.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?Gr(n):Kr(),(t=St)?(t=tx(t,Wn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Hr!==null?{id:rr,overflow:sr}:null,retryLane:536870912,hydrationErrors:null},a=Ep(t),a.return=n,n.child=a,nn=n,St=null)):t=null,t===null)throw Ur(n);return xd(t)?n.lanes=32:n.lanes=536870912,null}var K=p.children;return p=p.fallback,w?(Kr(),w=n.mode,K=Zo({mode:"hidden",children:K},w),p=bs(p,w,a,null),K.return=n,p.return=n,K.sibling=p,n.child=K,p=n.child,p.memoizedState=Ou(a),p.childLanes=Mu(t,M,a),n.memoizedState=Lu,pa(null,p)):(Gr(n),Iu(n,K))}var J=t.memoizedState;if(J!==null&&(K=J.dehydrated,K!==null)){if(E)n.flags&256?(Gr(n),n.flags&=-257,n=Bu(t,n,a)):n.memoizedState!==null?(Kr(),n.child=t.child,n.flags|=128,n=null):(Kr(),K=p.fallback,w=n.mode,p=Zo({mode:"visible",children:p.children},w),K=bs(K,w,a,null),K.flags|=2,p.return=n,K.return=n,p.sibling=K,n.child=p,ks(n,t.child,null,a),p=n.child,p.memoizedState=Ou(a),p.childLanes=Mu(t,M,a),n.memoizedState=Lu,n=pa(null,p));else if(Gr(n),xd(K)){if(M=K.nextSibling&&K.nextSibling.dataset,M)var oe=M.dgst;M=oe,p=Error(i(419)),p.stack="",p.digest=M,na({value:p,source:null,stack:null}),n=Bu(t,n,a)}else if(Ut||oi(t,n,a,!1),M=(a&t.childLanes)!==0,Ut||M){if(M=vt,M!==null&&(p=Lf(M,a),p!==0&&p!==J.retryLane))throw J.retryLane=p,xs(t,p),wn(M,t,p),Du;gd(K)||al(),n=Bu(t,n,a)}else gd(K)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,St=Gn(K.nextSibling),nn=n,it=!0,Fr=null,Wn=!1,t!==null&&Tp(n,t),n=Iu(n,p.children),n.flags|=4096);return n}return w?(Kr(),K=p.fallback,w=n.mode,J=t.child,oe=J.sibling,p=xr(J,{mode:"hidden",children:p.children}),p.subtreeFlags=J.subtreeFlags&65011712,oe!==null?K=xr(oe,K):(K=bs(K,w,a,null),K.flags|=2),K.return=n,p.return=n,p.sibling=K,n.child=p,pa(null,p),p=n.child,K=t.child.memoizedState,K===null?K=Ou(a):(w=K.cachePool,w!==null?(J=Ht._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=Mp(),K={baseLanes:K.baseLanes|a,cachePool:w}),p.memoizedState=K,p.childLanes=Mu(t,M,a),n.memoizedState=Lu,pa(t.child,p)):(Gr(n),a=t.child,t=a.sibling,a=xr(a,{mode:"visible",children:p.children}),a.return=n,a.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=a,n.memoizedState=null,a)}function Iu(t,n){return n=Zo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Zo(t,n){return t=jn(22,t,null,n),t.lanes=0,t}function Bu(t,n,a){return ks(n,t.child,null,a),t=Iu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Km(t,n,a){t.lanes|=n;var p=t.alternate;p!==null&&(p.lanes|=n),Qc(t.return,n,a)}function zu(t,n,a,p,w,E){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:p,tail:a,tailMode:w,treeForkCount:E}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=p,M.tail=a,M.tailMode=w,M.treeForkCount=E)}function Ym(t,n,a){var p=n.pendingProps,w=p.revealOrder,E=p.tail;p=p.children;var M=It.current,K=(M&2)!==0;if(K?(M=M&1|2,n.flags|=128):M&=1,U(It,M),sn(t,n,p,a),p=it?ta:0,!K&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Km(t,a,n);else if(t.tag===19)Km(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&&Po(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),zu(n,!1,w,a,E,p);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Po(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}zu(n,!0,a,null,E,p);break;case"together":zu(n,!1,null,null,void 0,p);break;default:n.memoizedState=null}return n.child}function wr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Zr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(oi(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,a=xr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=xr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Pu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Do(t)))}function oS(t,n,a){switch(n.tag){case 3:V(n,n.stateNode.containerInfo),$r(n,Ht,t.memoizedState.cache),vs();break;case 27:case 5:re(n);break;case 4:V(n,n.stateNode.containerInfo);break;case 10:$r(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,uu(n),null;break;case 13:var p=n.memoizedState;if(p!==null)return p.dehydrated!==null?(Gr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Gm(t,n,a):(Gr(n),t=wr(t,n,a),t!==null?t.sibling:null);Gr(n);break;case 19:var w=(t.flags&128)!==0;if(p=(a&n.childLanes)!==0,p||(oi(t,n,a,!1),p=(a&n.childLanes)!==0),w){if(p)return Ym(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),U(It,It.current),p)break;return null;case 22:return n.lanes=0,Fm(t,n,a,n.pendingProps);case 24:$r(n,Ht,t.memoizedState.cache)}return wr(t,n,a)}function Xm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ut=!0;else{if(!Pu(t,a)&&(n.flags&128)===0)return Ut=!1,oS(t,n,a);Ut=(t.flags&131072)!==0}else Ut=!1,it&&(n.flags&1048576)!==0&&Np(n,ta,n.index);switch(n.lanes=0,n.tag){case 16:e:{var p=n.pendingProps;if(t=ws(n.elementType),n.type=t,typeof t=="function")qc(t)?(p=js(t,p),n.tag=1,n=Wm(null,n,t,p,a)):(n.tag=0,n=Ru(null,n,t,p,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=zm(null,n,t,p,a);break e}else if(w===D){n.tag=14,n=Pm(null,n,t,p,a);break e}}throw n=G(t)||t,Error(i(306,n,""))}}return n;case 0:return Ru(t,n,n.type,n.pendingProps,a);case 1:return p=n.type,w=js(p,n.pendingProps),Wm(t,n,p,w,a);case 3:e:{if(V(n,n.stateNode.containerInfo),t===null)throw Error(i(387));p=n.pendingProps;var E=n.memoizedState;w=E.element,iu(t,n),ca(n,p,null,a);var M=n.memoizedState;if(p=M.cache,$r(n,Ht,p),p!==E.cache&&Jc(n,[Ht],a,!0),la(),p=M.element,E.isDehydrated)if(E={element:p,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=Vm(t,n,p,a);break e}else if(p!==w){w=Un(Error(i(424)),n),na(w),n=Vm(t,n,p,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(St=Gn(t.firstChild),nn=n,it=!0,Fr=null,Wn=!0,a=Fp(n,null,p,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(vs(),p===w){n=wr(t,n,a);break e}sn(t,n,p,a)}n=n.child}return n;case 26:return Xo(t,n),t===null?(a=ox(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,p=fl(ee.current).createElement(a),p[tn]=n,p[xn]=t,an(p,a,t),Xt(p),n.stateNode=p):n.memoizedState=ox(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&it&&(p=n.stateNode=sx(n.type,n.pendingProps,ee.current),nn=n,Wn=!0,w=St,ns(n.type)?(bd=w,St=Gn(p.firstChild)):St=w),sn(t,n,n.pendingProps.children,a),Xo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=p=St)&&(p=BS(p,n.type,n.pendingProps,Wn),p!==null?(n.stateNode=p,nn=n,St=Gn(p.firstChild),Wn=!1,w=!0):w=!1),w||Ur(n)),re(n),w=n.type,E=n.pendingProps,M=t!==null?t.memoizedProps:null,p=E.children,fd(w,E)?p=null:M!==null&&fd(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=hu(t,n,Q_,null,null,a),Ta._currentValue=w),Xo(t,n),sn(t,n,p,a),n.child;case 6:return t===null&&it&&((t=a=St)&&(a=zS(a,n.pendingProps,Wn),a!==null?(n.stateNode=a,nn=n,St=null,t=!0):t=!1),t||Ur(n)),null;case 13:return Gm(t,n,a);case 4:return V(n,n.stateNode.containerInfo),p=n.pendingProps,t===null?n.child=ks(n,null,p,a):sn(t,n,p,a),n.child;case 11:return zm(t,n,n.type,n.pendingProps,a);case 7:return sn(t,n,n.pendingProps,a),n.child;case 8:return sn(t,n,n.pendingProps.children,a),n.child;case 12:return sn(t,n,n.pendingProps.children,a),n.child;case 10:return p=n.pendingProps,$r(n,n.type,p.value),sn(t,n,p.children,a),n.child;case 9:return w=n.type._context,p=n.pendingProps.children,_s(n),w=rn(w),p=p(w),n.flags|=1,sn(t,n,p,a),n.child;case 14:return Pm(t,n,n.type,n.pendingProps,a);case 15:return Hm(t,n,n.type,n.pendingProps,a);case 19:return Ym(t,n,a);case 31:return aS(t,n,a);case 22:return Fm(t,n,a,n.pendingProps);case 24:return _s(n),p=rn(Ht),t===null?(w=nu(),w===null&&(w=vt,E=eu(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:p,cache:w},su(n),$r(n,Ht,w)):((t.lanes&a)!==0&&(iu(t,n),ca(n,null,null,a),la()),w=t.memoizedState,E=n.memoizedState,w.parent!==p?(w={parent:p,cache:p},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),$r(n,Ht,p)):(p=E.cache,$r(n,Ht,p),p!==w.cache&&Jc(n,[Ht],a,!0))),sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function Cr(t){t.flags|=4}function Hu(t,n,a,p,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(wg())t.flags|=8192;else throw Cs=Mo,ru}else t.flags&=-16777217}function Zm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!hx(n))if(wg())t.flags|=8192;else throw Cs=Mo,ru}function Qo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Pt():536870912,t.lanes|=n,vi|=n)}function ma(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 p=null;a!==null;)a.alternate!==null&&(p=a),a=a.sibling;p===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:p.sibling=null}}function wt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,p=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,p|=w.subtreeFlags&65011712,p|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,p|=w.subtreeFlags,p|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=p,t.childLanes=a,n}function lS(t,n,a){var p=n.pendingProps;switch(Kc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(n),null;case 1:return wt(n),null;case 3:return a=n.stateNode,p=null,t!==null&&(p=t.memoizedState.cache),n.memoizedState.cache!==p&&(n.flags|=2048),yr(Ht),ie(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(ai(n)?Cr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Xc())),wt(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(Cr(n),E!==null?(wt(n),Zm(n,E)):(wt(n),Hu(n,w,null,p,a))):E?E!==t.memoizedState?(Cr(n),wt(n),Zm(n,E)):(wt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==p&&Cr(n),wt(n),Hu(n,w,t,p,a)),null;case 27:if(be(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==p&&Cr(n);else{if(!p){if(n.stateNode===null)throw Error(i(166));return wt(n),null}t=ne.current,ai(n)?Ap(n):(t=sx(w,p,a),n.stateNode=t,Cr(n))}return wt(n),null;case 5:if(be(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==p&&Cr(n);else{if(!p){if(n.stateNode===null)throw Error(i(166));return wt(n),null}if(E=ne.current,ai(n))Ap(n);else{var M=fl(ee.current);switch(E){case 1:E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=M.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof p.is=="string"?M.createElement("select",{is:p.is}):M.createElement("select"),p.multiple?E.multiple=!0:p.size&&(E.size=p.size);break;default:E=typeof p.is=="string"?M.createElement(w,{is:p.is}):M.createElement(w)}}E[tn]=n,E[xn]=p;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)E.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===n)break e;for(;M.sibling===null;){if(M.return===null||M.return===n)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}n.stateNode=E;e:switch(an(E,w,p),w){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Cr(n)}}return wt(n),Hu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==p&&Cr(n);else{if(typeof p!="string"&&n.stateNode===null)throw Error(i(166));if(t=ee.current,ai(n)){if(t=n.stateNode,a=n.memoizedProps,p=null,w=nn,w!==null)switch(w.tag){case 27:case 5:p=w.memoizedProps}t[tn]=n,t=!!(t.nodeValue===a||p!==null&&p.suppressHydrationWarning===!0||Gg(t.nodeValue,a)),t||Ur(n,!0)}else t=fl(t).createTextNode(p),t[tn]=n,n.stateNode=t}return wt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(p=ai(n),a!==null){if(t===null){if(!p)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[tn]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),t=!1}else a=Xc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Tn(n),n):(Tn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return wt(n),null;case 13:if(p=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=ai(n),p!==null&&p.dehydrated!==null){if(t===null){if(!w)throw Error(i(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(i(317));w[tn]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),w=!1}else w=Xc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(Tn(n),n):(Tn(n),null)}return Tn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=p!==null,t=t!==null&&t.memoizedState!==null,a&&(p=n.child,w=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(w=p.alternate.memoizedState.cachePool.pool),E=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(E=p.memoizedState.cachePool.pool),E!==w&&(p.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Qo(n,n.updateQueue),wt(n),null);case 4:return ie(),t===null&&ld(n.stateNode.containerInfo),wt(n),null;case 10:return yr(n.type),wt(n),null;case 19:if($(It),p=n.memoizedState,p===null)return wt(n),null;if(w=(n.flags&128)!==0,E=p.rendering,E===null)if(w)ma(p,!1);else{if(Lt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=Po(t),E!==null){for(n.flags|=128,ma(p,!1),t=E.updateQueue,n.updateQueue=t,Qo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)kp(a,t),a=a.sibling;return U(It,It.current&1|2),it&&br(n,p.treeForkCount),n.child}t=t.sibling}p.tail!==null&&Me()>rl&&(n.flags|=128,w=!0,ma(p,!1),n.lanes=4194304)}else{if(!w)if(t=Po(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Qo(n,t),ma(p,!0),p.tail===null&&p.tailMode==="hidden"&&!E.alternate&&!it)return wt(n),null}else 2*Me()-p.renderingStartTime>rl&&a!==536870912&&(n.flags|=128,w=!0,ma(p,!1),n.lanes=4194304);p.isBackwards?(E.sibling=n.child,n.child=E):(t=p.last,t!==null?t.sibling=E:n.child=E,p.last=E)}return p.tail!==null?(t=p.tail,p.rendering=t,p.tail=t.sibling,p.renderingStartTime=Me(),t.sibling=null,a=It.current,U(It,w?a&1|2:a&1),it&&br(n,p.treeForkCount),t):(wt(n),null);case 22:case 23:return Tn(n),cu(),p=n.memoizedState!==null,t!==null?t.memoizedState!==null!==p&&(n.flags|=8192):p&&(n.flags|=8192),p?(a&536870912)!==0&&(n.flags&128)===0&&(wt(n),n.subtreeFlags&6&&(n.flags|=8192)):wt(n),a=n.updateQueue,a!==null&&Qo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),p=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(p=n.memoizedState.cachePool.pool),p!==a&&(n.flags|=2048),t!==null&&$(Ss),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),yr(Ht),wt(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function cS(t,n){switch(Kc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return yr(Ht),ie(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return be(n),null;case 31:if(n.memoizedState!==null){if(Tn(n),n.alternate===null)throw Error(i(340));vs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Tn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));vs()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return $(It),null;case 4:return ie(),null;case 10:return yr(n.type),null;case 22:case 23:return Tn(n),cu(),t!==null&&$(Ss),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return yr(Ht),null;case 25:return null;default:return null}}function Qm(t,n){switch(Kc(n),n.tag){case 3:yr(Ht),ie();break;case 26:case 27:case 5:be(n);break;case 4:ie();break;case 31:n.memoizedState!==null&&Tn(n);break;case 13:Tn(n);break;case 19:$(It);break;case 10:yr(n.type);break;case 22:case 23:Tn(n),cu(),t!==null&&$(Ss);break;case 24:yr(Ht)}}function ga(t,n){try{var a=n.updateQueue,p=a!==null?a.lastEffect:null;if(p!==null){var w=p.next;a=w;do{if((a.tag&t)===t){p=void 0;var E=a.create,M=a.inst;p=E(),M.destroy=p}a=a.next}while(a!==w)}}catch(K){pt(n,n.return,K)}}function Yr(t,n,a){try{var p=n.updateQueue,w=p!==null?p.lastEffect:null;if(w!==null){var E=w.next;p=E;do{if((p.tag&t)===t){var M=p.inst,K=M.destroy;if(K!==void 0){M.destroy=void 0,w=n;var J=a,oe=K;try{oe()}catch(he){pt(w,J,he)}}}p=p.next}while(p!==E)}}catch(he){pt(n,n.return,he)}}function Jm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{$p(n,a)}catch(p){pt(t,t.return,p)}}}function eg(t,n,a){a.props=js(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(p){pt(t,n,p)}}function xa(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var p=t.stateNode;break;case 30:p=t.stateNode;break;default:p=t.stateNode}typeof a=="function"?t.refCleanup=a(p):a.current=p}}catch(w){pt(t,n,w)}}function ir(t,n){var a=t.ref,p=t.refCleanup;if(a!==null)if(typeof p=="function")try{p()}catch(w){pt(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){pt(t,n,w)}else a.current=null}function tg(t){var n=t.type,a=t.memoizedProps,p=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&p.focus();break e;case"img":a.src?p.src=a.src:a.srcSet&&(p.srcset=a.srcSet)}}catch(w){pt(t,t.return,w)}}function Fu(t,n,a){try{var p=t.stateNode;DS(p,t.type,a,n),p[xn]=n}catch(w){pt(t,t.return,w)}}function ng(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ns(t.type)||t.tag===4}function Uu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ng(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&&ns(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 $u(t,n,a){var p=t.tag;if(p===5||p===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=mr));else if(p!==4&&(p===27&&ns(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for($u(t,n,a),t=t.sibling;t!==null;)$u(t,n,a),t=t.sibling}function Jo(t,n,a){var p=t.tag;if(p===5||p===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(p!==4&&(p===27&&ns(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Jo(t,n,a),t=t.sibling;t!==null;)Jo(t,n,a),t=t.sibling}function rg(t){var n=t.stateNode,a=t.memoizedProps;try{for(var p=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);an(n,p,a),n[tn]=t,n[xn]=a}catch(E){pt(t,t.return,E)}}var kr=!1,$t=!1,qu=!1,sg=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function uS(t,n){if(t=t.containerInfo,dd=yl,t=gp(t),Bc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var p=a.getSelection&&a.getSelection();if(p&&p.rangeCount!==0){a=p.anchorNode;var w=p.anchorOffset,E=p.focusNode;p=p.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var M=0,K=-1,J=-1,oe=0,he=0,xe=t,le=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(K=M+w),xe!==E||p!==0&&xe.nodeType!==3||(J=M+p),xe.nodeType===3&&(M+=xe.nodeValue.length),(de=xe.firstChild)!==null;)le=xe,xe=de;for(;;){if(xe===t)break t;if(le===a&&++oe===w&&(K=M),le===E&&++he===p&&(J=M),(de=xe.nextSibling)!==null)break;xe=le,le=xe.parentNode}xe=de}a=K===-1||J===-1?null:{start:K,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(hd={focusedElem:t,selectionRange:a},yl=!1,Zt=n;Zt!==null;)if(n=Zt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Zt=t;else for(;Zt!==null;){switch(n=Zt,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,p=a.stateNode;try{var De=js(a.type,w);t=p.getSnapshotBeforeUpdate(De,E),p.__reactInternalSnapshotBeforeUpdate=t}catch(He){pt(a,a.return,He)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)md(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":md(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(i(163))}if(t=n.sibling,t!==null){t.return=n.return,Zt=t;break}Zt=n.return}}function ig(t,n,a){var p=a.flags;switch(a.tag){case 0:case 11:case 15:jr(t,a),p&4&&ga(5,a);break;case 1:if(jr(t,a),p&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){pt(a,a.return,M)}else{var w=js(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){pt(a,a.return,M)}}p&64&&Jm(a),p&512&&xa(a,a.return);break;case 3:if(jr(t,a),p&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{$p(t,n)}catch(M){pt(a,a.return,M)}}break;case 27:n===null&&p&4&&rg(a);case 26:case 5:jr(t,a),n===null&&p&4&&tg(a),p&512&&xa(a,a.return);break;case 12:jr(t,a);break;case 31:jr(t,a),p&4&&lg(t,a);break;case 13:jr(t,a),p&4&&cg(t,a),p&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=vS.bind(null,a),PS(t,a))));break;case 22:if(p=a.memoizedState!==null||kr,!p){n=n!==null&&n.memoizedState!==null||$t,w=kr;var E=$t;kr=p,($t=n)&&!E?Nr(t,a,(a.subtreeFlags&8772)!==0):jr(t,a),kr=w,$t=E}break;case 30:break;default:jr(t,a)}}function ag(t){var n=t.alternate;n!==null&&(t.alternate=null,ag(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&yc(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 Et=null,vn=!1;function Er(t,n,a){for(a=a.child;a!==null;)og(t,n,a),a=a.sibling}function og(t,n,a){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(Mt,a)}catch{}switch(a.tag){case 26:$t||ir(a,n),Er(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:$t||ir(a,n);var p=Et,w=vn;ns(a.type)&&(Et=a.stateNode,vn=!1),Er(t,n,a),Ea(a.stateNode),Et=p,vn=w;break;case 5:$t||ir(a,n);case 6:if(p=Et,w=vn,Et=null,Er(t,n,a),Et=p,vn=w,Et!==null)if(vn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(a.stateNode)}catch(E){pt(a,n,E)}else try{Et.removeChild(a.stateNode)}catch(E){pt(a,n,E)}break;case 18:Et!==null&&(vn?(t=Et,Jg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ji(t)):Jg(Et,a.stateNode));break;case 4:p=Et,w=vn,Et=a.stateNode.containerInfo,vn=!0,Er(t,n,a),Et=p,vn=w;break;case 0:case 11:case 14:case 15:Yr(2,a,n),$t||Yr(4,a,n),Er(t,n,a);break;case 1:$t||(ir(a,n),p=a.stateNode,typeof p.componentWillUnmount=="function"&&eg(a,n,p)),Er(t,n,a);break;case 21:Er(t,n,a);break;case 22:$t=(p=$t)||a.memoizedState!==null,Er(t,n,a),$t=p;break;default:Er(t,n,a)}}function lg(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ji(t)}catch(a){pt(n,n.return,a)}}}function cg(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ji(t)}catch(a){pt(n,n.return,a)}}function dS(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new sg),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new sg),n;default:throw Error(i(435,t.tag))}}function el(t,n){var a=dS(t);n.forEach(function(p){if(!a.has(p)){a.add(p);var w=yS.bind(null,t,p);p.then(w,w)}})}function yn(t,n){var a=n.deletions;if(a!==null)for(var p=0;p<a.length;p++){var w=a[p],E=t,M=n,K=M;e:for(;K!==null;){switch(K.tag){case 27:if(ns(K.type)){Et=K.stateNode,vn=!1;break e}break;case 5:Et=K.stateNode,vn=!1;break e;case 3:case 4:Et=K.stateNode.containerInfo,vn=!0;break e}K=K.return}if(Et===null)throw Error(i(160));og(E,M,w),Et=null,vn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)ug(n,t),n=n.sibling}var Zn=null;function ug(t,n){var a=t.alternate,p=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:yn(n,t),_n(t),p&4&&(Yr(3,t,t.return),ga(3,t),Yr(5,t,t.return));break;case 1:yn(n,t),_n(t),p&512&&($t||a===null||ir(a,a.return)),p&64&&kr&&(t=t.updateQueue,t!==null&&(p=t.callbacks,p!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?p:a.concat(p))));break;case 26:var w=Zn;if(yn(n,t),_n(t),p&512&&($t||a===null||ir(a,a.return)),p&4){var E=a!==null?a.memoizedState:null;if(p=t.memoizedState,a===null)if(p===null)if(t.stateNode===null){e:{p=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(p){case"title":E=w.getElementsByTagName("title")[0],(!E||E[qi]||E[tn]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(p),w.head.insertBefore(E,w.querySelector("head > title"))),an(E,p,a),E[tn]=t,Xt(E),p=E;break e;case"link":var M=ux("link","href",w).get(p+(a.href||""));if(M){for(var K=0;K<M.length;K++)if(E=M[K],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)){M.splice(K,1);break t}}E=w.createElement(p),an(E,p,a),w.head.appendChild(E);break;case"meta":if(M=ux("meta","content",w).get(p+(a.content||""))){for(K=0;K<M.length;K++)if(E=M[K],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)){M.splice(K,1);break t}}E=w.createElement(p),an(E,p,a),w.head.appendChild(E);break;default:throw Error(i(468,p))}E[tn]=t,Xt(E),p=E}t.stateNode=p}else dx(w,t.type,t.stateNode);else t.stateNode=cx(w,p,t.memoizedProps);else E!==p?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,p===null?dx(w,t.type,t.stateNode):cx(w,p,t.memoizedProps)):p===null&&t.stateNode!==null&&Fu(t,t.memoizedProps,a.memoizedProps)}break;case 27:yn(n,t),_n(t),p&512&&($t||a===null||ir(a,a.return)),a!==null&&p&4&&Fu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(yn(n,t),_n(t),p&512&&($t||a===null||ir(a,a.return)),t.flags&32){w=t.stateNode;try{Xs(w,"")}catch(De){pt(t,t.return,De)}}p&4&&t.stateNode!=null&&(w=t.memoizedProps,Fu(t,w,a!==null?a.memoizedProps:w)),p&1024&&(qu=!0);break;case 6:if(yn(n,t),_n(t),p&4){if(t.stateNode===null)throw Error(i(162));p=t.memoizedProps,a=t.stateNode;try{a.nodeValue=p}catch(De){pt(t,t.return,De)}}break;case 3:if(gl=null,w=Zn,Zn=pl(n.containerInfo),yn(n,t),Zn=w,_n(t),p&4&&a!==null&&a.memoizedState.isDehydrated)try{ji(n.containerInfo)}catch(De){pt(t,t.return,De)}qu&&(qu=!1,dg(t));break;case 4:p=Zn,Zn=pl(t.stateNode.containerInfo),yn(n,t),_n(t),Zn=p;break;case 12:yn(n,t),_n(t);break;case 31:yn(n,t),_n(t),p&4&&(p=t.updateQueue,p!==null&&(t.updateQueue=null,el(t,p)));break;case 13:yn(n,t),_n(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(nl=Me()),p&4&&(p=t.updateQueue,p!==null&&(t.updateQueue=null,el(t,p)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,oe=kr,he=$t;if(kr=oe||w,$t=he||J,yn(n,t),$t=he,kr=oe,_n(t),p&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||kr||$t||Ns(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)M=E.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{K=J.stateNode;var xe=J.memoizedProps.style,le=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;K.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(De){pt(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){pt(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?ex(de,!0):ex(J.stateNode,!1)}catch(De){pt(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}p&4&&(p=t.updateQueue,p!==null&&(a=p.retryQueue,a!==null&&(p.retryQueue=null,el(t,a))));break;case 19:yn(n,t),_n(t),p&4&&(p=t.updateQueue,p!==null&&(t.updateQueue=null,el(t,p)));break;case 30:break;case 21:break;default:yn(n,t),_n(t)}}function _n(t){var n=t.flags;if(n&2){try{for(var a,p=t.return;p!==null;){if(ng(p)){a=p;break}p=p.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var w=a.stateNode,E=Uu(t);Jo(t,E,w);break;case 5:var M=a.stateNode;a.flags&32&&(Xs(M,""),a.flags&=-33);var K=Uu(t);Jo(t,K,M);break;case 3:case 4:var J=a.stateNode.containerInfo,oe=Uu(t);$u(t,oe,J);break;default:throw Error(i(161))}}catch(he){pt(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function dg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;dg(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function jr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)ig(t,n.alternate,n),n=n.sibling}function Ns(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Yr(4,n,n.return),Ns(n);break;case 1:ir(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&eg(n,n.return,a),Ns(n);break;case 27:Ea(n.stateNode);case 26:case 5:ir(n,n.return),Ns(n);break;case 22:n.memoizedState===null&&Ns(n);break;case 30:Ns(n);break;default:Ns(n)}t=t.sibling}}function Nr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var p=n.alternate,w=t,E=n,M=E.flags;switch(E.tag){case 0:case 11:case 15:Nr(w,E,a),ga(4,E);break;case 1:if(Nr(w,E,a),p=E,w=p.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(oe){pt(p,p.return,oe)}if(p=E,w=p.updateQueue,w!==null){var K=p.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)Up(J[w],K)}catch(oe){pt(p,p.return,oe)}}a&&M&64&&Jm(E),xa(E,E.return);break;case 27:rg(E);case 26:case 5:Nr(w,E,a),a&&p===null&&M&4&&tg(E),xa(E,E.return);break;case 12:Nr(w,E,a);break;case 31:Nr(w,E,a),a&&M&4&&lg(w,E);break;case 13:Nr(w,E,a),a&&M&4&&cg(w,E);break;case 22:E.memoizedState===null&&Nr(w,E,a),xa(E,E.return);break;case 30:break;default:Nr(w,E,a)}n=n.sibling}}function Wu(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&&ra(a))}function Vu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&ra(t))}function Qn(t,n,a,p){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)hg(t,n,a,p),n=n.sibling}function hg(t,n,a,p){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Qn(t,n,a,p),w&2048&&ga(9,n);break;case 1:Qn(t,n,a,p);break;case 3:Qn(t,n,a,p),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&ra(t)));break;case 12:if(w&2048){Qn(t,n,a,p),t=n.stateNode;try{var E=n.memoizedProps,M=E.id,K=E.onPostCommit;typeof K=="function"&&K(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){pt(n,n.return,J)}}else Qn(t,n,a,p);break;case 31:Qn(t,n,a,p);break;case 13:Qn(t,n,a,p);break;case 23:break;case 22:E=n.stateNode,M=n.alternate,n.memoizedState!==null?E._visibility&2?Qn(t,n,a,p):ba(t,n):E._visibility&2?Qn(t,n,a,p):(E._visibility|=2,gi(t,n,a,p,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Wu(M,n);break;case 24:Qn(t,n,a,p),w&2048&&Vu(n.alternate,n);break;default:Qn(t,n,a,p)}}function gi(t,n,a,p,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,M=n,K=a,J=p,oe=M.flags;switch(M.tag){case 0:case 11:case 15:gi(E,M,K,J,w),ga(8,M);break;case 23:break;case 22:var he=M.stateNode;M.memoizedState!==null?he._visibility&2?gi(E,M,K,J,w):ba(E,M):(he._visibility|=2,gi(E,M,K,J,w)),w&&oe&2048&&Wu(M.alternate,M);break;case 24:gi(E,M,K,J,w),w&&oe&2048&&Vu(M.alternate,M);break;default:gi(E,M,K,J,w)}n=n.sibling}}function ba(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,p=n,w=p.flags;switch(p.tag){case 22:ba(a,p),w&2048&&Wu(p.alternate,p);break;case 24:ba(a,p),w&2048&&Vu(p.alternate,p);break;default:ba(a,p)}n=n.sibling}}var va=8192;function xi(t,n,a){if(t.subtreeFlags&va)for(t=t.child;t!==null;)fg(t,n,a),t=t.sibling}function fg(t,n,a){switch(t.tag){case 26:xi(t,n,a),t.flags&va&&t.memoizedState!==null&&ZS(a,Zn,t.memoizedState,t.memoizedProps);break;case 5:xi(t,n,a);break;case 3:case 4:var p=Zn;Zn=pl(t.stateNode.containerInfo),xi(t,n,a),Zn=p;break;case 22:t.memoizedState===null&&(p=t.alternate,p!==null&&p.memoizedState!==null?(p=va,va=16777216,xi(t,n,a),va=p):xi(t,n,a));break;default:xi(t,n,a)}}function pg(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 ya(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var p=n[a];Zt=p,gg(p,t)}pg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mg(t),t=t.sibling}function mg(t){switch(t.tag){case 0:case 11:case 15:ya(t),t.flags&2048&&Yr(9,t,t.return);break;case 3:ya(t);break;case 12:ya(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,tl(t)):ya(t);break;default:ya(t)}}function tl(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var p=n[a];Zt=p,gg(p,t)}pg(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Yr(8,n,n.return),tl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,tl(n));break;default:tl(n)}t=t.sibling}}function gg(t,n){for(;Zt!==null;){var a=Zt;switch(a.tag){case 0:case 11:case 15:Yr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var p=a.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:ra(a.memoizedState.cache)}if(p=a.child,p!==null)p.return=a,Zt=p;else e:for(a=t;Zt!==null;){p=Zt;var w=p.sibling,E=p.return;if(ag(p),p===a){Zt=null;break e}if(w!==null){w.return=E,Zt=w;break e}Zt=E}}}var hS={getCacheForType:function(t){var n=rn(Ht),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return rn(Ht).controller.signal}},fS=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Je=null,nt=0,ft=0,An=null,Xr=!1,bi=!1,Gu=!1,Tr=0,Lt=0,Zr=0,Ts=0,Ku=0,Dn=0,vi=0,_a=null,Sn=null,Yu=!1,nl=0,xg=0,rl=1/0,sl=null,Qr=null,Kt=0,Jr=null,yi=null,Ar=0,Xu=0,Zu=null,bg=null,Sa=0,Qu=null;function Rn(){return(dt&2)!==0&&nt!==0?nt&-nt:F.T!==null?sd():Of()}function vg(){if(Dn===0)if((nt&536870912)===0||it){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),Dn=t}else Dn=536870912;return t=Nn.current,t!==null&&(t.flags|=32),Dn}function wn(t,n,a){(t===vt&&(ft===2||ft===9)||t.cancelPendingCommit!==null)&&(_i(t,0),es(t,nt,Dn,!1)),$s(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ts|=a),Lt===4&&es(t,nt,Dn,!1)),ar(t))}function yg(t,n,a){if((dt&6)!==0)throw Error(i(327));var p=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Fe(t,n),w=p?gS(t,n):ed(t,n,!0),E=p;do{if(w===0){bi&&!p&&es(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!pS(a)){w=ed(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var K=t;w=_a;var J=K.current.memoizedState.isDehydrated;if(J&&(_i(K,M).flags|=256),M=ed(K,M,!1),M!==2){if(Gu&&!J){K.errorRecoveryDisabledLanes|=E,Ts|=E,w=4;break e}E=Sn,Sn=w,E!==null&&(Sn===null?Sn=E:Sn.push.apply(Sn,E))}w=M}if(E=!1,w!==2)continue}}if(w===1){_i(t,0),es(t,n,0,!0);break}e:{switch(p=t,E=w,E){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n)break;case 6:es(p,n,Dn,!Xr);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(w=nl+300-Me(),10<w)){if(es(p,n,Dn,!Xr),st(p,0,!0)!==0)break e;Ar=n,p.timeoutHandle=Zg(_g.bind(null,p,a,Sn,sl,Yu,n,Dn,Ts,vi,Xr,E,"Throttled",-0,0),w);break e}_g(p,a,Sn,sl,Yu,n,Dn,Ts,vi,Xr,E,null,-0,0)}}break}while(!0);ar(t)}function _g(t,n,a,p,w,E,M,K,J,oe,he,xe,le,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:mr},fg(n,E,xe);var De=(E&62914560)===E?nl-Me():(E&4194048)===E?xg-Me():0;if(De=QS(xe,De),De!==null){Ar=E,t.cancelPendingCommit=De(Tg.bind(null,t,n,E,a,p,w,M,K,J,he,xe,null,le,de)),es(t,E,M,!oe);return}}Tg(t,n,E,a,p,w,M,K,J)}function pS(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 p=0;p<a.length;p++){var w=a[p],E=w.getSnapshot;w=w.value;try{if(!En(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 es(t,n,a,p){n&=~Ku,n&=~Ts,t.suspendedLanes|=n,t.pingedLanes&=~n,p&&(t.warmLanes|=n),p=t.expirationTimes;for(var w=n;0<w;){var E=31-Ee(w),M=1<<E;p[E]=-1,w&=~M}a!==0&&Df(t,a,n)}function il(){return(dt&6)===0?(wa(0),!1):!0}function Ju(){if(Je!==null){if(ft===0)var t=Je.return;else t=Je,vr=ys=null,mu(t),di=null,ia=0,t=Je;for(;t!==null;)Qm(t.alternate,t),t=t.return;Je=null}}function _i(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,OS(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Ar=0,Ju(),vt=t,Je=a=xr(t.current,null),nt=n,ft=0,An=null,Xr=!1,bi=Fe(t,n),Gu=!1,vi=Dn=Ku=Ts=Zr=Lt=0,Sn=_a=null,Yu=!1,(n&8)!==0&&(n|=n&32);var p=t.entangledLanes;if(p!==0)for(t=t.entanglements,p&=n;0<p;){var w=31-Ee(p),E=1<<w;n|=t[w],p&=~E}return Tr=n,Eo(),a}function Sg(t,n){Ke=null,F.H=fa,n===ui||n===Oo?(n=zp(),ft=3):n===ru?(n=zp(),ft=4):ft=n===Du?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,Je===null&&(Lt=1,Ko(t,Un(n,t.current)))}function wg(){var t=Nn.current;return t===null?!0:(nt&4194048)===nt?Vn===null:(nt&62914560)===nt||(nt&536870912)!==0?t===Vn:!1}function Cg(){var t=F.H;return F.H=fa,t===null?fa:t}function kg(){var t=F.A;return F.A=hS,t}function al(){Lt=4,Xr||(nt&4194048)!==nt&&Nn.current!==null||(bi=!0),(Zr&134217727)===0&&(Ts&134217727)===0||vt===null||es(vt,nt,Dn,!1)}function ed(t,n,a){var p=dt;dt|=2;var w=Cg(),E=kg();(vt!==t||nt!==n)&&(sl=null,_i(t,n)),n=!1;var M=Lt;e:do try{if(ft!==0&&Je!==null){var K=Je,J=An;switch(ft){case 8:Ju(),M=6;break e;case 3:case 2:case 9:case 6:Nn.current===null&&(n=!0);var oe=ft;if(ft=0,An=null,Si(t,K,J,oe),a&&bi){M=0;break e}break;default:oe=ft,ft=0,An=null,Si(t,K,J,oe)}}mS(),M=Lt;break}catch(he){Sg(t,he)}while(!0);return n&&t.shellSuspendCounter++,vr=ys=null,dt=p,F.H=w,F.A=E,Je===null&&(vt=null,nt=0,Eo()),M}function mS(){for(;Je!==null;)Eg(Je)}function gS(t,n){var a=dt;dt|=2;var p=Cg(),w=kg();vt!==t||nt!==n?(sl=null,rl=Me()+500,_i(t,n)):bi=Fe(t,n);e:do try{if(ft!==0&&Je!==null){n=Je;var E=An;t:switch(ft){case 1:ft=0,An=null,Si(t,n,E,1);break;case 2:case 9:if(Ip(E)){ft=0,An=null,jg(n);break}n=function(){ft!==2&&ft!==9||vt!==t||(ft=7),ar(t)},E.then(n,n);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:Ip(E)?(ft=0,An=null,jg(n)):(ft=0,An=null,Si(t,n,E,7));break;case 5:var M=null;switch(Je.tag){case 26:M=Je.memoizedState;case 5:case 27:var K=Je;if(M?hx(M):K.stateNode.complete){ft=0,An=null;var J=K.sibling;if(J!==null)Je=J;else{var oe=K.return;oe!==null?(Je=oe,ol(oe)):Je=null}break t}}ft=0,An=null,Si(t,n,E,5);break;case 6:ft=0,An=null,Si(t,n,E,6);break;case 8:Ju(),Lt=6;break e;default:throw Error(i(462))}}xS();break}catch(he){Sg(t,he)}while(!0);return vr=ys=null,F.H=p,F.A=w,dt=a,Je!==null?0:(vt=null,nt=0,Eo(),Lt)}function xS(){for(;Je!==null&&!me();)Eg(Je)}function Eg(t){var n=Xm(t.alternate,t,Tr);t.memoizedProps=t.pendingProps,n===null?ol(t):Je=n}function jg(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=qm(a,n,n.pendingProps,n.type,void 0,nt);break;case 11:n=qm(a,n,n.pendingProps,n.type.render,n.ref,nt);break;case 5:mu(n);default:Qm(a,n),n=Je=kp(n,Tr),n=Xm(a,n,Tr)}t.memoizedProps=t.pendingProps,n===null?ol(t):Je=n}function Si(t,n,a,p){vr=ys=null,mu(n),di=null,ia=0;var w=n.return;try{if(iS(t,w,n,a,nt)){Lt=1,Ko(t,Un(a,t.current)),Je=null;return}}catch(E){if(w!==null)throw Je=w,E;Lt=1,Ko(t,Un(a,t.current)),Je=null;return}n.flags&32768?(it||p===1?t=!0:bi||(nt&536870912)!==0?t=!1:(Xr=t=!0,(p===2||p===9||p===3||p===6)&&(p=Nn.current,p!==null&&p.tag===13&&(p.flags|=16384))),Ng(n,t)):ol(n)}function ol(t){var n=t;do{if((n.flags&32768)!==0){Ng(n,Xr);return}t=n.return;var a=lS(n.alternate,n,Tr);if(a!==null){Je=a;return}if(n=n.sibling,n!==null){Je=n;return}Je=n=t}while(n!==null);Lt===0&&(Lt=5)}function Ng(t,n){do{var a=cS(t.alternate,t);if(a!==null){a.flags&=32767,Je=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Je=t;return}Je=t=a}while(t!==null);Lt=6,Je=null}function Tg(t,n,a,p,w,E,M,K,J){t.cancelPendingCommit=null;do ll();while(Kt!==0);if((dt&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));if(E=n.lanes|n.childLanes,E|=Uc,gc(t,a,E,M,K,J),t===vt&&(Je=vt=null,nt=0),yi=n,Jr=t,Ar=a,Xu=E,Zu=w,bg=p,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,_S(Ae,function(){return Og(),null})):(t.callbackNode=null,t.callbackPriority=0),p=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||p){p=F.T,F.T=null,w=Z.p,Z.p=2,M=dt,dt|=4;try{uS(t,n,a)}finally{dt=M,Z.p=w,F.T=p}}Kt=1,Ag(),Dg(),Rg()}}function Ag(){if(Kt===1){Kt=0;var t=Jr,n=yi,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=F.T,F.T=null;var p=Z.p;Z.p=2;var w=dt;dt|=4;try{ug(n,t);var E=hd,M=gp(t.containerInfo),K=E.focusedElem,J=E.selectionRange;if(M!==K&&K&&K.ownerDocument&&mp(K.ownerDocument.documentElement,K)){if(J!==null&&Bc(K)){var oe=J.start,he=J.end;if(he===void 0&&(he=oe),"selectionStart"in K)K.selectionStart=oe,K.selectionEnd=Math.min(he,K.value.length);else{var xe=K.ownerDocument||document,le=xe&&xe.defaultView||window;if(le.getSelection){var de=le.getSelection(),De=K.textContent.length,He=Math.min(J.start,De),bt=J.end===void 0?He:Math.min(J.end,De);!de.extend&&He>bt&&(M=bt,bt=He,He=M);var se=pp(K,He),te=pp(K,bt);if(se&&te&&(de.rangeCount!==1||de.anchorNode!==se.node||de.anchorOffset!==se.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var ae=xe.createRange();ae.setStart(se.node,se.offset),de.removeAllRanges(),He>bt?(de.addRange(ae),de.extend(te.node,te.offset)):(ae.setEnd(te.node,te.offset),de.addRange(ae))}}}}for(xe=[],de=K;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<xe.length;K++){var ge=xe[K];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}yl=!!dd,hd=dd=null}finally{dt=w,Z.p=p,F.T=a}}t.current=n,Kt=2}}function Dg(){if(Kt===2){Kt=0;var t=Jr,n=yi,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=F.T,F.T=null;var p=Z.p;Z.p=2;var w=dt;dt|=4;try{ig(t,n.alternate,n)}finally{dt=w,Z.p=p,F.T=a}}Kt=3}}function Rg(){if(Kt===4||Kt===3){Kt=0,je();var t=Jr,n=yi,a=Ar,p=bg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Kt=5:(Kt=0,yi=Jr=null,Lg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Qr=null),bc(a),n=n.stateNode,Dt&&typeof Dt.onCommitFiberRoot=="function")try{Dt.onCommitFiberRoot(Mt,n,void 0,(n.current.flags&128)===128)}catch{}if(p!==null){n=F.T,w=Z.p,Z.p=2,F.T=null;try{for(var E=t.onRecoverableError,M=0;M<p.length;M++){var K=p[M];E(K.value,{componentStack:K.stack})}}finally{F.T=n,Z.p=w}}(Ar&3)!==0&&ll(),ar(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Qu?Sa++:(Sa=0,Qu=t):Sa=0,wa(0)}}function Lg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,ra(n)))}function ll(){return Ag(),Dg(),Rg(),Og()}function Og(){if(Kt!==5)return!1;var t=Jr,n=Xu;Xu=0;var a=bc(Ar),p=F.T,w=Z.p;try{Z.p=32>a?32:a,F.T=null,a=Zu,Zu=null;var E=Jr,M=Ar;if(Kt=0,yi=Jr=null,Ar=0,(dt&6)!==0)throw Error(i(331));var K=dt;if(dt|=4,mg(E.current),hg(E,E.current,M,a),dt=K,wa(0,!1),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(Mt,E)}catch{}return!0}finally{Z.p=w,F.T=p,Lg(t,n)}}function Mg(t,n,a){n=Un(a,n),n=Au(t.stateNode,n,2),t=Vr(t,n,2),t!==null&&($s(t,2),ar(t))}function pt(t,n,a){if(t.tag===3)Mg(t,t,a);else for(;n!==null;){if(n.tag===3){Mg(n,t,a);break}else if(n.tag===1){var p=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Qr===null||!Qr.has(p))){t=Un(a,t),a=Im(2),p=Vr(n,a,2),p!==null&&(Bm(a,p,n,t),$s(p,2),ar(p));break}}n=n.return}}function td(t,n,a){var p=t.pingCache;if(p===null){p=t.pingCache=new fS;var w=new Set;p.set(n,w)}else w=p.get(n),w===void 0&&(w=new Set,p.set(n,w));w.has(a)||(Gu=!0,w.add(a),t=bS.bind(null,t,n,a),n.then(t,t))}function bS(t,n,a){var p=t.pingCache;p!==null&&p.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(nt&a)===a&&(Lt===4||Lt===3&&(nt&62914560)===nt&&300>Me()-nl?(dt&2)===0&&_i(t,0):Ku|=a,vi===nt&&(vi=0)),ar(t)}function Ig(t,n){n===0&&(n=Pt()),t=xs(t,n),t!==null&&($s(t,n),ar(t))}function vS(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),Ig(t,a)}function yS(t,n){var a=0;switch(t.tag){case 31:case 13:var p=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:p=t.stateNode;break;case 22:p=t.stateNode._retryCache;break;default:throw Error(i(314))}p!==null&&p.delete(n),Ig(t,a)}function _S(t,n){return $e(t,n)}var cl=null,wi=null,nd=!1,ul=!1,rd=!1,ts=0;function ar(t){t!==wi&&t.next===null&&(wi===null?cl=wi=t:wi=wi.next=t),ul=!0,nd||(nd=!0,wS())}function wa(t,n){if(!rd&&ul){rd=!0;do for(var a=!1,p=cl;p!==null;){if(t!==0){var w=p.pendingLanes;if(w===0)var E=0;else{var M=p.suspendedLanes,K=p.pingedLanes;E=(1<<31-Ee(42|t)+1)-1,E&=w&~(M&~K),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,Hg(p,E))}else E=nt,E=st(p,p===vt?E:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(E&3)===0||Fe(p,E)||(a=!0,Hg(p,E));p=p.next}while(a);rd=!1}}function SS(){Bg()}function Bg(){ul=nd=!1;var t=0;ts!==0&&LS()&&(t=ts);for(var n=Me(),a=null,p=cl;p!==null;){var w=p.next,E=zg(p,n);E===0?(p.next=null,a===null?cl=w:a.next=w,w===null&&(wi=a)):(a=p,(t!==0||(E&3)!==0)&&(ul=!0)),p=w}Kt!==0&&Kt!==5||wa(t),ts!==0&&(ts=0)}function zg(t,n){for(var a=t.suspendedLanes,p=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var M=31-Ee(E),K=1<<M,J=w[M];J===-1?((K&a)===0||(K&p)!==0)&&(w[M]=en(K,n)):J<=n&&(t.expiredLanes|=K),E&=~K}if(n=vt,a=nt,a=st(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),p=t.callbackNode,a===0||t===n&&(ft===2||ft===9)||t.cancelPendingCommit!==null)return p!==null&&p!==null&&Tt(p),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Fe(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(p!==null&&Tt(p),bc(a)){case 2:case 8:a=_e;break;case 32:a=Ae;break;case 268435456:a=Ve;break;default:a=Ae}return p=Pg.bind(null,t),a=$e(a,p),t.callbackPriority=n,t.callbackNode=a,n}return p!==null&&p!==null&&Tt(p),t.callbackPriority=2,t.callbackNode=null,2}function Pg(t,n){if(Kt!==0&&Kt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(ll()&&t.callbackNode!==a)return null;var p=nt;return p=st(t,t===vt?p:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),p===0?null:(yg(t,p,n),zg(t,Me()),t.callbackNode!=null&&t.callbackNode===a?Pg.bind(null,t):null)}function Hg(t,n){if(ll())return null;yg(t,n,!0)}function wS(){MS(function(){(dt&6)!==0?$e(ce,SS):Bg()})}function sd(){if(ts===0){var t=li;t===0&&(t=fe,fe<<=1,(fe&261888)===0&&(fe=256)),ts=t}return ts}function Fg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:bo(""+t)}function Ug(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 CS(t,n,a,p,w){if(n==="submit"&&a&&a.stateNode===w){var E=Fg((w[xn]||null).action),M=p.submitter;M&&(n=(n=M[xn]||null)?Fg(n.formAction):M.getAttribute("formAction"),n!==null&&(E=n,M=null));var K=new So("action","action",null,p,w);t.push({event:K,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ts!==0){var J=M?Ug(w,M):new FormData(w);Cu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(K.preventDefault(),J=M?Ug(w,M):new FormData(w),Cu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var id=0;id<Fc.length;id++){var ad=Fc[id],kS=ad.toLowerCase(),ES=ad[0].toUpperCase()+ad.slice(1);Xn(kS,"on"+ES)}Xn(vp,"onAnimationEnd"),Xn(yp,"onAnimationIteration"),Xn(_p,"onAnimationStart"),Xn("dblclick","onDoubleClick"),Xn("focusin","onFocus"),Xn("focusout","onBlur"),Xn(U_,"onTransitionRun"),Xn($_,"onTransitionStart"),Xn(q_,"onTransitionCancel"),Xn(Sp,"onTransitionEnd"),Ks("onMouseEnter",["mouseout","mouseover"]),Ks("onMouseLeave",["mouseout","mouseover"]),Ks("onPointerEnter",["pointerout","pointerover"]),Ks("onPointerLeave",["pointerout","pointerover"]),fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fs("onBeforeInput",["compositionend","keypress","textInput","paste"]),fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ca="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(" "),jS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ca));function $g(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var p=t[a],w=p.event;p=p.listeners;e:{var E=void 0;if(n)for(var M=p.length-1;0<=M;M--){var K=p[M],J=K.instance,oe=K.currentTarget;if(K=K.listener,J!==E&&w.isPropagationStopped())break e;E=K,w.currentTarget=oe;try{E(w)}catch(he){ko(he)}w.currentTarget=null,E=J}else for(M=0;M<p.length;M++){if(K=p[M],J=K.instance,oe=K.currentTarget,K=K.listener,J!==E&&w.isPropagationStopped())break e;E=K,w.currentTarget=oe;try{E(w)}catch(he){ko(he)}w.currentTarget=null,E=J}}}}function et(t,n){var a=n[vc];a===void 0&&(a=n[vc]=new Set);var p=t+"__bubble";a.has(p)||(qg(n,t,2,!1),a.add(p))}function od(t,n,a){var p=0;n&&(p|=4),qg(a,t,p,n)}var dl="_reactListening"+Math.random().toString(36).slice(2);function ld(t){if(!t[dl]){t[dl]=!0,Bf.forEach(function(a){a!=="selectionchange"&&(jS.has(a)||od(a,!1,t),od(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[dl]||(n[dl]=!0,od("selectionchange",!1,n))}}function qg(t,n,a,p){switch(vx(n)){case 2:var w=t1;break;case 8:w=n1;break;default:w=wd}a=w.bind(null,n,a,t),w=void 0,!Nc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),p?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 cd(t,n,a,p,w){var E=p;if((n&1)===0&&(n&2)===0&&p!==null)e:for(;;){if(p===null)return;var M=p.tag;if(M===3||M===4){var K=p.stateNode.containerInfo;if(K===w)break;if(M===4)for(M=p.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;K!==null;){if(M=Ws(K),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){p=E=M;continue e}K=K.parentNode}}p=p.return}Yf(function(){var oe=E,he=Ec(a),xe=[];e:{var le=wp.get(t);if(le!==void 0){var de=So,De=t;switch(t){case"keypress":if(yo(a)===0)break e;case"keydown":case"keyup":de=y_;break;case"focusin":De="focus",de=Rc;break;case"focusout":De="blur",de=Rc;break;case"beforeblur":case"afterblur":de=Rc;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=Qf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=l_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=w_;break;case vp:case yp:case _p:de=d_;break;case Sp:de=k_;break;case"scroll":case"scrollend":de=a_;break;case"wheel":de=j_;break;case"copy":case"cut":case"paste":de=f_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=ep;break;case"toggle":case"beforetoggle":de=T_}var He=(n&4)!==0,bt=!He&&(t==="scroll"||t==="scrollend"),se=He?le!==null?le+"Capture":null:le;He=[];for(var te=oe,ae;te!==null;){var ge=te;if(ae=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ae===null||se===null||(ge=Vi(te,se),ge!=null&&He.push(ka(te,ge,ae))),bt)break;te=te.return}0<He.length&&(le=new de(le,De,null,a,he),xe.push({event:le,listeners:He}))}}if((n&7)===0){e:{if(le=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",le&&a!==kc&&(De=a.relatedTarget||a.fromElement)&&(Ws(De)||De[qs]))break e;if((de||le)&&(le=he.window===he?he:(le=he.ownerDocument)?le.defaultView||le.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=oe,De=De?Ws(De):null,De!==null&&(bt=u(De),He=De.tag,De!==bt||He!==5&&He!==27&&He!==6)&&(De=null)):(de=null,De=oe),de!==De)){if(He=Qf,ge="onMouseLeave",se="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(He=ep,ge="onPointerLeave",se="onPointerEnter",te="pointer"),bt=de==null?le:Wi(de),ae=De==null?le:Wi(De),le=new He(ge,te+"leave",de,a,he),le.target=bt,le.relatedTarget=ae,ge=null,Ws(he)===oe&&(He=new He(se,te+"enter",De,a,he),He.target=ae,He.relatedTarget=bt,ge=He),bt=ge,de&&De)t:{for(He=NS,se=de,te=De,ae=0,ge=se;ge;ge=He(ge))ae++;ge=0;for(var Be=te;Be;Be=He(Be))ge++;for(;0<ae-ge;)se=He(se),ae--;for(;0<ge-ae;)te=He(te),ge--;for(;ae--;){if(se===te||te!==null&&se===te.alternate){He=se;break t}se=He(se),te=He(te)}He=null}else He=null;de!==null&&Wg(xe,le,de,He,!1),De!==null&&bt!==null&&Wg(xe,bt,De,He,!0)}}e:{if(le=oe?Wi(oe):window,de=le.nodeName&&le.nodeName.toLowerCase(),de==="select"||de==="input"&&le.type==="file")var ct=lp;else if(ap(le))if(cp)ct=P_;else{ct=B_;var Le=I_}else de=le.nodeName,!de||de.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?oe&&Cc(oe.elementType)&&(ct=lp):ct=z_;if(ct&&(ct=ct(t,oe))){op(xe,ct,a,he);break e}Le&&Le(t,le,oe),t==="focusout"&&oe&&le.type==="number"&&oe.memoizedProps.value!=null&&wc(le,"number",le.value)}switch(Le=oe?Wi(oe):window,t){case"focusin":(ap(Le)||Le.contentEditable==="true")&&(ei=Le,zc=oe,ea=null);break;case"focusout":ea=zc=ei=null;break;case"mousedown":Pc=!0;break;case"contextmenu":case"mouseup":case"dragend":Pc=!1,xp(xe,a,he);break;case"selectionchange":if(F_)break;case"keydown":case"keyup":xp(xe,a,he)}var Ye;if(Oc)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Js?sp(t,a)&&(rt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(rt="onCompositionStart");rt&&(tp&&a.locale!=="ko"&&(Js||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Js&&(Ye=Xf()):(Pr=he,Tc="value"in Pr?Pr.value:Pr.textContent,Js=!0)),Le=hl(oe,rt),0<Le.length&&(rt=new Jf(rt,t,null,a,he),xe.push({event:rt,listeners:Le}),Ye?rt.data=Ye:(Ye=ip(a),Ye!==null&&(rt.data=Ye)))),(Ye=D_?R_(t,a):L_(t,a))&&(rt=hl(oe,"onBeforeInput"),0<rt.length&&(Le=new Jf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Le,listeners:rt}),Le.data=Ye)),CS(xe,t,oe,a,he)}$g(xe,n)})}function ka(t,n,a){return{instance:t,listener:n,currentTarget:a}}function hl(t,n){for(var a=n+"Capture",p=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Vi(t,a),w!=null&&p.unshift(ka(t,w,E)),w=Vi(t,n),w!=null&&p.push(ka(t,w,E))),t.tag===3)return p;t=t.return}return[]}function NS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Wg(t,n,a,p,w){for(var E=n._reactName,M=[];a!==null&&a!==p;){var K=a,J=K.alternate,oe=K.stateNode;if(K=K.tag,J!==null&&J===p)break;K!==5&&K!==26&&K!==27||oe===null||(J=oe,w?(oe=Vi(a,E),oe!=null&&M.unshift(ka(a,oe,J))):w||(oe=Vi(a,E),oe!=null&&M.push(ka(a,oe,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var TS=/\r\n?/g,AS=/\u0000|\uFFFD/g;function Vg(t){return(typeof t=="string"?t:""+t).replace(TS,`
|
|
49
|
-
`).replace(AS,"")}function Gg(t,n){return n=Vg(n),Vg(t)===n}function xt(t,n,a,p,w,E){switch(a){case"children":typeof p=="string"?n==="body"||n==="textarea"&&p===""||Xs(t,p):(typeof p=="number"||typeof p=="bigint")&&n!=="body"&&Xs(t,""+p);break;case"className":go(t,"class",p);break;case"tabIndex":go(t,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":go(t,a,p);break;case"style":Gf(t,p,E);break;case"data":if(n!=="object"){go(t,"data",p);break}case"src":case"href":if(p===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){t.removeAttribute(a);break}p=bo(""+p),t.setAttribute(a,p);break;case"action":case"formAction":if(typeof p=="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"&&xt(t,n,"name",w.name,w,null),xt(t,n,"formEncType",w.formEncType,w,null),xt(t,n,"formMethod",w.formMethod,w,null),xt(t,n,"formTarget",w.formTarget,w,null)):(xt(t,n,"encType",w.encType,w,null),xt(t,n,"method",w.method,w,null),xt(t,n,"target",w.target,w,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){t.removeAttribute(a);break}p=bo(""+p),t.setAttribute(a,p);break;case"onClick":p!=null&&(t.onclick=mr);break;case"onScroll":p!=null&&et("scroll",t);break;case"onScrollEnd":p!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(i(61));if(a=p.__html,a!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"multiple":t.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":t.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){t.removeAttribute("xlink:href");break}a=bo(""+p),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":p!=null&&typeof p!="function"&&typeof p!="symbol"?t.setAttribute(a,""+p):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":p&&typeof p!="function"&&typeof p!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":p===!0?t.setAttribute(a,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?t.setAttribute(a,p):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?t.setAttribute(a,p):t.removeAttribute(a);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?t.removeAttribute(a):t.setAttribute(a,p);break;case"popover":et("beforetoggle",t),et("toggle",t),mo(t,"popover",p);break;case"xlinkActuate":pr(t,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":pr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":pr(t,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":pr(t,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":pr(t,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":pr(t,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":pr(t,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":pr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":pr(t,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":mo(t,"is",p);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=s_.get(a)||a,mo(t,a,p))}}function ud(t,n,a,p,w,E){switch(a){case"style":Gf(t,p,E);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(i(61));if(a=p.__html,a!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=a}}break;case"children":typeof p=="string"?Xs(t,p):(typeof p=="number"||typeof p=="bigint")&&Xs(t,""+p);break;case"onScroll":p!=null&&et("scroll",t);break;case"onScrollEnd":p!=null&&et("scrollend",t);break;case"onClick":p!=null&&(t.onclick=mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zf.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[xn]||null,E=E!=null?E[a]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof p=="function")){typeof E!="function"&&E!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,p,w);break e}a in t?t[a]=p:p===!0?t.setAttribute(a,""):mo(t,a,p)}}}function an(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",t),et("load",t);var p=!1,w=!1,E;for(E in a)if(a.hasOwnProperty(E)){var M=a[E];if(M!=null)switch(E){case"src":p=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:xt(t,n,E,M,a,null)}}w&&xt(t,n,"srcSet",a.srcSet,a,null),p&&xt(t,n,"src",a.src,a,null);return;case"input":et("invalid",t);var K=E=M=w=null,J=null,oe=null;for(p in a)if(a.hasOwnProperty(p)){var he=a[p];if(he!=null)switch(p){case"name":w=he;break;case"type":M=he;break;case"checked":J=he;break;case"defaultChecked":oe=he;break;case"value":E=he;break;case"defaultValue":K=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,n));break;default:xt(t,n,p,he,a,null)}}$f(t,E,K,J,oe,M,w,!1);return;case"select":et("invalid",t),p=M=E=null;for(w in a)if(a.hasOwnProperty(w)&&(K=a[w],K!=null))switch(w){case"value":E=K;break;case"defaultValue":M=K;break;case"multiple":p=K;default:xt(t,n,w,K,a,null)}n=E,a=M,t.multiple=!!p,n!=null?Ys(t,!!p,n,!1):a!=null&&Ys(t,!!p,a,!0);return;case"textarea":et("invalid",t),E=w=p=null;for(M in a)if(a.hasOwnProperty(M)&&(K=a[M],K!=null))switch(M){case"value":p=K;break;case"defaultValue":w=K;break;case"children":E=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(91));break;default:xt(t,n,M,K,a,null)}Wf(t,p,w,E);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(p=a[J],p!=null))switch(J){case"selected":t.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:xt(t,n,J,p,a,null)}return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(p=0;p<Ca.length;p++)et(Ca[p],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("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(oe in a)if(a.hasOwnProperty(oe)&&(p=a[oe],p!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:xt(t,n,oe,p,a,null)}return;default:if(Cc(n)){for(he in a)a.hasOwnProperty(he)&&(p=a[he],p!==void 0&&ud(t,n,he,p,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(p=a[K],p!=null&&xt(t,n,K,p,a,null))}function DS(t,n,a,p){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,M=null,K=null,J=null,oe=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:p.hasOwnProperty(de)||xt(t,n,de,null,p,xe)}}for(var le in p){var de=p[le];if(xe=a[le],p.hasOwnProperty(le)&&(de!=null||xe!=null))switch(le){case"type":E=de;break;case"name":w=de;break;case"checked":oe=de;break;case"defaultChecked":he=de;break;case"value":M=de;break;case"defaultValue":K=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,n));break;default:de!==xe&&xt(t,n,le,de,p,xe)}}Sc(t,M,K,J,oe,he,E,w);return;case"select":de=M=K=le=null;for(E in a)if(J=a[E],a.hasOwnProperty(E)&&J!=null)switch(E){case"value":break;case"multiple":de=J;default:p.hasOwnProperty(E)||xt(t,n,E,null,p,J)}for(w in p)if(E=p[w],J=a[w],p.hasOwnProperty(w)&&(E!=null||J!=null))switch(w){case"value":le=E;break;case"defaultValue":K=E;break;case"multiple":M=E;default:E!==J&&xt(t,n,w,E,p,J)}n=K,a=M,p=de,le!=null?Ys(t,!!a,le,!1):!!p!=!!a&&(n!=null?Ys(t,!!a,n,!0):Ys(t,!!a,a?[]:"",!1));return;case"textarea":de=le=null;for(K in a)if(w=a[K],a.hasOwnProperty(K)&&w!=null&&!p.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:xt(t,n,K,null,p,w)}for(M in p)if(w=p[M],E=a[M],p.hasOwnProperty(M)&&(w!=null||E!=null))switch(M){case"value":le=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(i(91));break;default:w!==E&&xt(t,n,M,w,p,E)}qf(t,le,de);return;case"option":for(var De in a)if(le=a[De],a.hasOwnProperty(De)&&le!=null&&!p.hasOwnProperty(De))switch(De){case"selected":t.selected=!1;break;default:xt(t,n,De,null,p,le)}for(J in p)if(le=p[J],de=a[J],p.hasOwnProperty(J)&&le!==de&&(le!=null||de!=null))switch(J){case"selected":t.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:xt(t,n,J,le,p,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 He in a)le=a[He],a.hasOwnProperty(He)&&le!=null&&!p.hasOwnProperty(He)&&xt(t,n,He,null,p,le);for(oe in p)if(le=p[oe],de=a[oe],p.hasOwnProperty(oe)&&le!==de&&(le!=null||de!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,n));break;default:xt(t,n,oe,le,p,de)}return;default:if(Cc(n)){for(var bt in a)le=a[bt],a.hasOwnProperty(bt)&&le!==void 0&&!p.hasOwnProperty(bt)&&ud(t,n,bt,void 0,p,le);for(he in p)le=p[he],de=a[he],!p.hasOwnProperty(he)||le===de||le===void 0&&de===void 0||ud(t,n,he,le,p,de);return}}for(var se in a)le=a[se],a.hasOwnProperty(se)&&le!=null&&!p.hasOwnProperty(se)&&xt(t,n,se,null,p,le);for(xe in p)le=p[xe],de=a[xe],!p.hasOwnProperty(xe)||le===de||le==null&&de==null||xt(t,n,xe,le,p,de)}function Kg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function RS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),p=0;p<a.length;p++){var w=a[p],E=w.transferSize,M=w.initiatorType,K=w.duration;if(E&&K&&Kg(M)){for(M=0,K=w.responseEnd,p+=1;p<a.length;p++){var J=a[p],oe=J.startTime;if(oe>K)break;var he=J.transferSize,xe=J.initiatorType;he&&Kg(xe)&&(J=J.responseEnd,M+=he*(J<K?1:(K-oe)/(J-oe)))}if(--p,n+=8*(E+M)/(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 dd=null,hd=null;function fl(t){return t.nodeType===9?t:t.ownerDocument}function Yg(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 Xg(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 fd(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 pd=null;function LS(){var t=window.event;return t&&t.type==="popstate"?t===pd?!1:(pd=t,!0):(pd=null,!1)}var Zg=typeof setTimeout=="function"?setTimeout:void 0,OS=typeof clearTimeout=="function"?clearTimeout:void 0,Qg=typeof Promise=="function"?Promise:void 0,MS=typeof queueMicrotask=="function"?queueMicrotask:typeof Qg<"u"?function(t){return Qg.resolve(null).then(t).catch(IS)}:Zg;function IS(t){setTimeout(function(){throw t})}function ns(t){return t==="head"}function Jg(t,n){var a=n,p=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(p===0){t.removeChild(w),ji(n);return}p--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")p++;else if(a==="html")Ea(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,Ea(a);for(var E=a.firstChild;E;){var M=E.nextSibling,K=E.nodeName;E[qi]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=M}}else a==="body"&&Ea(t.ownerDocument.body);a=w}while(a);ji(n)}function ex(t,n){var a=t;t=0;do{var p=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||""),p&&p.nodeType===8)if(a=p.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=p}while(a)}function md(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":md(a),yc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function BS(t,n,a,p){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!p&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(p){if(!t[qi])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=Gn(t.nextSibling),t===null)break}return null}function zS(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Gn(t.nextSibling),t===null))return null;return t}function tx(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Gn(t.nextSibling),t===null))return null;return t}function gd(t){return t.data==="$?"||t.data==="$~"}function xd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function PS(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var p=function(){n(),a.removeEventListener("DOMContentLoaded",p)};a.addEventListener("DOMContentLoaded",p),t._reactRetry=p}}function Gn(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 bd=null;function nx(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Gn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function rx(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 sx(t,n,a){switch(n=fl(a),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Ea(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);yc(t)}var Kn=new Map,ix=new Set;function pl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Dr=Z.d;Z.d={f:HS,r:FS,D:US,C:$S,L:qS,m:WS,X:GS,S:VS,M:KS};function HS(){var t=Dr.f(),n=il();return t||n}function FS(t){var n=Vs(t);n!==null&&n.tag===5&&n.type==="form"?Sm(n):Dr.r(t)}var Ci=typeof document>"u"?null:document;function ax(t,n,a){var p=Ci;if(p&&typeof n=="string"&&n){var w=Hn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),ix.has(w)||(ix.add(w),t={rel:t,crossOrigin:a,href:n},p.querySelector(w)===null&&(n=p.createElement("link"),an(n,"link",t),Xt(n),p.head.appendChild(n)))}}function US(t){Dr.D(t),ax("dns-prefetch",t,null)}function $S(t,n){Dr.C(t,n),ax("preconnect",t,n)}function qS(t,n,a){Dr.L(t,n,a);var p=Ci;if(p&&t&&n){var w='link[rel="preload"][as="'+Hn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Hn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Hn(a.imageSizes)+'"]')):w+='[href="'+Hn(t)+'"]';var E=w;switch(n){case"style":E=ki(t);break;case"script":E=Ei(t)}Kn.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Kn.set(E,t),p.querySelector(w)!==null||n==="style"&&p.querySelector(ja(E))||n==="script"&&p.querySelector(Na(E))||(n=p.createElement("link"),an(n,"link",t),Xt(n),p.head.appendChild(n)))}}function WS(t,n){Dr.m(t,n);var a=Ci;if(a&&t){var p=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Hn(p)+'"][href="'+Hn(t)+'"]',E=w;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Ei(t)}if(!Kn.has(E)&&(t=m({rel:"modulepreload",href:t},n),Kn.set(E,t),a.querySelector(w)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Na(E)))return}p=a.createElement("link"),an(p,"link",t),Xt(p),a.head.appendChild(p)}}}function VS(t,n,a){Dr.S(t,n,a);var p=Ci;if(p&&t){var w=Gs(p).hoistableStyles,E=ki(t);n=n||"default";var M=w.get(E);if(!M){var K={loading:0,preload:null};if(M=p.querySelector(ja(E)))K.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Kn.get(E))&&vd(t,a);var J=M=p.createElement("link");Xt(J),an(J,"link",t),J._p=new Promise(function(oe,he){J.onload=oe,J.onerror=he}),J.addEventListener("load",function(){K.loading|=1}),J.addEventListener("error",function(){K.loading|=2}),K.loading|=4,ml(M,n,p)}M={type:"stylesheet",instance:M,count:1,state:K},w.set(E,M)}}}function GS(t,n){Dr.X(t,n);var a=Ci;if(a&&t){var p=Gs(a).hoistableScripts,w=Ei(t),E=p.get(w);E||(E=a.querySelector(Na(w)),E||(t=m({src:t,async:!0},n),(n=Kn.get(w))&&yd(t,n),E=a.createElement("script"),Xt(E),an(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},p.set(w,E))}}function KS(t,n){Dr.M(t,n);var a=Ci;if(a&&t){var p=Gs(a).hoistableScripts,w=Ei(t),E=p.get(w);E||(E=a.querySelector(Na(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=Kn.get(w))&&yd(t,n),E=a.createElement("script"),Xt(E),an(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},p.set(w,E))}}function ox(t,n,a,p){var w=(w=ee.current)?pl(w):null;if(!w)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ki(a.href),a=Gs(w).hoistableStyles,p=a.get(n),p||(p={type:"style",instance:null,count:0,state:null},a.set(n,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ki(a.href);var E=Gs(w).hoistableStyles,M=E.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,M),(E=w.querySelector(ja(t)))&&!E._p&&(M.instance=E,M.state.loading=5),Kn.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},Kn.set(t,a),E||YS(w,t,a,M.state))),n&&p===null)throw Error(i(528,""));return M}if(n&&p!==null)throw Error(i(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ei(a),a=Gs(w).hoistableScripts,p=a.get(n),p||(p={type:"script",instance:null,count:0,state:null},a.set(n,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function ki(t){return'href="'+Hn(t)+'"'}function ja(t){return'link[rel="stylesheet"]['+t+"]"}function lx(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function YS(t,n,a,p){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?p.loading=1:(n=t.createElement("link"),p.preload=n,n.addEventListener("load",function(){return p.loading|=1}),n.addEventListener("error",function(){return p.loading|=2}),an(n,"link",a),Xt(n),t.head.appendChild(n))}function Ei(t){return'[src="'+Hn(t)+'"]'}function Na(t){return"script[async]"+t}function cx(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var p=t.querySelector('style[data-href~="'+Hn(a.href)+'"]');if(p)return n.instance=p,Xt(p),p;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return p=(t.ownerDocument||t).createElement("style"),Xt(p),an(p,"style",w),ml(p,a.precedence,t),n.instance=p;case"stylesheet":w=ki(a.href);var E=t.querySelector(ja(w));if(E)return n.state.loading|=4,n.instance=E,Xt(E),E;p=lx(a),(w=Kn.get(w))&&vd(p,w),E=(t.ownerDocument||t).createElement("link"),Xt(E);var M=E;return M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),an(E,"link",p),n.state.loading|=4,ml(E,a.precedence,t),n.instance=E;case"script":return E=Ei(a.src),(w=t.querySelector(Na(E)))?(n.instance=w,Xt(w),w):(p=a,(w=Kn.get(E))&&(p=m({},a),yd(p,w)),t=t.ownerDocument||t,w=t.createElement("script"),Xt(w),an(w,"link",p),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(p=n.instance,n.state.loading|=4,ml(p,a.precedence,t));return n.instance}function ml(t,n,a){for(var p=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=p.length?p[p.length-1]:null,E=w,M=0;M<p.length;M++){var K=p[M];if(K.dataset.precedence===n)E=K;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 vd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function yd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var gl=null;function ux(t,n,a){if(gl===null){var p=new Map,w=gl=new Map;w.set(a,p)}else w=gl,p=w.get(a),p||(p=new Map,w.set(a,p));if(p.has(t))return p;for(p.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var E=a[w];if(!(E[qi]||E[tn]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var M=E.getAttribute(n)||"";M=t+M;var K=p.get(M);K?K.push(E):p.set(M,[E])}}return p}function dx(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function XS(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 hx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function ZS(t,n,a,p){if(a.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=ki(p.href),E=n.querySelector(ja(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=xl.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,Xt(E);return}E=n.ownerDocument||n,p=lx(p),(w=Kn.get(w))&&vd(p,w),E=E.createElement("link"),Xt(E);var M=E;M._p=new Promise(function(K,J){M.onload=K,M.onerror=J}),an(E,"link",p),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=xl.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var _d=0;function QS(t,n){return t.stylesheets&&t.count===0&&vl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var p=setTimeout(function(){if(t.stylesheets&&vl(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&_d===0&&(_d=62500*RS());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&vl(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>_d?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(p),clearTimeout(w)}}:null}function xl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var bl=null;function vl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,bl=new Map,n.forEach(JS,t),bl=null,xl.call(t))}function JS(t,n){if(!(n.state.loading&4)){var a=bl.get(t);if(a)var p=a.get(null);else{a=new Map,bl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var M=w[E];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),p=M)}p&&a.set(null,p)}w=n.instance,M=w.getAttribute("data-precedence"),E=a.get(M)||p,E===p&&a.set(null,w),a.set(M,w),this.count++,p=xl.bind(this),w.addEventListener("load",p),w.addEventListener("error",p),E?E.parentNode.insertBefore(w,E.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var Ta={$$typeof:_,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function e1(t,n,a,p,w,E,M,K,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=Gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.hiddenUpdates=Gt(null),this.identifierPrefix=p,this.onUncaughtError=w,this.onCaughtError=E,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function fx(t,n,a,p,w,E,M,K,J,oe,he,xe){return t=new e1(t,n,a,M,J,oe,he,xe,K),n=1,E===!0&&(n|=24),E=jn(3,null,null,n),t.current=E,E.stateNode=t,n=eu(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:p,isDehydrated:a,cache:n},su(E),t}function px(t){return t?(t=ri,t):ri}function mx(t,n,a,p,w,E){w=px(w),p.context===null?p.context=w:p.pendingContext=w,p=Wr(n),p.payload={element:a},E=E===void 0?null:E,E!==null&&(p.callback=E),a=Vr(t,p,n),a!==null&&(wn(a,t,n),oa(a,t,n))}function gx(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Sd(t,n){gx(t,n),(t=t.alternate)&&gx(t,n)}function xx(t){if(t.tag===13||t.tag===31){var n=xs(t,67108864);n!==null&&wn(n,t,67108864),Sd(t,67108864)}}function bx(t){if(t.tag===13||t.tag===31){var n=Rn();n=xc(n);var a=xs(t,n);a!==null&&wn(a,t,n),Sd(t,n)}}var yl=!0;function t1(t,n,a,p){var w=F.T;F.T=null;var E=Z.p;try{Z.p=2,wd(t,n,a,p)}finally{Z.p=E,F.T=w}}function n1(t,n,a,p){var w=F.T;F.T=null;var E=Z.p;try{Z.p=8,wd(t,n,a,p)}finally{Z.p=E,F.T=w}}function wd(t,n,a,p){if(yl){var w=Cd(p);if(w===null)cd(t,n,p,_l,a),yx(t,p);else if(s1(w,t,n,a,p))p.stopPropagation();else if(yx(t,p),n&4&&-1<r1.indexOf(t)){for(;w!==null;){var E=Vs(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var M=qe(E.pendingLanes);if(M!==0){var K=E;for(K.pendingLanes|=2,K.entangledLanes|=2;M;){var J=1<<31-Ee(M);K.entanglements[1]|=J,M&=~J}ar(E),(dt&6)===0&&(rl=Me()+500,wa(0))}}break;case 31:case 13:K=xs(E,2),K!==null&&wn(K,E,2),il(),Sd(E,2)}if(E=Cd(p),E===null&&cd(t,n,p,_l,a),E===w)break;w=E}w!==null&&p.stopPropagation()}else cd(t,n,p,null,a)}}function Cd(t){return t=Ec(t),kd(t)}var _l=null;function kd(t){if(_l=null,t=Ws(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=h(n),t!==null)return t;t=null}else if(a===31){if(t=c(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 _l=t,null}function vx(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(ht()){case ce:return 2;case _e:return 8;case Ae:case Ie:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var Ed=!1,rs=null,ss=null,is=null,Aa=new Map,Da=new Map,as=[],r1="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 yx(t,n){switch(t){case"focusin":case"focusout":rs=null;break;case"dragenter":case"dragleave":ss=null;break;case"mouseover":case"mouseout":is=null;break;case"pointerover":case"pointerout":Aa.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Da.delete(n.pointerId)}}function Ra(t,n,a,p,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:a,eventSystemFlags:p,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Vs(n),n!==null&&xx(n)),t):(t.eventSystemFlags|=p,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function s1(t,n,a,p,w){switch(n){case"focusin":return rs=Ra(rs,t,n,a,p,w),!0;case"dragenter":return ss=Ra(ss,t,n,a,p,w),!0;case"mouseover":return is=Ra(is,t,n,a,p,w),!0;case"pointerover":var E=w.pointerId;return Aa.set(E,Ra(Aa.get(E)||null,t,n,a,p,w)),!0;case"gotpointercapture":return E=w.pointerId,Da.set(E,Ra(Da.get(E)||null,t,n,a,p,w)),!0}return!1}function _x(t){var n=Ws(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=h(a),n!==null){t.blockedOn=n,Mf(t.priority,function(){bx(a)});return}}else if(n===31){if(n=c(a),n!==null){t.blockedOn=n,Mf(t.priority,function(){bx(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 Sl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Cd(t.nativeEvent);if(a===null){a=t.nativeEvent;var p=new a.constructor(a.type,a);kc=p,a.target.dispatchEvent(p),kc=null}else return n=Vs(a),n!==null&&xx(n),t.blockedOn=a,!1;n.shift()}return!0}function Sx(t,n,a){Sl(t)&&a.delete(n)}function i1(){Ed=!1,rs!==null&&Sl(rs)&&(rs=null),ss!==null&&Sl(ss)&&(ss=null),is!==null&&Sl(is)&&(is=null),Aa.forEach(Sx),Da.forEach(Sx)}function wl(t,n){t.blockedOn===n&&(t.blockedOn=null,Ed||(Ed=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,i1)))}var Cl=null;function wx(t){Cl!==t&&(Cl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Cl===t&&(Cl=null);for(var n=0;n<t.length;n+=3){var a=t[n],p=t[n+1],w=t[n+2];if(typeof p!="function"){if(kd(p||a)===null)continue;break}var E=Vs(a);E!==null&&(t.splice(n,3),n-=3,Cu(E,{pending:!0,data:w,method:a.method,action:p},p,w))}}))}function ji(t){function n(J){return wl(J,t)}rs!==null&&wl(rs,t),ss!==null&&wl(ss,t),is!==null&&wl(is,t),Aa.forEach(n),Da.forEach(n);for(var a=0;a<as.length;a++){var p=as[a];p.blockedOn===t&&(p.blockedOn=null)}for(;0<as.length&&(a=as[0],a.blockedOn===null);)_x(a),a.blockedOn===null&&as.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(p=0;p<a.length;p+=3){var w=a[p],E=a[p+1],M=w[xn]||null;if(typeof E=="function")M||wx(a);else if(M){var K=null;if(E&&E.hasAttribute("formAction")){if(w=E,M=E[xn]||null)K=M.formAction;else if(kd(w)!==null)continue}else K=M.action;typeof K=="function"?a[p+1]=K:(a.splice(p,3),p-=3),wx(a)}}}function Cx(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),p||setTimeout(a,20)}function a(){if(!p&&!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 p=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){p=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function jd(t){this._internalRoot=t}kl.prototype.render=jd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var a=n.current,p=Rn();mx(a,p,t,n,null,null)},kl.prototype.unmount=jd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;mx(t.current,2,null,t,null,null),il(),n[qs]=null}};function kl(t){this._internalRoot=t}kl.prototype.unstable_scheduleHydration=function(t){if(t){var n=Of();t={blockedOn:null,target:t,priority:n};for(var a=0;a<as.length&&n!==0&&n<as[a].priority;a++);as.splice(a,0,t),a===0&&_x(t)}};var kx=r.version;if(kx!=="19.2.4")throw Error(i(527,kx,"19.2.4"));Z.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var a1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var El=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!El.isDisabled&&El.supportsFiber)try{Mt=El.inject(a1),Dt=El}catch{}}return Oa.createRoot=function(t,n){if(!l(t))throw Error(i(299));var a=!1,p="",w=Rm,E=Lm,M=Om;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(p=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(E=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=fx(t,1,!1,null,null,a,p,null,w,E,M,Cx),t[qs]=n.current,ld(t),new jd(n)},Oa.hydrateRoot=function(t,n,a){if(!l(t))throw Error(i(299));var p=!1,w="",E=Rm,M=Lm,K=Om,J=null;return a!=null&&(a.unstable_strictMode===!0&&(p=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=fx(t,1,!0,n,a??null,p,w,J,E,M,K,Cx),n.context=px(null),a=n.current,p=Rn(),p=xc(p),w=Wr(p),w.callback=null,Vr(a,w,p),a=p,n.current.lanes=a,$s(n,a),ar(n),t[qs]=n.current,ld(t),new kl(n)},Oa.version="19.2.4",Oa}var Mx;function v1(){if(Mx)return Ad.exports;Mx=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(),Ad.exports=b1(),Ad.exports}var y1=v1();const _1=Zl(y1),Ix=e=>{let r;const s=new Set,i=(f,g)=>{const m=typeof f=="function"?f(r):f;if(!Object.is(m,r)){const v=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),s.forEach(S=>S(r,v))}},l=()=>r,c={setState:i,getState:l,getInitialState:()=>d,subscribe:f=>(s.add(f),()=>s.delete(f))},d=r=e(i,l,c);return c},S1=(e=>e?Ix(e):Ix),w1=e=>e;function C1(e,r=w1){const s=dn.useSyncExternalStore(e.subscribe,dn.useCallback(()=>r(e.getState()),[e,r]),dn.useCallback(()=>r(e.getInitialState()),[e,r]));return dn.useDebugValue(s),s}const Bx=e=>{const r=S1(e),s=i=>C1(r,i);return Object.assign(s,r),s},Bn=(e=>e?Bx(e):Bx);async function ke(e,r={}){const s=localStorage.getItem("openfox_token"),i={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...s?{"x-session-token":s}:{}};return fetch(e,{...r,headers:i})}async function k1(e,r){try{return(await ke(`/api/sessions/${e}/truncate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageIndex:r})})).ok}catch{return!1}}const ot={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings",DISPLAY_SHOW_THINKING:"display.showThinking",DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT:"display.showVerboseToolOutput",DISPLAY_SHOW_STATS:"display.showStats",DISPLAY_SHOW_AGENT_DEFINITIONS:"display.showAgentDefinitions",DISPLAY_SHOW_WORKFLOW_BARS:"display.showWorkflowBars",DISPLAY_THEME:"display.theme",DISPLAY_USER_PRESETS:"display.userPresets"};function jl(e,r){return s=>({loading:{...s.loading,[e]:r}})}function zx(e,r){return s=>({settings:{...s.settings,[e]:r},loading:{...s.loading,[e]:!1}})}const Rv=[ot.DISPLAY_SHOW_THINKING,ot.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,ot.DISPLAY_SHOW_STATS,ot.DISPLAY_SHOW_AGENT_DEFINITIONS,ot.DISPLAY_SHOW_WORKFLOW_BARS];function Th(){return{showThinking:hn(e=>e.settings[ot.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:hn(e=>e.settings[ot.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:hn(e=>e.settings[ot.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:hn(e=>e.settings[ot.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:hn(e=>e.settings[ot.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const hn=Bn(e=>({settings:{},loading:{},getSetting:async r=>{e(jl(r,!0));try{const i=await(await ke(`/api/settings/${r}`)).json();return e(zx(r,i.value??"")),i.value}catch{return e(jl(r,!1)),null}},setSetting:async(r,s)=>{e(jl(r,!0));try{const l=await(await ke(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s})})).json();e(zx(r,l.value??""))}catch{e(jl(r,!1))}}})),Px=Object.freeze(Object.defineProperty({__proto__:null,DISPLAY_SETTINGS_KEYS:Rv,SETTINGS_KEYS:ot,useDisplaySettings:Th,useSettingsStore:hn},Symbol.toStringTag,{value:"Module"}));function E1(){const[e,r]=z.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),s=z.useRef(window.innerHeight);return z.useEffect(()=>{const i=window.visualViewport;if(!i)return;const l=()=>{const u=i.offsetTop,h=i.height,c=s.current-h>100;r({offsetTop:u,height:h,keyboardVisible:c})};return l(),i.addEventListener("resize",l),i.addEventListener("scroll",l),()=>{i.removeEventListener("resize",l),i.removeEventListener("scroll",l)}},[]),e}function j1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var s,i,l,u,h=[],c="",d=e.split("/");for(d[0]||d.shift();l=d.shift();)s=l[0],s==="*"?(h.push(s),c+=l[1]==="?"?"(?:/(.*))?":"/(.*)"):s===":"?(i=l.indexOf("?",1),u=l.indexOf(".",1),h.push(l.substring(1,~i?i:~u?u:l.length)),c+=~i&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(c+=(~i?"?":"")+"\\"+l.substring(u))):c+="/"+l;return{keys:h,pattern:new RegExp("^"+c+(r?"(?=$|/)":"/?$"),"i")}}var Od={exports:{}},Md={};/**
|
|
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 Hx;function N1(){if(Hx)return Md;Hx=1;var e=Ql();function r(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var s=typeof Object.is=="function"?Object.is:r,i=e.useState,l=e.useEffect,u=e.useLayoutEffect,h=e.useDebugValue;function c(m,v){var S=v(),k=i({inst:{value:S,getSnapshot:v}}),C=k[0].inst,y=k[1];return u(function(){C.value=S,C.getSnapshot=v,d(C)&&y({inst:C})},[m,S,v]),l(function(){return d(C)&&y({inst:C}),m(function(){d(C)&&y({inst:C})})},[m]),h(S),S}function d(m){var v=m.getSnapshot;m=m.value;try{var S=v();return!s(m,S)}catch{return!0}}function f(m,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Md.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Md}var Fx;function T1(){return Fx||(Fx=1,Od.exports=N1()),Od.exports}var A1=T1();const D1=p1.useInsertionEffect,R1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",L1=R1?z.useLayoutEffect:z.useEffect,O1=D1||L1,Lv=e=>{const r=z.useRef([e,(...s)=>r[0](...s)]).current;return O1(()=>{r[0]=e}),r[1]},M1="popstate",Ah="pushState",Dh="replaceState",I1="hashchange",Ux=[M1,Ah,Dh,I1],B1=e=>{for(const r of Ux)addEventListener(r,e);return()=>{for(const r of Ux)removeEventListener(r,e)}},Ov=(e,r)=>A1.useSyncExternalStore(B1,e,r),$x=()=>location.search,z1=({ssrSearch:e}={})=>Ov($x,e!=null?()=>e:$x),qx=()=>location.pathname,P1=({ssrPath:e}={})=>Ov(qx,e!=null?()=>e:qx),H1=(e,{replace:r=!1,state:s=null}={})=>history[r?Dh:Ah](s,"",e),F1=(e={})=>[P1(e),H1],Wx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Wx]>"u"){for(const e of[Ah,Dh]){const r=history[e];history[e]=function(){const s=r.apply(this,arguments),i=new Event(e);return i.arguments=arguments,dispatchEvent(i),s}}Object.defineProperty(window,Wx,{value:!0})}const U1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",Mv=(e="")=>e==="/"?"":e,$1=(e,r)=>e[0]==="~"?e.slice(1):Mv(r)+e,q1=(e="",r)=>U1(Vx(Mv(e)),Vx(r)),Vx=e=>{try{return decodeURI(e)}catch{return e}},Iv={hook:F1,searchHook:z1,parser:j1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,s)=>e(r,s)},Bv=z.createContext(Iv),Hi=()=>z.useContext(Bv),zv={},Pv=z.createContext(zv),W1=()=>z.useContext(Pv),Jl=e=>{const[r,s]=e.hook(e);return[q1(e.base,r),Lv((i,l)=>e.aroundNav(s,$1(i,e.base),l))]},nr=()=>Jl(Hi()),Rh=(e,r,s,i)=>{const{pattern:l,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",i),h=l.exec(s)||[],[c,...d]=h;return c!==void 0?[!0,(()=>{const f=u!==!1?Object.fromEntries(u.map((m,v)=>[m,d[v]])):h.groups;let g={...d};return f&&Object.assign(g,f),g})(),...i?[c]:[]]:[!1,null]},Lh=e=>Rh(Hi().parser,e,nr()[0]),V1=({children:e,...r})=>{var g,m,v;const s=Hi(),i=r.hook?Iv:s;let l=i;const[u,h=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=h,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((v=r.hook)==null?void 0:v.searchHook);let c=z.useRef({}),d=c.current,f=d;for(let S in i){const k=S==="base"?i[S]+(r[S]??""):r[S]??i[S];d===f&&k!==f[S]&&(c.current=f={...f}),f[S]=k,(k!==i[S]||k!==l[S])&&(l=f)}return z.createElement(Bv.Provider,{value:l,children:e})},Gx=({children:e,component:r},s)=>r?z.createElement(r,{params:s}):typeof e=="function"?e(s):e,G1=e=>{let r=z.useRef(zv);const s=r.current;return r.current=Object.keys(e).length!==Object.keys(s).length||Object.entries(e).some(([i,l])=>l!==s[i])?e:s},Ma=({path:e,nest:r,match:s,...i})=>{const l=Hi(),[u]=Jl(l),[h,c,d]=s??Rh(l.parser,e,u,r),f=G1({...W1(),...c});if(!h)return null;const g=d?z.createElement(V1,{base:d},Gx(i,f)):Gx(i,f);return z.createElement(Pv.Provider,{value:f,children:g})},Mn=z.forwardRef((e,r)=>{const s=Hi(),[i,l]=Jl(s),{to:u="",href:h=u,onClick:c,asChild:d,children:f,className:g,replace:m,state:v,transition:S,...k}=e,C=Lv(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(c==null||c(b),b.defaultPrevented||(b.preventDefault(),l(h,e)))}),y=s.hrefs(h[0]==="~"?h.slice(1):s.base+h,s);return d&&z.isValidElement(f)?z.cloneElement(f,{onClick:C,href:y}):z.createElement("a",{...k,onClick:C,href:y,className:g!=null&&g.call?g(i===h):g,children:f,ref:r})}),Hv=e=>Array.isArray(e)?e.flatMap(r=>Hv(r&&r.type===z.Fragment?r.props.children:r)):[e],K1=({children:e,location:r})=>{const s=Hi(),[i]=Jl(s);for(const l of Hv(e)){let u=0;if(z.isValidElement(l)&&(u=Rh(s.parser,l.props.path,r||i,l.props.nest))[0])return z.cloneElement(l,{match:u})}return null};function Y1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function Fv(){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 X1{constructor(r){or(this,"ws",null);or(this,"handlers",new Set);or(this,"statusHandler",null);or(this,"baseUrl");or(this,"isReconnecting",!1);or(this,"connectingPromise",null);or(this,"lastCloseCode",0);or(this,"reconnectAttempts",0);or(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const s=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${s}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,s;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((i,l)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const h=setTimeout(()=>{var c;((c=this.ws)==null?void 0:c.readyState)===WebSocket.CONNECTING&&(this.ws.close(),l(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var c;clearTimeout(h),this.isReconnecting=!1,this.connectingPromise=null,(c=this.statusHandler)==null||c.call(this,"connected"),i()},this.ws.onclose=c=>{var d,f,g;clearTimeout(h),this.lastCloseCode=c.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(f=this.statusHandler)==null||f.call(this,"disconnected"),l(new Error(`Connection closed: ${c.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=c=>{clearTimeout(h),console.error("WebSocket error:",c),this.connectingPromise=null,l(c)},this.ws.onmessage=c=>{try{const d=JSON.parse(c.data);Y1(d)&&this.handlers.forEach(f=>f(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,l(u)}}),this.connectingPromise))}attemptReconnect(){var l;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.warn("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(l=this.statusHandler)==null||l.call(this,"reconnecting");const i=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(()=>{})},i)}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,s){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const i=Fv(),l={id:i,type:r,payload:s};return this.ws.send(JSON.stringify(l)),i}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 Z1=window.location.protocol==="https:"?"wss:":"ws:";let lh=window.location.port;lh||(lh=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"10469":window.location.protocol==="https:"?"443":"80");const Q1=`${Z1}//${window.location.hostname}:${lh}/ws`,Wt=new X1(Q1),ds=async(e,r,s)=>{try{const i=await ke(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return i.ok?{success:!0}:{success:!1,error:(await i.json()).error}}catch{return{success:!1,error:"Network error"}}};function Uv(e){let r=null;function s(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return s}let Nl=[];const ur=Bn()((e,r)=>{function s(){if(Nl.length===0)return;const l=Nl;Nl=[],e(u=>({logs:[...u.logs,...l]}))}const i=Uv(s);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:l=>{r().workdir!==l&&(e({workdir:l,status:null,logs:[],config:null,loading:!0}),l&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const l=r().workdir;if(l)try{const h=await(await ke(`/api/dev-server?workdir=${encodeURIComponent(l)}`)).json();e({status:h,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const l=r().workdir;if(l)try{const h=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(l)}`)).json();e({config:h.config??null})}catch{}},fetchLogs:async()=>{const l=r().workdir;if(l)try{const c=(await(await ke(`/api/dev-server/logs?workdir=${encodeURIComponent(l)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:c})}catch{}},start:async()=>{const l=r().workdir;if(l)try{const h=await(await ke(`/api/dev-server/start?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:h,logs:[]})}catch{}},stop:async()=>{const l=r().workdir;if(l)try{const h=await(await ke(`/api/dev-server/stop?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:h})}catch{}},restart:async()=>{const l=r().workdir;if(l)try{const h=await(await ke(`/api/dev-server/restart?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:h,logs:[]})}catch{}},saveConfig:async l=>{const u=r().workdir;if(u)try{const c=await(await ke(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();e({config:c.config??l}),r().fetchStatus()}catch{}},handleMessage:l=>{const u=r().workdir;if(u)switch(l.type){case"devServer.output":{const h=l.payload;if(h.workdir!==u)return;Nl.push({stream:h.stream,content:h.content}),i();break}case"devServer.state":{const h=l.payload;if(h.workdir!==u)return;e(c=>({status:c.status?{...c.status,state:h.state,errorMessage:h.errorMessage}:c.status}));break}}}}});function J1(e){return{...e.temperature!=null&&{temperature:e.temperature},...e.topP!=null&&{topP:e.topP},...e.topK!=null&&{topK:e.topK},...e.maxTokens!=null&&{maxTokens:e.maxTokens}}}async function Kx(e,r,s){const i=await ke(`/api/providers/${e}/models/${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok){const l=await i.json();throw new Error(l.error??"Failed to update model")}return i.json()}function Yx(e,r,s,i){return e.map(l=>l.id===r?{...l,models:l.models.map(u=>u.id===s?{...u,...i,source:"user"}:u)}:l)}const ew=3e4;function tw(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 Ct=Bn((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 s=await ke("/api/config");if(!s.ok)throw new Error("Failed to fetch config");const i=await s.json();e({version:i.version,model:i.model,maxContext:i.maxContext,llmUrl:i.llmUrl,llmStatus:i.llmStatus,backend:i.backend,providers:i.providers??[],activeProviderId:i.activeProviderId??null,defaultModelSelection:i.defaultModelSelection??null,loading:!1})}catch(s){e({error:s instanceof Error?s.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const s=await ke("/api/model/refresh",{method:"POST"});if(!s.ok)throw new Error("Failed to refresh model");const i=await s.json(),u=Se.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:i.llmStatus,backend:i.backend});return}e({model:i.model,llmStatus:i.llmStatus,backend:i.backend})}catch(s){console.error("Failed to refresh model:",s)}},activateProvider:async s=>{const{activeProviderId:i,providers:l}=r();if(s===i)return!0;e({activating:!0,error:null});try{const u=await ke(`/api/providers/${s}/activate`,{method:"POST"});if(!u.ok){const c=await u.json();throw new Error(c.error??"Failed to activate provider")}const h=await u.json();return e({activeProviderId:h.activeProviderId,model:h.model,backend:h.backend,providers:l.map(c=>({...c,isActive:c.id===h.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(s,i)=>{var c;const{providers:l,defaultModelSelection:u}=r();let h=i;if(!h){const d=u?u.split("/"):[],f=d[0],g=d.slice(1).join("/")??"";if(f===s&&g)h=g;else{const m=l.find(v=>v.id===s);h=((c=m==null?void 0:m.models[0])==null?void 0:c.id)??""}}e({activeProviderId:s,model:h,defaultModelSelection:`${s}/${h}`,providers:l.map(d=>({...d,isActive:d.id===s}))})},updateModelContext:async(s,i,l)=>{e({activating:!0,error:null});try{const u=await Kx(s,i,{contextWindow:l}),{providers:h}=r();return e({providers:Yx(h,s,i,{contextWindow:l}),activating:!1}),u.contextState&&Se.getState().updateContextState(u.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},updateModelSettings:async(s,i,l)=>{e({activating:!0,error:null});try{const u=await Kx(s,i,l),{providers:h}=r(),c={...l.contextWindow!==void 0&&{contextWindow:l.contextWindow},...J1({temperature:l.temperature??void 0,topP:l.topP??void 0,topK:l.topK??void 0,maxTokens:l.maxTokens??void 0}),...l.supportsVision!==void 0&&{supportsVision:l.supportsVision}};return e({providers:Yx(h,s,i,c),activating:!1}),u.contextState&&Se.getState().updateContextState(u.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model settings",activating:!1}),!1}},refreshProviderModels:async s=>{e({activating:!0,error:null});try{const i=await ke(`/api/providers/${s}/refresh`,{method:"POST"});if(!i.ok){const h=await i.json();throw new Error(h.error??"Failed to refresh models")}const l=await i.json(),{providers:u}=r();return e({providers:u.map(h=>h.id===s?{...h,models:l.models,status:l.status}:h),activating:!1}),!0}catch(i){return e({error:i instanceof Error?i.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:s,refreshModel:i}=r();if(s)return;const l=setInterval(()=>{i()},ew);e({autoRefreshInterval:l})},stopAutoRefresh:()=>{const{autoRefreshInterval:s}=r();s&&(clearInterval(s),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:s,activeProviderId:i}=r();return s.find(l=>l.id===i)},getModelContext:s=>{const{providers:i,activeProviderId:l}=r(),u=i.find(c=>c.id===l);if(!u)return 2e5;const h=u.models.find(c=>c.id===s);return(h==null?void 0:h.contextWindow)??2e5}})),Ot=Bn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const i=await(await ke("/api/projects")).json();e({projects:i.projects??[],loading:!1})}catch(s){console.error("Failed to load projects:",s),e({loading:!1})}},createProject:async(s,i)=>{try{const l=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:i})});if(!l.ok){const h=await l.json().catch(()=>({}));return{error:{code:h.code||"UNKNOWN",path:h.path,message:h.error}}}const u=await l.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async s=>{try{const i=await ke(`/api/projects/${s}`);if(!i.ok)return null;const l=await i.json();return e({currentProject:l.project}),r().projects.length===0&&await r().listProjects(),l.project}catch{return null}},updateProject:async(s,i)=>{var l;try{const u=await ke(`/api/projects/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!u.ok)return null;const h=await u.json();return((l=r().currentProject)==null?void 0:l.id)===s&&e({currentProject:h.project}),await r().listProjects(),h.project}catch{return null}},deleteProject:async s=>{var i;try{return(await ke(`/api/projects/${s}`,{method:"DELETE"})).ok?(await r().listProjects(),((i=r().currentProject)==null?void 0:i.id)===s&&e({currentProject:null}),!0):!1}catch{return!1}},toggleStar:async(s,i)=>{var l;try{const u=await ke(`/api/projects/${s}/star`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isStarred:i})});if(!u.ok)return!1;if(((l=r().currentProject)==null?void 0:l.id)===s){const h=await u.json();e({currentProject:h.project})}return await r().listProjects(),!0}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let Tl=[];const Ka=Bn()((e,r)=>{function s(){if(Tl.length===0)return;const l=Tl;Tl=[],e(u=>{const h={...u.logs};for(const c of l){const d=h[c.processId]??[];h[c.processId]=[...d,{offset:d.length,content:c.content,timestamp:Date.now(),stream:c.stream}]}return{logs:h}})}const i=Uv(s);return{processes:[],logs:{},loading:!1,setProcesses:l=>e({processes:l}),addProcess:l=>e(u=>({processes:[...u.processes,l]})),updateProcess:(l,u)=>e(h=>({processes:h.processes.map(c=>c.id===l?{...c,...u}:c)})),removeProcess:l=>e(u=>({processes:u.processes.filter(h=>h.id!==l),logs:Object.fromEntries(Object.entries(u.logs).filter(([h])=>h!==l))})),stopProcess:async(l,u)=>{try{(await ke(`/api/sessions/${u}/background-process/${l}/stop`,{method:"POST"})).ok&&r().removeProcess(l)}catch{}},appendLog:(l,u,h)=>{Tl.push({processId:l,stream:u,content:h}),i()},setLogs:(l,u)=>e(h=>({logs:{...h.logs,[l]:u}})),clearLogs:l=>e(u=>({logs:{...u.logs,[l]:[]}})),handleMessage:(l,u)=>{switch(l){case"backgroundProcess.started":{const{processId:h,name:c,pid:d,status:f}=u;e(g=>({processes:[...g.processes,{id:h,sessionId:"",name:c,command:"",cwd:"",pid:d,status:f,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const h=u.processId,c=u.stream,d=u.content;r().appendLog(h,c,d);break}case"backgroundProcess.exited":{const h=u.processId,c=u.exitCode;e(d=>({processes:d.processes.map(f=>f.id===h?{...f,status:"exited",exitCode:c}:f)}));break}case"backgroundProcess.removed":{const h=u.processId;r().removeProcess(h);break}}}}}),nw=[{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"}],rw=[{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"}],$v={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"},cs={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},qv={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},ch={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...cs},waiting_for_user:{...cs},phase_done:{...cs},phase_blocked:{...cs},new_message:{...qv}},agentOverrides:{}};function Wv(e,r,s){var u;const i=e.events[r];if(!s)return i;const l=(u=e.agentOverrides[s])==null?void 0:u[r];return l?{soundEnabled:l.soundEnabled??i.soundEnabled,browserNotification:l.browserNotification??i.browserNotification,customSoundUrl:l.customSoundUrl!==void 0?l.customSoundUrl:i.customSoundUrl}:i}const Ms=Bn((e,r)=>({settings:ch,loaded:!1,load:()=>{hn.getState().getSetting(ot.NOTIFICATION_SETTINGS);const i=hn.subscribe(u=>{const h=u.settings[ot.NOTIFICATION_SETTINGS];if(h!==void 0)try{const c=JSON.parse(h);e({settings:Xx(c),loaded:!0})}catch{e({loaded:!0})}}),l=hn.getState().settings[ot.NOTIFICATION_SETTINGS];if(l)try{const u=JSON.parse(l);e({settings:Xx(u),loaded:!0})}catch{e({loaded:!0})}return i},update:s=>{e({settings:s}),Id(s)},updateEvent:(s,i)=>{const l=r().settings,u={...l,events:{...l.events,[s]:{...l.events[s],...i}}};e({settings:u}),Id(u)},updateAgentOverride:(s,i,l)=>{var d;const u=r().settings,h={...u.agentOverrides};if(l===null){if(h[s]){const f={...h[s]};delete f[i],Object.keys(f).length===0?delete h[s]:h[s]=f}}else h[s]={...h[s],[i]:{...((d=h[s])==null?void 0:d[i])??{},...l}};const c={...u,agentOverrides:h};e({settings:c}),Id(c)}}));function Id(e){hn.getState().setSetting(ot.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Xx(e){var r,s,i,l,u;return{soundEnabled:e.soundEnabled??ch.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??ch.browserNotificationEnabled,events:{complete:{...cs,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...cs,...(s=e.events)==null?void 0:s.waiting_for_user},phase_done:{...cs,...(i=e.events)==null?void 0:i.phase_done},phase_blocked:{...cs,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...qv,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Zx=new Map;function sw(e){let r=Zx.get(e);return r||(r=new Audio(e),r.volume=.5,Zx.set(e,r)),r}let Vv=typeof Notification<"u"?Notification.permission:"denied";function iw(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Vv=e,e))}const aw={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},ow={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 lw(e){typeof Notification>"u"||Vv==="granted"&&(document.hasFocus()||new Notification(aw[e],{body:ow[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function ao(e,r){const{settings:s}=Ms.getState(),i=Wv(s,e,r);if(s.soundEnabled&&i.soundEnabled){const l=i.customSoundUrl??$v[e],u=sw(l);u.currentTime=0,u.play().catch(()=>{})}s.browserNotificationEnabled&&i.browserNotification&&lw(e)}const cw=e=>ao("complete",e),uw=e=>ao("phase_done",e),dw=e=>ao("phase_blocked",e),Qx=e=>ao("waiting_for_user",e),hw=e=>ao("new_message",e);let Ia=!1,lr=null;const Bd=new Set,qt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Mi=null,un=null;function zd(){Mi===null&&(Mi=requestAnimationFrame(()=>{Mi=null,un==null||un()}))}function As(){Mi!==null&&(cancelAnimationFrame(Mi),Mi=null)}function zt(e,r){return r!==null&&e.sessionId===r}function fw(e,r,s){return e.id!==void 0||zt(e,r)||s===!0&&e.sessionId!==void 0}function pw(e,r){return e.includes(r)?e:[...e,r]}function Ba(e,r){return e.filter(s=>s!==r)}function mw(e,r){const s=e.find(l=>l.id===r.id),i=s?{...s,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning&&s.isRunning!==!1,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(l=>l.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(l=>l.status.type==="passed").length,messageCount:r.messages.length};return s?e.map(l=>l.id===r.id?i:l):[i,...e]}function Jx(e,r,s){return e.map(i=>{const l=(s==null?void 0:s.id)===i.id?s:null,u=r.find(h=>h.id===i.id);return{...i,title:i.title??(u==null?void 0:u.title),mode:(l==null?void 0:l.mode)??(u==null?void 0:u.mode)??i.mode,phase:(l==null?void 0:l.phase)??(u==null?void 0:u.phase)??i.phase,isRunning:i.isRunning&&(u==null?void 0:u.isRunning)!==!1,messageCount:i.messageCount,recentUserPrompts:i.recentUserPrompts}})}const eb=new Map;function Va(e,r){var u;const s=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,i=e.sessions.find(h=>h.id===r),l=(s==null?void 0:s.mode)??(i==null?void 0:i.mode);return l==="planner"?"planner":l==="builder"?"build":"planner"}function gw(e,r){if(e.type==="chat.done"){const s=e.payload,i=Va(r,e.sessionId),l=s.agentType??i;s.reason==="complete"&&cw(l),s.reason==="waiting_for_user"&&Qx(l);return}if(e.type==="chat.path_confirmation"){const s=Va(r,e.sessionId);Qx(s);return}if(e.type==="task.completed"){const s=Va(r,e.sessionId);uw(s);return}if(e.type==="phase.changed"&&e.sessionId){const s=e.payload,i=eb.get(e.sessionId)??null;if(eb.set(e.sessionId,s.phase),i===s.phase)return;const l=Va(r,e.sessionId);s.phase==="blocked"&&dw(l)}}const Se=Bn((e,r)=>(un=()=>{const s=qt;if(!s.messageId)return;const i=s.deltaContent.length>0,l=s.thinkingContent.length>0,u=s.toolOutput.length>0;if(!i&&!l&&!u)return;const h=s.deltaContent,c=s.thinkingContent,d=s.toolOutput;s.deltaContent="",s.thinkingContent="",s.toolOutput=[],e(f=>{var m;const g=f.streamingMessage;if(g&&g.id===s.messageId){const v={...g};if(i&&(v.content=v.content+h),l&&(v.thinkingContent=(v.thinkingContent??"")+c),u){const S=new Set;v.toolCalls=(m=v.toolCalls)==null?void 0:m.map(C=>{const y=d.filter(b=>b.callId===C.id);return y.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...y.map(b=>({stream:b.stream,content:b.content,timestamp:Date.now()}))]})});const k=d.filter(C=>!S.has(C.callId));k.length>0&&qt.toolOutput.push(...k)}return{streamingMessage:v}}if(u){const v=new Set,S=f.messages.map(C=>{var b;if(C.id!==s.messageId)return C;const y=(b=C.toolCalls)==null?void 0:b.map(x=>{const _=d.filter(j=>j.callId===x.id);return _.length===0?x:(v.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],..._.map(j=>({stream:j.stream,content:j.content,timestamp:Date.now()}))]})});return{...C,toolCalls:y}}),k=d.filter(C=>!v.has(C.callId));return k.length>0&&qt.toolOutput.push(...k),{messages:S}}return f})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},gitStatus:null,queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{if(r().connectionStatus==="connected")return;e({connectionStatus:"reconnecting"});let i=!1;try{i=(await(await ke("/api/auth")).json()).requiresAuth}catch{}if(i&&!Wt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Wt.onStatusChange(l=>{var u;if(e({connectionStatus:l}),l==="connected"){r().listSessions(void 0),Ot.getState().listProjects();const h=(u=r().currentSession)==null?void 0:u.id;h&&r().loadSession(h)}});try{if(await Wt.connect(),!Ia){Ia=!0;const l=r().handleServerMessage;lr=Wt.subscribe(l)}}catch(l){console.error("Failed to connect:",l);const u=Wt.getLastCloseCode();if(!Wt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}lr&&(lr(),lr=null),Ia=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Wt.disconnect(),lr&&(lr(),lr=null),Ia=!1,e({connectionStatus:"disconnected"}),r().connect()},disconnect:()=>{Wt.disconnect(),lr&&(lr(),lr=null),Ia=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async s=>{try{const i=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:s})});if(!i.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:l}=await i.json();Wt.setToken(l),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Ot.getState(),{fetchConfig:h}=Ct.getState();u(),h(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Wt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(s,i)=>{if(r().pendingSessionCreate)return null;try{e({pendingSessionCreate:!0});const u=await ke("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:s,title:i})});if(!u.ok)return e({pendingSessionCreate:!1}),null;const h=await u.json();return Wt.send("session.load",{sessionId:h.session.id}),h.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async s=>{try{const i=r().currentSession;!i||i.id!==s?(As(),e({currentSession:null,unreadSessionIds:Ba(r().unreadSessionIds,s),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null,pendingSessionCreate:!1})):e({unreadSessionIds:Ba(r().unreadSessionIds,s)});const l=await ke(`/api/sessions/${s}`);if(!l.ok)return;const u=await l.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Wt.send("session.load",{sessionId:s});try{const h=await ke(`/api/sessions/${s}/background-processes`);if(h.ok){const c=await h.json();Ka.getState().setProcesses(c.processes??[])}}catch{}}catch{}},listSessions:async(s,i=20)=>{try{const l=new URLSearchParams;l.set("limit",String(i)),s&&l.set("projectId",s);const h=await(await ke(`/api/sessions?${l.toString()}`)).json(),c=h.sessions??[];e(d=>({sessions:Jx(c,d.sessions,d.currentSession),sessionsHasMore:s?h.hasMore??!1:!0}))}catch{}},loadMoreSessions:async s=>{const i=r();if(!(i.sessionsPaginationLoading||!i.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const l=new URLSearchParams;l.set("limit","20"),l.set("offset",String(i.sessions.length)),l.set("projectId",s);const h=await(await ke(`/api/sessions?${l.toString()}`)).json(),c=h.sessions??[];e(d=>({sessions:[...d.sessions,...c.map(f=>{const g=d.sessions.find(m=>m.id===f.id);return(g==null?void 0:g.isRunning)===!1?{...f,isRunning:!1}:f})],sessionsHasMore:h.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async s=>{var i;try{return(await ke(`/api/sessions/${s}`,{method:"DELETE"})).ok?(await r().listSessions(),((i=r().currentSession)==null?void 0:i.id)===s&&r().clearSession(),!0):!1}catch{return!1}},renameSession:async(s,i)=>{var l;try{const u=await ke(`/api/sessions/${s}/title`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!u.ok)return!1;if(await r().listSessions(),((l=r().currentSession)==null?void 0:l.id)===s){const c=await u.json();c.session&&e({currentSession:c.session})}return!0}catch{return!1}},deleteAllSessions:async s=>{try{return(await ke(`/api/projects/${s}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{As(),e(s=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingSessionCreate:!1,unreadSessionIds:s.currentSession?Ba(s.unreadSessionIds,s.currentSession.id):s.unreadSessionIds}))},sendMessage:async(s,i,l)=>{var h;const u=(h=r().currentSession)==null?void 0:h.id;if(u){e({streamingMessageId:null});try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:l==null?void 0:l.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error sending message:",c)}}},stopGeneration:async()=>{var i;const s=(i=r().currentSession)==null?void 0:i.id;if(s&&!r().abortInProgress){As(),un==null||un(),e({abortInProgress:!0});try{await ke(`/api/sessions/${s}/stop`,{method:"POST"})}catch(l){console.error("Error stopping generation:",l)}}},continueGeneration:async()=>{var i;const s=(i=r().currentSession)==null?void 0:i.id;if(s){e({streamingMessageId:null});try{await ke(`/api/sessions/${s}/continue`,{method:"POST"})}catch(l){console.error("Error continuing generation:",l)}}},launchRunner:(s,i,l)=>{e({streamingMessageId:null});const u={};s!=null&&s.trim()&&(u.content=s),i&&i.length>0&&(u.attachments=i),l&&(u.workflowId=l),Wt.send("runner.launch",u)},switchMode:async s=>{var l;const i=(l=r().currentSession)==null?void 0:l.id;if(i)try{const u=await ke(`/api/sessions/${i}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:s})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const h=await u.json();h.session&&e({currentSession:h.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async s=>{var l;const i=(l=r().currentSession)==null?void 0:l.id;if(i)try{const u=await ke(`/api/sessions/${i}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:s})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const h=await u.json();h.session&&e({currentSession:h.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(s,i,l)=>{var c;e({streamingMessageId:null});const u={};s&&(u.workflowId=s),i!=null&&i.trim()&&(u.content=i),l&&l.length>0&&(u.attachments=l);const h=(c=r().currentSession)==null?void 0:c.id;h&&ke(`/api/sessions/${h}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"builder"})}).then(()=>{Wt.send("runner.launch",u)})},editCriteria:async s=>{var l;const i=(l=r().currentSession)==null?void 0:l.id;if(i)try{const u=await ke(`/api/sessions/${i}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:s})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Wt.send("context.compact",{})},setSessionProvider:async(s,i)=>{var l,u;try{const h=(l=r().currentSession)==null?void 0:l.id;if(!h)return null;const c=await ke(`/api/sessions/${h}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:s,...i?{model:i}:{}})});if(!c.ok)return null;const d=await c.json();if(e({currentSession:d.session,messages:d.messages??[],contextState:d.contextState}),(u=d.session)!=null&&u.providerId){const f=Ct.getState();f.providers.find(m=>m.id===d.session.providerId)&&f.syncFromSession(d.session.providerId,d.session.providerModel??"")}return d.session}catch{return null}},updateContextState:s=>{e({contextState:s})},updateSubAgentContextState:(s,i)=>{e(l=>({subAgentContextStates:{...l.subAgentContextStates,[s]:i}}))},clearSubAgentContextState:s=>{e(i=>{const l={...i.subAgentContextStates};return delete l[s],{subAgentContextStates:l}})},confirmPath:async(s,i,l=!1)=>{var h;const u=(h=r().currentSession)==null?void 0:h.id;if(u)try{await ke(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:s,approved:i,alwaysAllow:l})})}catch(c){console.error("Error confirming path:",c)}},answerQuestion:async(s,i)=>{var u;const l=(u=r().currentSession)==null?void 0:u.id;if(l){try{await ke(`/api/sessions/${l}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:s,answer:i})})}catch(h){console.error("Error answering question:",h)}e({pendingQuestion:null})}},queueAsap:async(s,i,l)=>{var h;const u=(h=r().currentSession)==null?void 0:h.id;if(u)try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing ASAP message:",c)}},queueCompletion:async(s,i,l)=>{var h;const u=(h=r().currentSession)==null?void 0:h.id;if(u)try{const d=await(await ke(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,attachments:i,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing completion message:",c)}},cancelQueued:async s=>{var l;const i=(l=r().currentSession)==null?void 0:l.id;if(i)try{const h=await(await ke(`/api/sessions/${i}/queue/${s}`,{method:"DELETE"})).json();h.queueState&&e({queuedMessages:h.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:s=>{var h,c,d,f,g,m,v,S,k,C,y,b,x,_,j,T,N,D,A,P,O,H,q,W,G;const i=r();gw(s,i);const l=((h=i.currentSession)==null?void 0:h.id)??null,u=()=>{const B=s.sessionId;!B||B===l||e(F=>({unreadSessionIds:pw(F.unreadSessionIds,B)}))};switch(s.type){case"session.state":{const B=s.payload;if(!fw(s,l,i.pendingSessionCreate))break;As();const F=B.messages.find(R=>R.isStreaming)??null,Z=r().pendingSessionCreate===!0,Y=B.pendingConfirmations??[],L=i.pendingPathConfirmation??(Y.length>0?Y[0]??null:null);if(e({currentSession:B.session,sessions:mw(r().sessions,B.session),unreadSessionIds:Ba(r().unreadSessionIds,B.session.id),messages:B.messages,streamingMessageId:(F==null?void 0:F.id)??null,streamingMessage:F,currentTodos:[],pendingPathConfirmation:L,error:null,...Z?{pendingSessionCreate:B.session.id}:{}}),B.session.providerId){const R=Ct.getState();R.providers.find(U=>U.id===B.session.providerId)&&R.syncFromSession(B.session.providerId,B.session.providerModel??"")}break}case"session.list":{const B=s.payload;e(F=>({sessions:Jx(B.sessions,F.sessions,F.currentSession)}));break}case"session.deleted":{const B=s.payload;e(F=>({unreadSessionIds:Ba(F.unreadSessionIds,B.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const B=s.payload,F=s.sessionId,Z=(c=r().currentSession)==null?void 0:c.id,Y=F&&F!==Z;e(I=>({sessions:I.sessions.map(L=>L.id===F?{...L,isRunning:B.isRunning}:L)})),Y||e(I=>({currentSession:I.currentSession?{...I.currentSession,isRunning:B.isRunning}:null,...B.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!zt(s,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const B=s.payload;e(F=>F.messages.some(Z=>Z.id===B.message.id)?F:{messages:[...F.messages,B.message],streamingMessageId:B.message.isStreaming?B.message.id:F.streamingMessageId,streamingMessage:B.message.isStreaming?B.message:F.streamingMessage});break}case"chat.message_updated":{if(!zt(s,((f=r().currentSession)==null?void 0:f.id)??null)){u();break}const B=s.payload,F=B.updates.isStreaming===!1&&r().streamingMessageId===B.messageId;F&&(As(),un==null||un()),e(Z=>{const Y=Z.streamingMessage,I=F;if(Y&&Y.id===B.messageId){const L={...Y,...B.updates};return{messages:Z.messages.map(R=>R.id===B.messageId?L:R),streamingMessageId:I?null:Z.streamingMessageId,streamingMessage:I?null:{...Y,...B.updates}}}return{messages:Z.messages.map(L=>L.id===B.messageId?{...L,...B.updates}:L),streamingMessageId:I?null:Z.streamingMessageId}});break}case"chat.delta":{if(!zt(s,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const B=s.payload;if(!Bd.has(B.messageId)){Bd.add(B.messageId);const F=Va(r(),s.sessionId);hw(F)}qt.messageId=B.messageId,qt.deltaContent+=B.content,zd();break}case"chat.thinking":{if(!zt(s,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const B=s.payload;qt.messageId=B.messageId,qt.thinkingContent+=B.content,zd();break}case"chat.tool_preparing":{if(!zt(s,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const B=s.payload,F=r().streamingMessage;if(!F||F.id!==B.messageId||((S=F.toolCalls)==null?void 0:S.find((Y,I)=>I===B.index)))return;e(Y=>{const I=Y.streamingMessage.preparingToolCalls??[],L=I.findIndex($=>$.index===B.index);let R;return L>=0?R=I.map(($,U)=>U===L?{...$,arguments:B.arguments}:$):R=[...I,{index:B.index,name:B.name,...B.arguments?{arguments:B.arguments}:{}}],{streamingMessage:{...Y.streamingMessage,preparingToolCalls:R}}});break}case"chat.tool_call":{if(!zt(s,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const B=s.payload,F=Z=>{var L;const Y=(L=Z.preparingToolCalls)==null?void 0:L.filter((R,$)=>{var U;return R.name===B.tool?(U=Z.preparingToolCalls)==null?void 0:U.slice(0,$).some(Q=>Q.name===B.tool):!0}),I=qt.toolOutput.filter(R=>R.callId===B.callId);return I.length>0&&(qt.toolOutput=qt.toolOutput.filter(R=>R.callId!==B.callId)),{...Z,toolCalls:[...Z.toolCalls??[],{id:B.callId,name:B.tool,arguments:B.args,startedAt:Date.now(),...I.length>0?{streamingOutput:I.map(R=>({stream:R.stream,content:R.content,timestamp:Date.now()}))}:{}}],...Y&&Y.length>0?{preparingToolCalls:Y}:{preparingToolCalls:void 0}}};e(Z=>{const Y=Z.streamingMessage;return Y&&Y.id===B.messageId?{streamingMessage:F(Y)}:{messages:Z.messages.map(I=>I.id===B.messageId?F(I):I)}});break}case"chat.tool_output":{if(!zt(s,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const B=s.payload;qt.messageId=B.messageId,qt.toolOutput.push({messageId:B.messageId,callId:B.callId,stream:B.stream,content:B.output}),zd();break}case"chat.tool_result":{if(!zt(s,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const B=s.payload,F=Z=>{var I;const Y=(I=Z.toolCalls)==null?void 0:I.map(L=>L.id===B.callId?{...L,result:B.result}:L);return{...Z,toolCalls:Y}};e(Z=>{const Y=Z.streamingMessage;return Y&&Y.id===B.messageId?{streamingMessage:F(Y)}:{messages:Z.messages.map(I=>I.id===B.messageId?F(I):I)}});break}case"chat.vision_fallback":{if(!zt(s,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const B=s.payload;e(F=>{const Z=`${B.messageId}-${B.attachmentId}`,Y={...F.visionFallbackByMessage};return Y[Z]={type:B.type,attachmentId:B.attachmentId,filename:B.filename,description:B.description},{visionFallbackByMessage:Y}});break}case"chat.todo":{if(!zt(s,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const B=s.payload;e({currentTodos:B.todos});break}case"chat.summary":{if(!zt(s,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const B=s.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,summary:B.summary}:null}));break}case"chat.progress":{if(!zt(s,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const B=s.payload;console.warn("Progress:",B.message,B.phase);break}case"chat.format_retry":{if(!zt(s,((T=r().currentSession)==null?void 0:T.id)??null)){u();break}const B=s.payload;console.warn("Format retry:",B.attempt,"/",B.maxAttempts);break}case"chat.done":{if(!zt(s,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}As(),un==null||un();const B=s.payload,F=B.stats;qt.messageId=null,qt.deltaContent="",qt.thinkingContent="",qt.toolOutput=[],Bd.delete(B.messageId),e(Z=>{const Y=Z.streamingMessage,I=Y&&Y.id===B.messageId?{...Y,isStreaming:!1,stats:F??Y.stats}:null;return{messages:Z.messages.map(L=>L.id===B.messageId?I??{...L,isStreaming:!1,stats:F??L.stats,completeReason:B.reason}:L),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!zt(s,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}As(),un==null||un();const B=s.payload;console.error("Chat error:",B.error,"recoverable:",B.recoverable),B.recoverable||(qt.messageId=null,qt.deltaContent="",qt.thinkingContent="",qt.toolOutput=[]),e(F=>({error:{code:"CHAT_ERROR",message:B.error},streamingMessageId:B.recoverable?F.streamingMessageId:null,...B.recoverable?{}:{messages:F.streamingMessage?F.messages.map(Z=>Z.id===F.streamingMessage.id?F.streamingMessage:Z):F.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!zt(s,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}const B=s.payload;e({pendingPathConfirmation:{callId:B.callId,tool:B.tool,paths:B.paths,workdir:B.workdir,reason:B.reason}});break}case"chat.ask_user":{if(!zt(s,((P=r().currentSession)==null?void 0:P.id)??null)){u();return}const B=s.payload;e({pendingQuestion:{callId:B.callId,question:B.question}});break}case"mode.changed":{if(!zt(s,((O=r().currentSession)==null?void 0:O.id)??null)){u();break}const B=s.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,mode:B.mode}:null}));break}case"phase.changed":{const B=s.payload,F=s.sessionId,Z=(H=r().currentSession)==null?void 0:H.id,Y=F&&F!==Z;e(I=>({sessions:I.sessions.map(L=>L.id===F?{...L,phase:B.phase}:L)})),Y||e(I=>({currentSession:I.currentSession?{...I.currentSession,phase:B.phase}:null}));break}case"criteria.updated":{if(!zt(s,((q=r().currentSession)==null?void 0:q.id)??null)){u();break}const B=s.payload;e(F=>({currentSession:F.currentSession?{...F.currentSession,criteria:B.criteria}:null}));break}case"context.state":{const B=s.payload,F=zt(s,((W=r().currentSession)==null?void 0:W.id)??null);B.subAgentId?F&&r().updateSubAgentContextState(B.subAgentId,B.context):F?e({contextState:B.context}):u();break}case"session.name_generated":{const B=s.payload,F=s.sessionId,Z=(G=r().currentSession)==null?void 0:G.id;e(Y=>{const I=Y.sessions.map(R=>R.id===F?{...R,title:B.name,updatedAt:new Date().toISOString()}:R),L=Z===F?Y.currentSession?{...Y.currentSession,title:B.name,updatedAt:new Date().toISOString()}:null:Y.currentSession;return{sessions:I,currentSession:L}});break}case"queue.state":{const B=s.payload;e({queuedMessages:B.messages??[]});break}case"git.status":{const B=s.payload;e({gitStatus:{branch:B.branch,diff:B.diff}});break}case"devServer.output":case"devServer.state":{ur.getState().handleMessage(s);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Ka.getState().handleMessage(s.type,s.payload);break}case"error":{const B=s.payload;console.error("Server error:",B),e({error:{code:B.code,message:B.message},streamingMessageId:null});break}}}}));function Oh(){return Se(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function xw(){return Se(e=>e.queuedMessages)}function bw(){return Se(e=>e.abortInProgress)}function vw(){const e=Se(i=>i.connect),r=Se(i=>i.connectionStatus),s=Ms(i=>i.load);return z.useEffect(()=>{e()},[e]),z.useEffect(()=>{r==="connected"&&s()},[r,s]),{connectionStatus:r}}const yw="modulepreload",_w=function(e){return"/"+e},tb={},uh=function(r,s,i){let l=Promise.resolve();if(s&&s.length>0){let h=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));l=h(s.map(f=>{if(f=_w(f),f in tb)return;tb[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":yw,g||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),g)return new Promise((S,k)=>{v.addEventListener("load",S),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(h){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=h,window.dispatchEvent(c),!c.defaultPrevented)throw h}return l.then(h=>{for(const c of h||[])c.status==="rejected"&&u(c.reason);return r().catch(u)})},Gv=[{key:"color-bg-primary",category:"background",label:"Primary Background",defaultValue:"13 17 23"},{key:"color-bg-secondary",category:"background",label:"Secondary Background",defaultValue:"22 27 34"},{key:"color-bg-tertiary",category:"background",label:"Tertiary Background",defaultValue:"33 38 45"},{key:"color-primary",category:"surface",label:"Primary Surface",defaultValue:"10 10 10"},{key:"color-secondary",category:"surface",label:"Secondary Surface",defaultValue:"20 20 20"},{key:"color-text-primary",category:"text",label:"Primary Text",defaultValue:"139 148 158"},{key:"color-text-secondary",category:"text",label:"Secondary Text",defaultValue:"139 148 158"},{key:"color-text-muted",category:"text",label:"Muted Text",defaultValue:"72 79 88"},{key:"color-accent-primary",category:"accent",label:"Primary Accent",defaultValue:"88 166 255"},{key:"color-accent-success",category:"accent",label:"Success Accent",defaultValue:"63 185 80"},{key:"color-accent-warning",category:"accent",label:"Warning Accent",defaultValue:"210 153 34"},{key:"color-accent-error",category:"accent",label:"Error Accent",defaultValue:"248 81 73"},{key:"color-border",category:"border",label:"Border",defaultValue:"48 53 60"}],dr=[{id:"dark",name:"Dark",tokens:{"color-bg-primary":"13 17 23","color-bg-secondary":"22 27 34","color-bg-tertiary":"33 38 45","color-primary":"10 10 10","color-secondary":"20 20 20","color-text-primary":"255 255 255","color-text-secondary":"139 148 158","color-text-muted":"72 79 88","color-accent-primary":"88 166 255","color-accent-success":"63 185 80","color-accent-warning":"210 153 34","color-accent-error":"248 81 73","color-border":"48 53 60"}},{id:"light",name:"Light",tokens:{"color-bg-primary":"255 255 255","color-bg-secondary":"250 251 252","color-bg-tertiary":"243 244 246","color-primary":"245 245 245","color-secondary":"229 229 229","color-text-primary":"15 23 42","color-text-secondary":"30 41 59","color-text-muted":"100 116 139","color-accent-primary":"37 99 235","color-accent-success":"22 163 74","color-accent-warning":"217 119 6","color-accent-error":"220 38 38","color-border":"203 213 225"}},{id:"monokai",name:"Monokai",tokens:{"color-bg-primary":"39 40 34","color-bg-secondary":"30 31 28","color-bg-tertiary":"62 61 50","color-primary":"30 31 28","color-secondary":"45 46 39","color-text-primary":"248 248 242","color-text-secondary":"207 207 194","color-text-muted":"117 113 94","color-accent-primary":"102 217 239","color-accent-success":"166 226 46","color-accent-warning":"230 219 116","color-accent-error":"249 38 114","color-border":"73 72 62"}},{id:"dracula",name:"Dracula",tokens:{"color-bg-primary":"40 42 54","color-bg-secondary":"33 34 44","color-bg-tertiary":"68 71 90","color-primary":"30 31 41","color-secondary":"44 46 61","color-text-primary":"248 248 242","color-text-secondary":"230 230 230","color-text-muted":"98 114 164","color-accent-primary":"189 147 249","color-accent-success":"80 250 123","color-accent-warning":"255 184 108","color-accent-error":"255 85 85","color-border":"68 71 90"}},{id:"nord",name:"Nord",tokens:{"color-bg-primary":"46 52 64","color-bg-secondary":"59 66 82","color-bg-tertiary":"67 76 94","color-primary":"46 52 64","color-secondary":"59 66 82","color-text-primary":"236 239 244","color-text-secondary":"229 233 240","color-text-muted":"76 86 106","color-accent-primary":"129 161 193","color-accent-success":"163 190 140","color-accent-warning":"235 203 139","color-accent-error":"191 97 106","color-border":"76 86 106"}}];function nb(){try{const e=localStorage.getItem("openfox:userPresets");if(e)return JSON.parse(e)}catch{}return[]}const Jt=Bn((e,r)=>({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:nb(),applySavedTheme:()=>{const{getSavedTheme:s,applyPreset:i,applyTokens:l}=r(),u=s();if(u)try{const h=JSON.parse(u);h.preset&&h.tokens?(i(h.preset),e({basePreset:h.preset}),l(h.tokens)):h.preset?i(h.preset):h.tokens&&l(h.tokens)}catch{i("dark")}else i("dark")},applyPreset:s=>{dr.find(l=>l.id===s)&&(e({currentPreset:s,basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1}),r().applyTheme())},startCustomizing:()=>{var l;const{currentPreset:s}=r(),i=((l=dr.find(u=>u.id===s))==null?void 0:l.tokens)??{};e({basePreset:s,customTokens:{...i},isCustom:!0,isCustomizing:!0})},setCustomToken:(s,i)=>{e(l=>({customTokens:{...l.customTokens,[s]:i}})),r().applyTheme()},cancelCustomizing:()=>{r().applyPreset(r().basePreset||r().currentPreset)},saveCustomTheme:()=>{const{customTokens:s}=r();r().saveTheme(JSON.stringify({tokens:s})).catch(()=>{}),e({isCustomizing:!1})},applyTokens:s=>{e({customTokens:s,isCustom:!0,isCustomizing:!1}),r().applyTheme()},getActiveTheme:()=>{var h,c;const{basePreset:s,customTokens:i,isCustom:l}=r();if(l&&s)return{...((h=dr.find(f=>f.id===s))==null?void 0:h.tokens)??{},...i};if(l)return{...Gv.reduce((d,f)=>({...d,[f.key]:f.defaultValue}),{}),...i};const u=dr.find(d=>d.id===r().currentPreset);return(u==null?void 0:u.tokens)??((c=dr[0])==null?void 0:c.tokens)??{}},applyTheme:()=>{if(typeof document>"u")return;const s=r().getActiveTheme(),i=document.documentElement;Object.entries(s).forEach(([l,u])=>{i.style.setProperty(`--${l}`,u)})},getSavedTheme:()=>{try{const s=localStorage.getItem("openfox:theme");if(!s)return null;if(s[0]!=="{")return JSON.stringify({preset:s});const i=JSON.parse(s);if(i.preset)return JSON.stringify({preset:i.preset});if(i.tokens)return JSON.stringify({tokens:i.tokens})}catch{return null}return null},saveTheme:async s=>{localStorage.setItem("openfox:theme",s);const{useSettingsStore:i}=await uh(async()=>{const{useSettingsStore:l}=await Promise.resolve().then(()=>Px);return{useSettingsStore:l}},void 0);await i.getState().setSetting(ot.DISPLAY_THEME,s)},clearCustomTheme:()=>{localStorage.removeItem("openfox:theme"),e({isCustom:!1,isCustomizing:!1,basePreset:""})},reset:()=>{e({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:[]})},addUserPreset:s=>{const{basePreset:i,customTokens:l,currentPreset:u}=r(),h={id:"custom-"+Date.now(),name:s,basePreset:i||u,tokens:{...l}},c=[...r().userPresets,h];e({userPresets:c}),r().saveUserPresets()},applyUserPreset:s=>{const i=r().userPresets[s];i&&(e({currentPreset:i.basePreset,basePreset:i.basePreset,customTokens:{...i.tokens},isCustom:!0,isCustomizing:!1}),r().applyTheme(),r().saveTheme(JSON.stringify({preset:i.basePreset,tokens:i.tokens})).catch(()=>{}))},deleteUserPreset:s=>{const i=r().userPresets.filter((l,u)=>u!==s);e({userPresets:i}),r().saveUserPresets()},loadUserPresets:()=>{e({userPresets:nb()})},saveUserPresets:()=>{localStorage.setItem("openfox:userPresets",JSON.stringify(r().userPresets)),uh(async()=>{const{useSettingsStore:s}=await Promise.resolve().then(()=>Px);return{useSettingsStore:s}},void 0).then(({useSettingsStore:s})=>{s.getState().setSetting(ot.DISPLAY_USER_PRESETS,JSON.stringify(r().userPresets)).catch(()=>{})})}}));function Sw({className:e="w-5 h-5"}){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:"M15 19l-7-7 7-7"})})}function Kv({className:e="w-3.5 h-3.5"}){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:"M14 5l7 7m0 0l-7 7m7-7H3"})})}function ww({className:e="w-5 h-5"}){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:"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"})})}function Cw({className:e="w-3 h-3 text-text-muted"}){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 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"})})}function kw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,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"})})}function Mr({className:e="w-3.5 h-3.5 text-text-muted"}){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 hr({className:e="w-3 h-3 text-text-muted",rotate:r}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:r!==void 0?{transform:`rotate(${r}deg)`}:void 0,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Ew({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,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"})]})}function Mh({className:e="w-3.5 h-3.5"}){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:"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 jw({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:"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"})})}function Ih({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,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"})]})}function ec({className:e="w-3.5 h-3.5"}){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:"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 Bh({className:e="w-5 h-5 text-accent-primary"}){return o.jsx("svg",{className:e,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"})})}function Nw({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:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})})}function Tw({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:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}function Aw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,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"})})}function Dw({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:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Rw({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:"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"})})}function rb({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:"M4 6h16M4 12h16M4 18h16"})})}function Yv({className:e="w-[18px] h-[18px]"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function Lw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,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"})]})}function Ow({className:e="w-3 h-3",color:r}){return o.jsx("svg",{className:e,fill:r??"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})})}function Bi({className:e="w-3 h-3 text-accent-primary"}){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:"M12 4v16m8-8H4"})})}function Mw({className:e="w-5 h-5"}){return o.jsx("svg",{className:e,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"})})}function Iw({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:"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"})})}function Bw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,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"})]})}function zw({className:e="w-3 h-3 text-blue-400 animate-spin flex-shrink-0"}){return o.jsxs("svg",{"aria-label":"Session running",className:e,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"})]})}function Pw({className:e="w-3.5 h-3.5 text-text-muted"}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z"})})}function Hw({className:e="w-3.5 h-3.5 text-text-muted"}){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:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})})}function Xv({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}function Fw({className:e="w-3.5 h-3.5 shrink-0",color:r}){return o.jsx("svg",{className:e,fill:"none",stroke:r,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"})})}function Uw({className:e="w-4 h-4"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"4 17 10 11 4 5"}),o.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function tc({className:e="w-3.5 h-3.5"}){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 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 zh(){return 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:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function $w({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:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function dh({className:e="w-2.5 h-2.5"}){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:"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"})})}function Ph({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,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"})})}function qw({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,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.55 0 0 1 0-.708z"})})}function hh(){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 sb(e,r){const s=Wt.ws;!s||s.readyState!==WebSocket.OPEN||s.send(JSON.stringify({id:hh(),type:e,payload:r}))}const Jn=Bn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:s=>e({isOpen:s}),toggleOpen:()=>e(s=>({isOpen:!s.isOpen})),setWorkdir:s=>e({workdir:s}),fetchSessions:async s=>{if(!s){e({sessions:[]});return}try{const i=await ke(`/api/terminals?projectId=${encodeURIComponent(s)}`);if(i.ok){const l=await i.json();e({sessions:l});const u=Wt.ws;if(u&&u.readyState===WebSocket.OPEN)for(const h of l)u.send(JSON.stringify({id:hh(),type:"terminal.subscribe",payload:{sessionId:h.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async(s,i)=>{try{const l=await ke("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:s??r().workdir??void 0,projectId:i})});if(l.ok){const u=await l.json();e(c=>({sessions:[...c.sessions,u]}));const h=Wt.ws;h&&h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({id:hh(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(l){console.error("Failed to create terminal:",l)}},writeSession:(s,i)=>{sb("terminal.write",{sessionId:s,data:i})},resizeSession:(s,i,l)=>{sb("terminal.resize",{sessionId:s,cols:i,rows:l})},killSession:async s=>{try{(await ke(`/api/terminals/${s}`,{method:"DELETE"})).ok&&e(l=>({sessions:l.sessions.filter(u=>u.id!==s)}))}catch(i){console.error("Failed to kill terminal:",i)}},handleMessage:s=>{switch(s.type){case"terminal.exit":{const{sessionId:i}=s.payload||{};i&&e(l=>{const u=l.sessions.filter(h=>h.id!==i);return u.length===0&&l.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Wt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&Jn.getState().handleMessage(e)});var Fi=Dv();const nc=z.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:s="",...i},l)=>o.jsx("button",{ref:l,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${s}`,...i,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})})}));nc.displayName="IconButton";const Ww="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",zi=z.forwardRef((e,r)=>o.jsx(nc,{ref:r,icon:Ww,title:"Edit",...e}));zi.displayName="EditButton";const Vw="M6 18L18 6M6 6l12 12",Hh=z.forwardRef((e,r)=>o.jsx(nc,{ref:r,icon:Vw,...e}));Hh.displayName="CloseButton";const Gw={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw] h-[90vh] flex-1"};function kt({label:e,title:r,size:s="md",minHeight:i,children:l,footer:u,className:h,onClose:c,isOpen:d,closeOnBackdropClick:f=!0,closeOnEscape:g=!0,showCloseButton:m=!0}){const[v,S]=z.useState(!1),k=d!==void 0,C=k?d:v,y=z.useCallback(()=>{k||S(!0)},[k]),b=z.useCallback(()=>{k||S(!1),c==null||c()},[k,c]);z.useEffect(()=>{if(!C||!g)return;const _=j=>{j.key==="Escape"&&(j.stopPropagation(),b())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[C,b,g]);const x=e&&(typeof e=="string"?o.jsx("button",{type:"button",onClick:y,className:h,children:e}):o.jsx("span",{onClick:y,className:h,style:{cursor:"pointer"},children:e}));return o.jsxs(o.Fragment,{children:[x,C&&(typeof document<"u"?Fi.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:f?b:void 0}),o.jsxs("div",{className:`relative w-full ${Gw[s]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(r||m)&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r&&o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:r}),m&&o.jsx(Hh,{onClick:b,className:"ml-auto","aria-label":"Close"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:i?{minHeight:i}:void 0,children:l}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const Ze=z.forwardRef(({variant:e="secondary",size:r="md",className:s="",children:i,...l},u)=>{const h="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",c={primary:"bg-accent-primary/25 text-text-primary 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:`${h} ${c[e]} ${d[r]} ${s}`,...l,children:i})});Ze.displayName="Button";function Kw({value:e,defaultUrl:r,disabled:s,onChange:i}){const l=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:l,disabled:s,onChange:u=>{const h=u.target.value;i(h===r?null:h)},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:rw.map(({url:u,label:h})=>o.jsx("option",{value:u,title:h,children:h.split(" ")[0]},u))}),o.jsx(hr,{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted"})]})}const ib=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Yw(){const e=Ms(d=>d.settings),r=Ms(d=>d.update),s=Ms(d=>d.updateEvent),i=Ms(d=>d.updateAgentOverride),l=Ms(d=>d.load);z.useEffect(()=>{l()},[l]);const u=async()=>{await iw()==="granted"&&r({...e,browserNotificationEnabled:!0})},h=(d,f,g,m)=>{d==="general"?s(f,{[g]:m}):i(d,f,{[g]:m})},c=(d,f,g)=>{d==="general"?s(f,{customSoundUrl:g}):i(d,f,{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(ab,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(ab,{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"}),ib.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:nw.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})}),ib.map(f=>{const g=Wv(e,d.key,f.key==="general"?void 0:f.key),m=$v[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:v=>h(f.key,d.key,"soundEnabled",v.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:v=>h(f.key,d.key,"browserNotification",v.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(Kw,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:v=>c(f.key,d.key,v)})]})},f.key)})]},d.key))})]})})]})]})}function ab({label:e,description:r,checked:s,onChange:i}){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 ${s?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:l=>{l.preventDefault(),i(!s)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${s?"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 Fh(e,r){r({loading:!0});try{const i=await(await ke(e)).json();r({defaults:i.defaults??[],userItems:i.userItems??[],loading:!1})}catch{r({loading:!1})}}const Rr=Bn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await Fh("/api/skills",e)},toggleSkill:async s=>{try{const l=await(await ke(`/api/skills/${s}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(h=>h.id===s?{...h,enabled:l.enabled}:h),userItems:u.userItems.map(h=>h.id===s?{...h,enabled:l.enabled}:h)}))}catch{}},fetchSkill:async s=>{try{const i=await ke(`/api/skills/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/skills/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createSkill:async s=>{const i=await ds("POST","/api/skills",s);return i.success&&await r().fetchSkills(),i},updateSkill:async(s,i)=>{const l=await ds("PUT",`/api/skills/${s}`,i);return l.success&&await r().fetchSkills(),l},deleteSkill:async s=>{try{const i=await ke(`/api/skills/${s}`,{method:"DELETE"}),l=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(h=>h.id!==s)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async s=>{try{const i=await ke(`/api/skills/${s}/duplicate`,{method:"POST"}),l=await i.json();return i.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Uh(){const[e,r]=z.useState({id:null,type:null}),s=z.useCallback(u=>r({id:u,type:"delete"}),[]),i=z.useCallback(()=>r({id:null,type:null}),[]),l=z.useCallback((u,h)=>e.id===u&&e.type===h,[e.id,e.type]);return{requestDelete:s,clearConfirm:i,isConfirming:l}}function $h({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 qh({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(tc,{})})}function Ja({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(Mh,{})})}function Is({label:e,value:r,onChange:s,placeholder:i,readOnly:l,hint:u,mono:h}){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:c=>s(c.target.value),readOnly:l,placeholder:i,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 ${h?"font-mono":""} ${l?"opacity-60":""}`})]})}function Xw({onCancel:e,onSave:r,saving:s,saveDisabled:i}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(Ze,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(Ze,{variant:"primary",onClick:r,disabled:s||i,children:s?"Saving...":"Save"})]})}function Wh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function Zv({label:e="Custom",children:r}){return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsx("div",{className:"space-y-2",children:r})]})}function Qv({description:e,onNew:r,newLabel:s="+ 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(Ze,{variant:"primary",size:"sm",onClick:r,children:s})})]})}function Jv({isBuiltIn:e,isConfirmingDelete:r,onView:s,onEdit:i,onDuplicate:l,onDelete:u,children:h}){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:h}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&s&&o.jsx("button",{onClick:s,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx(ec,{})}),o.jsx(Ja,{onClick:l}),!e&&i&&o.jsx(zi,{onClick:i}),!e&&(r?o.jsx($h,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(qh,{onClick:()=>u==null?void 0:u()}))]})]})}function Zw({id:e,name:r,description:s,isBuiltIn:i,isConfirmingDelete:l,onView:u,onEdit:h,onDuplicate:c,onDelete:d}){return o.jsxs(Jv,{isBuiltIn:i,isConfirmingDelete:l,onView:u,onEdit:h,onDuplicate:c,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})]}),s&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:s})]})}function ey({loading:e,hasItems:r,loadingLabel:s,emptyLabel:i,children:l}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:s}):r?o.jsx("div",{className:"space-y-4",children:l}):i?o.jsx("div",{className:"text-text-muted text-sm",children:i}):null}function ty({name:e,id:r,nameLabel:s="Name",idLabel:i="ID",namePlaceholder:l="My Item",idPlaceholder:u="my-item",nameHint:h,readOnlyId:c=!1,readOnlyHint:d="(read-only)",onNameChange:f,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Is,{label:s,value:e,onChange:f,placeholder:l,hint:h}),o.jsx(Is,{label:i,value:r,onChange:g,readOnly:c,placeholder:u,hint:c?d:void 0,mono:!0})]})}function ny(e={}){const{initialData:r={}}=e,[s,i]=z.useState("list"),[l,u]=z.useState(null),[h,c]=z.useState(""),[d,f]=z.useState(!1),[g,m]=z.useState(r),v=z.useCallback(()=>{m(r),c(""),u(null)},[r]),S=z.useCallback(b=>{i(b),b==="list"&&v()},[v]),k=z.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),C=z.useCallback((b,x={})=>{u(b),i("edit"),m({...x}),c("")},[]),y=z.useCallback(()=>{u(null),i("edit"),m(r),c("")},[r]);return{view:s,editingId:l,formError:h,saving:d,formData:g,setView:S,setEditingId:u,setFormError:c,setFormData:k,setSaving:f,resetForm:v,startEditing:C,startNew:y}}function Vh(){return o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[o.jsx("span",{children:"⚠️"}),o.jsx("p",{className:"text-text-secondary",children:"Editing this value now will have the side-effect of invalidating KV-cache, causing your next message in current sessions to take a long time to process. Consider doing this between sessions."})]})}function ob({skill:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h}){return o.jsx(Zw,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h})}function Qw({isOpen:e}){const r=Rr(G=>G.defaults),s=Rr(G=>G.userItems),i=Rr(G=>G.loading),l=Rr(G=>G.fetchSkills),u=Rr(G=>G.fetchSkill),h=Rr(G=>G.fetchDefaultContent),c=Rr(G=>G.createSkill),d=Rr(G=>G.updateSkill),f=Rr(G=>G.deleteSkill),{view:g,editingId:m,formError:v,saving:S,formData:k,setView:C,setEditingId:y,setFormError:b,setFormData:x,setSaving:_}=ny(),{clearConfirm:j}=Uh();z.useEffect(()=>{e&&(l(),C("list"),y(null),j())},[e,l,j]);const T=(G,B,F,Z)=>{x({name:Z??G.metadata.name,id:F??G.metadata.id,description:G.metadata.description??"",version:G.metadata.version??"1.0.0",prompt:G.prompt,isReadOnly:B})},N=async G=>{if(r.some(F=>F.id===G)){const F=await h(G);if(!F)return;T(F,!0),y(G),b(""),C("edit")}else{const F=await u(G);if(!F)return;T(F,!0),y(G),b(""),C("edit")}},D=async G=>{const F=r.some(Y=>Y.id===G)?await h(G):await u(G);if(!F)return;const Z=`${G}-copy-${Date.now()}`;T(F,!1,Z,`${F.metadata.name} (copy)`),y(null),b(""),C("edit")},A=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},P=async G=>{const B=await u(G);B&&(T(B,!1),y(G),b(""),C("edit"))},O=async G=>{await f(G),j()},H=async()=>{const G=m??k.id;if(!G||!k.name||!k.prompt){b("Name, ID, and prompt are required.");return}_(!0),b("");const B={metadata:{id:G,name:k.name,description:k.description,version:k.version},prompt:k.prompt},F=m?await d(m,B):await c(B);if(_(!1),!F.success){b(F.error??"Failed to save skill.");return}C("list")},q=G=>{x(B=>({...B,name:G})),m||x(B=>({...B,id:G.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},W=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:W?k.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),v&&o.jsx(Wh,{message:v}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(ty,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:q,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Is,{label:"Description",value:k.description,onChange:G=>x(B=>({...B,description:G})),placeholder:"What this skill does...",readOnly:W}),o.jsx(Is,{label:"Version",value:k.version,onChange:G=>x(B=>({...B,version:G})),placeholder:"1.0.0",readOnly:W})]})]}),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:G=>x(B=>({...B,prompt:G.target.value})),readOnly:W,placeholder:"The system prompt for this skill...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsx(Vh,{}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[o.jsx(Ze,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),W?o.jsx(Ze,{variant:"primary",onClick:()=>{x(G=>({...G,name:G.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),y(null)},children:"Duplicate & Customize"}):o.jsx(Ze,{variant:"primary",onClick:H,disabled:S||!k.name||!k.id||!k.prompt,children:S?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(Qv,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:A}),o.jsxs(ey,{loading:i,hasItems:r.length>0||s.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(G=>o.jsx(ob,{skill:G,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(G.id),onDuplicate:()=>D(G.id)},G.id))})]}),s.length>0&&o.jsx(Zv,{children:s.map(G=>o.jsx(ob,{skill:G,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(G.id),onEdit:()=>P(G.id),onDuplicate:()=>D(G.id),onDelete:()=>O(G.id)},G.id))})]})]})}function Jw(e){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r){const s=parseInt(r[1]??"0",16),i=parseInt(r[2]??"0",16),l=parseInt(r[3]??"0",16);return`${s} ${i} ${l}`}return e}function Os(e){const r=e.split(" ").map(s=>parseInt(s,10));return r.length===3&&r.every(s=>!isNaN(s))?`#${r.map(s=>(s??0).toString(16).padStart(2,"0")).join("")}`:e}function eC({isOpen:e,isNew:r,basePresetId:s,presetName:i,initialTokens:l,onClose:u,onSave:h}){const[c,d]=z.useState(l),[f,g]=z.useState(i);z.useEffect(()=>{d(l),g(i)},[l,i]);const m=(y,b)=>{const x=b.startsWith("#")?Jw(b):b;d(_=>({..._,[y]:x}))},v=()=>{h(f.trim()||"Untitled",{...c})},S=Gv.reduce((y,b)=>{const x=b.category;return y[x]||(y[x]=[]),y[x].push(b),y},{}),k={background:"Backgrounds",surface:"Surfaces",text:"Text",accent:"Accents",border:"Border"},C=dr.find(y=>y.id===s);return o.jsx(kt,{isOpen:e,onClose:u,size:"lg",title:r?"New Theme":"Edit Theme",closeOnBackdropClick:!0,closeOnEscape:!0,footer:o.jsxs("div",{className:"flex gap-2 justify-end",children:[o.jsx("button",{type:"button",onClick:u,className:"px-4 py-2 border border-border rounded text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:"Cancel"}),o.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 bg-accent-primary text-white rounded hover:bg-accent-primary/80 transition-colors text-sm",children:"Save"})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs text-text-muted block mb-1",children:"Name"}),o.jsx("input",{type:"text",value:f,onChange:y=>g(y.target.value),className:"w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),!r&&o.jsxs("div",{className:"text-xs text-text-muted",children:["Based on ",o.jsx("span",{className:"text-text-primary",children:C==null?void 0:C.name})]}),Object.entries(S).map(([y,b])=>o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:k[y]??y}),o.jsx("div",{className:"grid grid-cols-2 gap-3",children:b.map(x=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("label",{htmlFor:x.key,className:"text-xs text-text-muted",children:x.label}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"color",id:x.key,value:Os(c[x.key]??x.defaultValue),onChange:_=>m(x.key,_.target.value),className:"w-8 h-8 rounded cursor-pointer border border-border bg-transparent"}),o.jsx("input",{type:"text",value:c[x.key]??x.defaultValue,onChange:_=>m(x.key,_.target.value),className:"flex-1 px-2 py-1 bg-bg-tertiary border border-border rounded text-xs text-text-primary font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]},x.key))})]},y))]})})}function tC(){const[e,r]=z.useState(null),s=Jt(x=>x.currentPreset),i=Jt(x=>x.isCustom),l=Jt(x=>x.basePreset),u=Jt(x=>x.userPresets),h=Jt(x=>x.applyPreset),c=Jt(x=>x.applyUserPreset),d=Jt(x=>x.deleteUserPreset),f=Jt(x=>x.saveTheme),g=x=>{h(x),f(JSON.stringify({preset:x})).catch(()=>{})},m=x=>{c(x)},v=x=>{const _=dr.find(j=>j.id===x);_&&r({type:"new",presetIndex:u.length,basePresetId:x,presetName:_.name+" Copy",tokens:{..._.tokens}})},S=x=>{const _=u[x];if(!_)return;const j=dr.find(N=>N.id===_.basePreset),T=j?{...j.tokens,..._.tokens}:_.tokens;r({type:"edit",presetIndex:x,basePresetId:_.basePreset,presetName:_.name,tokens:T})},k=(x,_)=>{if(!e)return;const j=[...u];if(e.type==="new"){const T={id:"custom-"+Date.now(),name:x,basePreset:e.basePresetId,tokens:_};j.push(T);const N=j.length-1;Jt.setState({userPresets:j}),Jt.getState().saveUserPresets(),Jt.getState().applyUserPreset(N)}else{const T=j[e.presetIndex];T&&(j[e.presetIndex]={...T,name:x,tokens:_}),Jt.setState({userPresets:j}),Jt.getState().saveUserPresets(),Jt.getState().applyUserPreset(e.presetIndex)}r(null)},C=()=>{r(null)},y=(x,_)=>{x.stopPropagation(),d(_)},b=i?l:s;return o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Theme"}),o.jsx("div",{className:"grid grid-cols-5 gap-2",children:dr.map(x=>o.jsxs("div",{className:"relative group",children:[o.jsxs("button",{type:"button",onClick:()=>g(x.id),className:`w-full flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${b===x.id&&!i?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[o.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:Os(x.tokens["color-bg-primary"]??"#000"),borderColor:Os(x.tokens["color-border"]??"#000")},children:o.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Os(x.tokens["color-text-primary"]??"#fff")}})}),o.jsx("span",{className:"text-xs",children:x.name})]}),o.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),v(x.id)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Create custom theme based on this",children:o.jsx("span",{className:"text-xs",children:"✎"})})]},x.id))}),u.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:"My Themes"}),o.jsx("div",{className:"grid grid-cols-5 gap-2",children:u.map((x,_)=>{const j=dr.find(N=>N.id===x.basePreset),T=j?{...j.tokens,...x.tokens}:x.tokens;return o.jsxs("div",{className:"relative group",children:[o.jsxs("button",{type:"button",onClick:()=>m(_),className:`w-full flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${i&&l===x.basePreset&&b===x.basePreset?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[o.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:Os(T["color-bg-primary"]??"#000"),borderColor:Os(T["color-border"]??"#000")},children:o.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Os(T["color-text-primary"]??"#fff")}})}),o.jsx("span",{className:"text-xs truncate w-full text-center",children:x.name})]}),o.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(_)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Edit",children:o.jsx("span",{className:"text-xs",children:"✎"})}),o.jsx("button",{type:"button",onClick:N=>y(N,_),className:"absolute -top-1 -left-1 w-5 h-5 rounded-full bg-accent-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-20",children:o.jsx(Ph,{className:"w-3 h-3"})})]},x.id)})})]}),e&&o.jsx(eC,{isOpen:!0,isNew:e.type==="new",presetIndex:e.presetIndex,basePresetId:e.basePresetId,presetName:e.presetName,initialTokens:e.tokens,onClose:C,onSave:k})]})}function ry(){const e=hn(l=>l.settings),r=hn(l=>l.loading),s=hn(l=>l.getSetting),i=hn(l=>l.setSetting);return{settings:e,loading:r,getSetting:s,setSetting:i}}function nC({isOpen:e,onClose:r}){const[s,i]=z.useState("instructions");return o.jsx(kt,{isOpen:e,onClose:r,title:"Settings",size:"xl",minHeight:"500px",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(za,{label:"Instructions",active:s==="instructions",onClick:()=>i("instructions")}),o.jsx(za,{label:"Skills",active:s==="skills",onClick:()=>i("skills")}),o.jsx(za,{label:"Notifications",active:s==="notifications",onClick:()=>i("notifications")}),o.jsx(za,{label:"Display",active:s==="display",onClick:()=>i("display")}),o.jsx(za,{label:"Advanced",active:s==="advanced",onClick:()=>i("advanced")})]}),s==="instructions"&&o.jsx(aC,{isOpen:e}),s==="skills"&&o.jsx(Qw,{isOpen:e}),s==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(Yw,{})}),s==="display"&&o.jsx(iC,{}),s==="advanced"&&o.jsx(rC,{onClose:r})]})})}function rC({onClose:e}){const[,r]=nr();function s(){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(Ze,{variant:"secondary",onClick:s,children:"Launch Onboarding"})]})})}function sC(){return o.jsx(tC,{})}function iC(){const{settings:e,loading:r,getSetting:s,setSetting:i}=ry(),l=r[ot.DISPLAY_SHOW_THINKING]??!1,u=[{key:ot.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:ot.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:ot.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:ot.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:ot.DISPLAY_SHOW_WORKFLOW_BARS,label:"Show workflow bars",description:"Display workflow start and end markers"}],h=Object.fromEntries(u.map(g=>[g.key,e[g.key]??"true"])),[c,d]=z.useState(()=>Object.fromEntries(u.map(g=>[g.key,h[g.key]==="true"])));z.useEffect(()=>{u.forEach(g=>s(g.key))},[s]),z.useEffect(()=>{d(Object.fromEntries(u.map(g=>[g.key,h[g.key]==="true"])))},[JSON.stringify(h)]);const f=async g=>{const m=String(!c[g]);d(v=>({...v,[g]:!v[g]})),await i(g,m)};return l?o.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):o.jsxs("div",{className:"space-y-6",children:[o.jsx(sC,{}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),o.jsx("div",{className:"space-y-4",children:u.map(({key:g,label:m,description:v})=>o.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary",children:m}),o.jsx("div",{className:"text-xs text-text-muted",children:v})]}),o.jsx("button",{type:"button",onClick:()=>f(g),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${c[g]?"bg-accent-primary":"bg-bg-tertiary"}`,children:o.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${c[g]?"translate-x-6":"translate-x-1"}`})})]},g))})]})]})}function za({label:e,active:r,onClick:s}){return o.jsx("button",{onClick:s,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 aC({isOpen:e}){const{settings:r,loading:s,getSetting:i,setSetting:l}=ry(),u=r[ot.GLOBAL_INSTRUCTIONS]??"",h=s[ot.GLOBAL_INSTRUCTIONS]??!1,[c,d]=z.useState(u),[f,g]=z.useState(!1),[m,v]=z.useState(!1);z.useEffect(()=>{e&&i(ot.GLOBAL_INSTRUCTIONS)},[e,i]),z.useEffect(()=>{d(u),g(!1)},[u]);const S=async()=>{v(!0),await l(ot.GLOBAL_INSTRUCTIONS,c),v(!1),g(!1)},k=()=>{d(u),g(!1)},C=h||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:c,onChange:y=>{d(y.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full min-h-80 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),f&&o.jsx(Vh,{}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Ze,{variant:"secondary",onClick:k,disabled:!f,children:"Discard"}),o.jsx(Ze,{variant:"primary",onClick:S,disabled:!f||C,children:m?"Saving...":"Save"})]})]})}var Pd={exports:{}},lb;function oC(){return lb||(lb=1,(function(e,r){(function(s,i){e.exports=i()})(globalThis,(()=>(()=>{var s={4567:function(h,c,d){var f=this&&this.__decorate||function(x,_,j,T){var N,D=arguments.length,A=D<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,_,j,T);else for(var P=x.length-1;P>=0;P--)(N=x[P])&&(A=(D<3?N(A):D>3?N(_,j,A):N(_,j))||A);return D>3&&A&&Object.defineProperty(_,j,A),A},g=this&&this.__param||function(x,_){return function(j,T){_(j,T,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=d(9042),v=d(9924),S=d(844),k=d(4725),C=d(2585),y=d(3656);let b=c.AccessibilityManager=class extends S.Disposable{constructor(x,_,j,T){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((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,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let _=0;_<x;_++)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,_){this._liveRegionDebouncer.refresh(x,_,this._terminal.rows)}_renderRows(x,_){const j=this._terminal.buffer,T=j.lines.length.toString();for(let N=x;N<=_;N++){const D=j.lines.get(j.ydisp+N),A=[],P=(D==null?void 0:D.translateToString(!0,void 0,void 0,A))||"",O=(j.ydisp+N+1).toString(),H=this._rowElements[N];H&&(P.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=P,this._rowColumns.set(H,A)),H.setAttribute("aria-posinset",O),H.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,_){const j=x.target,T=this._rowElements[_===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==T)return;let N,D;if(_===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),_===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var P;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 _={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((_.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===j.node&&_.offset>j.offset)&&([_,j]=[j,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const T=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:T,offset:((P=T.textContent)==null?void 0:P.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:O,offset:H})=>{const q=O instanceof Text?O.parentNode:O;let W=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const G=this._rowColumns.get(q);if(!G)return console.warn("columns is null. Race condition?"),null;let B=H<G.length?G[H]:G.slice(-1)[0]+1;return B>=this._terminal.cols&&(++W,B=0),{row:W,column:B}},D=N(_),A=N(j);if(D&&A){if(D.row>A.row||D.row===A.row&&D.column>=A.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(A.row-D.row)*this._terminal.cols-D.column+A.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);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`}};c.AccessibilityManager=b=f([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],b)},3614:(h,c)=>{function d(v){return v.replace(/\r?\n/g,"\r")}function f(v,S){return S?"\x1B[200~"+v+"\x1B[201~":v}function g(v,S,k,C){v=f(v=d(v),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(v,!0),S.value=""}function m(v,S,k){const C=k.getBoundingClientRect(),y=v.clientX-C.left-10,b=v.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${y}px`,S.style.top=`${b}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=d,c.bracketTextForPaste=f,c.copyHandler=function(v,S){v.clipboardData&&v.clipboardData.setData("text/plain",S.selectionText),v.preventDefault()},c.handlePasteEvent=function(v,S,k,C){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),S,k,C)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(v,S,k,C,y){m(v,S,k),y&&C.rightClickSelect(v),S.value=C.selectionText,S.select()}},7239:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const f=d(1505);c.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,m,v){this._css.set(g,m,v)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,v){this._color.set(g,m,v)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(d,f,g,m){d.addEventListener(f,g,m);let v=!1;return{dispose:()=>{v||(v=!0,d.removeEventListener(f,g,m))}}}},3551:function(h,c,d){var f=this&&this.__decorate||function(b,x,_,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,_,j);else for(var A=b.length-1;A>=0;A--)(T=b[A])&&(D=(N<3?T(D):N>3?T(x,_,D):T(x,_))||D);return N>3&&D&&Object.defineProperty(x,_,D),D},g=this&&this.__param||function(b,x){return function(_,j){x(_,j,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=d(3656),v=d(8460),S=d(844),k=d(2585),C=d(4725);let y=c.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(b,x,_,j,T){super(),this._element=b,this._mouseService=x,this._renderService=_,this._bufferService=j,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.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 _=b.composedPath();for(let j=0;j<_.length;j++){const T=_[j];if(T.classList.contains("xterm"))break;if(T.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,T;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 _=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(T=this._activeProviderReplies)!=null&&T.get(N)&&(_=this._checkLinkProviderResult(N,b,_)):D.provideLinks(b.y,(A=>{var O,H;if(this._isMouseOut)return;const P=A==null?void 0:A.map((q=>({link:q})));(O=this._activeProviderReplies)==null||O.set(N,P),_=this._checkLinkProviderResult(N,b,_),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const _=new Set;for(let j=0;j<x.size;j++){const T=x.get(j);if(T)for(let N=0;N<T.length;N++){const D=T[N],A=D.link.range.start.y<b?0:D.link.range.start.x,P=D.link.range.end.y>b?this._bufferService.cols:D.link.range.end.x;for(let O=A;O<=P;O++){if(_.has(O)){T.splice(N--,1);break}_.add(O)}}}}_checkLinkProviderResult(b,x,_){var N;if(!this._activeProviderReplies)return _;const j=this._activeProviderReplies.get(b);let T=!1;for(let D=0;D<b;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(T=!0);if(!T&&j){const D=j.find((A=>this._linkAtPosition(A.link,x)));D&&(_=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let D=0;D<this._activeProviderReplies.size;D++){const A=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((P=>this._linkAtPosition(P.link,x)));if(A){_=!0,this._handleNewLink(A);break}}return _}_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,S.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 _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.pointerCursor},set:_=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.underline},set:_=>{var j,T,N;(j=this._currentLink)!=null&&j.state&&((N=(T=this._currentLink)==null?void 0:T.state)==null?void 0:N.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const j=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(j,T),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(b,x,_){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(_,x.text)}_fireUnderlineEvent(b,x){const _=b.range,j=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-j-1,_.end.x,_.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(b,x,_){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(_,x.text)}_linkAtPosition(b,x){const _=b.range.start.y*this._bufferService.cols+b.range.start.x,j=b.range.end.y*this._bufferService.cols+b.range.end.x,T=x.y*this._bufferService.cols+x.x;return _<=T&&T<=j}_positionFromMouseEvent(b,x,_){const j=_.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,_,j,T){return{x1:b,y1:x,x2:_,y2:j,cols:this._bufferService.cols,fg:T}}};c.Linkifier=y=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.IBufferService),g(4,C.ILinkProviderService)],y)},9042:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(h,c,d){var f=this&&this.__decorate||function(C,y,b,x){var _,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,b,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(T=(j<3?_(T):j>3?_(y,b,T):_(y,b))||T);return j>3&&T&&Object.defineProperty(y,b,T),T},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=d(511),v=d(2585);let S=c.OscLinkProvider=class{constructor(C,y,b){this._bufferService=C,this._optionsService=y,this._oscLinkService=b}provideLinks(C,y){var P;const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void y(void 0);const x=[],_=this._optionsService.rawOptions.linkHandler,j=new m.CellData,T=b.getTrimmedLength();let N=-1,D=-1,A=!1;for(let O=0;O<T;O++)if(D!==-1||b.hasContent(O)){if(b.loadCell(O,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=O,N=j.extended.urlId;continue}A=j.extended.urlId!==N}else D!==-1&&(A=!0);if(A||D!==-1&&O===T-1){const H=(P=this._oscLinkService.getLinkData(N))==null?void 0:P.uri;if(H){const q={start:{x:D+1,y:C},end:{x:O+(A||O!==T-1?0:1),y:C}};let W=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const G=new URL(H);["http:","https:"].includes(G.protocol)||(W=!0)}catch{W=!0}W||x.push({text:H,range:q,activate:(G,B)=>_?_.activate(G,B,q):k(0,B),hover:(G,B)=>{var F;return(F=_==null?void 0:_.hover)==null?void 0:F.call(_,G,B,q)},leave:(G,B)=>{var F;return(F=_==null?void 0:_.leave)==null?void 0:F.call(_,G,B,q)}})}A=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=O,N=j.extended.urlId):(D=-1,N=-1)}}y(x)}};function k(C,y){if(confirm(`Do you want to navigate to ${y}?
|
|
60
|
-
|
|
61
|
-
WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=S=f([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.IOscLinkService)],S)},6193:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,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,f,g){this._rowCount=g,d=d!==void 0?d:0,f=f!==void 0?f: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,f):f,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),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const f=d(3614),g=d(3656),m=d(3551),v=d(9042),S=d(3730),k=d(1680),C=d(3107),y=d(5744),b=d(2950),x=d(1296),_=d(428),j=d(4269),T=d(5114),N=d(8934),D=d(3230),A=d(9312),P=d(4725),O=d(6731),H=d(8055),q=d(8969),W=d(8460),G=d(844),B=d(6114),F=d(8437),Z=d(2584),Y=d(7399),I=d(5941),L=d(9074),R=d(2585),$=d(5435),U=d(4567),ne=d(779);class Q extends q.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(X={}){super(X),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new G.MutableDisposable),this._onCursorMove=this.register(new W.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new W.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new W.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new W.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new W.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new W.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new W.EventEmitter),this._onBlur=this.register(new W.EventEmitter),this._onA11yCharEmitter=this.register(new W.EventEmitter),this._onA11yTabEmitter=this.register(new W.EventEmitter),this._onWillOpen=this.register(new W.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(P.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,ie)=>this.refresh(V,ie)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,W.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,W.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,W.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,G.toDisposable)((()=>{var V,ie;this._customKeyEventHandler=void 0,(ie=(V=this.element)==null?void 0:V.parentNode)==null||ie.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const V of X){let ie,re="";switch(V.index){case 256:ie="foreground",re="10";break;case 257:ie="background",re="11";break;case 258:ie="cursor",re="12";break;default:ie="ansi",re="4;"+V.index}switch(V.type){case 0:const be=H.color.toColorRGB(ie==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ie]);this.coreService.triggerDataEvent(`${Z.C0.ESC}]${re};${(0,I.toRgbString)(be)}${Z.C1_ESCAPED.ST}`);break;case 1:if(ie==="ansi")this._themeService.modifyColors((ve=>ve.ansi[V.index]=H.channels.toColor(...V.color)));else{const ve=ie;this._themeService.modifyColors((Re=>Re[ve]=H.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(X);if(!V)return;const ie=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,be=V.getWidth(ie),ve=this._renderService.dimensions.css.cell.width*be,Re=this.buffer.y*this._renderService.dimensions.css.cell.height,Oe=ie*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Oe+"px",this.textarea.style.top=Re+"px",this.textarea.style.width=ve+"px",this.textarea.style.height=re+"px",this.textarea.style.lineHeight=re+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,f.copyHandler)(V,this._selectionService)})));const X=V=>(0,f.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),B.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,f.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,f.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,f.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ie;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ie=this.element)==null?void 0:ie.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.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",(re=>this.updateCursorStyle(re)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(P.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(re=>this._handleTextAreaFocus(re)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(P.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(O.ThemeService),this._instantiationService.setService(P.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(P.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(P.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((re=>this._onRender.fire(re)))),this.onResize((re=>this._renderService.resize(re.cols,re.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(P.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(V);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((re=>this.scrollLines(re.amount,re.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(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(P.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((re=>this.scrollLines(re.amount,re.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((re=>this._renderService.handleSelectionChanged(re.start,re.end,re.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((re=>{this.textarea.value=re,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((re=>{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",(re=>this._selectionService.handleMouseDown(re)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(re=>this._handleScreenReaderModeOptionChange(re)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(re=>{!this._overviewRulerRenderer&&re&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.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 X=this,V=this.element;function ie(ve){const Re=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!Re)return!1;let Oe,ze;switch(ve.overrideType||ve.type){case"mousemove":ze=32,ve.buttons===void 0?(Oe=3,ve.button!==void 0&&(Oe=ve.button<3?ve.button:3)):Oe=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":ze=0,Oe=ve.button<3?ve.button:3;break;case"mousedown":ze=1,Oe=ve.button<3?ve.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ve)===!1||X.viewport.getLinesScrolled(ve)===0)return!1;ze=ve.deltaY<0?0:1,Oe=4;break;default:return!1}return!(ze===void 0||Oe===void 0||Oe>4)&&X.coreMouseService.triggerMouseEvent({col:Re.col,row:Re.row,x:Re.x,y:Re.y,button:Oe,action:ze,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const re={mouseup:null,wheel:null,mousedrag:null,mousemove:null},be={mouseup:ve=>(ie(ve),ve.buttons||(this._document.removeEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.removeEventListener("mousemove",re.mousedrag)),this.cancel(ve)),wheel:ve=>(ie(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&ie(ve)},mousemove:ve=>{ve.buttons||ie(ve)}};this.register(this.coreMouseService.onProtocolChange((ve=>{ve?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ve)),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&ve?re.mousemove||(V.addEventListener("mousemove",be.mousemove),re.mousemove=be.mousemove):(V.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&ve?re.wheel||(V.addEventListener("wheel",be.wheel,{passive:!1}),re.wheel=be.wheel):(V.removeEventListener("wheel",re.wheel),re.wheel=null),2&ve?re.mouseup||(re.mouseup=be.mouseup):(this._document.removeEventListener("mouseup",re.mouseup),re.mouseup=null),4&ve?re.mousedrag||(re.mousedrag=be.mousedrag):(this._document.removeEventListener("mousemove",re.mousedrag),re.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(V,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return ie(ve),re.mouseup&&this._document.addEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.addEventListener("mousemove",re.mousedrag),this.cancel(ve)}))),this.register((0,g.addDisposableDomListener)(V,"wheel",(ve=>{if(!re.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const Re=this.viewport.getLinesScrolled(ve);if(Re===0)return;const Oe=Z.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let ze="";for(let Ue=0;Ue<Math.abs(Re);Ue++)ze+=Oe;return this.coreService.triggerDataEvent(ze,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(V,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(V,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,V){var ie;(ie=this._renderService)==null||ie.refreshRows(X,V)}updateCursorStyle(X){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,V,ie=0){var re;ie===1?(super.scrollLines(X,V,ie),this.refresh(0,this.rows-1)):(re=this.viewport)==null||re.scrollLines(X)}paste(X){(0,f.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,V,ie){this._selectionService.setSelection(X,V,ie)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,V){var ie;(ie=this._selectionService)==null||ie.selectLines(X,V)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!V&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ie=(0,Y.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ie.type===3||ie.type===2){const re=this.rows-1;return this.scrollLines(ie.type===2?-re:re),this.cancel(X,!0)}return ie.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ie.cancel&&this.cancel(X,!0),!ie.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ie.key!==Z.C0.ETX&&ie.key!==Z.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ie.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ie.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,V){const ie=X.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||X.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||X.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ie:ie&&(!V.keyCode||V.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)V=X.charCode;else if(X.which===null||X.which===void 0)V=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;V=X.which}return!(!V||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=X.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(X),!0}return!1}resize(X,V){X!==this.cols||V!==this.rows?super.resize(X,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,V){var ie,re;(ie=this._charSizeService)==null||ie.measure(),(re=this.viewport)==null||re.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var V,ie;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(ie=this.viewport)==null||ie.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Z.C0.ESC+"[I"):this.coreService.triggerDataEvent(Z.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),ie=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.C0.ESC}[4;${ie};${V}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const re=this._renderService.dimensions.css.cell.width.toFixed(0),be=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.C0.ESC}[6;${be};${re}t`)}}cancel(X,V){if(this.options.cancelEvents||V)return X.preventDefault(),X.stopPropagation(),!1}}c.Terminal=Q},9924:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,g){this._rowCount=g,d=d!==void 0?d:0,f=f!==void 0?f: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,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=m-this._lastRefreshMs,S=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(h,c,d){var f=this&&this.__decorate||function(b,x,_,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,_,j);else for(var A=b.length-1;A>=0;A--)(T=b[A])&&(D=(N<3?T(D):N>3?T(x,_,D):T(x,_))||D);return N>3&&D&&Object.defineProperty(x,_,D),D},g=this&&this.__param||function(b,x){return function(_,j){x(_,j,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=d(3656),v=d(4725),S=d(8460),k=d(844),C=d(2585);let y=c.Viewport=class extends k.Disposable{constructor(b,x,_,j,T,N,D,A){super(),this._viewportElement=b,this._scrollArea=x,this._bufferService=_,this._optionsService=j,this._charSizeService=T,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 S.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((P=>this._activeBuffer=P.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((P=>this._renderDimensions=P))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((P=>this._handleThemeChange(P)))),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 _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&_<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 A;let _,j="";const T=[],N=x??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let P=b;P<N;P++){const O=D.get(P);if(!O)continue;const H=(A=D.get(P+1))==null?void 0:A.isWrapped;if(j+=O.translateToString(!H),!H||P===D.length-1){const q=document.createElement("div");q.textContent=j,T.push(q),j.length>0&&(_=q),j=""}}return{bufferElements:T,cursorElement:_}}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 _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&x.altKey||_==="ctrl"&&x.ctrlKey||_==="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))}};c.Viewport=y=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],y)},3107:function(h,c,d){var f=this&&this.__decorate||function(C,y,b,x){var _,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,b,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(T=(j<3?_(T):j>3?_(y,b,T):_(y,b))||T);return j>3&&T&&Object.defineProperty(y,b,T),T},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=d(4725),v=d(844),S=d(2585);let k=c.BufferDecorationRenderer=class extends v.Disposable{constructor(C,y,b,x,_){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=b,this._decorationService=x,this._renderService=_,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,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const 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 y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=C.options.x??0;return b&&b>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=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=y*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(b)}}_refreshXPosition(C,y=C.element){if(!y)return;const b=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=k=f([g(1,S.IBufferService),g(2,m.ICoreBrowserService),g(3,S.IDecorationService),g(4,m.IRenderService)],k)},5871:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.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 f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,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,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,g){return f>=d.startBufferLine-this._linePadding[g||"full"]&&f<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(h,c,d){var f=this&&this.__decorate||function(_,j,T,N){var D,A=arguments.length,P=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(_,j,T,N);else for(var O=_.length-1;O>=0;O--)(D=_[O])&&(P=(A<3?D(P):A>3?D(j,T,P):D(j,T))||P);return A>3&&P&&Object.defineProperty(j,T,P),P},g=this&&this.__param||function(_,j){return function(T,N){j(T,N,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=d(5871),v=d(4725),S=d(844),k=d(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let x=c.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,j,T,N,D,A,P){var H;super(),this._viewportElement=_,this._screenElement=j,this._bufferService=T,this._decorationService=N,this._renderService=D,this._optionsService=A,this._coreBrowserService=P,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(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const O=this._canvas.getContext("2d");if(!O)throw new Error("Ctx cannot be null");this._ctx=O,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.toDisposable)((()=>{var q;(q=this._canvas)==null||q.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 _=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=_,y.center=j,y.right=_,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=y.left,b.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(_,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 _=this._colorZoneStore.zones;for(const j of _)j.position!=="full"&&this._renderColorZone(j);for(const j of _)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(b[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-C[_.position||"full"]/2),y[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[_.position||"full"]))}_queueRefresh(_,j){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=x=f([g(2,k.IBufferService),g(3,k.IDecorationService),g(4,v.IRenderService),g(5,k.IOptionsService),g(6,v.ICoreBrowserService)],x)},2950:function(h,c,d){var f=this&&this.__decorate||function(C,y,b,x){var _,j=arguments.length,T=j<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(C,y,b,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(T=(j<3?_(T):j>3?_(y,b,T):_(y,b))||T);return j>3&&T&&Object.defineProperty(y,b,T),T},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=d(4725),v=d(2585),S=d(2584);let k=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,b,x,_,j){this._textarea=C,this._compositionView=y,this._bufferService=b,this._optionsService=x,this._coreService=_,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 y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,b=y.replace(C,"");this._dataAlreadySent=b,y.length>C.length?this._coreService.triggerDataEvent(b,!0):y.length<C.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):y.length===C.length&&y!==C&&this._coreService.triggerDataEvent(y,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const y=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,_=y*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"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=_+"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)}}};c.CompositionHelper=k=f([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,m.IRenderService)],k)},9806:(h,c)=>{function d(f,g,m){const v=m.getBoundingClientRect(),S=f.getComputedStyle(m),k=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-v.left-k,g.clientY-v.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=d,c.getCoords=function(f,g,m,v,S,k,C,y,b){if(!k)return;const x=d(f,g,m);return x?(x[0]=Math.ceil((x[0]+(b?C/2:0))/C),x[1]=Math.ceil(x[1]/y),x[0]=Math.min(Math.max(x[0],1),v+(b?1:0)),x[1]=Math.min(Math.max(x[1],1),S),x):void 0}},9504:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const f=d(2584);function g(y,b,x,_){const j=y-m(y,x),T=b-m(b,x),N=Math.abs(j-T)-(function(D,A,P){let O=0;const H=D-m(D,P),q=A-m(A,P);for(let W=0;W<Math.abs(H-q);W++){const G=v(D,A)==="A"?-1:1,B=P.buffer.lines.get(H+G*W);B!=null&&B.isWrapped&&O++}return O})(y,b,x);return C(N,k(v(y,b),_))}function m(y,b){let x=0,_=b.buffer.lines.get(y),j=_==null?void 0:_.isWrapped;for(;j&&y>=0&&y<b.rows;)x++,_=b.buffer.lines.get(--y),j=_==null?void 0:_.isWrapped;return x}function v(y,b){return y>b?"A":"B"}function S(y,b,x,_,j,T){let N=y,D=b,A="";for(;N!==x||D!==_;)N+=j?1:-1,j&&N>T.cols-1?(A+=T.buffer.translateBufferLineToString(D,!1,y,N),N=0,y=0,D++):!j&&N<0&&(A+=T.buffer.translateBufferLineToString(D,!1,0,y+1),N=T.cols-1,y=N,D--);return A+T.buffer.translateBufferLineToString(D,!1,y,N)}function k(y,b){const x=b?"O":"[";return f.C0.ESC+x+y}function C(y,b){y=Math.floor(y);let x="";for(let _=0;_<y;_++)x+=b;return x}c.moveToCellSequence=function(y,b,x,_){const j=x.buffer.x,T=x.buffer.y;if(!x.buffer.hasScrollback)return(function(A,P,O,H,q,W){return g(P,H,q,W).length===0?"":C(S(A,P,A,P-m(P,q),!1,q).length,k("D",W))})(j,T,0,b,x,_)+g(T,b,x,_)+(function(A,P,O,H,q,W){let G;G=g(P,H,q,W).length>0?H-m(H,q):P;const B=H,F=(function(Z,Y,I,L,R,$){let U;return U=g(I,L,R,$).length>0?L-m(L,R):Y,Z<I&&U<=L||Z>=I&&U<L?"C":"D"})(A,P,O,H,q,W);return C(S(A,G,O,B,F==="C",q).length,k(F,W))})(j,T,y,b,x,_);let N;if(T===b)return N=j>y?"D":"C",C(Math.abs(j-y),k(N,_));N=T>b?"D":"C";const D=Math.abs(T-b);return C((function(A,P){return P.cols-A})(T>b?y:j,x)+(D-1)*x.cols+1+((T>b?j:y)-1),k(N,_))}},1296:function(h,c,d){var f=this&&this.__decorate||function(W,G,B,F){var Z,Y=arguments.length,I=Y<3?G:F===null?F=Object.getOwnPropertyDescriptor(G,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(W,G,B,F);else for(var L=W.length-1;L>=0;L--)(Z=W[L])&&(I=(Y<3?Z(I):Y>3?Z(G,B,I):Z(G,B))||I);return Y>3&&I&&Object.defineProperty(G,B,I),I},g=this&&this.__param||function(W,G){return function(B,F){G(B,F,W)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=d(3787),v=d(2550),S=d(2223),k=d(6171),C=d(6052),y=d(4725),b=d(8055),x=d(8460),_=d(844),j=d(2585),T="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",A="xterm-bg-",P="xterm-focus",O="xterm-selection";let H=1,q=c.DomRenderer=class extends _.Disposable{constructor(W,G,B,F,Z,Y,I,L,R,$,U,ne,Q){super(),this._terminal=W,this._document=G,this._element=B,this._screenElement=F,this._viewportElement=Z,this._helperContainer=Y,this._linkifier2=I,this._charSizeService=R,this._optionsService=$,this._bufferService=U,this._coreBrowserService=ne,this._themeService=Q,this._terminalClass=H++,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(O),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(T+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,_.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const W=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*W,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*W),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/W),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/W),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const G=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=G,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(W){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let G=`${this._terminalSelector} .${N} { color: ${W.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;G+=`${this._terminalSelector} .${N} .xterm-dim { color: ${b.color.multiplyOpacity(W.foreground,.5).css};}`,G+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const B=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,Z=`blink_block_${this._terminalClass}`;G+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,G+=`@keyframes ${F} { 50% { box-shadow: none; }}`,G+=`@keyframes ${Z} { 0% { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css}; } 50% { background-color: inherit; color: ${W.cursor.css}; }}`,G+=`${this._terminalSelector} .${N}.${P} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${N}.${P} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${N}.${P} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Z} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${W.cursor.css} !important; color: ${W.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${W.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${W.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${W.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,G+=`${this._terminalSelector} .${O} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${O} div { position: absolute; background-color: ${W.selectionBackgroundOpaque.css};}${this._terminalSelector} .${O} div { position: absolute; background-color: ${W.selectionInactiveBackgroundOpaque.css};}`;for(const[Y,I]of W.ansi.entries())G+=`${this._terminalSelector} .${D}${Y} { color: ${I.css}; }${this._terminalSelector} .${D}${Y}.xterm-dim { color: ${b.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${A}${Y} { background-color: ${I.css}; }`;G+=`${this._terminalSelector} .${D}${S.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(W.background).css}; }${this._terminalSelector} .${D}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(W.background),.5).css}; }${this._terminalSelector} .${A}${S.INVERTED_DEFAULT_COLOR} { background-color: ${W.foreground.css}; }`,this._themeStyleElement.textContent=G}_setDefaultSpacing(){const W=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${W}px`,this._rowFactory.defaultSpacing=W}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(W,G){for(let B=this._rowElements.length;B<=G;B++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>G;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(W,G){this._refreshRowElements(W,G),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(P),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(P),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(W,G,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,G,B),this.renderRows(0,this._bufferService.rows-1),!W||!G)return;this._selectionRenderModel.update(this._terminal,W,G,B);const F=this._selectionRenderModel.viewportStartRow,Z=this._selectionRenderModel.viewportEndRow,Y=this._selectionRenderModel.viewportCappedStartRow,I=this._selectionRenderModel.viewportCappedEndRow;if(Y>=this._bufferService.rows||I<0)return;const L=this._document.createDocumentFragment();if(B){const R=W[0]>G[0];L.appendChild(this._createSelectionElement(Y,R?G[0]:W[0],R?W[0]:G[0],I-Y+1))}else{const R=F===Y?W[0]:0,$=Y===Z?G[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Y,R,$));const U=I-Y-1;if(L.appendChild(this._createSelectionElement(Y+1,0,this._bufferService.cols,U)),Y!==I){const ne=Z===I?G[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,0,ne))}}this._selectionContainer.appendChild(L)}_createSelectionElement(W,G,B,F=1){const Z=this._document.createElement("div"),Y=G*this.dimensions.css.cell.width;let I=this.dimensions.css.cell.width*(B-G);return Y+I>this.dimensions.css.canvas.width&&(I=this.dimensions.css.canvas.width-Y),Z.style.height=F*this.dimensions.css.cell.height+"px",Z.style.top=W*this.dimensions.css.cell.height+"px",Z.style.left=`${Y}px`,Z.style.width=`${I}px`,Z}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 W of this._rowElements)W.replaceChildren()}renderRows(W,G){const B=this._bufferService.buffer,F=B.ybase+B.y,Z=Math.min(B.x,this._bufferService.cols-1),Y=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=W;R<=G;R++){const $=R+B.ydisp,U=this._rowElements[R],ne=B.lines.get($);if(!U||!ne)break;U.replaceChildren(...this._rowFactory.createRow(ne,$,$===F,I,L,Z,Y,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!0)}_handleLinkLeave(W){this._setCellUnderline(W.x1,W.x2,W.y1,W.y2,W.cols,!1)}_setCellUnderline(W,G,B,F,Z,Y){B<0&&(W=0),F<0&&(G=0);const I=this._bufferService.rows-1;B=Math.max(Math.min(B,I),0),F=Math.max(Math.min(F,I),0),Z=Math.min(Z,this._bufferService.cols);const L=this._bufferService.buffer,R=L.ybase+L.y,$=Math.min(L.x,Z-1),U=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=B;ee<=F;++ee){const X=ee+L.ydisp,V=this._rowElements[ee],ie=L.lines.get(X);if(!V||!ie)break;V.replaceChildren(...this._rowFactory.createRow(ie,X,X===R,ne,Q,$,U,this.dimensions.css.cell.width,this._widthCache,Y?ee===B?W:0:-1,Y?(ee===F?G:Z)-1:-1))}}};c.DomRenderer=q=f([g(7,j.IInstantiationService),g(8,y.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,y.ICoreBrowserService),g(12,y.IThemeService)],q)},3787:function(h,c,d){var f=this&&this.__decorate||function(N,D,A,P){var O,H=arguments.length,q=H<3?D:P===null?P=Object.getOwnPropertyDescriptor(D,A):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(N,D,A,P);else for(var W=N.length-1;W>=0;W--)(O=N[W])&&(q=(H<3?O(q):H>3?O(D,A,q):O(D,A))||q);return H>3&&q&&Object.defineProperty(D,A,q),q},g=this&&this.__param||function(N,D){return function(A,P){D(A,P,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=d(2223),v=d(643),S=d(511),k=d(2585),C=d(8055),y=d(4725),b=d(4269),x=d(6171),_=d(3734);let j=c.DomRendererRowFactory=class{constructor(N,D,A,P,O,H,q){this._document=N,this._characterJoinerService=D,this._optionsService=A,this._coreBrowserService=P,this._coreService=O,this._decorationService=H,this._themeService=q,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,A){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=A}createRow(N,D,A,P,O,H,q,W,G,B,F){const Z=[],Y=this._characterJoinerService.getJoinedCharacters(D),I=this._themeService.colors;let L,R=N.getNoBgTrimmedLength();A&&R<H+1&&(R=H+1);let $=0,U="",ne=0,Q=0,ee=0,X=!1,V=0,ie=!1,re=0;const be=[],ve=B!==-1&&F!==-1;for(let Re=0;Re<R;Re++){N.loadCell(Re,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let ze=!1,Ue=Re,Te=this._workCell;if(Y.length>0&&Re===Y[0][0]){ze=!0;const Qe=Y.shift();Te=new b.JoinedCellData(this._workCell,N.translateToString(!0,Qe[0],Qe[1]),Qe[1]-Qe[0]),Ue=Qe[1]-1,Oe=Te.getWidth()}const pe=this._isCellInSelection(Re,D),Ne=A&&Re===H,$e=ve&&Re>=B&&Re<=F;let Tt=!1;this._decorationService.forEachDecorationAtCell(Re,D,void 0,(Qe=>{Tt=!0}));let me=Te.getChars()||v.WHITESPACE_CELL_CHAR;if(me===" "&&(Te.isUnderline()||Te.isOverline())&&(me=" "),re=Oe*W-G.get(me,Te.isBold(),Te.isItalic()),L){if($&&(pe&&ie||!pe&&!ie&&Te.bg===ne)&&(pe&&ie&&I.selectionForeground||Te.fg===Q)&&Te.extended.ext===ee&&$e===X&&re===V&&!Ne&&!ze&&!Tt){Te.isInvisible()?U+=v.WHITESPACE_CELL_CHAR:U+=me,$++;continue}$&&(L.textContent=U),L=this._document.createElement("span"),$=0,U=""}else L=this._document.createElement("span");if(ne=Te.bg,Q=Te.fg,ee=Te.extended.ext,X=$e,V=re,ie=pe,ze&&H>=Re&&H<=Ue&&(H=Re),!this._coreService.isCursorHidden&&Ne&&this._coreService.isCursorInitialized){if(be.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&be.push("xterm-cursor-blink"),be.push(P==="bar"?"xterm-cursor-bar":P==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(O)switch(O){case"outline":be.push("xterm-cursor-outline");break;case"block":be.push("xterm-cursor-block");break;case"bar":be.push("xterm-cursor-bar");break;case"underline":be.push("xterm-cursor-underline")}}if(Te.isBold()&&be.push("xterm-bold"),Te.isItalic()&&be.push("xterm-italic"),Te.isDim()&&be.push("xterm-dim"),U=Te.isInvisible()?v.WHITESPACE_CELL_CHAR:Te.getChars()||v.WHITESPACE_CELL_CHAR,Te.isUnderline()&&(be.push(`xterm-underline-${Te.extended.underlineStyle}`),U===" "&&(U=" "),!Te.isUnderlineColorDefault()))if(Te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Te.getUnderlineColor()).join(",")})`;else{let Qe=Te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Te.isBold()&&Qe<8&&(Qe+=8),L.style.textDecorationColor=I.ansi[Qe].css}Te.isOverline()&&(be.push("xterm-overline"),U===" "&&(U=" ")),Te.isStrikethrough()&&be.push("xterm-strikethrough"),$e&&(L.style.textDecoration="underline");let je=Te.getFgColor(),Me=Te.getFgColorMode(),ht=Te.getBgColor(),ce=Te.getBgColorMode();const _e=!!Te.isInverse();if(_e){const Qe=je;je=ht,ht=Qe;const Mt=Me;Me=ce,ce=Mt}let Ae,Ie,Ve,At=!1;switch(this._decorationService.forEachDecorationAtCell(Re,D,void 0,(Qe=>{Qe.options.layer!=="top"&&At||(Qe.backgroundColorRGB&&(ce=50331648,ht=Qe.backgroundColorRGB.rgba>>8&16777215,Ae=Qe.backgroundColorRGB),Qe.foregroundColorRGB&&(Me=50331648,je=Qe.foregroundColorRGB.rgba>>8&16777215,Ie=Qe.foregroundColorRGB),At=Qe.options.layer==="top")})),!At&&pe&&(Ae=this._coreBrowserService.isFocused?I.selectionBackgroundOpaque:I.selectionInactiveBackgroundOpaque,ht=Ae.rgba>>8&16777215,ce=50331648,At=!0,I.selectionForeground&&(Me=50331648,je=I.selectionForeground.rgba>>8&16777215,Ie=I.selectionForeground)),At&&be.push("xterm-decoration-top"),ce){case 16777216:case 33554432:Ve=I.ansi[ht],be.push(`xterm-bg-${ht}`);break;case 50331648:Ve=C.channels.toColor(ht>>16,ht>>8&255,255&ht),this._addStyle(L,`background-color:#${T((ht>>>0).toString(16),"0",6)}`);break;default:_e?(Ve=I.foreground,be.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ve=I.background}switch(Ae||Te.isDim()&&(Ae=C.color.multiplyOpacity(Ve,.5)),Me){case 16777216:case 33554432:Te.isBold()&&je<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(je+=8),this._applyMinimumContrast(L,Ve,I.ansi[je],Te,Ae,void 0)||be.push(`xterm-fg-${je}`);break;case 50331648:const Qe=C.channels.toColor(je>>16&255,je>>8&255,255&je);this._applyMinimumContrast(L,Ve,Qe,Te,Ae,Ie)||this._addStyle(L,`color:#${T(je.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ve,I.foreground,Te,Ae,Ie)||_e&&be.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}be.length&&(L.className=be.join(" "),be.length=0),Ne||ze||Tt?L.textContent=U:$++,re!==this.defaultSpacing&&(L.style.letterSpacing=`${re}px`),Z.push(L),Re=Ue}return L&&$&&(L.textContent=U),Z}_applyMinimumContrast(N,D,A,P,O,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(P.getCode()))return!1;const q=this._getContrastCache(P);let W;if(O||H||(W=q.getColor(D.rgba,A.rgba)),W===void 0){const G=this._optionsService.rawOptions.minimumContrastRatio/(P.isDim()?2:1);W=C.color.ensureContrastRatio(O||D,H||A,G),q.setColor((O||D).rgba,(H||A).rgba,W??null)}return!!W&&(this._addStyle(N,`color:${W.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 A=this._selectionStart,P=this._selectionEnd;return!(!A||!P)&&(this._columnSelectMode?A[0]<=P[0]?N>=A[0]&&D>=A[1]&&N<P[0]&&D<=P[1]:N<A[0]&&D>=A[1]&&N>=P[0]&&D<=P[1]:D>A[1]&&D<P[1]||A[1]===P[1]&&D===A[1]&&N>=A[0]&&N<P[0]||A[1]<P[1]&&D===P[1]&&N<P[0]||A[1]<P[1]&&D===A[1]&&N>=A[0])}};function T(N,D,A){for(;N.length<A;)N=D+N;return N}c.DomRendererRowFactory=j=f([g(1,y.ICharacterJoinerService),g(2,k.IOptionsService),g(3,y.ICoreBrowserService),g(4,k.ICoreService),g(5,k.IDecorationService),g(6,y.IThemeService)],j)},2550:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(d,f){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 v=d.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const S=d.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[g,m,v,S],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(v),this._container.appendChild(S),f.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,f,g,m){d===this._font&&f===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=f,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,f,g){let m=0;if(!f&&!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 v=d;f&&(v+="B"),g&&(v+="I");let S=this._holey.get(v);if(S===void 0){let k=0;f&&(k|=1),g&&(k|=2),S=this._measure(d,k),S>0&&this._holey.set(v,S)}return S}_measure(d,f){const g=this._measureElements[f];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(h,c)=>{function d(g){return 57508<=g&&g<=57558}function f(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(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},c.isPowerlineGlyph=d,c.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},c.isEmoji=f,c.allowRescaling=function(g,m,v,S){return m===1&&v>Math.ceil(1.5*S)&&g!==void 0&&g>255&&!f(g)&&!d(g)&&!(function(k){return 57344<=k&&k<=63743})(g)},c.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(m){return 9472<=m&&m<=9631})(g)},c.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}}}},c.computeNextVariantOffset=function(g,m,v=0){return(g-(2*Math.round(m)-v))%(2*Math.round(m))}},6052:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.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,v,S=!1){if(this.selectionStart=m,this.selectionEnd=v,!m||!v||m[0]===v[0]&&m[1]===v[1])return void this.clear();const k=g.buffers.active.ydisp,C=m[1]-k,y=v[1]-k,b=Math.max(C,0),x=Math.min(y,g.rows-1);b>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=b,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=v[0])}isCellSelected(g,m,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&v>=this.viewportCappedStartRow&&m<this.endCol&&v<=this.viewportCappedEndRow:m<this.startCol&&v>=this.viewportCappedStartRow&&m>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&m>=this.startCol)}}c.createSelectionRenderModel=function(){return new d}},456:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.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,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[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(h,c,d){var f=this&&this.__decorate||function(x,_,j,T){var N,D=arguments.length,A=D<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,_,j,T);else for(var P=x.length-1;P>=0;P--)(N=x[P])&&(A=(D<3?N(A):D>3?N(_,j,A):N(_,j))||A);return D>3&&A&&Object.defineProperty(_,j,A),A},g=this&&this.__param||function(x,_){return function(j,T){_(j,T,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=d(2585),v=d(8460),S=d(844);let k=c.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,_,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new y(x,_,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())}};c.CharSizeService=k=f([g(2,m.IOptionsService)],k);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,j){_!==void 0&&_>0&&j!==void 0&&j>0&&(this._result.width=_,this._result.height=j)}}class y extends C{constructor(_,j,T){super(),this._document=_,this._parentElement=j,this._optionsService=T,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends C{constructor(_){super(),this._optionsService=_,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 _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(h,c,d){var f=this&&this.__decorate||function(b,x,_,j){var T,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,_,j);else for(var A=b.length-1;A>=0;A--)(T=b[A])&&(D=(N<3?T(D):N>3?T(x,_,D):T(x,_))||D);return N>3&&D&&Object.defineProperty(x,_,D),D},g=this&&this.__param||function(b,x){return function(_,j){x(_,j,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=d(3734),v=d(643),S=d(511),k=d(2585);class C extends m.AttributeData{constructor(x,_,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=_,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()]}}c.JoinedCellData=C;let y=c.CharacterJoinerService=class sy{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(x){const _={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(_),_.id}deregister(x){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===x)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(x);if(!_||_.length===0)return[];const j=[],T=_.translateToString(!0);let N=0,D=0,A=0,P=_.getFg(0),O=_.getBg(0);for(let H=0;H<_.getTrimmedLength();H++)if(_.loadCell(H,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==P||this._workCell.bg!==O){if(H-N>1){const q=this._getJoinedRanges(T,A,D,_,N);for(let W=0;W<q.length;W++)j.push(q[W])}N=H,A=D,P=this._workCell.fg,O=this._workCell.bg}D+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const H=this._getJoinedRanges(T,A,D,_,N);for(let q=0;q<H.length;q++)j.push(H[q])}return j}_getJoinedRanges(x,_,j,T,N){const D=x.substring(_,j);let A=[];try{A=this._characterJoiners[0].handler(D)}catch(P){console.error(P)}for(let P=1;P<this._characterJoiners.length;P++)try{const O=this._characterJoiners[P].handler(D);for(let H=0;H<O.length;H++)sy._mergeRanges(A,O[H])}catch(O){console.error(O)}return this._stringRangesToCellRanges(A,T,N),A}_stringRangesToCellRanges(x,_,j){let T=0,N=!1,D=0,A=x[T];if(A){for(let P=j;P<this._bufferService.cols;P++){const O=_.getWidth(P),H=_.getString(P).length||v.WHITESPACE_CELL_CHAR.length;if(O!==0){if(!N&&A[0]<=D&&(A[0]=P,N=!0),A[1]<=D){if(A[1]=P,A=x[++T],!A)break;A[0]<=D?(A[0]=P,N=!0):N=!1}D+=H}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(x,_){let j=!1;for(let T=0;T<x.length;T++){const N=x[T];if(j){if(_[1]<=N[0])return x[T-1][1]=_[1],x;if(_[1]<=N[1])return x[T-1][1]=Math.max(_[1],N[1]),x.splice(T,1),x;x.splice(T,1),T--}else{if(_[1]<=N[0])return x.splice(T,0,_),x;if(_[1]<=N[1])return N[0]=Math.min(_[0],N[0]),x;_[0]<N[1]&&(N[0]=Math.min(_[0],N[0]),j=!0)}}return j?x[x.length-1][1]=_[1]:x.push(_),x}};c.CharacterJoinerService=y=f([g(0,k.IBufferService)],y)},5114:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const f=d(844),g=d(8460),m=d(3656);class v extends f.Disposable{constructor(C,y,b){super(),this._textarea=C,this._window=y,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(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}}c.CoreBrowserService=v;class S extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.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,f.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:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const f=d(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const S=this.linkProviders.indexOf(v);S!==-1&&this.linkProviders.splice(S,1)}}}}c.LinkProviderService=g},8934:function(h,c,d){var f=this&&this.__decorate||function(k,C,y,b){var x,_=arguments.length,j=_<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(k,C,y,b);else for(var T=k.length-1;T>=0;T--)(x=k[T])&&(j=(_<3?x(j):_>3?x(C,y,j):x(C,y))||j);return _>3&&j&&Object.defineProperty(C,y,j),j},g=this&&this.__param||function(k,C){return function(y,b){C(y,b,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=d(4725),v=d(9806);let S=c.MouseService=class{constructor(k,C){this._renderService=k,this._charSizeService=C}getCoords(k,C,y,b,x){return(0,v.getCoords)(window,k,C,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(k,C){const y=(0,v.getCoordsRelativeToElement)(window,k,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};c.MouseService=S=f([g(0,m.IRenderService),g(1,m.ICharSizeService)],S)},3230:function(h,c,d){var f=this&&this.__decorate||function(x,_,j,T){var N,D=arguments.length,A=D<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,_,j,T);else for(var P=x.length-1;P>=0;P--)(N=x[P])&&(A=(D<3?N(A):D>3?N(_,j,A):N(_,j))||A);return D>3&&A&&Object.defineProperty(_,j,A),A},g=this&&this.__param||function(x,_){return function(j,T){_(j,T,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=d(6193),v=d(4725),S=d(8460),k=d(844),C=d(7226),y=d(2585);let b=c.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,_,j,T,N,D,A,P){super(),this._rowCount=x,this._charSizeService=T,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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((O,H)=>this._renderRows(O,H)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var O;return(O=this._renderer.value)==null?void 0:O.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(P.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,_),this.register(A.onWindowChange((O=>this._registerIntersectionObserver(O,_))))}_registerIntersectionObserver(x,_){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});j.observe(_),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,_,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,_,this._rowCount))}_renderRows(x,_){this._renderer.value&&(x=Math.min(x,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(x,_),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:_}),this._onRender.fire({start:x,end:_}),this._isNextRenderRedrawOnly=!0)}resize(x,_){this._rowCount=_,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((_=>this.refreshRows(_.start,_.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,_;this._renderer.value&&((_=(x=this._renderer.value).clearTextureAtlas)==null||_.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,_)})):this._renderer.value.handleResize(x,_),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,_,j){var T;this._selectionState.start=x,this._selectionState.end=_,this._selectionState.columnSelectMode=j,(T=this._renderer.value)==null||T.handleSelectionChanged(x,_,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};c.RenderService=b=f([g(2,y.IOptionsService),g(3,v.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],b)},9312:function(h,c,d){var f=this&&this.__decorate||function(A,P,O,H){var q,W=arguments.length,G=W<3?P:H===null?H=Object.getOwnPropertyDescriptor(P,O):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(A,P,O,H);else for(var B=A.length-1;B>=0;B--)(q=A[B])&&(G=(W<3?q(G):W>3?q(P,O,G):q(P,O))||G);return W>3&&G&&Object.defineProperty(P,O,G),G},g=this&&this.__param||function(A,P){return function(O,H){P(O,H,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=d(9806),v=d(9504),S=d(456),k=d(4725),C=d(8460),y=d(844),b=d(6114),x=d(4841),_=d(511),j=d(2585),T=" ",N=new RegExp(T,"g");let D=c.SelectionService=class extends y.Disposable{constructor(A,P,O,H,q,W,G,B,F){super(),this._element=A,this._screenElement=P,this._linkifier=O,this._bufferService=H,this._coreService=q,this._mouseService=W,this._optionsService=G,this._renderService=B,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.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=Z=>this._handleMouseMove(Z),this._mouseUpListener=Z=>this._handleMouseUp(Z),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Z=>this._handleTrim(Z))),this.register(this._bufferService.buffers.onBufferActivate((Z=>this._handleBufferActivate(Z)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.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 A=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!A||!P||A[0]===P[0]&&A[1]===P[1])}get selectionText(){const A=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;if(!A||!P)return"";const O=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(A[0]===P[0])return"";const q=A[0]<P[0]?A[0]:P[0],W=A[0]<P[0]?P[0]:A[0];for(let G=A[1];G<=P[1];G++){const B=O.translateBufferLineToString(G,!0,q,W);H.push(B)}}else{const q=A[1]===P[1]?P[0]:void 0;H.push(O.translateBufferLineToString(A[1],!0,A[0],q));for(let W=A[1]+1;W<=P[1]-1;W++){const G=O.lines.get(W),B=O.translateBufferLineToString(W,!0);G!=null&&G.isWrapped?H[H.length-1]+=B:H.push(B)}if(A[1]!==P[1]){const W=O.lines.get(P[1]),G=O.translateBufferLineToString(P[1],!0,0,P[0]);W&&W.isWrapped?H[H.length-1]+=G:H.push(G)}}return H.map((q=>q.replace(N," "))).join(b.isWindows?`\r
|
|
62
|
-
`:`
|
|
63
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&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(A){const P=this._getMouseBufferCoords(A),O=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(O&&H&&P)&&this._areCoordsInSelection(P,O,H)}isCellInSelection(A,P){const O=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!O||!H)&&this._areCoordsInSelection([A,P],O,H)}_areCoordsInSelection(A,P,O){return A[1]>P[1]&&A[1]<O[1]||P[1]===O[1]&&A[1]===P[1]&&A[0]>=P[0]&&A[0]<O[0]||P[1]<O[1]&&A[1]===O[1]&&A[0]<O[0]||P[1]<O[1]&&A[1]===P[1]&&A[0]>=P[0]}_selectWordAtCursor(A,P){var q,W;const O=(W=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:W.range;if(O)return this._model.selectionStart=[O.start.x-1,O.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(O,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(A);return!!H&&(this._selectWordAt(H,P),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,P){this._model.clearSelection(),A=Math.max(A,0),P=Math.min(P,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,P],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const P=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(P)return P[0]--,P[1]--,P[1]+=this._bufferService.buffer.ydisp,P}_getMouseEventScrollAmount(A){let P=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const O=this._renderService.dimensions.css.canvas.height;return P>=0&&P<=O?0:(P>O&&(P-=O),P=Math.min(Math.max(P,-50),50),P/=50,P/Math.abs(P)+Math.round(14*P))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),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(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const P=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);P&&P.length!==this._model.selectionStart[0]&&P.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const P=this._getMouseBufferCoords(A);P&&(this._activeSelectionMode=2,this._selectLineAt(P[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const P=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!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(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const O=this._bufferService.buffer;if(this._model.selectionEnd[1]<O.lines.length){const H=O.lines.get(this._model.selectionEnd[1]);H&&H.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}P&&P[0]===this._model.selectionEnd[0]&&P[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 A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const P=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&P<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const O=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(O&&O[0]!==void 0&&O[1]!==void 0){const H=(0,v.moveToCellSequence)(O[0]-1,O[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,P=this._model.finalSelectionEnd,O=!(!A||!P||A[0]===P[0]&&A[1]===P[1]);O?A&&P&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&P[0]===this._oldSelectionEnd[0]&&P[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,P,O)):this._oldHasSelection&&this._fireOnSelectionChange(A,P,O)}_fireOnSelectionChange(A,P,O){this._oldSelectionStart=A,this._oldSelectionEnd=P,this._oldHasSelection=O,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((P=>this._handleTrim(P)))}_convertViewportColToCharacterIndex(A,P){let O=P;for(let H=0;P>=H;H++){const q=A.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?O--:q>1&&P!==H&&(O+=q-1)}return O}setSelection(A,P,O){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,P],this._model.selectionStartLength=O,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,P,O=!0,H=!0){if(A[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,W=q.lines.get(A[1]);if(!W)return;const G=q.translateBufferLineToString(A[1],!1);let B=this._convertViewportColToCharacterIndex(W,A[0]),F=B;const Z=A[0]-B;let Y=0,I=0,L=0,R=0;if(G.charAt(B)===" "){for(;B>0&&G.charAt(B-1)===" ";)B--;for(;F<G.length&&G.charAt(F+1)===" ";)F++}else{let ne=A[0],Q=A[0];W.getWidth(ne)===0&&(Y++,ne--),W.getWidth(Q)===2&&(I++,Q++);const ee=W.getString(Q).length;for(ee>1&&(R+=ee-1,F+=ee-1);ne>0&&B>0&&!this._isCharWordSeparator(W.loadCell(ne-1,this._workCell));){W.loadCell(ne-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(Y++,ne--):X>1&&(L+=X-1,B-=X-1),B--,ne--}for(;Q<W.length&&F+1<G.length&&!this._isCharWordSeparator(W.loadCell(Q+1,this._workCell));){W.loadCell(Q+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(I++,Q++):X>1&&(R+=X-1,F+=X-1),F++,Q++}}F++;let $=B+Z-Y+L,U=Math.min(this._bufferService.cols,F-B+Y+I-L-R);if(P||G.slice(B,F).trim()!==""){if(O&&$===0&&W.getCodePoint(0)!==32){const ne=q.lines.get(A[1]-1);if(ne&&W.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Q){const ee=this._bufferService.cols-Q.start;$-=ee,U+=ee}}}if(H&&$+U===this._bufferService.cols&&W.getCodePoint(this._bufferService.cols-1)!==32){const ne=q.lines.get(A[1]+1);if(ne!=null&&ne.isWrapped&&ne.getCodePoint(0)!==32){const Q=this._getWordAt([0,A[1]+1],!1,!1,!0);Q&&(U+=Q.length)}}return{start:$,length:U}}}_selectWordAt(A,P){const O=this._getWordAt(A,P);if(O){for(;O.start<0;)O.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[O.start,A[1]],this._model.selectionStartLength=O.length}}_selectToWordAt(A){const P=this._getWordAt(A,!0);if(P){let O=A[1];for(;P.start<0;)P.start+=this._bufferService.cols,O--;if(!this._model.areSelectionValuesReversed())for(;P.start+P.length>this._bufferService.cols;)P.length-=this._bufferService.cols,O++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?P.start:P.start+P.length,O]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const P=this._bufferService.buffer.getWrappedRangeForLine(A),O={start:{x:0,y:P.first},end:{x:this._bufferService.cols-1,y:P.last}};this._model.selectionStart=[0,P.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(O,this._bufferService.cols)}};c.SelectionService=D=f([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:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const f=d(8343);c.ICharSizeService=(0,f.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),c.IMouseService=(0,f.createDecorator)("MouseService"),c.IRenderService=(0,f.createDecorator)("RenderService"),c.ISelectionService=(0,f.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,f.createDecorator)("ThemeService"),c.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(h,c,d){var f=this&&this.__decorate||function(D,A,P,O){var H,q=arguments.length,W=q<3?A:O===null?O=Object.getOwnPropertyDescriptor(A,P):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,A,P,O);else for(var G=D.length-1;G>=0;G--)(H=D[G])&&(W=(q<3?H(W):q>3?H(A,P,W):H(A,P))||W);return q>3&&W&&Object.defineProperty(A,P,W),W},g=this&&this.__param||function(D,A){return function(P,O){A(P,O,D)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),v=d(8055),S=d(8460),k=d(844),C=d(2585),y=v.css.toColor("#ffffff"),b=v.css.toColor("#000000"),x=v.css.toColor("#ffffff"),_=v.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let P=0;P<216;P++){const O=A[P/36%6|0],H=A[P/6%6|0],q=A[P%6];D.push({css:v.channels.toCss(O,H,q),rgba:v.channels.toRgba(O,H,q)})}for(let P=0;P<24;P++){const O=8+10*P;D.push({css:v.channels.toCss(O,O,O),rgba:v.channels.toRgba(O,O,O)})}return D})());let T=c.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 S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:b,cursor:x,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:v.color.blend(b,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:v.color.blend(b,j),ansi:c.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 A=this._colors;if(A.foreground=N(D.foreground,y),A.background=N(D.background,b),A.cursor=N(D.cursor,x),A.cursorAccent=N(D.cursorAccent,_),A.selectionBackgroundTransparent=N(D.selectionBackground,j),A.selectionBackgroundOpaque=v.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=v.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=D.selectionForeground?N(D.selectionForeground,v.NULL_COLOR):void 0,A.selectionForeground===v.NULL_COLOR&&(A.selectionForeground=void 0),v.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=v.color.opacity(A.selectionBackgroundTransparent,.3)),v.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=v.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=N(D.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=N(D.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=N(D.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=N(D.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=N(D.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=N(D.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=N(D.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=N(D.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=N(D.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=N(D.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=N(D.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=N(D.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=N(D.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=N(D.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=N(D.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=N(D.brightWhite,c.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const P=Math.min(A.ansi.length-16,D.extendedAnsi.length);for(let O=0;O<P;O++)A.ansi[O+16]=N(D.extendedAnsi[O],c.DEFAULT_ANSI_COLORS[O+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 A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}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,A){if(D!==void 0)try{return v.css.toColor(D)}catch{}return A}c.ThemeService=T=f([g(0,C.IOptionsService)],T)},6349:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const f=d(8460),g=d(844);class m extends g.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(S){if(this._maxLength===S)return;const k=new Array(S);for(let C=0;C<Math.min(S,this.length);C++)k[C]=this._array[this._getCyclicIndex(C)];this._array=k,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let k=this._length;k<S;k++)this._array[k]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,k){this._array[this._getCyclicIndex(S)]=k}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,k,...C){if(k){for(let y=S;y<this._length-k;y++)this._array[this._getCyclicIndex(y)]=this._array[this._getCyclicIndex(y+k)];this._length-=k,this.onDeleteEmitter.fire({index:S,amount:k})}for(let y=this._length-1;y>=S;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;y<C.length;y++)this._array[this._getCyclicIndex(S+y)]=C[y];if(C.length&&this.onInsertEmitter.fire({index:S,amount:C.length}),this._length+C.length>this._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,k,C){if(!(k<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+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(S+b+C,this.get(S+b));const y=S+k+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y<k;y++)this.set(S+y+C,this.get(S+y))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}c.CircularList=m},1439:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function d(f,g=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const v in f)m[v]=g<=1?f[v]:f[v]&&d(f[v],g-1);return m}},8055:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let d=0,f=0,g=0,m=0;var v,S,k,C,y;function b(_){const j=_.toString(16);return j.length<2?"0"+j:j}function x(_,j){return _<j?(j+.05)/(_+.05):(_+.05)/(j+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(j,T,N,D){return D!==void 0?`#${b(j)}${b(T)}${b(N)}${b(D)}`:`#${b(j)}${b(T)}${b(N)}`},_.toRgba=function(j,T,N,D=255){return(j<<24|T<<16|N<<8|D)>>>0},_.toColor=function(j,T,N,D){return{css:_.toCss(j,T,N,D),rgba:_.toRgba(j,T,N,D)}}})(v||(c.channels=v={})),(function(_){function j(T,N){return m=Math.round(255*N),[d,f,g]=y.toChannels(T.rgba),{css:v.toCss(d,f,g,m),rgba:v.toRgba(d,f,g,m)}}_.blend=function(T,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,A=N.rgba>>16&255,P=N.rgba>>8&255,O=T.rgba>>24&255,H=T.rgba>>16&255,q=T.rgba>>8&255;return d=O+Math.round((D-O)*m),f=H+Math.round((A-H)*m),g=q+Math.round((P-q)*m),{css:v.toCss(d,f,g),rgba:v.toRgba(d,f,g)}},_.isOpaque=function(T){return(255&T.rgba)==255},_.ensureContrastRatio=function(T,N,D){const A=y.ensureContrastRatio(T.rgba,N.rgba,D);if(A)return v.toColor(A>>24&255,A>>16&255,A>>8&255)},_.opaque=function(T){const N=(255|T.rgba)>>>0;return[d,f,g]=y.toChannels(N),{css:v.toCss(d,f,g),rgba:N}},_.opacity=j,_.multiplyOpacity=function(T,N){return m=255&T.rgba,j(T,m*N/255)},_.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(S||(c.color=S={})),(function(_){let j,T;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",T=j.createLinearGradient(0,0,1,1))}catch{}_.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),f=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),v.toColor(d,f,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),f=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),v.toColor(d,f,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]),f=parseInt(D[2]),g=parseInt(D[3]),m=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),v.toColor(d,f,g,m);if(!j||!T)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=T,j.fillStyle=N,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[d,f,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(d,f,g,m),css:N}}})(k||(c.css=k={})),(function(_){function j(T,N,D){const A=T/255,P=N/255,O=D/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))+.0722*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))}_.relativeLuminance=function(T){return j(T>>16&255,T>>8&255,255&T)},_.relativeLuminance2=j})(C||(c.rgb=C={})),(function(_){function j(N,D,A){const P=N>>24&255,O=N>>16&255,H=N>>8&255;let q=D>>24&255,W=D>>16&255,G=D>>8&255,B=x(C.relativeLuminance2(q,W,G),C.relativeLuminance2(P,O,H));for(;B<A&&(q>0||W>0||G>0);)q-=Math.max(0,Math.ceil(.1*q)),W-=Math.max(0,Math.ceil(.1*W)),G-=Math.max(0,Math.ceil(.1*G)),B=x(C.relativeLuminance2(q,W,G),C.relativeLuminance2(P,O,H));return(q<<24|W<<16|G<<8|255)>>>0}function T(N,D,A){const P=N>>24&255,O=N>>16&255,H=N>>8&255;let q=D>>24&255,W=D>>16&255,G=D>>8&255,B=x(C.relativeLuminance2(q,W,G),C.relativeLuminance2(P,O,H));for(;B<A&&(q<255||W<255||G<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),W=Math.min(255,W+Math.ceil(.1*(255-W))),G=Math.min(255,G+Math.ceil(.1*(255-G))),B=x(C.relativeLuminance2(q,W,G),C.relativeLuminance2(P,O,H));return(q<<24|W<<16|G<<8|255)>>>0}_.blend=function(N,D){if(m=(255&D)/255,m===1)return D;const A=D>>24&255,P=D>>16&255,O=D>>8&255,H=N>>24&255,q=N>>16&255,W=N>>8&255;return d=H+Math.round((A-H)*m),f=q+Math.round((P-q)*m),g=W+Math.round((O-W)*m),v.toRgba(d,f,g)},_.ensureContrastRatio=function(N,D,A){const P=C.relativeLuminance(N>>8),O=C.relativeLuminance(D>>8);if(x(P,O)<A){if(O<P){const W=j(N,D,A),G=x(P,C.relativeLuminance(W>>8));if(G<A){const B=T(N,D,A);return G>x(P,C.relativeLuminance(B>>8))?W:B}return W}const H=T(N,D,A),q=x(P,C.relativeLuminance(H>>8));if(q<A){const W=j(N,D,A);return q>x(P,C.relativeLuminance(W>>8))?H:W}return H}},_.reduceLuminance=j,_.increaseLuminance=T,_.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(y||(c.rgba=y={})),c.toPaddedHex=b,c.contrastRatio=x},8969:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const f=d(844),g=d(2585),m=d(4348),v=d(7866),S=d(744),k=d(7302),C=d(6975),y=d(8460),b=d(1753),x=d(1480),_=d(7994),j=d(9282),T=d(5435),N=d(5981),D=d(2660);let A=!1;class P extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((H=>{var q;(q=this._onScrollApi)==null||q.fire(H.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(H){for(const q in H)this.optionsService.options[q]=H[q]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new k.OptionsService(H)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.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(_.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 T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.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((q=>{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((q=>{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(((q,W)=>this._inputHandler.parse(q,W)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,q){this._writeBuffer.write(H,q)}writeSync(H,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(H,q)}input(H,q=!0){this.coreService.triggerDataEvent(H,q)}resize(H,q){isNaN(H)||isNaN(q)||(H=Math.max(H,S.MINIMUM_COLS),q=Math.max(q,S.MINIMUM_ROWS),this._bufferService.resize(H,q))}scroll(H,q=!1){this._bufferService.scroll(H,q)}scrollLines(H,q,W){this._bufferService.scrollLines(H,q,W)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const q=H-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(H,q){return this._inputHandler.registerEscHandler(H,q)}registerDcsHandler(H,q){return this._inputHandler.registerDcsHandler(H,q)}registerCsiHandler(H,q){return this._inputHandler.registerCsiHandler(H,q)}registerOscHandler(H,q){return this._inputHandler.registerOscHandler(H,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?H=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const q of H)q.dispose()}))}}}c.CoreTerminal=P},8460:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.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 f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){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,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(d,f){return d((g=>f.fire(g)))},c.runAndSubscribe=function(d,f){return f(void 0),d((g=>f(g)))}},5435:function(h,c,d){var f=this&&this.__decorate||function(Y,I,L,R){var $,U=arguments.length,ne=U<3?I:R===null?R=Object.getOwnPropertyDescriptor(I,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(Y,I,L,R);else for(var Q=Y.length-1;Q>=0;Q--)($=Y[Q])&&(ne=(U<3?$(ne):U>3?$(I,L,ne):$(I,L))||ne);return U>3&&ne&&Object.defineProperty(I,L,ne),ne},g=this&&this.__param||function(Y,I){return function(L,R){I(L,R,Y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=d(2584),v=d(7116),S=d(2015),k=d(844),C=d(482),y=d(8437),b=d(8460),x=d(643),_=d(511),j=d(3734),T=d(2585),N=d(1480),D=d(6242),A=d(6351),P=d(5941),O={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function q(Y,I){if(Y>24)return I.setWinLines||!1;switch(Y){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var W;(function(Y){Y[Y.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Y[Y.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(W||(c.WindowsOptionsReportType=W={}));let G=0;class B extends k.Disposable{getAttrData(){return this._curAttrData}constructor(I,L,R,$,U,ne,Q,ee,X=new S.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=L,this._coreService=R,this._logService=$,this._optionsService=U,this._oscLinkService=ne,this._coreMouseService=Q,this._unicodeService=ee,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new _.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.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 F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ie)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ie.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ie,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ie,data:re})})),this._parser.setDcsHandlerFallback(((V,ie,re)=>{ie==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ie,payload:re})})),this._parser.setPrintHandler(((V,ie,re)=>this.print(V,ie,re))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!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((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new D.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new D.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new D.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new D.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new D.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new D.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new D.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new D.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new D.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new D.OscHandler((V=>this.restoreCursorColor(V)))),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 V in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((V,ie)=>this.requestStatusString(V,ie))))}_preserveStack(I,L,R,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=R,this._parseStack.position=$}_logSlowResolvingAsync(I){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([I,new Promise(((L,R)=>setTimeout((()=>R("#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(I,L){let R,$=this._activeBuffer.x,U=this._activeBuffer.y,ne=0;const Q=this._parseStack.paused;if(Q){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(R),R;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>H&&(ne=this._parseStack.position+H)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,(V=>String.fromCharCode(V))).join("")}"`),typeof I=="string"?I.split("").map((V=>V.charCodeAt(0))):I),this._parseBuffer.length<I.length&&this._parseBuffer.length<H&&(this._parseBuffer=new Uint32Array(Math.min(I.length,H))),Q||this._dirtyRowTracker.clearRange(),I.length>H)for(let V=ne;V<I.length;V+=H){const ie=V+H<I.length?V+H:I.length,re=typeof I=="string"?this._stringDecoder.decode(I.substring(V,ie),this._parseBuffer):this._utf8Decoder.decode(I.subarray(V,ie),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,re))return this._preserveStack($,U,re,V),this._logSlowResolvingAsync(R),R}else if(!Q){const V=typeof I=="string"?this._stringDecoder.decode(I,this._parseBuffer):this._utf8Decoder.decode(I,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,V))return this._preserveStack($,U,V,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===$&&this._activeBuffer.y===U||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(I,L,R){let $,U;const ne=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,ie=this._curAttrData;let re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-L>0&&re.getWidth(this._activeBuffer.x-1)===2&&re.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ie);let be=this._parser.precedingJoinState;for(let ve=L;ve<R;++ve){if($=I[ve],$<127&&ne){const Ue=ne[String.fromCharCode($)];Ue&&($=Ue.charCodeAt(0))}const Re=this._unicodeService.charProperties($,be);U=N.UnicodeService.extractWidth(Re);const Oe=N.UnicodeService.extractShouldJoin(Re),ze=Oe?N.UnicodeService.extractWidth(be):0;if(be=Re,Q&&this._onA11yChar.fire((0,C.stringFromCodePoint)($)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-ze>ee){if(X){const Ue=re;let Te=this._activeBuffer.x-ze;for(this._activeBuffer.x=ze,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),re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ze>0&&re instanceof y.BufferLine&&re.copyCellsFrom(Ue,Te,0,ze,!1);Te<ee;)Ue.setCellFromCodepoint(Te++,0,1,ie)}else if(this._activeBuffer.x=ee-1,U===2)continue}if(Oe&&this._activeBuffer.x){const Ue=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-Ue,$,U);for(let Te=U-ze;--Te>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}else if(V&&(re.insertCells(this._activeBuffer.x,U-ze,this._activeBuffer.getNullCell(ie)),re.getWidth(ee-1)===2&&re.setCellFromCodepoint(ee-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ie)),re.setCellFromCodepoint(this._activeBuffer.x++,$,U,ie),U>0)for(;--U;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,ie)}this._parser.precedingJoinState=be,this._activeBuffer.x<ee&&R-L>0&&re.getWidth(this._activeBuffer.x)===0&&!re.hasContent(this._activeBuffer.x)&&re.setCellFromCodepoint(this._activeBuffer.x,0,1,ie),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,L){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,L):this._parser.registerCsiHandler(I,(R=>!q(R.params[0],this._optionsService.rawOptions.windowOptions)||L(R)))}registerDcsHandler(I,L){return this._parser.registerDcsHandler(I,new A.DcsHandler(L))}registerEscHandler(I,L){return this._parser.registerEscHandler(I,L)}registerOscHandler(I,L){return this._parser.registerOscHandler(I,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 I;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&&((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&I.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 I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,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(I,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=I,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+L)}cursorUp(I){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const L=I.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const L=I.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,L,R,$=!1,U=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);ne.replaceCells(L,R,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(ne.isWrapped=!1)}_resetBufferLine(I,L=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),R.isWrapped=!1)}eraseInDisplay(I,L=!1){let R;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);R<this._bufferService.rows;R++)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,L);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(I,L=!1){switch(this._restrictCursor(this._bufferService.cols),I.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(I){this._restrictCursor();let L=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,$=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-$+1;for(;L--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(I){this._restrictCursor();let L=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let $;for($=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-$;L--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice($,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(I){let L=I.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(I){let L=I.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(y.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);$.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);$.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);$.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=I.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);$.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(I){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(I.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(I){const L=this._parser.precedingJoinState;if(!L)return!0;const R=I.params[0]||1,$=N.UnicodeService.extractWidth(L),U=this._activeBuffer.x-$,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),Q=new Uint32Array(ne.length*R);let ee=0;for(let V=0;V<ne.length;){const ie=ne.codePointAt(V)||0;Q[ee++]=ie,V+=ie>65535?2:1}let X=ee;for(let V=1;V<R;++V)Q.copyWithin(X,0,ee),X+=ee;return this.print(Q,0,X),!0}sendDeviceAttributesPrimary(I){return I.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(I){return I.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(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(I){for(let L=0;L<I.length;L++)switch(I.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(I){for(let L=0;L<I.length;L++)switch(I.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(),I.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(I,L){const R=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:U}=this._coreMouseService,ne=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:X,alt:V}=Q,ie=this._optionsService.rawOptions,re=Oe=>Oe?1:2,be=I.params[0];return ve=be,Re=L?be===2?4:be===4?re(ne.modes.insertMode):be===12?3:be===20?re(ie.convertEol):0:be===1?re(R.applicationCursorKeys):be===3?ie.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:be===6?re(R.origin):be===7?re(R.wraparound):be===8?3:be===9?re($==="X10"):be===12?re(ie.cursorBlink):be===25?re(!ne.isCursorHidden):be===45?re(R.reverseWraparound):be===66?re(R.applicationKeypad):be===67?4:be===1e3?re($==="VT200"):be===1002?re($==="DRAG"):be===1003?re($==="ANY"):be===1004?re(R.sendFocus):be===1005?4:be===1006?re(U==="SGR"):be===1015?4:be===1016?re(U==="SGR_PIXELS"):be===1048?1:be===47||be===1047||be===1049?re(X===V):be===2004?re(R.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${ve};${Re}$y`),!0;var ve,Re}_updateAttrColor(I,L,R,$,U){return L===2?(I|=50331648,I&=-16777216,I|=j.AttributeData.fromColorRGB([R,$,U])):L===5&&(I&=-50331904,I|=33554432|255&R),I}_extractColor(I,L,R){const $=[0,0,-1,0,0,0];let U=0,ne=0;do{if($[ne+U]=I.params[L+ne],I.hasSubParams(L+ne)){const Q=I.getSubParams(L+ne);let ee=0;do $[1]===5&&(U=1),$[ne+ee+1+U]=Q[ee];while(++ee<Q.length&&ee+ne+1+U<$.length);break}if($[1]===5&&ne+U>=2||$[1]===2&&ne+U>=5)break;$[1]&&(U=1)}while(++ne+L<I.length&&ne+U<$.length);for(let Q=2;Q<$.length;++Q)$[Q]===-1&&($[Q]=0);switch($[0]){case 38:R.fg=this._updateAttrColor(R.fg,$[1],$[3],$[4],$[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,$[1],$[3],$[4],$[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,$[1],$[3],$[4],$[5])}return ne}_processUnderline(I,L){L.extended=L.extended.clone(),(!~I||I>5)&&(I=1),L.extended.underlineStyle=I,L.fg|=268435456,I===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(I){I.fg=y.DEFAULT_ATTR_DATA.fg,I.bg=y.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=I.length;let R;const $=this._curAttrData;for(let U=0;U<L;U++)R=I.params[U],R>=30&&R<=37?($.fg&=-50331904,$.fg|=16777216|R-30):R>=40&&R<=47?($.bg&=-50331904,$.bg|=16777216|R-40):R>=90&&R<=97?($.fg&=-50331904,$.fg|=16777224|R-90):R>=100&&R<=107?($.bg&=-50331904,$.bg|=16777224|R-100):R===0?this._processSGR0($):R===1?$.fg|=134217728:R===3?$.bg|=67108864:R===4?($.fg|=268435456,this._processUnderline(I.hasSubParams(U)?I.getSubParams(U)[0]:1,$)):R===5?$.fg|=536870912:R===7?$.fg|=67108864:R===8?$.fg|=1073741824:R===9?$.fg|=2147483648:R===2?$.bg|=134217728:R===21?this._processUnderline(2,$):R===22?($.fg&=-134217729,$.bg&=-134217729):R===23?$.bg&=-67108865:R===24?($.fg&=-268435457,this._processUnderline(0,$)):R===25?$.fg&=-536870913:R===27?$.fg&=-67108865:R===28?$.fg&=-1073741825:R===29?$.fg&=2147483647:R===39?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):R===49?($.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?U+=this._extractColor(I,U,$):R===53?$.bg|=1073741824:R===55?$.bg&=-1073741825:R===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):R===100?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${R}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const L=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${R}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=y.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(I){const L=I.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 R=L%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(I){const L=I.params[0]||1;let R;return(I.length<2||(R=I.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(I){if(!q(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(W.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(W.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(I){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(I){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(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const L=[],R=I.split(";");for(;R.length>1;){const $=R.shift(),U=R.shift();if(/^\d+$/.exec($)){const ne=parseInt($);if(Z(ne))if(U==="?")L.push({type:0,index:ne});else{const Q=(0,P.parseColor)(U);Q&&L.push({type:1,index:ne,color:Q})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(I){const L=I.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(I,L){this._getCurrentLinkId()&&this._finishHyperlink();const R=I.split(":");let $;const U=R.findIndex((ne=>ne.startsWith("id=")));return U!==-1&&($=R[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,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(I,L){const R=I.split(";");for(let $=0;$<R.length&&!(L>=this._specialColors.length);++$,++L)if(R[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,P.parseColor)(R[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const L=[],R=I.split(";");for(let $=0;$<R.length;++$)if(/^\d+$/.exec(R[$])){const U=parseInt(R[$]);Z(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(I){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(I){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(I){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),!0}selectCharset(I){return I.length!==2?(this.selectDefaultCharset(),!0):(I[0]==="/"||this._charsetService.setgCharset(O[I[0]],v.CHARSETS[I[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new _.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const R=this._activeBuffer.ybase+this._activeBuffer.y+L,$=this._activeBuffer.lines.get(R);$&&($.fill(I),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(I,L){const R=this._bufferService.buffer,$=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,L){this._dirtyRowTracker.markRangeDirty(I,L)}}c.InputHandler=B;let F=class{constructor(Y){this._bufferService=Y,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Y){Y<this.start?this.start=Y:Y>this.end&&(this.end=Y)}markRangeDirty(Y,I){Y>I&&(G=Y,Y=I,I=G),Y<this.start&&(this.start=Y),I>this.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Z(Y){return 0<=Y&&Y<256}F=f([g(0,T.IBufferService)],F)},844:(h,c)=>{function d(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},c.toDisposable=function(f){return{dispose:f}},c.disposeArray=d,c.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,v){this._data[g]||(this._data[g]={}),this._data[g][m]=v}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=d,c.FourKeyMap=class{constructor(){this._data=new d}set(f,g,m,v,S){this._data.get(f,g)||this._data.set(f,g,new d),this._data.get(f,g).set(m,v,S)}get(f,g,m,v){var S;return(S=this._data.get(f,g))==null?void 0:S.get(m,v)}clear(){this._data.clear()}}},6114:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const d=c.isNode?"node":navigator.userAgent,f=c.isNode?"node":navigator.platform;c.isFirefox=d.includes("Firefox"),c.isLegacyEdge=d.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(d),c.getSafariVersion=function(){if(!c.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),c.isIpad=f==="iPad",c.isIphone=f==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),c.isLinux=f.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(d)},6106:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let d=0;c.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(d=this._search(this._getKey(f)),this._array.splice(d,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)return!1;do if(this._array[d]===f)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===g);return!1}*getKeyIterator(f){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===f)}forEachByKey(f,g){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let g=0,m=this._array.length-1;for(;m>=g;){let v=g+m>>1;const S=this._getKey(this._array[v]);if(S>f)m=v-1;else{if(!(S<f)){for(;v>0&&this._getKey(this._array[v-1])===f;)v--;return v}g=v+1}}return g}}},7226:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const f=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let k=0,C=0,y=S.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=S.timeRemaining(),1.5*C>b)return y-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-k))}ms`),void this._start();y=b}this.clear()}}class m extends g{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const k=Date.now()+S;return{timeRemaining:()=>Math.max(0,k-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const f=d(643);c.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),v=m==null?void 0:m.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&v&&(S.isWrapped=v[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&v[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}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}}c.AttributeData=d;class f{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,v=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=v}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=f},9092:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const f=d(6349),g=d(7226),m=d(3734),v=d(8437),S=d(4634),k=d(511),C=d(643),y=d(4863),b=d(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(x,_,j){this._hasScrollback=x,this._optionsService=_,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=v.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 f.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,_){return new v.BufferLine(this._bufferService.cols,this.getNullCell(x),_)}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 _=x+this._optionsService.rawOptions.scrollback;return _>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:_}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=v.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,_){const j=this.getNullCell(v.DEFAULT_ATTR_DATA);let T=0;const N=this._getCorrectBufferLength(_);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let A=0;A<this.lines.length;A++)T+=+this.lines.get(A).resize(x,j);let D=0;if(this._rows<_)for(let A=this._rows;A<_;A++)this.lines.length<_+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(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 v.BufferLine(x,j)));else for(let A=this._rows;A>_;A--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const A=this.lines.length-N;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,_-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(x,_),this._cols>x))for(let D=0;D<this.lines.length;D++)T+=+this.lines.get(D).resize(x,j);this._cols=x,this._rows=_,this._memoryCleanupQueue.clear(),T>.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 _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>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,_){this._cols!==x&&(x>this._cols?this._reflowLarger(x,_):this._reflowSmaller(x,_))}_reflowLarger(x,_){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(j.length>0){const T=(0,S.reflowLargerCreateNewLayout)(this.lines,j);(0,S.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(x,_,T.countRemoved)}}_reflowLargerAdjustViewport(x,_,j){const T=this.getNullCell(v.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new v.BufferLine(x,T))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,_){const j=this.getNullCell(v.DEFAULT_ATTR_DATA),T=[];let N=0;for(let D=this.lines.length-1;D>=0;D--){let A=this.lines.get(D);if(!A||!A.isWrapped&&A.getTrimmedLength()<=x)continue;const P=[A];for(;A.isWrapped&&D>0;)A=this.lines.get(--D),P.unshift(A);const O=this.ybase+this.y;if(O>=D&&O<D+P.length)continue;const H=P[P.length-1].getTrimmedLength(),q=(0,S.reflowSmallerGetNewLineLengths)(P,this._cols,x),W=q.length-P.length;let G;G=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+W):Math.max(0,this.lines.length-this.lines.maxLength+W);const B=[];for(let R=0;R<W;R++){const $=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);B.push($)}B.length>0&&(T.push({start:D+P.length+N,newLines:B}),N+=B.length),P.push(...B);let F=q.length-1,Z=q[F];Z===0&&(F--,Z=q[F]);let Y=P.length-W-1,I=H;for(;Y>=0;){const R=Math.min(I,Z);if(P[F]===void 0)break;if(P[F].copyCellsFrom(P[Y],I-R,Z-R,R,!0),Z-=R,Z===0&&(F--,Z=q[F]),I-=R,I===0){Y--;const $=Math.max(Y,0);I=(0,S.getWrappedLineTrimmedLength)(P,$,this._cols)}}for(let R=0;R<P.length;R++)q[R]<x&&P[R].setCell(q[R],j);let L=W-G;for(;L-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+W,this.ybase+_-1)}if(T.length>0){const D=[],A=[];for(let F=0;F<this.lines.length;F++)A.push(this.lines.get(F));const P=this.lines.length;let O=P-1,H=0,q=T[H];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let W=0;for(let F=Math.min(this.lines.maxLength-1,P+N-1);F>=0;F--)if(q&&q.start>O+W){for(let Z=q.newLines.length-1;Z>=0;Z--)this.lines.set(F--,q.newLines[Z]);F++,D.push({index:O+1,amount:q.newLines.length}),W+=q.newLines.length,q=T[++H]}else this.lines.set(F,A[O--]);let G=0;for(let F=D.length-1;F>=0;F--)D[F].index+=G,this.lines.onInsertEmitter.fire(D[F]),G+=D[F].amount;const B=Math.max(0,P+N-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(x,_,j=0,T){const N=this.lines.get(x);return N?N.translateToString(_,j,T):""}getWrappedRangeForLine(x){let _=x,j=x;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:_,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 _=0;_<this.markers.length;_++)this.markers[_].line===x&&(this.markers[_].dispose(),this.markers.splice(_--,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 _=new y.Marker(x);return this.markers.push(_),_.register(this.lines.onTrim((j=>{_.line-=j,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((j=>{_.line>=j.index&&(_.line+=j.amount)}))),_.register(this.lines.onDelete((j=>{_.line>=j.index&&_.line<j.index+j.amount&&_.dispose(),_.line>j.index&&(_.line-=j.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const f=d(3734),g=d(511),m=d(643),v=d(482);c.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let S=0;class k{constructor(y,b,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const _=b||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<y;++j)this.setCell(j,_);this.length=y}get(y){const b=this._data[3*y+0],x=2097151&b;return[this._data[3*y+1],2097152&b?this._combined[y]:x?(0,v.stringFromCodePoint)(x):"",b>>22,2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):x]}set(y,b){this._data[3*y+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=b[1],this._data[3*y+0]=2097152|y|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&b}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y]:2097151&b?(0,v.stringFromCodePoint)(2097151&b):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,b){return S=3*y,b.content=this._data[S+0],b.fg=this._data[S+1],b.bg=this._data[S+2],2097152&b.content&&(b.combinedData=this._combined[y]),268435456&b.bg&&(b.extended=this._extendedAttrs[y]),b}setCell(y,b){2097152&b.content&&(this._combined[y]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[y]=b.extended),this._data[3*y+0]=b.content,this._data[3*y+1]=b.fg,this._data[3*y+2]=b.bg}setCellFromCodepoint(y,b,x,_){268435456&_.bg&&(this._extendedAttrs[y]=_.extended),this._data[3*y+0]=b|x<<22,this._data[3*y+1]=_.fg,this._data[3*y+2]=_.bg}addCodepointToCell(y,b,x){let _=this._data[3*y+0];2097152&_?this._combined[y]+=(0,v.stringFromCodePoint)(b):2097151&_?(this._combined[y]=(0,v.stringFromCodePoint)(2097151&_)+(0,v.stringFromCodePoint)(b),_&=-2097152,_|=2097152):_=b|4194304,x&&(_&=-12582913,_|=x<<22),this._data[3*y+0]=_}insertCells(y,b,x){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),b<this.length-y){const _=new g.CellData;for(let j=this.length-y-b-1;j>=0;--j)this.setCell(y+b+j,this.loadCell(y+j,_));for(let j=0;j<b;++j)this.setCell(y+j,x)}else for(let _=y;_<this.length;++_)this.setCell(_,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(y,b,x){if(y%=this.length,b<this.length-y){const _=new g.CellData;for(let j=0;j<this.length-y-b;++j)this.setCell(y+j,this.loadCell(y+b+j,_));for(let j=this.length-b;j<this.length;++j)this.setCell(j,x)}else for(let _=y;_<this.length;++_)this.setCell(_,x);y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),this.getWidth(y)!==0||this.hasContent(y)||this.setCellFromCodepoint(y,0,1,x)}replaceCells(y,b,x,_=!1){if(_)for(y&&this.getWidth(y-1)===2&&!this.isProtected(y-1)&&this.setCellFromCodepoint(y-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,x);y<b&&y<this.length;)this.isProtected(y)||this.setCell(y,x),y++;else for(y&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,x);y<b&&y<this.length;)this.setCell(y++,x)}resize(y,b){if(y===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*y;if(y>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const _=new Uint32Array(x);_.set(this._data),this._data=_}for(let _=this.length;_<y;++_)this.setCell(_,b)}else{this._data=this._data.subarray(0,x);const _=Object.keys(this._combined);for(let T=0;T<_.length;T++){const N=parseInt(_[T],10);N>=y&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let T=0;T<j.length;T++){const N=parseInt(j[T],10);N>=y&&delete this._extendedAttrs[N]}}return this.length=y,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const y=new Uint32Array(this._data.length);return y.set(this._data),this._data=y,1}return 0}fill(y,b=!1){if(b)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,y);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,y)}}copyFrom(y){this.length!==y.length?this._data=new Uint32Array(y._data):this._data.set(y._data),this.length=y.length,this._combined={};for(const b in y._combined)this._combined[b]=y._combined[b];this._extendedAttrs={};for(const b in y._extendedAttrs)this._extendedAttrs[b]=y._extendedAttrs[b];this.isWrapped=y.isWrapped}clone(){const y=new k(0);y._data=new Uint32Array(this._data),y.length=this.length;for(const b in this._combined)y._combined[b]=this._combined[b];for(const b in this._extendedAttrs)y._extendedAttrs[b]=this._extendedAttrs[b];return y.isWrapped=this.isWrapped,y}getTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,b,x,_,j){const T=y._data;if(j)for(let D=_-1;D>=0;D--){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=T[3*(b+D)+A];268435456&T[3*(b+D)+2]&&(this._extendedAttrs[x+D]=y._extendedAttrs[b+D])}else for(let D=0;D<_;D++){for(let A=0;A<3;A++)this._data[3*(x+D)+A]=T[3*(b+D)+A];268435456&T[3*(b+D)+2]&&(this._extendedAttrs[x+D]=y._extendedAttrs[b+D])}const N=Object.keys(y._combined);for(let D=0;D<N.length;D++){const A=parseInt(N[D],10);A>=b&&(this._combined[A-b+x]=y._combined[A])}}translateToString(y,b,x,_){b=b??0,x=x??this.length,y&&(x=Math.min(x,this.getTrimmedLength())),_&&(_.length=0);let j="";for(;b<x;){const T=this._data[3*b+0],N=2097151&T,D=2097152&T?this._combined[b]:N?(0,v.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,_)for(let A=0;A<D.length;++A)_.push(b);b+=T>>22||1}return _&&_.push(b),j}}c.BufferLine=k},4841:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(d,f){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 f*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(h,c)=>{function d(f,g,m){if(g===f.length-1)return f[g].getTrimmedLength();const v=!f[g].hasContent(m-1)&&f[g].getWidth(m-1)===1,S=f[g+1].getWidth(0)===2;return v&&S?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(f,g,m,v,S){const k=[];for(let C=0;C<f.length-1;C++){let y=C,b=f.get(++y);if(!b.isWrapped)continue;const x=[f.get(C)];for(;y<f.length&&b.isWrapped;)x.push(b),b=f.get(++y);if(v>=C&&v<y){C+=x.length-1;continue}let _=0,j=d(x,_,g),T=1,N=0;for(;T<x.length;){const A=d(x,T,g),P=A-N,O=m-j,H=Math.min(P,O);x[_].copyCellsFrom(x[T],N,j,H,!1),j+=H,j===m&&(_++,j=0),N+=H,N===A&&(T++,N=0),j===0&&_!==0&&x[_-1].getWidth(m-1)===2&&(x[_].copyCellsFrom(x[_-1],m-1,j++,1,!1),x[_-1].setCell(m-1,S))}x[_].replaceCells(j,m,S);let D=0;for(let A=x.length-1;A>0&&(A>_||x[A].getTrimmedLength()===0);A--)D++;D>0&&(k.push(C+x.length-D),k.push(D)),C+=x.length-1}return k},c.reflowLargerCreateNewLayout=function(f,g){const m=[];let v=0,S=g[v],k=0;for(let C=0;C<f.length;C++)if(S===C){const y=g[++v];f.onDeleteEmitter.fire({index:C-k,amount:y}),C+=y-1,k+=y,S=g[++v]}else m.push(C);return{layout:m,countRemoved:k}},c.reflowLargerApplyNewLayout=function(f,g){const m=[];for(let v=0;v<g.length;v++)m.push(f.get(g[v]));for(let v=0;v<m.length;v++)f.set(v,m[v]);f.length=g.length},c.reflowSmallerGetNewLineLengths=function(f,g,m){const v=[],S=f.map(((b,x)=>d(f,x,g))).reduce(((b,x)=>b+x));let k=0,C=0,y=0;for(;y<S;){if(S-y<m){v.push(S-y);break}k+=m;const b=d(f,C,g);k>b&&(k-=b,C++);const x=f[C].getWidth(k-1)===2;x&&k--;const _=x?m-1:m;v.push(_),y+=_}return v},c.getWrappedLineTrimmedLength=d},5295:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const f=d(8460),g=d(844),m=d(9092);class v extends g.Disposable{constructor(k,C){super(),this._optionsService=k,this._bufferService=C,this._onBufferActivate=this.register(new f.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)}}c.BufferSet=v},511:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const f=d(482),g=d(643),m=d(3734);class v 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 v;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,f.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 y=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-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()]}}c.CellData=v},643:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const f=d(8460),g=d(844);class m{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.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(S){return this._disposables.push(S),S}}c.Marker=m,m._nextId=1},7116:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(h,c)=>{var d,f,g;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.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||(c.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=""})(f||(c.C1=f={})),(function(m){m.ST=`${d.ESC}\\`})(g||(c.C1_ESCAPED=g={}))},7399:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const f=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:["'",'"']};c.evaluateKeyboardEvent=function(m,v,S,k){const C={type:0,cancel:!1,key:void 0},y=(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=v?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=v?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,m.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(S?"b":"[1;5D"))):C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(S?"f":"[1;5C"))):C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"A",S||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=v?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"B",S||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=v?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=y?f.C0.ESC+"[3;"+(y+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=y?f.C0.ESC+"[1;"+(y+1)+"H":v?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=y?f.C0.ESC+"[1;"+(y+1)+"F":v?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=f.C0.ESC+"[5;"+(y+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=f.C0.ESC+"[6;"+(y+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=y?f.C0.ESC+"[1;"+(y+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=y?f.C0.ESC+"[1;"+(y+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=y?f.C0.ESC+"[1;"+(y+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=y?f.C0.ESC+"[1;"+(y+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=y?f.C0.ESC+"[15;"+(y+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=y?f.C0.ESC+"[17;"+(y+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=y?f.C0.ESC+"[18;"+(y+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=y?f.C0.ESC+"[19;"+(y+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=y?f.C0.ESC+"[20;"+(y+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=y?f.C0.ESC+"[21;"+(y+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=y?f.C0.ESC+"[23;"+(y+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=y?f.C0.ESC+"[24;"+(y+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(S&&!k||!m.altKey||m.metaKey)!S||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=f.C0.US),m.key==="@"&&(C.key=f.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=f.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const _=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(_);m.shiftKey&&(j=j.toUpperCase()),C.key=f.C0.ESC+j}else if(m.keyCode===32)C.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let _=m.code.slice(3,4);m.shiftKey||(_=_.toLowerCase()),C.key=f.C0.ESC+_,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=f.C0.DEL:m.keyCode===219?C.key=f.C0.ESC:m.keyCode===220?C.key=f.C0.FS:m.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},c.utf32ToString=function(d,f=0,g=d.length){let m="";for(let v=f;v<g;++v){let S=d[v];S>65535?(S-=65536,m+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):m+=String.fromCharCode(S)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const g=d.length;if(!g)return 0;let m=0,v=0;if(this._interim){const S=d.charCodeAt(v++);56320<=S&&S<=57343?f[m++]=1024*(this._interim-55296)+S-56320+65536:(f[m++]=this._interim,f[m++]=S),this._interim=0}for(let S=v;S<g;++S){const k=d.charCodeAt(S);if(55296<=k&&k<=56319){if(++S>=g)return this._interim=k,m;const C=d.charCodeAt(S);56320<=C&&C<=57343?f[m++]=1024*(k-55296)+C-56320+65536:(f[m++]=k,f[m++]=C)}else k!==65279&&(f[m++]=k)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const g=d.length;if(!g)return 0;let m,v,S,k,C=0,y=0,b=0;if(this.interim[0]){let j=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)T<<=6,T|=N;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,P=A-D;for(;b<P;){if(b>=g)return 0;if(N=d[b++],(192&N)!=128){b--,j=!0;break}this.interim[D++]=N,T<<=6,T|=63&N}j||(A===2?T<128?b--:f[C++]=T:A===3?T<2048||T>=55296&&T<=57343||T===65279||(f[C++]=T):T<65536||T>1114111||(f[C++]=T)),this.interim.fill(0)}const x=g-4;let _=b;for(;_<g;){for(;!(!(_<x)||128&(m=d[_])||128&(v=d[_+1])||128&(S=d[_+2])||128&(k=d[_+3]));)f[C++]=m,f[C++]=v,f[C++]=S,f[C++]=k,_+=4;if(m=d[_++],m<128)f[C++]=m;else if((224&m)==192){if(_>=g)return this.interim[0]=m,C;if(v=d[_++],(192&v)!=128){_--;continue}if(y=(31&m)<<6|63&v,y<128){_--;continue}f[C++]=y}else if((240&m)==224){if(_>=g)return this.interim[0]=m,C;if(v=d[_++],(192&v)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,C;if(S=d[_++],(192&S)!=128){_--;continue}if(y=(15&m)<<12|(63&v)<<6|63&S,y<2048||y>=55296&&y<=57343||y===65279)continue;f[C++]=y}else if((248&m)==240){if(_>=g)return this.interim[0]=m,C;if(v=d[_++],(192&v)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,C;if(S=d[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=v,this.interim[2]=S,C;if(k=d[_++],(192&k)!=128){_--;continue}if(y=(7&m)<<18|(63&v)<<12|(63&S)<<6|63&k,y<65536||y>1114111)continue;f[C++]=y}}return C}}},225:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const f=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 v;c.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let S=0;S<g.length;++S)v.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?v[S]:(function(k,C){let y,b=0,x=C.length-1;if(k<C[0][0]||k>C[x][1])return!1;for(;x>=b;)if(y=b+x>>1,k>C[y][1])b=y+1;else{if(!(k<C[y][0]))return!0;x=y-1}return!1})(S,m)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,k){let C=this.wcwidth(S),y=C===0&&k!==0;if(y){const b=f.UnicodeService.extractWidth(k);b===0?y=!1:b>C&&(C=b)}return f.UnicodeService.createPropertyValue(0,C,y)}}},5981:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const f=d(8460),g=d(844);class m extends g.Disposable{constructor(S){super(),this._action=S,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,k){if(k!==void 0&&this._syncCalls>k)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,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+=S.length,this._writeBuffer.push(S),this._callbacks.push(k),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(k)}_innerWrite(S=0,k=!0){const C=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],b=this._action(y,k);if(b){const _=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(_)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=y.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()}}c.WriteBuffer=m},5941:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.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})$/,f=/^[\da-f]+$/;function g(m,v){const S=m.toString(16),k=S.length<2?"0"+S:S;switch(v){case 4:return S[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}c.parseColor=function(m){if(!m)return;let v=m.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const S=d.exec(v);if(S){const k=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/k*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/k*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/k*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),f.exec(v)&&[3,6,9,12].includes(v.length))){const S=v.length/3,k=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(v.slice(S*C,S*C+S),16);k[C]=S===1?y<<4:S===2?y:S===3?y>>4:y>>8}return k}},c.toRgbString=function(m,v=16){const[S,k,C]=m;return`rgb:${g(S,v)}/${g(k,v)}/${g(C,v)}`}},5770:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const f=d(482),g=d(8742),m=d(5770),v=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(k,C){this._handlers[k]===void 0&&(this._handlers[k]=[]);const y=this._handlers[k];return y.push(C),{dispose:()=>{const b=y.indexOf(C);b!==-1&&y.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=v,this._ident=0}hook(k,C){if(this.reset(),this._ident=k,this._active=this._handlers[k]||v,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(k,C,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(k,C,y);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(k,C,y))}unhook(k,C=!0){if(this._active.length){let y=!1,b=this._active.length-1,x=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&y===!1){for(;b>=0&&(y=this._active[b].unhook(k),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",k);this._active=v,this._ident=0}};const S=new g.Params;S.addParam(0),c.DcsHandler=class{constructor(k){this._handler=k,this._data="",this._params=S,this._hitLimit=!1}hook(k){this._params=k.length>1||k.params[0]?k.clone():S,this._data="",this._hitLimit=!1}put(k,C,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(k,C,y),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((y=>(this._params=S,this._data="",this._hitLimit=!1,y)));return this._params=S,this._data="",this._hitLimit=!1,C}}},2015:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const f=d(844),g=d(8742),m=d(6242),v=d(6351);class S{constructor(b){this.table=new Uint8Array(b)}setDefault(b,x){this.table.fill(b<<4|x)}add(b,x,_,j){this.table[x<<8|b]=_<<4|j}addMany(b,x,_,j){for(let T=0;T<b.length;T++)this.table[x<<8|b[T]]=_<<4|j}}c.TransitionTable=S;const k=160;c.VT500_TRANSITION_TABLE=(function(){const y=new S(4095),b=Array.apply(null,Array(256)).map(((D,A)=>A)),x=(D,A)=>b.slice(D,A),_=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const T=x(0,14);let N;for(N in y.setDefault(1,0),y.addMany(_,0,2,0),T)y.addMany([24,26,153,154],N,3,0),y.addMany(x(128,144),N,3,0),y.addMany(x(144,152),N,3,0),y.add(156,N,0,0),y.add(27,N,11,1),y.add(157,N,4,8),y.addMany([152,158,159],N,0,7),y.add(155,N,11,3),y.add(144,N,11,9);return y.addMany(j,0,3,0),y.addMany(j,1,3,1),y.add(127,1,0,1),y.addMany(j,8,0,8),y.addMany(j,3,3,3),y.add(127,3,0,3),y.addMany(j,4,3,4),y.add(127,4,0,4),y.addMany(j,6,3,6),y.addMany(j,5,3,5),y.add(127,5,0,5),y.addMany(j,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(_,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(x(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(_,7,0,7),y.addMany(j,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(x(64,127),3,7,0),y.addMany(x(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(x(48,60),4,8,4),y.addMany(x(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(x(32,64),6,0,6),y.add(127,6,0,6),y.addMany(x(64,127),6,0,0),y.addMany(x(32,48),3,9,5),y.addMany(x(32,48),5,9,5),y.addMany(x(48,64),5,0,6),y.addMany(x(64,127),5,7,0),y.addMany(x(32,48),4,9,5),y.addMany(x(32,48),1,9,2),y.addMany(x(32,48),2,9,2),y.addMany(x(48,127),2,10,0),y.addMany(x(48,80),1,10,0),y.addMany(x(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(x(96,127),1,10,0),y.add(80,1,11,9),y.addMany(j,9,0,9),y.add(127,9,0,9),y.addMany(x(28,32),9,0,9),y.addMany(x(32,48),9,9,12),y.addMany(x(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(j,11,0,11),y.addMany(x(32,128),11,0,11),y.addMany(x(28,32),11,0,11),y.addMany(j,10,0,10),y.add(127,10,0,10),y.addMany(x(28,32),10,0,10),y.addMany(x(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(x(32,48),10,9,12),y.addMany(j,12,0,12),y.add(127,12,0,12),y.addMany(x(28,32),12,0,12),y.addMany(x(32,48),12,9,12),y.addMany(x(48,64),12,0,11),y.addMany(x(64,127),12,12,13),y.addMany(x(64,127),10,12,13),y.addMany(x(64,127),9,12,13),y.addMany(j,13,13,13),y.addMany(_,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(k,0,2,0),y.add(k,8,5,8),y.add(k,6,0,6),y.add(k,11,0,11),y.add(k,13,13,13),y})();class C extends f.Disposable{constructor(b=c.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,_,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,_)=>{},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,f.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 v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,x=[64,126]){let _=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=b.prefix.charCodeAt(0),_&&60>_||_>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 T=0;T<b.intermediates.length;++T){const N=b.intermediates.charCodeAt(T);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=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 _<<=8,_|=j,_}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 _=this._identifier(b,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const j=this._escHandlers[_];return j.push(x),{dispose:()=>{const T=j.indexOf(x);T!==-1&&j.splice(T,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 _=this._identifier(b);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const j=this._csiHandlers[_];return j.push(x),{dispose:()=>{const T=j.indexOf(x);T!==-1&&j.splice(T,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,_,j,T){this._parseStack.state=b,this._parseStack.handlers=x,this._parseStack.handlerPos=_,this._parseStack.transition=j,this._parseStack.chunkPos=T}parse(b,x,_){let j,T=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(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let P=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&P>-1){for(;P>=0&&(j=A[P](this._params),j!==!0);P--)if(j instanceof Promise)return this._parseStack.handlerPos=P,j}this._parseStack.handlers=[];break;case 4:if(_===!1&&P>-1){for(;P>=0&&(j=A[P](),j!==!0);P--)if(j instanceof Promise)return this._parseStack.handlerPos=P,j}this._parseStack.handlers=[];break;case 6:if(T=b[this._parseStack.chunkPos],j=this._dcsParser.unhook(T!==24&&T!==26,_),j)return j;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=b[this._parseStack.chunkPos],j=this._oscParser.end(T!==24&&T!==26,_),j)return j;T===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 A=D;A<x;++A){switch(T=b[A],N=this._transitions.table[this.currentState<<8|(T<160?T:k)],N>>4){case 2:for(let W=A+1;;++W){if(W>=x||(T=b[W])<32||T>126&&T<k){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(T=b[W])<32||T>126&&T<k){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(T=b[W])<32||T>126&&T<k){this._printHandler(b,A,W),A=W-1;break}if(++W>=x||(T=b[W])<32||T>126&&T<k){this._printHandler(b,A,W),A=W-1;break}}break;case 3:this._executeHandlers[T]?this._executeHandlers[T]():this._executeHandlerFb(T),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:T,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const P=this._csiHandlers[this._collect<<8|T];let O=P?P.length-1:-1;for(;O>=0&&(j=P[O](this._params),j!==!0);O--)if(j instanceof Promise)return this._preserveStack(3,P,O,N,A),j;O<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++A<x&&(T=b[A])>47&&T<60);A--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const H=this._escHandlers[this._collect<<8|T];let q=H?H.length-1:-1;for(;q>=0&&(j=H[q](),j!==!0);q--)if(j instanceof Promise)return this._preserveStack(4,H,q,N,A),j;q<0&&this._escHandlerFb(this._collect<<8|T),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|T,this._params);break;case 13:for(let W=A+1;;++W)if(W>=x||(T=b[W])===24||T===26||T===27||T>127&&T<k){this._dcsParser.put(b,A,W),A=W-1;break}break;case 14:if(j=this._dcsParser.unhook(T!==24&&T!==26),j)return this._preserveStack(6,[],0,N,A),j;T===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let W=A+1;;W++)if(W>=x||(T=b[W])<32||T>127&&T<k){this._oscParser.put(b,A,W),A=W-1;break}break;case 6:if(j=this._oscParser.end(T!==24&&T!==26),j)return this._preserveStack(5,[],0,N,A),j;T===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}c.EscapeSequenceParser=C},6242:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const f=d(5770),g=d(482),m=[];c.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(v,S){this._handlers[v]===void 0&&(this._handlers[v]=[]);const k=this._handlers[v];return k.push(S),{dispose:()=>{const C=k.indexOf(S);C!==-1&&k.splice(C,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,S,k){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(v,S,k);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,S,k))}start(){this.reset(),this._state=1}put(v,S,k){if(this._state!==3){if(this._state===1)for(;S<k;){const C=v[S++];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-S>0&&this._put(v,S,k)}}end(v,S=!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,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,k=S,y=this._stack.fallThrough,this._stack.paused=!1),!y&&k===!1){for(;C>=0&&(k=this._active[C].end(v),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",v);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,S,k){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,S,k),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let S=!1;if(this._hitLimit)S=!1;else if(v&&(S=this._handler(this._data),S instanceof Promise))return S.then((k=>(this._data="",this._hitLimit=!1,k)));return this._data="",this._hitLimit=!1,S}}},8742:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const d=2147483647;class f{static fromArray(m){const v=new f;if(!m.length)return v;for(let S=Array.isArray(m[0])?1:0;S<m.length;++S){const k=m[S];if(Array.isArray(k))for(let C=0;C<k.length;++C)v.addSubParam(k[C]);else v.addParam(k)}return v}constructor(m=32,v=32){if(this.maxLength=m,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(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 v=0;v<this.length;++v){m.push(this.params[v]);const S=this._subParamsIdx[v]>>8,k=255&this._subParamsIdx[v];k-S>0&&m.push(Array.prototype.slice.call(this._subParams,S,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 v=this._subParamsIdx[m]>>8,S=255&this._subParamsIdx[m];return S-v>0?this._subParams.subarray(v,S):null}getSubParamsAll(){const m={};for(let v=0;v<this.length;++v){const S=this._subParamsIdx[v]>>8,k=255&this._subParamsIdx[v];k-S>0&&(m[v]=this._subParams.slice(S,k))}return m}addDigit(m){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,k=S[v-1];S[v-1]=~k?Math.min(10*k+m,d):m}}c.Params=f},5741:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){f=g;break}if(f===-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(f,1)}}},8771:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const f=d(3785),g=d(511);c.BufferApiView=class{constructor(m,v){this._buffer=m,this.type=v}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 v=this._buffer.lines.get(m);if(v)return new f.BufferLineApiView(v)}getNullCell(){return new g.CellData}}},3785:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const f=d(511);c.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 f.CellData)}translateToString(g,m,v){return this._line.translateToString(g,m,v)}}},8285:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const f=d(8771),g=d(8460),m=d(844);class v extends m.Disposable{constructor(k){super(),this._core=k,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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)}}c.BufferNamespaceApi=v},7975:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(g=>f(g.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((g,m)=>f(g,m.toArray())))}addDcsHandler(d,f){return this.registerDcsHandler(d,f)}registerEscHandler(d,f){return this._core.registerEscHandler(d,f)}addEscHandler(d,f){return this.registerEscHandler(d,f)}registerOscHandler(d,f){return this._core.registerOscHandler(d,f)}addOscHandler(d,f){return this.registerOscHandler(d,f)}}},7090:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.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(h,c,d){var f=this&&this.__decorate||function(y,b,x,_){var j,T=arguments.length,N=T<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,b,x,_);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(b,x,N):j(b,x))||N);return T>3&&N&&Object.defineProperty(b,x,N),N},g=this&&this.__param||function(y,b){return function(x,_){b(x,_,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),v=d(844),S=d(5295),k=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(y){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(y.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(y,this))}resize(y,b){this.cols=y,this.rows=b,this.buffers.resize(y,b),this._onResize.fire({cols:y,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,b=!1){const x=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===y.fg&&_.getBg(0)===y.bg||(_=x.getBlankLine(y,b),this._cachedBlankLine=_),_.isWrapped=b;const j=x.ybase+x.scrollTop,T=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;T===x.lines.length-1?N?x.lines.recycle().copyFrom(_):x.lines.push(_.clone()):x.lines.splice(T+1,0,_.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=T-j+1;x.lines.shiftElements(j+1,N-1,-1),x.lines.set(T,_.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(y,b,x){const _=this.buffer;if(y<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else y+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const j=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+y,_.ybase),0),j!==_.ydisp&&(b||this._onScroll.fire(_.ydisp))}};c.BufferService=C=f([g(0,k.IOptionsService)],C)},7994:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.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,f){this._charsets[d]=f,this.glevel===d&&(this.charset=f)}}},1753:function(h,c,d){var f=this&&this.__decorate||function(_,j,T,N){var D,A=arguments.length,P=A<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(_,j,T,N);else for(var O=_.length-1;O>=0;O--)(D=_[O])&&(P=(A<3?D(P):A>3?D(j,T,P):D(j,T))||P);return A>3&&P&&Object.defineProperty(j,T,P),P},g=this&&this.__param||function(_,j){return function(T,N){j(T,N,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=d(2585),v=d(8460),S=d(844),k={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function C(_,j){let T=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(T|=64,T|=_.action):(T|=3&_.button,4&_.button&&(T|=64),8&_.button&&(T|=128),_.action===32?T|=32:_.action!==0||j||(T|=3)),T}const y=String.fromCharCode,b={DEFAULT:_=>{const j=[C(_,!1)+32,_.col+32,_.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${y(j[0])}${y(j[1])}${y(j[2])}`},SGR:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.col};${_.row}${j}`},SGR_PIXELS:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.x};${_.y}${j}`}};let x=c.CoreMouseService=class extends S.Disposable{constructor(_,j){super(),this._bufferService=_,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(k))this.addProtocol(T,k[T]);for(const T of Object.keys(b))this.addEncoding(T,b[T]);this.reset()}addProtocol(_,j){this._protocols[_]=j}addEncoding(_,j){this._encodings[_]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const j=this._encodings[this._activeEncoding](_);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,j,T){if(T){if(_.x!==j.x||_.y!==j.y)return!1}else if(_.col!==j.col||_.row!==j.row)return!1;return _.button===j.button&&_.action===j.action&&_.ctrl===j.ctrl&&_.alt===j.alt&&_.shift===j.shift}};c.CoreMouseService=x=f([g(0,m.IBufferService),g(1,m.ICoreService)],x)},6975:function(h,c,d){var f=this&&this.__decorate||function(x,_,j,T){var N,D=arguments.length,A=D<3?_:T===null?T=Object.getOwnPropertyDescriptor(_,j):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,_,j,T);else for(var P=x.length-1;P>=0;P--)(N=x[P])&&(A=(D<3?N(A):D>3?N(_,j,A):N(_,j))||A);return D>3&&A&&Object.defineProperty(_,j,A),A},g=this&&this.__param||function(x,_){return function(j,T){_(j,T,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),v=d(8460),S=d(844),k=d(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends S.Disposable{constructor(x,_,j){super(),this._bufferService=x,this._logService=_,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(y)}triggerDataEvent(x,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(x))}};c.CoreService=b=f([g(0,k.IBufferService),g(1,k.ILogService),g(2,k.IOptionsService)],b)},9074:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const f=d(8055),g=d(8460),m=d(844),v=d(6106);let S=0,k=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.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 _=new y(x);if(_){const j=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),j.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,_,j){let T=0,N=0;for(const D of this._decorations.getKeyIterator(_))T=D.options.x??0,N=T+(D.options.width??1),x>=T&&x<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(x,_,j,T){this._decorations.forEachByKey(_,(N=>{S=N.options.x??0,k=S+(N.options.width??1),x>=S&&x<k&&(!j||(N.options.layer??"bottom")===j)&&T(N)}))}}c.DecorationService=C;class y extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.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:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const f=d(2585),g=d(8343);class m{constructor(...S){this._entries=new Map;for(const[k,C]of S)this.set(k,C)}set(S,k){const C=this._entries.get(S);return this._entries.set(S,k),C}forEach(S){for(const[k,C]of this._entries.entries())S(k,C)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(v,S){this._services.set(v,S)}getService(v){return this._services.get(v)}createInstance(v,...S){const k=(0,g.getServiceDependencies)(v).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] ${v.name} depends on UNKNOWN service ${b.id}.`);C.push(x)}const y=k.length>0?k[0].index:S.length;if(S.length!==y)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${y+1} conflicts with ${S.length} static arguments`);return new v(...S,...C)}}},7866:function(h,c,d){var f=this&&this.__decorate||function(y,b,x,_){var j,T=arguments.length,N=T<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(y,b,x,_);else for(var D=y.length-1;D>=0;D--)(j=y[D])&&(N=(T<3?j(N):T>3?j(b,x,N):j(b,x))||N);return T>3&&N&&Object.defineProperty(b,x,N),N},g=this&&this.__param||function(y,b){return function(x,_){b(x,_,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),v=d(2585),S={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let k,C=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),k=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let b=0;b<y.length;b++)typeof y[b]=="function"&&(y[b]=y[b]())}_log(y,b,x){this._evalLazyOptionalParams(x),y.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...x)}trace(y,...b){var x;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,y,b)}debug(y,...b){var x;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,y,b)}info(y,...b){var x;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,y,b)}warn(y,...b){var x;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,y,b)}error(y,...b){var x;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,y,b)}};c.LogService=C=f([g(0,v.IOptionsService)],C),c.setTraceLogger=function(y){k=y},c.traceCall=function(y,b,x){if(typeof x.value!="function")throw new Error("not supported");const _=x.value;x.value=function(...j){if(k.logLevel!==v.LogLevelEnum.TRACE)return _.apply(this,j);k.trace(`GlyphRenderer#${_.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const T=_.apply(this,j);return k.trace(`GlyphRenderer#${_.name} return`,T),T}}},7302:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const f=d(8460),g=d(844),m=d(6114);c.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 v=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...c.DEFAULT_OPTIONS};for(const b in C)if(b in y)try{const x=C[b];y[b]=this._sanitizeAndValidateOption(b,x)}catch(x){console.error(x)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((b=>{b===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((b=>{C.indexOf(b)!==-1&&y()}))}_setupOptions(){const C=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},y=(b,x)=>{if(!(b in c.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:y.bind(this,b)};Object.defineProperty(this.options,b,x)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=c.DEFAULT_OPTIONS[C]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=v.includes(y)?y:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}c.OptionsService=S},2660:function(h,c,d){var f=this&&this.__decorate||function(S,k,C,y){var b,x=arguments.length,_=x<3?k:y===null?y=Object.getOwnPropertyDescriptor(k,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(S,k,C,y);else for(var j=S.length-1;j>=0;j--)(b=S[j])&&(_=(x<3?b(_):x>3?b(k,C,_):b(k,C))||_);return x>3&&_&&Object.defineProperty(k,C,_),_},g=this&&this.__param||function(S,k){return function(C,y){k(C,y,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let v=c.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const k=this._bufferService.buffer;if(S.id===void 0){const j=k.addMarker(k.ybase+k.y),T={data:S,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(T,j))),this._dataByLinkId.set(T.id,T),T.id}const C=S,y=this._getEntryIdKey(C),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,k.ybase+k.y),b.id;const x=k.addMarker(k.ybase+k.y),_={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(_,x))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(S,k){const C=this._dataByLinkId.get(S);if(C&&C.lines.every((y=>y.line!==k))){const y=this._bufferService.buffer.addMarker(k);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(S){var k;return(k=this._dataByLinkId.get(S))==null?void 0:k.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,k){const C=S.lines.indexOf(k);C!==-1&&(S.lines.splice(C,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};c.OscLinkService=v=f([g(0,m.IBufferService)],v)},8343:(h,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const d="di$target",f="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(g){return g[f]||[]},c.createDecorator=function(g){if(c.serviceRegistry.has(g))return c.serviceRegistry.get(g);const m=function(v,S,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,b){y[d]===y?y[f].push({id:C,index:b}):(y[f]=[{id:C,index:b}],y[d]=y)})(m,v,k)};return m.toString=()=>g,c.serviceRegistry.set(g,m),m}},2585:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const f=d(8343);var g;c.IBufferService=(0,f.createDecorator)("BufferService"),c.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),c.ICoreService=(0,f.createDecorator)("CoreService"),c.ICharsetService=(0,f.createDecorator)("CharsetService"),c.IInstantiationService=(0,f.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||(c.LogLevelEnum=g={})),c.ILogService=(0,f.createDecorator)("LogService"),c.IOptionsService=(0,f.createDecorator)("OptionsService"),c.IOscLinkService=(0,f.createDecorator)("OscLinkService"),c.IUnicodeService=(0,f.createDecorator)("UnicodeService"),c.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(h,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const f=d(8460),g=d(225);class m{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,k,C=!1){return(16777215&S)<<3|(3&k)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const S=new g.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let k=0,C=0;const y=S.length;for(let b=0;b<y;++b){let x=S.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=y)return k+this.wcwidth(x);const T=S.charCodeAt(b);56320<=T&&T<=57343?x=1024*(x-55296)+T-56320+65536:k+=this.wcwidth(T)}const _=this.charProperties(x,C);let j=m.extractWidth(_);m.extractShouldJoin(_)&&(j-=m.extractWidth(C)),k+=j,C=_}return k}charProperties(S,k){return this._activeProvider.charProperties(S,k)}}c.UnicodeService=m}},i={};function l(h){var c=i[h];if(c!==void 0)return c.exports;var d=i[h]={exports:{}};return s[h].call(d.exports,d,d.exports,l),d.exports}var u={};return(()=>{var h=u;Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;const c=l(9042),d=l(3236),f=l(844),g=l(5741),m=l(8285),v=l(7975),S=l(7090),k=["cols","rows"];class C extends f.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],_=(j,T)=>{this._checkReadonlyOptions(j),this._core.options[j]=T};for(const j in this._core.options){const T={get:x.bind(this,j),set:_.bind(this,j)};Object.defineProperty(this._publicOptions,j,T)}}_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 v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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,_){this._verifyIntegers(b,x,_),this._core.select(b,x,_)}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 c}_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")}}h.Terminal=C})(),u})()))})(Pd)),Pd.exports}var lC=oC();/**
|
|
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 cC=2,uC=1,dC=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,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),l=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),h={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},c=h.top+h.bottom,d=h.right+h.left,f=i-c,g=l-d-r;return{cols:Math.max(cC,Math.floor(g/e.css.cell.width)),rows:Math.max(uC,Math.floor(f/e.css.cell.height))}}};function hC({sessionId:e,onClose:r,onEscape:s,autoFocus:i}){const l=z.useRef(null),u=z.useRef(e),h=z.useRef(null),c=z.useRef(null),d=Jn(g=>g.writeSession),f=Jn(g=>g.resizeSession);return z.useEffect(()=>{u.current=e},[e]),z.useEffect(()=>{if(!s)return;const g=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),s())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[s]),z.useEffect(()=>{if(!l.current)return;const g=new lC.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new dC;g.loadAddon(m),h.current={term:g,fitAddon:m},l.current.addEventListener("keydown",C=>{C.key==="Escape"&&s&&(C.preventDefault(),C.stopPropagation(),s())}),g.open(l.current);const v=l.current.querySelector(".xterm");v&&(v.style.padding="8px"),m.fit(),i&&setTimeout(()=>{g.focus()},150);const S=new ResizeObserver(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{requestAnimationFrame(()=>{var y;m.fit&&m.fit();const C=(y=h.current)==null?void 0:y.term;C&&C.cols>0&&C.rows>0&&f(u.current,C.cols,C.rows)})},100)});S.observe(l.current),g.onData(C=>{if(C==="\x1B"&&s){s();return}d(u.current,C)}),g.onKey(C=>{C.key==="\x1B"&&s&&(C.domEvent.stopPropagation(),s())});const k=Wt.subscribe(C=>{const y=C.payload;if(C.type==="terminal.output"&&(y==null?void 0:y.sessionId)===u.current){const b=y==null?void 0:y.data;b&&g.write(b)}});return()=>{k(),S.disconnect(),c.current&&clearTimeout(c.current),g.dispose(),h.current=null}},[e,d,f]),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(qw,{})})]}),o.jsx("div",{ref:l,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{g.key==="Escape"&&s&&(g.preventDefault(),g.stopPropagation(),s())}})]})}const iy="openfox-chat-textarea";function ay(){const e=document.getElementById(iy);e&&e.focus()}function fC(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 pC({isOpen:e,onClose:r}){const s=Jn(k=>k.createSession),i=Jn(k=>k.killSession),l=Jn(k=>k.sessions),u=Jn(k=>k.setWorkdir),h=Jn(k=>k.fetchSessions),c=Ot(k=>k.currentProject),[d,f]=z.useState(!0),g=z.useRef(null),m=z.useRef(!1),v=z.useRef(!1),S=z.useCallback(()=>{r()},[r]);return z.useEffect(()=>{c!=null&&c.workdir&&u(c.workdir)},[c==null?void 0:c.workdir,u]),z.useEffect(()=>{e?(f(!0),h(c==null?void 0:c.id).finally(()=>f(!1))):ay()},[e,h,c==null?void 0:c.id]),z.useEffect(()=>{e&&l.length===0&&!d&&!v.current&&(v.current=!0,s(void 0,c==null?void 0:c.id))},[e,l.length,d,s,c==null?void 0:c.id]),z.useEffect(()=>{e?(m.current=!0,setTimeout(()=>{var k;(k=g.current)==null||k.focus(),setTimeout(()=>{m.current=!1},200)},100)):v.current=!1},[e]),z.useEffect(()=>{if(!e)return;const k=C=>{m.current||C.key==="Escape"&&(C.preventDefault(),r())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[e,r]),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:S}),o.jsxs("div",{ref:g,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:k=>k.stopPropagation(),onKeyDown:k=>{k.key==="Escape"&&(k.preventDefault(),S())},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(void 0,c==null?void 0:c.id),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx(Mw,{})}),o.jsx("button",{onClick:r,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx(Ph,{})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:d?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):l.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(void 0,c==null?void 0:c.id),className:"px-4 py-2 bg-accent-primary/25 text-text-primary rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${fC(l.length)} gap-2 h-full auto-rows-fr`,children:l.map(k=>o.jsx(hC,{sessionId:k.id,onClose:()=>i(k.id),onEscape:S,autoFocus:l.length===1},k.id))})})]})]}):null}function oo({items:e,trigger:r,minWidth:s="120px",isOpen:i,onOpenChange:l}){const[u,h]=z.useState(!1),c=i!==void 0,d=c?i:u,f=O=>{if(c){const H=typeof O=="function"?O(u):O;l==null||l(H)}else h(O)},[g,m]=z.useState(null),v=z.useRef(null),S=z.useRef(null),[k,C]=z.useState(0),y=z.useRef(0),b=z.useRef(e),x=z.useCallback(()=>{if(!v.current)return;const O=v.current.getBoundingClientRect(),H=200,W=window.innerHeight-O.bottom<H;m({top:W?O.top-H-4:O.bottom+4,left:O.left,alignToTop:W})},[]);z.useEffect(()=>{b.current=e},[e]),z.useEffect(()=>{function O(H){if(S.current){const q=H.target;S.current.contains(q)||f(!1)}}return d&&document.addEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}},[d]),z.useEffect(()=>{d&&x()},[d,x]),z.useEffect(()=>{if(!d)return;setTimeout(()=>{var H;(H=S.current)==null||H.focus()},0);function O(H){const q=b.current,W=q.filter(B=>!_(B)),G=j(y.current,q);switch(H.key){case"ArrowDown":if(H.preventDefault(),H.stopPropagation(),G<W.length-1){const B=T(y.current+1,q);y.current=B,C(B)}break;case"ArrowUp":if(H.preventDefault(),H.stopPropagation(),G>0){const B=N(y.current-1,q);y.current=B,C(B)}break;case"Enter":H.preventDefault(),H.stopPropagation(),D(y.current,q);break;case"Escape":H.preventDefault(),H.stopPropagation(),f(!1);break}}return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[d,e]);function _(O){var W;const H=O.label;return H?String(((W=H.props)==null?void 0:W.className)??"").includes("cursor-default"):!1}function j(O,H){let q=0;for(let W=0;W<O;W++){const G=H[W];G&&!_(G)&&q++}return q}function T(O,H){for(let q=O;q<H.length;q++){const W=H[q];if(W&&!_(W))return q}return O}function N(O,H){for(let q=O;q>=0;q--){const W=H[q];if(W&&!_(W))return q}return O}function D(O,H){var W;const q=H[O];!q||_(q)||((W=q.onClick)==null||W.call(q),q.href&&(window.history.pushState(null,"",q.href),window.dispatchEvent(new PopStateEvent("popstate"))),f(!1))}z.useEffect(()=>{d&&(C(e.findIndex(O=>!_(O))),y.current=e.findIndex(O=>!_(O)))},[d,e]);const A=O=>{O.stopPropagation(),d||x(),f(!d)},P=g&&o.jsx("div",{ref:S,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${g.alignToTop?"mb-1":"mt-1"}`,style:{top:g.top,left:g.left,minWidth:s},tabIndex:-1,children:e.map((O,H)=>{const W=!_(O)&&H===k,G=o.jsxs(o.Fragment,{children:[O.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:O.icon}),O.label]});return O.href?o.jsx(Mn,{href:O.href,onClick:B=>{var F;(F=O.onClick)==null||F.call(O,B),f(!1)},onAuxClick:()=>f(!1),className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${O.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${H!==e.length-1?"border-b border-border":""}`,children:G},H):o.jsx("button",{onClick:B=>{var F;(F=O.onClick)==null||F.call(O,B),O.closeOnClick!==!1&&f(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${O.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${H!==e.length-1?"border-b border-border":""}`,children:G},H)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:v,onClick:A,children:r})}),d&&Fi.createPortal(P,document.body)]})}function oy(e){const r=new Date(e),i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),h=String(r.getDate()).padStart(2,"0");return`${i} ${l}/${u}/${h}`}function rc(e){const r=new Date(e),s=String(r.getHours()).padStart(2,"0"),i=String(r.getMinutes()).padStart(2,"0");return`${s}:${i}`}function mC(e){const r=new Date(e),s=new Date,i=new Date(s.getFullYear(),s.getMonth(),s.getDate()),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((i.getTime()-l.getTime())/(1e3*60*60*24)),h=rc(e);if(u===0)return`today ${h}`;if(u===1)return`yesterday ${h}`;if(u<7)return`${u} days ago ${h}`;{const c=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${c}/${d}/${f} ${h}`}}function ly(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 gC(e){const{year:r,month:s,day:i}=ly(e);return`${r}-${s}-${i}`}function cy(e){const r=new Map;for(const l of e){const u=gC(l.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(l)}for(const[l,u]of r)u.sort((h,c)=>{const d=new Date(h.updatedAt).getTime();return new Date(c.updatedAt).getTime()-d});const s=Array.from(r.keys()).sort((l,u)=>u.localeCompare(l)),i=new Map;for(const l of s)i.set(l,r.get(l));return i}function xC({items:e,trigger:r,isActive:s=!1}){const[i,l]=z.useState(!1),u=z.useRef(null);return z.useEffect(()=>{function h(c){u.current&&!u.current.contains(c.target)&&l(!1)}if(i)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>l(!i),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${s?"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(hr,{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",rotate:i?180:0})]}),i&&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((h,c)=>{const d=h.label&&typeof h.label=="object"&&h.label.type===Mn?h.label:null;if(d){const f=d.props.href||"";return o.jsxs(Mn,{href:f,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[h.icon,d.props.children]},c)}return h.href?o.jsxs("a",{href:h.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[h.icon,h.label]},c):o.jsxs("button",{type:"button",onClick:()=>{var f;(f=h.onClick)==null||f.call(h),l(!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:[h.icon,h.label]},c)})})]})}function bC({projects:e,currentProject:r}){const s=Ot(h=>h.loadProject),i=Ot(h=>h.toggleStar),u=z.useMemo(()=>{const h=e.filter(d=>d.isStarred).sort((d,f)=>d.name.localeCompare(f.name)),c=e.filter(d=>!d.isStarred).sort((d,f)=>d.name.localeCompare(f.name));return[...h,...c]},[e]).map(h=>({label:o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[o.jsx("span",{className:"truncate flex-1",children:h.name}),o.jsx("button",{onClick:c=>{c.stopPropagation(),c.preventDefault(),c.nativeEvent.stopImmediatePropagation(),i(h.id,!h.isStarred)},className:"flex-shrink-0 p-1 hover:bg-bg-tertiary rounded transition-colors",title:h.isStarred?"Unstar project":"Star project",children:h.isStarred?o.jsx(Pw,{className:"w-3.5 h-3.5 text-yellow-500"}):o.jsx(Hw,{className:"w-3.5 h-3.5 text-text-muted hover:text-yellow-500"})})]}),icon:h.id===r.id?o.jsx(Mr,{}):void 0,href:`/p/${h.id}`,closeOnClick:!0,onClick:()=>{s(h.id)}}));return o.jsx(oo,{items:u,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(hr,{})]}),minWidth:"250px"})}function vC({currentProject:e,sessions:r,currentSession:s,projectIdFromUrl:i}){if(!(e!=null&&e.id)||e.id!==i)return null;const l=r.filter(h=>h.projectId===e.id).sort((h,c)=>new Date(c.updatedAt).getTime()-new Date(h.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Mn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx(Bi,{className:"w-3 h-3 text-accent-primary"}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...l.map(h=>({label:o.jsx(Mn,{href:`/p/${e.id}/s/${h.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:h.title??h.id.slice(0,8)})}),icon:h.id===(s==null?void 0:s.id)?o.jsx(Mr,{className:"w-3 h-3"}):void 0})),{label:o.jsxs(Mn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx(Cw,{className:"w-3 h-3"}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(xC,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function yC({sessions:e,currentProject:r,currentSession:s,isOpen:i,onOpenChange:l}){var g;const u=Se(m=>m.loadSession),h=e.filter(m=>m.projectId===r.id).slice(0,15),c=cy(h),d=z.useMemo(()=>{const m=[];m.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Bi,{className:"w-4 h-4 text-accent-primary"}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[v,S]of c){const k=S[0];if(k){m.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:oy(k.updatedAt)}),onClick:()=>{}});for(const C of S)m.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:C.title??C.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:rc(C.updatedAt)})]}),icon:C.id===(s==null?void 0:s.id)?o.jsx(Mr,{}):void 0,href:`/p/${r.id}/s/${C.id}`,onClick:()=>{u(C.id)}})}}return m},[r.id,c,s==null?void 0:s.id]),f=s?((g=s.metadata)==null?void 0:g.title)??s.id.slice(0,8):"No session selected";return o.jsx(oo,{items:d,isOpen:i,onOpenChange:l,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:f,"data-testid":"header-session-dropdown",children:[f,o.jsx(hr,{})]}),minWidth:"280px"})}function _C({onMenuClick:e,onCriteriaToggle:r}){const[s,i]=z.useState(!1),[l,u]=z.useState(!1),[h,c]=z.useState(!!document.fullscreenElement);z.useEffect(()=>{const j=()=>c(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",j),()=>document.removeEventListener("fullscreenchange",j)},[]);const[d]=nr(),f=d.startsWith("/p/"),g=/^\/p\/[^/]+\/s\/[^/]+$/.test(d),m=Se(j=>j.currentSession),v=Se(j=>j.sessions),S=Ot(j=>j.currentProject),k=Ot(j=>j.projects),C=Ct(j=>j.startAutoRefresh),y=Ct(j=>j.stopAutoRefresh),b=Jn(j=>j.setOpen),x=Jn(j=>j.isOpen);z.useEffect(()=>{const j=()=>u(!0);return window.addEventListener("open-session-dropdown",j),()=>window.removeEventListener("open-session-dropdown",j)},[]);const _=z.useRef(0);return z.useEffect(()=>{const j=T=>{if(T.key==="Control"&&!T.shiftKey&&!T.metaKey&&!T.altKey){const N=Date.now();N-_.current<300?(T.preventDefault(),T.stopPropagation(),Jn.getState().toggleOpen(),_.current=0):_.current=N}};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[]),z.useEffect(()=>(C(),()=>y()),[C,y]),o.jsxs("header",{className:"h-8 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&&f&&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(rb,{})}),o.jsx(Mn,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),S&&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(bC,{projects:k,currentProject:S})}),o.jsx("span",{className:"md:hidden",children:o.jsx(vC,{currentProject:S,sessions:v,currentSession:m,projectIdFromUrl:f&&d.split("/")[2]||null},S==null?void 0:S.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(yC,{sessions:v,currentProject:S,currentSession:m,isOpen:l,onOpenChange:u})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g&&o.jsx("button",{onClick:()=>{var j,T,N;document.fullscreenElement?(j=document.exitFullscreen)==null||j.call(document):(N=(T=document.documentElement).requestFullscreen)==null||N.call(T)},className:"max-sm:block hidden p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:h?"Exit fullscreen":"Enter fullscreen",children:h?o.jsx(Nw,{}):o.jsx(Tw,{})}),f&&o.jsx("button",{onClick:()=>b(!x),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${x?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double Ctrl)",children:o.jsx(Uw,{})}),o.jsx("button",{onClick:()=>i(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsx(Bw,{})}),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(Rw,{})}),r&&g&&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(rb,{})})]}),o.jsx(nC,{isOpen:s,onClose:()=>i(!1)}),o.jsx(pC,{isOpen:x,onClose:()=>b(!1)})]})}function SC({onCancel:e,onSave:r,saving:s,saveDisabled:i,cancelLabel:l="Cancel",saveLabel:u=s?"Saving...":"Save"}){return o.jsxs("div",{className:"flex justify-end gap-2 flex-shrink-0",children:[o.jsx(Ze,{variant:"secondary",onClick:e,children:l}),o.jsx(Ze,{variant:"primary",onClick:r,disabled:i??s,children:u})]})}function wC({isOpen:e,onClose:r,project:s}){const i=Ot(_=>_.updateProject),[l,u]=z.useState(s.customInstructions??""),[h,c]=z.useState(s.dangerLevel??""),[d,f]=z.useState(!1),[g,m]=z.useState(!1),[v,S]=z.useState(!1),k=d||g;z.useEffect(()=>{u(s.customInstructions??""),c(s.dangerLevel??""),f(!1),m(!1)},[s]);const C=_=>{u(_.target.value),f(!0)},y=_=>{c(_),m(!0)},b=async()=>{S(!0);const _=h===""?null:h;await i(s.id,{customInstructions:l||null,dangerLevel:_}),S(!1),f(!1),m(!1),r()},x=()=>{u(s.customInstructions??""),c(s.dangerLevel??""),f(!1),m(!1),r()};return o.jsx(kt,{isOpen:e,onClose:x,title:`${s.name} Settings`,size:"lg",footer:o.jsx(SC,{onCancel:x,onSave:b,saving:v,saveDisabled:!k||v}),children:o.jsxs("div",{className:"flex flex-col gap-5 -mt-1",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Default Danger Level"}),o.jsx("p",{className:"text-sm text-text-muted mb-3",children:"Default danger level for new sessions in this project. Existing sessions are not affected."}),o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1 rounded bg-bg-tertiary/50 w-fit",children:[o.jsx("button",{type:"button",onClick:()=>y(""),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${h===""?"bg-bg-tertiary text-text-primary border border-border":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Use global default (Normal)",children:"Default"}),o.jsx("button",{type:"button",onClick:()=>y("normal"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${h==="normal"?"bg-accent-success/20 text-accent-success border border-accent-success/30":"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:()=>y("dangerous"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${h==="dangerous"?"bg-red-500/20 text-red-400 border border-red-500/30":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Path"}),o.jsx("p",{className:"text-sm text-text-muted font-mono",children:s.workdir})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] pb-4",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files."}),o.jsx("textarea",{value:l,onChange:C,placeholder:"Enter project-specific instructions...",className:"w-full h-full px-3 py-2 mb-3 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:v})]}),d&&o.jsx(Vh,{})]})})}const CC={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},kC="M6 18L18 6M6 6l12 12";function lo({onClick:e,className:r="",size:s="md",variant:i="default"}){const l=i==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":i==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":i==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx(nc,{onClick:e,icon:kC,iconSize:CC[s],className:`${l} ${r}`,title:"Close"})}function uy({projectId:e,isOpen:r=!0,onClose:s}){const[,i]=nr(),[l,u]=z.useState(!1),h=Se(T=>T.sessions),c=Se(T=>T.currentSession),d=Se(T=>T.unreadSessionIds),f=Se(T=>T.deleteSession),g=Se(T=>T.deleteAllSessions),m=Se(T=>T.loadMoreSessions),v=Se(T=>T.sessionsHasMore),S=Se(T=>T.sessionsPaginationLoading),k=Ot(T=>T.currentProject),C=z.useRef(null),y=z.useCallback(()=>{v&&!S&&k&&m(k.id)},[v,S,k,m]);z.useEffect(()=>{if(!C.current||!v)return;const T=new IntersectionObserver(N=>{const D=N[0];D&&D.isIntersecting&&y()},{threshold:.1});return T.observe(C.current),()=>T.disconnect()},[v,y]);const b=h.filter(T=>T.projectId===(k==null?void 0:k.id)),x=(T,N)=>{N==null||N.stopPropagation(),confirm("Delete this session?")&&(f(T),(c==null?void 0:c.id)===T&&i(`/p/${e}`))},_=(T,N)=>{N==null||N.stopPropagation();const D=h.find(O=>O.id===T),A=(D==null?void 0:D.title)??T.slice(0,6),P=prompt("Rename session:",A);if(P!==null&&P.trim()!==""){const O=Se.getState().renameSession;O(T,P.trim())}},j=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),i(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&s&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:s}),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-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(Mn,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(oo,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:j,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.jsx(Ih,{})})}),s&&o.jsx(lo,{onClick:s,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(wC,{isOpen:l,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:EC(b,c,d,x,_,e)}),S&&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 EC(e,r,s,i,l,u){const h=cy(e);return Array.from(h).map(([c,d])=>{const f=d[0];return f?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:oy(f.updatedAt)}),d.map(g=>{const m=(r==null?void 0:r.id)===g.id,v=s.includes(g.id),S=g.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${m?"bg-bg-tertiary":""}`,children:o.jsxs(Mn,{href:`/p/${u}/s/${g.id}`,className:`block ${m?"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 ${m?"text-accent-primary":"text-text-primary"}`,children:g.title??g.id.slice(0,6)}),o.jsx(oo,{items:[{label:"Rename session",onClick:k=>l(g.id,k)},{label:"Delete session",onClick:k=>i(g.id,k),danger:!0}],trigger:o.jsx("button",{onClick:k=>k.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsx(Ih,{})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[S?o.jsx(zw,{}):v&&!m?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:rc(g.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[g.messageCount," messages"]})]})]})},g.id)})]},c):null})}const cb=["⠋","⠙","⠹","⠸","⠼","⠴"];function jC(){var c;const e=Ot(d=>d.currentProject),r=Se(d=>d.currentSession),s=Oh(),i=!1,l=z.useRef(0),u=z.useRef(null);z.useEffect(()=>(s?(u.current=window.setInterval(()=>{l.current=(l.current+1)%cb.length,h()},150),h()):(u.current&&(clearInterval(u.current),u.current=null),h()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[s,e,r,i]);const h=()=>{var m;const f=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=s?`${cb[l.current]} `:"";e&&f?document.title=`${g}${e.name} - ${f} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((c=r==null?void 0:r.metadata)!=null&&c.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}function dy(e,r=28){if(e.length<=r)return e;const s=e.split("/").filter(Boolean);if(s.length<=2)return e;const i=s[0],l=s[s.length-1],u=s.slice(1,-1).join("/"),h=r-i.length-l.length-3;if(h<0)return e;const c=u.slice(0,Math.floor(h/2)),d=u.slice(-Math.ceil(h/2));return`/${i}/${c}...${d}/${l}`}function NC({isOpen:e,onClose:r,projectName:s,onConfirm:i}){const l=()=>{i(),r()};return o.jsx(kt,{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:s})," 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(Ze,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(Ze,{variant:"danger",onClick:l,children:"Delete"})]})]})})}const sc=z.forwardRef(({className:e="",...r},s)=>o.jsx("input",{ref:s,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}));sc.displayName="Input";function TC(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 hy({isOpen:e,onClose:r,path:s,onRetry:i}){const[l,u]=z.useState(!1),[h,c]=z.useState(null),[d,f]=z.useState(null);z.useEffect(()=>{e&&g()},[e]);const g=async()=>{try{const j=await(await ke("/api/projects/check-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s})})).json();f({sudoAvailable:j.sudoAvailable,userInGroup:j.userInGroup,groupHasWrite:j.groupHasWrite,groupName:j.groupName||null})}catch{f({sudoAvailable:!1,userInGroup:!1,groupHasWrite:!1,groupName:null})}},m=z.useCallback(async _=>{u(!0),c(null);try{const T=await(await ke("/api/projects/fix-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,action:_})})).json();T.success?(i(),r()):T.sudoAvailable?c("Failed to fix permissions: "+(T.error||"Unknown error")):c(`Passwordless sudo is not available. Please fix permissions manually:
|
|
85
|
-
|
|
86
|
-
`+(_==="group"?`sudo chmod g+w "${s}"`:"sudo usermod -aG <group> $USER"))}catch(j){c("Failed to fix permissions: "+(j instanceof Error?j.message:"Unknown error"))}finally{u(!1)}},[s,i,r]),v=(d==null?void 0:d.userInGroup)??!1,S=(d==null?void 0:d.groupHasWrite)??!1,k=(d==null?void 0:d.sudoAvailable)??!1,C=(d==null?void 0:d.groupName)??"",y=v&&!S,b=!v&&S,x=!v&&!S;return o.jsx(kt,{isOpen:e,onClose:r,title:"Permission Denied",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"text-sm text-text-secondary",children:[o.jsx("p",{children:y?o.jsxs(o.Fragment,{children:["The group ",o.jsx("strong",{children:C})," doesn't have write access:"]}):b?o.jsxs(o.Fragment,{children:["You're not a member of group ",o.jsx("strong",{children:C}),":"]}):o.jsxs(o.Fragment,{children:["You're not a member of group ",o.jsx("strong",{children:C})," and it doesn't have write access:"]})}),o.jsx("p",{className:"mt-2 font-mono text-xs bg-bg-tertiary p-2 rounded break-all",children:s})]}),h?o.jsx("div",{className:"p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error whitespace-pre-wrap",children:h}):d?o.jsxs("div",{className:"flex flex-col gap-2",children:[y&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{type:"button",variant:"primary",onClick:()=>m("group"),disabled:l||!k,className:"w-full",children:l?"Granting access...":"Extend group permissions"}),o.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),o.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',s,'"']})]}),b&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{type:"button",variant:"primary",onClick:()=>m("join_group"),disabled:l||!k,className:"w-full",children:l?"Joining group...":"Join group"}),o.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),o.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",C," $USER"]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{type:"button",variant:"primary",onClick:()=>m("join_group_and_group"),disabled:l||!k,className:"w-full",children:l?"Joining group...":"Join group & grant write permissions"}),o.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),o.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",C," $USER",o.jsx("br",{}),'sudo chmod g+w "',s,'"']})]}),!k&&!h&&o.jsxs("div",{className:"text-xs text-text-secondary",children:[o.jsx("p",{children:"Passwordless sudo is not available. Please fix permissions manually:"}),o.jsxs("code",{className:"block mt-1 p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',s,'"']})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx(Ze,{type:"button",variant:"secondary",onClick:r,disabled:l,children:"Cancel"})})]}):null]})})}function AC({isOpen:e,onClose:r}){const[,s]=nr(),[i,l]=z.useState(""),[u,h]=z.useState(null),[c,d]=z.useState(!1),[f,g]=z.useState(""),[m,v]=z.useState(null),S=z.useRef(null);z.useEffect(()=>{e&&(ke("/api/config").then(j=>j.json()).then(j=>{j.workdir&&g(j.workdir)}),l(""),h(null),d(!1),v(null),setTimeout(()=>{var j;(j=S.current)==null||j.focus()},100))},[e]);const k=z.useCallback(async j=>{j.preventDefault();const T=TC(i);if(!T.valid){h(T.error);return}const N=`${f}/${i}`;await b(N)},[i,s,r,f]),C=z.useCallback(()=>{v(null)},[]),y=z.useCallback(async()=>{const j=`${f}/${i}`;await b(j)},[f,i,s,r,v,h,d]);async function b(j){d(!0),h(null),v(null);try{const T=await ke("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:j})});if(!T.ok){const A=await T.json().catch(()=>({}));if(A.code==="EACCES"){v(j),d(!1);return}throw new Error(A.error||"Failed to create project")}const D=(await T.json()).project;r(),s(`/p/${D.id}`)}catch(T){h(T instanceof Error?T.message:"Failed to create project"),d(!1)}}const x=z.useCallback(()=>{l(""),h(null),r()},[r]),_=i?`${f}/${i}`:"";return o.jsxs(o.Fragment,{children:[o.jsx(kt,{isOpen:e,onClose:x,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:k,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(sc,{ref:S,id:"project-name",value:i,onChange:j=>{l(j.target.value),h(null)},placeholder:"my-project",disabled:c,"data-testid":"create-project-name-input",className:"w-full"}),i&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:_})]}),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(Ze,{type:"button",variant:"secondary",onClick:x,disabled:c,children:"Cancel"}),o.jsx(Ze,{type:"submit",variant:"primary",disabled:c||!i.trim(),"data-testid":"create-project-submit-button",className:"min-w-[100px]",children:c?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Bi,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})}),m&&o.jsx(hy,{isOpen:!!m,onClose:C,path:m,onRetry:y})]})}const DC={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function co({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${DC[e]} ${r}`})}function RC({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(co,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function fy({onSelect:e,onClose:r,initialPath:s}){const[i,l]=z.useState(null),[u,h]=z.useState(!0),[c,d]=z.useState(""),[f,g]=z.useState(-1),m=z.useRef(null),v=z.useRef([]),S=z.useCallback(async x=>{h(!0),d(""),g(-1);try{const _=x?`/api/directories?path=${encodeURIComponent(x)}`:"/api/directories",T=await(await ke(_)).json();l(T)}catch(_){console.error("Failed to load directories:",_)}finally{h(!1)}},[]);z.useEffect(()=>{S(s)},[s,S]);const k=((i==null?void 0:i.current)??"").split("/").filter(Boolean).map((x,_,j)=>({name:x,path:"/"+j.slice(0,_+1).join("/")})),C=(i==null?void 0:i.directories.filter(x=>c===""||x.name.toLowerCase().includes(c.toLowerCase())))??[],y=[...i!=null&&i.parent?[{type:"parent",path:i.parent,name:".."}]:[],...C.map(x=>({type:"dir",path:x.path,name:x.name}))];z.useEffect(()=>{g(c?0:-1)},[c,C.length]),z.useEffect(()=>{var x;f>=0&&v.current[f]&&((x=v.current[f])==null||x.scrollIntoView({block:"nearest"}))},[f]);const b=x=>{var _;if(x.key==="ArrowDown")x.preventDefault(),g(j=>Math.min(j+1,y.length-1));else if(x.key==="ArrowUp")x.preventDefault(),g(j=>Math.max(j-1,0));else if(x.key==="Enter"){if(x.preventDefault(),f>=0&&y[f]){const j=y[f];j.type,S(j.path)}}else x.key==="Escape"&&(d(""),(_=m.current)==null||_.focus())};return o.jsxs(kt,{isOpen:!0,onClose:r,title:"Select Folder",size:"lg",children:[i&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[k.map((x,_)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>S(x.path),className:`px-1 ${_===k.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:x.name})]},x.path)),k.length===0&&o.jsx("button",{onClick:()=>S("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"px-4 mb-3",children:o.jsxs("div",{className:"relative",children:[o.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none flex items-center justify-center",children:o.jsx(zh,{})}),o.jsx(sc,{autoFocus:!0,ref:m,value:c,onChange:x=>d(x.target.value),onKeyDown:b,placeholder:"Filter directories...",className:"w-full pl-9"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(co,{size:"sm"})}):y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:c?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:y.map((x,_)=>o.jsxs("button",{ref:j=>{v.current[_]=j},onClick:()=>S(x.path),onDoubleClick:()=>e(x.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${_===f?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[x.type==="parent"?o.jsx(Sw,{className:"w-5 h-5 text-text-muted"}):o.jsx(Bh,{className:"w-5 h-5"}),o.jsx("span",{className:"flex-1",children:x.name}),_===f&&o.jsx("span",{className:"text-xs text-text-muted",children:"⏎ navigate · dbl-click select"})]},x.path))})}),o.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border mt-4 -mx-4 -mb-4 p-4",children:[(i==null?void 0:i.current)&&o.jsx("button",{onClick:()=>e(i.current),className:"w-full px-4 py-2 bg-accent-primary text-text-primary 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"})]})]})}function LC({isOpen:e,onClose:r}){const[,s]=nr(),[i,l]=z.useState(!1),[u,h]=z.useState(null),[c,d]=z.useState(!1),f=Ot(O=>O.projects),g=Ot(O=>O.createProject),m=Ot(O=>O.listProjects),v=Ot(O=>O.deleteProject),[S,k]=z.useState(null),[C,y]=z.useState(null),[b,x]=z.useState(null);z.useEffect(()=>{ke("/api/config").then(O=>O.json()).then(O=>{O.workdir&&h(O.workdir)})},[]),z.useEffect(()=>{e&&m()},[e,m]);const _=O=>{s(`/p/${O}`),r()},j=(O,H)=>{H.stopPropagation(),k(O)},T=()=>{S&&(v(S.id),k(null))},N=async O=>{const H=O.split("/").filter(Boolean).pop()??"",q=await g(H,O);return m(),y(O),D(q)?(x(q.error.path||O),!1):!0};function D(O){return O!=null&&typeof O=="object"&&"error"in O&&O.error!=null&&typeof O.error=="object"&&"code"in O.error&&O.error.code==="EACCES"}const A=z.useCallback(()=>{x(null)},[]),P=z.useCallback(async()=>{if(x(null),C){const O=C.split("/").filter(Boolean).pop()??"",H=await g(O,C);m(),y(C),D(H)&&x(H.error.path||C)}},[C,g,m,x]);return z.useEffect(()=>{if(C){const O=f.find(H=>H.workdir===C);O&&(s(`/p/${O.id}`),r(),y(null))}},[f,C,s,r]),e?o.jsxs(kt,{isOpen:e,onClose:r,title:"Open Project",size:"xl",footer:o.jsx("div",{className:"flex justify-end gap-2",children:o.jsx(Ze,{variant:"secondary",onClick:r,children:"Close"})}),children:[o.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 -m-4",children:[o.jsxs("div",{className:"w-full sm:w-1/2 border-b sm:border-b-0 sm:border-r border-border flex flex-col max-h-[40vh] sm:max-h-[50vh]",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 shrink-0",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:f.length===0?o.jsxs("div",{className:"p-6 text-center text-text-muted text-sm",children:[o.jsx("p",{className:"mb-2",children:"No recent projects"}),o.jsx("p",{className:"text-xs",children:'Click "Create new project" to add one'})]}):o.jsx("div",{className:"divide-y divide-border",children:f.map(O=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>_(O.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx(Bh,{className:"w-5 h-5 text-accent-primary"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:O.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:dy(O.workdir,32)})]})]}),o.jsx("button",{onClick:H=>j(O,H),className:"text-accent-error/70 hover:text-accent-error p-1",title:"Delete project",children:o.jsx(tc,{className:"w-4 h-4"})})]},O.id))})})]}),o.jsx("div",{className:"w-full sm:w-1/2 flex flex-col items-center justify-center p-6 sm:p-8 text-center",children:o.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-sm",children:[o.jsx(Ze,{variant:"primary",onClick:()=>d(!0),children:"Select existing project"}),o.jsx(Ze,{variant:"secondary",onClick:()=>l(!0),"data-testid":"open-project-create-button",children:"Create new project"})]})})]}),i&&o.jsx(AC,{isOpen:i,onClose:()=>l(!1)}),S&&o.jsx(NC,{isOpen:!0,onClose:()=>k(null),projectName:S.name,onConfirm:T}),c&&o.jsx(fy,{initialPath:u??void 0,onSelect:O=>{N(O).then(H=>{H&&d(!1)})},onClose:()=>d(!1)}),b&&o.jsx(hy,{isOpen:!0,onClose:A,path:b,onRetry:P})]}):null}function OC(){const[e,r]=z.useState(!1),s=Se(m=>m.sessions),i=Ot(m=>m.projects),l=Ot(m=>m.loading),u=Ot(m=>m.listProjects),h=Se(m=>m.listSessions),c=Se(m=>m.connectionStatus);z.useEffect(()=>{c==="connected"&&(u(),h())},[c,u,h]);const d=[...i].sort((m,v)=>{const S=s.filter(b=>b.workdir.startsWith(m.workdir)),k=s.filter(b=>b.workdir.startsWith(v.workdir)),C=S.length>0?new Date(S.reduce((b,x)=>new Date(x.updatedAt)>new Date(b.updatedAt)?x:b).updatedAt).getTime():new Date(m.updatedAt).getTime();return(k.length>0?new Date(k.reduce((b,x)=>new Date(x.updatedAt)>new Date(b.updatedAt)?x:b).updatedAt).getTime():new Date(v.updatedAt).getTime())-C}),f=m=>{const v=i.find(S=>S.id===m);return v?s.filter(S=>S.workdir.startsWith(v.workdir)).sort((S,k)=>new Date(k.updatedAt).getTime()-new Date(S.updatedAt).getTime()).slice(0,5):[]},g=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto bg-primary",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(Ze,{variant:"primary",onClick:g,children:"Open Project"})]}),d.map(m=>{const v=f(m.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(Mn,{href:`/p/${m.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx(Bh,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),o.jsx("span",{className:"text-text-primary font-semibold",children:m.name})]}),o.jsx(Mn,{href:`/p/${m.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:v.length>0?v.map(S=>{const k=i.find(y=>S.workdir.startsWith(y.workdir)),C=k?`/p/${k.id}/s/${S.id}`:"#";return o.jsx(Mn,{href:C,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:S.title??S.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:mC(S.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[S.messageCount," msgs"]})]})]})},S.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},m.id)}),d.length===0&&!l&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."}),l&&o.jsx("div",{className:"flex justify-center py-12",children:o.jsx(co,{})})]}),e&&o.jsx(LC,{isOpen:e,onClose:()=>r(!1)})]})}function MC(){const[,e]=Lh("/p/:projectId/new"),[,r]=nr(),s=e==null?void 0:e.projectId,i=Se(h=>h.createSession),l=Se(h=>h.resetPendingSessionCreate),u=z.useCallback(async()=>{if(!s)return;const h=await i(s);h?(r(`/p/${s}/s/${h.id}`),l()):(r(`/p/${s}`),l())},[s,i,r,l]);return z.useEffect(()=>{u()},[u]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(co,{})})}function IC(){const e=Ot(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(Mn,{href:`/p/${e.id}/new`,"data-testid":"create-new-session-button",className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-text-primary 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 Pa=e=>Math.round(e*10)/10;function fh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function BC(e){return`${e.providerId}::${e.model}`}function zC(e){return`${e.providerName} > ${e.model}`}function ub(e){let r=0,s=0,i=0,l=0,u=0,h=0;const c=[],d=[];let f=0;for(const[v,S]of e.entries()){const k=S.stats,C=fh(k);r+=k.totalTime,s+=k.toolTime,i+=k.prefillTokens,l+=k.generationTokens;const y=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,b=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=y,h+=b,c.push({messageId:S.id,timestamp:S.timestamp,...C,mode:k.mode,responseIndex:v+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 _ of x)f+=1,d.push({messageId:S.id,timestamp:_.timestamp??S.timestamp,providerId:_.providerId,providerName:_.providerName,backend:_.backend,model:_.model,mode:k.mode,responseIndex:v+1,sessionCallIndex:f,callIndex:_.callIndex,promptTokens:_.promptTokens,completionTokens:_.completionTokens,ttft:_.ttft,completionTime:_.completionTime,prefillSpeed:_.prefillSpeed,generationSpeed:_.generationSpeed,totalTime:_.totalTime,..._.temperature!==void 0&&{temperature:_.temperature},..._.topP!==void 0&&{topP:_.topP},..._.topK!==void 0&&{topK:_.topK},..._.maxTokens!==void 0&&{maxTokens:_.maxTokens}})}const g=u>0?Pa(i/u):0,m=h>0?Pa(l/h):0;return{totalTime:Pa(r),aiTime:Pa(r-s),toolTime:Pa(s),prefillTokens:i,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:c,callDataPoints:d}}function PC(e){const r=e.filter(l=>l.stats!==void 0&&l.stats!==null).sort((l,u)=>new Date(l.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const s=new Map;for(const l of r){const u=BC(fh(l.stats)),h=s.get(u)??[];s.set(u,[...h,l])}const i=Array.from(s.entries()).map(([l,u])=>{const h=fh(u[0].stats),c=ub(u);return{...h,key:l,label:zC(h),...c}});return{...ub(r),modelGroups:i}}function HC(e){return z.useMemo(()=>PC(e),[e])}function py(){var l;const e=Se(u=>u.gitStatus),r=Se(u=>u.currentSession),[s,i]=z.useState(!0);return z.useEffect(()=>{r!=null&&r.workdir&&i(!1)},[r==null?void 0:r.workdir]),{branch:(e==null?void 0:e.branch)??null,diff:{files:((l=e==null?void 0:e.diff)==null?void 0:l.files)??[],loading:s,error:null}}}function Ul(e){return e.toLocaleString("en-US").replace(/,/g," ")}function db(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function FC(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),s=Math.round(e%60);return`${r}m${s}s`}const hb=["▁","▂","▃","▄","▅","▆","▇","█"];function UC(e,r,s){if(s===r)return 4;const i=(e-r)/(s-r);return Math.min(7,Math.max(0,Math.round(i*7)))}function $C(e,r){if(e===r){const l=Math.max(Math.abs(e)*.05,1);return{minY:e-l,maxY:r+l}}const s=r-e,i=Math.max(s*.1,.1);return{minY:e-i,maxY:r+i}}function qC(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const s=[...e].sort((m,v)=>m.x-v.x),i=s[0].x,l=s[s.length-1].x,u=Math.min(...s.map(m=>m.y)),h=Math.max(...s.map(m=>m.y)),{minY:c,maxY:d}=$C(u,h),f=Array.from({length:r},()=>" "),g=new Map;for(const m of s){const v=l===i?0:Math.round((m.x-i)/(l-i)*(r-1)),S=g.get(v)??[];g.set(v,[...S,m.y])}for(const[m,v]of g){const S=Math.max(...v);f[m]=hb[UC(S,c,d)]??hb[0]}return{blocks:f.join(""),minX:i,maxX:l,minY:c,maxY:d}}function fb(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function pb({data:e,width:r=60,height:s=78,label:i,xLabel:l,yLabel:u,showAxes:h=!0,formatY:c=fb,formatX:d=fb}){const f=z.useMemo(()=>{const g=qC(e,r),m=Math.max(r*6,240),v=10,S=8,C=[...e].sort((_,j)=>_.x-j.x).map(_=>{const j=g.maxX===g.minX?m/2:v+(_.x-g.minX)/(g.maxX-g.minX)*(m-v*2),T=g.maxY===g.minY?s/2:S+(g.maxY-_.y)/(g.maxY-g.minY)*(s-S*2);return{..._,cx:j,cy:T,leftPercent:j/m*100,topPercent:T/s*100}}),y=C.map((_,j)=>`${j===0?"M":"L"} ${_.cx.toFixed(1)} ${_.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(_=>({value:_,y:g.maxY===g.minY?s/2:S+(g.maxY-_)/(g.maxY-g.minY)*(s-S*2)}));return{...g,chartWidth:m,points:C,path:y,gridLines:x}},[e,s,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[i&&o.jsx("div",{className:"mb-1",children:i}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[i&&o.jsx("div",{className:"text-text-secondary mb-2",children:i}),o.jsxs("div",{className:"flex gap-3",children:[h&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(g=>o.jsx("span",{children:c(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 ${f.chartWidth} ${s}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[f.gridLines.map(g=>o.jsx("line",{x1:"0",x2:f.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),f.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:s-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),f.points.length>1&&o.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.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)} -> ${c(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}`))]})})]}),h&&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(f.minX)}),o.jsx("span",{children:l}),o.jsx("span",{children:d(f.maxX)})]})]}),u&&h&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function WC({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:s="Generation Speed (tok/s) by Response",xLabel:i="response",width:l=60}){const u=e.map(c=>({x:c.x,y:c.ppSpeed})),h=e.map(c=>({x:c.x,y:c.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(pb,{data:u,width:l,label:r,xLabel:i}),o.jsx(pb,{data:h,width:l,label:s,xLabel:i})]})}function VC(e){const r=new Map;for(const s of e.callDataPoints){const i=r.get(s.messageId)??[];r.set(s.messageId,[...i,s])}return e.dataPoints.map(s=>{const i=[...r.get(s.messageId)??[]].sort((l,u)=>l.callIndex-u.callIndex);return{...s,callCount:i.length,calls:i,isExpandable:i.length>1}})}function GC(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 KC(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 YC(e){return e.callDataPoints.length>0?KC(e):GC(e)}function Hd(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),s=e%60;return`${r}m ${s.toFixed(0)}s`}function Bs(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ga(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function XC(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),s=Math.max(...e);return r===s?`${Bs(r)} ctx`:`${Bs(r)}-${Bs(s)} ctx`}function $l(e){return`${Ga(e)} t/s`}function my(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function ZC(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 QC({isOpen:e,onClose:r,stats:s}){const i=z.useRef(null),[l,u]=z.useState({}),[h,c]=z.useState(()=>{var k;return((k=s.modelGroups[0])==null?void 0:k.key)??""});z.useEffect(()=>{var k;s.modelGroups.some(C=>C.key===h)||c(((k=s.modelGroups[0])==null?void 0:k.key)??"")},[h,s.modelGroups]);const d=z.useMemo(()=>s.modelGroups.find(k=>k.key===h)??s.modelGroups[0],[h,s.modelGroups]),f=z.useMemo(()=>d?VC(d):[],[d]),g=z.useMemo(()=>d?YC(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=z.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),v=z.useCallback(()=>{if(!d)return;const k=ZC(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),S=z.useCallback(async()=>{if(i.current)try{const k=(await uh(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[])).default,C=await k(i.current,{backgroundColor:"#1a1a1a",scale:2}),y=document.createElement("a");y.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,y.href=C.toDataURL("image/png"),y.click()}catch(k){console.error("Failed to export PNG:",k),v()}},[v]);return o.jsx(kt,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:i,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:s.modelGroups.map(k=>o.jsx("button",{onClick:()=>c(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(Lr,{label:"AI Time",value:Hd(d.aiTime)}),o.jsx(Lr,{label:"Total Time",value:Hd(d.totalTime)}),o.jsx(Lr,{label:"Tool Time",value:Hd(d.toolTime)}),o.jsx(Lr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(Lr,{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(Lr,{label:"Prefill Tokens",value:Bs(d.prefillTokens),subValue:`@ ${Ga(d.avgPrefillSpeed)} tok/s`}),o.jsx(Lr,{label:"Gen Tokens",value:Bs(d.generationTokens),subValue:`@ ${Ga(d.avgGenerationSpeed)} tok/s`}),o.jsx(Lr,{label:"Avg PP Speed",value:`${Ga(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Lr,{label:"Avg TG Speed",value:`${Ga(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:v,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:S,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(WC,{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:f.map((k,C)=>o.jsxs(z.Fragment,{children:[o.jsx(JC,{row:k,index:C,isExpanded:l[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(l[k.messageId]??!1)&&k.calls.map((y,b)=>o.jsx(e2,{dataPoint:y,index:b},`${y.messageId}-${y.callIndex}`))]},k.messageId))})]})})]})]})})}function Lr({label:e,value:r,subValue:s}){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}),s&&o.jsx("div",{className:"text-text-muted text-xs",children:s})]})}function JC({row:e,index:r,isExpanded:s,onToggle:i}){const l=e.calls.length>0?XC(e.calls.map(u=>u.promptTokens)):`${Bs(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:i,className:`${r%2===0?"bg-bg-tertiary/20":""} ${i?"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:my(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:l.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(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?s?"v":">":""})]})}function e2({dataPoint:e,index:r}){const s=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return o.jsxs(o.Fragment,{children:[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:my(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:Bs(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(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"})]}),s&&o.jsx("tr",{className:`${r%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:o.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&o.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&o.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&o.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&o.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const t2={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"}},n2=z.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 s={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const l of r){const u=l.status.type;u in s&&s[u]++}const i=Object.keys(s).filter(l=>s[l]>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:i.map(l=>{const u=t2[l];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:s[l]})]},l)})})]})});function r2({isOpen:e,onClose:r}){const s=ur(C=>C.config),i=ur(C=>C.saveConfig),[l,u]=z.useState(""),[h,c]=z.useState(""),[d,f]=z.useState(!1),[g,m]=z.useState(!1),[v,S]=z.useState(!1);z.useEffect(()=>{e&&(u((s==null?void 0:s.command)??""),c((s==null?void 0:s.url)??""),f((s==null?void 0:s.hotReload)??!1),m((s==null?void 0:s.disableInspect)??!1))},[e,s]);const k=async()=>{!l.trim()||!h.trim()||(S(!0),await i({command:l.trim(),url:h.trim(),hotReload:d,disableInspect:g}),S(!1),r())};return o.jsx(kt,{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:l,onChange:C=>u(C.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:h,onChange:C=>c(C.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:C=>f(C.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 items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"disableInspect",checked:g,onChange:C=>m(C.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"disableInspect",className:"text-xs text-text-secondary",children:"Disable inspect feedback"})]}),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:k,disabled:v||!l.trim()||!h.trim(),children:v?"Saving...":"Save"})]})]})})}const mb={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"},s2={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"},gb={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},i2="text-text-primary";function a2(e){const r=[],s=new RegExp("\x1B\\[([0-9;]+)m","g");let i=0,l="text-text-primary",u;try{for(;(u=s.exec(e))!==null;){if(u.index>i){const f=e.slice(i,u.index);f&&r.push({text:f,className:l})}const h=u[1];if(!h)continue;const c=h.split(";").map(Number);if(c.length===0||c[0]===0){l="text-text-primary";continue}const d=[];for(const f of c)if(f>=30&&f<=37){const g=mb[f];g&&d.push(g)}else if(f>=40&&f<=47){const g=s2[f];g&&d.push(g)}else if(f>=90&&f<=97){const g=mb[f];g&&d.push(g)}else if(f in gb){const g=gb[f];g&&d.push(g)}else f===39?d.push(i2):f===49&&(l=l.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(l=d.join(" ")),i=s.lastIndex}if(i<e.length){const h=e.slice(i);h&&r.push({text:h,className:l})}return r}catch(h){return console.warn("ANSI parsing failed, stripping codes:",h),[{text:o2(e),className:"text-text-primary"}]}}function o2(e){return e.replace(new RegExp("\x1B\\[([0-9;]+)m","g"),"")}function ql(e){const r=a2(e),s=[];return r.forEach((i,l)=>{const u=i.text.split(`
|
|
87
|
-
`);u.forEach((h,c)=>{s.push(dn.createElement("span",{key:`${l}-${c}`,className:i.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},h)),c<u.length-1&&s.push(dn.createElement("br",{key:`${l}-${c}-br`}))})}),s.length===1?s[0]:s}function gy({logs:e,preRef:r,preClassName:s="text-sm font-mono"}){return o.jsx("pre",{ref:r,className:s,children:e.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):e.map((i,l)=>o.jsx("span",{className:i.stream==="stderr"?"text-accent-warning":"",children:ql(i.content)},l))})}const xy=z.memo(function({title:r,logs:s,onClose:i,preClassName:l}){const u=z.useRef(null);return z.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[s]),o.jsx(kt,{isOpen:!0,onClose:i,title:r,size:"full",children:o.jsx(gy,{logs:s,preRef:u,preClassName:l})})}),l2=z.memo(function({logs:r,anchorRef:s,isHiding:i,onExpand:l,onClose:u}){const[h,c]=z.useState(null),d=z.useRef(null);return z.useEffect(()=>{var g;const f=(g=s.current)==null?void 0:g.getBoundingClientRect();f&&c({bottom:window.innerHeight-f.bottom,right:window.innerWidth-f.right,width:f.width,height:f.height})},[s]),z.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),h?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:h.bottom,right:h.right,width:h.width*2,maxHeight:h.height*3,transformOrigin:"bottom right",transform:i?"scale(0.01)":"scale(1)",opacity:i?0:1},children:r.map((f,g)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:ql(f.content)},g))}),o.jsx("button",{onClick:()=>{u(),l()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-text-primary hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:h.bottom+8,right:h.right+8},children:"Expand"})]}):null}),c2=z.memo(function({workdir:r}){const s=ur(q=>q.setWorkdir),i=ur(q=>q.status),l=ur(q=>q.config),u=ur(q=>q.logs),h=ur(q=>q.start),c=ur(q=>q.stop),d=ur(q=>q.fetchLogs),f=Se(q=>q.currentSession),[g,m]=z.useState(!1),[v,S]=z.useState(!1),[k,C]=z.useState(!1),[y,b]=z.useState(!1),x=z.useRef(null),_=z.useRef(null),j=z.useRef(null),T=z.useRef(null),N=z.useRef(null),D=()=>{const q=i==null?void 0:i.inspectProxyPort;if(!q){i!=null&&i.url&&window.open(i.url,"_blank");return}const W=`${window.location.protocol}//${window.location.hostname}:${q}`,G=window.open(W,"_blank");if(G){N.current=G;const B=()=>{var Z;!N.current||N.current.closed||(N.current.postMessage({type:"setFoxSessionId",sessionId:(f==null?void 0:f.id)??null},"*"),N.current.postMessage({type:"setFoxSessionTitle",sessionTitle:((Z=f==null?void 0:f.metadata)==null?void 0:Z.title)??null},"*"),N.current.postMessage({type:"setFoxInspectEnabled",enabled:!(l!=null&&l.disableInspect)},"*"))},F=setInterval(()=>{B(),(!N.current||N.current.closed)&&clearInterval(F)},500);setTimeout(()=>clearInterval(F),5e3)}},A=(i==null?void 0:i.state)??"off",P=l!==null,O=A==="running"||A==="warning";z.useEffect(()=>{s(r??null)},[r,s]),z.useEffect(()=>{O&&d()},[O,d]),z.useEffect(()=>{j.current&&O&&(j.current.scrollTop=j.current.scrollHeight)},[u,O]);const H=()=>{O?c():h()};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:()=>m(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:o.jsx(Aw,{})})]}),P?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:H,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(Xv,{}),"Stop"]}),(i==null?void 0:i.url)&&o.jsxs("button",{onClick:()=>D(),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-text-primary hover:bg-accent-primary/40 transition-colors",title:i.url,children:[o.jsx(Lw,{}),"Open"]})]}):o.jsx("button",{onClick:H,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",children:"Start"}),O&&o.jsxs("div",{ref:T,className:"relative",onMouseEnter:()=>{_.current&&clearTimeout(_.current),x.current=setTimeout(()=>{C(!0),b(!1)},500)},onMouseLeave:()=>{x.current&&clearTimeout(x.current),b(!0),_.current=setTimeout(()=>C(!1),150)},children:[o.jsx(gy,{logs:u,preRef:j,preClassName:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border"}),(k||y)&&T.current&&Fi.createPortal(o.jsx(l2,{logs:u,anchorRef:T,isHiding:y,onExpand:()=>S(!0),onClose:()=>C(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>m(!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(r2,{isOpen:g,onClose:()=>m(!1)}),v&&o.jsx(xy,{title:"Dev Server Logs",logs:u,onClose:()=>S(!1)})]})}),u2=z.memo(function({sessionId:r}){var S;const s=Ka(k=>k.processes),i=Ka(k=>k.stopProcess),[l,u]=z.useState(null),[h,c]=z.useState([]),d=s.filter(k=>k.status!=="exited"),f=d.filter(k=>k.status==="running").length;if(s.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=Ka.getState().logs[k]??[];c(C.map(y=>({content:y.content,stream:y.stream}))),u(k)},v=k=>{r&&i(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:["(",f," 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:()=>v(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))}),l&&o.jsx(xy,{title:((S=d.find(k=>k.id===l))==null?void 0:S.name)??"",logs:h,onClose:()=>{u(null),c([])}})]})});function d2({file:e}){const r=dy(e.path,28),s=e.status==="added"?"text-accent-success":e.status==="deleted"?"text-accent-error":"text-accent-primary",i=e.status==="added"?`+${e.additions}`:e.status==="deleted"?`-${e.deletions}`:e.additions>0||e.deletions>0?`+${e.additions}, -${e.deletions}`:"";return o.jsxs("div",{className:"flex items-center justify-between gap-1 py-0.5 text-xs min-w-0",children:[o.jsx("span",{className:`truncate ${s}`,title:e.path,children:r}),i&&o.jsx("span",{className:`shrink-0 font-mono${e.status==="added"?" text-accent-success":e.status==="deleted"?" text-accent-error":" text-text-muted"}`,children:i})]})}function h2(){const{diff:e}=py();return e.loading?o.jsx("div",{className:"mt-3",children:o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[o.jsx("span",{className:"w-3 h-3 border border-border border-t-accent-primary rounded-full animate-spin"}),o.jsx("span",{children:"Checking changes..."})]})}):e.files.length===0?o.jsx("div",{className:"mt-3",children:o.jsx("p",{className:"text-xs text-text-muted text-center",children:"No changes"})}):o.jsx("div",{className:"mt-3 max-h-[150px] overflow-y-auto",children:o.jsx("div",{className:"pr-1",children:e.files.map((r,s)=>o.jsx(d2,{file:r},s))})})}function xb({summary:e,messages:r,workdir:s}){const[i,l]=z.useState(!1),u=HC(r),{branch:h}=py(),c=Ct(f=>f.version),d=Se(f=>f.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>l(!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:FC(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:db(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:db(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(QC,{isOpen:i,onClose:()=>l(!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(n2,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),h&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx(kw,{}),o.jsx("span",{className:"truncate text-text-secondary",title:h,children:h})]}),o.jsx(h2,{}),o.jsx(c2,{workdir:s}),o.jsx(u2,{sessionId:d==null?void 0:d.id}),c&&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",c]})]})]})}function f2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:s,messages:i}){const l=Se(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-secondary/50 z-40",onClick:s}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden bg-secondary",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-secondary",children:o.jsx(xb,{summary:(l==null?void 0:l.summary)??null,messages:i,workdir:l==null?void 0:l.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
|
|
88
|
-
md:hidden
|
|
89
|
-
p-4 overflow-y-auto bg-secondary
|
|
90
|
-
transition-all duration-300 ease-in-out
|
|
91
|
-
fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
|
|
92
|
-
${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
|
|
93
|
-
`,children:o.jsx(xb,{summary:(l==null?void 0:l.summary)??null,messages:i,workdir:l==null?void 0:l.workdir})})]})]})}function p2(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function by({percent:e,dangerZone:r=!1,size:s="md",className:i=""}){const l=s==="sm"?"w-12":"w-20",u=s==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${l} ${i}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${p2(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function m2({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function bb(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function g2(){const e=Se(m=>m.contextState),r=Se(m=>m.currentSession),s=Se(m=>m.compactContext),[i,l]=z.useState(!1);if(!e||!r)return null;const{currentTokens:u,maxTokens:h,compactionCount:c,dangerZone:d}=e,f=Math.round(u/h*100),g=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-secondary",children:o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:bb(f,d),children:[Ul(u)," / ",Ul(h)]}),o.jsxs("span",{className:bb(f,d),children:["(",f,"%)"]}),o.jsx(by,{percent:f,dangerZone:d}),o.jsx(m2,{dangerZone:d}),c>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[c,"x"]})]}),o.jsx("div",{className:"flex-1 flex justify-end",children:o.jsxs("div",{className:"relative",children:[o.jsx("button",{onClick:()=>l(!i),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"More options",children:o.jsx(Yv,{})}),i&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>l(!1)}),o.jsx("div",{className:"absolute right-0 top-full mt-1.5 z-50 bg-bg-secondary border border-border rounded-lg shadow-xl py-1 min-w-[160px]",children:o.jsx("button",{onClick:()=>{g||s(),l(!1)},disabled:g,className:"w-full px-3 py-1.5 text-left text-sm hover:bg-bg-tertiary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:g?"Cannot compact while running":"Compact context",children:o.jsx("span",{className:d?"text-accent-error":"",children:"Compact"})})})]})]})})]})})}function x2({stats:e,onClose:r}){var s;return o.jsx(kt,{isOpen:!0,onClose:r,title:"Turn Stats",size:"md",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx(Al,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Al,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Al,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Al,{label:"LLM Calls",value:String(((s=e.llmCalls)==null?void 0:s.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((i,l)=>o.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",l+1]}),o.jsxs("span",{className:"text-xs text-text-muted",children:[i.ttft.toFixed(2),"s TTFT · ",i.completionTime.toFixed(2),"s gen"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",o.jsxs("span",{className:"text-text-primary",children:[i.promptTokens," → ",i.completionTokens]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[i.temperature!==void 0&&o.jsx(Dl,{label:"temp",value:i.temperature.toFixed(2)}),i.topP!==void 0&&o.jsx(Dl,{label:"topP",value:i.topP.toFixed(2)}),i.topK!==void 0&&o.jsx(Dl,{label:"topK",value:String(i.topK)}),i.maxTokens!==void 0&&o.jsx(Dl,{label:"maxTok",value:String(i.maxTokens)})]})]})]},l))]})]})})}function Al({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-xs text-text-muted",children:e}),o.jsx("div",{className:"text-lg font-semibold text-text-primary",children:r})]})}function Dl({label:e,value:r}){return o.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[o.jsxs("span",{className:"text-text-muted",children:[e,":"]})," ",r]})}const jt=Bn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const i=await(await ke("/api/workflows/template-variables")).json();e({templateVariables:i.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const i=await(await ke("/api/workflows")).json();e({defaults:i.defaults??[],userItems:i.userItems??[],activeWorkflowId:i.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/workflows/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createWorkflow:async s=>{const i=await ds("POST","/api/workflows",s);return i.success&&await r().fetchWorkflows(),i},updateWorkflow:async(s,i)=>{const l=await ds("PUT",`/api/workflows/${s}`,i);return l.success&&await r().fetchWorkflows(),l},deleteWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}`,{method:"DELETE"}),l=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(h=>h.id!==s)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async s=>{try{const i=await ke(`/api/workflows/${s}/duplicate`,{method:"POST"}),l=await i.json();return i.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function vb(e){const r=[],s=String(e||"");let i=s.indexOf(","),l=0,u=!1;for(;!u;){i===-1&&(i=s.length,u=!0);const h=s.slice(l,i).trim();(h||!u)&&r.push(h),l=i+1,i=s.indexOf(",",l)}return r}function b2(e,r){const s={};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const v2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_2={};function yb(e,r){return(_2.jsx?y2:v2).test(e)}const S2=/[ \t\n\f\r]/g;function w2(e){return typeof e=="object"?e.type==="text"?_b(e.value):!1:_b(e)}function _b(e){return e.replace(S2,"")===""}class uo{constructor(r,s,i){this.normal=s,this.property=r,i&&(this.space=i)}}uo.prototype.normal={};uo.prototype.property={};uo.prototype.space=void 0;function vy(e,r){const s={},i={};for(const l of e)Object.assign(s,l.property),Object.assign(i,l.normal);return new uo(s,i,r)}function eo(e){return e.toLowerCase()}class kn{constructor(r,s){this.attribute=s,this.property=r}}kn.prototype.attribute="";kn.prototype.booleanish=!1;kn.prototype.boolean=!1;kn.prototype.commaOrSpaceSeparated=!1;kn.prototype.commaSeparated=!1;kn.prototype.defined=!1;kn.prototype.mustUseProperty=!1;kn.prototype.number=!1;kn.prototype.overloadedBoolean=!1;kn.prototype.property="";kn.prototype.spaceSeparated=!1;kn.prototype.space=void 0;let C2=0;const Xe=Hs(),Vt=Hs(),ph=Hs(),we=Hs(),_t=Hs(),Ii=Hs(),On=Hs();function Hs(){return 2**++C2}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:Vt,commaOrSpaceSeparated:On,commaSeparated:Ii,number:we,overloadedBoolean:ph,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Fd=Object.keys(mh);class Gh extends kn{constructor(r,s,i,l){let u=-1;if(super(r,s),Sb(this,"space",l),typeof i=="number")for(;++u<Fd.length;){const h=Fd[u];Sb(this,Fd[u],(i&mh[h])===mh[h])}}}Gh.prototype.defined=!0;function Sb(e,r,s){s&&(e[r]=s)}function Ui(e){const r={},s={};for(const[i,l]of Object.entries(e.properties)){const u=new Gh(i,e.transform(e.attributes||{},i),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),r[i]=u,s[eo(i)]=i,s[eo(u.attribute)]=i}return new uo(r,s,e.space)}const yy=Ui({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:_t,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:we,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:_t,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Vt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function _y(e,r){return r in e?e[r]:r}function Sy(e,r){return _y(e,r.toLowerCase())}const k2=Ui({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ii,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:_t,autoFocus:Xe,autoPlay:Xe,blocking:_t,capture:null,charSet:null,checked:Xe,cite:null,className:_t,cols:we,colSpan:null,content:null,contentEditable:Vt,controls:Xe,controlsList:_t,coords:we|Ii,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:ph,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:_t,height:we,hidden:ph,high:we,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:_t,itemRef:_t,itemScope:Xe,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,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:Xe,optimum:we,pattern:null,ping:_t,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:_t,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:_t,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:Vt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Vt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Sy}),E2=Ui({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:On,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ii,g2:Ii,glyphName:Ii,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:On,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:On,rev:On,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:On,requiredFeatures:On,requiredFonts:On,requiredFormats:On,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_y}),wy=Ui({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()}}),Cy=Ui({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sy}),ky=Ui({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),j2={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"},N2=/[A-Z]/g,wb=/-[a-z]/g,T2=/^data[-\w.:]+$/i;function Ey(e,r){const s=eo(r);let i=r,l=kn;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&T2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(wb,D2);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!wb.test(u)){let h=u.replace(N2,A2);h.charAt(0)!=="-"&&(h="-"+h),r="data"+h}}l=Gh}return new l(i,r)}function A2(e){return"-"+e.toLowerCase()}function D2(e){return e.charAt(1).toUpperCase()}const jy=vy([yy,k2,wy,Cy,ky],"html"),ic=vy([yy,E2,wy,Cy,ky],"svg");function Cb(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function R2(e){return e.join(" ").trim()}var Ni={},Ud,kb;function L2(){if(kb)return Ud;kb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,s=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,h=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
94
|
-
`,f="/",g="*",m="",v="comment",S="declaration";function k(y,b){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];b=b||{};var x=1,_=1;function j(G){var B=G.match(r);B&&(x+=B.length);var F=G.lastIndexOf(d);_=~F?G.length-F:_+G.length}function T(){var G={line:x,column:_};return function(B){return B.position=new N(G),P(),B}}function N(G){this.start=G,this.end={line:x,column:_},this.source=b.source}N.prototype.content=y;function D(G){var B=new Error(b.source+":"+x+":"+_+": "+G);if(B.reason=G,B.filename=b.source,B.line=x,B.column=_,B.source=y,!b.silent)throw B}function A(G){var B=G.exec(y);if(B){var F=B[0];return j(F),y=y.slice(F.length),B}}function P(){A(s)}function O(G){var B;for(G=G||[];B=H();)B!==!1&&G.push(B);return G}function H(){var G=T();if(!(f!=y.charAt(0)||g!=y.charAt(1))){for(var B=2;m!=y.charAt(B)&&(g!=y.charAt(B)||f!=y.charAt(B+1));)++B;if(B+=2,m===y.charAt(B-1))return D("End of comment missing");var F=y.slice(2,B-2);return _+=2,j(F),y=y.slice(B),_+=2,G({type:v,comment:F})}}function q(){var G=T(),B=A(i);if(B){if(H(),!A(l))return D("property missing ':'");var F=A(u),Z=G({type:S,property:C(B[0].replace(e,m)),value:F?C(F[0].replace(e,m)):m});return A(h),Z}}function W(){var G=[];O(G);for(var B;B=q();)B!==!1&&(G.push(B),O(G));return G}return P(),W()}function C(y){return y?y.replace(c,m):m}return Ud=k,Ud}var Eb;function O2(){if(Eb)return Ni;Eb=1;var e=Ni&&Ni.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.default=s;const r=e(L2());function s(i,l){let u=null;if(!i||typeof i!="string")return u;const h=(0,r.default)(i),c=typeof l=="function";return h.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:g}=d;c?l(f,g,d):g&&(u=u||{},u[f]=g)}),u}return Ni}var Ha={},jb;function M2(){if(jb)return Ha;jb=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,s=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(f){return!f||s.test(f)||e.test(f)},h=function(f,g){return g.toUpperCase()},c=function(f,g){return"".concat(g,"-")},d=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(l,c):f=f.replace(i,c),f.replace(r,h))};return Ha.camelCase=d,Ha}var Fa,Nb;function I2(){if(Nb)return Fa;Nb=1;var e=Fa&&Fa.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(O2()),s=M2();function i(l,u){var h={};return!l||typeof l!="string"||(0,r.default)(l,function(c,d){c&&d&&(h[(0,s.camelCase)(c,u)]=d)}),h}return i.default=i,Fa=i,Fa}var B2=I2();const z2=Zl(B2),Ny=Ty("end"),Kh=Ty("start");function Ty(e){return r;function r(s){const i=s&&s.position&&s.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function P2(e){const r=Kh(e),s=Ny(e);if(r&&s)return{start:r,end:s}}function Ya(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Tb(e.position):"start"in e||"end"in e?Tb(e):"line"in e||"column"in e?gh(e):""}function gh(e){return Ab(e&&e.line)+":"+Ab(e&&e.column)}function Tb(e){return gh(e&&e.start)+"-"+gh(e&&e.end)}function Ab(e){return e&&typeof e=="number"?e:1}class pn extends Error{constructor(r,s,i){super(),typeof s=="string"&&(i=s,s=void 0);let l="",u={},h=!1;if(s&&("line"in s&&"column"in s?u={place:s}:"start"in s&&"end"in s?u={place:s}:"type"in s?u={ancestors:[s],place:s.position}:u={...s}),typeof r=="string"?l=r:!u.cause&&r&&(h=!0,l=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof i=="string"){const d=i.indexOf(":");d===-1?u.ruleId=i:(u.source=i.slice(0,d),u.ruleId=i.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const c=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=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=c?c.line:void 0,this.name=Ya(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=h&&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}}pn.prototype.file="";pn.prototype.name="";pn.prototype.reason="";pn.prototype.message="";pn.prototype.stack="";pn.prototype.column=void 0;pn.prototype.line=void 0;pn.prototype.ancestors=void 0;pn.prototype.cause=void 0;pn.prototype.fatal=void 0;pn.prototype.place=void 0;pn.prototype.ruleId=void 0;pn.prototype.source=void 0;const Yh={}.hasOwnProperty,H2=new Map,F2=/[A-Z]/g,U2=new Set(["table","tbody","thead","tfoot","tr"]),$2=new Set(["td","th"]),Ay="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function q2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=r.filePath||void 0;let i;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Q2(s,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");i=Z2(s,r.jsx,r.jsxs)}const l={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:i,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?ic:jy,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Dy(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Dy(e,r,s){if(r.type==="element")return W2(e,r,s);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return V2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return K2(e,r,s);if(r.type==="mdxjsEsm")return G2(e,r);if(r.type==="root")return Y2(e,r,s);if(r.type==="text")return X2(e,r)}function W2(e,r,s){const i=e.schema;let l=i;r.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=ic,e.schema=l),e.ancestors.push(r);const u=Ly(e,r.tagName,!1),h=J2(e,r);let c=Zh(e,r);return U2.has(r.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!w2(d):!0})),Ry(e,h,u,r),Xh(h,c),e.ancestors.pop(),e.schema=i,e.create(r,u,h,s)}function V2(e,r){if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}to(e,r.position)}function G2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);to(e,r.position)}function K2(e,r,s){const i=e.schema;let l=i;r.name==="svg"&&i.space==="html"&&(l=ic,e.schema=l),e.ancestors.push(r);const u=r.name===null?e.Fragment:Ly(e,r.name,!0),h=ek(e,r),c=Zh(e,r);return Ry(e,h,u,r),Xh(h,c),e.ancestors.pop(),e.schema=i,e.create(r,u,h,s)}function Y2(e,r,s){const i={};return Xh(i,Zh(e,r)),e.create(r,e.Fragment,i,s)}function X2(e,r){return r.value}function Ry(e,r,s,i){typeof s!="string"&&s!==e.Fragment&&e.passNode&&(r.node=i)}function Xh(e,r){if(r.length>0){const s=r.length>1?r:r[0];s&&(e.children=s)}}function Z2(e,r,s){return i;function i(l,u,h,c){const f=Array.isArray(h.children)?s:r;return c?f(u,h,c):f(u,h)}}function Q2(e,r){return s;function s(i,l,u,h){const c=Array.isArray(u.children),d=Kh(i);return r(l,u,h,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function J2(e,r){const s={};let i,l;for(l in r.properties)if(l!=="children"&&Yh.call(r.properties,l)){const u=tk(e,l,r.properties[l]);if(u){const[h,c]=u;e.tableCellAlignToStyle&&h==="align"&&typeof c=="string"&&$2.has(r.tagName)?i=c:s[h]=c}}if(i){const u=s.style||(s.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return s}function ek(e,r){const s={};for(const i of r.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const h=u.expression;h.type;const c=h.properties[0];c.type,Object.assign(s,e.evaluater.evaluateExpression(c.argument))}else to(e,r.position);else{const l=i.name;let u;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const c=i.value.data.estree.body[0];c.type,u=e.evaluater.evaluateExpression(c.expression)}else to(e,r.position);else u=i.value===null?!0:i.value;s[l]=u}return s}function Zh(e,r){const s=[];let i=-1;const l=e.passKeys?new Map:H2;for(;++i<r.children.length;){const u=r.children[i];let h;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const f=l.get(d)||0;h=d+"-"+f,l.set(d,f+1)}}const c=Dy(e,u,h);c!==void 0&&s.push(c)}return s}function tk(e,r,s){const i=Ey(e.schema,r);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=i.commaSeparated?b2(s):R2(s)),i.property==="style"){let l=typeof s=="object"?s:nk(e,String(s));return e.stylePropertyNameCase==="css"&&(l=rk(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?j2[i.property]||i.property:i.attribute,s]}}function nk(e,r){try{return z2(r,{reactCompat:!0})}catch(s){if(e.ignoreInvalidStyle)return{};const i=s,l=new pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Ay+"#cannot-parse-style-attribute",l}}function Ly(e,r,s){let i;if(!s)i={type:"Literal",value:r};else if(r.includes(".")){const l=r.split(".");let u=-1,h;for(;++u<l.length;){const c=yb(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};h=h?{type:"MemberExpression",object:h,property:c,computed:!!(u&&c.type==="Literal"),optional:!1}:c}i=h}else i=yb(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const l=i.value;return Yh.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(i);to(e)}function to(e,r){const s=new pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Ay+"#cannot-handle-mdx-estrees-without-createevaluater",s}function rk(e){const r={};let s;for(s in e)Yh.call(e,s)&&(r[sk(s)]=e[s]);return r}function sk(e){let r=e.replace(F2,ik);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function ik(e){return"-"+e.toLowerCase()}const $d={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"]},ak={};function Qh(e,r){const s=ak,i=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,l=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return Oy(e,i,l)}function Oy(e,r,s){if(ok(e)){if("value"in e)return e.type==="html"&&!s?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Db(e.children,r,s)}return Array.isArray(e)?Db(e,r,s):""}function Db(e,r,s){const i=[];let l=-1;for(;++l<e.length;)i[l]=Oy(e[l],r,s);return i.join("")}function ok(e){return!!(e&&typeof e=="object")}const Rb=document.createElement("i");function no(e){const r="&"+e+";";Rb.innerHTML=r;const s=Rb.textContent;return s.charCodeAt(s.length-1)===59&&e!=="semi"||s===r?!1:s}function In(e,r,s,i){const l=e.length;let u=0,h;if(r<0?r=-r>l?0:l+r:r=r>l?l:r,s=s>0?s:0,i.length<1e4)h=Array.from(i),h.unshift(r,s),e.splice(...h);else for(s&&e.splice(r,s);u<i.length;)h=i.slice(u,u+1e4),h.unshift(r,0),e.splice(...h),u+=1e4,r+=1e4}function Yn(e,r){return e.length>0?(In(e,e.length,0,r),e):r}const Lb={}.hasOwnProperty;function My(e){const r={};let s=-1;for(;++s<e.length;)lk(r,e[s]);return r}function lk(e,r){let s;for(s in r){const l=(Lb.call(e,s)?e[s]:void 0)||(e[s]={}),u=r[s];let h;if(u)for(h in u){Lb.call(l,h)||(l[h]=[]);const c=u[h];ck(l[h],Array.isArray(c)?c:c?[c]:[])}}}function ck(e,r){let s=-1;const i=[];for(;++s<r.length;)(r[s].add==="after"?e:i).push(r[s]);In(e,0,0,i)}function Iy(e,r){const s=Number.parseInt(e,r);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function tr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gn=hs(/[A-Za-z]/),fn=hs(/[\dA-Za-z]/),uk=hs(/[#-'*+\--9=?A-Z^-~]/);function Wl(e){return e!==null&&(e<32||e===127)}const xh=hs(/\d/),dk=hs(/[\dA-Fa-f]/),hk=hs(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function tt(e){return e===-2||e===-1||e===32}const ac=hs(new RegExp("\\p{P}|\\p{S}","u")),Ps=hs(/\s/);function hs(e){return r;function r(s){return s!==null&&s>-1&&e.test(String.fromCharCode(s))}}function $i(e){const r=[];let s=-1,i=0,l=0;for(;++s<e.length;){const u=e.charCodeAt(s);let h="";if(u===37&&fn(e.charCodeAt(s+1))&&fn(e.charCodeAt(s+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(h=String.fromCharCode(u));else if(u>55295&&u<57344){const c=e.charCodeAt(s+1);u<56320&&c>56319&&c<57344?(h=String.fromCharCode(u,c),l=1):h="�"}else h=String.fromCharCode(u);h&&(r.push(e.slice(i,s),encodeURIComponent(h)),i=s+l+1,h=""),l&&(s+=l,l=0)}return r.join("")+e.slice(i)}function at(e,r,s,i){const l=i?i-1:Number.POSITIVE_INFINITY;let u=0;return h;function h(d){return tt(d)?(e.enter(s),c(d)):r(d)}function c(d){return tt(d)&&u++<l?(e.consume(d),c):(e.exit(s),r(d))}}const fk={tokenize:pk};function pk(e){const r=e.attempt(this.parser.constructs.contentInitial,i,l);let s;return r;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),at(e,r,"linePrefix")}function l(c){return e.enter("paragraph"),u(c)}function u(c){const d=e.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=d),s=d,h(c)}function h(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Pe(c)?(e.consume(c),e.exit("chunkText"),u):(e.consume(c),h)}}const mk={tokenize:gk},Ob={tokenize:xk};function gk(e){const r=this,s=[];let i=0,l,u,h;return c;function c(_){if(i<s.length){const j=s[i];return r.containerState=j[1],e.attempt(j[0].continuation,d,f)(_)}return f(_)}function d(_){if(i++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,l&&x();const j=r.events.length;let T=j,N;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){N=r.events[T][1].end;break}b(i);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return In(r.events,T+1,0,r.events.slice(j)),r.events.length=D,f(_)}return c(_)}function f(_){if(i===s.length){if(!l)return v(_);if(l.currentConstruct&&l.currentConstruct.concrete)return k(_);r.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Ob,g,m)(_)}function g(_){return l&&x(),b(i),v(_)}function m(_){return r.parser.lazy[r.now().line]=i!==s.length,h=r.now().offset,k(_)}function v(_){return r.containerState={},e.attempt(Ob,S,k)(_)}function S(_){return i++,s.push([r.currentConstruct,r.containerState]),v(_)}function k(_){if(_===null){l&&x(),b(0),e.consume(_);return}return l=l||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(_);return}return Pe(_)?(e.consume(_),y(e.exit("chunkFlow")),i=0,r.interrupt=void 0,c):(e.consume(_),C)}function y(_,j){const T=r.sliceStream(_);if(j&&T.push(null),_.previous=u,u&&(u.next=_),u=_,l.defineSkip(_.start),l.write(T),r.parser.lazy[_.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<h&&(!l.events[N][1].end||l.events[N][1].end.offset>h))return;const D=r.events.length;let A=D,P,O;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){if(P){O=r.events[A][1].end;break}P=!0}for(b(i),N=D;N<r.events.length;)r.events[N][1].end={...O},N++;In(r.events,A+1,0,r.events.slice(D)),r.events.length=N}}function b(_){let j=s.length;for(;j-- >_;){const T=s[j];r.containerState=T[1],T[0].exit.call(r,e)}s.length=_}function x(){l.write([null]),u=void 0,l=void 0,r.containerState._closeFlow=void 0}}function xk(e,r,s){return at(e,e.attempt(this.parser.constructs.document,r,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pi(e){if(e===null||yt(e)||Ps(e))return 1;if(ac(e))return 2}function oc(e,r,s){const i=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!i.includes(u)&&(r=u(r,s),i.push(u))}return r}const bh={name:"attention",resolveAll:bk,tokenize:vk};function bk(e,r){let s=-1,i,l,u,h,c,d,f,g;for(;++s<e.length;)if(e[s][0]==="enter"&&e[s][1].type==="attentionSequence"&&e[s][1]._close){for(i=s;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&r.sliceSerialize(e[i][1]).charCodeAt(0)===r.sliceSerialize(e[s][1]).charCodeAt(0)){if((e[i][1]._close||e[s][1]._open)&&(e[s][1].end.offset-e[s][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[s][1].end.offset-e[s][1].start.offset)%3))continue;d=e[i][1].end.offset-e[i][1].start.offset>1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1;const m={...e[i][1].end},v={...e[s][1].start};Mb(m,-d),Mb(v,d),h={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[i][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[s][1].start},end:v},u={type:d>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[s][1].start}},l={type:d>1?"strong":"emphasis",start:{...h.start},end:{...c.end}},e[i][1].end={...h.start},e[s][1].start={...c.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=Yn(f,[["enter",e[i][1],r],["exit",e[i][1],r]])),f=Yn(f,[["enter",l,r],["enter",h,r],["exit",h,r],["enter",u,r]]),f=Yn(f,oc(r.parser.constructs.insideSpan.null,e.slice(i+1,s),r)),f=Yn(f,[["exit",u,r],["enter",c,r],["exit",c,r],["exit",l,r]]),e[s][1].end.offset-e[s][1].start.offset?(g=2,f=Yn(f,[["enter",e[s][1],r],["exit",e[s][1],r]])):g=0,In(e,i-1,s-i+3,f),s=i+f.length-g-2;break}}for(s=-1;++s<e.length;)e[s][1].type==="attentionSequence"&&(e[s][1].type="data");return e}function vk(e,r){const s=this.parser.constructs.attentionMarkers.null,i=this.previous,l=Pi(i);let u;return h;function h(d){return u=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===u)return e.consume(d),c;const f=e.exit("attentionSequence"),g=Pi(d),m=!g||g===2&&l||s.includes(d),v=!l||l===2&&g||s.includes(i);return f._open=!!(u===42?m:m&&(l||!v)),f._close=!!(u===42?v:v&&(g||!m)),r(d)}}function Mb(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const yk={name:"autolink",tokenize:_k};function _k(e,r,s){let i=0;return l;function l(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(S){return gn(S)?(e.consume(S),h):S===64?s(S):f(S)}function h(S){return S===43||S===45||S===46||fn(S)?(i=1,c(S)):f(S)}function c(S){return S===58?(e.consume(S),i=0,d):(S===43||S===45||S===46||fn(S))&&i++<32?(e.consume(S),c):(i=0,f(S))}function d(S){return S===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):S===null||S===32||S===60||Wl(S)?s(S):(e.consume(S),d)}function f(S){return S===64?(e.consume(S),g):uk(S)?(e.consume(S),f):s(S)}function g(S){return fn(S)?m(S):s(S)}function m(S){return S===46?(e.consume(S),i=0,g):S===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):v(S)}function v(S){if((S===45||fn(S))&&i++<63){const k=S===45?v:m;return e.consume(S),k}return s(S)}}const ho={partial:!0,tokenize:Sk};function Sk(e,r,s){return i;function i(u){return tt(u)?at(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?r(u):s(u)}}const By={continuation:{tokenize:Ck},exit:kk,name:"blockQuote",tokenize:wk};function wk(e,r,s){const i=this;return l;function l(h){if(h===62){const c=i.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(h),e.exit("blockQuoteMarker"),u}return s(h)}function u(h){return tt(h)?(e.enter("blockQuotePrefixWhitespace"),e.consume(h),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(h))}}function Ck(e,r,s){const i=this;return l;function l(h){return tt(h)?at(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):u(h)}function u(h){return e.attempt(By,r,s)(h)}}function kk(e){e.exit("blockQuote")}const zy={name:"characterEscape",tokenize:Ek};function Ek(e,r,s){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return hk(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):s(u)}}const Py={name:"characterReference",tokenize:jk};function jk(e,r,s){const i=this;let l=0,u,h;return c;function c(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"),f):(e.enter("characterReferenceValue"),u=31,h=fn,g(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,h=dk,g):(e.enter("characterReferenceValue"),u=7,h=xh,g(m))}function g(m){if(m===59&&l){const v=e.exit("characterReferenceValue");return h===fn&&!no(i.sliceSerialize(v))?s(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return h(m)&&l++<u?(e.consume(m),g):s(m)}}const Ib={partial:!0,tokenize:Tk},Bb={concrete:!0,name:"codeFenced",tokenize:Nk};function Nk(e,r,s){const i=this,l={partial:!0,tokenize:T};let u=0,h=0,c;return d;function d(N){return f(N)}function f(N){const D=i.events[i.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===c?(h++,e.consume(N),g):h<3?s(N):(e.exit("codeFencedFenceSequence"),tt(N)?at(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Pe(N)?(e.exit("codeFencedFence"),i.interrupt?r(N):e.check(Ib,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):tt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,S,"whitespace")(N)):N===96&&N===c?s(N):(e.consume(N),v)}function S(N){return N===null||Pe(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===c?s(N):(e.consume(N),k)}function C(N){return e.attempt(l,j,y)(N)}function y(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b}function b(N){return u>0&&tt(N)?at(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||Pe(N)?e.check(Ib,C,j)(N):(e.enter("codeFlowValue"),_(N))}function _(N){return N===null||Pe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),_)}function j(N){return e.exit("codeFenced"),r(N)}function T(N,D,A){let P=0;return O;function O(B){return N.enter("lineEnding"),N.consume(B),N.exit("lineEnding"),H}function H(B){return N.enter("codeFencedFence"),tt(B)?at(N,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):q(B)}function q(B){return B===c?(N.enter("codeFencedFenceSequence"),W(B)):A(B)}function W(B){return B===c?(P++,N.consume(B),W):P>=h?(N.exit("codeFencedFenceSequence"),tt(B)?at(N,G,"whitespace")(B):G(B)):A(B)}function G(B){return B===null||Pe(B)?(N.exit("codeFencedFence"),D(B)):A(B)}}}function Tk(e,r,s){const i=this;return l;function l(h){return h===null?s(h):(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u)}function u(h){return i.parser.lazy[i.now().line]?s(h):r(h)}}const qd={name:"codeIndented",tokenize:Dk},Ak={partial:!0,tokenize:Rk};function Dk(e,r,s){const i=this;return l;function l(f){return e.enter("codeIndented"),at(e,u,"linePrefix",5)(f)}function u(f){const g=i.events[i.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?h(f):s(f)}function h(f){return f===null?d(f):Pe(f)?e.attempt(Ak,h,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Pe(f)?(e.exit("codeFlowValue"),h(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),r(f)}}function Rk(e,r,s){const i=this;return l;function l(h){return i.parser.lazy[i.now().line]?s(h):Pe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):at(e,u,"linePrefix",5)(h)}function u(h){const c=i.events[i.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(h):Pe(h)?l(h):s(h)}}const Lk={name:"codeText",previous:Mk,resolve:Ok,tokenize:Ik};function Ok(e){let r=e.length-4,s=3,i,l;if((e[s][1].type==="lineEnding"||e[s][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(i=s;++i<r;)if(e[i][1].type==="codeTextData"){e[s][1].type="codeTextPadding",e[r][1].type="codeTextPadding",s+=2,r-=2;break}}for(i=s-1,r++;++i<=r;)l===void 0?i!==r&&e[i][1].type!=="lineEnding"&&(l=i):(i===r||e[i][1].type==="lineEnding")&&(e[l][1].type="codeTextData",i!==l+2&&(e[l][1].end=e[i-1][1].end,e.splice(l+2,i-l-2),r-=i-l-2,i=l+2),l=void 0);return e}function Mk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ik(e,r,s){let i=0,l,u;return h;function h(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),i++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?s(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),l=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),f)}function g(m){return m===96?(e.consume(m),l++,g):l===i?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",f(m))}}class Bk{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,s){const i=s??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(r,i):r>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(r,s,i){const l=s||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Ua(this.left,i),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),Ua(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ua(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 s=this.left.splice(r,Number.POSITIVE_INFINITY);Ua(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ua(this.left,s.reverse())}}}function Ua(e,r){let s=0;if(r.length<1e4)e.push(...r);else for(;s<r.length;)e.push(...r.slice(s,s+1e4)),s+=1e4}function Hy(e){const r={};let s=-1,i,l,u,h,c,d,f;const g=new Bk(e);for(;++s<g.length;){for(;s in r;)s=r[s];if(i=g.get(s),s&&i[1].type==="chunkFlow"&&g.get(s-1)[1].type==="listItemPrefix"&&(d=i[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(i[0]==="enter")i[1].contentType&&(Object.assign(r,zk(g,s)),s=r[s],f=!0);else if(i[1]._container){for(u=s,l=void 0;u--;)if(h=g.get(u),h[1].type==="lineEnding"||h[1].type==="lineEndingBlank")h[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),h[1].type="lineEnding",l=u);else if(!(h[1].type==="linePrefix"||h[1].type==="listItemIndent"))break;l&&(i[1].end={...g.get(l)[1].start},c=g.slice(l,s),c.unshift(i),g.splice(l,s-l+1,c))}}return In(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function zk(e,r){const s=e.get(r)[1],i=e.get(r)[2];let l=r-1;const u=[];let h=s._tokenizer;h||(h=i.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(h._contentTypeTextTrailing=!0));const c=h.events,d=[],f={};let g,m,v=-1,S=s,k=0,C=0;const y=[C];for(;S;){for(;e.get(++l)[1]!==S;);u.push(l),S._tokenizer||(g=i.sliceStream(S),S.next||g.push(null),m&&h.defineSkip(S.start),S._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=!0),h.write(g),S._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=void 0)),m=S,S=S.next}for(S=s;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(C=v+1,y.push(C),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(h.events=[],S?(S._tokenizer=void 0,S.previous=void 0):y.pop(),v=y.length;v--;){const b=c.slice(y[v],y[v+1]),x=u.pop();d.push([x,x+b.length-1]),e.splice(x,2,b)}for(d.reverse(),v=-1;++v<d.length;)f[k+d[v][0]]=k+d[v][1],k+=d[v][1]-d[v][0]-1;return f}const Pk={resolve:Fk,tokenize:Uk},Hk={partial:!0,tokenize:$k};function Fk(e){return Hy(e),e}function Uk(e,r){let s;return i;function i(c){return e.enter("content"),s=e.enter("chunkContent",{contentType:"content"}),l(c)}function l(c){return c===null?u(c):Pe(c)?e.check(Hk,h,u)(c):(e.consume(c),l)}function u(c){return e.exit("chunkContent"),e.exit("content"),r(c)}function h(c){return e.consume(c),e.exit("chunkContent"),s.next=e.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,l}}function $k(e,r,s){const i=this;return l;function l(h){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),at(e,u,"linePrefix")}function u(h){if(h===null||Pe(h))return s(h);const c=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(h):e.interrupt(i.parser.constructs.flow,s,r)(h)}}function Fy(e,r,s,i,l,u,h,c,d){const f=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(b){return b===60?(e.enter(i),e.enter(l),e.enter(u),e.consume(b),e.exit(u),v):b===null||b===32||b===41||Wl(b)?s(b):(e.enter(i),e.enter(h),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(b))}function v(b){return b===62?(e.enter(u),e.consume(b),e.exit(u),e.exit(l),e.exit(i),r):(e.enter(c),e.enter("chunkString",{contentType:"string"}),S(b))}function S(b){return b===62?(e.exit("chunkString"),e.exit(c),v(b)):b===null||b===60||Pe(b)?s(b):(e.consume(b),b===92?k:S)}function k(b){return b===60||b===62||b===92?(e.consume(b),S):S(b)}function C(b){return!g&&(b===null||b===41||yt(b))?(e.exit("chunkString"),e.exit(c),e.exit(h),e.exit(i),r(b)):g<f&&b===40?(e.consume(b),g++,C):b===41?(e.consume(b),g--,C):b===null||b===32||b===40||Wl(b)?s(b):(e.consume(b),b===92?y:C)}function y(b){return b===40||b===41||b===92?(e.consume(b),C):C(b)}}function Uy(e,r,s,i,l,u){const h=this;let c=0,d;return f;function f(S){return e.enter(i),e.enter(l),e.consume(S),e.exit(l),e.enter(u),g}function g(S){return c>999||S===null||S===91||S===93&&!d||S===94&&!c&&"_hiddenFootnoteSupport"in h.parser.constructs?s(S):S===93?(e.exit(u),e.enter(l),e.consume(S),e.exit(l),e.exit(i),r):Pe(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||S===91||S===93||Pe(S)||c++>999?(e.exit("chunkString"),g(S)):(e.consume(S),d||(d=!tt(S)),S===92?v:m)}function v(S){return S===91||S===92||S===93?(e.consume(S),c++,m):m(S)}}function $y(e,r,s,i,l,u){let h;return c;function c(v){return v===34||v===39||v===40?(e.enter(i),e.enter(l),e.consume(v),e.exit(l),h=v===40?41:v,d):s(v)}function d(v){return v===h?(e.enter(l),e.consume(v),e.exit(l),e.exit(i),r):(e.enter(u),f(v))}function f(v){return v===h?(e.exit(u),d(h)):v===null?s(v):Pe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),at(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===h||v===null||Pe(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?m:g)}function m(v){return v===h||v===92?(e.consume(v),g):g(v)}}function Xa(e,r){let s;return i;function i(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s=!0,i):tt(l)?at(e,i,s?"linePrefix":"lineSuffix")(l):r(l)}}const qk={name:"definition",tokenize:Vk},Wk={partial:!0,tokenize:Gk};function Vk(e,r,s){const i=this;let l;return u;function u(S){return e.enter("definition"),h(S)}function h(S){return Uy.call(i,e,c,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function c(S){return l=tr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),d):s(S)}function d(S){return yt(S)?Xa(e,f)(S):f(S)}function f(S){return Fy(e,g,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(Wk,m,m)(S)}function m(S){return tt(S)?at(e,v,"whitespace")(S):v(S)}function v(S){return S===null||Pe(S)?(e.exit("definition"),i.parser.defined.push(l),r(S)):s(S)}}function Gk(e,r,s){return i;function i(c){return yt(c)?Xa(e,l)(c):s(c)}function l(c){return $y(e,u,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function u(c){return tt(c)?at(e,h,"whitespace")(c):h(c)}function h(c){return c===null||Pe(c)?r(c):s(c)}}const Kk={name:"hardBreakEscape",tokenize:Yk};function Yk(e,r,s){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),r(u)):s(u)}}const Xk={name:"headingAtx",resolve:Zk,tokenize:Qk};function Zk(e,r){let s=e.length-2,i=3,l,u;return e[i][1].type==="whitespace"&&(i+=2),s-2>i&&e[s][1].type==="whitespace"&&(s-=2),e[s][1].type==="atxHeadingSequence"&&(i===s-1||s-4>i&&e[s-2][1].type==="whitespace")&&(s-=i+1===s?2:4),s>i&&(l={type:"atxHeadingText",start:e[i][1].start,end:e[s][1].end},u={type:"chunkText",start:e[i][1].start,end:e[s][1].end,contentType:"text"},In(e,i,s-i+1,[["enter",l,r],["enter",u,r],["exit",u,r],["exit",l,r]])),e}function Qk(e,r,s){let i=0;return l;function l(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),h(g)}function h(g){return g===35&&i++<6?(e.consume(g),h):g===null||yt(g)?(e.exit("atxHeadingSequence"),c(g)):s(g)}function c(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Pe(g)?(e.exit("atxHeading"),r(g)):tt(g)?at(e,c,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),c(g))}function f(g){return g===null||g===35||yt(g)?(e.exit("atxHeadingText"),c(g)):(e.consume(g),f)}}const Jk=["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"],zb=["pre","script","style","textarea"],eE={concrete:!0,name:"htmlFlow",resolveTo:rE,tokenize:sE},tE={partial:!0,tokenize:aE},nE={partial:!0,tokenize:iE};function rE(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 sE(e,r,s){const i=this;let l,u,h,c,d;return f;function f(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),v):U===47?(e.consume(U),u=!0,C):U===63?(e.consume(U),l=3,i.interrupt?r:L):gn(U)?(e.consume(U),h=String.fromCharCode(U),y):s(U)}function v(U){return U===45?(e.consume(U),l=2,S):U===91?(e.consume(U),l=5,c=0,k):gn(U)?(e.consume(U),l=4,i.interrupt?r:L):s(U)}function S(U){return U===45?(e.consume(U),i.interrupt?r:L):s(U)}function k(U){const ne="CDATA[";return U===ne.charCodeAt(c++)?(e.consume(U),c===ne.length?i.interrupt?r:q:k):s(U)}function C(U){return gn(U)?(e.consume(U),h=String.fromCharCode(U),y):s(U)}function y(U){if(U===null||U===47||U===62||yt(U)){const ne=U===47,Q=h.toLowerCase();return!ne&&!u&&zb.includes(Q)?(l=1,i.interrupt?r(U):q(U)):Jk.includes(h.toLowerCase())?(l=6,ne?(e.consume(U),b):i.interrupt?r(U):q(U)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?s(U):u?x(U):_(U))}return U===45||fn(U)?(e.consume(U),h+=String.fromCharCode(U),y):s(U)}function b(U){return U===62?(e.consume(U),i.interrupt?r:q):s(U)}function x(U){return tt(U)?(e.consume(U),x):O(U)}function _(U){return U===47?(e.consume(U),O):U===58||U===95||gn(U)?(e.consume(U),j):tt(U)?(e.consume(U),_):O(U)}function j(U){return U===45||U===46||U===58||U===95||fn(U)?(e.consume(U),j):T(U)}function T(U){return U===61?(e.consume(U),N):tt(U)?(e.consume(U),T):_(U)}function N(U){return U===null||U===60||U===61||U===62||U===96?s(U):U===34||U===39?(e.consume(U),d=U,D):tt(U)?(e.consume(U),N):A(U)}function D(U){return U===d?(e.consume(U),d=null,P):U===null||Pe(U)?s(U):(e.consume(U),D)}function A(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||yt(U)?T(U):(e.consume(U),A)}function P(U){return U===47||U===62||tt(U)?_(U):s(U)}function O(U){return U===62?(e.consume(U),H):s(U)}function H(U){return U===null||Pe(U)?q(U):tt(U)?(e.consume(U),H):s(U)}function q(U){return U===45&&l===2?(e.consume(U),F):U===60&&l===1?(e.consume(U),Z):U===62&&l===4?(e.consume(U),R):U===63&&l===3?(e.consume(U),L):U===93&&l===5?(e.consume(U),I):Pe(U)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(tE,$,W)(U)):U===null||Pe(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),q)}function W(U){return e.check(nE,G,$)(U)}function G(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),B}function B(U){return U===null||Pe(U)?W(U):(e.enter("htmlFlowData"),q(U))}function F(U){return U===45?(e.consume(U),L):q(U)}function Z(U){return U===47?(e.consume(U),h="",Y):q(U)}function Y(U){if(U===62){const ne=h.toLowerCase();return zb.includes(ne)?(e.consume(U),R):q(U)}return gn(U)&&h.length<8?(e.consume(U),h+=String.fromCharCode(U),Y):q(U)}function I(U){return U===93?(e.consume(U),L):q(U)}function L(U){return U===62?(e.consume(U),R):U===45&&l===2?(e.consume(U),L):q(U)}function R(U){return U===null||Pe(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),R)}function $(U){return e.exit("htmlFlow"),r(U)}}function iE(e,r,s){const i=this;return l;function l(h){return Pe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):s(h)}function u(h){return i.parser.lazy[i.now().line]?s(h):r(h)}}function aE(e,r,s){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(ho,r,s)}}const oE={name:"htmlText",tokenize:lE};function lE(e,r,s){const i=this;let l,u,h;return c;function c(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),T):L===63?(e.consume(L),_):gn(L)?(e.consume(L),A):s(L)}function f(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,k):gn(L)?(e.consume(L),x):s(L)}function g(L){return L===45?(e.consume(L),S):s(L)}function m(L){return L===null?s(L):L===45?(e.consume(L),v):Pe(L)?(h=m,Z(L)):(e.consume(L),m)}function v(L){return L===45?(e.consume(L),S):m(L)}function S(L){return L===62?F(L):L===45?v(L):m(L)}function k(L){const R="CDATA[";return L===R.charCodeAt(u++)?(e.consume(L),u===R.length?C:k):s(L)}function C(L){return L===null?s(L):L===93?(e.consume(L),y):Pe(L)?(h=C,Z(L)):(e.consume(L),C)}function y(L){return L===93?(e.consume(L),b):C(L)}function b(L){return L===62?F(L):L===93?(e.consume(L),b):C(L)}function x(L){return L===null||L===62?F(L):Pe(L)?(h=x,Z(L)):(e.consume(L),x)}function _(L){return L===null?s(L):L===63?(e.consume(L),j):Pe(L)?(h=_,Z(L)):(e.consume(L),_)}function j(L){return L===62?F(L):_(L)}function T(L){return gn(L)?(e.consume(L),N):s(L)}function N(L){return L===45||fn(L)?(e.consume(L),N):D(L)}function D(L){return Pe(L)?(h=D,Z(L)):tt(L)?(e.consume(L),D):F(L)}function A(L){return L===45||fn(L)?(e.consume(L),A):L===47||L===62||yt(L)?P(L):s(L)}function P(L){return L===47?(e.consume(L),F):L===58||L===95||gn(L)?(e.consume(L),O):Pe(L)?(h=P,Z(L)):tt(L)?(e.consume(L),P):F(L)}function O(L){return L===45||L===46||L===58||L===95||fn(L)?(e.consume(L),O):H(L)}function H(L){return L===61?(e.consume(L),q):Pe(L)?(h=H,Z(L)):tt(L)?(e.consume(L),H):P(L)}function q(L){return L===null||L===60||L===61||L===62||L===96?s(L):L===34||L===39?(e.consume(L),l=L,W):Pe(L)?(h=q,Z(L)):tt(L)?(e.consume(L),q):(e.consume(L),G)}function W(L){return L===l?(e.consume(L),l=void 0,B):L===null?s(L):Pe(L)?(h=W,Z(L)):(e.consume(L),W)}function G(L){return L===null||L===34||L===39||L===60||L===61||L===96?s(L):L===47||L===62||yt(L)?P(L):(e.consume(L),G)}function B(L){return L===47||L===62||yt(L)?P(L):s(L)}function F(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):s(L)}function Z(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Y}function Y(L){return tt(L)?at(e,I,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return e.enter("htmlTextData"),h(L)}}const Jh={name:"labelEnd",resolveAll:hE,resolveTo:fE,tokenize:pE},cE={tokenize:mE},uE={tokenize:gE},dE={tokenize:xE};function hE(e){let r=-1;const s=[];for(;++r<e.length;){const i=e[r][1];if(s.push(e[r]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const l=i.type==="labelImage"?4:2;i.type="data",r+=l}}return e.length!==s.length&&In(e,0,e.length,s),e}function fE(e,r){let s=e.length,i=0,l,u,h,c;for(;s--;)if(l=e[s][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[s][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(h){if(e[s][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=s,l.type!=="labelLink")){i=2;break}}else l.type==="labelEnd"&&(h=s);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[h][1].end}},g={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[h-2][1].start}};return c=[["enter",d,r],["enter",f,r]],c=Yn(c,e.slice(u+1,u+i+3)),c=Yn(c,[["enter",g,r]]),c=Yn(c,oc(r.parser.constructs.insideSpan.null,e.slice(u+i+4,h-3),r)),c=Yn(c,[["exit",g,r],e[h-2],e[h-1],["exit",f,r]]),c=Yn(c,e.slice(h+1)),c=Yn(c,[["exit",d,r]]),In(e,u,e.length,c),e}function pE(e,r,s){const i=this;let l=i.events.length,u,h;for(;l--;)if((i.events[l][1].type==="labelImage"||i.events[l][1].type==="labelLink")&&!i.events[l][1]._balanced){u=i.events[l][1];break}return c;function c(v){return u?u._inactive?m(v):(h=i.parser.defined.includes(tr(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):s(v)}function d(v){return v===40?e.attempt(cE,g,h?g:m)(v):v===91?e.attempt(uE,g,h?f:m)(v):h?g(v):m(v)}function f(v){return e.attempt(dE,g,m)(v)}function g(v){return r(v)}function m(v){return u._balanced=!0,s(v)}}function mE(e,r,s){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),l}function l(m){return yt(m)?Xa(e,u)(m):u(m)}function u(m){return m===41?g(m):Fy(e,h,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function h(m){return yt(m)?Xa(e,d)(m):g(m)}function c(m){return s(m)}function d(m){return m===34||m===39||m===40?$y(e,f,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function f(m){return yt(m)?Xa(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):s(m)}}function gE(e,r,s){const i=this;return l;function l(c){return Uy.call(i,e,u,h,"reference","referenceMarker","referenceString")(c)}function u(c){return i.parser.defined.includes(tr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?r(c):s(c)}function h(c){return s(c)}}function xE(e,r,s){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):s(u)}}const bE={name:"labelStartImage",resolveAll:Jh.resolveAll,tokenize:vE};function vE(e,r,s){const i=this;return l;function l(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),u}function u(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),h):s(c)}function h(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?s(c):r(c)}}const yE={name:"labelStartLink",resolveAll:Jh.resolveAll,tokenize:_E};function _E(e,r,s){const i=this;return l;function l(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelLink"),u}function u(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?s(h):r(h)}}const Wd={name:"lineEnding",tokenize:SE};function SE(e,r){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),at(e,r,"linePrefix")}}const zl={name:"thematicBreak",tokenize:wE};function wE(e,r,s){let i=0,l;return u;function u(f){return e.enter("thematicBreak"),h(f)}function h(f){return l=f,c(f)}function c(f){return f===l?(e.enter("thematicBreakSequence"),d(f)):i>=3&&(f===null||Pe(f))?(e.exit("thematicBreak"),r(f)):s(f)}function d(f){return f===l?(e.consume(f),i++,d):(e.exit("thematicBreakSequence"),tt(f)?at(e,c,"whitespace")(f):c(f))}}const Cn={continuation:{tokenize:jE},exit:TE,name:"list",tokenize:EE},CE={partial:!0,tokenize:AE},kE={partial:!0,tokenize:NE};function EE(e,r,s){const i=this,l=i.events[i.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,h=0;return c;function c(S){const k=i.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||S===i.containerState.marker:xh(S)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(zl,s,f)(S):f(S);if(!i.interrupt||S===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(S)}return s(S)}function d(S){return xh(S)&&++h<10?(e.consume(S),d):(!i.interrupt||h<2)&&(i.containerState.marker?S===i.containerState.marker:S===41||S===46)?(e.exit("listItemValue"),f(S)):s(S)}function f(S){return e.enter("listItemMarker"),e.consume(S),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||S,e.check(ho,i.interrupt?s:g,e.attempt(CE,v,m))}function g(S){return i.containerState.initialBlankLine=!0,u++,v(S)}function m(S){return tt(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),v):s(S)}function v(S){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(S)}}function jE(e,r,s){const i=this;return i.containerState._closeFlow=void 0,e.check(ho,l,u);function l(c){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,at(e,r,"listItemIndent",i.containerState.size+1)(c)}function u(c){return i.containerState.furtherBlankLines||!tt(c)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,h(c)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(kE,r,h)(c))}function h(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,at(e,e.attempt(Cn,r,s),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function NE(e,r,s){const i=this;return at(e,l,"listItemIndent",i.containerState.size+1);function l(u){const h=i.events[i.events.length-1];return h&&h[1].type==="listItemIndent"&&h[2].sliceSerialize(h[1],!0).length===i.containerState.size?r(u):s(u)}}function TE(e){e.exit(this.containerState.type)}function AE(e,r,s){const i=this;return at(e,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const h=i.events[i.events.length-1];return!tt(u)&&h&&h[1].type==="listItemPrefixWhitespace"?r(u):s(u)}}const Pb={name:"setextUnderline",resolveTo:DE,tokenize:RE};function DE(e,r){let s=e.length,i,l,u;for(;s--;)if(e[s][0]==="enter"){if(e[s][1].type==="content"){i=s;break}e[s][1].type==="paragraph"&&(l=s)}else e[s][1].type==="content"&&e.splice(s,1),!u&&e[s][1].type==="definition"&&(u=s);const h={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",h,r]),e.splice(u+1,0,["exit",e[i][1],r]),e[i][1].end={...e[u][1].end}):e[i][1]=h,e.push(["exit",h,r]),e}function RE(e,r,s){const i=this;let l;return u;function u(f){let g=i.events.length,m;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){m=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),l=f,h(f)):s(f)}function h(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===l?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),tt(f)?at(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Pe(f)?(e.exit("setextHeadingLine"),r(f)):s(f)}}const LE={tokenize:OE};function OE(e){const r=this,s=e.attempt(ho,i,e.attempt(this.parser.constructs.flowInitial,l,at(e,e.attempt(this.parser.constructs.flow,l,e.attempt(Pk,l)),"linePrefix")));return s;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,s}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,s}}const ME={resolveAll:Wy()},IE=qy("string"),BE=qy("text");function qy(e){return{resolveAll:Wy(e==="text"?zE:void 0),tokenize:r};function r(s){const i=this,l=this.parser.constructs[e],u=s.attempt(l,h,c);return h;function h(g){return f(g)?u(g):c(g)}function c(g){if(g===null){s.consume(g);return}return s.enter("data"),s.consume(g),d}function d(g){return f(g)?(s.exit("data"),u(g)):(s.consume(g),d)}function f(g){if(g===null)return!0;const m=l[g];let v=-1;if(m)for(;++v<m.length;){const S=m[v];if(!S.previous||S.previous.call(i,i.previous))return!0}return!1}}}function Wy(e){return r;function r(s,i){let l=-1,u;for(;++l<=s.length;)u===void 0?s[l]&&s[l][1].type==="data"&&(u=l,l++):(!s[l]||s[l][1].type!=="data")&&(l!==u+2&&(s[u][1].end=s[l-1][1].end,s.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(s,i):s}}function zE(e,r){let s=0;for(;++s<=e.length;)if((s===e.length||e[s][1].type==="lineEnding")&&e[s-1][1].type==="data"){const i=e[s-1][1],l=r.sliceStream(i);let u=l.length,h=-1,c=0,d;for(;u--;){const f=l[u];if(typeof f=="string"){for(h=f.length;f.charCodeAt(h-1)===32;)c++,h--;if(h)break;h=-1}else if(f===-2)d=!0,c++;else if(f!==-1){u++;break}}if(r._contentTypeTextTrailing&&s===e.length&&(c=0),c){const f={type:s===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?h:i.start._bufferIndex+h,_index:i.start._index+u,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(s,0,["enter",f,r],["exit",f,r]),s+=2)}s++}return e}const PE={42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:By},HE={91:qk},FE={[-2]:qd,[-1]:qd,32:qd},UE={35:Xk,42:zl,45:[Pb,zl],60:eE,61:Pb,95:zl,96:Bb,126:Bb},$E={38:Py,92:zy},qE={[-5]:Wd,[-4]:Wd,[-3]:Wd,33:bE,38:Py,42:bh,60:[yk,oE],91:yE,92:[Kk,zy],93:Jh,95:bh,96:Lk},WE={null:[bh,ME]},VE={null:[42,95]},GE={null:[]},KE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VE,contentInitial:HE,disable:GE,document:PE,flow:UE,flowInitial:FE,insideSpan:WE,string:$E,text:qE},Symbol.toStringTag,{value:"Module"}));function YE(e,r,s){let i={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const l={},u=[];let h=[],c=[];const d={attempt:D(T),check:D(N),consume:x,enter:_,exit:j,interrupt:D(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:v,sliceStream:S,write:m};let g=r.tokenize.call(f,d);return r.resolveAll&&u.push(r),f;function m(H){return h=Yn(h,H),y(),h[h.length-1]!==null?[]:(A(r,0),f.events=oc(u,f.events,f),f.events)}function v(H,q){return ZE(S(H),q)}function S(H){return XE(h,H)}function k(){const{_bufferIndex:H,_index:q,line:W,column:G,offset:B}=i;return{_bufferIndex:H,_index:q,line:W,column:G,offset:B}}function C(H){l[H.line]=H.column,O()}function y(){let H;for(;i._index<h.length;){const q=h[i._index];if(typeof q=="string")for(H=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===H&&i._bufferIndex<q.length;)b(q.charCodeAt(i._bufferIndex));else b(q)}}function b(H){g=g(H)}function x(H){Pe(H)?(i.line++,i.column=1,i.offset+=H===-3?2:1,O()):H!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===h[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=H}function _(H,q){const W=q||{};return W.type=H,W.start=k(),f.events.push(["enter",W,f]),c.push(W),W}function j(H){const q=c.pop();return q.end=k(),f.events.push(["exit",q,f]),q}function T(H,q){A(H,q.from)}function N(H,q){q.restore()}function D(H,q){return W;function W(G,B,F){let Z,Y,I,L;return Array.isArray(G)?$(G):"tokenize"in G?$([G]):R(G);function R(ee){return X;function X(V){const ie=V!==null&&ee[V],re=V!==null&&ee.null,be=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(re)?re:re?[re]:[]];return $(be)(V)}}function $(ee){return Z=ee,Y=0,ee.length===0?F:U(ee[Y])}function U(ee){return X;function X(V){return L=P(),I=ee,ee.partial||(f.currentConstruct=ee),ee.name&&f.parser.constructs.disable.null.includes(ee.name)?Q():ee.tokenize.call(q?Object.assign(Object.create(f),q):f,d,ne,Q)(V)}}function ne(ee){return H(I,L),B}function Q(ee){return L.restore(),++Y<Z.length?U(Z[Y]):F}}}function A(H,q){H.resolveAll&&!u.includes(H)&&u.push(H),H.resolve&&In(f.events,q,f.events.length-q,H.resolve(f.events.slice(q),f)),H.resolveTo&&(f.events=H.resolveTo(f.events,f))}function P(){const H=k(),q=f.previous,W=f.currentConstruct,G=f.events.length,B=Array.from(c);return{from:G,restore:F};function F(){i=H,f.previous=q,f.currentConstruct=W,f.events.length=G,c=B,O()}}function O(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function XE(e,r){const s=r.start._index,i=r.start._bufferIndex,l=r.end._index,u=r.end._bufferIndex;let h;if(s===l)h=[e[s].slice(i,u)];else{if(h=e.slice(s,l),i>-1){const c=h[0];typeof c=="string"?h[0]=c.slice(i):h.shift()}u>0&&h.push(e[l].slice(0,u))}return h}function ZE(e,r){let s=-1;const i=[];let l;for(;++s<e.length;){const u=e[s];let h;if(typeof u=="string")h=u;else switch(u){case-5:{h="\r";break}case-4:{h=`
|
|
95
|
-
`;break}case-3:{h=`\r
|
|
96
|
-
`;break}case-2:{h=r?" ":" ";break}case-1:{if(!r&&l)continue;h=" ";break}default:h=String.fromCharCode(u)}l=u===-2,i.push(h)}return i.join("")}function QE(e){const i={constructs:My([KE,...(e||{}).extensions||[]]),content:l(fk),defined:[],document:l(mk),flow:l(LE),lazy:{},string:l(IE),text:l(BE)};return i;function l(u){return h;function h(c){return YE(i,u,c)}}}function JE(e){for(;!Hy(e););return e}const Hb=/[\0\t\n\r]/g;function ej(){let e=1,r="",s=!0,i;return l;function l(u,h,c){const d=[];let f,g,m,v,S;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(h||void 0).decode(u)),m=0,r="",s&&(u.charCodeAt(0)===65279&&m++,s=void 0);m<u.length;){if(Hb.lastIndex=m,f=Hb.exec(u),v=f&&f.index!==void 0?f.index:u.length,S=u.charCodeAt(v),!f){r=u.slice(m);break}if(S===10&&m===v&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),m<v&&(d.push(u.slice(m,v)),e+=v-m),S){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:i=!0,e=1}m=v+1}return c&&(i&&d.push(-5),r&&d.push(r),d.push(null)),d}}const tj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nj(e){return e.replace(tj,rj)}function rj(e,r,s){if(r)return r;if(s.charCodeAt(0)===35){const l=s.charCodeAt(1),u=l===120||l===88;return Iy(s.slice(u?2:1),u?16:10)}return no(s)||e}const Vy={}.hasOwnProperty;function sj(e,r,s){return r&&typeof r=="object"&&(s=r,r=void 0),ij(s)(JE(QE(s).document().write(ej()(e,r,!0))))}function ij(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ne),autolinkProtocol:P,autolinkEmail:P,atxHeading:u(ze),blockQuote:u(re),characterEscape:P,characterReference:P,codeFenced:u(be),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:u(be,h),codeText:u(ve,h),codeTextData:P,data:P,codeFlowValue:P,definition:u(Re),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:u(Oe),hardBreakEscape:u(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(Te,h),htmlFlowData:P,htmlText:u(Te,h),htmlTextData:P,image:u(pe),label:h,link:u(Ne),listItem:u(Tt),listItemValue:v,listOrdered:u($e,m),listUnordered:u($e),paragraph:u(me),reference:U,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:u(ze),strong:u(je),thematicBreak:u(ht)},exit:{atxHeading:d(),atxHeadingSequence:T,autolink:d(),autolinkEmail:ie,autolinkProtocol:V,blockQuote:d(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:X,codeFenced:d(y),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:k,codeFlowValue:O,codeIndented:d(b),codeText:d(B),codeTextData:O,data:O,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:_,emphasis:d(),hardBreakEscape:d(q),hardBreakTrailing:d(q),htmlFlow:d(W),htmlFlowData:O,htmlText:d(G),htmlTextData:O,image:d(Z),label:I,labelText:Y,lineEnding:H,link:d(F),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ne,resourceDestinationString:L,resourceTitleString:R,resource:$,setextHeading:d(A),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};Gy(r,(e||{}).mdastExtensions||[]);const s={};return i;function i(ce){let _e={type:"root",children:[]};const Ae={stack:[_e],tokenStack:[],config:r,enter:c,exit:f,buffer:h,resume:g,data:s},Ie=[];let Ve=-1;for(;++Ve<ce.length;)if(ce[Ve][1].type==="listOrdered"||ce[Ve][1].type==="listUnordered")if(ce[Ve][0]==="enter")Ie.push(Ve);else{const At=Ie.pop();Ve=l(ce,At,Ve)}for(Ve=-1;++Ve<ce.length;){const At=r[ce[Ve][0]];Vy.call(At,ce[Ve][1].type)&&At[ce[Ve][1].type].call(Object.assign({sliceSerialize:ce[Ve][2].sliceSerialize},Ae),ce[Ve][1])}if(Ae.tokenStack.length>0){const At=Ae.tokenStack[Ae.tokenStack.length-1];(At[1]||Fb).call(Ae,void 0,At[0])}for(_e.position={start:ls(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ls(ce.length>0?ce[ce.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 l(ce,_e,Ae){let Ie=_e-1,Ve=-1,At=!1,Qe,Mt,Dt,ue;for(;++Ie<=Ae;){const Ee=ce[Ie];switch(Ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ee[0]==="enter"?Ve++:Ve--,ue=void 0;break}case"lineEndingBlank":{Ee[0]==="enter"&&(Qe&&!ue&&!Ve&&!Dt&&(Dt=Ie),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!Ve&&Ee[0]==="enter"&&Ee[1].type==="listItemPrefix"||Ve===-1&&Ee[0]==="exit"&&(Ee[1].type==="listUnordered"||Ee[1].type==="listOrdered")){if(Qe){let Ge=Ie;for(Mt=void 0;Ge--;){const lt=ce[Ge];if(lt[1].type==="lineEnding"||lt[1].type==="lineEndingBlank"){if(lt[0]==="exit")continue;Mt&&(ce[Mt][1].type="lineEndingBlank",At=!0),lt[1].type="lineEnding",Mt=Ge}else if(!(lt[1].type==="linePrefix"||lt[1].type==="blockQuotePrefix"||lt[1].type==="blockQuotePrefixWhitespace"||lt[1].type==="blockQuoteMarker"||lt[1].type==="listItemIndent"))break}Dt&&(!Mt||Dt<Mt)&&(Qe._spread=!0),Qe.end=Object.assign({},Mt?ce[Mt][1].start:Ee[1].end),ce.splice(Mt||Ie,0,["exit",Qe,Ee[2]]),Ie++,Ae++}if(Ee[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},Ee[1].start),end:void 0};Qe=Ge,ce.splice(Ie,0,["enter",Ge,Ee[2]]),Ie++,Ae++,Dt=void 0,ue=!0}}}return ce[_e][1]._spread=At,Ae}function u(ce,_e){return Ae;function Ae(Ie){c.call(this,ce(Ie),Ie),_e&&_e.call(this,Ie)}}function h(){this.stack.push({type:"fragment",children:[]})}function c(ce,_e,Ae){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([_e,Ae||void 0]),ce.position={start:ls(_e.start),end:void 0}}function d(ce){return _e;function _e(Ae){ce&&ce.call(this,Ae),f.call(this,Ae)}}function f(ce,_e){const Ae=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ce.type&&(_e?_e.call(this,ce,Ie[0]):(Ie[1]||Fb).call(this,ce,Ie[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Ya({start:ce.start,end:ce.end})+"): it’s not open");Ae.position.end=ls(ce.end)}function g(){return Qh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(ce){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function S(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ce}function k(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ce}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce.replace(/(\r?\n|\r)$/g,"")}function x(ce){const _e=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=_e,Ae.identifier=tr(this.sliceSerialize(ce)).toLowerCase()}function _(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ce}function j(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ce}function T(ce){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Ae=this.sliceSerialize(ce).length;_e.depth=Ae}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ce){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function P(ce){const Ae=this.stack[this.stack.length-1].children;let Ie=Ae[Ae.length-1];(!Ie||Ie.type!=="text")&&(Ie=Me(),Ie.position={start:ls(ce.start),end:void 0},Ae.push(Ie)),this.stack.push(Ie)}function O(ce){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ce),_e.position.end=ls(ce.end)}function H(ce){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=_e.children[_e.children.length-1];Ae.position.end=ls(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(P.call(this,ce),O.call(this,ce))}function q(){this.data.atHardBreak=!0}function W(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function G(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function B(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function F(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=_e,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function Z(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=_e,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function Y(ce){const _e=this.sliceSerialize(ce),Ae=this.stack[this.stack.length-2];Ae.label=nj(_e),Ae.identifier=tr(_e).toLowerCase()}function I(){const ce=this.stack[this.stack.length-1],_e=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const Ie=ce.children;Ae.children=Ie}else Ae.alt=_e}function L(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ce}function R(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ce}function $(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ne(ce){const _e=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=_e,Ae.identifier=tr(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function Q(ce){this.data.characterReferenceType=ce.type}function ee(ce){const _e=this.sliceSerialize(ce),Ae=this.data.characterReferenceType;let Ie;Ae?(Ie=Iy(_e,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=no(_e);const Ve=this.stack[this.stack.length-1];Ve.value+=Ie}function X(ce){const _e=this.stack.pop();_e.position.end=ls(ce.end)}function V(ce){O.call(this,ce);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ce)}function ie(ce){O.call(this,ce);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ce)}function re(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function Re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oe(){return{type:"emphasis",children:[]}}function ze(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function Te(){return{type:"html",value:""}}function pe(){return{type:"image",title:null,url:"",alt:null}}function Ne(){return{type:"link",title:null,url:"",children:[]}}function $e(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Tt(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function me(){return{type:"paragraph",children:[]}}function je(){return{type:"strong",children:[]}}function Me(){return{type:"text",value:""}}function ht(){return{type:"thematicBreak"}}}function ls(e){return{line:e.line,column:e.column,offset:e.offset}}function Gy(e,r){let s=-1;for(;++s<r.length;){const i=r[s];Array.isArray(i)?Gy(e,i):aj(e,i)}}function aj(e,r){let s;for(s in r)if(Vy.call(r,s))switch(s){case"canContainEols":{const i=r[s];i&&e[s].push(...i);break}case"transforms":{const i=r[s];i&&e[s].push(...i);break}case"enter":case"exit":{const i=r[s];i&&Object.assign(e[s],i);break}}}function Fb(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Ya({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Ya({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Ya({start:r.start,end:r.end})+") is still open")}function oj(e){const r=this;r.parser=s;function s(i){return sj(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function lj(e,r){const s={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,s),e.applyData(r,s)}function cj(e,r){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,s),[e.applyData(r,s),{type:"text",value:`
|
|
97
|
-
`}]}function uj(e,r){const s=r.value?r.value+`
|
|
98
|
-
`:"",i={},l=r.lang?r.lang.split(/\s+/):[];l.length>0&&(i.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:s}]};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 dj(e,r){const s={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function hj(e,r){const s={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function fj(e,r){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(r.identifier).toUpperCase(),l=$i(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let h,c=e.footnoteCounts.get(i);c===void 0?(c=0,e.footnoteOrder.push(i),h=e.footnoteOrder.length):h=u+1,c+=1,e.footnoteCounts.set(i,c);const d={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+l,id:s+"fnref-"+l+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(h)}]};e.patch(r,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,f),e.applyData(r,f)}function pj(e,r){const s={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function mj(e,r){if(e.options.allowDangerousHtml){const s={type:"raw",value:r.value};return e.patch(r,s),e.applyData(r,s)}}function Ky(e,r){const s=r.referenceType;let i="]";if(s==="collapsed"?i+="[]":s==="full"&&(i+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+i}];const l=e.all(r),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const h=l[l.length-1];return h&&h.type==="text"?h.value+=i:l.push({type:"text",value:i}),l}function gj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Ky(e,r);const l={src:$i(i.url||""),alt:r.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,u),e.applyData(r,u)}function xj(e,r){const s={src:$i(r.url)};r.alt!==null&&r.alt!==void 0&&(s.alt=r.alt),r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(r,i),e.applyData(r,i)}function bj(e,r){const s={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,s);const i={type:"element",tagName:"code",properties:{},children:[s]};return e.patch(r,i),e.applyData(r,i)}function vj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Ky(e,r);const l={href:$i(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const u={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function yj(e,r){const s={href:$i(r.url)};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function _j(e,r,s){const i=e.all(r),l=s?Sj(s):Yy(r),u={},h=[];if(typeof r.checked=="boolean"){const g=i[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},i.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 c=-1;for(;++c<i.length;){const g=i[c];(l||c!==0||g.type!=="element"||g.tagName!=="p")&&h.push({type:"text",value:`
|
|
99
|
-
`}),g.type==="element"&&g.tagName==="p"&&!l?h.push(...g.children):h.push(g)}const d=i[i.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&h.push({type:"text",value:`
|
|
100
|
-
`});const f={type:"element",tagName:"li",properties:u,children:h};return e.patch(r,f),e.applyData(r,f)}function Sj(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const s=e.children;let i=-1;for(;!r&&++i<s.length;)r=Yy(s[i])}return r}function Yy(e){const r=e.spread;return r??e.children.length>1}function wj(e,r){const s={},i=e.all(r);let l=-1;for(typeof r.start=="number"&&r.start!==1&&(s.start=r.start);++l<i.length;){const h=i[l];if(h.type==="element"&&h.tagName==="li"&&h.properties&&Array.isArray(h.properties.className)&&h.properties.className.includes("task-list-item")){s.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:s,children:e.wrap(i,!0)};return e.patch(r,u),e.applyData(r,u)}function Cj(e,r){const s={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function kj(e,r){const s={type:"root",children:e.wrap(e.all(r))};return e.patch(r,s),e.applyData(r,s)}function Ej(e,r){const s={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function jj(e,r){const s=e.all(r),i=s.shift(),l=[];if(i){const h={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(r.children[0],h),l.push(h)}if(s.length>0){const h={type:"element",tagName:"tbody",properties:{},children:e.wrap(s,!0)},c=Kh(r.children[1]),d=Ny(r.children[r.children.length-1]);c&&d&&(h.position={start:c,end:d}),l.push(h)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(r,u),e.applyData(r,u)}function Nj(e,r,s){const i=s?s.children:void 0,u=(i?i.indexOf(r):1)===0?"th":"td",h=s&&s.type==="table"?s.align:void 0,c=h?h.length:r.children.length;let d=-1;const f=[];for(;++d<c;){const m=r.children[d],v={},S=h?h[d]:void 0;S&&(v.align=S);let k={type:"element",tagName:u,properties:v,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),f.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(r,g),e.applyData(r,g)}function Tj(e,r){const s={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}const Ub=9,$b=32;function Aj(e){const r=String(e),s=/\r?\n|\r/g;let i=s.exec(r),l=0;const u=[];for(;i;)u.push(qb(r.slice(l,i.index),l>0,!0),i[0]),l=i.index+i[0].length,i=s.exec(r);return u.push(qb(r.slice(l),l>0,!1)),u.join("")}function qb(e,r,s){let i=0,l=e.length;if(r){let u=e.codePointAt(i);for(;u===Ub||u===$b;)i++,u=e.codePointAt(i)}if(s){let u=e.codePointAt(l-1);for(;u===Ub||u===$b;)l--,u=e.codePointAt(l-1)}return l>i?e.slice(i,l):""}function Dj(e,r){const s={type:"text",value:Aj(String(r.value))};return e.patch(r,s),e.applyData(r,s)}function Rj(e,r){const s={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,s),e.applyData(r,s)}const Lj={blockquote:lj,break:cj,code:uj,delete:dj,emphasis:hj,footnoteReference:fj,heading:pj,html:mj,imageReference:gj,image:xj,inlineCode:bj,linkReference:vj,link:yj,listItem:_j,list:wj,paragraph:Cj,root:kj,strong:Ej,table:jj,tableCell:Tj,tableRow:Nj,text:Dj,thematicBreak:Rj,toml:Rl,yaml:Rl,definition:Rl,footnoteDefinition:Rl};function Rl(){}const Xy=-1,lc=0,Za=1,Vl=2,ef=3,tf=4,nf=5,rf=6,Zy=7,Qy=8,Wb=typeof self=="object"?self:globalThis,Oj=(e,r)=>{const s=(l,u)=>(e.set(u,l),l),i=l=>{if(e.has(l))return e.get(l);const[u,h]=r[l];switch(u){case lc:case Xy:return s(h,l);case Za:{const c=s([],l);for(const d of h)c.push(i(d));return c}case Vl:{const c=s({},l);for(const[d,f]of h)c[i(d)]=i(f);return c}case ef:return s(new Date(h),l);case tf:{const{source:c,flags:d}=h;return s(new RegExp(c,d),l)}case nf:{const c=s(new Map,l);for(const[d,f]of h)c.set(i(d),i(f));return c}case rf:{const c=s(new Set,l);for(const d of h)c.add(i(d));return c}case Zy:{const{name:c,message:d}=h;return s(new Wb[c](d),l)}case Qy:return s(BigInt(h),l);case"BigInt":return s(Object(BigInt(h)),l);case"ArrayBuffer":return s(new Uint8Array(h).buffer,h);case"DataView":{const{buffer:c}=new Uint8Array(h);return s(new DataView(c),h)}}return s(new Wb[u](h),l)};return i},Vb=e=>Oj(new Map,e)(0),Ti="",{toString:Mj}={},{keys:Ij}=Object,$a=e=>{const r=typeof e;if(r!=="object"||!e)return[lc,r];const s=Mj.call(e).slice(8,-1);switch(s){case"Array":return[Za,Ti];case"Object":return[Vl,Ti];case"Date":return[ef,Ti];case"RegExp":return[tf,Ti];case"Map":return[nf,Ti];case"Set":return[rf,Ti];case"DataView":return[Za,s]}return s.includes("Array")?[Za,s]:s.includes("Error")?[Zy,s]:[Vl,s]},Ll=([e,r])=>e===lc&&(r==="function"||r==="symbol"),Bj=(e,r,s,i)=>{const l=(h,c)=>{const d=i.push(h)-1;return s.set(c,d),d},u=h=>{if(s.has(h))return s.get(h);let[c,d]=$a(h);switch(c){case lc:{let g=h;switch(d){case"bigint":c=Qy,g=h.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([Xy],h)}return l([c,g],h)}case Za:{if(d){let v=h;return d==="DataView"?v=new Uint8Array(h.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(h)),l([d,[...v]],h)}const g=[],m=l([c,g],h);for(const v of h)g.push(u(v));return m}case Vl:{if(d)switch(d){case"BigInt":return l([d,h.toString()],h);case"Boolean":case"Number":case"String":return l([d,h.valueOf()],h)}if(r&&"toJSON"in h)return u(h.toJSON());const g=[],m=l([c,g],h);for(const v of Ij(h))(e||!Ll($a(h[v])))&&g.push([u(v),u(h[v])]);return m}case ef:return l([c,h.toISOString()],h);case tf:{const{source:g,flags:m}=h;return l([c,{source:g,flags:m}],h)}case nf:{const g=[],m=l([c,g],h);for(const[v,S]of h)(e||!(Ll($a(v))||Ll($a(S))))&&g.push([u(v),u(S)]);return m}case rf:{const g=[],m=l([c,g],h);for(const v of h)(e||!Ll($a(v)))&&g.push(u(v));return m}}const{message:f}=h;return l([c,{name:d,message:f}],h)};return u},Gb=(e,{json:r,lossy:s}={})=>{const i=[];return Bj(!(r||s),!!r,new Map,i)(e),i},Gl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Vb(Gb(e,r)):structuredClone(e):(e,r)=>Vb(Gb(e,r));function zj(e,r){const s=[{type:"text",value:"↩"}];return r>1&&s.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),s}function Pj(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function Hj(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=e.options.footnoteBackContent||zj,i=e.options.footnoteBackLabel||Pj,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",h=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const g=e.all(f),m=String(f.identifier).toUpperCase(),v=$i(m.toLowerCase());let S=0;const k=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++S<=C;){k.length>0&&k.push({type:"text",value:" "});let x=typeof s=="string"?s:s(d,S);typeof x=="string"&&(x={type:"text",value:x}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+v+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(d,S),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const y=g[g.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...k)}else g.push(...k);const b={type:"element",tagName:"li",properties:{id:r+"fn-"+v},children:e.wrap(g,!0)};e.patch(f,b),c.push(b)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Gl(h),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
101
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const cc=(function(e){if(e==null)return qj;if(typeof e=="function")return uc(e);if(typeof e=="object")return Array.isArray(e)?Fj(e):Uj(e);if(typeof e=="string")return $j(e);throw new Error("Expected function, string, or object as test")});function Fj(e){const r=[];let s=-1;for(;++s<e.length;)r[s]=cc(e[s]);return uc(i);function i(...l){let u=-1;for(;++u<r.length;)if(r[u].apply(this,l))return!0;return!1}}function Uj(e){const r=e;return uc(s);function s(i){const l=i;let u;for(u in e)if(l[u]!==r[u])return!1;return!0}}function $j(e){return uc(r);function r(s){return s&&s.type===e}}function uc(e){return r;function r(s,i,l){return!!(Wj(s)&&e.call(this,s,typeof i=="number"?i:void 0,l||void 0))}}function qj(){return!0}function Wj(e){return e!==null&&typeof e=="object"&&"type"in e}const Jy=[],Vj=!0,vh=!1,Gj="skip";function e0(e,r,s,i){let l;typeof r=="function"&&typeof s!="function"?(i=s,s=r):l=r;const u=cc(l),h=i?-1:1;c(e,void 0,[])();function c(d,f,g){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const S=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(S?"<"+S+">":""))+")"})}return v;function v(){let S=Jy,k,C,y;if((!r||u(d,f,g[g.length-1]||void 0))&&(S=Kj(s(d,g)),S[0]===vh))return S;if("children"in d&&d.children){const b=d;if(b.children&&S[0]!==Gj)for(C=(i?b.children.length:-1)+h,y=g.concat(b);C>-1&&C<b.children.length;){const x=b.children[C];if(k=c(x,C,y)(),k[0]===vh)return k;C=typeof k[1]=="number"?k[1]:C+h}}return S}}}function Kj(e){return Array.isArray(e)?e:typeof e=="number"?[Vj,e]:e==null?Jy:[e]}function sf(e,r,s,i){let l,u,h;typeof r=="function"&&typeof s!="function"?(u=void 0,h=r,l=s):(u=r,h=s,l=i),e0(e,u,c,l);function c(d,f){const g=f[f.length-1],m=g?g.children.indexOf(d):void 0;return h(d,m,g)}}const yh={}.hasOwnProperty,Yj={};function Xj(e,r){const s=r||Yj,i=new Map,l=new Map,u=new Map,h={...Lj,...s.handlers},c={all:f,applyData:Qj,definitionById:i,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:h,one:d,options:s,patch:Zj,wrap:eN};return sf(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?i:l,v=String(g.identifier).toUpperCase();m.has(v)||m.set(v,g)}}),c;function d(g,m){const v=g.type,S=c.handlers[v];if(yh.call(c.handlers,v)&&S)return S(c,g,m);if(c.options.passThrough&&c.options.passThrough.includes(v)){if("children"in g){const{children:C,...y}=g,b=Gl(y);return b.children=c.all(g),b}return Gl(g)}return(c.options.unknownHandler||Jj)(c,g,m)}function f(g){const m=[];if("children"in g){const v=g.children;let S=-1;for(;++S<v.length;){const k=c.one(v[S],g);if(k){if(S&&v[S-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Kb(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=Kb(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function Zj(e,r){e.position&&(r.position=P2(e))}function Qj(e,r){let s=r;if(e&&e.data){const i=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(s.type==="element")s.tagName=i;else{const h="children"in s?s.children:[s];s={type:"element",tagName:i,properties:{},children:h}}s.type==="element"&&u&&Object.assign(s.properties,Gl(u)),"children"in s&&s.children&&l!==null&&l!==void 0&&(s.children=l)}return s}function Jj(e,r){const s=r.data||{},i="value"in r&&!(yh.call(s,"hProperties")||yh.call(s,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function eN(e,r){const s=[];let i=-1;for(r&&s.push({type:"text",value:`
|
|
103
|
-
`});++i<e.length;)i&&s.push({type:"text",value:`
|
|
104
|
-
`}),s.push(e[i]);return r&&e.length>0&&s.push({type:"text",value:`
|
|
105
|
-
`}),s}function Kb(e){let r=0,s=e.charCodeAt(r);for(;s===9||s===32;)r++,s=e.charCodeAt(r);return e.slice(r)}function Yb(e,r){const s=Xj(e,r),i=s.one(e,void 0),l=Hj(s),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
106
|
-
`},l),u}function tN(e,r){return e&&"run"in e?async function(s,i){const l=Yb(s,{file:i,...r});await e.run(l,i)}:function(s,i){return Yb(s,{file:i,...e||r})}}function Xb(e){if(e)throw e}var Vd,Zb;function nN(){if(Zb)return Vd;Zb=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):r.call(f)==="[object Array]"},u=function(f){if(!f||r.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!m)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},h=function(f,g){s&&g.name==="__proto__"?s(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},c=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(i)return i(f,g).value}else return;return f[g]};return Vd=function d(){var f,g,m,v,S,k,C=arguments[0],y=1,b=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});y<b;++y)if(f=arguments[y],f!=null)for(g in f)m=c(C,g),v=c(f,g),C!==v&&(x&&v&&(u(v)||(S=l(v)))?(S?(S=!1,k=m&&l(m)?m:[]):k=m&&u(m)?m:{},h(C,{name:g,newValue:d(x,k,v)})):typeof v<"u"&&h(C,{name:g,newValue:v}));return C},Vd}var rN=nN();const Gd=Zl(rN);function _h(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 sN(){const e=[],r={run:s,use:i};return r;function s(...l){let u=-1;const h=l.pop();if(typeof h!="function")throw new TypeError("Expected function as last argument, not "+h);c(null,...l);function c(d,...f){const g=e[++u];let m=-1;if(d){h(d);return}for(;++m<l.length;)(f[m]===null||f[m]===void 0)&&(f[m]=l[m]);l=f,g?iN(g,c)(...f):h(null,...f)}}function i(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),r}}function iN(e,r){let s;return i;function i(...h){const c=e.length>h.length;let d;c&&h.push(l);try{d=e.apply(this,h)}catch(f){const g=f;if(c&&s)throw g;return l(g)}c||(d&&d.then&&typeof d.then=="function"?d.then(u,l):d instanceof Error?l(d):u(d))}function l(h,...c){s||(s=!0,r(h,...c))}function u(h){l(null,h)}}const cr={basename:aN,dirname:oN,extname:lN,join:cN,sep:"/"};function aN(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');fo(e);let s=0,i=-1,l=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){s=l+1;break}}else i<0&&(u=!0,i=l+1);return i<0?"":e.slice(s,i)}if(r===e)return"";let h=-1,c=r.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){s=l+1;break}}else h<0&&(u=!0,h=l+1),c>-1&&(e.codePointAt(l)===r.codePointAt(c--)?c<0&&(i=l):(c=-1,i=h));return s===i?i=h:i<0&&(i=e.length),e.slice(s,i)}function oN(e){if(fo(e),e.length===0)return".";let r=-1,s=e.length,i;for(;--s;)if(e.codePointAt(s)===47){if(i){r=s;break}}else i||(i=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function lN(e){fo(e);let r=e.length,s=-1,i=0,l=-1,u=0,h;for(;r--;){const c=e.codePointAt(r);if(c===47){if(h){i=r+1;break}continue}s<0&&(h=!0,s=r+1),c===46?l<0?l=r:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||s<0||u===0||u===1&&l===s-1&&l===i+1?"":e.slice(l,s)}function cN(...e){let r=-1,s;for(;++r<e.length;)fo(e[r]),e[r]&&(s=s===void 0?e[r]:s+"/"+e[r]);return s===void 0?".":uN(s)}function uN(e){fo(e);const r=e.codePointAt(0)===47;let s=dN(e,!r);return s.length===0&&!r&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),r?"/"+s:s}function dN(e,r){let s="",i=0,l=-1,u=0,h=-1,c,d;for(;++h<=e.length;){if(h<e.length)c=e.codePointAt(h);else{if(c===47)break;c=47}if(c===47){if(!(l===h-1||u===1))if(l!==h-1&&u===2){if(s.length<2||i!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(d=s.lastIndexOf("/"),d!==s.length-1){d<0?(s="",i=0):(s=s.slice(0,d),i=s.length-1-s.lastIndexOf("/")),l=h,u=0;continue}}else if(s.length>0){s="",i=0,l=h,u=0;continue}}r&&(s=s.length>0?s+"/..":"..",i=2)}else s.length>0?s+="/"+e.slice(l+1,h):s=e.slice(l+1,h),i=h-l-1;l=h,u=0}else c===46&&u>-1?u++:u=-1}return s}function fo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hN={cwd:fN};function fN(){return"/"}function Sh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pN(e){if(typeof e=="string")e=new URL(e);else if(!Sh(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 mN(e)}function mN(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const r=e.pathname;let s=-1;for(;++s<r.length;)if(r.codePointAt(s)===37&&r.codePointAt(s+1)===50){const i=r.codePointAt(s+2);if(i===70||i===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(r)}const Kd=["history","path","basename","stem","extname","dirname"];class t0{constructor(r){let s;r?Sh(r)?s={path:r}:typeof r=="string"||gN(r)?s={value:r}:s=r:s={},this.cwd="cwd"in s?"":hN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Kd.length;){const u=Kd[i];u in s&&s[u]!==void 0&&s[u]!==null&&(this[u]=u==="history"?[...s[u]]:s[u])}let l;for(l in s)Kd.includes(l)||(this[l]=s[l])}get basename(){return typeof this.path=="string"?cr.basename(this.path):void 0}set basename(r){Xd(r,"basename"),Yd(r,"basename"),this.path=cr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?cr.dirname(this.path):void 0}set dirname(r){Qb(this.basename,"dirname"),this.path=cr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?cr.extname(this.path):void 0}set extname(r){if(Yd(r,"extname"),Qb(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=cr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Sh(r)&&(r=pN(r)),Xd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?cr.basename(this.path,this.extname):void 0}set stem(r){Xd(r,"stem"),Yd(r,"stem"),this.path=cr.join(this.dirname||"",r+(this.extname||""))}fail(r,s,i){const l=this.message(r,s,i);throw l.fatal=!0,l}info(r,s,i){const l=this.message(r,s,i);return l.fatal=void 0,l}message(r,s,i){const l=new pn(r,s,i);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Yd(e,r){if(e&&e.includes(cr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+cr.sep+"`")}function Xd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Qb(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function gN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xN=(function(e){const i=this.constructor.prototype,l=i[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),bN={}.hasOwnProperty;class af extends xN{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=sN()}copy(){const r=new af;let s=-1;for(;++s<this.attachers.length;){const i=this.attachers[s];r.use(...i)}return r.data(Gd(!0,{},this.namespace)),r}data(r,s){return typeof r=="string"?arguments.length===2?(Jd("data",this.frozen),this.namespace[r]=s,this):bN.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Jd("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[s,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const l=s.call(r,...i);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const s=Ol(r),i=this.parser||this.Parser;return Zd("parse",i),i(String(s),s)}process(r,s){const i=this;return this.freeze(),Zd("process",this.parser||this.Parser),Qd("process",this.compiler||this.Compiler),s?l(void 0,s):new Promise(l);function l(u,h){const c=Ol(r),d=i.parse(c);i.run(d,c,function(g,m,v){if(g||!m||!v)return f(g);const S=m,k=i.stringify(S,v);_N(k)?v.value=k:v.result=k,f(g,v)});function f(g,m){g||!m?h(g):u?u(m):s(void 0,m)}}}processSync(r){let s=!1,i;return this.freeze(),Zd("processSync",this.parser||this.Parser),Qd("processSync",this.compiler||this.Compiler),this.process(r,l),ev("processSync","process",s),i;function l(u,h){s=!0,Xb(u),i=h}}run(r,s,i){Jb(r),this.freeze();const l=this.transformers;return!i&&typeof s=="function"&&(i=s,s=void 0),i?u(void 0,i):new Promise(u);function u(h,c){const d=Ol(s);l.run(r,d,f);function f(g,m,v){const S=m||r;g?c(g):h?h(S):i(void 0,S,v)}}}runSync(r,s){let i=!1,l;return this.run(r,s,u),ev("runSync","run",i),l;function u(h,c){Xb(h),l=c,i=!0}}stringify(r,s){this.freeze();const i=Ol(s),l=this.compiler||this.Compiler;return Qd("stringify",l),Jb(r),l(r,i)}use(r,...s){const i=this.attachers,l=this.namespace;if(Jd("use",this.frozen),r!=null)if(typeof r=="function")d(r,s);else if(typeof r=="object")Array.isArray(r)?c(r):h(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...m]=f;d(g,m)}else h(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function h(f){if(!("plugins"in f)&&!("settings"in f))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");c(f.plugins),f.settings&&(l.settings=Gd(!0,l.settings,f.settings))}function c(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const m=f[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,g){let m=-1,v=-1;for(;++m<i.length;)if(i[m][0]===f){v=m;break}if(v===-1)i.push([f,...g]);else if(g.length>0){let[S,...k]=g;const C=i[v][1];_h(C)&&_h(S)&&(S=Gd(!0,C,S)),i[v]=[f,S,...k]}}}}const vN=new af().freeze();function Zd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Jd(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 Jb(e){if(!_h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ev(e,r,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Ol(e){return yN(e)?e:new t0(e)}function yN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _N(e){return typeof e=="string"||SN(e)}function SN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tv=[],nv={allowDangerousHtml:!0},CN=/^(https?|ircs?|mailto|xmpp)$/i,kN=[{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 EN(e){const r=jN(e),s=NN(e);return TN(r.runSync(r.parse(s),s),e)}function jN(e){const r=e.rehypePlugins||tv,s=e.remarkPlugins||tv,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nv}:nv;return vN().use(oj).use(s).use(tN,i).use(r)}function NN(e){const r=e.children||"",s=new t0;return typeof r=="string"&&(s.value=r),s}function TN(e,r){const s=r.allowedElements,i=r.allowElement,l=r.components,u=r.disallowedElements,h=r.skipHtml,c=r.unwrapDisallowed,d=r.urlTransform||AN;for(const g of kN)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+wN+g.id,void 0);return sf(e,f),q2(e,{Fragment:o.Fragment,components:l,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(g,m,v){if(g.type==="raw"&&v&&typeof m=="number")return h?v.children.splice(m,1):v.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let S;for(S in $d)if(Object.hasOwn($d,S)&&Object.hasOwn(g.properties,S)){const k=g.properties[S],C=$d[S];(C===null||C.includes(g.tagName))&&(g.properties[S]=d(String(k||""),S,g))}}if(g.type==="element"){let S=s?!s.includes(g.tagName):u?u.includes(g.tagName):!1;if(!S&&i&&typeof m=="number"&&(S=!i(g,m,v)),S&&v&&typeof m=="number")return c&&g.children?v.children.splice(m,1,...g.children):v.children.splice(m,1),m}}}function AN(e){const r=e.indexOf(":"),s=e.indexOf("?"),i=e.indexOf("#"),l=e.indexOf("/");return r===-1||l!==-1&&r>l||s!==-1&&r>s||i!==-1&&r>i||CN.test(e.slice(0,r))?e:""}function rv(e,r){const s=String(e);if(typeof r!="string")throw new TypeError("Expected character");let i=0,l=s.indexOf(r);for(;l!==-1;)i++,l=s.indexOf(r,l+r.length);return i}function DN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RN(e,r,s){const l=cc((s||{}).ignore||[]),u=LN(r);let h=-1;for(;++h<u.length;)e0(e,"text",c);function c(f,g){let m=-1,v;for(;++m<g.length;){const S=g[m],k=v?v.children:void 0;if(l(S,k?k.indexOf(S):void 0,v))return;v=S}if(v)return d(f,g)}function d(f,g){const m=g[g.length-1],v=u[h][0],S=u[h][1];let k=0;const y=m.children.indexOf(f);let b=!1,x=[];v.lastIndex=0;let _=v.exec(f.value);for(;_;){const j=_.index,T={index:_.index,input:_.input,stack:[...g,f]};let N=S(..._,T);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?v.lastIndex=j+1:(k!==j&&x.push({type:"text",value:f.value.slice(k,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),k=j+_[0].length,b=!0),!v.global)break;_=v.exec(f.value)}return b?(k<f.value.length&&x.push({type:"text",value:f.value.slice(k)}),m.children.splice(y,1,...x)):x=[f],y+x.length}}function LN(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const s=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<s.length;){const l=s[i];r.push([ON(l[0]),MN(l[1])])}return r}function ON(e){return typeof e=="string"?new RegExp(DN(e),"g"):e}function MN(e){return typeof e=="function"?e:function(){return e}}const eh="phrasing",th=["autolink","link","image","label"];function IN(){return{transforms:[$N],enter:{literalAutolink:zN,literalAutolinkEmail:nh,literalAutolinkHttp:nh,literalAutolinkWww:nh},exit:{literalAutolink:UN,literalAutolinkEmail:FN,literalAutolinkHttp:PN,literalAutolinkWww:HN}}}function BN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:eh,notInConstruct:th},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:eh,notInConstruct:th},{character:":",before:"[ps]",after:"\\/",inConstruct:eh,notInConstruct:th}]}}function zN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function nh(e){this.config.enter.autolinkProtocol.call(this,e)}function PN(e){this.config.exit.autolinkProtocol.call(this,e)}function HN(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 FN(e){this.config.exit.autolinkEmail.call(this,e)}function UN(e){this.exit(e)}function $N(e){RN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),WN]],{ignore:["link","linkReference"]})}function qN(e,r,s,i,l){let u="";if(!n0(l)||(/^w/i.test(r)&&(s=r+s,r="",u="http://"),!VN(s)))return!1;const h=GN(s+i);if(!h[0])return!1;const c={type:"link",title:null,url:u+r+h[0],children:[{type:"text",value:r+h[0]}]};return h[1]?[c,{type:"text",value:h[1]}]:c}function WN(e,r,s,i){return!n0(i,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+s,children:[{type:"text",value:r+"@"+s}]}}function VN(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 GN(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let s=r[0],i=s.indexOf(")");const l=rv(e,"(");let u=rv(e,")");for(;i!==-1&&l>u;)e+=s.slice(0,i+1),s=s.slice(i+1),i=s.indexOf(")"),u++;return[e,s]}function n0(e,r){const s=e.input.charCodeAt(e.index-1);return(e.index===0||Ps(s)||ac(s))&&(!r||s!==47)}r0.peek=nT;function KN(){this.buffer()}function YN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function XN(){this.buffer()}function ZN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function QN(e){const r=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=tr(this.sliceSerialize(e)).toLowerCase(),s.label=r}function JN(e){this.exit(e)}function eT(e){const r=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=tr(this.sliceSerialize(e)).toLowerCase(),s.label=r}function tT(e){this.exit(e)}function nT(){return"["}function r0(e,r,s,i){const l=s.createTracker(i);let u=l.move("[^");const h=s.enter("footnoteReference"),c=s.enter("reference");return u+=l.move(s.safe(s.associationId(e),{after:"]",before:u})),c(),h(),u+=l.move("]"),u}function rT(){return{enter:{gfmFootnoteCallString:KN,gfmFootnoteCall:YN,gfmFootnoteDefinitionLabelString:XN,gfmFootnoteDefinition:ZN},exit:{gfmFootnoteCallString:QN,gfmFootnoteCall:JN,gfmFootnoteDefinitionLabelString:eT,gfmFootnoteDefinition:tT}}}function sT(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:s,footnoteReference:r0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function s(i,l,u,h){const c=u.createTracker(h);let d=c.move("[^");const f=u.enter("footnoteDefinition"),g=u.enter("label");return d+=c.move(u.safe(u.associationId(i),{before:d,after:"]"})),g(),d+=c.move("]:"),i.children&&i.children.length>0&&(c.shift(4),d+=c.move((r?`
|
|
107
|
-
`:" ")+u.indentLines(u.containerFlow(i,c.current()),r?s0:iT))),f(),d}}function iT(e,r,s){return r===0?e:s0(e,r,s)}function s0(e,r,s){return(s?"":" ")+e}const aT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];i0.peek=dT;function oT(){return{canContainEols:["delete"],enter:{strikethrough:cT},exit:{strikethrough:uT}}}function lT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:aT}],handlers:{delete:i0}}}function cT(e){this.enter({type:"delete",children:[]},e)}function uT(e){this.exit(e)}function i0(e,r,s,i){const l=s.createTracker(i),u=s.enter("strikethrough");let h=l.move("~~");return h+=s.containerPhrasing(e,{...l.current(),before:h,after:"~"}),h+=l.move("~~"),u(),h}function dT(){return"~"}function hT(e){return e.length}function fT(e,r){const s=r||{},i=(s.align||[]).concat(),l=s.stringLength||hT,u=[],h=[],c=[],d=[];let f=0,g=-1;for(;++g<e.length;){const C=[],y=[];let b=-1;for(e[g].length>f&&(f=e[g].length);++b<e[g].length;){const x=pT(e[g][b]);if(s.alignDelimiters!==!1){const _=l(x);y[b]=_,(d[b]===void 0||_>d[b])&&(d[b]=_)}C.push(x)}h[g]=C,c[g]=y}let m=-1;if(typeof i=="object"&&"length"in i)for(;++m<f;)u[m]=sv(i[m]);else{const C=sv(i);for(;++m<f;)u[m]=C}m=-1;const v=[],S=[];for(;++m<f;){const C=u[m];let y="",b="";C===99?(y=":",b=":"):C===108?y=":":C===114&&(b=":");let x=s.alignDelimiters===!1?1:Math.max(1,d[m]-y.length-b.length);const _=y+"-".repeat(x)+b;s.alignDelimiters!==!1&&(x=y.length+x+b.length,x>d[m]&&(d[m]=x),S[m]=x),v[m]=_}h.splice(1,0,v),c.splice(1,0,S),g=-1;const k=[];for(;++g<h.length;){const C=h[g],y=c[g];m=-1;const b=[];for(;++m<f;){const x=C[m]||"";let _="",j="";if(s.alignDelimiters!==!1){const T=d[m]-(y[m]||0),N=u[m];N===114?_=" ".repeat(T):N===99?T%2?(_=" ".repeat(T/2+.5),j=" ".repeat(T/2-.5)):(_=" ".repeat(T/2),j=_):j=" ".repeat(T)}s.delimiterStart!==!1&&!m&&b.push("|"),s.padding!==!1&&!(s.alignDelimiters===!1&&x==="")&&(s.delimiterStart!==!1||m)&&b.push(" "),s.alignDelimiters!==!1&&b.push(_),b.push(x),s.alignDelimiters!==!1&&b.push(j),s.padding!==!1&&b.push(" "),(s.delimiterEnd!==!1||m!==f-1)&&b.push("|")}k.push(s.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return k.join(`
|
|
108
|
-
`)}function pT(e){return e==null?"":String(e)}function sv(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 mT(e,r,s,i){const l=s.enter("blockquote"),u=s.createTracker(i);u.move("> "),u.shift(2);const h=s.indentLines(s.containerFlow(e,u.current()),gT);return l(),h}function gT(e,r,s){return">"+(s?"":" ")+e}function xT(e,r){return iv(e,r.inConstruct,!0)&&!iv(e,r.notInConstruct,!1)}function iv(e,r,s){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return s;let i=-1;for(;++i<r.length;)if(e.includes(r[i]))return!0;return!1}function av(e,r,s,i){let l=-1;for(;++l<s.unsafe.length;)if(s.unsafe[l].character===`
|
|
109
|
-
`&&xT(s.stack,s.unsafe[l]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
110
|
-
`}function bT(e,r){const s=String(e);let i=s.indexOf(r),l=i,u=0,h=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===l?++u>h&&(h=u):u=1,l=i+r.length,i=s.indexOf(r,l);return h}function vT(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 yT(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 _T(e,r,s,i){const l=yT(s),u=e.value||"",h=l==="`"?"GraveAccent":"Tilde";if(vT(e,s)){const m=s.enter("codeIndented"),v=s.indentLines(u,ST);return m(),v}const c=s.createTracker(i),d=l.repeat(Math.max(bT(u,l)+1,3)),f=s.enter("codeFenced");let g=c.move(d);if(e.lang){const m=s.enter(`codeFencedLang${h}`);g+=c.move(s.safe(e.lang,{before:g,after:" ",encode:["`"],...c.current()})),m()}if(e.lang&&e.meta){const m=s.enter(`codeFencedMeta${h}`);g+=c.move(" "),g+=c.move(s.safe(e.meta,{before:g,after:`
|
|
111
|
-
`,encode:["`"],...c.current()})),m()}return g+=c.move(`
|
|
112
|
-
`),u&&(g+=c.move(u+`
|
|
113
|
-
`)),g+=c.move(d),f(),g}function ST(e,r,s){return(s?"":" ")+e}function of(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 wT(e,r,s,i){const l=of(s),u=l==='"'?"Quote":"Apostrophe",h=s.enter("definition");let c=s.enter("label");const d=s.createTracker(i);let f=d.move("[");return f+=d.move(s.safe(s.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=s.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(s.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=s.enter("destinationRaw"),f+=d.move(s.safe(e.url,{before:f,after:e.title?" ":`
|
|
114
|
-
`,...d.current()}))),c(),e.title&&(c=s.enter(`title${u}`),f+=d.move(" "+l),f+=d.move(s.safe(e.title,{before:f,after:l,...d.current()})),f+=d.move(l),c()),h(),f}function CT(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 ro(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Kl(e,r,s){const i=Pi(e),l=Pi(r);return i===void 0?l===void 0?s==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}a0.peek=kT;function a0(e,r,s,i){const l=CT(s),u=s.enter("emphasis"),h=s.createTracker(i),c=h.move(l);let d=h.move(s.containerPhrasing(e,{after:l,before:c,...h.current()}));const f=d.charCodeAt(0),g=Kl(i.before.charCodeAt(i.before.length-1),f,l);g.inside&&(d=ro(f)+d.slice(1));const m=d.charCodeAt(d.length-1),v=Kl(i.after.charCodeAt(0),m,l);v.inside&&(d=d.slice(0,-1)+ro(m));const S=h.move(l);return u(),s.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+d+S}function kT(e,r,s){return s.options.emphasis||"*"}function ET(e,r){let s=!1;return sf(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return s=!0,vh}),!!((!e.depth||e.depth<3)&&Qh(e)&&(r.options.setext||s))}function jT(e,r,s,i){const l=Math.max(Math.min(6,e.depth||1),1),u=s.createTracker(i);if(ET(e,s)){const g=s.enter("headingSetext"),m=s.enter("phrasing"),v=s.containerPhrasing(e,{...u.current(),before:`
|
|
115
|
-
`,after:`
|
|
116
|
-
`});return m(),g(),v+`
|
|
117
|
-
`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
118
|
-
`))+1))}const h="#".repeat(l),c=s.enter("headingAtx"),d=s.enter("phrasing");u.move(h+" ");let f=s.containerPhrasing(e,{before:"# ",after:`
|
|
119
|
-
`,...u.current()});return/^[\t ]/.test(f)&&(f=ro(f.charCodeAt(0))+f.slice(1)),f=f?h+" "+f:h,s.options.closeAtx&&(f+=" "+h),d(),c(),f}o0.peek=NT;function o0(e){return e.value||""}function NT(){return"<"}l0.peek=TT;function l0(e,r,s,i){const l=of(s),u=l==='"'?"Quote":"Apostrophe",h=s.enter("image");let c=s.enter("label");const d=s.createTracker(i);let f=d.move("![");return f+=d.move(s.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=s.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(s.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=s.enter("destinationRaw"),f+=d.move(s.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=s.enter(`title${u}`),f+=d.move(" "+l),f+=d.move(s.safe(e.title,{before:f,after:l,...d.current()})),f+=d.move(l),c()),f+=d.move(")"),h(),f}function TT(){return"!"}c0.peek=AT;function c0(e,r,s,i){const l=e.referenceType,u=s.enter("imageReference");let h=s.enter("label");const c=s.createTracker(i);let d=c.move("![");const f=s.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),h();const g=s.stack;s.stack=[],h=s.enter("reference");const m=s.safe(s.associationId(e),{before:d,after:"]",...c.current()});return h(),s.stack=g,u(),l==="full"||!f||f!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function AT(){return"!"}u0.peek=DT;function u0(e,r,s){let i=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++u<s.unsafe.length;){const h=s.unsafe[u],c=s.compilePattern(h);let d;if(h.atBreak)for(;d=c.exec(i);){let f=d.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(d.index+1)}}return l+i+l}function DT(){return"`"}function d0(e,r){const s=Qh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(s===e.url||"mailto:"+s===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}h0.peek=RT;function h0(e,r,s,i){const l=of(s),u=l==='"'?"Quote":"Apostrophe",h=s.createTracker(i);let c,d;if(d0(e,s)){const g=s.stack;s.stack=[],c=s.enter("autolink");let m=h.move("<");return m+=h.move(s.containerPhrasing(e,{before:m,after:">",...h.current()})),m+=h.move(">"),c(),s.stack=g,m}c=s.enter("link"),d=s.enter("label");let f=h.move("[");return f+=h.move(s.containerPhrasing(e,{before:f,after:"](",...h.current()})),f+=h.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=s.enter("destinationLiteral"),f+=h.move("<"),f+=h.move(s.safe(e.url,{before:f,after:">",...h.current()})),f+=h.move(">")):(d=s.enter("destinationRaw"),f+=h.move(s.safe(e.url,{before:f,after:e.title?" ":")",...h.current()}))),d(),e.title&&(d=s.enter(`title${u}`),f+=h.move(" "+l),f+=h.move(s.safe(e.title,{before:f,after:l,...h.current()})),f+=h.move(l),d()),f+=h.move(")"),c(),f}function RT(e,r,s){return d0(e,s)?"<":"["}f0.peek=LT;function f0(e,r,s,i){const l=e.referenceType,u=s.enter("linkReference");let h=s.enter("label");const c=s.createTracker(i);let d=c.move("[");const f=s.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),h();const g=s.stack;s.stack=[],h=s.enter("reference");const m=s.safe(s.associationId(e),{before:d,after:"]",...c.current()});return h(),s.stack=g,u(),l==="full"||!f||f!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function LT(){return"["}function lf(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 OT(e){const r=lf(e),s=e.options.bulletOther;if(!s)return r==="*"?"-":"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(s===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+s+"`) to be different");return s}function MT(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 p0(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 IT(e,r,s,i){const l=s.enter("list"),u=s.bulletCurrent;let h=e.ordered?MT(s):lf(s);const c=e.ordered?h==="."?")":".":OT(s);let d=r&&s.bulletLastUsed?h===s.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((h==="*"||h==="-")&&g&&(!g.children||!g.children[0])&&s.stack[s.stack.length-1]==="list"&&s.stack[s.stack.length-2]==="listItem"&&s.stack[s.stack.length-3]==="list"&&s.stack[s.stack.length-4]==="listItem"&&s.indexStack[s.indexStack.length-1]===0&&s.indexStack[s.indexStack.length-2]===0&&s.indexStack[s.indexStack.length-3]===0&&(d=!0),p0(s)===h&&g){let m=-1;for(;++m<e.children.length;){const v=e.children[m];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(h=c),s.bulletCurrent=h;const f=s.containerFlow(e,i);return s.bulletLastUsed=h,s.bulletCurrent=u,l(),f}function BT(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 zT(e,r,s,i){const l=BT(s);let u=s.bulletCurrent||lf(s);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(s.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let h=u.length+1;(l==="tab"||l==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(h=Math.ceil(h/4)*4);const c=s.createTracker(i);c.move(u+" ".repeat(h-u.length)),c.shift(h);const d=s.enter("listItem"),f=s.indentLines(s.containerFlow(e,c.current()),g);return d(),f;function g(m,v,S){return v?(S?"":" ".repeat(h))+m:(S?u:u+" ".repeat(h-u.length))+m}}function PT(e,r,s,i){const l=s.enter("paragraph"),u=s.enter("phrasing"),h=s.containerPhrasing(e,i);return u(),l(),h}const HT=cc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function FT(e,r,s,i){return(e.children.some(function(h){return HT(h)})?s.containerPhrasing:s.containerFlow).call(s,e,i)}function UT(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}m0.peek=$T;function m0(e,r,s,i){const l=UT(s),u=s.enter("strong"),h=s.createTracker(i),c=h.move(l+l);let d=h.move(s.containerPhrasing(e,{after:l,before:c,...h.current()}));const f=d.charCodeAt(0),g=Kl(i.before.charCodeAt(i.before.length-1),f,l);g.inside&&(d=ro(f)+d.slice(1));const m=d.charCodeAt(d.length-1),v=Kl(i.after.charCodeAt(0),m,l);v.inside&&(d=d.slice(0,-1)+ro(m));const S=h.move(l+l);return u(),s.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},c+d+S}function $T(e,r,s){return s.options.strong||"*"}function qT(e,r,s,i){return s.safe(e.value,i)}function WT(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 VT(e,r,s){const i=(p0(s)+(s.options.ruleSpaces?" ":"")).repeat(WT(s));return s.options.ruleSpaces?i.slice(0,-1):i}const g0={blockquote:mT,break:av,code:_T,definition:wT,emphasis:a0,hardBreak:av,heading:jT,html:o0,image:l0,imageReference:c0,inlineCode:u0,link:h0,linkReference:f0,list:IT,listItem:zT,paragraph:PT,root:FT,strong:m0,text:qT,thematicBreak:VT};function GT(){return{enter:{table:KT,tableData:ov,tableHeader:ov,tableRow:XT},exit:{codeText:ZT,table:YT,tableData:rh,tableHeader:rh,tableRow:rh}}}function KT(e){const r=e._align;this.enter({type:"table",align:r.map(function(s){return s==="none"?null:s}),children:[]},e),this.data.inTable=!0}function YT(e){this.exit(e),this.data.inTable=void 0}function XT(e){this.enter({type:"tableRow",children:[]},e)}function rh(e){this.exit(e)}function ov(e){this.enter({type:"tableCell",children:[]},e)}function ZT(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,QT));const s=this.stack[this.stack.length-1];s.type,s.value=r,this.exit(e)}function QT(e,r){return r==="|"?r:e}function JT(e){const r=e||{},s=r.tableCellPadding,i=r.tablePipeAlign,l=r.stringLength,u=s?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
120
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:h,tableCell:d,tableRow:c}};function h(S,k,C,y){return f(g(S,C,y),S.align)}function c(S,k,C,y){const b=m(S,C,y),x=f([b]);return x.slice(0,x.indexOf(`
|
|
121
|
-
`))}function d(S,k,C,y){const b=C.enter("tableCell"),x=C.enter("phrasing"),_=C.containerPhrasing(S,{...y,before:u,after:u});return x(),b(),_}function f(S,k){return fT(S,{align:k,alignDelimiters:i,padding:s,stringLength:l})}function g(S,k,C){const y=S.children;let b=-1;const x=[],_=k.enter("table");for(;++b<y.length;)x[b]=m(y[b],k,C);return _(),x}function m(S,k,C){const y=S.children;let b=-1;const x=[],_=k.enter("tableRow");for(;++b<y.length;)x[b]=d(y[b],S,k,C);return _(),x}function v(S,k,C){let y=g0.inlineCode(S,k,C);return C.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function e3(){return{exit:{taskListCheckValueChecked:lv,taskListCheckValueUnchecked:lv,paragraph:n3}}}function t3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:r3}}}function lv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function n3(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const s=this.stack[this.stack.length-1];s.type;const i=s.children[0];if(i&&i.type==="text"){const l=r.children;let u=-1,h;for(;++u<l.length;){const c=l[u];if(c.type==="paragraph"){h=c;break}}h===s&&(i.value=i.value.slice(1),i.value.length===0?s.children.shift():s.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,s.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function r3(e,r,s,i){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",h="["+(e.checked?"x":" ")+"] ",c=s.createTracker(i);u&&c.move(h);let d=g0.listItem(e,r,s,{...i,...c.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(g){return g+h}}function s3(){return[IN(),rT(),oT(),GT(),e3()]}function i3(e){return{extensions:[BN(),sT(e),lT(),JT(e),t3()]}}const a3={tokenize:h3,partial:!0},x0={tokenize:f3,partial:!0},b0={tokenize:p3,partial:!0},v0={tokenize:m3,partial:!0},o3={tokenize:g3,partial:!0},y0={name:"wwwAutolink",tokenize:u3,previous:S0},_0={name:"protocolAutolink",tokenize:d3,previous:w0},Br={name:"emailAutolink",tokenize:c3,previous:C0},fr={};function l3(){return{text:fr}}let Ds=48;for(;Ds<123;)fr[Ds]=Br,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);fr[43]=Br;fr[45]=Br;fr[46]=Br;fr[95]=Br;fr[72]=[Br,_0];fr[104]=[Br,_0];fr[87]=[Br,y0];fr[119]=[Br,y0];function c3(e,r,s){const i=this;let l,u;return h;function h(m){return!wh(m)||!C0.call(i,i.previous)||cf(i.events)?s(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return wh(m)?(e.consume(m),c):m===64?(e.consume(m),d):s(m)}function d(m){return m===46?e.check(o3,g,f)(m):m===45||m===95||fn(m)?(u=!0,e.consume(m),d):g(m)}function f(m){return e.consume(m),l=!0,d}function g(m){return u&&l&&gn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):s(m)}}function u3(e,r,s){const i=this;return l;function l(h){return h!==87&&h!==119||!S0.call(i,i.previous)||cf(i.events)?s(h):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(a3,e.attempt(x0,e.attempt(b0,u),s),s)(h))}function u(h){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(h)}}function d3(e,r,s){const i=this;let l="",u=!1;return h;function h(m){return(m===72||m===104)&&w0.call(i,i.previous)&&!cf(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(m),e.consume(m),c):s(m)}function c(m){if(gn(m)&&l.length<5)return l+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const v=l.toLowerCase();if(v==="http"||v==="https")return e.consume(m),d}return s(m)}function d(m){return m===47?(e.consume(m),u?f:(u=!0,d)):s(m)}function f(m){return m===null||Wl(m)||yt(m)||Ps(m)||ac(m)?s(m):e.attempt(x0,e.attempt(b0,g),s)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function h3(e,r,s){let i=0;return l;function l(h){return(h===87||h===119)&&i<3?(i++,e.consume(h),l):h===46&&i===3?(e.consume(h),u):s(h)}function u(h){return h===null?s(h):r(h)}}function f3(e,r,s){let i,l,u;return h;function h(f){return f===46||f===95?e.check(v0,d,c)(f):f===null||yt(f)||Ps(f)||f!==45&&ac(f)?d(f):(u=!0,e.consume(f),h)}function c(f){return f===95?i=!0:(l=i,i=void 0),e.consume(f),h}function d(f){return l||i||!u?s(f):r(f)}}function p3(e,r){let s=0,i=0;return l;function l(h){return h===40?(s++,e.consume(h),l):h===41&&i<s?u(h):h===33||h===34||h===38||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===60||h===63||h===93||h===95||h===126?e.check(v0,r,u)(h):h===null||yt(h)||Ps(h)?r(h):(e.consume(h),l)}function u(h){return h===41&&i++,e.consume(h),l}}function m3(e,r,s){return i;function i(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),i):c===38?(e.consume(c),u):c===93?(e.consume(c),l):c===60||c===null||yt(c)||Ps(c)?r(c):s(c)}function l(c){return c===null||c===40||c===91||yt(c)||Ps(c)?r(c):i(c)}function u(c){return gn(c)?h(c):s(c)}function h(c){return c===59?(e.consume(c),i):gn(c)?(e.consume(c),h):s(c)}}function g3(e,r,s){return i;function i(u){return e.consume(u),l}function l(u){return fn(u)?s(u):r(u)}}function S0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function w0(e){return!gn(e)}function C0(e){return!(e===47||wh(e))}function wh(e){return e===43||e===45||e===46||e===95||fn(e)}function cf(e){let r=e.length,s=!1;for(;r--;){const i=e[r][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){s=!0;break}if(i._gfmAutolinkLiteralWalkedInto){s=!1;break}}return e.length>0&&!s&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),s}const x3={tokenize:k3,partial:!0};function b3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:S3,continuation:{tokenize:w3},exit:C3}},text:{91:{name:"gfmFootnoteCall",tokenize:_3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:v3,resolveTo:y3}}}}function v3(e,r,s){const i=this;let l=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let h;for(;l--;){const d=i.events[l][1];if(d.type==="labelImage"){h=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!h||!h._balanced)return s(d);const f=tr(i.sliceSerialize({start:h.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?s(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function y3(e,r){let s=e.length;for(;s--;)if(e[s][1].type==="labelImage"&&e[s][0]==="enter"){e[s][1];break}e[s+1][1].type="data",e[s+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[s+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[s+3][1].end),end:Object.assign({},e[s+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},h={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},c=[e[s+1],e[s+2],["enter",i,r],e[s+3],e[s+4],["enter",l,r],["exit",l,r],["enter",u,r],["enter",h,r],["exit",h,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",i,r]];return e.splice(s,e.length-s+1,...c),e}function _3(e,r,s){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,h;return c;function c(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?s(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(m){if(u>999||m===93&&!h||m===null||m===91||yt(m))return s(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return l.includes(tr(i.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):s(m)}return yt(m)||(h=!0),u++,e.consume(m),m===92?g:f}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,f):f(m)}}function S3(e,r,s){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,h=0,c;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):s(k)}function g(k){if(h>999||k===93&&!c||k===null||k===91||yt(k))return s(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=tr(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return yt(k)||(c=!0),h++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),h++,g):g(k)}function v(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),at(e,S,"gfmFootnoteDefinitionWhitespace")):s(k)}function S(k){return r(k)}}function w3(e,r,s){return e.check(ho,r,e.attempt(x3,r,s))}function C3(e){e.exit("gfmFootnoteDefinition")}function k3(e,r,s){const i=this;return at(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const h=i.events[i.events.length-1];return h&&h[1].type==="gfmFootnoteDefinitionIndent"&&h[2].sliceSerialize(h[1],!0).length===4?r(u):s(u)}}function E3(e){let s=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:l};return s==null&&(s=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(h,c){let d=-1;for(;++d<h.length;)if(h[d][0]==="enter"&&h[d][1].type==="strikethroughSequenceTemporary"&&h[d][1]._close){let f=d;for(;f--;)if(h[f][0]==="exit"&&h[f][1].type==="strikethroughSequenceTemporary"&&h[f][1]._open&&h[d][1].end.offset-h[d][1].start.offset===h[f][1].end.offset-h[f][1].start.offset){h[d][1].type="strikethroughSequence",h[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},h[f][1].start),end:Object.assign({},h[d][1].end)},m={type:"strikethroughText",start:Object.assign({},h[f][1].end),end:Object.assign({},h[d][1].start)},v=[["enter",g,c],["enter",h[f][1],c],["exit",h[f][1],c],["enter",m,c]],S=c.parser.constructs.insideSpan.null;S&&In(v,v.length,0,oc(S,h.slice(f+1,d),c)),In(v,v.length,0,[["exit",m,c],["enter",h[d][1],c],["exit",h[d][1],c],["exit",g,c]]),In(h,f-1,d-f+3,v),d=f+v.length-2;break}}for(d=-1;++d<h.length;)h[d][1].type==="strikethroughSequenceTemporary"&&(h[d][1].type="data");return h}function u(h,c,d){const f=this.previous,g=this.events;let m=0;return v;function v(k){return f===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(h.enter("strikethroughSequenceTemporary"),S(k))}function S(k){const C=Pi(f);if(k===126)return m>1?d(k):(h.consume(k),m++,S);if(m<2&&!s)return d(k);const y=h.exit("strikethroughSequenceTemporary"),b=Pi(k);return y._open=!b||b===2&&!!C,y._close=!C||C===2&&!!b,c(k)}}}class j3{constructor(){this.map=[]}add(r,s,i){N3(this,r,s,i)}consume(r){if(this.map.sort(function(u,h){return u[0]-h[0]}),this.map.length===0)return;let s=this.map.length;const i=[];for(;s>0;)s-=1,i.push(r.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),r.length=this.map[s][0];i.push(r.slice()),r.length=0;let l=i.pop();for(;l;){for(const u of l)r.push(u);l=i.pop()}this.map.length=0}}function N3(e,r,s,i){let l=0;if(!(s===0&&i.length===0)){for(;l<e.map.length;){if(e.map[l][0]===r){e.map[l][1]+=s,e.map[l][2].push(...i);return}l+=1}e.map.push([r,s,i])}}function T3(e,r){let s=!1;const i=[];for(;r<e.length;){const l=e[r];if(s){if(l[0]==="enter")l[1].type==="tableContent"&&i.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=i.length-1;i[u]=i[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(s=!0);r+=1}return i}function A3(){return{flow:{null:{name:"table",tokenize:D3,resolveAll:R3}}}}function D3(e,r,s){const i=this;let l=0,u=0,h;return c;function c(O){let H=i.events.length-1;for(;H>-1;){const G=i.events[H][1].type;if(G==="lineEnding"||G==="linePrefix")H--;else break}const q=H>-1?i.events[H][1].type:null,W=q==="tableHead"||q==="tableRow"?N:d;return W===N&&i.parser.lazy[i.now().line]?s(O):W(O)}function d(O){return e.enter("tableHead"),e.enter("tableRow"),f(O)}function f(O){return O===124||(h=!0,u+=1),g(O)}function g(O){return O===null?s(O):Pe(O)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),S):s(O):tt(O)?at(e,g,"whitespace")(O):(u+=1,h&&(h=!1,l+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),h=!0,g):(e.enter("data"),m(O)))}function m(O){return O===null||O===124||yt(O)?(e.exit("data"),g(O)):(e.consume(O),O===92?v:m)}function v(O){return O===92||O===124?(e.consume(O),m):m(O)}function S(O){return i.interrupt=!1,i.parser.lazy[i.now().line]?s(O):(e.enter("tableDelimiterRow"),h=!1,tt(O)?at(e,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):k(O))}function k(O){return O===45||O===58?y(O):O===124?(h=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),C):T(O)}function C(O){return tt(O)?at(e,y,"whitespace")(O):y(O)}function y(O){return O===58?(u+=1,h=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),b):O===45?(u+=1,b(O)):O===null||Pe(O)?j(O):T(O)}function b(O){return O===45?(e.enter("tableDelimiterFiller"),x(O)):T(O)}function x(O){return O===45?(e.consume(O),x):O===58?(h=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(O))}function _(O){return tt(O)?at(e,j,"whitespace")(O):j(O)}function j(O){return O===124?k(O):O===null||Pe(O)?!h||l!==u?T(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(O)):T(O)}function T(O){return s(O)}function N(O){return e.enter("tableRow"),D(O)}function D(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),D):O===null||Pe(O)?(e.exit("tableRow"),r(O)):tt(O)?at(e,D,"whitespace")(O):(e.enter("data"),A(O))}function A(O){return O===null||O===124||yt(O)?(e.exit("data"),D(O)):(e.consume(O),O===92?P:A)}function P(O){return O===92||O===124?(e.consume(O),A):A(O)}}function R3(e,r){let s=-1,i=!0,l=0,u=[0,0,0,0],h=[0,0,0,0],c=!1,d=0,f,g,m;const v=new j3;for(;++s<e.length;){const S=e[s],k=S[1];S[0]==="enter"?k.type==="tableHead"?(c=!1,d!==0&&(cv(v,r,d,f,g),g=void 0,d=0),f={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(s,0,[["enter",f,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(i=!0,m=void 0,u=[0,0,0,0],h=[0,s+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(s,0,[["enter",g,r]])),l=k.type==="tableDelimiterRow"?2:g?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(i=!1,h[2]===0&&(u[1]!==0&&(h[0]=h[1],m=Ml(v,r,u,l,void 0,m),u=[0,0,0,0]),h[2]=s)):k.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(h[0]=h[1],m=Ml(v,r,u,l,void 0,m)),u=h,h=[u[1],s,0,0])):k.type==="tableHead"?(c=!0,d=s):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=s,u[1]!==0?(h[0]=h[1],m=Ml(v,r,u,l,s,m)):h[1]!==0&&(m=Ml(v,r,h,l,s,m)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(h[3]=s)}for(d!==0&&cv(v,r,d,f,g),v.consume(r.events),s=-1;++s<r.events.length;){const S=r.events[s];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=T3(r.events,s))}return e}function Ml(e,r,s,i,l,u){const h=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",c="tableContent";s[0]!==0&&(u.end=Object.assign({},Li(r.events,s[0])),e.add(s[0],0,[["exit",u,r]]));const d=Li(r.events,s[1]);if(u={type:h,start:Object.assign({},d),end:Object.assign({},d)},e.add(s[1],0,[["enter",u,r]]),s[2]!==0){const f=Li(r.events,s[2]),g=Li(r.events,s[3]),m={type:c,start:Object.assign({},f),end:Object.assign({},g)};if(e.add(s[2],0,[["enter",m,r]]),i!==2){const v=r.events[s[2]],S=r.events[s[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",s[3]>s[2]+1){const k=s[2]+1,C=s[3]-s[2]-1;e.add(k,C,[])}}e.add(s[3]+1,0,[["exit",m,r]])}return l!==void 0&&(u.end=Object.assign({},Li(r.events,l)),e.add(l,0,[["exit",u,r]]),u=void 0),u}function cv(e,r,s,i,l){const u=[],h=Li(r.events,s);l&&(l.end=Object.assign({},h),u.push(["exit",l,r])),i.end=Object.assign({},h),u.push(["exit",i,r]),e.add(s+1,0,u)}function Li(e,r){const s=e[r],i=s[0]==="enter"?"start":"end";return s[1][i]}const L3={name:"tasklistCheck",tokenize:M3};function O3(){return{text:{91:L3}}}function M3(e,r,s){const i=this;return l;function l(d){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?s(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return yt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),h):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),h):s(d)}function h(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):s(d)}function c(d){return Pe(d)?r(d):tt(d)?e.check({tokenize:I3},r,s)(d):s(d)}}function I3(e,r,s){return at(e,i,"whitespace");function i(l){return l===null?s(l):r(l)}}function B3(e){return My([l3(),b3(),E3(e),A3(),O3()])}const z3={};function P3(e){const r=this,s=e||z3,i=r.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),h=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(B3(s)),u.push(s3()),h.push(i3(s))}function H3(e,r){if(e==null)return{};var s={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(r.indexOf(i)!==-1)continue;s[i]=e[i]}return s}function F3(e,r){if(e==null)return{};var s,i,l=H3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(i=0;i<u.length;i++)s=u[i],r.indexOf(s)===-1&&{}.propertyIsEnumerable.call(e,s)&&(l[s]=e[s])}return l}function Ch(e,r){(r==null||r>e.length)&&(r=e.length);for(var s=0,i=Array(r);s<r;s++)i[s]=e[s];return i}function U3(e){if(Array.isArray(e))return Ch(e)}function $3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q3(e,r){if(e){if(typeof e=="string")return Ch(e,r);var s={}.toString.call(e).slice(8,-1);return s==="Object"&&e.constructor&&(s=e.constructor.name),s==="Map"||s==="Set"?Array.from(e):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Ch(e,r):void 0}}function W3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
122
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kh(e){return U3(e)||$3(e)||q3(e)||W3()}function so(e){"@babel/helpers - typeof";return so=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},so(e)}function V3(e,r){if(so(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var i=s.call(e,r);if(so(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function G3(e){var r=V3(e,"string");return so(r)=="symbol"?r:r+""}function k0(e,r,s){return(r=G3(r))in e?Object.defineProperty(e,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[r]=s,e}function Eh(){return Eh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var i in s)({}).hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},Eh.apply(null,arguments)}function uv(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),s.push.apply(s,i)}return s}function Oi(e){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?uv(Object(s),!0).forEach(function(i){k0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):uv(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}function K3(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 sh={};function Y3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return sh[r]||(sh[r]=K3(e)),sh[r]}function X3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,i=e.filter(function(u){return u!=="token"}),l=Y3(i);return l.reduce(function(u,h){return Oi(Oi({},u),s[h])},r)}function dv(e){return e.join(" ")}function Z3(e,r){var s=0;return function(i){return s+=1,i.map(function(l,u){return E0({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(s,"-").concat(u)})})}}function E0(e){var r=e.node,s=e.stylesheet,i=e.style,l=i===void 0?{}:i,u=e.useInlineStyles,h=e.key,c=r.properties,d=r.type,f=r.tagName,g=r.value;if(d==="text")return g;if(f){var m=Z3(s,u),v;if(!u)v=Oi(Oi({},c),{},{className:dv(c.className)});else{var S=Object.keys(s).reduce(function(b,x){return x.split(".").forEach(function(_){b.includes(_)||b.push(_)}),b},[]),k=c.className&&c.className.includes("token")?["token"]:[],C=c.className&&k.concat(c.className.filter(function(b){return!S.includes(b)}));v=Oi(Oi({},c),{},{className:dv(C)||void 0,style:X3(c.className,Object.assign({},c.style,l),s)})}var y=m(r.children);return dn.createElement(f,Eh({key:h},v),y)}}const Q3=(function(e,r){var s=e.listLanguages();return s.indexOf(r)!==-1});var J3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function hv(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),s.push.apply(s,i)}return s}function us(e){for(var r=1;r<arguments.length;r++){var s=arguments[r]!=null?arguments[r]:{};r%2?hv(Object(s),!0).forEach(function(i){k0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):hv(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var e5=/\n/g;function t5(e){return e.match(e5)}function n5(e){var r=e.lines,s=e.startingLineNumber,i=e.style;return r.map(function(l,u){var h=u+s;return dn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof i=="function"?i(h):i},"".concat(h,`
|
|
123
|
-
`))})}function r5(e){var r=e.codeString,s=e.codeStyle,i=e.containerStyle,l=i===void 0?{float:"left",paddingRight:"10px"}:i,u=e.numberStyle,h=u===void 0?{}:u,c=e.startingLineNumber;return dn.createElement("code",{style:Object.assign({},s,l)},n5({lines:r.replace(/\n$/,"").split(`
|
|
124
|
-
`),style:h,startingLineNumber:c}))}function s5(e){return"".concat(e.toString().length,".25em")}function j0(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 N0(e,r,s){var i={display:"inline-block",minWidth:s5(s),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(r):e,u=us(us({},i),l);return u}function Pl(e){var r=e.children,s=e.lineNumber,i=e.lineNumberStyle,l=e.largestLineNumber,u=e.showInlineLineNumbers,h=e.lineProps,c=h===void 0?{}:h,d=e.className,f=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,v=e.wrapLines,S=v===void 0?!1:v,k=S?us({},typeof c=="function"?c(s):c):{};if(k.className=k.className?[].concat(kh(k.className.trim().split(/\s+/)),kh(f)):f,s&&u){var C=N0(i,s,l);r.unshift(j0(s,C))}return m&g&&(k.style=us({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function T0(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var i=0;i<e.length;i++){var l=e[i];if(l.type==="text")s.push(Pl({children:[l],className:kh(new Set(r))}));else if(l.children){var u,h=r.concat(((u=l.properties)===null||u===void 0?void 0:u.className)||[]);T0(l.children,h).forEach(function(c){return s.push(c)})}}return s}function i5(e,r,s,i,l,u,h,c,d){var f,g=T0(e.value),m=[],v=-1,S=0;function k(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Pl({children:T,lineNumber:N,lineNumberStyle:c,largestLineNumber:h,showInlineLineNumbers:l,lineProps:s,className:D,showLineNumbers:i,wrapLongLines:d,wrapLines:r})}function C(T,N){if(i&&N&&l){var D=N0(c,N,h);T.unshift(j0(N,D))}return T}function y(T,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?k(T,N,D):C(T,N)}for(var b=function(){var N=g[S],D=N.children[0].value,A=t5(D);if(A){var P=D.split(`
|
|
125
|
-
`);P.forEach(function(O,H){var q=i&&m.length+u,W={type:"text",value:"".concat(O,`
|
|
126
|
-
`)};if(H===0){var G=g.slice(v+1,S).concat(Pl({children:[W],className:N.properties.className})),B=y(G,q);m.push(B)}else if(H===P.length-1){var F=g[S+1]&&g[S+1].children&&g[S+1].children[0],Z={type:"text",value:"".concat(O)};if(F){var Y=Pl({children:[Z],className:N.properties.className});g.splice(S+1,0,Y)}else{var I=[Z],L=y(I,q,N.properties.className);m.push(L)}}else{var R=[W],$=y(R,q,N.properties.className);m.push($)}}),v=S}S++};S<g.length;)b();if(v!==g.length-1){var x=g.slice(v+1,g.length);if(x&&x.length){var _=i&&m.length+u,j=y(x,_);m.push(j)}}return r?m:(f=[]).concat.apply(f,m)}function a5(e){var r=e.rows,s=e.stylesheet,i=e.useInlineStyles;return r.map(function(l,u){return E0({node:l,stylesheet:s,useInlineStyles:i,key:"code-segment-".concat(u)})})}function A0(e){return e&&typeof e.highlightAuto<"u"}function o5(e){var r=e.astGenerator,s=e.language,i=e.code,l=e.defaultCodeValue;if(A0(r)){var u=Q3(r,s);return s==="text"?{value:l,language:"text"}:u?r.highlight(s,i):r.highlightAuto(i)}try{return s&&s!=="text"?{value:r.highlight(i,s)}:{value:l}}catch{return{value:l}}}function l5(e,r){return function(i){var l,u,h=i.language,c=i.children,d=i.style,f=d===void 0?r:d,g=i.customStyle,m=g===void 0?{}:g,v=i.codeTagProps,S=v===void 0?{className:h?"language-".concat(h):void 0,style:us(us({},f['code[class*="language-"]']),f['code[class*="language-'.concat(h,'"]')])}:v,k=i.useInlineStyles,C=k===void 0?!0:k,y=i.showLineNumbers,b=y===void 0?!1:y,x=i.showInlineLineNumbers,_=x===void 0?!0:x,j=i.startingLineNumber,T=j===void 0?1:j,N=i.lineNumberContainerStyle,D=i.lineNumberStyle,A=D===void 0?{}:D,P=i.wrapLines,O=i.wrapLongLines,H=O===void 0?!1:O,q=i.lineProps,W=q===void 0?{}:q,G=i.renderer,B=i.PreTag,F=B===void 0?"pre":B,Z=i.CodeTag,Y=Z===void 0?"code":Z,I=i.code,L=I===void 0?(Array.isArray(c)?c[0]:c)||"":I,R=i.astGenerator,$=F3(i,J3);R=R||e;var U=b?dn.createElement(r5,{containerStyle:N,codeStyle:S.style||{},numberStyle:A,startingLineNumber:T,codeString:L}):null,ne=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=A0(R)?"hljs":"prismjs",ee=C?Object.assign({},$,{style:Object.assign({},ne,m)}):Object.assign({},$,{className:$.className?"".concat(Q," ").concat($.className):Q,style:Object.assign({},m)});if(H?S.style=us({whiteSpace:"pre-wrap"},S.style):S.style=us({whiteSpace:"pre"},S.style),!R)return dn.createElement(F,ee,U,dn.createElement(Y,S,L));(P===void 0&&G||H)&&(P=!0),G=G||a5;var X=[{type:"text",value:L}],V=o5({astGenerator:R,language:h,code:L,defaultCodeValue:X});V.language===null&&(V.value=X);var ie=(l=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0,re=T+ie,be=i5(V,P,W,b,_,T,re,A,H);return dn.createElement(F,ee,dn.createElement(Y,S,!_&&U,G({rows:be,stylesheet:f,useInlineStyles:C})))}}const fv=/[#.]/g;function c5(e,r){const s=e||"",i={};let l=0,u,h;for(;l<s.length;){fv.lastIndex=l;const c=fv.exec(s),d=s.slice(l,c?c.index:s.length);d&&(u?u==="#"?i.id=d:Array.isArray(i.className)?i.className.push(d):i.className=[d]:h=d,l+=d.length),c&&(u=c[0],l++)}return{type:"element",tagName:h||r||"div",properties:i,children:[]}}function D0(e,r,s){const i=s?f5(s):void 0;function l(u,h,...c){let d;if(u==null){d={type:"root",children:[]};const f=h;c.unshift(f)}else{d=c5(u,r);const f=d.tagName.toLowerCase(),g=i?i.get(f):void 0;if(d.tagName=g||f,u5(h))c.unshift(h);else for(const[m,v]of Object.entries(h))d5(e,d.properties,m,v)}for(const f of c)jh(d.children,f);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function u5(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,s=Object.keys(e);for(const i of s){const l=r[i];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const u=l;for(const h of u)if(typeof h!="number"&&typeof h!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function d5(e,r,s,i){const l=Ey(e,s);let u;if(i!=null){if(typeof i=="number"){if(Number.isNaN(i))return;u=i}else typeof i=="boolean"?u=i:typeof i=="string"?l.spaceSeparated?u=Cb(i):l.commaSeparated?u=vb(i):l.commaOrSpaceSeparated?u=Cb(vb(i).join(" ")):u=pv(l,l.property,i):Array.isArray(i)?u=[...i]:u=l.property==="style"?h5(i):String(i);if(Array.isArray(u)){const h=[];for(const c of u)h.push(pv(l,l.property,c));u=h}l.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[l.property]=u}}function jh(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 s of r)jh(e,s);else if(typeof r=="object"&&"type"in r)r.type==="root"?jh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function pv(e,r,s){if(typeof s=="string"){if(e.number&&s&&!Number.isNaN(Number(s)))return Number(s);if((e.boolean||e.overloadedBoolean)&&(s===""||eo(s)===eo(r)))return!0}return s}function h5(e){const r=[];for(const[s,i]of Object.entries(e))r.push([s,i].join(": "));return r.join("; ")}function f5(e){const r=new Map;for(const s of e)r.set(s.toLowerCase(),s);return r}const p5=["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"],m5=D0(jy,"div");D0(ic,"g",p5);const g5=["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"],mv={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 R0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function x5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function b5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function gv(e){return b5(e)||R0(e)}const v5=["","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 y5(e,r){const s={},i=typeof s.additional=="string"?s.additional.charCodeAt(0):s.additional,l=[];let u=0,h=-1,c="",d,f;s.position&&("start"in s.position||"indent"in s.position?(f=s.position.indent,d=s.position.start):d=s.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,v=k(),S;for(u--;++u<=e.length;)if(S===10&&(m=(f?f[h]:0)||1),S=e.charCodeAt(u),S===38){const b=e.charCodeAt(u+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||i&&b===i){c+=String.fromCharCode(S),m++;continue}const x=u+1;let _=x,j=x,T;if(b===35){j=++_;const W=e.charCodeAt(j);W===88||W===120?(T="hexadecimal",j=++_):T="decimal"}else T="named";let N="",D="",A="";const P=T==="named"?gv:T==="decimal"?R0:x5;for(j--;++j<=e.length;){const W=e.charCodeAt(j);if(!P(W))break;A+=String.fromCharCode(W),T==="named"&&g5.includes(A)&&(N=A,D=no(A))}let O=e.charCodeAt(j)===59;if(O){j++;const W=T==="named"?no(A):!1;W&&(N=A,D=W)}let H=1+j-x,q="";if(!(!O&&s.nonTerminated===!1))if(!A)T!=="named"&&C(4,H);else if(T==="named"){if(O&&!D)C(5,1);else if(N!==A&&(j=_+N.length,H=1+j-_,O=!1),!O){const W=N?1:3;if(s.attribute){const G=e.charCodeAt(j);G===61?(C(W,H),D=""):gv(G)?D="":C(W,H)}else C(W,H)}q=D}else{O||C(2,H);let W=Number.parseInt(A,T==="hexadecimal"?16:10);if(_5(W))C(7,H),q="�";else if(W in mv)C(6,H),q=mv[W];else{let G="";S5(W)&&C(6,H),W>65535&&(W-=65536,G+=String.fromCharCode(W>>>10|55296),W=56320|W&1023),q=G+String.fromCharCode(W)}}if(q){y(),v=k(),u=j-1,m+=j-x+1,l.push(q);const W=k();W.offset++,s.reference&&s.reference.call(s.referenceContext||void 0,q,{start:v,end:W},e.slice(x-1,j)),v=W}else A=e.slice(x-1,j),c+=A,m+=A.length,u=j-1}else S===10&&(g++,h++,m=0),Number.isNaN(S)?y():(c+=String.fromCharCode(S),m++);return l.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(b,x){let _;s.warning&&(_=k(),_.column+=x,_.offset+=x,s.warning.call(s.warningContext||void 0,v5[b],_,b))}function y(){c&&(l.push(c),s.text&&s.text.call(s.textContext||void 0,c,{start:v,end:k()}),c="")}}function _5(e){return e>=55296&&e<=57343||e>1114111}function S5(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 w5=0,Il={},Qt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++w5}),e.__id},clone:function e(r,s){s=s||{};var i,l;switch(Qt.util.type(r)){case"Object":if(l=Qt.util.objId(r),s[l])return s[l];i={},s[l]=i;for(var u in r)r.hasOwnProperty(u)&&(i[u]=e(r[u],s));return i;case"Array":return l=Qt.util.objId(r),s[l]?s[l]:(i=[],s[l]=i,r.forEach(function(h,c){i[c]=e(h,s)}),i);default:return r}}},languages:{plain:Il,plaintext:Il,text:Il,txt:Il,extend:function(e,r){var s=Qt.util.clone(Qt.languages[e]);for(var i in r)s[i]=r[i];return s},insertBefore:function(e,r,s,i){i=i||Qt.languages;var l=i[e],u={};for(var h in l)if(l.hasOwnProperty(h)){if(h==r)for(var c in s)s.hasOwnProperty(c)&&(u[c]=s[c]);s.hasOwnProperty(h)||(u[h]=l[h])}var d=i[e];return i[e]=u,Qt.languages.DFS(Qt.languages,function(f,g){g===d&&f!=e&&(this[f]=u)}),u},DFS:function e(r,s,i,l){l=l||{};var u=Qt.util.objId;for(var h in r)if(r.hasOwnProperty(h)){s.call(r,h,r[h],i||h);var c=r[h],d=Qt.util.type(c);d==="Object"&&!l[u(c)]?(l[u(c)]=!0,e(c,s,null,l)):d==="Array"&&!l[u(c)]&&(l[u(c)]=!0,e(c,s,h,l))}}},plugins:{},highlight:function(e,r,s){var i={code:e,grammar:r,language:s};if(Qt.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=Qt.tokenize(i.code,i.grammar),Qt.hooks.run("after-tokenize",i),Qa.stringify(Qt.util.encode(i.tokens),i.language)},tokenize:function(e,r){var s=r.rest;if(s){for(var i in s)r[i]=s[i];delete r.rest}var l=new C5;return Hl(l,l.head,e),L0(e,l,r,l.head,0),E5(l)},hooks:{all:{},add:function(e,r){var s=Qt.hooks.all;s[e]=s[e]||[],s[e].push(r)},run:function(e,r){var s=Qt.hooks.all[e];if(!(!s||!s.length))for(var i=0,l;l=s[i++];)l(r)}},Token:Qa};function Qa(e,r,s,i){this.type=e,this.content=r,this.alias=s,this.length=(i||"").length|0}function xv(e,r,s,i){e.lastIndex=r;var l=e.exec(s);if(l&&i&&l[1]){var u=l[1].length;l.index+=u,l[0]=l[0].slice(u)}return l}function L0(e,r,s,i,l,u){for(var h in s)if(!(!s.hasOwnProperty(h)||!s[h])){var c=s[h];c=Array.isArray(c)?c:[c];for(var d=0;d<c.length;++d){if(u&&u.cause==h+","+d)return;var f=c[d],g=f.inside,m=!!f.lookbehind,v=!!f.greedy,S=f.alias;if(v&&!f.pattern.global){var k=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,k+"g")}for(var C=f.pattern||f,y=i.next,b=l;y!==r.tail&&!(u&&b>=u.reach);b+=y.value.length,y=y.next){var x=y.value;if(r.length>e.length)return;if(!(x instanceof Qa)){var _=1,j;if(v){if(j=xv(C,b,e,m),!j||j.index>=e.length)break;var A=j.index,T=j.index+j[0].length,N=b;for(N+=y.value.length;A>=N;)y=y.next,N+=y.value.length;if(N-=y.value.length,b=N,y.value instanceof Qa)continue;for(var D=y;D!==r.tail&&(N<T||typeof D.value=="string");D=D.next)_++,N+=D.value.length;_--,x=e.slice(b,N),j.index-=b}else if(j=xv(C,0,x,m),!j)continue;var A=j.index,P=j[0],O=x.slice(0,A),H=x.slice(A+P.length),q=b+x.length;u&&q>u.reach&&(u.reach=q);var W=y.prev;O&&(W=Hl(r,W,O),b+=O.length),k5(r,W,_);var G=new Qa(h,g?Qt.tokenize(P,g):P,S,P);if(y=Hl(r,W,G),H&&Hl(r,y,H),_>1){var B={cause:h+","+d,reach:q};L0(e,r,s,y.prev,b,B),u&&B.reach>u.reach&&(u.reach=B.reach)}}}}}}function C5(){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 Hl(e,r,s){var i=r.next,l={value:s,prev:r,next:i};return r.next=l,i.prev=l,e.length++,l}function k5(e,r,s){for(var i=r.next,l=0;l<s&&i!==e.tail;l++)i=i.next;r.next=i,i.prev=r,e.length-=l}function E5(e){for(var r=[],s=e.head.next;s!==e.tail;)r.push(s.value),s=s.next;return r}const O0=Qt;function M0(){}M0.prototype=O0;const Yt=new M0;Yt.highlight=j5;Yt.register=N5;Yt.alias=T5;Yt.registered=A5;Yt.listLanguages=D5;Yt.util.encode=R5;Yt.Token.stringify=Nh;function j5(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let s,i;if(r&&typeof r=="object")s=r;else{if(i=r,typeof i!="string")throw new TypeError("Expected `string` for `name`, got `"+i+"`");if(Object.hasOwn(Yt.languages,i))s=Yt.languages[i];else throw new Error("Unknown language: `"+i+"` is not registered")}return{type:"root",children:O0.highlight.call(Yt,e,s,i)}}function N5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Yt.languages,e.displayName)||e(Yt)}function T5(e,r){const s=Yt.languages;let i={};typeof e=="string"?r&&(i[e]=r):i=e;let l;for(l in i)if(Object.hasOwn(i,l)){const u=i[l],h=typeof u=="string"?[u]:u;let c=-1;for(;++c<h.length;)s[h[c]]=s[l]}}function A5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Yt.languages,e)}function D5(){const e=Yt.languages,r=[];let s;for(s in e)Object.hasOwn(e,s)&&typeof e[s]=="object"&&r.push(s);return r}function Nh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const i=[];let l=-1;for(;++l<e.length;)e[l]!==null&&e[l]!==void 0&&e[l]!==""&&i.push(Nh(e[l],r));return i}const s={attributes:{},classes:["token",e.type],content:Nh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&s.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Yt.hooks.run("wrap",s),m5(s.tag+"."+s.classes.join("."),L5(s.attributes),s.content)}function R5(e){return e}function L5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=y5(e[r]));return e}var mt=l5(Yt,{});mt.registerLanguage=function(e,r){return Yt.register(r)};mt.alias=function(e,r){return Yt.alias(e,r)};Fs.displayName="markup";Fs.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Fs(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(s,i){var l={};l["language-"+i]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[i]},l.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:l}};u["language-"+i]={pattern:/[\s\S]+/,inside:e.languages[i]};var h={};h[s]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",h)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,s){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:[s,"language-"+s],inside:e.languages[s]},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}dc.displayName="css";dc.aliases=[];function dc(e){(function(r){var s=/(?:"(?:\\(?:\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+"|"+s.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\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,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 i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))})(e)}Us.displayName="clike";Us.aliases=[];function Us(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:/[{}[\];(),.:]/}}po.displayName="javascript";po.aliases=["js"];function po(e){e.register(Us),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}uf.displayName="sql";uf.aliases=[];function uf(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:/[;[\]()`,.]/}}hc.displayName="c";hc.aliases=[];function hc(e){e.register(Us),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}df.displayName="cpp";df.aliases=[];function df(e){e.register(hc),(function(r){var s=/\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/,i=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return s.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 s.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:s,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 i})+")"),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)}hf.displayName="bash";hf.aliases=["sh","shell"];function hf(e){(function(r){var s="\\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",i={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},l={bash:i,environment:{pattern:RegExp("\\$"+s),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("(\\{)"+s),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;|&]|[<>]\\()"+s),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:l},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:i}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:l},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:l.entity}}],environment:{pattern:RegExp("\\$?"+s),alias:"constant"},variable:l.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}},i.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"],h=l.variable[1].inside,c=0;c<u.length;c++)h[u[c]]=r.languages.bash[u[c]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}ff.displayName="yaml";ff.aliases=["yml"];function ff(e){(function(r){var s=/[*&][^\s[\]{},]+/,i=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,l="(?:"+i.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+i.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}),h=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(d,f){f=(f||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return l}).replace(/<<value>>/g,function(){return d});return RegExp(g,f)}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 l})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return l}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+h+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\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:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(h),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:i,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}pf.displayName="markdown";pf.aliases=["md"];function pf(e){e.register(Fs),(function(r){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function i(c){return c=c.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+c+")")}var l=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return l}),h=/\|?[ \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+h+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+h+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(l),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+h+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(l),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:i(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:i(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:i(/(~~?)(?:(?!~)<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:i(/!?\[(?:(?!\])<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(c){["url","bold","italic","strike","code-snippet"].forEach(function(d){c!==d&&(r.languages.markdown[c].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(c){if(c.language!=="markdown"&&c.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var g=0,m=f.length;g<m;g++){var v=f[g];if(v.type!=="code"){d(v.content);continue}var S=v.content[1],k=v.content[3];if(S&&k&&S.type==="code-language"&&k.type==="code-block"&&typeof S.content=="string"){var C=S.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var y="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,y]:k.alias.push(y):k.alias=[y]}}}d(c.tokens)}),r.hooks.add("wrap",function(c){if(c.type==="code-block"){for(var d="",f=0,g=c.classes.length;f<g;f++){var m=c.classes[f],v=/language-(.+)/.exec(m);if(v){d=v[1];break}}var S=r.languages[d];if(S)c.content=r.highlight(c.content.value,S,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);c.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)}mf.displayName="ruby";mf.aliases=["rb"];function mf(e){e.register(Us),(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 s={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 i="(?:"+[/([^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("|")+")",l=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+i+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+l),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+l+/(?=:(?!:))/.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+i),greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:s,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:s,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+i),greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:s,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)}gf.displayName="diff";gf.aliases=[];function gf(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var s={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(s).forEach(function(i){var l=s[i],u=[];/^\w+$/.test(i)||u.push(/\w+/.exec(i)[0]),i==="diff"&&u.push("bold"),r.languages.diff[i]={pattern:RegExp("^(?:["+l+`].*(?:\r
|
|
127
|
-
?|
|
|
128
|
-
|(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(i)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:s})})(e)}xf.displayName="docker";xf.aliases=["dockerfile"];function xf(e){(function(r){var s=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,i=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return s}),l=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return l}),h={pattern:RegExp(l),greedy:!0},c={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(f,g){return f=f.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return i}),RegExp(f,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:[h,{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:c,string:h,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:c},r.languages.dockerfile=r.languages.docker})(e)}bf.displayName="go";bf.aliases=[];function bf(e){e.register(Us),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"]}vf.displayName="graphql";vf.aliases=[];function vf(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(s){if(s.language!=="graphql")return;var i=s.tokens.filter(function(y){return typeof y!="string"&&y.type!=="comment"&&y.type!=="scalar"}),l=0;function u(y){return i[l+y]}function h(y,b){b=b||0;for(var x=0;x<y.length;x++){var _=u(x+b);if(!_||_.type!==y[x])return!1}return!0}function c(y,b){for(var x=1,_=l;_<i.length;_++){var j=i[_],T=j.content;if(j.type==="punctuation"&&typeof T=="string"){if(y.test(T))x++;else if(b.test(T)&&(x--,x===0))return _}}return-1}function d(y,b){var x=y.alias;x?Array.isArray(x)||(y.alias=x=[x]):y.alias=x=[],x.push(b)}for(;l<i.length;){var f=i[l++];if(f.type==="keyword"&&f.content==="mutation"){var g=[];if(h(["definition-mutation","punctuation"])&&u(1).content==="("){l+=2;var m=c(/^\($/,/^\)$/);if(m===-1)continue;for(;l<m;l++){var v=u(0);v.type==="variable"&&(d(v,"variable-input"),g.push(v.content))}l=m+1}if(h(["punctuation","property-query"])&&u(0).content==="{"&&(l++,d(u(0),"property-mutation"),g.length>0)){var S=c(/^\{$/,/^\}$/);if(S===-1)continue;for(var k=l;k<S;k++){var C=i[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}yf.displayName="scss";yf.aliases=[];function yf(e){e.register(dc),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}_f.displayName="json";_f.aliases=["webmanifest"];function _f(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}Sf.displayName="java";Sf.aliases=[];function Sf(e){e.register(Us),(function(r){var s=/\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/,i=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,l={pattern:RegExp(/(^|[^\w.])/.source+i+/[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":[l,{pattern:RegExp(/(^|[^\w.])/.source+i+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:l.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+i+/[A-Z]\w*\b/.source),lookbehind:!0,inside:l.inside}],keyword:s,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":l,keyword:s,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+i+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:l.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+i+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:l.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 s.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}fc.displayName="typescript";fc.aliases=["ts"];function fc(e){e.register(po),(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 s=r.languages.extend("typescript",{});delete s["class-name"],r.languages.typescript["class-name"].inside=s,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:s}}}}),r.languages.ts=r.languages.typescript})(e)}wf.displayName="python";wf.aliases=["py"];function wf(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}pc.displayName="jsx";pc.aliases=[];function pc(e){e.register(po),e.register(Fs),(function(r){var s=r.util.clone(r.languages.javascript),i=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,l=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function h(f,g){return f=f.replace(/<S>/g,function(){return i}).replace(/<BRACES>/g,function(){return l}).replace(/<SPREAD>/g,function(){return u}),RegExp(f,g)}u=h(u).source,r.languages.jsx=r.languages.extend("markup",s),r.languages.jsx.tag.pattern=h(/<\/?(?:[\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=s.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:h(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:h(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var c=function(f){return f?typeof f=="string"?f:typeof f.content=="string"?f.content:f.content.map(c).join(""):""},d=function(f){for(var g=[],m=0;m<f.length;m++){var v=f[m],S=!1;if(typeof v!="string"&&(v.type==="tag"&&v.content[0]&&v.content[0].type==="tag"?v.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===c(v.content[0].content[1])&&g.pop():v.content[v.content.length-1].content==="/>"||g.push({tagName:c(v.content[0].content[1]),openedBraces:0}):g.length>0&&v.type==="punctuation"&&v.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&v.type==="punctuation"&&v.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof v=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var k=c(v);m<f.length-1&&(typeof f[m+1]=="string"||f[m+1].type==="plain-text")&&(k+=c(f[m+1]),f.splice(m+1,1)),m>0&&(typeof f[m-1]=="string"||f[m-1].type==="plain-text")&&(k=c(f[m-1])+k,f.splice(m-1,1),m--),f[m]=new r.Token("plain-text",k,null,k)}v.content&&typeof v.content!="string"&&d(v.content)}};r.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||d(f.tokens)})})(e)}Cf.displayName="tsx";Cf.aliases=[];function Cf(e){e.register(pc),e.register(fc),(function(r){var s=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",s),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var i=r.languages.tsx.tag;i.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+i.pattern.source+")",i.pattern.flags),i.lookbehind=!0})(e)}kf.displayName="rust";kf.aliases=[];function kf(e){(function(r){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,i=0;i<2;i++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),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)}Ef.displayName="toml";Ef.aliases=[];function Ef(e){(function(r){var s=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function i(l){return l.replace(/__/g,function(){return s})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(i(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(i(/(^[\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 Fl={'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%)"}};mt.registerLanguage("typescript",fc);mt.registerLanguage("javascript",po);mt.registerLanguage("tsx",Cf);mt.registerLanguage("jsx",pc);mt.registerLanguage("python",wf);mt.registerLanguage("bash",hf);mt.registerLanguage("json",_f);mt.registerLanguage("css",dc);mt.registerLanguage("html",Fs);mt.registerLanguage("markup",Fs);mt.registerLanguage("xml",Fs);mt.registerLanguage("sql",uf);mt.registerLanguage("yaml",ff);mt.registerLanguage("markdown",pf);mt.registerLanguage("diff",gf);mt.registerLanguage("rust",kf);mt.registerLanguage("go",bf);mt.registerLanguage("java",Sf);mt.registerLanguage("c",hc);mt.registerLanguage("cpp",df);mt.registerLanguage("ruby",mf);mt.registerLanguage("toml",Ef);mt.registerLanguage("scss",yf);mt.registerLanguage("graphql",vf);mt.registerLanguage("docker",xf);function I0(e=2e3){const[r,s]=z.useState(!1),i=z.useCallback(async l=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(l);else{const u=document.createElement("textarea");u.value=l,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}s(!0),setTimeout(()=>s(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:i}}function O5(e){const r=e?"text-text-muted":"text-sky-400",s=e?"text-text-secondary":"text-amber-400";return{code({className:i,children:l,...u}){const h=/language-(\w+)/.exec(i||"");if(!h&&!String(l).includes(`
|
|
129
|
-
`)){const v=e?"text-text-muted":"text-accent-secondary";return o.jsx("code",{className:`bg-bg-tertiary px-1 py-0.5 rounded ${v} font-mono text-xs`,...u,children:l})}const d=(h==null?void 0:h[1])||"text",f=String(l).replace(/\n$/,""),{copied:g,copy:m}=I0();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:d}),o.jsx("button",{type:"button",onClick:v=>{v.preventDefault(),v.stopPropagation(),m(f)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:g?o.jsx(Mr,{}):o.jsx(Mh,{})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(mt,{style:Fl,language:d,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})})]})},p({children:i}){const l=e?"text-text-muted":"text-text-primary";return o.jsx("p",{className:`${l} mb-1.5 last:mb-0 leading-tight`,children:i})},ul({children:i}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:i})},ol({children:i}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:i})},li({children:i}){const l=e?"text-text-muted":"text-text-primary";return o.jsx("li",{className:`${l} text-sm list-item`,children:i})},h1({children:i}){return o.jsx("h1",{className:`text-base font-bold mb-1.5 mt-2 first:mt-0 ${r}`,children:i})},h2({children:i}){return o.jsx("h2",{className:`text-sm font-bold mb-1.5 mt-2 first:mt-0 ${r}`,children:i})},h3({children:i}){return o.jsx("h3",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${r}`,children:i})},h4({children:i}){return o.jsx("h4",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${r}`,children:i})},strong({children:i}){return o.jsx("strong",{className:`font-bold ${s}`,children:i})},em({children:i}){return o.jsx("em",{className:e?"italic text-text-secondary":"italic",children:i})},a({href:i,children:l}){return o.jsx("a",{href:i,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:l})},blockquote({children:i}){const l=e?"text-text-muted":"text-text-secondary";return o.jsx("blockquote",{className:`border-l-2 border-accent-primary pl-2 my-1.5 ${l} italic text-sm`,children:i})},table({children:i}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:i})})},th({children:i}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:i})},td({children:i}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:i})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:i,...l}){return o.jsx("input",{type:"checkbox",checked:i,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...l})}}}const Ir=z.memo(function({content:r,className:s="",muted:i=!1}){const l=z.useMemo(()=>{let h=M5(r);return h=I5(h),h},[r]),u=z.useMemo(()=>O5(i),[i]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${s}`,children:o.jsx(EN,{remarkPlugins:[P3],components:u,children:l})})});function M5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r=r.replace(/^\|\s*$/gm,""),r=r.replace(/^\d+:\s/gm,""),r}function I5(e){const r=/```/g,s=e.match(r);if(((s==null?void 0:s.length)??0)%2===1){const l=e.lastIndexOf("```");return e.slice(l+3).includes(`
|
|
130
|
-
`),e+"\n```"}return e}const B5=z.memo(function({content:r,variant:s="default"}){return s==="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(Ir,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-secondary rounded p-1.5 feed-item",children:o.jsx(Ir,{content:r,muted:!0})})});function B0({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 z5={...Fl,'pre[class*="language-"]':{...Fl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Fl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},P5={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 mc(e){var l;if(!e)return"text";const r=e.split("/").pop()??"",s=r.toLowerCase();if(s==="dockerfile")return"docker";if(s==="makefile")return"makefile";if(s==="cmakelists.txt")return"cmake";const i=(l=r.split(".").pop())==null?void 0:l.toLowerCase();return i?P5[i]??"text":"text"}const z0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},H5={...z0,display:"inline"},F5={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},io=z.memo(function({code:r,language:s,variant:i}){const l=i==="inline"?"span":i==="block-nowrap"?"div":"pre",u=i==="inline"?H5:i==="block-nowrap"?z0:F5;return o.jsx(mt,{style:z5,language:s,PreTag:l,customStyle:u,children:r})});function P0({src:e,alt:r,isOpen:s,onClose:i}){return s?o.jsx(kt,{isOpen:s,onClose:i,title:"",size:"full",children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const U5=z.memo(function({oldString:r,newString:s,filePath:i}){const l=z.useMemo(()=>mc(i),[i]),u=r.split(`
|
|
131
|
-
`),h=s.split(`
|
|
132
|
-
`),c=r.length>0,d=s.length>0;return!c&&!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:[c&&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((f,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(io,{code:r,language:l,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:h.map((f,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(io,{code:s,language:l,variant:"block-nowrap"})})]})]})}),$5=z.memo(function({content:r,filePath:s}){const i=z.useMemo(()=>mc(s),[s]);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(`
|
|
133
|
-
`).map((l,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(io,{code:r,language:i,variant:"block"})})]})})}),q5=z.memo(function({regions:r,filePath:s}){const i=z.useMemo(()=>mc(s),[s]);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((l,u)=>o.jsx(W5,{region:l,language:i},u))})}),W5=z.memo(function({region:r,language:s}){const i=V5(r),l=Math.max(...r.beforeContext.map(h=>h.lineNumber),...r.afterContext.map(h=>h.lineNumber),...r.edits.flatMap(h=>[h.startLine,h.endLine])),u=String(l).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:i.map((h,c)=>o.jsx(G5,{item:h,language:s,lineNumWidth:u},c))})});function V5(e){const r=[];for(const s of e.beforeContext)r.push({type:"context",lineNumber:s.lineNumber,content:s.content});for(const s of e.edits){const i=s.oldContent.split(`
|
|
134
|
-
`);for(let u=0;u<i.length;u++)r.push({type:"removed",lineNumber:s.startLine+u,content:i[u]});const l=s.newContent.split(`
|
|
135
|
-
`);for(let u=0;u<l.length;u++)r.push({type:"added",lineNumber:s.startLine+u,content:l[u]})}for(const s of e.afterContext)r.push({type:"context",lineNumber:s.lineNumber,content:s.content});return r}const G5=z.memo(function({item:r,language:s,lineNumWidth:i}){const l=String(r.lineNumber).padStart(i," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",h=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",c=r.type==="context"?" ":r.type==="removed"?"-":"+",d=r.type==="removed"?"line-through decoration-red-400/30":"",f=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:f}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:l}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${h}`,children:c}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(io,{code:r.content||" ",language:s,variant:"inline"})})]})}),K5=z.memo(function({result:r,metadata:s,filePath:i,heightExpanded:l=!1}){const[u,h]=z.useState(!1),c=z.useMemo(()=>mc(i),[i]),d=s==null?void 0:s.mimeType,f=s==null?void 0:s.base64Data;if(d!=null&&d.startsWith("image/")&&f){const v=`data:${d};base64,${f}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>h(!0),children:o.jsx("img",{src:v,alt:i,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(P0,{src:v,alt:i,isOpen:u,onClose:()=>h(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});if(c==="markdown"){const v=r.split(`
|
|
136
|
-
`).filter(S=>!S.startsWith(`
|
|
137
|
-
[`)&&!S.startsWith("[")).map(S=>S.replace(/^\d+: /,"")).join(`
|
|
138
|
-
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto p-2`,children:o.jsx(Ir,{content:v})})}const g=r.split(`
|
|
139
|
-
`),m=g.filter(v=>!v.startsWith(`
|
|
140
|
-
[`)&&!v.startsWith("[")).map(v=>v.replace(/^\d+: /,"")).join(`
|
|
141
|
-
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"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(v=>!v.startsWith(`
|
|
142
|
-
[`)&&!v.startsWith("[")).map((v,S)=>{const k=v.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:S+1},S)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(io,{code:m,language:c,variant:"block"})})]})})}),Y5={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"}},bv=z.memo(function({diagnostics:r}){if(r.length===0)return null;const s=r.filter(u=>u.severity==="error"),i=r.filter(u=>u.severity==="warning"),l=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"}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[s.length," error",s.length!==1?"s":""]}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[i.length," warning",i.length!==1?"s":""]}),l.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,h)=>{const c=Y5[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${c.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${c.color} text-xs flex-shrink-0 w-4 text-center`,children:c.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})]})]},h)})})]})}),X5=z.memo(function({command:r,timeout:s,startedAt:i,streamingOutput:l,status:u,result:h,error:c,durationMs:d}){const f=z.useRef(null),[g,m]=z.useState(0);z.useEffect(()=>{f.current&&u==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[l,u]),z.useEffect(()=>{if(u!=="pending"||!i)return;const C=setInterval(()=>{m(Date.now()-i)},100);return()=>clearInterval(C)},[u,i]);const v=s/1e3,S=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(l==null?void 0:l.map(C=>C.content).join(""))??"":h??"";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:[S.toFixed(1),"s / ",v,"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/s*100)}%`}})}),(k||u==="pending")&&o.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${u==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:u==="pending"&&l?l.map((C,y)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:ql(C.content)},y)):ql(k)}),u==="error"&&c&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:c}),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"git_no_verify":return{title:"Git --no-verify",description:"Bypassing git hooks/pre-commit checks"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function Q5({confirmation:e}){const r=Se(m=>m.confirmPath),s=Se(m=>m.currentSession),i=Se(m=>m.switchDangerLevel),{title:l,description:u}=Z5(e.reason),h=e.reason==="sensitive_file"||e.reason==="both",c=h?"border-red-500/50":"border-amber-500/50",d=h?"bg-red-500/10":"bg-amber-500/10",f=e.reason==="git_no_verify",g=()=>{s!=null&&s.id&&i("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${c} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(dh,{}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${h?"text-red-400":"text-amber-400"}`,children:l}),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((m,v)=>o.jsx("li",{className:`text-xs font-mono ${h?"text-red-300":"text-amber-300"} break-all`,children:m},v))})}),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-text-primary transition-colors",children:"Allow"}),o.jsx("button",{onClick:g,className:`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors ${f?"hidden":"bg-red-600 hover:bg-red-700 text-white"}`,title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function J5(e,r){if(e==="read_file"){const i=String(r.path??""),l=r.offset,u=r.limit,h=[];return l!==void 0&&l!==1&&h.push(`offset=${l}`),u!==void 0&&h.push(`limit=${u}`),h.length>0?`${i} [${h.join(", ")}]`:i}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 i=String(r.content??"");return i.length>60?i.slice(0,60)+"...":i}const s=JSON.stringify(r);return s.length>50?s.slice(0,50)+"...":s}function vv(e,r,s){return J5(e,r)}function eA(e){return JSON.stringify(e,null,2)}const tA={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}},nA=z.memo(function({tool:r,args:s,status:i,variant:l="compact",forceCompact:u,result:h,error:c,durationMs:d,diagnostics:f,editContext:g,startedAt:m,streamingOutput:v,metadata:S,callId:k}){const C=r==="edit_file"||r==="write_file",y=r==="run_command"&&i==="pending",b=r==="read_file",_=u?!1:C||y||r==="return_value",[j,T]=z.useState(_),N=tA[i],D=Se(P=>P.pendingPathConfirmation),A=i==="pending"&&D&&k&&D.callId===k?D:null;return l==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-secondary rounded px-2 py-1.5",children:[o.jsx(B0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:vv(r,s)}),o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:i==="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-secondary hover:bg-secondary/80 text-left",onClick:()=>T(!j),children:[o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:N.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:vv(r,s)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),A&&o.jsx(Q5,{confirmation:A}),(j||b)&&o.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(X5,{command:String(s.command??""),timeout:s.timeout??12e4,startedAt:m,streamingOutput:v,status:i,result:h,error:c,durationMs:d}),r==="edit_file"&&i==="success"&&o.jsxs(o.Fragment,{children:[g&&g.regions.length>0?o.jsx(q5,{regions:g.regions,filePath:String(s.path??"")}):o.jsx(U5,{oldString:String(s.old_string??""),newString:String(s.new_string??""),filePath:String(s.path??"")}),f&&f.length>0&&o.jsx(bv,{diagnostics:f})]}),r==="write_file"&&i==="success"&&o.jsxs(o.Fragment,{children:[o.jsx($5,{content:String(s.content??""),filePath:String(s.path??"")}),f&&f.length>0&&o.jsx(bv,{diagnostics:f})]}),r==="read_file"&&i==="success"&&o.jsx(K5,{result:h,metadata:S,filePath:String(s.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const P=(v==null?void 0:v.map(H=>H.content).join(""))??"",O=i==="pending"&&P?P:String(s.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(Ir,{content:O})})]})})(),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:eA(s)})]}),i==="success"&&h!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",d!==void 0&&` (${d}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:h||"No output"})]})]}),i==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",d,"ms"]}),i==="error"&&c&&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:c})]})]})]})}),rA={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 sA(e){return rA[e]??`Preparing ${e}`}function iA(e){try{const r=e.replace(/\s*\}\s*$/,""),s=JSON.parse(r);if(typeof s.command=="string")return s.command}catch{const r=e.match(/"command"\s*:\s*"([^"]*)/);if(r&&r[1])return r[1]}return null}const aA=z.memo(function({name:r,arguments:s}){let l=sA(r)+"...";if(r==="run_command"&&s){const u=iA(s);u&&(l=u)}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(B0,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),r==="run_command"&&s?o.jsx("code",{className:"text-text-muted text-xs flex-1 truncate",children:l}):o.jsx("span",{className:"text-text-muted text-xs flex-1",children:l})]})})}),oA={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},lA=z.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((s,i)=>{const l=oA[s.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${i>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(l==null?void 0:l.color)??"text-text-muted"} ${l!=null&&l.animate?"animate-pulse":""} text-sm leading-tight`,children:(l==null?void 0:l.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${s.status==="completed"?"text-text-muted":"text-text-primary"}`,children:s.content})]},i)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),yv={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"}},H0=z.memo(function({toolCalls:r,criteria:s}){if(r.length===0)return null;const i=new Map((s==null?void 0:s.map(u=>[u.id,u]))??[]),l=r.find(u=>{var h,c;return u.arguments.action==="get"&&((h=u.result)==null?void 0:h.success)&&((c=u.result)==null?void 0:c.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{className:"bg-primary",children:l?(()=>{const u=l.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((c,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(Ir,{content:`[${c.id}] ${c.description}`})})]},c.id??d))}catch{return r.map((h,c)=>o.jsx(_v,{tc:h,index:c,criteriaMap:i},h.id??c))}})():r.map((u,h)=>o.jsx(_v,{tc:u,index:h,criteriaMap:i},u.id??h))})]})});function _v({tc:e,index:r,criteriaMap:s}){const i=e.arguments.action,l=i&&yv[i]?yv[i]:{icon:"○",color:"text-text-muted"},u=e.arguments,h=i==="remove",c=u.id,d=u.description,f=c?s.get(c):void 0,g=d??(f==null?void 0:f.description)??(h&&c?`[${c}]`:"Criterion updated"),m=u.reason,v=i==="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:`${l.color} text-sm leading-tight flex-shrink-0`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:h?"line-through text-text-muted":"",children:o.jsx(Ir,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${v?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function cA(e){return e==="criterion"}const uA="#6b7280";function Yl(e,r){var s;return((s=e.find(i=>i.id===r))==null?void 0:s.color)??uA}const Nt=Bn(e=>{const r=async()=>{await Fh("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async s=>{try{const i=await ke(`/api/agents/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/agents/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createAgent:async s=>{const i=await ds("POST","/api/agents",s);return i.success&&await r(),i},updateAgent:async(s,i)=>{const l=await ds("PUT",`/api/agents/${s}`,i);return l.success&&await r(),l},deleteAgent:async s=>{try{const i=await ke(`/api/agents/${s}`,{method:"DELETE"}),l=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(h=>h.id!==s)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async s=>{try{const i=await ke(`/api/agents/${s}/duplicate`,{method:"POST"}),l=await i.json();return i.ok?(await r(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function dA(e){const r=[];let s=[];const i=()=>{s.length>0&&(r.push({type:"criteria_group",toolCalls:s}),s=[])};for(const l of e)l.type==="tool_call"&&cA(l.toolCall.name)?s.push(l.toolCall):(i(),r.push(l));return i(),r}function hA(e,r){if(e.segments&&e.segments.length>0)return fA(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const s=[];if(e.thinkingContent&&s.push({type:"thinking",content:e.thinkingContent}),e.content&&s.push({type:"text",content:e.content}),e.toolCalls)for(const i of e.toolCalls)s.push({type:"tool_call",toolCall:i});if(e.preparingToolCalls)for(const i of e.preparingToolCalls)s.push({type:"preparing_tool_call",preparing:i});return r&&e.stats&&s.push({type:"stats",stats:e.stats}),s}function fA(e,r,s,i,l){const u=[],h=new Map(r.map(c=>[c.id,c]));for(const c of e)switch(c.type){case"text":u.push({type:"text",content:c.content});break;case"thinking":c.content&&c.content.trim().length>0&&u.push({type:"thinking",content:c.content});break;case"tool_call":{const d=h.get(c.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const c of s)u.push({type:"preparing_tool_call",preparing:c});return l&&i&&u.push({type:"stats",stats:i}),u}const jf=z.memo(function({message:r,showStats:s=!0,showThinking:i=!0,showVerboseToolOutput:l=!0}){const u=Se(v=>{var S;return(S=v.currentSession)==null?void 0:S.criteria}),h=Nt(v=>v.defaults),c=Nt(v=>v.userItems),d=[...h,...c],f=hA(r,s),g=i?f:f.filter(v=>v.type!=="thinking"),m=dA(g);return m.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[m.map((v,S)=>{var k,C;switch(v.type){case"thinking":return o.jsx(B5,{content:v.content},S);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Ir,{content:v.content})},S);case"preparing_tool_call":return o.jsx(aA,{name:v.preparing.name,arguments:v.preparing.arguments},`preparing-${v.preparing.index}`);case"tool_call":{const y=v.toolCall,b=y.result;if(y.name==="todo_write"){const j=y.arguments.todos,T=Array.isArray(j)?j:[];return o.jsx(lA,{todos:T},S)}const x=(k=b==null?void 0:b.output)==null?void 0:k.includes("[interrupted by user]"),_=b?x?"interrupted":b.success?"success":"error":"pending";return o.jsx(nA,{tool:y.name,args:y.arguments,status:_,variant:"expandable",forceCompact:!l,result:b==null?void 0:b.output,error:b==null?void 0:b.error,durationMs:b==null?void 0:b.durationMs,diagnostics:b==null?void 0:b.diagnostics,editContext:b==null?void 0:b.editContext,startedAt:y.startedAt,streamingOutput:y.streamingOutput,metadata:b==null?void 0:b.metadata,callId:y.id},S)}case"criteria_group":return o.jsx(H0,{toolCalls:v.toolCalls,criteria:u},S);case"stats":{const y=v.stats;if(!y||"error"in y)return null;const b=((C=y.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??y.model,x=Yl(d,y.mode),_=T=>T>=1e3?`${(T/1e3).toFixed(1)}k`:T.toString(),j=T=>T>=1e3?`${(T/1e3).toFixed(1)}k`:T.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:b}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:x},children:y.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.totalTime.toFixed(1),"s"]}),y.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[y.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_(y.prefillTokens)," @ ",j(y.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_(y.generationTokens)," @ ",j(y.generationSpeed)," tg"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const T=new CustomEvent("open-turn-stats",{detail:{stats:y}});window.dispatchEvent(T)},children:o.jsx(Dw,{className:"w-3 h-3"})}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},S)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx(dh,{}),o.jsx("span",{children:"Aborted"})]}),r.completeReason==="truncated"&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber-400/80 mt-1",children:[o.jsx(dh,{}),o.jsx("span",{children:"Response was truncated — the model ran out of output tokens."})]})]})})});function Xl(e,r){const s=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${s},${i},${l},${r})`}function pA(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),s=Math.round(e%60);return s>0?`${r}m ${s}s`:`${r}m`}function mA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const gA=z.memo(function({data:r}){var h;const s=jt(c=>c.defaults),i=jt(c=>c.userItems),u=((h=[...s,...i].find(c=>c.id===r.workflowId))==null?void 0:h.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Xl(u,.3),backgroundColor:Xl(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Fw,{color:u}),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(qa,{label:"Iterations",value:String(r.iterations)}),o.jsx(qa,{label:"Total time",value:pA(r.totalTimeSeconds)}),o.jsx(qa,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(qa,{label:"Tokens",value:mA(r.totalTokensGenerated)}),o.jsx(qa,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function qa({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 xA=z.memo(function({data:r}){var h;const s=jt(c=>c.defaults),i=jt(c=>c.userItems),u=((h=[...s,...i].find(c=>c.id===r.workflowId))==null?void 0:h.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Xl(u,.3),backgroundColor:Xl(u,.08)},children:[o.jsx(Ow,{className:"w-3 h-3 shrink-0",color:u}),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 bA({attachments:e,messageId:r}){const[s,i]=z.useState(null),l=Se(g=>g.visionFallbackByMessage),u=Se(g=>g.messages),h=z.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const v=u[m];if(v&&v.role==="assistant")return v.id}return null},[u,r]),c=g=>{i(g)},d=()=>{i(null)},f=g=>{const m=`${r}-${g}`;if(l[m])return l[m];if(h){const v=`${h}-${g}`;return l[v]}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=f(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>c(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)})}),s&&o.jsx(P0,{src:s,alt:"Attached image",isOpen:!0,onClose:d})]})}function vA({isOpen:e,onClose:r,promptContext:s}){const[i,l]=z.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=h=>{l(c=>({...c,[h]:!c[h]}))};return o.jsx(kt,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Ai,{title:"User Message",expanded:i.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:s.userMessage||"(empty)"})}),s.messages.length>0&&o.jsx(Ai,{title:`Prompt Messages (${s.messages.length})`,expanded:i.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:s.messages.map((h,c)=>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:h.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:h.source}),h.toolCallId&&o.jsx("span",{className:"font-mono",children:h.toolCallId}),h.attachments&&h.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[h.attachments.length," attachment",h.attachments.length===1?"":"s"]})]}),h.attachments&&h.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:h.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:h.content||"(empty)"})]},`${h.role}-${c}`))})}),o.jsx(Ai,{title:`Tools (${s.tools.length})`,expanded:i.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[s.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),s.tools.map((h,c)=>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:h.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:h.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(h.parameters,null,2)})]},`${h.name}-${c}`))]})}),o.jsx(Ai,{title:"Request Options",expanded:i.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(s.requestOptions,null,2)})}),s.injectedFiles.length>0&&o.jsx(Ai,{title:`Injected Files (${s.injectedFiles.length})`,expanded:i.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:s.injectedFiles.map((h,c)=>o.jsx(yA,{file:h,expanded:i[`file-${c}`]??!1,onToggle:()=>u(`file-${c}`)},c))})}),o.jsx(Ai,{title:"System Prompt",expanded:i.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(s.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:s.systemPrompt})})]})})}function yA({file:e,expanded:r,onToggle:s}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:s,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx(hr,{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`}),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 Ai({title:e,expanded:r,onToggle:s,badge:i,children:l}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:s,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(hr,{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),i&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:i})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:l})]})}function _A({content:e,promptContext:r,align:s="right",messageIndex:i,sessionId:l}){const[u,h]=z.useState(!1),[c,d]=z.useState(!1),[f,g]=z.useState(!1),[m,v]=z.useState(!1),S=z.useRef(null),k=Se(x=>x.loadSession);z.useEffect(()=>{const x=_=>{S.current&&!S.current.contains(_.target)&&h(!1)};return u&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const C=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const x=document.createElement("textarea");x.value=e,x.style.position="fixed",x.style.left="-999999px",document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x)}g(!0),h(!1),window.setTimeout(()=>g(!1),1500)}catch(x){console.error("Failed to copy:",x)}},y=async()=>{if(!l||i===void 0||!window.confirm("Delete all messages after this point?"))return;v(!0),h(!1),await k1(l,i)&&k(l),v(!1)},b=s==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${b?"":"order-first"}`,children:[f&&o.jsx(Mr,{className:"w-4 h-4 text-accent-success"}),o.jsxs("div",{ref:S,className:"relative",children:[o.jsx("button",{onClick:()=>h(!u),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsx(Ih,{})}),u&&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 ${b?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:C,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(Mh,{className:"w-4 h-4"}),"Copy"]}),l&&i!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border my-1"}),o.jsxs("button",{onClick:y,disabled:m,className:"w-full px-3 py-1.5 text-left text-sm text-red-400 hover:bg-bg-tertiary flex items-center gap-2 disabled:opacity-50",children:[o.jsx(tc,{className:"w-4 h-4"}),m?"Deleting...":"Delete after"]})]}),r&&o.jsxs("button",{onClick:()=>{d(!0),h(!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.jsx(ec,{className:"w-4 h-4"}),"Inspect"]})]})]})]}),r&&o.jsx(vA,{isOpen:c,onClose:()=>d(!1),promptContext:r})]})}function SA({message:e}){const[r,s]=z.useState(!1);if(e.messageKind!=="auto-prompt")return null;const i=e.metadata,l=(i==null?void 0:i.color)??"#6b7280",u=(i==null?void 0:i.name)??"Agent",h=(i==null?void 0:i.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[h]??"injected",f=h==="workflow"||h==="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 ${f?"":"cursor-pointer"}`,style:{backgroundColor:l},onClick:()=>!f&&s(!0)}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},onClick:()=>!f&&s(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&s(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&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 ${l}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(kt,{isOpen:r,onClose:()=>s(!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:l}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",h,")"]})]}),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 wA({message:e,promptContext:r,messageIndex:s,sessionId:i}){const l=e.messageKind==="auto-prompt",u=e.messageKind==="command",h=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!h&&o.jsx(_A,{content:e.content,promptContext:r,align:"right",messageIndex:s,sessionId:i}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${h?u?"bg-teal-500/10 border border-teal-500/30":l?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-text-primary"}`,children:[h&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${u?"text-teal-400":l?"text-slate-400":"text-amber-400"}`,children:u?"Command":l?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${h?`${u?"text-teal-200":l?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(bA,{attachments:e.attachments,messageId:e.id})]})]})}const F0=z.memo(function({message:r,isLastAssistantMessage:s=!1,promptContext:i,messageIndex:l,sessionId:u}){const h=r.role==="user",c=r.role==="assistant",d=r.role==="system",f=r.role==="tool";if(c)return o.jsx(jf,{message:r,showStats:s});if(d&&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]
|
|
143
|
-
`,"")})]});if(f)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 g=JSON.parse(r.content);return o.jsx(xA,{data:g})}catch{}if(r.messageKind==="task-completed")try{const g=JSON.parse(r.content);return o.jsx(gA,{data:g})}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(SA,{message:r}):h?o.jsx(wA,{message:r,promptContext:i,messageIndex:l,sessionId:u}):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(Ir,{content:r.content})})})}),U0=(e,r)=>{const s=z.useRef(!0),i=z.useRef(null),[l,u]=z.useState(!0),h=()=>{const c=e.current;c&&(c.scrollTop=c.scrollHeight)};return z.useEffect(()=>{const c=e.current;if(!c)return;const d=S=>{if(S.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{c.scrollHeight-c.scrollTop-c.offsetHeight<100&&(s.current=!0,u(!0))}));return}s.current=!1,u(!1)},f=S=>{S.touches[0]&&(i.current=S.touches[0].clientY)},g=S=>{if(i.current===null)return;const k=S.touches[0];if(!k)return;if(k.clientY-i.current>0){s.current=!1,u(!1);return}requestAnimationFrame(()=>requestAnimationFrame(()=>{c.scrollHeight-c.scrollTop-c.offsetHeight<100&&(s.current=!0,u(!0))}))},m=new MutationObserver(()=>{s.current&&requestAnimationFrame(h)}),v=setInterval(()=>{s.current&&h()},1e3);return c.addEventListener("wheel",d,{passive:!0}),c.addEventListener("touchstart",f,{passive:!0}),c.addEventListener("touchmove",g,{passive:!0}),m.observe(c,{childList:!0,subtree:!0,characterData:!0}),()=>{c.removeEventListener("wheel",d),c.removeEventListener("touchstart",f),c.removeEventListener("touchmove",g),m.disconnect(),clearInterval(v)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{s.current=!0,u(!0),h()},isAutoScrollActive:l,setAutoScroll:c=>{s.current=c,u(c),c&&h()}}},CA={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function kA(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function Sv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function EA({contextState:e}){const{currentTokens:r,maxTokens:s,compactionCount:i,dangerZone:l}=e,u=Math.round(r/s*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:Sv(u,l),children:[Ul(r),"/",Ul(s)]}),o.jsxs("span",{className:Sv(u,l),children:["(",u,"%)"]}),o.jsx(by,{percent:u,dangerZone:l,size:"sm"}),l&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),i>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[i,"x"]})]})}const jA=z.memo(function({messages:r,subAgentType:s,subAgentId:i,isStreaming:l}){const u=z.useRef(null),h=z.useRef(null),[c,d]=z.useState(!1),f=Nt(D=>D.defaults),g=Nt(D=>D.userItems),m=[...f,...g],v=Se(D=>D.subAgentContextStates[i]),{showThinking:S,showVerboseToolOutput:k}=Th(),{isAutoScrollActive:C,setAutoScroll:y}=U0(h,null);z.useEffect(()=>{l||y(!0)},[l]);const b=z.useCallback(()=>{const D=!c;d(D),D&&setTimeout(()=>{var A;(A=u.current)==null||A.scrollIntoView({block:"start",behavior:"smooth"})},220)},[c]),x=m.find(D=>D.id===s),_=(x==null?void 0:x.name)??CA[s]??s,j=Yl(m,s),T=kA(j),N=r.filter(D=>D.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:T,children:[o.jsx("span",{className:"text-xs font-medium",children:_}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:v&&o.jsx(EA,{contextState:v})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>y(!C),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${C?"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:b,children:[c?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:h,className:`${c?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:N.map(D=>D.role==="assistant"?o.jsx(jf,{message:D,showStats:!0,showThinking:S,showVerboseToolOutput:k},D.id):o.jsx(F0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function NA(e){const r={};let s=null;for(const i of e){if(i.role==="user"&&!i.isSystemGenerated){s=i.id;continue}i.role==="assistant"&&i.promptContext&&s&&r[s]===void 0&&(r[s]=i.promptContext)}return r}const TA=z.memo(function({displayItems:r,scrollContainerRef:s,highlightedMessageId:i}){const l=Se(H=>{var q;return(q=H.currentSession)==null?void 0:q.criteria}),u=Se(H=>{var q;return(q=H.currentSession)==null?void 0:q.id}),h=Se(H=>{var q;return(q=H.currentSession)==null?void 0:q.mode}),c=Se(H=>{var q;return(q=H.currentSession)==null?void 0:q.phase}),d=Se(H=>H.messages),f=Se(H=>H.error),g=Se(H=>H.clearError),m=Se(H=>H.acceptAndBuild),v=Oh(),{showThinking:S,showVerboseToolOutput:k,showStats:C,showAgentDefinitions:y,showWorkflowBars:b}=Th(),x=jt(H=>H.defaults),_=jt(H=>H.userItems),j=[...x,..._],T=z.useMemo(()=>NA(d),[d]),N=h==="planner",D=((l==null?void 0:l.length)??0)>0,A=c==="done",P=r.some(H=>H.type==="message"&&H.message.role==="assistant"),O=N&&D&&!v&&P&&!A;return o.jsxs("div",{ref:s,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative bg-primary",children:[o.jsx("div",{className:"pt-4",children:r.map((H,q)=>{if(H.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"})]},q);if(H.type==="subagent"){const F=H.messages.some(Z=>Z.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(jA,{messages:H.messages,subAgentType:H.subAgentType,subAgentId:H.subAgentId,isStreaming:F})},q)}if(H.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(H0,{toolCalls:H.toolCalls,criteria:l})},q);const W=H.message;if(W.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(jf,{message:W,showStats:C,showThinking:S,showVerboseToolOutput:k})},q);const G=!y&&W.messageKind==="auto-prompt",B=!b&&(W.messageKind==="workflow-started"||W.messageKind==="task-completed");return G||B?null:o.jsx("div",{className:"px-2 md:px-4",children:o.jsx("div",{"data-message-id":W.id,className:i===W.id?"rounded animate-highlight-fade":void 0,children:o.jsx(F0,{message:W,messageIndex:q,sessionId:u,isLastAssistantMessage:!1,promptContext:W.role==="user"?T[W.id]:void 0})})},q)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[f&&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:f.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:f.message})]}),o.jsx(lo,{onClick:g,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),O&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:j.map(H=>{const q=H.color??"#3b82f6",W=parseInt(q.slice(1,3),16),G=parseInt(q.slice(3,5),16),B=parseInt(q.slice(5,7),16),F=`rgba(${W},${G},${B},0.12)`,Z=`rgba(${W},${G},${B},0.22)`,Y=`rgba(${W},${G},${B},0.25)`;return o.jsxs("button",{onClick:()=>m(H.id),"data-testid":"workflow-run-button",className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:F,color:q,border:`1px solid ${Y}`},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=Z},onMouseLeave:I=>{I.currentTarget.style.backgroundColor=F},children:["▶ ",H.name]},H.id)})})]})]})});function AA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function DA({agent:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h}){return o.jsxs(Jv,{isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h,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(c=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:c},c)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function wv({title:e,agents:r,subagents:s,isBuiltIn:i,onView:l,onDuplicate:u,onEdit:h,onDelete:c}){if(r.length===0&&s.length===0)return null;const d=f=>o.jsx(DA,{agent:f,isBuiltIn:i,isConfirmingDelete:!1,onView:()=>l(f.id),onEdit:i?void 0:()=>h==null?void 0:h(f.id),onDuplicate:()=>u(f.id),onDelete:i?void 0:()=>c==null?void 0:c(f.id)},f.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),s.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:s.map(d)})]})]})]})}function RA({isOpen:e,onClose:r,initialEditId:s}){const i=Nt(me=>me.defaults),l=Nt(me=>me.userItems),u=Nt(me=>me.loading),h=Nt(me=>me.fetchAgents),c=Nt(me=>me.fetchAgent),d=Nt(me=>me.fetchDefaultContent),f=Nt(me=>me.createAgent),g=Nt(me=>me.updateAgent),m=Nt(me=>me.deleteAgent),[v,S]=z.useState("list"),[k,C]=z.useState(null),[y,b]=z.useState(!1),[x,_]=z.useState(""),[j,T]=z.useState(""),[N,D]=z.useState(""),[A,P]=z.useState(!0),[O,H]=z.useState([]),[q,W]=z.useState("#6b7280"),[G,B]=z.useState(""),[F,Z]=z.useState(""),[Y,I]=z.useState(!1),[L,R]=z.useState([]);function $(me){const je=new Map;for(const Me of me){const ht=Me.indexOf(":");if(ht===-1)je.set(Me,new Set);else{const ce=Me.slice(0,ht),Ae=Me.slice(ht+1).split(",").filter(Boolean);je.set(ce,new Set(Ae))}}return je}function U(me){const je=[];for(const[Me,ht]of me)ht.size===0?je.push(Me):je.push(`${Me}:${[...ht].join(",")}`);return je}const ne=$(O),Q=(me,je)=>{const Me=new Map(ne),ht=Me.get(me)||new Set,ce=new Set(ht);ce.has(je)?ce.delete(je):ce.add(je),ce.size===0?Me.set(me,new Set):Me.set(me,ce),H(U(Me))},ee=me=>{const je=new Map(ne);je.has(me)?je.delete(me):je.set(me,new Set),H(U(je))},X=me=>{_(me.metadata.name),T(me.metadata.id),D(me.metadata.description),P(me.metadata.subagent),H(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),B(me.prompt),Z("")},V=(me,je,Me)=>{_(me.metadata.name+" (copy)"),T(`${je}-copy-${Date.now()}`),D(me.metadata.description),P(me.metadata.subagent),H(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),B(me.prompt),Z(""),C(null),b(!1),S("edit")},ie=(me,je)=>{X(me),C(je),b(!0),S("edit")};z.useEffect(()=>{e&&(h(),ke("/api/tools").then(me=>me.json()).then(me=>R(me.tools||[])).catch(()=>R([])),s?i.some(je=>je.id===s)?d(s).then(je=>{je&&V(je,s)}):c(s).then(je=>{je&&(X(je),C(s),b(!1),S("edit"))}):(S("list"),C(null),b(!1)))},[e,h,c,d,s]);const re=async me=>{if(i.some(Me=>Me.id===me)){const Me=await d(me);if(!Me)return;ie(Me,me)}else{const Me=await c(me);if(!Me)return;ie(Me,me)}},be=async me=>{const je=await d(me);je&&V(je,me)},ve=()=>{C(null),_(""),T(""),D(""),P(!0),H(["read_file"]),W("#6b7280"),B(""),Z(""),b(!1),S("edit")},Re=async me=>{const je=await c(me);je&&(X(je),C(me),b(!1),S("edit"))},Oe=async me=>{await m(me)},ze=async()=>{const me=k??j;if(!me||!x||!G){Z("Name and prompt are required.");return}I(!0),Z("");const je={metadata:{id:me,name:x,description:N,subagent:A,allowedTools:O,color:q},prompt:G},Me=k?await g(k,je):await f(je);if(I(!1),!Me.success){Z(Me.error??"Failed to save agent.");return}s?r():S("list")},Ue=()=>{s?r():(S("list"),b(!1))},Te=me=>{_(me),k||T(AA(me))},pe=i.filter(me=>me.subagent),Ne=i.filter(me=>!me.subagent),$e=l.filter(me=>me.subagent),Tt=l.filter(me=>!me.subagent);return v==="edit"?o.jsx(kt,{isOpen:e,onClose:Ue,title:y?`${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:[F&&o.jsx(Wh,{message:F}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Is,{label:"Name",value:x,onChange:Te,placeholder:"My Agent",readOnly:y}),o.jsx(Is,{label:"ID",value:j,onChange:T,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Is,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:y}),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:()=>!y&&P(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${y?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!y&&P(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${A?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${y?"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:q,onChange:me=>!y&&W(me.target.value),disabled:y,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(me=>{const je=ne.has(me.name),Me=me.actions.length>0,ht=ne.get(me.name)||new Set,ce=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${je?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:me.name}),Me&&o.jsx("span",{className:`text-[10px] ${je&&ht.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},me.name);return Me?y?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:me.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},me.name):o.jsx(oo,{trigger:ce,minWidth:"160px",items:[...me.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${me.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${me.name}-${_e}`,checked:ht.has(_e),onChange:()=>Q(me.name,_e),disabled:y,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:je?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(je)ee(me.name);else{const _e=new Map(ne);_e.set(me.name,new Set(me.actions)),H(U(_e))}}}]},me.name):o.jsx("button",{onClick:()=>!y&&ee(me.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${je?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${y?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:me.name})},me.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:G,onChange:me=>!y&&B(me.target.value),readOnly:y,placeholder:"Instructions for this agent...",className:`h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary ${y?"opacity-60":""}`})]}),o.jsx(Xw,{onCancel:Ue,onSave:ze,saving:Y,saveDisabled:!x||!G||y}),y&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(Ze,{variant:"primary",onClick:()=>{_(x+" (copy)"),T(`${k}-copy-${Date.now()}`),C(null),b(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(kt,{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(Ze,{variant:"primary",size:"sm",onClick:ve,children:"+ New"})})]}),u&&i.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):i.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[i.length>0&&o.jsx(wv,{title:"Built-in",agents:Ne,subagents:pe,isBuiltIn:!0,onView:re,onDuplicate:be}),l.length>0&&o.jsx(wv,{title:"Custom",agents:Tt,subagents:$e,isBuiltIn:!1,onView:re,onDuplicate:be,onEdit:Re,onDelete:Oe})]})]})}function LA(){const e=Se(b=>{var x;return(x=b.currentSession)==null?void 0:x.mode}),r=Se(b=>b.switchMode),s=Nt(b=>b.defaults),i=Nt(b=>b.userItems),l=Nt(b=>b.fetchAgents),u=[...s,...i],[h,c]=z.useState(!1),[d,f]=z.useState(!1),[g,m]=z.useState(null),v=z.useRef(null);if(z.useEffect(()=>{l()},[l]),z.useEffect(()=>{function b(x){v.current&&!v.current.contains(x.target)&&c(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),!e)return null;const S=u.filter(b=>!b.subagent),k=S.find(b=>b.id===e),C=(k==null?void 0:k.name)??e,y=Yl(u,e);return o.jsxs("div",{className:"relative",ref:v,children:[o.jsxs("button",{type:"button",onClick:()=>c(!h),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:y},children:C}),o.jsx(hr,{className:`w-3 h-3 text-text-muted transition-transform ${h?"rotate-180":""}`})]}),h&&S.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:[S.map((b,x)=>{const _=b.id===e,j=Yl(u,b.id),T=x<4?`Ctrl+${x+1}`:null;return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${_?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{_||r(b.id),c(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"font-medium truncate",style:{color:j},children:b.name}),_&&o.jsx(Mr,{className:"w-3.5 h-3.5 text-text-muted shrink-0"})]}),T&&o.jsxs("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] bg-bg-tertiary text-text-muted rounded",children:["Ctrl+",x+1]})]},b.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{c(!1),f(!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(RA,{isOpen:d,onClose:()=>{f(!1),m(null)},initialEditId:g})]})}function OA(){const e=Se(i=>i.currentSession),r=Se(i=>i.switchDangerLevel);if(!e)return null;const s=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 ${s==="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 ${s==="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 MA({question:e}){const r=Se(h=>h.answerQuestion),[s,i]=z.useState(""),l=()=>{r(e.callId,s)},u=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),l())};return o.jsx(kt,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:s,onChange:h=>i(h.target.value),onKeyDown:u,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:"flex justify-end gap-2",children:[o.jsx(Ze,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(Ze,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})})}function IA(){const e=Se(i=>i.connectionStatus),r=Se(i=>i.reconnect);if(e==="connected")return null;const s=e==="reconnecting";return o.jsxs("div",{className:`
|
|
144
|
-
flex items-center justify-between px-4 py-2
|
|
145
|
-
text-sm font-medium
|
|
146
|
-
${s?"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"}
|
|
147
|
-
`,children:[o.jsx("div",{className:"flex items-center gap-2",children:s?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($w,{}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:s,className:`
|
|
148
|
-
px-3 py-1 rounded text-xs font-medium
|
|
149
|
-
transition-colors
|
|
150
|
-
${s?"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"}
|
|
151
|
-
`,children:s?"Reconnecting...":"Reconnect"})]})}function BA({attachment:e,onRemove:r}){const s=i=>i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/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(lo,{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:s(e.size)})]})}function zA({history:e,selectedIndex:r,onSelect:s,onEscape:i,onNavigate:l}){const u=z.useRef(null),h=z.useRef(null);z.useEffect(()=>{h.current&&u.current&&h.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const c=f=>{switch(f.key){case"Enter":f.preventDefault(),e[r]&&s(e[r].content);break;case"Escape":f.preventDefault(),i();break;case"ArrowUp":f.preventDefault(),l("up");break;case"ArrowDown":f.preventDefault(),l("down");break}},d=f=>{s(f)};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:c,children:e.map((f,g)=>o.jsxs("div",{ref:g===r?h:null,role:"listitem",onClick:()=>d(f.content),className:`
|
|
152
|
-
p-2 rounded cursor-pointer transition-colors
|
|
153
|
-
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
154
|
-
`,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}function PA(){const e=bw(),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"})]})}const on=Bn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await Fh("/api/commands",e)},fetchCommand:async s=>{try{const i=await ke(`/api/commands/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await ke(`/api/commands/defaults/${s}`);return i.ok?await i.json():null}catch{return null}},createCommand:async s=>{const i=await ds("POST","/api/commands",s);return i.success&&await r().fetchCommands(),i},updateCommand:async(s,i)=>{const l=await ds("PUT",`/api/commands/${s}`,i);return l.success&&await r().fetchCommands(),l},deleteCommand:async s=>{try{const i=await ke(`/api/commands/${s}`,{method:"DELETE"}),l=await i.json();return i.ok?(e(u=>({userItems:u.userItems.filter(h=>h.id!==s)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async s=>{try{const i=await ke(`/api/commands/${s}/duplicate`,{method:"POST"}),l=await i.json();return i.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}})),HA={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function FA(e,r={}){const s={...HA,...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<=s.maxSizeBytes){const l=await e.arrayBuffer(),u=KA(l),h=`data:${e.type};base64,${u}`,c=await $0(h);return{dataUrl:h,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await UA(e,s)}async function UA(e,r){const s=await qA(e),i=await $0(s),{width:l,height:u}=$A(i.width,i.height,r.maxWidth,r.maxHeight),h=WA();h.width=l,h.height=u;const c=h.getContext("2d");if(!c)throw new Error("Failed to get canvas context");c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(i,0,0,l,u);let d=r.quality,f="";for(let m=0;m<10&&(f=h.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),!(Cv(f)<=r.maxSizeBytes||d<=.3));m++)d-=.1;const g=Cv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:u}}function $A(e,r,s,i){const l=e/r;return e>r&&e>s?{width:s,height:Math.round(s/l)}:r>e&&r>i?{width:Math.round(i*l),height:i}:{width:e,height:r}}function qA(e){return new Promise((r,s)=>{const i=GA(),l=new i;l.onload=()=>r(l.result),l.onerror=()=>s(new Error("Failed to read file")),l.readAsDataURL(e)})}function $0(e){return new Promise((r,s)=>{const i=VA(),l=new i;l.onload=()=>r(l),l.onerror=()=>s(new Error("Failed to load image")),l.src=e})}function WA(){var r;const e=Nf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function VA(){const e=Nf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function GA(){const e=Nf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Nf(){return globalThis}function KA(e){const r=new Uint8Array(e);let s="";for(let i=0;i<r.byteLength;i++){const l=r[i];l!==void 0&&(s+=String.fromCharCode(l))}return btoa(s)}function Cv(e){const s=e.split(",")[1];return s?Math.round(s.length*3/4):0}function YA(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function XA(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${kv(e.size)}). Maximum size is ${kv(r)}.`}:{valid:!0}}function kv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function ih(e,r,s,i={}){const{maxSizeBytes:l=50*1024*1024,filename:u}=i;if(!YA(e)){s(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const h=XA(e,l);if(!h.valid){s(h.error??"Image file is too large");return}try{const c=await FA(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:Fv(),filename:u??e.name,mimeType:c.mimeType,size:c.size,data:c.dataUrl};r(d)}catch(c){const d=c instanceof Error?c.message??"Failed to process image":"Failed to process image";s(d)}}function ZA({content:e,children:r,position:s="top",delay:i=200}){const[l,u]=z.useState(!1),[h,c]=z.useState({top:0,left:0}),d=z.useRef(void 0),f=z.useRef(null);z.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const g=()=>{d.current=setTimeout(()=>{if(f.current){const S=f.current.getBoundingClientRect();c({top:S.top,left:S.left+S.width/2})}u(!0)},i)},m=()=>{d.current&&clearTimeout(d.current),u(!1)},v=(()=>{switch(s){case"top":return{top:h.top-8,left:h.left,tx:"-50%",ty:"-100%"};case"bottom":return{top:h.top+8,left:h.left,tx:"-50%",ty:"0%"};case"left":return{top:h.top,left:h.left-8,tx:"-100%",ty:"-50%"};case"right":return{top:h.top,left:h.left+8,tx:"0%",ty:"-50%"}}})();return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:f,className:"inline-flex",onMouseEnter:g,onMouseLeave:m,onFocus:g,onBlur:m,children:r}),l&&Fi.createPortal(o.jsx("div",{className:"fixed z-[9999] px-4 py-3 text-sm text-text-primary bg-bg-secondary border border-border rounded-lg shadow-xl max-w-sm break-words pointer-events-none",style:{top:v.top,left:v.left,transform:`translate(${v.tx}, ${v.ty})`},children:e}),document.body)]})}function ah(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null,supportsVision:e.supportsVision??null}}function QA({label:e,children:r}){return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary border-b border-border/50 pb-1",children:e}),r]})}function Wa({label:e,value:r,onChange:s,min:i,max:l,step:u=1,helpText:h,defaultValue:c,profileDefault:d,tooltip:f}){const[g,m]=z.useState((r==null?void 0:r.toString())??""),[v,S]=z.useState(r===null);z.useEffect(()=>{m((r==null?void 0:r.toString())??""),S(r===null)},[r]);const k=b=>{if(m(b),b==="")s(null);else{const x=parseFloat(b);isNaN(x)||s(x)}},C=()=>{v?(S(!1),c!==void 0&&(m(c.toString()),s(c))):(S(!0),s(null))},y=o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[f&&o.jsx(ZA,{content:f,children:o.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-xs text-text-muted hover:text-text-secondary cursor-help rounded-full border border-border/50",children:"?"})}),e,o.jsx("button",{type:"button",onClick:C,className:`text-xs px-1.5 py-0.5 rounded border ${v?"border-accent-primary/50 bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-secondary"}`,title:v?"Click to set a custom value":"Click to use default",children:v?"default":"custom"})]});return o.jsxs("div",{children:[y,o.jsx("input",{type:"number",min:i,max:l,step:u,value:g,readOnly:v,onChange:b=>k(b.target.value),onClick:()=>v&&C(),placeholder:v?`${d!==void 0?d:"Using default"} (click to edit)`:"",className:`w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary ${v?"opacity-50 cursor-pointer":""}`}),h&&o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[o.jsx("p",{className:"text-xs text-text-muted",children:h}),d!==void 0&&o.jsxs("span",{className:"text-xs text-text-muted/60",children:["(default: ",d,")"]})]}),!h&&d!==void 0&&o.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Profile default: ",d]})]})}function JA({isOpen:e,onClose:r,providerId:s,model:i}){const[l,u]=z.useState(()=>ah(i)),[h,c]=z.useState(!1),d=Ct(m=>m.updateModelSettings);z.useEffect(()=>{u(ah(i))},[i]);const f=async()=>{if(l.contextWindow<1024||l.contextWindow>1e7)return;c(!0);const m=l.temperature!==(i.temperature??null)||l.topP!==(i.topP??null)||l.topK!==(i.topK??null)||l.maxTokens!==(i.maxTokens??null)||l.supportsVision!==(i.supportsVision??null);await d(s,i.id,{contextWindow:l.contextWindow,...m&&{temperature:l.temperature,topP:l.topP,topK:l.topK,maxTokens:l.maxTokens,supportsVision:l.supportsVision??void 0}}),c(!1),r()},g=()=>{u(ah(i)),r()};return e?o.jsx(kt,{isOpen:e,onClose:r,title:"Model Properties",size:"lg",footer:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Ze,{variant:"secondary",onClick:g,disabled:h,children:"Cancel"}),o.jsx(Ze,{variant:"primary",onClick:f,disabled:h||l.contextWindow<1024||l.contextWindow>1e7,children:h?"Saving...":"Save"})]}),children:o.jsxs("div",{className:"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 font-mono text-sm break-all",children:i.id})]}),o.jsx(Wa,{label:"Context Window",value:l.contextWindow,onChange:m=>m!==null&&u(v=>({...v,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),o.jsxs(QA,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Wa,{label:"Temperature",value:l.temperature,onChange:m=>u(v=>({...v,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1,profileDefault:i.defaultTemperature,tooltip:"How random the response is. Low (0.1-0.3) = precise and predictable. High (0.7-1.5) = creative and varied."}),o.jsx(Wa,{label:"Top P",value:l.topP,onChange:m=>u(v=>({...v,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1,profileDefault:i.defaultTopP,tooltip:"How to pick the next word. Low (0.5-0.8) = stick to obvious choices. High (0.95-1.0) = allow surprising words."})]}),o.jsx(Wa,{label:"Top K",value:l.topK,onChange:m=>u(v=>({...v,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)",profileDefault:i.defaultTopK,tooltip:"Restricts word choices to the top K most likely ones. Low (10-20) = focused. High (50-200) = diverse. Not all backends support this."})]}),o.jsx(Wa,{label:"Max Tokens",value:l.maxTokens,onChange:m=>u(v=>({...v,maxTokens:m})),min:256,max:32e3,helpText:"Maximum tokens to generate per response",profileDefault:i.defaultMaxTokens,tooltip:"Longest response length. Higher values let the model write more, but use up your context window faster."}),o.jsxs("div",{children:[o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[o.jsx("input",{type:"checkbox",checked:l.supportsVision??!1,onChange:m=>u(v=>({...v,supportsVision:m.target.checked})),className:"rounded border-border bg-bg-tertiary text-accent-primary focus:ring-accent-primary focus:ring-offset-0"}),"Vision Enabled"]}),o.jsx("p",{className:"text-xs text-text-muted",children:"Allow sending images directly to this model. Disable if the model doesn't support vision."})]}),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 text-sm",children:[i.source==="backend"&&"Auto-detected from backend",i.source==="user"&&"Manually set",i.source==="default"&&"Default value"]})]})]})}):null}function e4(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function t4(){var Z;const[,e]=nr(),r=Se(Y=>Y.currentSession),s=Se(Y=>Y.setSessionProvider),[i,l]=z.useState(!1),[u,h]=z.useState([]),[c,d]=z.useState(null),f=z.useRef(null),[g,m]=z.useState(null),v=z.useRef(new Set),S=Ct(Y=>Y.providers),k=Ct(Y=>Y.activeProviderId),C=Ct(Y=>Y.defaultModelSelection);Ct(Y=>Y.backend);const y=Ct(Y=>Y.activating),b=Ct(Y=>Y.activateProvider),x=Ct(Y=>Y.refreshModel),_=Ct(Y=>Y.refreshProviderModels);z.useEffect(()=>{function Y(I){f.current&&!f.current.contains(I.target)&&(l(!1),h([]),v.current=new Set)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]),z.useEffect(()=>{if(i){const Y=S.map(I=>I.id);h(Y),Y.forEach(I=>{v.current.has(I)||(v.current.add(I),P(I))})}},[i,S]);const j=S.find(Y=>Y.id===k),T=(j==null?void 0:j.status)==="disconnected",N=C?C.split("/").pop()??null:null,D=N?((Z=N.split("/").pop())==null?void 0:Z.replace(/-/g," "))??N:"detecting...",A=(Y,I)=>C?C===`${Y}/${I}`:!1,P=async Y=>{d(Y);try{await _(Y)}catch{}finally{d(null)}},O=Y=>{u.includes(Y.id)?h(u.filter(I=>I!==Y.id)):(h([...u,Y.id]),P(Y.id))},H=async Y=>{if(Y.id===k){O(Y);return}r?(s(Y.id,void 0),Ct.getState().syncFromSession(Y.id,""),l(!1),h([])):await b(Y.id)&&(l(!1),h([]))},q=Y=>{O(Y)},W=async(Y,I)=>{Y.stopPropagation(),v.current.delete(I),await _(I),await P(I)},G=(Y,I)=>{m({providerId:Y,model:I})},B=()=>{m(null)},F=async(Y,I)=>{if(r){s(Y,I),Ct.getState().syncFromSession(Y,I),h([]),l(!1);return}d("activating");try{Ct.getState().syncFromSession(Y,I),h([]),l(!1);const L=await ke(`/api/providers/${Y}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:I})});if(L.ok){const R=await L.json();Ct.getState().syncFromSession(R.activeProviderId,R.model)}}catch{}finally{d(null)}};return S.length===0?o.jsxs("button",{type:"button",onClick:()=>x(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:T?"LLM server is offline. Click to retry.":N??"Click to refresh model",children:[T?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:D}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:f,children:[o.jsxs("button",{type:"button",onClick:()=>l(!i),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:[T?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:D}),o.jsx(hr,{className:"w-3 h-3 text-text-muted transition-transform",rotate:i?180:0})]}),i&&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 max-h-[80vh] overflow-y-auto",children:[o.jsx("div",{className:"py-1",children:S.map(Y=>{var I;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${Y.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${y?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!y&&H(Y),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${Y.id===k?"text-accent-primary":"text-text-primary"}`,children:Y.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:Y.backend!=="auto"&&tw(Y.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Y.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx(Mr,{className:"w-4 h-4"})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),W(L,Y.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx(Iw,{className:`w-4 h-4 ${c===Y.id?"animate-spin":""} ${Y.id===k?"text-accent-primary":"text-text-muted"}`})}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),q(Y)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx(hr,{className:`w-4 h-4 transition-transform ${u.includes(Y.id)?"rotate-180":""} ${Y.id===k?"text-accent-primary":"text-text-muted"}`})})]})]}),u.includes(Y.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border max-h-40 overflow-y-auto",children:c===Y.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(I=Y.models)!=null&&I.length?Y.models.map(L=>{var R;return o.jsxs("button",{type:"button",onClick:()=>F(Y.id,L.id),disabled:c==="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 ${c==="activating"?"opacity-50 cursor-wait":""} ${A(Y.id,L.id)?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((R=L.id.split("/").pop())==null?void 0:R.replace(/-/g," "))??L.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:e4(L.contextWindow)}),o.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),G(Y.id,L)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx(jw,{className:"w-3 h-3 text-text-muted"})})]}),A(Y.id,L.id)&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx(Mr,{className:"w-3.5 h-3.5"})})]},L.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},Y.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(JA,{isOpen:!0,onClose:B,providerId:g.providerId,model:g.model})]})}function n4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function r4({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(ec,{})})}function q0({isOpen:e,onClose:r,initialEditId:s}){const i=on(pe=>pe.defaults),l=on(pe=>pe.userItems),u=on(pe=>pe.loading),h=on(pe=>pe.fetchCommands),c=on(pe=>pe.fetchCommand),d=on(pe=>pe.fetchDefaultContent),f=on(pe=>pe.createCommand),g=on(pe=>pe.updateCommand),m=on(pe=>pe.deleteCommand),[v,S]=z.useState(null),[k,C]=z.useState(null),{view:y,editingId:b,formError:x,saving:_,formData:j,setView:T,setEditingId:N,setFormError:D,setFormData:A,setSaving:P}=ny(),{requestDelete:O,clearConfirm:H,isConfirming:q}=Uh(),W=z.useRef(!1),G=Nt(pe=>pe.defaults),B=Nt(pe=>pe.userItems),F=Nt(pe=>pe.fetchAgents),Y=[...G,...B].filter(pe=>!pe.subagent),I=z.useRef(h),L=z.useRef(F),R=z.useRef(c),$=z.useRef(d),U=z.useRef(s),ne=z.useRef(T),Q=z.useRef(N),ee=z.useRef(D),X=z.useRef(H);z.useEffect(()=>{I.current=h,L.current=F,R.current=c,$.current=d,U.current=s,ne.current=T,Q.current=N,ee.current=D,X.current=H}),z.useEffect(()=>{if(e)if(I.current(),L.current(),W.current||(X.current(),W.current=!0),U.current){const pe=i.some(Ne=>Ne.id===U.current);ne.current("edit"),Q.current(U.current),ee.current(""),pe?$.current(U.current).then(Ne=>{Ne&&A({name:Ne.metadata.name+" (copy)",id:`${U.current}-copy-${Date.now()}`,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!0})}):R.current(U.current).then(Ne=>{Ne&&A({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1})})}else ne.current("list"),Q.current(null);else W.current=!1},[e]);const V=async pe=>{S(pe);const Ne=await d(pe);C((Ne==null?void 0:Ne.prompt)??null)},ie=async pe=>{if(i.some($e=>$e.id===pe)){const $e=await d(pe);$e&&(N(null),A({name:`${$e.metadata.name} (copy)`,id:`${pe}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!0}),D(""),T("edit"))}else{const $e=await c(pe);$e&&(N(null),A({name:`${$e.metadata.name} (copy)`,id:`${pe}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!1}),D(""),T("edit"))}},re=()=>{A({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),T("edit")},be=async pe=>{const Ne=await c(pe);Ne&&(N(pe),A({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1}),D(""),T("edit"))},ve=async pe=>{await m(pe),H()},Re=async()=>{const pe=b??j.id;if(!pe||!j.name||!j.prompt){D("Name and message are required.");return}P(!0),D("");const Ne={metadata:{id:pe,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},$e=b?await g(b,Ne):await f(Ne);if(P(!1),!$e.success){D($e.error??"Failed to save command.");return}s?r():T("list")},Oe=()=>{s?r():(T("list"),S(null),C(null))},ze=pe=>{A(Ne=>({...Ne,name:pe})),(!b||j.isDefault)&&A(Ne=>({...Ne,id:n4(pe)}))},Ue=()=>{S(null),C(null),T("list")},Te=()=>{v&&(S(null),T("edit"),N(v),d(v).then(pe=>{pe&&A({name:`${pe.metadata.name} (copy)`,id:`${v}-copy-${Date.now()}`,prompt:pe.prompt,agentMode:pe.metadata.agentMode??"",isDefault:!0})}))};if(v){const pe=i.find(Ne=>Ne.id===v);return o.jsx(kt,{isOpen:e,onClose:Ue,title:`Default: ${(pe==null?void 0:pe.name)??v}`,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:v})]}),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:pe==null?void 0:pe.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:(pe==null?void 0:pe.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(Ze,{variant:"secondary",onClick:Ue,children:"Close"}),o.jsx(Ze,{variant:"primary",onClick:Te,children:"Duplicate & Customize"})]})]})})}return y==="edit"?o.jsx(kt,{isOpen:e,onClose:Oe,title:b?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[x&&o.jsx(Wh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(ty,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!b&&!j.isDefault,onNameChange:ze,onIdChange:pe=>A(Ne=>({...Ne,id:pe}))}),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:pe=>A(Ne=>({...Ne,agentMode:pe.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)"}),Y.map(pe=>o.jsx("option",{value:pe.id,children:pe.name},pe.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:pe=>A(Ne=>({...Ne,prompt:pe.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y 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(Ze,{variant:"secondary",onClick:Oe,children:"Cancel"}),o.jsx(Ze,{variant:"primary",onClick:Re,disabled:_||!j.name||!j.prompt,children:_?"Saving...":"Save"})]})]})}):o.jsxs(kt,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(Qv,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),o.jsxs(ey,{loading:u,hasItems:i.length>0||l.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[i.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:i.map(pe=>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:pe.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(r4,{onClick:()=>V(pe.id)}),o.jsx(Ja,{onClick:()=>ie(pe.id)})]})]},pe.id))})]}),l.length>0&&o.jsx(Zv,{children:l.map(pe=>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:pe.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(zi,{onClick:()=>be(pe.id)}),o.jsx(Ja,{onClick:()=>ie(pe.id)}),q(pe.id,"delete")?o.jsx($h,{onConfirm:()=>ve(pe.id),onCancel:H}):o.jsx(qh,{onClick:()=>O(pe.id)})]})]},pe.id))})]})]})}function s4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function i4(e){let r=1;for(;e.some(s=>s.id===`s${r}`);)r++;return`s${r}`}const a4=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],W0={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"},V0=[{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)"}],Rs=150,Or=54,Di=80,Ln=30,Ri=70,Ev=100,Ls=50,Bl=50,jv=4;function Tf(e,r){if(e.type==="agent"){const s=r.find(i=>i.id===e.toolMode);return{name:(s==null?void 0:s.name)??(e.toolMode||"Agent"),color:(s==null?void 0:s.color)||"#3b82f6"}}if(e.type==="sub_agent"){const s=r.find(i=>i.id===e.subAgentType);return{name:(s==null?void 0:s.name)??(e.subAgentType||"Sub-Agent"),color:(s==null?void 0:s.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function o4(e,r,s,i){const l=Bl+Ls+Rs+Ev+Rs+Ls+Bl,u=l/2,h=Bl+Ls+Rs/2,c=Bl+Ls+Rs+Ev+Rs/2,d=[],f=[],g=new Map,m=e.filter(G=>G.type==="agent"||G.type==="shell"),v=e.filter(G=>G.type==="sub_agent"),S=v.length>0,k=S?h:u,C=m.length>0?c:u,y=Ls+Ln/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:y,w:Di,h:Ln}),g.set("$start",{cx:k,cy:y,w:Di,h:Ln}),e.length===0){const G=y+Ln/2+Ri*2+Ln/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:G,w:Di,h:Ln}),g.set("$done",{cx:k,cy:G,w:Di,h:Ln}),{nodes:d,edges:f,width:l,height:G+Ln/2+Ls,posMap:g}}const b=y+Ln/2+Ri,x=(G,B)=>{G.forEach((F,Z)=>{const Y=b+Z*(Or+Ri)+Or/2,{name:I,color:L}=Tf(F,i);d.push({id:F.id,type:"step",label:I,color:L,cx:B,cy:Y,w:Rs,h:Or}),g.set(F.id,{cx:B,cy:Y,w:Rs,h:Or})})};x(m,k),x(v,C);const _=m.length>0?b+(m.length-1)*(Or+Ri)+Or/2:y,j=S?b+(v.length-1)*(Or+Ri)+Or/2:y,T=Math.max(_,j)+Or/2+Ri+Ln/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:T,w:Di,h:Ln}),g.set("$done",{cx:k,cy:T,w:Di,h:Ln});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:s,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const G of e)G.transitions.forEach((B,F)=>{if(!B.goto||!g.has(B.goto))return;const Z=g.get(G.id),Y=g.get(B.goto),I=B.when.type==="step_result"?`${B.when.result}`:W0[B.when.type]??B.when.type,L=G.id===B.goto;let R;L?R="back":Y.cy>Z.cy+1?R="down":Y.cy<Z.cy-1?R="back":R="same",N.push({from:G.id,to:B.goto,label:I,edgeKey:`${G.id}:${F}`,direction:R,backEdgeIndex:R==="back"?D++:0})});const A=new Map,P=new Map,O=new Map,H=new Map;for(const G of N)G.direction==="down"&&(A.set(G.from,(A.get(G.from)??0)+1),P.set(G.to,(P.get(G.to)??0)+1));const q=new Map,W=new Map;for(const G of N){if(G.direction!=="same")continue;const B=[G.from,G.to].sort().join("|");q.set(B,(q.get(B)??0)+1)}for(const G of N){if(G.direction==="back"||G.direction==="same"){let R=0;if(G.direction==="same"){const $=[G.from,G.to].sort().join("|");R=W.get($)??0,W.set($,R+1)}f.push({...G,fromPort:0,toPort:0,sameEdgeIndex:R});continue}const B=A.get(G.from)??1,F=P.get(G.to)??1,Z=O.get(G.from)??0,Y=H.get(G.to)??0;O.set(G.from,Z+1),H.set(G.to,Y+1);const I=B===1?0:-.6+1.2*Z/(B-1),L=F===1?0:-.6+1.2*Y/(F-1);f.push({...G,fromPort:I,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:f,width:l,height:T+Ln/2+Ls,posMap:g}}function l4({steps:e,entryStep:r,selectedNodeId:s,selectedEdgeKey:i,startConditionLabel:l,agentTypes:u,isReadOnly:h,onSelectNode:c,onSelectEdge:d,onRemoveStep:f,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:v,onDeleteTransition:S}){const k=z.useRef(null),C=z.useRef(!1),[y,b]=z.useState(null),[x,_]=z.useState(null),[j,T]=z.useState(null),{nodes:N,edges:D,width:A,height:P,posMap:O}=z.useMemo(()=>o4(e,r,l,u),[e,r,l,u]),H=z.useCallback(Q=>{var re;const ee=k.current;if(!ee)return{x:0,y:0};const X=ee.createSVGPoint();X.x=Q.clientX,X.y=Q.clientY;const V=(re=ee.getScreenCTM())==null?void 0:re.inverse();if(!V)return{x:0,y:0};const ie=X.matrixTransform(V);return{x:ie.x,y:ie.y}},[]),q=z.useCallback(Q=>!Q||!x||Q==="$start"?!1:x.type==="reconnect-from"?Q!=="$done":!0,[x]),W=z.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=H(Q);_({type:"new",fromNodeId:ee,mouseX:X.x,mouseY:X.y})},[H,h]),G=z.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=H(Q);_({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[H,h]),B=z.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=H(Q);_({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[H,h]),F=z.useCallback(Q=>{if(!x)return;const ee=H(Q);_(X=>X?{...X,mouseX:ee.x,mouseY:ee.y}:null)},[x,H]),Z=z.useCallback(()=>{x&&(C.current=!0,j&&q(j)&&(x.type==="new"?g(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&v(x.edgeKey,j)),_(null),T(null))},[x,j,q,g,m,v]),Y=z.useCallback(()=>{if(C.current){C.current=!1;return}c(null),d(null)},[c,d]);z.useEffect(()=>{if(h)return;const Q=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&i&&i!=="start"&&(ee.preventDefault(),S(i),d(null))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[h,i,S,d]);const I=Q=>{const ee=O.get(Q.from),X=O.get(Q.to);if(!ee||!X)return null;let V,ie,re,be="middle",ve,Re;if(Q.direction==="down"){const Oe=ee.cx+Q.fromPort*(ee.w/2-10),ze=ee.cy+ee.h/2,Ue=X.cx+Q.toPort*(X.w/2-10),Te=X.cy-X.h/2,pe=Te-ze,Ne=Ue-Oe;V=`M ${Oe} ${ze} C ${Oe} ${ze+pe*.4}, ${Ue-Ne*.2} ${Te-pe*.1}, ${Ue} ${Te}`,ie=Oe+(Ue-Oe)*.5,re=ze+pe*.6,ve={x:Oe,y:ze},Re={x:Ue,y:Te}}else if(Q.direction==="back"){const Oe=Q.from===Q.to,ze=ee.cx>=A/2,Ue=Q.backEdgeIndex*16,Te=ze?A-20-Ue:20+Ue;if(Oe){const pe=ee.cx>=A/2,Ne=30+Q.backEdgeIndex*14,$e=ee.cy-ee.h/2,Tt=pe?ee.cx+ee.w/2:ee.cx-ee.w/2,me=pe?Tt+Ne:Tt-Ne,je=ee.cx+(pe?ee.w/4:-ee.w/4),Me=$e-20-Q.backEdgeIndex*10;V=`M ${Tt} ${ee.cy} C ${me} ${ee.cy}, ${me} ${Me}, ${je} ${$e}`,ie=me+10,re=Me+4,be="middle",ve={x:Tt,y:ee.cy},Re={x:je,y:$e}}else{const pe=ze?ee.cx+ee.w/2:ee.cx-ee.w/2,Ne=X.cx+(ze?X.w/4:-X.w/4),$e=Math.min(ee.cy,X.cy)-X.h/2-18-Q.backEdgeIndex*14;V=`M ${pe} ${ee.cy} L ${Te} ${ee.cy} L ${Te} ${$e} L ${Ne} ${$e} L ${Ne} ${X.cy-X.h/2}`,ie=Te,re=(ee.cy+$e)/2,be=ze?"start":"end",ve={x:pe,y:ee.cy},Re={x:Ne,y:X.cy-X.h/2}}}else{const Oe=X.cx>ee.cx,ze=Q.sameEdgeIndex===0?-12:12,Ue=Oe?ee.cx+ee.w/2:ee.cx-ee.w/2,Te=Oe?X.cx-X.w/2:X.cx+X.w/2,pe=ee.cy+ze,Ne=X.cy+ze,$e=(Ue+Te)/2;V=`M ${Ue} ${pe} C ${$e} ${pe}, ${$e} ${Ne}, ${Te} ${Ne}`,ie=$e,re=(pe+Ne)/2-6,ve={x:Ue,y:pe},Re={x:Te,y:Ne}}return{path:V,labelX:ie,labelY:re,labelAnchor:be,fromPt:ve,toPt:Re}},L=(Q,ee)=>{const X=I(Q);if(!X)return null;const{path:V,labelX:ie,labelY:re,labelAnchor:be}=X,ve=i===Q.edgeKey,Re=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Oe=>{Oe.stopPropagation(),d(ve?null:Q.edgeKey)}}),o.jsx("path",{d:V,fill:"none",stroke:ve?"#58a6ff":"#484f58",strokeWidth:ve?2.2:1.2,markerEnd:ve?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Re&&o.jsx("text",{x:ie+(be==="start"?5:be==="end"?-5:0),y:re+3,textAnchor:be,className:"text-[8px]",fill:ve?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Q.label})]},ee)},R=()=>{if(!i||x)return null;const Q=D.find(re=>re.edgeKey===i);if(!Q)return null;const ee=I(Q);if(!ee)return null;const{fromPt:X,toPt:V}=ee,ie=6;return o.jsxs(o.Fragment,{children:[Q.edgeKey!=="start"&&o.jsx("circle",{cx:X.x,cy:X.y,r:ie,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>B(re,Q)}),o.jsx("circle",{cx:V.x,cy:V.y,r:ie,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>G(re,Q)})]})},$=()=>{if(!x)return null;let Q,ee,X,V;if(x.type==="reconnect-from"){const be=O.get(x.fixedTargetId);if(!be)return null;Q=x.mouseX,ee=x.mouseY,X=be.cx,V=be.cy-be.h/2}else{const be=O.get(x.fromNodeId);if(!be)return null;Q=be.cx,ee=be.cy+be.h/2,X=x.mouseX,V=x.mouseY}const ie=V-ee,re=Math.abs(ie)>10?`M ${Q} ${ee} C ${Q} ${ee+ie*.4}, ${X} ${V-ie*.4}, ${X} ${V}`:`M ${Q} ${ee} L ${X} ${V}`;return o.jsx("path",{d:re,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},U=Q=>{const ee=Q.cy+Q.h/2,X=(x==null?void 0:x.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:jv,fill:X?"#58a6ff":"#1c2128",stroke:X?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5,className:"cursor-crosshair",onMouseDown:V=>W(V,Q.id)})},ne=Q=>{const ee=Q.cy-Q.h/2,X=x&&j===Q.id&&q(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:jv,fill:X?"#3fb950":"#1c2128",stroke:X?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${A} ${P}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:F,onMouseUp:Z,onClick:Y,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((Q,ee)=>L(Q,ee)),N.map(Q=>{const ee=s===Q.id,X=Q.cx-Q.w/2,V=Q.cy-Q.h/2,ie=y===Q.id,re=x&&j===Q.id&&q(Q.id);if(Q.type==="terminal"){const ve=Q.id==="$start",Re=ve?"#58a6ff":"#3fb950",Oe=ve,ze=!ve;return o.jsxs("g",{onClick:Ue=>{Ue.stopPropagation(),ve&&!h&&d("start")},className:ve&&!h?"cursor-pointer":void 0,children:[re&&o.jsx("rect",{x:X-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ve&&i==="start"&&o.jsx("rect",{x:X-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:X,y:V,width:Q.w,height:Q.h,rx:Q.h/2,fill:Re,fillOpacity:.08,stroke:Re,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:Re,className:"text-[10px] font-medium",pointerEvents:"none",children:Q.label}),Oe&&U(Q),ze&&ne(Q)]},Q.id)}const be=Q.color??"#6b7280";return o.jsxs("g",{onClick:ve=>{ve.stopPropagation(),h||c(ee?null:Q.id)},onMouseEnter:()=>b(Q.id),onMouseLeave:()=>b(null),className:h?void 0:"cursor-pointer",children:[re&&o.jsx("rect",{x:X-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:X-3,y:V-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:X,y:V,width:Q.w,height:Q.h,rx:10,fill:be,fillOpacity:.08,stroke:be,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Q.label}),!h&&U(Q),!h&&ne(Q),ie&&!x&&!h&&o.jsxs("g",{onClick:ve=>{ve.stopPropagation(),f(Q.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:X+Q.w-2,cy:V+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:X+Q.w-5,y1:V-1,x2:X+Q.w+1,y2:V+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:X+Q.w+1,y1:V-1,x2:X+Q.w-5,y2:V+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),x&&N.map(Q=>q(Q.id)?o.jsx("rect",{x:Q.cx-Q.w/2-8,y:Q.cy-Q.h/2-8,width:Q.w+16,height:Q.h+16,fill:"transparent",rx:12,onMouseEnter:()=>T(Q.id),onMouseLeave:()=>T(null),onMouseUp:ee=>{ee.stopPropagation(),Z()}},`drop-${Q.id}`):null),$(),R()]})}const er="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",zs="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",ln="block text-[11px] text-text-secondary mb-0.5";function c4({fromLabel:e,toLabel:r,condition:s,fromStep:i,agentTypes:l,onUpdateCondition:u,onDelete:h}){const c=i&&(i.type==="sub_agent"||i.type==="agent")?l.find(f=>f.id===(i.type==="sub_agent"?i.subAgentType:i.toolMode)):void 0,d=(c==null?void 0:c.results)&&c.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:h,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(Kv,{}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Condition"}),o.jsx("select",{value:s.type,onChange:f=>{u(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:zs,children:V0.map(f=>o.jsx("option",{value:f.value,children:f.label},f.value))})]}),s.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Result"}),d?o.jsx("select",{value:s.result??c.results[0],onChange:f=>{u({type:"step_result",result:f.target.value})},className:zs,children:c.results.map(f=>o.jsx("option",{value:f,children:f},f))}):o.jsx("input",{type:"text",value:s.result??"success",onChange:f=>u({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:er})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function oh({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(s=>o.jsx("button",{type:"button",onClick:()=>r(s.name),title:s.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:`{{${s.name}}}`},s.name))})}function u4({step:e,isEntry:r,agentTypes:s,transitionCount:i,templateVariables:l,onUpdate:u,onRemove:h,onSetEntry:c}){const{color:d,name:f}=Tf(e,s);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:f}),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:c,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:h,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,v=m==="sub_agent"?"verification":"build";if(m==="agent"){const S=s.find(k=>!k.subagent);u({...e,type:m,phase:v,toolMode:(S==null?void 0:S.id)??"builder",name:(S==null?void 0:S.name)??"Agent"})}else if(m==="sub_agent"){const S=s.find(k=>k.subagent);u({...e,type:m,phase:v,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else u({...e,type:m,phase:v,name:"Shell"})},className:zs,children:a4.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=s.find(v=>v.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:zs,children:s.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:ln,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=s.find(v=>v.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:zs,children:[o.jsx("option",{value:"",children:"— select —"}),s.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:ln,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${er} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(oh,{variables:l,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${er} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(oh,{variables:l,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${er} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(oh,{variables:l,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:ln,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${er} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,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:`${er} 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:[i," outgoing transition",i!==1?"s":""," — drag from the bottom port to connect."]})})]})}const Nv=[];function G0({isOpen:e,onClose:r,initialEditId:s}){const i=jt(fe=>fe.defaults),l=jt(fe=>fe.userItems),u=jt(fe=>fe.loading),h=jt(fe=>fe.templateVariables),c=jt(fe=>fe.fetchWorkflows),d=jt(fe=>fe.fetchWorkflow),f=jt(fe=>fe.fetchDefaultContent),g=jt(fe=>fe.fetchTemplateVariables),m=jt(fe=>fe.createWorkflow),v=jt(fe=>fe.updateWorkflow),S=jt(fe=>fe.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:y}=Uh(),[b,x]=z.useState("list"),[_,j]=z.useState(null),[T,N]=z.useState(!1),[D,A]=z.useState(null),[P,O]=z.useState(null),[H,q]=z.useState(""),[W,G]=z.useState(""),[B,F]=z.useState(""),[Z,Y]=z.useState("1.0.0"),[I,L]=z.useState("#3b82f6"),[R,$]=z.useState(""),[U,ne]=z.useState(50),[Q,ee]=z.useState(Nv),[X,V]=z.useState({type:"always"}),[ie,re]=z.useState(""),[be,ve]=z.useState(!1),[Re,Oe]=z.useState([]),[ze]=z.useState(null);z.useEffect(()=>{e&&(c(),g(),ke("/api/agents").then(fe=>fe.json()).then(fe=>Oe(fe.agents??[])).catch(()=>{}),A(null),O(null),s?i.some(ye=>ye.id===s)?f(s).then(ye=>{ye&&(q(ye.metadata.name+" (copy)"),G(`${s}-copy-${Date.now()}`),F(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))}):d(s).then(ye=>{ye&&(q(ye.metadata.name),G(ye.metadata.id),F(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),j(s),N(!1),x("edit"))}):(x("list"),j(null),N(!1)))},[e,c,d,f,g,s]);const Ue=async fe=>{const ye=await d(fe);ye&&(j(fe),q(ye.metadata.name),G(ye.metadata.id),F(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),V(ye.startCondition??{type:"always"}),re(""),A(null),O(null),x("edit"))},Te=async()=>{var st;const fe=_??W;if(!fe||!H)return re("Name is required."),!1;if(Q.length===0)return re("Add at least one step."),!1;let ye=R;if(!ye||!Q.some(Fe=>Fe.id===ye)){if(ye=((st=Q.find(Fe=>Fe.id))==null?void 0:st.id)??"",!ye)return re("All steps need an ID."),!1;$(ye)}ve(!0),re("");const Ce={metadata:{id:fe,name:H,description:B,version:Z||"1.0.0",color:I},entryStep:ye,settings:{maxIterations:U},steps:Q,startCondition:X},qe=_?await v(_,Ce):await m(Ce);return ve(!1),qe.success?(_||j(fe),!0):(re(qe.error??"Failed to save."),!1)},pe=async()=>{await Te()},Ne=async()=>{await Te()&&(s?r():x("list"))},$e=()=>{s?r():x("list")},Tt=fe=>{q(fe),_||G(s4(fe))},me=async fe=>{if(i.some(Ce=>Ce.id===fe)){const Ce=await f(fe);if(!Ce)return;q(Ce.metadata.name),G(Ce.metadata.id),F(Ce.metadata.description),Y(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),$(Ce.entryStep),ne(Ce.settings.maxIterations),ee(Ce.steps),V(Ce.startCondition??{type:"always"}),re(""),j(fe),N(!0)}else{const Ce=await d(fe);if(!Ce)return;q(Ce.metadata.name),G(Ce.metadata.id),F(Ce.metadata.description),Y(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),$(Ce.entryStep),ne(Ce.settings.maxIterations),ee(Ce.steps),V(Ce.startCondition??{type:"always"}),re(""),j(fe),N(!0)}x("edit")},je=async fe=>{const Ce=i.some(qe=>qe.id===fe)?await f(fe):await d(fe);Ce&&(q(Ce.metadata.name+" (copy)"),G(`${fe}-copy-${Date.now()}`),F(Ce.metadata.description),Y(Ce.metadata.version),L(Ce.metadata.color??"#3b82f6"),$(Ce.entryStep),ne(Ce.settings.maxIterations),ee(Ce.steps),V(Ce.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))},Me=()=>{j(null),q(""),G(""),F(""),Y("1.0.0"),L("#3b82f6"),$(""),ne(50),ee(structuredClone(Nv)),V({type:"always"}),re(""),A(null),O(null),N(!1),x("edit")},ht=async fe=>{await S(fe),C()},ce=z.useCallback(fe=>{A(fe),O(null)},[]),_e=z.useCallback(fe=>{O(fe),A(null)},[]),Ae=D!==null?Number(D):-1,Ie=Ae>=0?Q[Ae]??null:null,Ve=z.useCallback(fe=>{ee(ye=>ye.map((Ce,qe)=>qe===Ae?fe:Ce))},[Ae]),At=X.type==="step_result"?`${X.result}`:W0[X.type]??X.type,Qe=()=>{const fe=Q.length,ye=i4(Q),Ce=Re.find(qe=>!qe.subagent);ee([...Q,{id:ye,name:(Ce==null?void 0:Ce.name)??"Agent",type:"agent",phase:"build",toolMode:(Ce==null?void 0:Ce.id)??"builder",transitions:[]}]),R||$(ye),ce(String(fe))},Mt=z.useCallback((fe,ye)=>{fe==="$start"?($(ye),_e("start")):ee(Ce=>{const qe=Ce.find(Fe=>Fe.id===fe),st=qe?qe.transitions.length:0;return _e(`${fe}:${st}`),Ce.map(Fe=>Fe.id===fe?{...Fe,transitions:[...Fe.transitions,{when:{type:"always"},goto:ye}]}:Fe)})},[_e]),Dt=z.useCallback((fe,ye)=>{if(fe==="start")$(ye);else{const Ce=fe.lastIndexOf(":"),qe=fe.slice(0,Ce),st=parseInt(fe.slice(Ce+1));ee(Fe=>Fe.map(en=>en.id===qe?{...en,transitions:en.transitions.map((Pt,Gt)=>Gt===st?{...Pt,goto:ye}:Pt)}:en))}},[]),ue=z.useCallback((fe,ye)=>{const Ce=fe.lastIndexOf(":"),qe=fe.slice(0,Ce),st=parseInt(fe.slice(Ce+1));ee(Fe=>{const en=Fe.find(Gt=>Gt.id===qe);if(!en)return Fe;const Pt=en.transitions[st];return Pt?Fe.map(Gt=>Gt.id===qe?{...Gt,transitions:Gt.transitions.filter(($s,gc)=>gc!==st)}:Gt.id===ye?{...Gt,transitions:[...Gt.transitions,Pt]}:Gt):Fe}),O(null)},[]),Ee=z.useCallback(fe=>{if(fe==="start")$("");else{const ye=fe.lastIndexOf(":"),Ce=fe.slice(0,ye),qe=parseInt(fe.slice(ye+1));ee(st=>st.map(Fe=>Fe.id===Ce?{...Fe,transitions:Fe.transitions.filter((en,Pt)=>Pt!==qe)}:Fe))}O(null)},[]),Ge=z.useCallback((fe,ye)=>{if(fe==="start")V(ye);else{const Ce=fe.lastIndexOf(":"),qe=fe.slice(0,Ce),st=parseInt(fe.slice(Ce+1));ee(Fe=>Fe.map(en=>en.id===qe?{...en,transitions:en.transitions.map((Pt,Gt)=>Gt===st?{...Pt,when:ye}:Pt)}:en))}},[]),lt=fe=>Tf(fe,Re).name,zn=()=>{if(!P)return null;if(P==="start"){const Pt=Q.find(Gt=>Gt.id===R);return{type:"start",fromLabel:"Start",toLabel:Pt?lt(Pt):"(none)",condition:X}}const fe=P.lastIndexOf(":"),ye=P.slice(0,fe),Ce=parseInt(P.slice(fe+1)),qe=Q.find(Pt=>Pt.id===ye);if(!qe)return null;const st=qe.transitions[Ce];if(!st)return null;const Fe=Q.find(Pt=>Pt.id===st.goto),en=st.goto==="$done"?"Done":Fe?lt(Fe):st.goto;return{type:"step",fromLabel:lt(qe),toLabel:en,condition:st.when}};if(b==="edit"){const fe=zn();return o.jsxs(kt,{isOpen:e,onClose:$e,title:T?H:_?"Edit Workflow":"New Workflow",size:"full",children:[ie&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ie}),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:ln,children:"Name"}),o.jsx("input",{value:H,onChange:ye=>Tt(ye.target.value),placeholder:"Workflow name",className:`${er} ${T?"opacity-50":""}`,readOnly:T})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:ln,children:"ID"}),o.jsx("input",{value:W,readOnly:!0,className:`${er} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:ln,children:"Description"}),o.jsx("input",{value:B,onChange:ye=>!T&&F(ye.target.value),readOnly:T,placeholder:"What does this workflow do?",className:`${er} ${T?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:ln,children:"Max Iter."}),o.jsx("input",{type:"number",value:U,onChange:ye=>!T&&ne(Number(ye.target.value)),readOnly:T,className:`${er} font-mono ${T?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Color"}),o.jsx("input",{type:"color",value:I,onChange:ye=>!T&&L(ye.target.value),disabled:T,className:`w-8 h-8 rounded border border-border bg-transparent ${T?"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"}),!T&&o.jsx("button",{onClick:Qe,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(l4,{steps:Q,entryStep:R,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:P,startConditionLabel:At,agentTypes:Re,isReadOnly:T,onSelectNode:ye=>{if(ye===null){ce(null);return}const Ce=Q.findIndex(qe=>qe.id===ye);ce(Ce>=0?String(Ce):null)},onSelectEdge:_e,onRemoveStep:ye=>{var qe;const Ce=Q.findIndex(st=>st.id===ye);if(ee(st=>st.filter(Fe=>Fe.id!==ye)),Ae===Ce&&ce(null),R===ye){const st=Q.filter(Fe=>Fe.id!==ye);$(((qe=st[0])==null?void 0:qe.id)??"")}},onCreateTransition:Mt,onReconnectTo:Dt,onReconnectFrom:ue,onDeleteTransition:Ee}),Q.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:Qe,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:T&&(fe||Ie)?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"})}),R&&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(Kv,{}),o.jsx("span",{className:"text-text-primary font-medium",children:fe.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Activation Condition"}),o.jsx("select",{value:X.type,onChange:ye=>V(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:zs,children:V0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),X.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:ln,children:"Result"}),R&&(()=>{const ye=Q.find(Fe=>Fe.id===R),Ce=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Re.find(Fe=>Fe.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,qe=(Ce==null?void 0:Ce.results)&&Ce.results.length>0,st=(Ce==null?void 0:Ce.results)??[];return qe?o.jsx("select",{value:X.result??st[0],onChange:Fe=>V({type:"step_result",result:Fe.target.value}),className:zs,children:st.map(Fe=>o.jsx("option",{value:Fe,children:Fe},Fe))}):o.jsx("input",{type:"text",value:X.result??"success",onChange:Fe=>V({type:"step_result",result:Fe.target.value}),placeholder:"e.g. success, passed, failed",className:er})})()]}),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(c4,{fromLabel:fe.fromLabel,toLabel:fe.toLabel,condition:fe.condition,fromStep:fe.type==="step"?Q.find(ye=>ye.id===fe.fromLabel):void 0,agentTypes:Re,onUpdateCondition:ye=>Ge(P,ye),onDelete:()=>Ee(P)}):Ie?o.jsx(u4,{step:Ie,isEntry:Ie.id===R,agentTypes:Re,transitionCount:Ie.transitions.length,templateVariables:h,onUpdate:Ve,onRemove:()=>{var ye;if(Ie&&(ee(Q.filter((Ce,qe)=>qe!==Ae)),ce(null),R===Ie.id)){const Ce=Q.filter((qe,st)=>st!==Ae);$(((ye=Ce[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>$(Ie.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(Ze,{variant:"secondary",onClick:$e,children:"Close"}),T?o.jsx(Ze,{variant:"primary",onClick:()=>{q(H+" (copy)"),G(`${_}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(Ze,{variant:"secondary",onClick:pe,disabled:be||!H,children:be?"Saving...":"Save"}),o.jsx(Ze,{variant:"primary",onClick:Ne,disabled:be||!H,children:"Save & Close"})]})]})]})}return o.jsxs(kt,{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(Ze,{variant:"primary",size:"sm",onClick:Me,children:"+ New"})})]}),u&&i.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):i.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[i.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:i.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:()=>me(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(ec,{})}),o.jsx(Ja,{onClick:()=>je(fe.id)})]})]},fe.id))})]}),l.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:l.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(Ja,{onClick:()=>je(fe.id)}),o.jsx(zi,{onClick:()=>Ue(fe.id)}),y(fe.id,"delete")?o.jsx($h,{onConfirm:()=>ht(fe.id),onCancel:()=>{}}):o.jsx(qh,{onClick:()=>k(fe.id)})]})]},fe.id))})]})]})]})}function d4(e,r){const s=e.startCondition;if(!s||s.type==="always")return!0;switch(s.type){case"has_pending_criteria":return r.some(i=>i.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(i=>i.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(i=>i.status.type==="completed"||i.status.type==="passed");case"any_criteria_blocked":return r.some(i=>i.status.type==="failed"&&i.attempts.filter(l=>l.status==="failed").length>=4);case"step_result":return null;default:return null}}function h4({onSendCommand:e,onSelectWorkflow:r,onOpenCommandsManager:s,onOpenWorkflowsManager:i,onAttach:l,textareaContent:u,attachments:h,criteria:c}){const[d,f]=z.useState(!1),[g,m]=z.useState("commands"),[v,S]=z.useState(""),[k,C]=z.useState(0),[y,b]=z.useState(null),[x,_]=z.useState(null),j=z.useRef(null),T=z.useRef(null),N=on($=>$.defaults),D=on($=>$.userItems),A=on($=>$.fetchCommands),P=jt($=>$.defaults),O=jt($=>$.userItems),H=jt($=>$.fetchWorkflows),q=[...N,...D],W=[...P,...O];z.useEffect(()=>{d&&(g==="commands"?A():g==="workflows"&&H())},[d,g,A,H]),z.useEffect(()=>{d&&(S(""),C(0),requestAnimationFrame(()=>{var $;return($=j.current)==null?void 0:$.focus()}))},[d,g]),z.useEffect(()=>{if(!d)return;const $=U=>{var ne;(ne=T.current)!=null&&ne.contains(U.target)||f(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[d]);const G=$=>{switch($.key){case"ArrowDown":$.preventDefault(),C(U=>{const Q=(g==="commands"?q:W).filter(ee=>{const X=v.toLowerCase();return!X||ee.name.toLowerCase().includes(X)});return Math.min(U+1,Q.length-1)});break;case"ArrowUp":$.preventDefault(),C(U=>Math.max(U-1,0));break;case"Enter":$.preventDefault();break;case"Escape":$.preventDefault(),f(!1);break}},B=$=>{S($),C(0)},F=q.filter($=>!v||$.name.toLowerCase().includes(v.toLowerCase())),Z=W.filter($=>!v||$.name.toLowerCase().includes(v.toLowerCase())),Y=async $=>{const U=await on.getState().fetchCommand($);U&&e(U.prompt,U.metadata.agentMode,u,h),f(!1)},I=$=>{r($),f(!1)},L=($,U)=>{U.stopPropagation(),f(!1),b($)},R=($,U)=>{U.stopPropagation(),f(!1),_($)};return o.jsxs("div",{ref:T,className:"relative",children:[o.jsx("button",{type:"button",onClick:()=>f(!d),className:"px-1.5 py-2 rounded-r bg-bg-secondary text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors border-l border-border/50",title:"More options",children:o.jsx(Yv,{className:"w-4 h-4"})}),d&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-80 bg-bg-secondary border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[o.jsxs("div",{className:"flex border-b border-border",children:[o.jsx("button",{type:"button",onClick:()=>{m("commands"),S(""),C(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="commands"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Commands"}),o.jsx("button",{type:"button",onClick:()=>{m("workflows"),S(""),C(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="workflows"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Workflows"}),o.jsx("button",{type:"button",onClick:()=>m("attach"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${g==="attach"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Attach"})]}),g!=="attach"&&o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:j,value:v,onChange:$=>B($.target.value),onKeyDown:G,placeholder:g==="commands"?"Search commands...":"Search workflows...",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"})}),o.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:g==="commands"?F.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:q.length===0?"No commands yet":"No matches"}):F.map(($,U)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${U===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>Y($.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:$.name})}),o.jsx(zi,{className:"opacity-0 group-hover:opacity-100",onClick:ne=>L($.id,ne)})]},$.id)):g==="workflows"?Z.length===0?o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:W.length===0?"No workflows yet":"No matches"}):Z.map(($,U)=>{const ne=d4($,c),Q=$.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${U===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>I($.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:Q}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:$.name}),ne!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:ne?"#22c55e":"#6b7280"},title:ne?"Entry condition met":"Entry condition not met"})]}),o.jsx(zi,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>R($.id,ee)})]},$.id)}):o.jsxs("div",{className:"p-4 flex flex-col items-center gap-3",children:[o.jsxs("button",{type:"button",onClick:()=>{l(),f(!1)},className:"flex items-center gap-2 px-4 py-2 rounded bg-bg-tertiary hover:bg-accent-primary/20 text-text-primary transition-colors",children:[o.jsx(ww,{className:"w-4 h-4"}),o.jsx("span",{className:"text-sm font-medium",children:"Attach image"})]}),o.jsx("span",{className:"text-xs text-text-muted",children:"or drag & drop into chat"})]})}),g!=="attach"&&o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{f(!1),g==="commands"?s():i()},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:g==="commands"?"Manage Commands...":"Manage Workflows..."})})]}),o.jsx(q0,{isOpen:!!y,onClose:()=>b(null),initialEditId:y}),o.jsx(G0,{isOpen:!!x,onClose:()=>_(null),initialEditId:x})]})}function K0(e,r){if(!r)return!0;const s=r.toLowerCase().split(/\s+/),i=e.toLowerCase().split(/\s+/);return s.every(l=>{for(const u of i){let h=0;for(let c=0;c<u.length&&h<l.length;c++)u[c]===l[h]&&h++;if(h===l.length)return!0}return!1})}function Y0(e,r,s,i,l){switch(e.key){case"ArrowDown":e.preventDefault(),s(u=>Math.min(u+1,r));break;case"ArrowUp":e.preventDefault(),s(u=>Math.max(u-1,0));break;case"Enter":e.preventDefault(),i();break;case"Escape":e.preventDefault(),l();break}}function f4(e){const r=e.match(/^\/p\/([^/]+)/);return r==null?void 0:r[1]}function p4({isOpen:e,onClose:r,onCloseComplete:s,onSelectCommand:i,onSelectWorkflow:l,onCloseCompleteAction:u,textareaContent:h,onSearchMessages:c,onToggleAutoScroll:d,isAutoScrollActive:f}){const[,g]=nr(),m=on(R=>R.fetchCommands),v=jt(R=>R.fetchWorkflows),S=Nt(R=>R.fetchAgents),k=on(R=>R.defaults),C=on(R=>R.userItems),y=jt(R=>R.defaults),b=jt(R=>R.userItems),x=Nt(R=>R.defaults),_=Nt(R=>R.userItems),j=Se(R=>{var $;return($=R.currentSession)==null?void 0:$.mode}),T=Se(R=>{var $;return(($=R.currentSession)==null?void 0:$.dangerLevel)??"normal"}),N=Se(R=>R.switchMode),D=Se(R=>R.switchDangerLevel),A=Se(R=>{var $;return($=R.currentSession)==null?void 0:$.projectId}),P=z.useRef(void 0),[O,H]=z.useState(""),[q,W]=z.useState(0),G=z.useRef(null),B=z.useRef(!1);z.useEffect(()=>{e&&(B.current=!0)},[e]),z.useEffect(()=>{if(e){m(),v(),S(),H(""),W(0);const R=setTimeout(()=>{var $;return($=G.current)==null?void 0:$.focus()},50);return()=>clearTimeout(R)}},[e,m,v,S]),z.useEffect(()=>{var R;!e&&B.current&&(s==null||s(),(R=P.current)==null||R.call(P),P.current=void 0)},[e,s]);const F=(R,$)=>{const U=new Set($.map(ne=>ne.id));return[...R.filter(ne=>!U.has(ne.id)),...$]},Y=[{id:"create-session",name:"New Session",prefix:"Action > Create",action:()=>{const R=A??f4(window.location.pathname);R&&g(`/p/${R}/new`)}},{id:"navigate-session",name:"Another Session",prefix:"Action > Navigate to",action:()=>{P.current=u,r()}},{id:"search-messages",name:"Messages",prefix:"Action > Search",action:()=>{r(),c==null||c()}},{id:"toggle-autoscroll",name:f?"Auto-scroll Off":"Auto-scroll On",prefix:"Action > Toggle",action:()=>{r(),d==null||d(!f)}},...F(x,_).filter(R=>!R.subagent&&R.id!==j).map(R=>({id:R.id,name:R.name,prefix:"Agent > Switch to",action:()=>N(R.id)})),...F(k,C).map(R=>({id:R.id,name:R.name,prefix:"Command > Launch",action:()=>i(R.id,h)})),...F(y,b).map(R=>({id:R.id,name:R.name,prefix:"Workflow > Run",action:()=>l(R.id)})),...["normal","dangerous"].filter(R=>R!==T).map(R=>({id:R,name:R.charAt(0).toUpperCase()+R.slice(1),prefix:"Mode > Switch to",action:()=>D(R)}))].filter(R=>K0(`${R.prefix} ${R.name}`,O)),I=Y.length-1,L=R=>{Y0(R,I,W,()=>{var $;($=Y[q])==null||$.action(),r()},r)};return e?Fi.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[o.jsx("input",{ref:G,type:"text",value:O,onChange:R=>{H(R.target.value),W(0)},onKeyDown:L,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx(Hh,{onClick:r,className:"shrink-0","aria-label":"Close"})]}),o.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:Y.length===0?o.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:k.length+C.length+y.length+b.length>0?"No matches":"No agents, commands, or workflows yet"}):Y.map((R,$)=>o.jsxs("button",{type:"button",onClick:()=>{R.action(),r()},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${$===q?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:[o.jsxs("span",{className:"text-text-muted font-normal",children:[R.prefix," "]}),o.jsx("span",{children:R.name})]},R.id))})]})]}),document.body):null}function m4(e){const r=new Date(e),s=new Date;if(r.getDate()===s.getDate()&&r.getMonth()===s.getMonth()&&r.getFullYear()===s.getFullYear())return r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});const l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),h=String(r.getDate()).padStart(2,"0"),c=String(r.getHours()).padStart(2,"0"),d=String(r.getMinutes()).padStart(2,"0");return`${l}/${u}/${h} ${c}:${d}`}function g4({isOpen:e,onClose:r,messages:s,onSelectMessage:i}){const[l,u]=z.useState(""),[h,c]=z.useState(0),d=z.useRef(null),f=z.useRef(!1),g=s.filter(C=>C.role==="user"&&!C.isSystemGenerated&&C.messageKind!=="auto-prompt"&&C.messageKind!=="command");z.useEffect(()=>{e&&(f.current=!0)},[e]),z.useEffect(()=>{if(e){u(""),c(0);const C=setTimeout(()=>{var y;return(y=d.current)==null?void 0:y.focus()},50);return()=>clearTimeout(C)}},[e]);const m=g.filter(C=>K0(C.content,l)),v=m.length-1,S=C=>{Y0(C,v,c,()=>{m[h]&&(i(m[h].id),r())},r)},k=C=>{i(C),r()};return e?Fi.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[o.jsx(zh,{}),o.jsx("input",{ref:d,type:"text",value:l,onChange:C=>{u(C.target.value),c(0)},onKeyDown:S,placeholder:"Search messages...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),o.jsx("button",{type:"button",onClick:r,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Close",children:o.jsx(Ph,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:m.length===0?o.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:g.length>0?"No matches":"No messages yet"}):m.map((C,y)=>o.jsx("button",{type:"button",onClick:()=>k(C.id),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${y===h?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("span",{className:"truncate flex-1",children:C.content}),o.jsx("span",{className:"text-text-muted text-xs shrink-0",children:m4(C.timestamp)})]})},C.id))})]})]}),document.body):null}function x4(e){return e==="criterion"}function b4(e){var r,s;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(s=e.thinkingContent)!=null&&s.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(i=>x4(i.name))}function v4(e,r=[]){const s=[];let i=null,l=[],u,h=1;const c=new Map,d=new Map,f=[];for(const S of r)S.type==="message"?c.set(S.message.id,S):S.type==="subagent"?d.set(S.subAgentId,S):S.type==="criteria-batch"&&f.push(S);let g=0;const m=()=>{if(l.length>0){const S=f[g];S&&S.type==="criteria-batch"&&S.toolCalls.length===l.length&&S.toolCalls.every((C,y)=>{var b;return C.id===((b=l[y])==null?void 0:b.id)})?s.push(S):s.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},v=()=>{if(!i)return;const S=i,k=d.get(S.subAgentId);k&&k.type==="subagent"&&k.messages.length===S.messages.length&&k.messages.every((y,b)=>y===S.messages[b])?s.push(k):s.push({type:"subagent",subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:S.messages}),i=null};for(const S of e)if(S.role!=="tool"){if(S.contextWindowId&&u&&S.contextWindowId!==u&&(m(),v(),h++,s.push({type:"context-divider",windowSequence:h})),u=S.contextWindowId,b4(S)){v();for(const k of S.toolCalls)l.push(k);continue}if(m(),S.subAgentId&&S.subAgentType)i&&i.subAgentId===S.subAgentId?i.messages.push(S):(v(),i={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{v();const k=c.get(S.id);k&&k.type==="message"&&k.message===S?s.push(k):s.push({type:"message",message:S})}}return m(),v(),s}function y4(e){const{year:r,month:s,day:i}=ly(e);return`${r}/${s}/${i} ${rc(e)}`}function _4(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const S4=10,w4=150;function C4(e){const r=[];if(e.recentUserPrompts)for(const s of e.recentUserPrompts)r.push({id:s.id,content:s.content,timestamp:s.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function k4(e){return[...e].sort((i,l)=>new Date(l.timestamp).getTime()-new Date(i.timestamp).getTime()).slice(0,S4).reverse().map(i=>({id:i.id,content:i.content,timestamp:i.timestamp,formattedTimestamp:y4(i.timestamp),trimmedContent:_4(i.content,w4),sessionId:i.sessionId,sessionName:i.sessionName}))}function E4(e,r,s){const i=[],l=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of l)i.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:s??"",sessionName:"This session"});for(const u of r)s&&u.id===s||i.push(...C4(u));return k4(i)}function j4(e,r=[],s=null){const[i,l]=z.useState(0),[u,h]=z.useState(!1),c=z.useMemo(()=>E4(e,r,s),[e,r,s]),d=z.useCallback(()=>{c.length>0&&(l(c.length-1),h(!0))},[c.length]),f=z.useCallback(()=>{h(!1),l(0)},[]),g=z.useCallback(()=>{l(S=>c.length===0?S:S===0?c.length-1:S-1)},[c.length]),m=z.useCallback(()=>{l(S=>c.length===0?S:S===c.length-1?0:S+1)},[c.length]),v=z.useCallback(()=>{if(c.length===0||!u)return null;const S=c[i];return(S==null?void 0:S.content)??null},[c,i,u]);return{history:c,selectedIndex:i,showHistory:u,openHistory:d,closeHistory:f,navigateUp:g,navigateDown:m,selectCurrent:v}}function N4({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const s=e??!0,[i,l]=z.useState(""),[u,h]=z.useState([]),[c,d]=z.useState(!1),[f,g]=z.useState(null),[m,v]=z.useState(!1),[S,k]=z.useState(!1),[C,y]=z.useState(!1),[b,x]=z.useState(!1),[_,j]=z.useState(null),[T,N]=z.useState(null),D=z.useRef(null),A=z.useRef(null),P=z.useRef(null),O=Se(ue=>ue.currentSession),H=Se(ue=>ue.messages),q=Se(ue=>ue.streamingMessage),W=Se(ue=>ue.sessions),G=Se(ue=>ue.pendingQuestion),B=Oh(),F=Se(ue=>ue.sendMessage),Z=Se(ue=>ue.acceptAndBuild),Y=Se(ue=>ue.stopGeneration),I=Se(ue=>ue.launchRunner),L=Se(ue=>ue.cancelQueued),R=xw(),$=Nt(ue=>ue.defaults),U=Nt(ue=>ue.userItems),ne=[...$,...U].filter(ue=>!ue.subagent),{history:Q,selectedIndex:ee,showHistory:X,openHistory:V,closeHistory:ie,navigateUp:re,navigateDown:be,selectCurrent:ve}=j4(H,W,O==null?void 0:O.id),Re=z.useCallback(ue=>{j(ue),Ne(!1);const Ee=document.querySelector(`[data-message-id="${ue}"]`);Ee&&Ee.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>j(null),3e3)},[]);z.useEffect(()=>{const ue=Ee=>{N(Ee.detail.stats)};return window.addEventListener("open-turn-stats",ue),()=>window.removeEventListener("open-turn-stats",ue)},[]),z.useEffect(()=>{jt.getState().fetchWorkflows()},[]);const Oe=z.useMemo(()=>q?H.map(ue=>ue.id===q.id?q:ue):H,[H,q]),ze=z.useRef([]),Ue=z.useMemo(()=>{const ue=v4(Oe,ze.current);return ze.current=ue,ue},[Oe]),{force_scroll_to_bottom:Te,isAutoScrollActive:pe,setAutoScroll:Ne}=U0(D,O),$e=z.useRef(0),Tt=z.useCallback(()=>{const ue=A.current;if(!ue)return;const Ee=i.length>=$e.current;$e.current=i.length,Ee||(ue.style.height="auto"),ue.style.height=`${Math.min(200,ue.scrollHeight)}px`},[i]);z.useEffect(()=>{if(!(O!=null&&O.id))return;const ue=`openfox:draft:${O.id}`,Ee=localStorage.getItem(ue);Ee!==null&&l(Ee)},[O==null?void 0:O.id]),z.useEffect(()=>{var ue;(ue=A.current)==null||ue.focus(),Tt()},[O==null?void 0:O.id,Tt]),z.useEffect(()=>{if(!(O!=null&&O.id))return;const ue=`openfox:draft:${O.id}`,Ee=setTimeout(()=>{i?localStorage.setItem(ue,i):localStorage.removeItem(ue)},500);return()=>clearTimeout(Ee)},[O==null?void 0:O.id,i]),z.useEffect(()=>{Tt()},[i,Tt]),z.useEffect(()=>{const ue=Ee=>{const Ge=C||m||S||b||T;Ee.key==="Escape"&&B&&!Ge&&Y(),Ee.key==="ScrollLock"&&Ne(!pe)};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[B,Y,pe,C,m,S,b,T]);const me=z.useRef(0);z.useEffect(()=>{const ue=Ee=>{if(Ee.key==="Shift"&&!Ee.ctrlKey&&!Ee.metaKey&&!Ee.altKey){const Ge=Date.now();Ge-me.current<300?(Ee.preventDefault(),y(!0),me.current=0):me.current=Ge}};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[]),z.useEffect(()=>{const ue=A.current;if(!ue)return;const Ee=async Ge=>{var zn;if(document.activeElement!==ue)return;const lt=(zn=Ge.clipboardData)==null?void 0:zn.items;if(lt){for(const fe of Array.from(lt))if(fe.type.startsWith("image/")){Ge.preventDefault();const ye=fe.getAsFile();if(!ye)continue;await ih(ye,Ce=>h(qe=>[...qe,Ce]),g,{filename:"pasted-image"})}}};return ue.addEventListener("paste",Ee),()=>ue.removeEventListener("paste",Ee)},[]);const je=()=>{l(""),h([]),O!=null&&O.id&&localStorage.removeItem(`openfox:draft:${O.id}`)},Me=async ue=>{ue.preventDefault(),!(!i.trim()&&u.length===0)&&(Te(),F(i,u.length>0?u:void 0),je())},ht=ue=>{if((ue.ctrlKey||ue.metaKey)&&ue.code.startsWith("Digit")){const Ge=parseInt(ue.code.slice(-1),10)-1,lt=ne[Ge];lt&&(ue.preventDefault(),Se.getState().switchMode(lt.id));return}if(X)switch(ue.key){case"Enter":{ue.preventDefault();const Ee=ve();Ee&&(l(Ee),ie());return}case"Escape":ue.preventDefault(),ie(),B&&Y();return;case"ArrowUp":ue.preventDefault(),re();return;case"ArrowDown":ue.preventDefault(),be();return}if(ue.key==="ArrowUp"&&i.trim()===""&&!X){ue.preventDefault(),V();return}ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),Me(ue))},ce=z.useCallback(async ue=>{const Ee=ue.target.files;if(!(!Ee||Ee.length===0)){g(null);for(const Ge of Array.from(Ee))await ih(Ge,lt=>h(zn=>[...zn,lt]),g);P.current&&(P.current.value="")}},[]),_e=z.useCallback(ue=>{ue.preventDefault(),ue.stopPropagation(),d(!0)},[]),Ae=z.useCallback(ue=>{ue.preventDefault(),ue.stopPropagation(),d(!1)},[]),Ie=z.useCallback(async ue=>{ue.preventDefault(),ue.stopPropagation(),d(!1),g(null);const Ee=ue.dataTransfer.files;if(!(!Ee||Ee.length===0))for(const Ge of Array.from(Ee))await ih(Ge,lt=>h(zn=>[...zn,lt]),g)},[]),Ve=z.useCallback(ue=>{h(Ee=>Ee.filter(Ge=>Ge.id!==ue))},[]),At=z.useCallback(()=>{var ue;(ue=P.current)==null||ue.click()},[]),Qe=(O==null?void 0:O.mode)==="planner",Mt=(O==null?void 0:O.mode)==="builder",Dt=ue=>{const Ee=i.trim()?i:void 0,Ge=u.length>0?u:void 0;Qe?Z(ue,Ee,Ge):Mt&&I(Ee,Ge,ue),je()};return o.jsxs(o.Fragment,{children:[o.jsxs(f2,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:r,messages:Oe,children:[G&&o.jsx(MA,{question:G}),o.jsx(g2,{}),T&&o.jsx(x2,{stats:T,onClose:()=>N(null)}),o.jsx(IA,{}),o.jsx(TA,{displayItems:Ue,scrollContainerRef:D,highlightedMessageId:_}),o.jsxs("form",{onSubmit:Me,className:"relative p-2 md:p-4 bg-secondary",children:[B&&o.jsx("div",{className:"absolute -top-8 left-2 md:left-4 z-10",children:o.jsx(PA,{})}),o.jsxs("button",{type:"button",className:"absolute -top-8 right-12 md:right-16 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>Ne(!pe),children:[pe?o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-success"}):o.jsx(hr,{className:"w-3 h-3 text-text-muted"}),pe?"live":"scroll to bottom"]}),o.jsx("button",{type:"button",onClick:()=>x(!0),className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center p-0.5 rounded hover:bg-bg-tertiary transition-colors","aria-label":"Search messages",children:o.jsx(zh,{})}),o.jsx("input",{ref:P,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:ce,className:"hidden",multiple:!0}),f&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:f}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(ue=>o.jsx(BA,{attachment:ue,onRemove:Ve},ue.id))}),X&&o.jsx(zA,{history:Q,selectedIndex:ee,onSelect:ue=>{l(ue),ie()},onEscape:ie,onNavigate:ue=>{ue==="up"?re():be()}}),(R==null?void 0:R.length)>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:R.map(ue=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ue.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:[ue.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:ue.content}),o.jsx(lo,{onClick:()=>L(ue.queueId),size:"sm"})]},ue.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded transition-colors ${c?"bg-accent-primary/10":"bg-primary"}`,onDragOver:_e,onDragLeave:Ae,onDrop:Ie,children:[o.jsx("textarea",{id:iy,ref:A,value:i,onChange:ue=>{l(ue.target.value),X&&ie()},onKeyDown:ht,placeholder:"What would you like to build?","data-testid":"chat-input-textarea",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),o.jsxs("div",{className:"flex items-center self-center gap-1.5",children:[B&&o.jsxs("button",{type:"button",onClick:()=>Y(),"data-testid":"chat-stop-button",className:"flex items-center gap-1 px-4 py-1.5 rounded bg-accent-error/20 text-sm text-accent-error font-medium hover:bg-accent-error/30 transition-colors whitespace-nowrap",children:[o.jsx(Xv,{}),"Abort"]}),o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{type:"button",onClick:()=>{var ue;!i.trim()&&u.length===0||((ue=D.current)==null||ue.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),F(i,u),je())},disabled:!i.trim()&&u.length===0,"data-testid":"chat-send-button",className:"px-4 py-1.5 rounded-l 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.jsx(h4,{onSendCommand:(ue,Ee,Ge,lt)=>{var fe;Ee&&(O==null?void 0:O.mode)!==Ee&&Se.getState().switchMode(Ee);const zn=Ge&&Ge.trim()?`${Ge.trim()}
|
|
155
|
-
|
|
156
|
-
${ue}`:ue;(fe=D.current)==null||fe.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),F(zn,lt!=null&<.length?lt:void 0,{messageKind:"command",isSystemGenerated:!0}),je()},onSelectWorkflow:Dt,onOpenCommandsManager:()=>v(!0),onOpenWorkflowsManager:()=>k(!0),onAttach:At,textareaContent:i,attachments:u.length>0?u:void 0,criteria:(O==null?void 0:O.criteria)??[]})]})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(LA,{}),o.jsx(OA,{})]}),o.jsx(t4,{})]})]}),o.jsx(q0,{isOpen:m,onClose:()=>v(!1)}),o.jsx(G0,{isOpen:S,onClose:()=>k(!1)}),o.jsx(p4,{isOpen:C,onClose:()=>y(!1),onSearchMessages:()=>x(!0),isAutoScrollActive:pe,onToggleAutoScroll:Ne,textareaContent:i,onCloseComplete:ay,onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(ue,Ee)=>{const Ge=await on.getState().fetchCommand(ue);if(Ge){const lt=Ee!=null&&Ee.trim()?`${Ee.trim()}
|
|
157
|
-
|
|
158
|
-
${Ge.prompt}`:Ge.prompt;Ge.metadata.agentMode&&Se.getState().switchMode(Ge.metadata.agentMode),F(lt,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),je()}},onSelectWorkflow:ue=>{const Ee=i.trim()||void 0,Ge=u.length>0?u:void 0;(O==null?void 0:O.mode)==="planner"?Se.getState().acceptAndBuild(ue,Ee,Ge):Se.getState().launchRunner(Ee,Ge,ue),je()}})]}),b&&o.jsx(g4,{isOpen:b,onClose:()=>x(!1),messages:H,onSelectMessage:Re})]})}z.memo(function({item:r}){const[s,i]=z.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:()=>i(!s),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:s?"Hide":"Show"})]}),s&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Ir,{content:r.description})})]})]})});function Tv({isOpen:e,isRetry:r,onSubmit:s,onCancel:i}){const[l,u]=z.useState(""),h=z.useRef(null);z.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=h.current)==null?void 0:d.focus()},100))},[e]);const c=d=>{d.preventDefault(),l.trim()&&s(l)};return o.jsx(kt,{isOpen:e,onClose:i,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:c,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(sc,{ref:h,type:"password",value:l,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Ze,{type:"button",variant:"secondary",onClick:i,children:"Cancel"}),o.jsx(Ze,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}const T4=[8e3,11434,8080],A4=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function Av(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 D4({currentStep:e,totalSteps:r,labels:s,onStepClick:i}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(l,u)=>{const h=u+1,c=h<e,d=h===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>i==null?void 0:i(h),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${c?"bg-accent-primary text-text-primary hover:opacity-80":d?"bg-accent-primary text-text-primary":"bg-bg-tertiary text-text-muted"}`,children:c?"✓":h}),o.jsx("button",{onClick:()=>i==null?void 0:i(h),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:s[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${c?"bg-accent-primary":"bg-border"}`})]},u)})})})}function R4({onNext:e}){const[r,s]=z.useState([]),[i,l]=z.useState([]),[u,h]=z.useState(!1),[c,d]=z.useState(""),[f,g]=z.useState(""),[m,v]=z.useState(""),[S,k]=z.useState("auto"),[C,y]=z.useState(!1),[b,x]=z.useState(null),[_,j]=z.useState(null),[T,N]=z.useState(null),[D,A]=z.useState("");z.useEffect(()=>{P()},[]);async function P(){try{const B=await ke("/api/providers");if(B.ok){const Z=(await B.json()).providers.map(Y=>({id:Y.id,name:Y.name,url:Y.url,backend:Y.backend,model:null,apiKey:Y.apiKey}));s(Z),l(Z)}}catch{}}async function O(B){y(!0),x(null);const F=S!=="auto";try{const Y=await(await ke("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:B,skipBackendDetection:F})})).json();Y.success?(F||k(Y.backend??"auto"),x({success:!0,model:Y.model??void 0})):x({success:!1,error:Y.error??"Connection failed"})}catch(Z){x({success:!1,error:Z instanceof Error?Z.message:"Connection failed"})}y(!1)}function H(){if(!f)return;const B=c||`Provider ${i.length+1}`,F={id:`temp-${Date.now()}`,name:B,url:f,backend:b!=null&&b.success?S:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};l([...i,F]),d(""),g(""),v(""),x(null)}function q(B){j(B),r.some(Z=>Z.id===B)?ke(`/api/providers/${B}`,{method:"DELETE"}).then(()=>{l(i.filter(Z=>Z.id!==B)),s(r.filter(Z=>Z.id!==B)),j(null)}).catch(()=>{j(null)}):(l(i.filter(Z=>Z.id!==B)),j(null))}async function W(){for(const F of i)(F.id.startsWith("temp-")||!r.some(Z=>Z.id===F.id))&&((await ke("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:F.name,url:F.url,backend:F.backend,model:F.model,apiKey:F.apiKey})})).ok||console.error("Failed to add provider",F));const B=i.filter(F=>!F.id.startsWith("temp-"));e({providers:B})}const G=i.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:[i.length>0?o.jsx("div",{className:"space-y-2",children:i.map(B=>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:Av(B.backend)}),T===B.id?o.jsx("input",{type:"text",value:D,onChange:F=>A(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(l(i.map(Z=>Z.id===B.id?{...Z,name:D}:Z)),N(null)),F.key==="Escape"&&N(null)},onBlur:()=>{l(i.map(F=>F.id===B.id?{...F,name:D}:F)),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(B.id),A(B.name)},title:"Click to edit",children:B.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:B.url}),B.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",B.model]})]}),o.jsx("button",{onClick:()=>q(B.id),disabled:_===B.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(tc,{})})]},B.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:B=>{B.preventDefault(),f&&H()},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:A4.map(B=>o.jsx("button",{type:"button",onClick:()=>{d(B.name),g(B.url),k(B.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===B.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:B.name},B.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:T4.map(B=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${B}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${B}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",B]},B))})]}),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:f,onChange:B=>{g(B.target.value),x(null)},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),O(f))},placeholder:"http://localhost:8000","data-testid":"onboarding-provider-url-input",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:c,onChange:B=>d(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),H())},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:B=>v(B.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 ",Av(S),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:()=>O(f),disabled:!f||C,"data-testid":"onboarding-test-connection-button",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(Bi,{className:"w-4 h-4"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!f,"data-testid":"onboarding-add-provider-submit-button",className:"flex-1 px-4 py-2 bg-accent-primary text-text-primary 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:()=>{h(!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:()=>h(!0),"data-testid":"onboarding-add-provider-button",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(Bi,{className:"w-4 h-4"}),"Add Provider"]}),o.jsx("button",{onClick:W,disabled:!G,"data-testid":"onboarding-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function L4({onNext:e}){const[r,s]=z.useState(""),[i,l]=z.useState(!1);return z.useEffect(()=>{ke("/api/config").then(u=>u.json()).then(u=>{u.workdir?s(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(h=>h.json()).then(h=>{h.current&&s(h.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&s(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=>s(u.target.value),placeholder:"/home/user/projects","data-testid":"onboarding-workdir-input",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:()=>l(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),i&&o.jsx(fy,{initialPath:r||void 0,onSelect:u=>{s(u),l(!1)},onClose:()=>l(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,"data-testid":"onboarding-workdir-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function O4({onNext:e}){const[r,s]=z.useState(!1),[i,l]=z.useState("http://localhost:11434"),[u,h]=z.useState("qwen3-vl:2b"),{copied:c,copy:d}=I0();z.useEffect(()=>{ke("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(s(g.visionFallback.enabled),l(g.visionFallback.url),h(g.visionFallback.model))}).catch(()=>{})},[]);function f(g){if(g){e({});return}e({visionFallback:{enabled:r,url:i,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:c?o.jsx(Mr,{className:"w-4 h-4 text-accent-primary"}):o.jsx(Ew,{className:"w-4 h-4"})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>s(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:i,onChange:g=>l(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=>h(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:()=>f(!0),"data-testid":"onboarding-skip-button",className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>f(!1),className:"px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function M4({onComplete:e}){const[r,s]=z.useState(1),[i,l]=z.useState(!1),[u,h]=z.useState({});async function c(m){h(v=>({...v,providers:m.providers})),s(2)}async function d(m){h(v=>({...v,...m})),s(3)}async function f(m){l(!0);try{if(!(await ke("/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(v){console.error("Failed to save onboarding data:",v),l(!1)}}const g=m=>{s(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(lo,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(D4,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:i?o.jsxs("div",{className:"text-center",children:[o.jsx(Bi,{className:"w-6 h-6"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(R4,{onNext:c}),r===2&&o.jsx(L4,{onNext:d}),r===3&&o.jsx(O4,{onNext:f})]})})]})}typeof window<"u"&&(Jt.getState().loadUserPresets(),Jt.getState().applySavedTheme());function Af(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function X0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(co,{})})}function I4({sidebarOpen:e,onSidebarToggle:r}){const[,s]=Lh("/p/:projectId"),i=s==null?void 0:s.projectId,l=Se(f=>f.connectionStatus),u=Se(f=>f.clearSession),h=Ot(f=>f.currentProject),c=Af(),d=l==="connected"||c;return z.useEffect(()=>{d&&i&&(h==null?void 0:h.id)!==i&&Ot.getState().loadProject(i),d&&i&&(Se.getState().listSessions(i),u())},[d,i,h==null?void 0:h.id,u]),!h||h.id!==i?o.jsx(X0,{}):o.jsxs(o.Fragment,{children:[o.jsx(uy,{projectId:i,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(IC,{})})]})}function B4({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:s,onRightSidebarToggle:i}){const[,l]=Lh("/p/:projectId/s/:sessionId"),u=l==null?void 0:l.projectId,h=l==null?void 0:l.sessionId,[,c]=nr(),d=Se(_=>_.connectionStatus),f=Se(_=>_.currentSession),g=Se(_=>_.loadSession),m=Se(_=>_.listSessions),v=Se(_=>_.pendingSessionCreate),S=Se(_=>_.error),k=Se(_=>_.clearError),C=Ot(_=>_.currentProject),y=Ot(_=>_.loadProject),b=Af(),x=d==="connected"||b;return z.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&y(u),x&&h&&(f==null?void 0:f.id)!==h&&g(h),x&&u&&m(u)},[x,u,C==null?void 0:C.id,y,h,f==null?void 0:f.id,g,m,v]),z.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&u&&(k(),c(`/p/${u}`))},[S,u,k,c]),!C||C.id!==u?o.jsx(X0,{}):o.jsxs(o.Fragment,{children:[o.jsx(uy,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:o.jsx(N4,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:i})})]})}function z4(){const e=Ct(s=>s.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(M4,{onComplete:r})})}function P4(){const{connectionStatus:e}=vw(),r=Ct(F=>F.fetchConfig),s=Ct(F=>F.refreshProviderModels),i=hn(F=>F.getSetting),l=Ct(F=>F.providers),u=Ct(F=>F.activeProviderId),[,h]=nr(),c=Af(),[d,f]=z.useState(!1);z.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{f(!0);for(const F of Rv)i(F);i(ot.DISPLAY_THEME),i(ot.DISPLAY_USER_PRESETS)})},[e,c,r,i]),z.useEffect(()=>{d&&u&&s(u).then(()=>{const F=Ct.getState().defaultModelSelection;(F?F.split("/")[0]:null)!==u&&r()})},[d,u,s,r]);const g=hn(F=>F.settings);z.useEffect(()=>{d&&l.length===0&&h("/onboarding")},[d,l.length]),z.useEffect(()=>{const{applyPreset:F,applyTokens:Z}=Jt.getState(),Y=g[ot.DISPLAY_THEME],I=g[ot.DISPLAY_USER_PRESETS];if(I&&localStorage.setItem("openfox:userPresets",I),Y){localStorage.setItem("openfox:theme",Y);try{const L=JSON.parse(Y);L.preset&&L.tokens?(F(L.preset),Jt.setState({basePreset:L.preset}),Z(L.tokens)):L.preset?F(L.preset):L.tokens&&Z(L.tokens)}catch{F("dark")}}else F("dark")},[g[ot.DISPLAY_THEME],g[ot.DISPLAY_USER_PRESETS]]);const m=()=>{const F=localStorage.getItem("openfox:leftSidebar");return F!==null?F==="true":!0},v=()=>{const F=localStorage.getItem("openfox:rightSidebar");return F!==null?F==="true":!0},[S,k]=z.useState(m),[C,y]=z.useState(v),[b,x]=z.useState(!1),[_,j]=z.useState(!1),[T,N]=z.useState(!1),D=E1();z.useEffect(()=>{const F=()=>{N(window.innerWidth<768)};return F(),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const A=T?b:S,P=T?_:C,O=()=>{T?x(!b):k(!S)},H=()=>{T?j(!_):y(!C)};z.useEffect(()=>{T||localStorage.setItem("openfox:leftSidebar",String(S))},[S,T]),z.useEffect(()=>{T||localStorage.setItem("openfox:rightSidebar",String(C))},[C,T]),z.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const q=Se(F=>F.showPasswordModal),W=Se(F=>F.passwordModalRetry),G=Se(F=>F.submitPassword),B=Se(F=>F.cancelPassword);return e!=="connected"&&!q&&!c?o.jsxs(o.Fragment,{children:[o.jsx(Tv,{isOpen:!0,isRetry:W,onSubmit:G,onCancel:B}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(RC,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Tv,{isOpen:q,isRetry:W,onSubmit:G,onCancel:B}),o.jsxs("div",{className:"flex flex-col",style:{height:T?`calc(${D.offsetTop}px + ${D.height}px)`:"100vh"},children:[o.jsx(jC,{}),o.jsx(_C,{onMenuClick:O,onCriteriaToggle:H}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(K1,{children:[o.jsx(Ma,{path:"/onboarding",children:o.jsx(z4,{})}),o.jsx(Ma,{path:"/p/:projectId/s/:sessionId",children:o.jsx(B4,{sidebarOpen:A,onSidebarToggle:O,rightSidebarOpen:P,onRightSidebarToggle:H})}),o.jsx(Ma,{path:"/p/:projectId/new",children:o.jsx(MC,{})}),o.jsx(Ma,{path:"/p/:projectId",children:o.jsx(I4,{sidebarOpen:A,onSidebarToggle:O})}),o.jsx(Ma,{path:"/",children:o.jsx(OC,{})})]})})]})]})}_1.createRoot(document.getElementById("root")).render(o.jsx(dn.StrictMode,{children:o.jsx(P4,{})}));
|