openfox 1.6.91 → 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-I4YS2BN4.js → auto-compaction-7AGIGW6F.js} +6 -6
- package/dist/{chat-handler-O4FNSVPI.js → chat-handler-UPAEF6HR.js} +9 -9
- package/dist/{chunk-UQSL65WB.js → chunk-2BS6LMIU.js} +398 -470
- package/dist/{chunk-HKCUSLQ5.js → chunk-2TKN2X2A.js} +3 -3
- package/dist/{chunk-SSGVISQU.js → chunk-7KO2BQFQ.js} +8 -7
- package/dist/{chunk-II4UCFTE.js → chunk-7QG6LY5Q.js} +3 -3
- package/dist/{chunk-CL2ZPJAG.js → chunk-ARJIHQ3S.js} +225 -138
- package/dist/{chunk-H5T34J3H.js → chunk-BHZL3N2F.js} +3 -3
- package/dist/{chunk-MOQLMPTA.js → chunk-CHICEUV6.js} +3 -3
- package/dist/{chunk-STUSQVXQ.js → chunk-RJIPM7CO.js} +2 -2
- package/dist/{chunk-B5AP3RSV.js → chunk-RW25DL5R.js} +3 -3
- package/dist/{chunk-A3YOBYWJ.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-GEDIDCBM.js → config-7XJQNOKX.js} +5 -5
- package/dist/{events-AQKDXJFK.js → events-K6AYMXFT.js} +3 -3
- package/dist/{orchestrator-LLOIG2CR.js → orchestrator-M4WINFF3.js} +7 -7
- package/dist/package.json +1 -1
- package/dist/{processor-XL5NULQN.js → processor-D4XQ5QMB.js} +5 -5
- package/dist/{protocol--8PKNwb_.d.ts → protocol-XRiJzlOK.d.ts} +1 -1
- package/dist/{provider-EV3KBC7Y.js → provider-UO5PAZQQ.js} +7 -7
- package/dist/{runtime-config-CBJJJGBD.js → runtime-config-CYHDAC7W.js} +2 -2
- package/dist/{serve-UWKYNKAO.js → serve-Z5FNJUDT.js} +11 -11
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +9 -9
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-ZBAAAOUH.js → tools-NFFQWH6M.js} +6 -6
- package/dist/{vision-fallback-4TAGWGVS.js → vision-fallback-GZZWU7CR.js} +2 -2
- package/dist/web/assets/{index-CGEQK8Pf.css → index-CM0cLwa6.css} +1 -1
- 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-Cb7XVDFv.js +0 -158
- /package/dist/web/{workbox-8c29f6e4.js → workbox-7fc22fbe.js} +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
var h1=Object.defineProperty;var f1=(e,r,s)=>r in e?h1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s;var or=(e,r,s)=>f1(e,typeof r!="symbol"?r+"":r,s);function p1(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:{}},Ra={};/**
|
|
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 jx;function m1(){if(jx)return Ra;jx=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 Ra.Fragment=r,Ra.jsx=s,Ra.jsxs=s,Ra}var Nx;function g1(){return Nx||(Nx=1,Nd.exports=m1()),Nd.exports}var a=g1(),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 Tx;function x1(){if(Tx)return We;Tx=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(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function b(O,$,U){this.props=O,this.context=$,this.refs=y,this.updater=U||k}b.prototype.isReactComponent={},b.prototype.setState=function(O,$){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,$,"setState")},b.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function x(){}x.prototype=b.prototype;function _(O,$,U){this.props=O,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(O,$,U){var ne=U.ref;return{$$typeof:e,type:O,key:$,ref:ne!==void 0?ne:null,props:U}}function R(O,$){return P(O.type,$,O.props)}function F(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function q(O){var $={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(U){return $[U]})}var W=/\/+/g;function V(O,$){return typeof O=="object"&&O!==null&&O.key!=null?q(""+O.key):$.toString(36)}function z(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(N,N):(O.status="pending",O.then(function($){O.status==="pending"&&(O.status="fulfilled",O.value=$)},function($){O.status==="pending"&&(O.status="rejected",O.reason=$)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function H(O,$,U,ne,Q){var ee=typeof O;(ee==="undefined"||ee==="boolean")&&(O=null);var X=!1;if(O===null)X=!0;else switch(ee){case"bigint":case"string":case"number":X=!0;break;case"object":switch(O.$$typeof){case e:case r:X=!0;break;case g:return X=O._init,H(X(O._payload),$,U,ne,Q)}}if(X)return Q=Q(O),X=ne===""?"."+V(O,0):ne,T(Q)?(U="",X!=null&&(U=X.replace(W,"$&/")+"/"),H(Q,$,U,"",function(re){return re})):Q!=null&&(F(Q)&&(Q=R(Q,U+(Q.key==null||O&&O.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+X)),$.push(Q)),1;X=0;var G=ne===""?".":ne+":";if(T(O))for(var ie=0;ie<O.length;ie++)ne=O[ie],ee=G+V(ne,ie),X+=H(ne,$,U,ee,Q);else if(ie=S(O),typeof ie=="function")for(O=ie.call(O),ie=0;!(ne=O.next()).done;)ne=ne.value,ee=G+V(ne,ie++),X+=H(ne,$,U,ee,Q);else if(ee==="object"){if(typeof O.then=="function")return H(z(O),$,U,ne,Q);throw $=String(O),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return X}function Z(O,$,U){if(O==null)return O;var ne=[],Q=0;return H(O,ne,"","",function(ee){return $.call(U,ee,Q++)}),ne}function Y(O){if(O._status===-1){var $=O._result;$=$(),$.then(function(U){(O._status===0||O._status===-1)&&(O._status=1,O._result=U)},function(U){(O._status===0||O._status===-1)&&(O._status=2,O._result=U)}),O._status===-1&&(O._status=0,O._result=$)}if(O._status===1)return O._result.default;throw O._result}var B=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},L={map:Z,forEach:function(O,$,U){Z(O,function(){$.apply(this,arguments)},U)},count:function(O){var $=0;return Z(O,function(){$++}),$},toArray:function(O){return Z(O,function($){return $})||[]},only:function(O){if(!F(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};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(O){return D.H.useMemoCache(O)}},We.cache=function(O){return function(){return O.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(O,$,U){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ne=C({},O.props),Q=O.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),G=0;G<ee;G++)X[G]=arguments[G+2];ne.children=X}return P(O.type,Q,ne)},We.createContext=function(O){return O={$$typeof:h,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:u,_context:O},O},We.createElement=function(O,$,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 G=Array(X),ie=0;ie<X;ie++)G[ie]=arguments[ie+2];Q.children=G}if(O&&O.defaultProps)for(ne in X=O.defaultProps,X)Q[ne]===void 0&&(Q[ne]=X[ne]);return P(O,ee,Q)},We.createRef=function(){return{current:null}},We.forwardRef=function(O){return{$$typeof:c,render:O}},We.isValidElement=F,We.lazy=function(O){return{$$typeof:g,_payload:{_status:-1,_result:O},_init:Y}},We.memo=function(O,$){return{$$typeof:f,type:O,compare:$===void 0?null:$}},We.startTransition=function(O){var $=D.T,U={};D.T=U;try{var ne=O(),Q=D.S;Q!==null&&Q(U,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(N,B)}catch(ee){B(ee)}finally{$!==null&&U.types!==null&&($.types=U.types),D.T=$}},We.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},We.use=function(O){return D.H.use(O)},We.useActionState=function(O,$,U){return D.H.useActionState(O,$,U)},We.useCallback=function(O,$){return D.H.useCallback(O,$)},We.useContext=function(O){return D.H.useContext(O)},We.useDebugValue=function(){},We.useDeferredValue=function(O,$){return D.H.useDeferredValue(O,$)},We.useEffect=function(O,$){return D.H.useEffect(O,$)},We.useEffectEvent=function(O){return D.H.useEffectEvent(O)},We.useId=function(){return D.H.useId()},We.useImperativeHandle=function(O,$,U){return D.H.useImperativeHandle(O,$,U)},We.useInsertionEffect=function(O,$){return D.H.useInsertionEffect(O,$)},We.useLayoutEffect=function(O,$){return D.H.useLayoutEffect(O,$)},We.useMemo=function(O,$){return D.H.useMemo(O,$)},We.useOptimistic=function(O,$){return D.H.useOptimistic(O,$)},We.useReducer=function(O,$,U){return D.H.useReducer(O,$,U)},We.useRef=function(O){return D.H.useRef(O)},We.useState=function(O){return D.H.useState(O)},We.useSyncExternalStore=function(O,$,U){return D.H.useSyncExternalStore(O,$,U)},We.useTransition=function(){return D.H.useTransition()},We.version="19.2.4",We}var Ax;function Ql(){return Ax||(Ax=1,Td.exports=x1()),Td.exports}var I=Ql();const hn=Zl(I),b1=p1({__proto__:null,default:hn},[I]);var Ad={exports:{}},Oa={},Dd={exports:{}},Ld={};/**
|
|
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 Dx;function v1(){return Dx||(Dx=1,(function(e){function r(H,Z){var Y=H.length;H.push(Z);e:for(;0<Y;){var B=Y-1>>>1,L=H[B];if(0<l(L,Z))H[B]=Z,H[Y]=L,Y=B;else break e}}function s(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var Z=H[0],Y=H.pop();if(Y!==Z){H[0]=Y;e:for(var B=0,L=H.length,O=L>>>1;B<O;){var $=2*(B+1)-1,U=H[$],ne=$+1,Q=H[ne];if(0>l(U,Y))ne<L&&0>l(Q,U)?(H[B]=Q,H[ne]=Y,B=ne):(H[B]=U,H[$]=Y,B=$);else if(ne<L&&0>l(Q,Y))H[B]=Q,H[ne]=Y,B=ne;else break e}}return Z}function l(H,Z){var Y=H.sortIndex-Z.sortIndex;return Y!==0?Y:H.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(H){for(var Z=s(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=H)i(f),Z.sortIndex=Z.expirationTime,r(d,Z);else break;Z=s(f)}}function T(H){if(C=!1,j(H),!k)if(s(d)!==null)k=!0,N||(N=!0,q());else{var Z=s(f);Z!==null&&z(T,Z.startTime-H)}}var N=!1,D=-1,A=5,P=-1;function R(){return y?!0:!(e.unstable_now()-P<A)}function F(){if(y=!1,N){var H=e.unstable_now();P=H;var Z=!0;try{e:{k=!1,C&&(C=!1,x(D),D=-1),S=!0;var Y=v;try{t:{for(j(H),m=s(d);m!==null&&!(m.expirationTime>H&&R());){var B=m.callback;if(typeof B=="function"){m.callback=null,v=m.priorityLevel;var L=B(m.expirationTime<=H);if(H=e.unstable_now(),typeof L=="function"){m.callback=L,j(H),Z=!0;break t}m===s(d)&&i(d),j(H)}else i(d);m=s(d)}if(m!==null)Z=!0;else{var O=s(f);O!==null&&z(T,O.startTime-H),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(){_(F)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,V=W.port2;W.port1.onmessage=F,q=function(){V.postMessage(null)}}else q=function(){b(F,0)};function z(H,Z){D=b(function(){H(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(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(H){switch(v){case 1:case 2:case 3:var Z=3;break;default:Z=v}var Y=v;v=Z;try{return H()}finally{v=Y}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(H,Z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var Y=v;v=H;try{return Z()}finally{v=Y}},e.unstable_scheduleCallback=function(H,Z,Y){var B=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?B+Y:B):Y=B,H){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,H={id:g++,callback:Z,priorityLevel:H,startTime:Y,expirationTime:L,sortIndex:-1},Y>B?(H.sortIndex=Y,r(f,H),s(d)===null&&H===s(f)&&(C?(x(D),D=-1):C=!0,z(T,Y-B))):(H.sortIndex=L,r(d,H),k||S||(k=!0,N||(N=!0,q()))),H},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(H){var Z=v;return function(){var Y=v;v=Z;try{return H.apply(this,arguments)}finally{v=Y}}}})(Ld)),Ld}var Lx;function y1(){return Lx||(Lx=1,Dd.exports=v1()),Dd.exports}var Rd={exports:{}},un={};/**
|
|
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 _1(){if(Rx)return un;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 un.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,un.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)},un.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()}},un.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))},un.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},un.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})}},un.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)},un.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})}},un.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)},un.requestFormReset=function(d){i.d.r(d)},un.unstable_batchedUpdates=function(d,f){return d(f)},un.useFormState=function(d,f,g){return h.H.useFormState(d,f,g)},un.useFormStatus=function(){return h.H.useHostTransitionStatus()},un.version="19.2.4",un}var Ox;function Ov(){if(Ox)return Rd.exports;Ox=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(),Rd.exports=_1(),Rd.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 Mx;function S1(){if(Mx)return Oa;Mx=1;var e=y1(),r=Ql(),s=Ov();function i(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o])}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,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o: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 o=t,p=n;;){var w=o.return;if(w===null)break;var E=w.alternate;if(E===null){if(p=w.return,p!==null){o=p;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===o)return d(w),t;if(E===p)return d(w),n;E=E.sibling}throw Error(i(188))}if(o.return!==p.return)o=w,p=E;else{for(var M=!1,K=w.child;K;){if(K===o){M=!0,o=w,p=E;break}if(K===p){M=!0,p=w,o=E;break}K=K.sibling}if(!M){for(K=E.child;K;){if(K===o){M=!0,o=E,p=w;break}if(K===p){M=!0,p=E,o=w;break}K=K.sibling}if(!M)throw Error(i(189))}}if(o.alternate!==p)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?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"),R=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function q(t){return t===null||typeof t!="object"?null:(t=F&&t[F]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function V(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:V(t.type)||"Memo";case A:n=t._payload,t=t._init;try{return V(t(n))}catch{}}return null}var z=Array.isArray,H=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},B=[],L=-1;function O(t){return{current:t}}function $(t){0>L||(t.current=B[L],B[L]=null,L--)}function U(t,n){L++,B[L]=t.current,t.current=n}var ne=O(null),Q=O(null),ee=O(null),X=O(null);function G(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)?Xg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Xg(n),t=Zg(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,o=Zg(n,t.type);n!==o&&(U(Q,t),U(ne,o))}function be(t){Q.current===t&&($(ne),$(Q)),X.current===t&&($(X),Ta._currentValue=Y)}var ve,Le;function Oe(t){if(ve===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",Le=-1<o.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+t+Le}var ze=!1;function Ue(t,n){if(!t||ze)return"";ze=!0;var o=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=o}return(o=t?t.displayName||t.name:"")?Oe(o):""}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="",o=null;do n+=Te(t,o),o=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,Ge=e.unstable_IdlePriority,At=e.log,Je=e.unstable_setDisableYieldValue,Mt=null,Dt=null;function ue(t){if(typeof At=="function"&&Je(t),Dt&&typeof Dt.setStrictMode=="function")try{Dt.setStrictMode(Mt,t)}catch{}}var Ee=Math.clz32?Math.clz32:zn,Ve=Math.log,lt=Math.LN2;function zn(t){return t>>>=0,t===0?32:31-(Ve(t)/lt|0)|0}var fe=256,ye=262144,ke=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 it(t,n,o){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):o||(o=K&~t,o!==0&&(w=qe(o))))):(K=p&~E,K!==0?w=qe(K):M!==0?w=qe(M):o||(o=p&~t,o!==0&&(w=qe(o)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,o=n&-n,E>=o||E===32&&(o&4194048)!==0)?n:w}function Fe(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function tn(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=ke;return ke<<=1,(ke&62914560)===0&&(ke=4194304),t}function Vt(t){for(var n=[],o=0;31>o;o++)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,o,p,w,E){var M=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var K=t.entanglements,J=t.expirationTimes,oe=t.hiddenUpdates;for(o=M&~o;0<o;){var he=31-Ee(o),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)}o&=~xe}p!==0&&Lf(t,p,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(M&~n))}function Lf(t,n,o){t.pendingLanes|=n,t.suspendedLanes&=~n;var p=31-Ee(n);t.entangledLanes|=n,t.entanglements[p]=t.entanglements[p]|1073741824|o&261930}function Rf(t,n){var o=t.entangledLanes|=n;for(t=t.entanglements;o;){var p=31-Ee(o),w=1<<p;w&n|t[p]&n&&(t[p]|=n),o&=~w}}function Of(t,n){var o=n&-n;return o=(o&42)!==0?1:xc(o),(o&(t.suspendedLanes|n))!==0?0:o}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 Mf(){var t=Z.p;return t!==0?t:(t=window.event,t===void 0?32:yx(t.type))}function If(t,n){var o=Z.p;try{return Z.p=t,n()}finally{Z.p=o}}var zr=Math.random().toString(36).slice(2),nn="__reactFiber$"+zr,xn="__reactProps$"+zr,qs="__reactContainer$"+zr,vc="__reactEvents$"+zr,t_="__reactListeners$"+zr,n_="__reactHandles$"+zr,Bf="__reactResources$"+zr,qi="__reactMarker$"+zr;function yc(t){delete t[nn],delete t[xn],delete t[vc],delete t[t_],delete t[n_]}function Ws(t){var n=t[nn];if(n)return n;for(var o=t.parentNode;o;){if(n=o[qs]||o[nn]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(t=sx(t);t!==null;){if(o=t[nn])return o;t=sx(t)}return n}t=o,o=t.parentNode}return null}function Gs(t){if(t=t[nn]||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 Vs(t){var n=t[Bf];return n||(n=t[Bf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Xt(t){t[qi]=!0}var zf=new Set,Pf={};function fs(t,n){Ks(t,n),Ks(t+"Capture",n)}function Ks(t,n){for(Pf[t]=n,t=0;t<n.length;t++)zf.add(n[t])}var r_=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]*$"),Hf={},Ff={};function s_(t){return Ne.call(Ff,t)?!0:Ne.call(Hf,t)?!1:r_.test(t)?Ff[t]=!0:(Hf[t]=!0,!1)}function mo(t,n,o){if(s_(n))if(o===null)t.removeAttribute(n);else{switch(typeof o){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,""+o)}}function go(t,n,o){if(o===null)t.removeAttribute(n);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+o)}}function mr(t,n,o,p){if(p===null)t.removeAttribute(o);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(n,o,""+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 Uf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function i_(t,n,o){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){o=""+M,E.call(this,M)}}),Object.defineProperty(t,n,{enumerable:p.enumerable}),{getValue:function(){return o},setValue:function(M){o=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function _c(t){if(!t._valueTracker){var n=Uf(t)?"checked":"value";t._valueTracker=i_(t,n,""+t[n])}}function $f(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var o=n.getValue(),p="";return t&&(p=Uf(t)?t.checked?"true":"false":t.value),t=p,t!==o?(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 a_=/[\n"\\]/g;function Hn(t){return t.replace(a_,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Sc(t,n,o,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)):o!=null?wc(t,M,Pn(o)):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 qf(t,n,o,p,w,E,M,K){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||o!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){_c(t);return}o=o!=null?""+Pn(o):"",n=n!=null?""+Pn(n):o,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,o){n==="number"&&xo(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function Ys(t,n,o,p){if(t=t.options,n){n={};for(var w=0;w<o.length;w++)n["$"+o[w]]=!0;for(o=0;o<t.length;o++)w=n.hasOwnProperty("$"+t[o].value),t[o].selected!==w&&(t[o].selected=w),w&&p&&(t[o].defaultSelected=!0)}else{for(o=""+Pn(o),n=null,w=0;w<t.length;w++){if(t[w].value===o){t[w].selected=!0,p&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function Wf(t,n,o){if(n!=null&&(n=""+Pn(n),n!==t.value&&(t.value=n),o==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=o!=null?""+Pn(o):""}function Gf(t,n,o,p){if(n==null){if(p!=null){if(o!=null)throw Error(i(92));if(z(p)){if(1<p.length)throw Error(i(93));p=p[0]}o=p}o==null&&(o=""),n=o}o=Pn(n),t.defaultValue=o,p=t.textContent,p===o&&p!==""&&p!==null&&(t.value=p),_c(t)}function Xs(t,n){if(n){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=n;return}}t.textContent=n}var o_=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,o){var p=n.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?p?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":p?t.setProperty(n,o):typeof o!="number"||o===0||o_.has(n)?n==="float"?t.cssFloat=o:t[n]=(""+o).trim():t[n]=o+"px"}function Kf(t,n,o){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,o!=null){for(var p in o)!o.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)&&o[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 l_=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"]]),c_=/^[\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 c_.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function gr(){}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 Yf(t){var n=Gs(t);if(n&&(t=n.stateNode)){var o=t[xn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Sc(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),n=o.name,o.type==="radio"&&n!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Hn(""+n)+'"][type="radio"]'),n=0;n<o.length;n++){var p=o[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<o.length;n++)p=o[n],p.form===t.form&&$f(p)}break e;case"textarea":Wf(t,o.value,o.defaultValue);break e;case"select":n=o.value,n!=null&&Ys(t,!!o.multiple,n,!1)}}}var jc=!1;function Xf(t,n,o){if(jc)return t(n,o);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,Yf(n),t)))for(n=0;n<t.length;n++)Yf(t[n])}}function Gi(t,n){var o=t.stateNode;if(o===null)return null;var p=o[xn]||null;if(p===null)return null;o=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(o&&typeof o!="function")throw Error(i(231,n,typeof o));return o}var xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nc=!1;if(xr)try{var Vi={};Object.defineProperty(Vi,"passive",{get:function(){Nc=!0}}),window.addEventListener("test",Vi,Vi),window.removeEventListener("test",Vi,Vi)}catch{Nc=!1}var Pr=null,Tc=null,vo=null;function Zf(){if(vo)return vo;var t,n=Tc,o=n.length,p,w="value"in Pr?Pr.value:Pr.textContent,E=w.length;for(t=0;t<o&&n[t]===w[t];t++);var M=o-t;for(p=1;p<=M&&n[o-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 Qf(){return!1}function bn(t){function n(o,p,w,E,M){this._reactName=o,this._targetInst=w,this.type=p,this.nativeEvent=E,this.target=M,this.currentTarget=null;for(var K in t)t.hasOwnProperty(K)&&(o=t[K],this[K]=o?o(E):E[K]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?_o:Qf,this.isPropagationStopped=Qf,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=_o)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.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}),u_=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:Rc,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}}),Jf=bn(wo),d_=m({},wo,{dataTransfer:0}),h_=bn(d_),f_=m({},Ki,{relatedTarget:0}),Lc=bn(f_),p_=m({},ps,{animationName:0,elapsedTime:0,pseudoElement:0}),m_=bn(p_),g_=m({},ps,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),x_=bn(g_),b_=m({},ps,{data:0}),ep=bn(b_),v_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},y_={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"},__={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function S_(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=__[t])?!!n[t]:!1}function Rc(){return S_}var w_=m({},Ki,{key:function(t){if(t.key){var n=v_[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"?y_[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rc,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}}),C_=bn(w_),k_=m({},wo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tp=bn(k_),E_=m({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rc}),j_=bn(E_),N_=m({},ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),T_=bn(N_),A_=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}),D_=bn(A_),L_=m({},ps,{newState:0,oldState:0}),R_=bn(L_),O_=[9,13,27,32],Oc=xr&&"CompositionEvent"in window,Xi=null;xr&&"documentMode"in document&&(Xi=document.documentMode);var M_=xr&&"TextEvent"in window&&!Xi,np=xr&&(!Oc||Xi&&8<Xi&&11>=Xi),rp=" ",sp=!1;function ip(t,n){switch(t){case"keyup":return O_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ap(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Js=!1;function I_(t,n){switch(t){case"compositionend":return ap(n);case"keypress":return n.which!==32?null:(sp=!0,rp);case"textInput":return t=n.data,t===rp&&sp?null:t;default:return null}}function B_(t,n){if(Js)return t==="compositionend"||!Oc&&ip(t,n)?(t=Zf(),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 np&&n.locale!=="ko"?null:n.data;default:return null}}var z_={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 op(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!z_[t.type]:n==="textarea"}function lp(t,n,o,p){Zs?Qs?Qs.push(p):Qs=[p]:Zs=p,n=hl(n,"onChange"),0<n.length&&(o=new So("onChange","change",null,o,p),t.push({event:o,listeners:n}))}var Zi=null,Qi=null;function P_(t){qg(t,0)}function Co(t){var n=Wi(t);if($f(n))return t}function cp(t,n){if(t==="change")return n}var up=!1;if(xr){var Mc;if(xr){var Ic="oninput"in document;if(!Ic){var dp=document.createElement("div");dp.setAttribute("oninput","return;"),Ic=typeof dp.oninput=="function"}Mc=Ic}else Mc=!1;up=Mc&&(!document.documentMode||9<document.documentMode)}function hp(){Zi&&(Zi.detachEvent("onpropertychange",fp),Qi=Zi=null)}function fp(t){if(t.propertyName==="value"&&Co(Qi)){var n=[];lp(n,Qi,t,Ec(t)),Xf(P_,n)}}function H_(t,n,o){t==="focusin"?(hp(),Zi=n,Qi=o,Zi.attachEvent("onpropertychange",fp)):t==="focusout"&&hp()}function F_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Co(Qi)}function U_(t,n){if(t==="click")return Co(n)}function $_(t,n){if(t==="input"||t==="change")return Co(n)}function q_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var En=typeof Object.is=="function"?Object.is:q_;function Ji(t,n){if(En(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var o=Object.keys(t),p=Object.keys(n);if(o.length!==p.length)return!1;for(p=0;p<o.length;p++){var w=o[p];if(!Ne.call(n,w)||!En(t[w],n[w]))return!1}return!0}function pp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function mp(t,n){var o=pp(t);t=0;for(var p;o;){if(o.nodeType===3){if(p=t+o.textContent.length,t<=n&&p>=n)return{node:o,offset:n-t};t=p}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=pp(o)}}function gp(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?gp(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function xp(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 o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)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 W_=xr&&"documentMode"in document&&11>=document.documentMode,ei=null,zc=null,ea=null,Pc=!1;function bp(t,n,o){var p=o.window===o?o.document:o.nodeType===9?o:o.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,o),t.push({event:n,listeners:p}),n.target=ei)))}function ms(t,n){var o={};return o[t.toLowerCase()]=n.toLowerCase(),o["Webkit"+t]="webkit"+n,o["Moz"+t]="moz"+n,o}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={},vp={};xr&&(vp=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],o;for(o in n)if(n.hasOwnProperty(o)&&o in vp)return Hc[t]=n[o];return t}var yp=gs("animationend"),_p=gs("animationiteration"),Sp=gs("animationstart"),G_=gs("transitionrun"),V_=gs("transitionstart"),K_=gs("transitioncancel"),wp=gs("transitionend"),Cp=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){Cp.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 o=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&&kp(o,w,E)}}function jo(t,n,o,p){Fn[ni++]=t,Fn[ni++]=n,Fn[ni++]=o,Fn[ni++]=p,Uc|=p,t.lanes|=p,t=t.alternate,t!==null&&(t.lanes|=p)}function $c(t,n,o,p){return jo(t,n,o,p),No(t)}function xs(t,n){return jo(t,null,null,n),No(t)}function kp(t,n,o){t.lanes|=o;var p=t.alternate;p!==null&&(p.lanes|=o);for(var w=!1,E=t.return;E!==null;)E.childLanes|=o,p=E.alternate,p!==null&&(p.childLanes|=o),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(o),t=E.hiddenUpdates,p=t[w],p===null?t[w]=[n]:p.push(n),n.lane=o|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 Y_(t,n,o,p){this.tag=t,this.key=o,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,o,p){return new Y_(t,n,o,p)}function qc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function br(t,n){var o=t.alternate;return o===null?(o=jn(t.tag,n,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=n,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&65011712,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,n=t.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function Ep(t,n){t.flags&=65011714;var o=t.alternate;return o===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=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,n=o.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function To(t,n,o,p,w,E){var M=0;if(p=t,typeof t=="function")qc(t)&&(M=1);else if(typeof t=="string")M=e1(t,o,ne.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case P:return t=jn(31,o,n,w),t.elementType=P,t.lanes=E,t;case C:return bs(o.children,w,E,n);case y:M=8,w|=24;break;case b:return t=jn(12,o,n,w|2),t.elementType=b,t.lanes=E,t;case T:return t=jn(13,o,n,w),t.elementType=T,t.lanes=E,t;case N:return t=jn(19,o,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,o=Error(i(130,t===null?"null":typeof t,"")),p=null}return n=jn(M,o,n,w),n.elementType=t,n.type=p,n.lanes=E,n}function bs(t,n,o,p){return t=jn(7,t,p,n),t.lanes=o,t}function Wc(t,n,o){return t=jn(6,t,null,n),t.lanes=o,t}function jp(t){var n=jn(18,null,null,0);return n.stateNode=t,n}function Gc(t,n,o){return n=jn(4,t.children!==null?t.children:[],t.key,n),n.lanes=o,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Np=new WeakMap;function Un(t,n){if(typeof t=="object"&&t!==null){var o=Np.get(t);return o!==void 0?o:(n={value:t,source:n,stack:pe(n)},Np.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 vr(t,n){si[ii++]=ta,si[ii++]=Ao,Ao=t,ta=n}function Tp(t,n,o){$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),o+=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|o<<w|p,sr=E+t}else rr=1<<E|o<<w|p,sr=t}function Vc(t){t.return!==null&&(vr(t,1),Tp(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 Ap(t,n){$n[qn++]=rr,$n[qn++]=sr,$n[qn++]=Hr,rr=n.id,sr=n.overflow,Hr=t}var rn=null,wt=null,at=!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 Dp(t){var n=t.stateNode,o=t.type,p=t.memoizedProps;switch(n[nn]=t,n[xn]=p,o){case"dialog":tt("cancel",n),tt("close",n);break;case"iframe":case"object":case"embed":tt("load",n);break;case"video":case"audio":for(o=0;o<Ca.length;o++)tt(Ca[o],n);break;case"source":tt("error",n);break;case"img":case"image":case"link":tt("error",n),tt("load",n);break;case"details":tt("toggle",n);break;case"input":tt("invalid",n),qf(n,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":tt("invalid",n);break;case"textarea":tt("invalid",n),Gf(n,p.value,p.defaultValue,p.children)}o=p.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||n.textContent===""+o||p.suppressHydrationWarning===!0||Kg(n.textContent,o)?(p.popover!=null&&(tt("beforetoggle",n),tt("toggle",n)),p.onScroll!=null&&tt("scroll",n),p.onScrollEnd!=null&&tt("scrollend",n),p.onClick!=null&&(n.onclick=gr),n=!0):n=!1,n||Ur(t,!0)}function Lp(t){for(rn=t.return;rn;)switch(rn.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:rn=rn.return}}function ai(t){if(t!==rn)return!1;if(!at)return Lp(t),at=!0,!1;var n=t.tag,o;if((o=n!==3&&n!==27)&&((o=n===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||fd(t.type,t.memoizedProps)),o=!o),o&&wt&&Ur(t),Lp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));wt=rx(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));wt=rx(t)}else n===27?(n=wt,ns(t.type)?(t=bd,bd=null,wt=t):wt=n):wt=rn?Vn(t.stateNode.nextSibling):null;return!0}function vs(){wt=rn=null,at=!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=O(null),ys=null,yr=null;function $r(t,n,o){U(Zc,n._currentValue),n._currentValue=o}function _r(t){t._currentValue=Zc.current,$(Zc)}function Qc(t,n,o){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===o)break;t=t.return}}function Jc(t,n,o,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|=o,K=E.alternate,K!==null&&(K.lanes|=o),Qc(E.return,o,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|=o,E=M.alternate,E!==null&&(E.lanes|=o),Qc(M,o,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,o,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,o,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,yr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function sn(t){return Rp(ys,t)}function Lo(t,n){return ys===null&&_s(t),Rp(t,n)}function Rp(t,n){var o=n._currentValue;if(n={context:n,memoizedValue:o,next:null},yr===null){if(t===null)throw Error(i(308));yr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else yr=yr.next=n;return o}var X_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(o,p){t.push(p)}};this.abort=function(){n.aborted=!0,t.forEach(function(o){return o()})}},Z_=e.unstable_scheduleCallback,Q_=e.unstable_NormalPriority,Ht={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function eu(){return{controller:new X_,data:new Map,refCount:0}}function ra(t){t.refCount--,t.refCount===0&&Z_(Q_,function(){t.controller.abort()})}var sa=null,tu=0,li=0,ci=null;function J_(t,n){if(sa===null){var o=sa=[];tu=0,li=sd(),ci={status:"pending",value:void 0,then:function(p){o.push(p)}}}return tu++,n.then(Op,Op),n}function Op(){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 eS(t,n){var o=[],p={status:"pending",value:null,reason:null,then:function(w){o.push(w)}};return t.then(function(){p.status="fulfilled",p.value=n;for(var w=0;w<o.length;w++)(0,o[w])(n)},function(w){for(p.status="rejected",p.reason=w,w=0;w<o.length;w++)(0,o[w])(void 0)}),p}var Mp=H.S;H.S=function(t,n){bg=Me(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&J_(t,n),Mp!==null&&Mp(t,n)};var Ss=O(null);function nu(){var t=Ss.current;return t!==null?t:vt.pooledCache}function Ro(t,n){n===null?U(Ss,Ss.current):U(Ss,n.pool)}function Ip(){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 Bp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function zp(t,n,o){switch(o=t[o],o===void 0?t.push(n):o!==n&&(n.then(gr,gr),n=o),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Hp(t),t;default:if(typeof n.status=="string")n.then(gr,gr);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,Hp(t),t}throw Cs=n,ui}}function ws(t){try{var n=t._init;return n(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Cs=o,ui):o}}var Cs=null;function Pp(){if(Cs===null)throw Error(i(459));var t=Cs;return Cs=null,t}function Hp(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=[]),zp(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 Fp(t){function n(se,te){if(t){var ae=se.deletions;ae===null?(se.deletions=[te],se.flags|=16):ae.push(te)}}function o(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=br(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=Gc(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=Gc(te,se.mode,ae),te.return=se,te;case A:return te=ws(te),xe(se,te,ae)}if(z(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,Lo(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(z(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,Lo(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(z(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,Lo(te,ge),Be);Bo(te,ge)}return null}function De(se,te,ae,ge){for(var Be=null,ct=null,Re=te,Ye=te=0,st=null;Re!==null&&Ye<ae.length;Ye++){Re.index>Ye?(st=Re,Re=null):st=Re.sibling;var ut=le(se,Re,ae[Ye],ge);if(ut===null){Re===null&&(Re=st);break}t&&Re&&ut.alternate===null&&n(se,Re),te=E(ut,te,Ye),ct===null?Be=ut:ct.sibling=ut,ct=ut,Re=st}if(Ye===ae.length)return o(se,Re),at&&vr(se,Ye),Be;if(Re===null){for(;Ye<ae.length;Ye++)Re=xe(se,ae[Ye],ge),Re!==null&&(te=E(Re,te,Ye),ct===null?Be=Re:ct.sibling=Re,ct=Re);return at&&vr(se,Ye),Be}for(Re=p(Re);Ye<ae.length;Ye++)st=de(Re,se,Ye,ae[Ye],ge),st!==null&&(t&&st.alternate!==null&&Re.delete(st.key===null?Ye:st.key),te=E(st,te,Ye),ct===null?Be=st:ct.sibling=st,ct=st);return t&&Re.forEach(function(os){return n(se,os)}),at&&vr(se,Ye),Be}function He(se,te,ae,ge){if(ae==null)throw Error(i(151));for(var Be=null,ct=null,Re=te,Ye=te=0,st=null,ut=ae.next();Re!==null&&!ut.done;Ye++,ut=ae.next()){Re.index>Ye?(st=Re,Re=null):st=Re.sibling;var os=le(se,Re,ut.value,ge);if(os===null){Re===null&&(Re=st);break}t&&Re&&os.alternate===null&&n(se,Re),te=E(os,te,Ye),ct===null?Be=os:ct.sibling=os,ct=os,Re=st}if(ut.done)return o(se,Re),at&&vr(se,Ye),Be;if(Re===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 at&&vr(se,Ye),Be}for(Re=p(Re);!ut.done;Ye++,ut=ae.next())ut=de(Re,se,Ye,ut.value,ge),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Ye:ut.key),te=E(ut,te,Ye),ct===null?Be=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(d1){return n(se,d1)}),at&&vr(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){o(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){o(se,te.sibling),ge=w(te,ae.props),aa(ge,ae),ge.return=se,se=ge;break e}o(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){o(se,te.sibling),ge=w(te,ae.children||[]),ge.return=se,se=ge;break e}else{o(se,te);break}else n(se,te);te=te.sibling}ge=Gc(ae,se.mode,ge),ge.return=se,se=ge}return M(se);case A:return ae=ws(ae),bt(se,te,ae,ge)}if(z(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,Lo(se,ae),ge);Bo(se,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,te!==null&&te.tag===6?(o(se,te.sibling),ge=w(te,ae),ge.return=se,se=ge):(o(se,te),ge=Wc(ae,se.mode,ge),ge.return=se,se=ge),M(se)):o(se,te)}return function(se,te,ae,ge){try{ia=0;var Be=bt(se,te,ae,ge);return di=null,Be}catch(Re){if(Re===ui||Re===Oo)throw Re;var ct=jn(29,Re,null,se.mode);return ct.lanes=ge,ct.return=se,ct}finally{}}}var ks=Fp(!0),Up=Fp(!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 Gr(t,n,o){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),kp(t,null,o),n}return jo(t,p,n,o),No(t)}function oa(t,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194048)!==0)){var p=n.lanes;p&=t.pendingLanes,o|=p,n.lanes=o,Rf(t,o)}}function au(t,n){var o=t.updateQueue,p=t.alternate;if(p!==null&&(p=p.updateQueue,o===p)){var w=null,E=null;if(o=o.firstBaseUpdate,o!==null){do{var M={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};E===null?w=E=M:E=E.next=M,o=o.next}while(o!==null);E===null?w=E=n:E=E.next=n}else w=E=n;o={baseState:p.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:p.shared,callbacks:p.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=n:t.next=n,o.lastBaseUpdate=n}var ou=!1;function la(){if(ou){var t=ci;if(t!==null)throw t}}function ca(t,n,o,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?(rt&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=o;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 $p(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function qp(t,n){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)$p(o[t],n)}var hi=O(null),zo=O(0);function Wp(t,n){t=Ar,U(zo,t),U(hi,n),Ar=t|n.baseLanes}function lu(){U(zo,Ar),U(hi,hi.current)}function cu(){Ar=zo.current,$(hi),$(zo)}var Nn=O(null),Gn=null;function Vr(t){var n=t.alternate;U(It,It.current&1),U(Nn,t),Gn===null&&(n===null||hi.current!==null||n.memoizedState!==null)&&(Gn=t)}function uu(t){U(It,It.current),U(Nn,t),Gn===null&&(Gn=t)}function Gp(t){t.tag===22?(U(It,It.current),U(Nn,t),Gn===null&&(Gn=t)):Kr()}function Kr(){U(It,It.current),U(Nn,Nn.current)}function Tn(t){$(Nn),Gn===t&&(Gn=null),$(It)}var It=O(0);function Po(t){for(var n=t;n!==null;){if(n.tag===13){var o=n.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||gd(o)||xd(o)))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 Sr=0,Ke=null,gt=null,Ft=null,Ho=!1,fi=!1,Es=!1,Fo=0,ua=0,pi=null,tS=0;function Lt(){throw Error(i(321))}function du(t,n){if(n===null)return!1;for(var o=0;o<n.length&&o<t.length;o++)if(!En(t[o],n[o]))return!1;return!0}function hu(t,n,o,p,w,E){return Sr=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=t===null||t.memoizedState===null?Tm:ju,Es=!1,E=o(p,w),Es=!1,fi&&(E=Kp(n,o,p,w)),Vp(t),E}function Vp(t){H.H=fa;var n=gt!==null&>.next!==null;if(Sr=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 Kp(t,n,o,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)}H.H=Am,E=n(o,p)}while(fi);return E}function nS(){var t=H.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,o){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~o}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}Sr=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=zp(pi,t,n),n=Ke,(Ft===null?n.memoizedState:Ft.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?Tm:ju),t}function $o(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return da(t);if(t.$$typeof===_)return sn(t)}throw Error(i(438,String(t)))}function gu(t){var n=null,o=Ke.updateQueue;if(o!==null&&(n=o.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}),o===null&&(o=Uo(),Ke.updateQueue=o),o.memoCache=n,o=n.data[n.index],o===void 0)for(o=n.data[n.index]=Array(t),p=0;p<t;p++)o[p]=R;return n.index++,o}function wr(t,n){return typeof n=="function"?n(t):n}function qo(t){var n=Bt();return xu(n,gt,t)}function xu(t,n,o){var p=t.queue;if(p===null)throw Error(i(311));p.lastRenderedReducer=o;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?(rt&xe)===xe:(Sr&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((Sr&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&&o(E,xe),E=oe.hasEagerState?oe.eagerState:o(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&&(o=ci,o!==null)))throw o;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(),o=n.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=t;var p=o.dispatch,w=o.pending,E=n.memoizedState;if(w!==null){o.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),o.lastRenderedState=E}return[E,p]}function Yp(t,n,o){var p=Ke,w=Bt(),E=at;if(E){if(o===void 0)throw Error(i(407));o=o()}else o=n();var M=!En((gt||w).memoizedState,o);if(M&&(w.memoizedState=o,Ut=!0),w=w.queue,_u(Qp.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},Zp.bind(null,p,w,o,n),null),vt===null)throw Error(i(349));E||(Sr&127)!==0||Xp(p,n,o)}return o}function Xp(t,n,o){t.flags|=16384,t={getSnapshot:n,value:o},n=Ke.updateQueue,n===null?(n=Uo(),Ke.updateQueue=n,n.stores=[t]):(o=n.stores,o===null?n.stores=[t]:o.push(t))}function Zp(t,n,o,p){n.value=o,n.getSnapshot=p,Jp(n)&&em(t)}function Qp(t,n,o){return o(function(){Jp(n)&&em(t)})}function Jp(t){var n=t.getSnapshot;t=t.value;try{var o=n();return!En(t,o)}catch{return!0}}function em(t){var n=xs(t,2);n!==null&&wn(n,t,2)}function vu(t){var n=mn();if(typeof t=="function"){var o=t;if(t=o(),Es){ue(!0);try{o()}finally{ue(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:t},n}function tm(t,n,o,p){return t.baseState=o,xu(t,gt,typeof p=="function"?p:wr)}function rS(t,n,o,p,w){if(Vo(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)}};H.T!==null?o(!0):E.isTransition=!1,p(E),o=n.pending,o===null?(E.next=n.pending=E,nm(n,E)):(E.next=o.next,n.pending=o.next=E)}}function nm(t,n){var o=n.action,p=n.payload,w=t.state;if(n.isTransition){var E=H.T,M={};H.T=M;try{var K=o(w,p),J=H.S;J!==null&&J(M,K),rm(t,n,K)}catch(oe){yu(t,n,oe)}finally{E!==null&&M.types!==null&&(E.types=M.types),H.T=E}}else try{E=o(w,p),rm(t,n,E)}catch(oe){yu(t,n,oe)}}function rm(t,n,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(p){sm(t,n,p)},function(p){return yu(t,n,p)}):sm(t,n,o)}function sm(t,n,o){n.status="fulfilled",n.value=o,im(n),t.state=o,n=t.pending,n!==null&&(o=n.next,o===n?t.pending=null:(o=o.next,n.next=o,nm(t,o)))}function yu(t,n,o){var p=t.pending;if(t.pending=null,p!==null){p=p.next;do n.status="rejected",n.reason=o,im(n),n=n.next;while(n!==p)}t.action=null}function im(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function am(t,n){return n}function om(t,n){if(at){var o=vt.formState;if(o!==null){e:{var p=Ke;if(at){if(wt){t:{for(var w=wt,E=Wn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Vn(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){wt=Vn(w.nextSibling),p=w.data==="F!";break e}}Ur(p)}p=!1}p&&(n=o[0])}}return o=mn(),o.memoizedState=o.baseState=n,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:am,lastRenderedState:n},o.queue=p,o=Em.bind(null,Ke,p),p.dispatch=o,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,o=rS.bind(null,Ke,w,E,o),w.dispatch=o,p.memoizedState=t,[n,o,!1]}function lm(t){var n=Bt();return cm(n,gt,t)}function cm(t,n,o){if(n=xu(t,n,am)[0],t=qo(wr)[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 o!==n.memoizedState&&(Ke.flags|=2048,mi(9,{destroy:void 0},sS.bind(null,w,o),null)),[p,E,t]}function sS(t,n){t.action=n}function um(t){var n=Bt(),o=gt;if(o!==null)return cm(n,o,t);Bt(),n=n.memoizedState,o=Bt();var p=o.queue.dispatch;return o.memoizedState=t,[n,p,!1]}function mi(t,n,o,p){return t={tag:t,create:o,deps:p,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Uo(),Ke.updateQueue=n),o=n.lastEffect,o===null?n.lastEffect=t.next=t:(p=o.next,o.next=t,t.next=p,n.lastEffect=t),t}function dm(){return Bt().memoizedState}function Wo(t,n,o,p){var w=mn();Ke.flags|=t,w.memoizedState=mi(1|n,{destroy:void 0},o,p===void 0?null:p)}function Go(t,n,o,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,o,p):(Ke.flags|=t,w.memoizedState=mi(1|n,E,o,p))}function hm(t,n){Wo(8390656,8,t,n)}function _u(t,n){Go(2048,8,t,n)}function iS(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Uo(),Ke.updateQueue=n,n.events=[t];else{var o=n.events;o===null?n.events=[t]:o.push(t)}}function fm(t){var n=Bt().memoizedState;return iS({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function pm(t,n){return Go(4,2,t,n)}function mm(t,n){return Go(4,4,t,n)}function gm(t,n){if(typeof n=="function"){t=t();var o=n(t);return function(){typeof o=="function"?o():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function xm(t,n,o){o=o!=null?o.concat([t]):null,Go(4,4,gm.bind(null,n,t),o)}function Su(){}function bm(t,n){var o=Bt();n=n===void 0?null:n;var p=o.memoizedState;return n!==null&&du(n,p[1])?p[0]:(o.memoizedState=[t,n],t)}function vm(t,n){var o=Bt();n=n===void 0?null:n;var p=o.memoizedState;if(n!==null&&du(n,p[1]))return p[0];if(p=t(),Es){ue(!0);try{t()}finally{ue(!1)}}return o.memoizedState=[p,n],p}function wu(t,n,o){return o===void 0||(Sr&1073741824)!==0&&(rt&261930)===0?t.memoizedState=n:(t.memoizedState=o,t=yg(),Ke.lanes|=t,Zr|=t,o)}function ym(t,n,o,p){return En(o,n)?o:hi.current!==null?(t=wu(t,o,p),En(t,n)||(Ut=!0),t):(Sr&42)===0||(Sr&1073741824)!==0&&(rt&261930)===0?(Ut=!0,t.memoizedState=o):(t=yg(),Ke.lanes|=t,Zr|=t,n)}function _m(t,n,o,p,w){var E=Z.p;Z.p=E!==0&&8>E?E:8;var M=H.T,K={};H.T=K,Eu(t,!1,n,o);try{var J=w(),oe=H.S;if(oe!==null&&oe(K,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=eS(J,p);ha(t,n,he,Ln(t))}else ha(t,n,p,Ln(t))}catch(xe){ha(t,n,{then:function(){},status:"rejected",reason:xe},Ln())}finally{Z.p=E,M!==null&&K.types!==null&&(M.types=K.types),H.T=M}}function aS(){}function Cu(t,n,o,p){if(t.tag!==5)throw Error(i(476));var w=Sm(t).queue;_m(t,w,n,Y,o===null?aS:function(){return wm(t),o(p)})}function Sm(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:wr,lastRenderedState:Y},next:null};var o={};return n.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wr,lastRenderedState:o},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function wm(t){var n=Sm(t);n.next===null&&(n=t.alternate.memoizedState),ha(t,n.next.queue,{},Ln())}function ku(){return sn(Ta)}function Cm(){return Bt().memoizedState}function km(){return Bt().memoizedState}function oS(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var o=Ln();t=Wr(o);var p=Gr(n,t,o);p!==null&&(wn(p,n,o),oa(p,n,o)),n={cache:eu()},t.payload=n;return}n=n.return}}function lS(t,n,o){var p=Ln();o={lane:p,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Vo(t)?jm(n,o):(o=$c(t,n,o,p),o!==null&&(wn(o,t,p),Nm(o,n,p)))}function Em(t,n,o){var p=Ln();ha(t,n,o,p)}function ha(t,n,o,p){var w={lane:p,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Vo(t))jm(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,o);if(w.hasEagerState=!0,w.eagerState=K,En(K,M))return jo(t,n,w,0),vt===null&&Eo(),!1}catch{}finally{}if(o=$c(t,n,w,p),o!==null)return wn(o,t,p),Nm(o,n,p),!0}return!1}function Eu(t,n,o,p){if(p={lane:2,revertLane:sd(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Vo(t)){if(n)throw Error(i(479))}else n=$c(t,o,p,2),n!==null&&wn(n,t,2)}function Vo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function jm(t,n){fi=Ho=!0;var o=t.pending;o===null?n.next=n:(n.next=o.next,o.next=n),t.pending=n}function Nm(t,n,o){if((o&4194048)!==0){var p=n.lanes;p&=t.pendingLanes,o|=p,n.lanes=o,Rf(t,o)}}var fa={readContext:sn,use:$o,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};fa.useEffectEvent=Lt;var Tm={readContext:sn,use:$o,useCallback:function(t,n){return mn().memoizedState=[t,n===void 0?null:n],t},useContext:sn,useEffect:hm,useImperativeHandle:function(t,n,o){o=o!=null?o.concat([t]):null,Wo(4194308,4,gm.bind(null,n,t),o)},useLayoutEffect:function(t,n){return Wo(4194308,4,t,n)},useInsertionEffect:function(t,n){Wo(4,2,t,n)},useMemo:function(t,n){var o=mn();n=n===void 0?null:n;var p=t();if(Es){ue(!0);try{t()}finally{ue(!1)}}return o.memoizedState=[p,n],p},useReducer:function(t,n,o){var p=mn();if(o!==void 0){var w=o(n);if(Es){ue(!0);try{o(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=lS.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,o=Em.bind(null,Ke,n);return n.dispatch=o,[t.memoizedState,o]},useDebugValue:Su,useDeferredValue:function(t,n){var o=mn();return wu(o,t,n)},useTransition:function(){var t=vu(!1);return t=_m.bind(null,Ke,t.queue,!0,!1),mn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,o){var p=Ke,w=mn();if(at){if(o===void 0)throw Error(i(407));o=o()}else{if(o=n(),vt===null)throw Error(i(349));(rt&127)!==0||Xp(p,n,o)}w.memoizedState=o;var E={value:o,getSnapshot:n};return w.queue=E,hm(Qp.bind(null,p,E,t),[t]),p.flags|=2048,mi(9,{destroy:void 0},Zp.bind(null,p,E,o,n),null),o},useId:function(){var t=mn(),n=vt.identifierPrefix;if(at){var o=sr,p=rr;o=(p&~(1<<32-Ee(p)-1)).toString(32)+o,n="_"+n+"R_"+o,o=Fo++,0<o&&(n+="H"+o.toString(32)),n+="_"}else o=tS++,n="_"+n+"r_"+o.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:ku,useFormState:om,useActionState:om,useOptimistic:function(t){var n=mn();n.memoizedState=n.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=o,n=Eu.bind(null,Ke,!0,o),o.dispatch=n,[t,n]},useMemoCache:gu,useCacheRefresh:function(){return mn().memoizedState=oS.bind(null,Ke)},useEffectEvent:function(t){var n=mn(),o={impl:t};return n.memoizedState=o,function(){if((dt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},ju={readContext:sn,use:$o,useCallback:bm,useContext:sn,useEffect:_u,useImperativeHandle:xm,useInsertionEffect:pm,useLayoutEffect:mm,useMemo:vm,useReducer:qo,useRef:dm,useState:function(){return qo(wr)},useDebugValue:Su,useDeferredValue:function(t,n){var o=Bt();return ym(o,gt.memoizedState,t,n)},useTransition:function(){var t=qo(wr)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:da(t),n]},useSyncExternalStore:Yp,useId:Cm,useHostTransitionStatus:ku,useFormState:lm,useActionState:lm,useOptimistic:function(t,n){var o=Bt();return tm(o,gt,t,n)},useMemoCache:gu,useCacheRefresh:km};ju.useEffectEvent=fm;var Am={readContext:sn,use:$o,useCallback:bm,useContext:sn,useEffect:_u,useImperativeHandle:xm,useInsertionEffect:pm,useLayoutEffect:mm,useMemo:vm,useReducer:bu,useRef:dm,useState:function(){return bu(wr)},useDebugValue:Su,useDeferredValue:function(t,n){var o=Bt();return gt===null?wu(o,t,n):ym(o,gt.memoizedState,t,n)},useTransition:function(){var t=bu(wr)[0],n=Bt().memoizedState;return[typeof t=="boolean"?t:da(t),n]},useSyncExternalStore:Yp,useId:Cm,useHostTransitionStatus:ku,useFormState:um,useActionState:um,useOptimistic:function(t,n){var o=Bt();return gt!==null?tm(o,gt,t,n):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:gu,useCacheRefresh:km};Am.useEffectEvent=fm;function Nu(t,n,o,p){n=t.memoizedState,o=o(p,n),o=o==null?n:m({},n,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var Tu={enqueueSetState:function(t,n,o){t=t._reactInternals;var p=Ln(),w=Wr(p);w.payload=n,o!=null&&(w.callback=o),n=Gr(t,w,p),n!==null&&(wn(n,t,p),oa(n,t,p))},enqueueReplaceState:function(t,n,o){t=t._reactInternals;var p=Ln(),w=Wr(p);w.tag=1,w.payload=n,o!=null&&(w.callback=o),n=Gr(t,w,p),n!==null&&(wn(n,t,p),oa(n,t,p))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var o=Ln(),p=Wr(o);p.tag=2,n!=null&&(p.callback=n),n=Gr(t,p,o),n!==null&&(wn(n,t,o),oa(n,t,o))}};function Dm(t,n,o,p,w,E,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(p,E,M):n.prototype&&n.prototype.isPureReactComponent?!Ji(o,p)||!Ji(w,E):!0}function Lm(t,n,o,p){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(o,p),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(o,p),n.state!==t&&Tu.enqueueReplaceState(n,n.state,null)}function js(t,n){var o=n;if("ref"in n){o={};for(var p in n)p!=="ref"&&(o[p]=n[p])}if(t=t.defaultProps){o===n&&(o=m({},o));for(var w in t)o[w]===void 0&&(o[w]=t[w])}return o}function Rm(t){ko(t)}function Om(t){console.error(t)}function Mm(t){ko(t)}function Ko(t,n){try{var o=t.onUncaughtError;o(n.value,{componentStack:n.stack})}catch(p){setTimeout(function(){throw p})}}function Im(t,n,o){try{var p=t.onCaughtError;p(o.value,{componentStack:o.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function Au(t,n,o){return o=Wr(o),o.tag=3,o.payload={element:null},o.callback=function(){Ko(t,n)},o}function Bm(t){return t=Wr(t),t.tag=3,t}function zm(t,n,o,p){var w=o.type.getDerivedStateFromError;if(typeof w=="function"){var E=p.value;t.payload=function(){return w(E)},t.callback=function(){Im(n,o,p)}}var M=o.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){Im(n,o,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 cS(t,n,o,p,w){if(o.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(n=o.alternate,n!==null&&oi(n,o,w,!0),o=Nn.current,o!==null){switch(o.tag){case 31:case 13:return Gn===null?al():o.alternate===null&&Rt===0&&(Rt=3),o.flags&=-257,o.flags|=65536,o.lanes=w,p===Mo?o.flags|=16384:(n=o.updateQueue,n===null?o.updateQueue=new Set([p]):n.add(p),td(t,p,w)),!1;case 22:return o.flags|=65536,p===Mo?o.flags|=16384:(n=o.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([p])},o.updateQueue=n):(o=n.retryQueue,o===null?n.retryQueue=new Set([p]):o.add(p)),td(t,p,w)),!1}throw Error(i(435,o.tag))}return td(t,p,w),al(),!1}if(at)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,o)))):(p!==Yc&&(n=Error(i(423),{cause:p}),na(Un(n,o))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,p=Un(p,o),w=Au(t.stateNode,p,w),au(t,w),Rt!==4&&(Rt=2)),!1;var E=Error(i(520),{cause:p});if(E=Un(E,o),_a===null?_a=[E]:_a.push(E),Rt!==4&&(Rt=2),n===null)return!0;p=Un(p,o),o=n;do{switch(o.tag){case 3:return o.flags|=65536,t=w&-w,o.lanes|=t,t=Au(o.stateNode,p,t),au(o,t),!1;case 1:if(n=o.type,E=o.stateNode,(o.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Qr===null||!Qr.has(E))))return o.flags|=65536,w&=-w,o.lanes|=w,w=Bm(w),zm(w,t,o,p),au(o,w),!1}o=o.return}while(o!==null);return!1}var Du=Error(i(461)),Ut=!1;function an(t,n,o,p){n.child=t===null?Up(n,null,o,p):ks(n,t.child,o,p)}function Pm(t,n,o,p,w){o=o.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,o,M,E,w),K=fu(),t!==null&&!Ut?(pu(t,n,w),Cr(t,n,w)):(at&&K&&Vc(n),n.flags|=1,an(t,n,p,w),n.child)}function Hm(t,n,o,p,w){if(t===null){var E=o.type;return typeof E=="function"&&!qc(E)&&E.defaultProps===void 0&&o.compare===null?(n.tag=15,n.type=E,Fm(t,n,E,p,w)):(t=To(o.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(o=o.compare,o=o!==null?o:Ji,o(M,p)&&t.ref===n.ref)return Cr(t,n,w)}return n.flags|=1,t=br(E,p),t.ref=n.ref,t.return=n,n.child=t}function Fm(t,n,o,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,Cr(t,n,w)}return Lu(t,n,o,p,w)}function Um(t,n,o,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|o:o,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 $m(t,n,E,o,p)}if((o&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ro(n,E!==null?E.cachePool:null),E!==null?Wp(n,E):lu(),Gp(n);else return p=n.lanes=536870912,$m(t,n,E!==null?E.baseLanes|o:o,o,p)}else E!==null?(Ro(n,E.cachePool),Wp(n,E),Kr(),n.memoizedState=null):(t!==null&&Ro(n,null),lu(),Kr());return an(t,n,w,o),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 $m(t,n,o,p,w){var E=nu();return E=E===null?null:{parent:Ht._currentValue,pool:E},n.memoizedState={baseLanes:o,cachePool:E},t!==null&&Ro(n,null),lu(),Gp(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 qm(t,n,o){return ks(n,t.child,null,o),t=Yo(n,n.pendingProps),t.flags|=2,Tn(n),n.memoizedState=null,t}function uS(t,n,o){var p=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(at){if(p.mode==="hidden")return t=Yo(n,p),n.lanes=536870912,pa(null,t);if(uu(n),(t=wt)?(t=nx(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},o=jp(t),o.return=n,n.child=o,rn=n,wt=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=qm(t,n,o);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,o,!1),w=(o&t.childLanes)!==0,Ut||w){if(p=vt,p!==null&&(M=Of(p,o),M!==0&&M!==E.retryLane))throw E.retryLane=M,xs(t,M),wn(p,t,M),Du;al(),n=qm(t,n,o)}else t=E.treeContext,wt=Vn(M.nextSibling),rn=n,at=!0,Fr=null,Wn=!1,t!==null&&Ap(n,t),n=Yo(n,p),n.flags|=4096;return n}return t=br(t.child,{mode:p.mode,children:p.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Xo(t,n){var o=n.ref;if(o===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(t===null||t.ref!==o)&&(n.flags|=4194816)}}function Lu(t,n,o,p,w){return _s(n),o=hu(t,n,o,p,void 0,w),p=fu(),t!==null&&!Ut?(pu(t,n,w),Cr(t,n,w)):(at&&p&&Vc(n),n.flags|=1,an(t,n,o,w),n.child)}function Wm(t,n,o,p,w,E){return _s(n),n.updateQueue=null,o=Kp(n,p,o,w),Vp(t),p=fu(),t!==null&&!Ut?(pu(t,n,E),Cr(t,n,E)):(at&&p&&Vc(n),n.flags|=1,an(t,n,o,E),n.child)}function Gm(t,n,o,p,w){if(_s(n),n.stateNode===null){var E=ri,M=o.contextType;typeof M=="object"&&M!==null&&(E=sn(M)),E=new o(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=o.contextType,E.context=typeof M=="object"&&M!==null?sn(M):ri,E.state=n.memoizedState,M=o.getDerivedStateFromProps,typeof M=="function"&&(Nu(n,o,M,p),E.state=n.memoizedState),typeof o.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(o,K);E.props=J;var oe=E.context,he=o.contextType;M=ri,typeof he=="object"&&he!==null&&(M=sn(he));var xe=o.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)&&Lm(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,o,xe,p),oe=n.memoizedState),(J=qr||Dm(n,o,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(o,M),E.props=he,xe=n.pendingProps,le=E.context,oe=o.contextType,J=ri,typeof oe=="object"&&oe!==null&&(J=sn(oe)),K=o.getDerivedStateFromProps,(oe=typeof K=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(M!==xe||le!==J)&&Lm(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,o,K,p),de=n.memoizedState),(he=qr||Dm(n,o,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,o=p&&typeof o.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&p?(n.child=ks(n,t.child,null,w),n.child=ks(n,null,o,w)):an(t,n,o,w),n.memoizedState=E.state,t=n.child):t=Cr(t,n,w),t}function Vm(t,n,o,p){return vs(),n.flags|=256,an(t,n,o,p),n.child}var Ru={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ou(t){return{baseLanes:t,cachePool:Ip()}}function Mu(t,n,o){return t=t!==null?t.childLanes&~o:0,n&&(t|=Dn),t}function Km(t,n,o){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(at){if(w?Vr(n):Kr(),(t=wt)?(t=nx(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},o=jp(t),o.return=n,n.child=o,rn=n,wt=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,o,null),K.return=n,p.return=n,K.sibling=p,n.child=K,p=n.child,p.memoizedState=Ou(o),p.childLanes=Mu(t,M,o),n.memoizedState=Ru,pa(null,p)):(Vr(n),Iu(n,K))}var J=t.memoizedState;if(J!==null&&(K=J.dehydrated,K!==null)){if(E)n.flags&256?(Vr(n),n.flags&=-257,n=Bu(t,n,o)):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,o,null),K.flags|=2,p.return=n,K.return=n,p.sibling=K,n.child=p,ks(n,t.child,null,o),p=n.child,p.memoizedState=Ou(o),p.childLanes=Mu(t,M,o),n.memoizedState=Ru,n=pa(null,p));else if(Vr(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,o)}else if(Ut||oi(t,n,o,!1),M=(o&t.childLanes)!==0,Ut||M){if(M=vt,M!==null&&(p=Of(M,o),p!==0&&p!==J.retryLane))throw J.retryLane=p,xs(t,p),wn(M,t,p),Du;gd(K)||al(),n=Bu(t,n,o)}else gd(K)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,wt=Vn(K.nextSibling),rn=n,at=!0,Fr=null,Wn=!1,t!==null&&Ap(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=br(J,{mode:"hidden",children:p.children}),p.subtreeFlags=J.subtreeFlags&65011712,oe!==null?K=br(oe,K):(K=bs(K,w,o,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(o):(w=K.cachePool,w!==null?(J=Ht._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=Ip(),K={baseLanes:K.baseLanes|o,cachePool:w}),p.memoizedState=K,p.childLanes=Mu(t,M,o),n.memoizedState=Ru,pa(t.child,p)):(Vr(n),o=t.child,t=o.sibling,o=br(o,{mode:"visible",children:p.children}),o.return=n,o.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=o,n.memoizedState=null,o)}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,o){return ks(n,t.child,null,o),t=Iu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Ym(t,n,o){t.lanes|=n;var p=t.alternate;p!==null&&(p.lanes|=n),Qc(t.return,n,o)}function zu(t,n,o,p,w,E){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:p,tail:o,tailMode:w,treeForkCount:E}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=p,M.tail=o,M.tailMode=w,M.treeForkCount=E)}function Xm(t,n,o){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),an(t,n,p,o),p=at?ta:0,!K&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Ym(t,o,n);else if(t.tag===19)Ym(t,o,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(o=n.child,w=null;o!==null;)t=o.alternate,t!==null&&Po(t)===null&&(w=o),o=o.sibling;o=w,o===null?(w=n.child,n.child=null):(w=o.sibling,o.sibling=null),zu(n,!1,w,o,E,p);break;case"backwards":case"unstable_legacy-backwards":for(o=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=o,o=w,w=t}zu(n,!0,o,null,E,p);break;case"together":zu(n,!1,null,null,void 0,p);break;default:n.memoizedState=null}return n.child}function Cr(t,n,o){if(t!==null&&(n.dependencies=t.dependencies),Zr|=n.lanes,(o&n.childLanes)===0)if(t!==null){if(oi(t,n,o,!1),(o&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,o=br(t,t.pendingProps),n.child=o,o.return=n;t.sibling!==null;)t=t.sibling,o=o.sibling=br(t,t.pendingProps),o.return=n;o.sibling=null}return n.child}function Pu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Do(t)))}function dS(t,n,o){switch(n.tag){case 3:G(n,n.stateNode.containerInfo),$r(n,Ht,t.memoizedState.cache),vs();break;case 27:case 5:re(n);break;case 4:G(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?(Vr(n),n.flags|=128,null):(o&n.child.childLanes)!==0?Km(t,n,o):(Vr(n),t=Cr(t,n,o),t!==null?t.sibling:null);Vr(n);break;case 19:var w=(t.flags&128)!==0;if(p=(o&n.childLanes)!==0,p||(oi(t,n,o,!1),p=(o&n.childLanes)!==0),w){if(p)return Xm(t,n,o);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,Um(t,n,o,n.pendingProps);case 24:$r(n,Ht,t.memoizedState.cache)}return Cr(t,n,o)}function Zm(t,n,o){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ut=!0;else{if(!Pu(t,o)&&(n.flags&128)===0)return Ut=!1,dS(t,n,o);Ut=(t.flags&131072)!==0}else Ut=!1,at&&(n.flags&1048576)!==0&&Tp(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=Gm(null,n,t,p,o)):(n.tag=0,n=Lu(null,n,t,p,o));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=Pm(null,n,t,p,o);break e}else if(w===D){n.tag=14,n=Hm(null,n,t,p,o);break e}}throw n=V(t)||t,Error(i(306,n,""))}}return n;case 0:return Lu(t,n,n.type,n.pendingProps,o);case 1:return p=n.type,w=js(p,n.pendingProps),Gm(t,n,p,w,o);case 3:e:{if(G(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,o);var M=n.memoizedState;if(p=M.cache,$r(n,Ht,p),p!==E.cache&&Jc(n,[Ht],o,!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,o);break e}else if(p!==w){w=Un(Error(i(424)),n),na(w),n=Vm(t,n,p,o);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(wt=Vn(t.firstChild),rn=n,at=!0,Fr=null,Wn=!0,o=Up(n,null,p,o),n.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(vs(),p===w){n=Cr(t,n,o);break e}an(t,n,p,o)}n=n.child}return n;case 26:return Xo(t,n),t===null?(o=lx(n.type,null,n.pendingProps,null))?n.memoizedState=o:at||(o=n.type,t=n.pendingProps,p=fl(ee.current).createElement(o),p[nn]=n,p[xn]=t,on(p,o,t),Xt(p),n.stateNode=p):n.memoizedState=lx(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return re(n),t===null&&at&&(p=n.stateNode=ix(n.type,n.pendingProps,ee.current),rn=n,Wn=!0,w=wt,ns(n.type)?(bd=w,wt=Vn(p.firstChild)):wt=w),an(t,n,n.pendingProps.children,o),Xo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&at&&((w=p=wt)&&(p=FS(p,n.type,n.pendingProps,Wn),p!==null?(n.stateNode=p,rn=n,wt=Vn(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,nS,null,null,o),Ta._currentValue=w),Xo(t,n),an(t,n,p,o),n.child;case 6:return t===null&&at&&((t=o=wt)&&(o=US(o,n.pendingProps,Wn),o!==null?(n.stateNode=o,rn=n,wt=null,t=!0):t=!1),t||Ur(n)),null;case 13:return Km(t,n,o);case 4:return G(n,n.stateNode.containerInfo),p=n.pendingProps,t===null?n.child=ks(n,null,p,o):an(t,n,p,o),n.child;case 11:return Pm(t,n,n.type,n.pendingProps,o);case 7:return an(t,n,n.pendingProps,o),n.child;case 8:return an(t,n,n.pendingProps.children,o),n.child;case 12:return an(t,n,n.pendingProps.children,o),n.child;case 10:return p=n.pendingProps,$r(n,n.type,p.value),an(t,n,p.children,o),n.child;case 9:return w=n.type._context,p=n.pendingProps.children,_s(n),w=sn(w),p=p(w),n.flags|=1,an(t,n,p,o),n.child;case 14:return Hm(t,n,n.type,n.pendingProps,o);case 15:return Fm(t,n,n.type,n.pendingProps,o);case 19:return Xm(t,n,o);case 31:return uS(t,n,o);case 22:return Um(t,n,o,n.pendingProps);case 24:return _s(n),p=sn(Ht),t===null?(w=nu(),w===null&&(w=vt,E=eu(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=o),w=E),n.memoizedState={parent:p,cache:w},su(n),$r(n,Ht,w)):((t.lanes&o)!==0&&(iu(t,n),ca(n,null,null,o),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],o,!0))),an(t,n,n.pendingProps.children,o),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function kr(t){t.flags|=4}function Hu(t,n,o,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(Cg())t.flags|=8192;else throw Cs=Mo,ru}else t.flags&=-16777217}function Qm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!fx(n))if(Cg())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(!at)switch(t.tailMode){case"hidden":n=t.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var p=null;o!==null;)o.alternate!==null&&(p=o),o=o.sibling;p===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:p.sibling=null}}function Ct(t){var n=t.alternate!==null&&t.alternate.child===t.child,o=0,p=0;if(n)for(var w=t.child;w!==null;)o|=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;)o|=w.lanes|w.childLanes,p|=w.subtreeFlags,p|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=p,t.childLanes=o,n}function hS(t,n,o){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 Ct(n),null;case 1:return Ct(n),null;case 3:return o=n.stateNode,p=null,t!==null&&(p=t.memoizedState.cache),n.memoizedState.cache!==p&&(n.flags|=2048),_r(Ht),ie(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ai(n)?kr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Xc())),Ct(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(kr(n),E!==null?(Ct(n),Qm(n,E)):(Ct(n),Hu(n,w,null,p,o))):E?E!==t.memoizedState?(kr(n),Ct(n),Qm(n,E)):(Ct(n),n.flags&=-16777217):(t=t.memoizedProps,t!==p&&kr(n),Ct(n),Hu(n,w,t,p,o)),null;case 27:if(be(n),o=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==p&&kr(n);else{if(!p){if(n.stateNode===null)throw Error(i(166));return Ct(n),null}t=ne.current,ai(n)?Dp(n):(t=ix(w,p,o),n.stateNode=t,kr(n))}return Ct(n),null;case 5:if(be(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==p&&kr(n);else{if(!p){if(n.stateNode===null)throw Error(i(166));return Ct(n),null}if(E=ne.current,ai(n))Dp(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[nn]=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(on(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&&kr(n)}}return Ct(n),Hu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,o),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==p&&kr(n);else{if(typeof p!="string"&&n.stateNode===null)throw Error(i(166));if(t=ee.current,ai(n)){if(t=n.stateNode,o=n.memoizedProps,p=null,w=rn,w!==null)switch(w.tag){case 27:case 5:p=w.memoizedProps}t[nn]=n,t=!!(t.nodeValue===o||p!==null&&p.suppressHydrationWarning===!0||Kg(t.nodeValue,o)),t||Ur(n,!0)}else t=fl(t).createTextNode(p),t[nn]=n,n.stateNode=t}return Ct(n),null;case 31:if(o=n.memoizedState,t===null||t.memoizedState!==null){if(p=ai(n),o!==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[nn]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ct(n),t=!1}else o=Xc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return n.flags&256?(Tn(n),n):(Tn(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Ct(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[nn]=n}else vs(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Ct(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=o,n):(o=p!==null,t=t!==null&&t.memoizedState!==null,o&&(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)),o!==t&&o&&(n.child.flags|=8192),Qo(n,n.updateQueue),Ct(n),null);case 4:return ie(),t===null&&ld(n.stateNode.containerInfo),Ct(n),null;case 10:return _r(n.type),Ct(n),null;case 19:if($(It),p=n.memoizedState,p===null)return Ct(n),null;if(w=(n.flags&128)!==0,E=p.rendering,E===null)if(w)ma(p,!1);else{if(Rt!==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=o,o=n.child;o!==null;)Ep(o,t),o=o.sibling;return U(It,It.current&1|2),at&&vr(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&&!at)return Ct(n),null}else 2*Me()-p.renderingStartTime>rl&&o!==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,o=It.current,U(It,w?o&1|2:o&1),at&&vr(n,p.treeForkCount),t):(Ct(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?(o&536870912)!==0&&(n.flags&128)===0&&(Ct(n),n.subtreeFlags&6&&(n.flags|=8192)):Ct(n),o=n.updateQueue,o!==null&&Qo(n,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),p=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(p=n.memoizedState.cachePool.pool),p!==o&&(n.flags|=2048),t!==null&&$(Ss),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),_r(Ht),Ct(n),null;case 25:return null;case 30:return null}throw Error(i(156,n.tag))}function fS(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 _r(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 _r(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 _r(Ht),null;case 25:return null;default:return null}}function Jm(t,n){switch(Kc(n),n.tag){case 3:_r(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:_r(n.type);break;case 22:case 23:Tn(n),cu(),t!==null&&$(Ss);break;case 24:_r(Ht)}}function ga(t,n){try{var o=n.updateQueue,p=o!==null?o.lastEffect:null;if(p!==null){var w=p.next;o=w;do{if((o.tag&t)===t){p=void 0;var E=o.create,M=o.inst;p=E(),M.destroy=p}o=o.next}while(o!==w)}}catch(K){pt(n,n.return,K)}}function Yr(t,n,o){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=o,oe=K;try{oe()}catch(he){pt(w,J,he)}}}p=p.next}while(p!==E)}}catch(he){pt(n,n.return,he)}}function eg(t){var n=t.updateQueue;if(n!==null){var o=t.stateNode;try{qp(n,o)}catch(p){pt(t,t.return,p)}}}function tg(t,n,o){o.props=js(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(p){pt(t,n,p)}}function xa(t,n){try{var o=t.ref;if(o!==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 o=="function"?t.refCleanup=o(p):o.current=p}}catch(w){pt(t,n,w)}}function ir(t,n){var o=t.ref,p=t.refCleanup;if(o!==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 o=="function")try{o(null)}catch(w){pt(t,n,w)}else o.current=null}function ng(t){var n=t.type,o=t.memoizedProps,p=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":o.autoFocus&&p.focus();break e;case"img":o.src?p.src=o.src:o.srcSet&&(p.srcset=o.srcSet)}}catch(w){pt(t,t.return,w)}}function Fu(t,n,o){try{var p=t.stateNode;MS(p,t.type,o,n),p[xn]=n}catch(w){pt(t,t.return,w)}}function rg(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||rg(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,o){var p=t.tag;if(p===5||p===6)t=t.stateNode,n?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,n):(n=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,n.appendChild(t),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=gr));else if(p!==4&&(p===27&&ns(t.type)&&(o=t.stateNode,n=null),t=t.child,t!==null))for($u(t,n,o),t=t.sibling;t!==null;)$u(t,n,o),t=t.sibling}function Jo(t,n,o){var p=t.tag;if(p===5||p===6)t=t.stateNode,n?o.insertBefore(t,n):o.appendChild(t);else if(p!==4&&(p===27&&ns(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(Jo(t,n,o),t=t.sibling;t!==null;)Jo(t,n,o),t=t.sibling}function sg(t){var n=t.stateNode,o=t.memoizedProps;try{for(var p=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);on(n,p,o),n[nn]=t,n[xn]=o}catch(E){pt(t,t.return,E)}}var Er=!1,$t=!1,qu=!1,ig=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function pS(t,n){if(t=t.containerInfo,dd=yl,t=xp(t),Bc(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var p=o.getSelection&&o.getSelection();if(p&&p.rangeCount!==0){o=p.anchorNode;var w=p.anchorOffset,E=p.focusNode;p=p.focusOffset;try{o.nodeType,E.nodeType}catch{o=null;break e}var M=0,K=-1,J=-1,oe=0,he=0,xe=t,le=null;t:for(;;){for(var de;xe!==o||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===o&&++oe===w&&(K=M),le===E&&++he===p&&(J=M),(de=xe.nextSibling)!==null)break;xe=le,le=xe.parentNode}xe=de}o=K===-1||J===-1?null:{start:K,end:J}}else o=null}o=o||{start:0,end:0}}else o=null;for(hd={focusedElem:t,selectionRange:o},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(o=0;o<t.length;o++)w=t[o],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&E!==null){t=void 0,o=n,w=E.memoizedProps,E=E.memoizedState,p=o.stateNode;try{var De=js(o.type,w);t=p.getSnapshotBeforeUpdate(De,E),p.__reactInternalSnapshotBeforeUpdate=t}catch(He){pt(o,o.return,He)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,o=t.nodeType,o===9)md(t);else if(o===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 ag(t,n,o){var p=o.flags;switch(o.tag){case 0:case 11:case 15:Nr(t,o),p&4&&ga(5,o);break;case 1:if(Nr(t,o),p&4)if(t=o.stateNode,n===null)try{t.componentDidMount()}catch(M){pt(o,o.return,M)}else{var w=js(o.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){pt(o,o.return,M)}}p&64&&eg(o),p&512&&xa(o,o.return);break;case 3:if(Nr(t,o),p&64&&(t=o.updateQueue,t!==null)){if(n=null,o.child!==null)switch(o.child.tag){case 27:case 5:n=o.child.stateNode;break;case 1:n=o.child.stateNode}try{qp(t,n)}catch(M){pt(o,o.return,M)}}break;case 27:n===null&&p&4&&sg(o);case 26:case 5:Nr(t,o),n===null&&p&4&&ng(o),p&512&&xa(o,o.return);break;case 12:Nr(t,o);break;case 31:Nr(t,o),p&4&&cg(t,o);break;case 13:Nr(t,o),p&4&&ug(t,o),p&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=wS.bind(null,o),$S(t,o))));break;case 22:if(p=o.memoizedState!==null||Er,!p){n=n!==null&&n.memoizedState!==null||$t,w=Er;var E=$t;Er=p,($t=n)&&!E?Tr(t,o,(o.subtreeFlags&8772)!==0):Nr(t,o),Er=w,$t=E}break;case 30:break;default:Nr(t,o)}}function og(t){var n=t.alternate;n!==null&&(t.alternate=null,og(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 jr(t,n,o){for(o=o.child;o!==null;)lg(t,n,o),o=o.sibling}function lg(t,n,o){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(Mt,o)}catch{}switch(o.tag){case 26:$t||ir(o,n),jr(t,n,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:$t||ir(o,n);var p=Et,w=vn;ns(o.type)&&(Et=o.stateNode,vn=!1),jr(t,n,o),Ea(o.stateNode),Et=p,vn=w;break;case 5:$t||ir(o,n);case 6:if(p=Et,w=vn,Et=null,jr(t,n,o),Et=p,vn=w,Et!==null)if(vn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(o.stateNode)}catch(E){pt(o,n,E)}else try{Et.removeChild(o.stateNode)}catch(E){pt(o,n,E)}break;case 18:Et!==null&&(vn?(t=Et,ex(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),ji(t)):ex(Et,o.stateNode));break;case 4:p=Et,w=vn,Et=o.stateNode.containerInfo,vn=!0,jr(t,n,o),Et=p,vn=w;break;case 0:case 11:case 14:case 15:Yr(2,o,n),$t||Yr(4,o,n),jr(t,n,o);break;case 1:$t||(ir(o,n),p=o.stateNode,typeof p.componentWillUnmount=="function"&&tg(o,n,p)),jr(t,n,o);break;case 21:jr(t,n,o);break;case 22:$t=(p=$t)||o.memoizedState!==null,jr(t,n,o),$t=p;break;default:jr(t,n,o)}}function cg(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ji(t)}catch(o){pt(n,n.return,o)}}}function ug(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(o){pt(n,n.return,o)}}function mS(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new ig),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new ig),n;default:throw Error(i(435,t.tag))}}function el(t,n){var o=mS(t);n.forEach(function(p){if(!o.has(p)){o.add(p);var w=CS.bind(null,t,p);p.then(w,w)}})}function yn(t,n){var o=n.deletions;if(o!==null)for(var p=0;p<o.length;p++){var w=o[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));lg(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;)dg(n,t),n=n.sibling}var Zn=null;function dg(t,n){var o=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||o===null||ir(o,o.return)),p&64&&Er&&(t=t.updateQueue,t!==null&&(p=t.callbacks,p!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?p:o.concat(p))));break;case 26:var w=Zn;if(yn(n,t),_n(t),p&512&&($t||o===null||ir(o,o.return)),p&4){var E=o!==null?o.memoizedState:null;if(p=t.memoizedState,o===null)if(p===null)if(t.stateNode===null){e:{p=t.type,o=t.memoizedProps,w=w.ownerDocument||w;t:switch(p){case"title":E=w.getElementsByTagName("title")[0],(!E||E[qi]||E[nn]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(p),w.head.insertBefore(E,w.querySelector("head > title"))),on(E,p,o),E[nn]=t,Xt(E),p=E;break e;case"link":var M=dx("link","href",w).get(p+(o.href||""));if(M){for(var K=0;K<M.length;K++)if(E=M[K],E.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&E.getAttribute("rel")===(o.rel==null?null:o.rel)&&E.getAttribute("title")===(o.title==null?null:o.title)&&E.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){M.splice(K,1);break t}}E=w.createElement(p),on(E,p,o),w.head.appendChild(E);break;case"meta":if(M=dx("meta","content",w).get(p+(o.content||""))){for(K=0;K<M.length;K++)if(E=M[K],E.getAttribute("content")===(o.content==null?null:""+o.content)&&E.getAttribute("name")===(o.name==null?null:o.name)&&E.getAttribute("property")===(o.property==null?null:o.property)&&E.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&E.getAttribute("charset")===(o.charSet==null?null:o.charSet)){M.splice(K,1);break t}}E=w.createElement(p),on(E,p,o),w.head.appendChild(E);break;default:throw Error(i(468,p))}E[nn]=t,Xt(E),p=E}t.stateNode=p}else hx(w,t.type,t.stateNode);else t.stateNode=ux(w,p,t.memoizedProps);else E!==p?(E===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):E.count--,p===null?hx(w,t.type,t.stateNode):ux(w,p,t.memoizedProps)):p===null&&t.stateNode!==null&&Fu(t,t.memoizedProps,o.memoizedProps)}break;case 27:yn(n,t),_n(t),p&512&&($t||o===null||ir(o,o.return)),o!==null&&p&4&&Fu(t,t.memoizedProps,o.memoizedProps);break;case 5:if(yn(n,t),_n(t),p&512&&($t||o===null||ir(o,o.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,o!==null?o.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,o=t.stateNode;try{o.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&&o!==null&&o.memoizedState.isDehydrated)try{ji(n.containerInfo)}catch(De){pt(t,t.return,De)}qu&&(qu=!1,hg(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!=(o!==null&&o.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=o!==null&&o.memoizedState!==null,oe=Er,he=$t;if(Er=oe||w,$t=he||J,yn(n,t),$t=he,Er=oe,_n(t),p&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(o===null||J||Er||$t||Ns(t)),o=null,n=t;;){if(n.tag===5||n.tag===26){if(o===null){J=o=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(o===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){pt(J,J.return,De)}}}else if(n.tag===18){if(o===null){J=n;try{var de=J.stateNode;w?tx(de,!0):tx(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;o===n&&(o=null),n=n.return}o===n&&(o=null),n.sibling.return=n.return,n=n.sibling}p&4&&(p=t.updateQueue,p!==null&&(o=p.retryQueue,o!==null&&(p.retryQueue=null,el(t,o))));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 o,p=t.return;p!==null;){if(rg(p)){o=p;break}p=p.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var w=o.stateNode,E=Uu(t);Jo(t,E,w);break;case 5:var M=o.stateNode;o.flags&32&&(Xs(M,""),o.flags&=-33);var K=Uu(t);Jo(t,K,M);break;case 3:case 4:var J=o.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 hg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;hg(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Nr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)ag(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 o=n.stateNode;typeof o.componentWillUnmount=="function"&&tg(n,n.return,o),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 Tr(t,n,o){for(o=o&&(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:Tr(w,E,o),ga(4,E);break;case 1:if(Tr(w,E,o),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++)$p(J[w],K)}catch(oe){pt(p,p.return,oe)}}o&&M&64&&eg(E),xa(E,E.return);break;case 27:sg(E);case 26:case 5:Tr(w,E,o),o&&p===null&&M&4&&ng(E),xa(E,E.return);break;case 12:Tr(w,E,o);break;case 31:Tr(w,E,o),o&&M&4&&cg(w,E);break;case 13:Tr(w,E,o),o&&M&4&&ug(w,E);break;case 22:E.memoizedState===null&&Tr(w,E,o),xa(E,E.return);break;case 30:break;default:Tr(w,E,o)}n=n.sibling}}function Wu(t,n){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&ra(o))}function Gu(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,o,p){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)fg(t,n,o,p),n=n.sibling}function fg(t,n,o,p){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Qn(t,n,o,p),w&2048&&ga(9,n);break;case 1:Qn(t,n,o,p);break;case 3:Qn(t,n,o,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,o,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,o,p);break;case 31:Qn(t,n,o,p);break;case 13:Qn(t,n,o,p);break;case 23:break;case 22:E=n.stateNode,M=n.alternate,n.memoizedState!==null?E._visibility&2?Qn(t,n,o,p):ba(t,n):E._visibility&2?Qn(t,n,o,p):(E._visibility|=2,gi(t,n,o,p,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Wu(M,n);break;case 24:Qn(t,n,o,p),w&2048&&Gu(n.alternate,n);break;default:Qn(t,n,o,p)}}function gi(t,n,o,p,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,M=n,K=o,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&&Gu(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 o=t,p=n,w=p.flags;switch(p.tag){case 22:ba(o,p),w&2048&&Wu(p.alternate,p);break;case 24:ba(o,p),w&2048&&Gu(p.alternate,p);break;default:ba(o,p)}n=n.sibling}}var va=8192;function xi(t,n,o){if(t.subtreeFlags&va)for(t=t.child;t!==null;)pg(t,n,o),t=t.sibling}function pg(t,n,o){switch(t.tag){case 26:xi(t,n,o),t.flags&va&&t.memoizedState!==null&&t1(o,Zn,t.memoizedState,t.memoizedProps);break;case 5:xi(t,n,o);break;case 3:case 4:var p=Zn;Zn=pl(t.stateNode.containerInfo),xi(t,n,o),Zn=p;break;case 22:t.memoizedState===null&&(p=t.alternate,p!==null&&p.memoizedState!==null?(p=va,va=16777216,xi(t,n,o),va=p):xi(t,n,o));break;default:xi(t,n,o)}}function mg(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 o=0;o<n.length;o++){var p=n[o];Zt=p,xg(p,t)}mg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gg(t),t=t.sibling}function gg(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 o=0;o<n.length;o++){var p=n[o];Zt=p,xg(p,t)}mg(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:o=n.stateNode,o._visibility&2&&(o._visibility&=-3,tl(n));break;default:tl(n)}t=t.sibling}}function xg(t,n){for(;Zt!==null;){var o=Zt;switch(o.tag){case 0:case 11:case 15:Yr(8,o,n);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var p=o.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:ra(o.memoizedState.cache)}if(p=o.child,p!==null)p.return=o,Zt=p;else e:for(o=t;Zt!==null;){p=Zt;var w=p.sibling,E=p.return;if(og(p),p===o){Zt=null;break e}if(w!==null){w.return=E,Zt=w;break e}Zt=E}}}var gS={getCacheForType:function(t){var n=sn(Ht),o=n.data.get(t);return o===void 0&&(o=t(),n.data.set(t,o)),o},cacheSignal:function(){return sn(Ht).controller.signal}},xS=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,et=null,rt=0,ft=0,An=null,Xr=!1,bi=!1,Vu=!1,Ar=0,Rt=0,Zr=0,Ts=0,Ku=0,Dn=0,vi=0,_a=null,Sn=null,Yu=!1,nl=0,bg=0,rl=1/0,sl=null,Qr=null,Kt=0,Jr=null,yi=null,Dr=0,Xu=0,Zu=null,vg=null,Sa=0,Qu=null;function Ln(){return(dt&2)!==0&&rt!==0?rt&-rt:H.T!==null?sd():Mf()}function yg(){if(Dn===0)if((rt&536870912)===0||at){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,o){(t===vt&&(ft===2||ft===9)||t.cancelPendingCommit!==null)&&(_i(t,0),es(t,rt,Dn,!1)),$s(t,o),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ts|=o),Rt===4&&es(t,rt,Dn,!1)),ar(t))}function _g(t,n,o){if((dt&6)!==0)throw Error(i(327));var p=!o&&(n&127)===0&&(n&t.expiredLanes)===0||Fe(t,n),w=p?yS(t,n):ed(t,n,!0),E=p;do{if(w===0){bi&&!p&&es(t,n,0,!1);break}else{if(o=t.current.alternate,E&&!bS(o)){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(Vu&&!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),it(p,0,!0)!==0)break e;Dr=n,p.timeoutHandle=Qg(Sg.bind(null,p,o,Sn,sl,Yu,n,Dn,Ts,vi,Xr,E,"Throttled",-0,0),w);break e}Sg(p,o,Sn,sl,Yu,n,Dn,Ts,vi,Xr,E,null,-0,0)}}break}while(!0);ar(t)}function Sg(t,n,o,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:gr},pg(n,E,xe);var De=(E&62914560)===E?nl-Me():(E&4194048)===E?bg-Me():0;if(De=n1(xe,De),De!==null){Dr=E,t.cancelPendingCommit=De(Ag.bind(null,t,n,E,o,p,w,M,K,J,he,xe,null,le,de)),es(t,E,M,!oe);return}}Ag(t,n,E,o,p,w,M,K,J)}function bS(t){for(var n=t;;){var o=n.tag;if((o===0||o===11||o===15)&&n.flags&16384&&(o=n.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var p=0;p<o.length;p++){var w=o[p],E=w.getSnapshot;w=w.value;try{if(!En(E(),w))return!1}catch{return!1}}if(o=n.child,n.subtreeFlags&16384&&o!==null)o.return=n,n=o;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,o,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}o!==0&&Lf(t,o,n)}function il(){return(dt&6)===0?(wa(0),!1):!0}function Ju(){if(et!==null){if(ft===0)var t=et.return;else t=et,yr=ys=null,mu(t),di=null,ia=0,t=et;for(;t!==null;)Jm(t.alternate,t),t=t.return;et=null}}function _i(t,n){var o=t.timeoutHandle;o!==-1&&(t.timeoutHandle=-1,zS(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),Dr=0,Ju(),vt=t,et=o=br(t.current,null),rt=n,ft=0,An=null,Xr=!1,bi=Fe(t,n),Vu=!1,vi=Dn=Ku=Ts=Zr=Rt=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 Ar=n,Eo(),o}function wg(t,n){Ke=null,H.H=fa,n===ui||n===Oo?(n=Pp(),ft=3):n===ru?(n=Pp(),ft=4):ft=n===Du?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,et===null&&(Rt=1,Ko(t,Un(n,t.current)))}function Cg(){var t=Nn.current;return t===null?!0:(rt&4194048)===rt?Gn===null:(rt&62914560)===rt||(rt&536870912)!==0?t===Gn:!1}function kg(){var t=H.H;return H.H=fa,t===null?fa:t}function Eg(){var t=H.A;return H.A=gS,t}function al(){Rt=4,Xr||(rt&4194048)!==rt&&Nn.current!==null||(bi=!0),(Zr&134217727)===0&&(Ts&134217727)===0||vt===null||es(vt,rt,Dn,!1)}function ed(t,n,o){var p=dt;dt|=2;var w=kg(),E=Eg();(vt!==t||rt!==n)&&(sl=null,_i(t,n)),n=!1;var M=Rt;e:do try{if(ft!==0&&et!==null){var K=et,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),o&&bi){M=0;break e}break;default:oe=ft,ft=0,An=null,Si(t,K,J,oe)}}vS(),M=Rt;break}catch(he){wg(t,he)}while(!0);return n&&t.shellSuspendCounter++,yr=ys=null,dt=p,H.H=w,H.A=E,et===null&&(vt=null,rt=0,Eo()),M}function vS(){for(;et!==null;)jg(et)}function yS(t,n){var o=dt;dt|=2;var p=kg(),w=Eg();vt!==t||rt!==n?(sl=null,rl=Me()+500,_i(t,n)):bi=Fe(t,n);e:do try{if(ft!==0&&et!==null){n=et;var E=An;t:switch(ft){case 1:ft=0,An=null,Si(t,n,E,1);break;case 2:case 9:if(Bp(E)){ft=0,An=null,Ng(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:Bp(E)?(ft=0,An=null,Ng(n)):(ft=0,An=null,Si(t,n,E,7));break;case 5:var M=null;switch(et.tag){case 26:M=et.memoizedState;case 5:case 27:var K=et;if(M?fx(M):K.stateNode.complete){ft=0,An=null;var J=K.sibling;if(J!==null)et=J;else{var oe=K.return;oe!==null?(et=oe,ol(oe)):et=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(),Rt=6;break e;default:throw Error(i(462))}}_S();break}catch(he){wg(t,he)}while(!0);return yr=ys=null,H.H=p,H.A=w,dt=o,et!==null?0:(vt=null,rt=0,Eo(),Rt)}function _S(){for(;et!==null&&!me();)jg(et)}function jg(t){var n=Zm(t.alternate,t,Ar);t.memoizedProps=t.pendingProps,n===null?ol(t):et=n}function Ng(t){var n=t,o=n.alternate;switch(n.tag){case 15:case 0:n=Wm(o,n,n.pendingProps,n.type,void 0,rt);break;case 11:n=Wm(o,n,n.pendingProps,n.type.render,n.ref,rt);break;case 5:mu(n);default:Jm(o,n),n=et=Ep(n,Ar),n=Zm(o,n,Ar)}t.memoizedProps=t.pendingProps,n===null?ol(t):et=n}function Si(t,n,o,p){yr=ys=null,mu(n),di=null,ia=0;var w=n.return;try{if(cS(t,w,n,o,rt)){Rt=1,Ko(t,Un(o,t.current)),et=null;return}}catch(E){if(w!==null)throw et=w,E;Rt=1,Ko(t,Un(o,t.current)),et=null;return}n.flags&32768?(at||p===1?t=!0:bi||(rt&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))),Tg(n,t)):ol(n)}function ol(t){var n=t;do{if((n.flags&32768)!==0){Tg(n,Xr);return}t=n.return;var o=hS(n.alternate,n,Ar);if(o!==null){et=o;return}if(n=n.sibling,n!==null){et=n;return}et=n=t}while(n!==null);Rt===0&&(Rt=5)}function Tg(t,n){do{var o=fS(t.alternate,t);if(o!==null){o.flags&=32767,et=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!n&&(t=t.sibling,t!==null)){et=t;return}et=t=o}while(t!==null);Rt=6,et=null}function Ag(t,n,o,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,o,E,M,K,J),t===vt&&(et=vt=null,rt=0),yi=n,Jr=t,Dr=o,Xu=E,Zu=w,vg=p,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,kS(Ae,function(){return Mg(),null})):(t.callbackNode=null,t.callbackPriority=0),p=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||p){p=H.T,H.T=null,w=Z.p,Z.p=2,M=dt,dt|=4;try{pS(t,n,o)}finally{dt=M,Z.p=w,H.T=p}}Kt=1,Dg(),Lg(),Rg()}}function Dg(){if(Kt===1){Kt=0;var t=Jr,n=yi,o=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||o){o=H.T,H.T=null;var p=Z.p;Z.p=2;var w=dt;dt|=4;try{dg(n,t);var E=hd,M=xp(t.containerInfo),K=E.focusedElem,J=E.selectionRange;if(M!==K&&K&&K.ownerDocument&&gp(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=mp(K,He),te=mp(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,H.T=o}}t.current=n,Kt=2}}function Lg(){if(Kt===2){Kt=0;var t=Jr,n=yi,o=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||o){o=H.T,H.T=null;var p=Z.p;Z.p=2;var w=dt;dt|=4;try{ag(t,n.alternate,n)}finally{dt=w,Z.p=p,H.T=o}}Kt=3}}function Rg(){if(Kt===4||Kt===3){Kt=0,je();var t=Jr,n=yi,o=Dr,p=vg;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Kt=5:(Kt=0,yi=Jr=null,Og(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Qr=null),bc(o),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=H.T,w=Z.p,Z.p=2,H.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{H.T=n,Z.p=w}}(Dr&3)!==0&&ll(),ar(t),w=t.pendingLanes,(o&261930)!==0&&(w&42)!==0?t===Qu?Sa++:(Sa=0,Qu=t):Sa=0,wa(0)}}function Og(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,ra(n)))}function ll(){return Dg(),Lg(),Rg(),Mg()}function Mg(){if(Kt!==5)return!1;var t=Jr,n=Xu;Xu=0;var o=bc(Dr),p=H.T,w=Z.p;try{Z.p=32>o?32:o,H.T=null,o=Zu,Zu=null;var E=Jr,M=Dr;if(Kt=0,yi=Jr=null,Dr=0,(dt&6)!==0)throw Error(i(331));var K=dt;if(dt|=4,gg(E.current),fg(E,E.current,M,o),dt=K,wa(0,!1),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(Mt,E)}catch{}return!0}finally{Z.p=w,H.T=p,Og(t,n)}}function Ig(t,n,o){n=Un(o,n),n=Au(t.stateNode,n,2),t=Gr(t,n,2),t!==null&&($s(t,2),ar(t))}function pt(t,n,o){if(t.tag===3)Ig(t,t,o);else for(;n!==null;){if(n.tag===3){Ig(n,t,o);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(o,t),o=Bm(2),p=Gr(n,o,2),p!==null&&(zm(o,p,n,t),$s(p,2),ar(p));break}}n=n.return}}function td(t,n,o){var p=t.pingCache;if(p===null){p=t.pingCache=new xS;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(o)||(Vu=!0,w.add(o),t=SS.bind(null,t,n,o),n.then(t,t))}function SS(t,n,o){var p=t.pingCache;p!==null&&p.delete(n),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,vt===t&&(rt&o)===o&&(Rt===4||Rt===3&&(rt&62914560)===rt&&300>Me()-nl?(dt&2)===0&&_i(t,0):Ku|=o,vi===rt&&(vi=0)),ar(t)}function Bg(t,n){n===0&&(n=Pt()),t=xs(t,n),t!==null&&($s(t,n),ar(t))}function wS(t){var n=t.memoizedState,o=0;n!==null&&(o=n.retryLane),Bg(t,o)}function CS(t,n){var o=0;switch(t.tag){case 31:case 13:var p=t.stateNode,w=t.memoizedState;w!==null&&(o=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),Bg(t,o)}function kS(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,jS())}function wa(t,n){if(!rd&&ul){rd=!0;do for(var o=!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&&(o=!0,Fg(p,E))}else E=rt,E=it(p,p===vt?E:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(E&3)===0||Fe(p,E)||(o=!0,Fg(p,E));p=p.next}while(o);rd=!1}}function ES(){zg()}function zg(){ul=nd=!1;var t=0;ts!==0&&BS()&&(t=ts);for(var n=Me(),o=null,p=cl;p!==null;){var w=p.next,E=Pg(p,n);E===0?(p.next=null,o===null?cl=w:o.next=w,w===null&&(wi=o)):(o=p,(t!==0||(E&3)!==0)&&(ul=!0)),p=w}Kt!==0&&Kt!==5||wa(t),ts!==0&&(ts=0)}function Pg(t,n){for(var o=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&o)===0||(K&p)!==0)&&(w[M]=tn(K,n)):J<=n&&(t.expiredLanes|=K),E&=~K}if(n=vt,o=rt,o=it(t,t===n?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),p=t.callbackNode,o===0||t===n&&(ft===2||ft===9)||t.cancelPendingCommit!==null)return p!==null&&p!==null&&Tt(p),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||Fe(t,o)){if(n=o&-o,n===t.callbackPriority)return n;switch(p!==null&&Tt(p),bc(o)){case 2:case 8:o=_e;break;case 32:o=Ae;break;case 268435456:o=Ge;break;default:o=Ae}return p=Hg.bind(null,t),o=$e(o,p),t.callbackPriority=n,t.callbackNode=o,n}return p!==null&&p!==null&&Tt(p),t.callbackPriority=2,t.callbackNode=null,2}function Hg(t,n){if(Kt!==0&&Kt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if(ll()&&t.callbackNode!==o)return null;var p=rt;return p=it(t,t===vt?p:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),p===0?null:(_g(t,p,n),Pg(t,Me()),t.callbackNode!=null&&t.callbackNode===o?Hg.bind(null,t):null)}function Fg(t,n){if(ll())return null;_g(t,n,!0)}function jS(){PS(function(){(dt&6)!==0?$e(ce,ES):zg()})}function sd(){if(ts===0){var t=li;t===0&&(t=fe,fe<<=1,(fe&261888)===0&&(fe=256)),ts=t}return ts}function Ug(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:bo(""+t)}function $g(t,n){var o=n.ownerDocument.createElement("input");return o.name=n.name,o.value=n.value,t.id&&o.setAttribute("form",t.id),n.parentNode.insertBefore(o,n),t=new FormData(t),o.parentNode.removeChild(o),t}function NS(t,n,o,p,w){if(n==="submit"&&o&&o.stateNode===w){var E=Ug((w[xn]||null).action),M=p.submitter;M&&(n=(n=M[xn]||null)?Ug(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?$g(w,M):new FormData(w);Cu(o,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(K.preventDefault(),J=M?$g(w,M):new FormData(w),Cu(o,{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],TS=ad.toLowerCase(),AS=ad[0].toUpperCase()+ad.slice(1);Xn(TS,"on"+AS)}Xn(yp,"onAnimationEnd"),Xn(_p,"onAnimationIteration"),Xn(Sp,"onAnimationStart"),Xn("dblclick","onDoubleClick"),Xn("focusin","onFocus"),Xn("focusout","onBlur"),Xn(G_,"onTransitionRun"),Xn(V_,"onTransitionStart"),Xn(K_,"onTransitionCancel"),Xn(wp,"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(" "),DS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ca));function qg(t,n){n=(n&4)!==0;for(var o=0;o<t.length;o++){var p=t[o],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 tt(t,n){var o=n[vc];o===void 0&&(o=n[vc]=new Set);var p=t+"__bubble";o.has(p)||(Wg(n,t,2,!1),o.add(p))}function od(t,n,o){var p=0;n&&(p|=4),Wg(o,t,p,n)}var dl="_reactListening"+Math.random().toString(36).slice(2);function ld(t){if(!t[dl]){t[dl]=!0,zf.forEach(function(o){o!=="selectionchange"&&(DS.has(o)||od(o,!1,t),od(o,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[dl]||(n[dl]=!0,od("selectionchange",!1,n))}}function Wg(t,n,o,p){switch(yx(n)){case 2:var w=i1;break;case 8:w=a1;break;default:w=wd}o=w.bind(null,n,o,t),w=void 0,!Nc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),p?w!==void 0?t.addEventListener(n,o,{capture:!0,passive:w}):t.addEventListener(n,o,!0):w!==void 0?t.addEventListener(n,o,{passive:w}):t.addEventListener(n,o,!1)}function cd(t,n,o,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}Xf(function(){var oe=E,he=Ec(o),xe=[];e:{var le=Cp.get(t);if(le!==void 0){var de=So,De=t;switch(t){case"keypress":if(yo(o)===0)break e;case"keydown":case"keyup":de=C_;break;case"focusin":De="focus",de=Lc;break;case"focusout":De="blur",de=Lc;break;case"beforeblur":case"afterblur":de=Lc;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Jf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=h_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=j_;break;case yp:case _p:case Sp:de=m_;break;case wp:de=T_;break;case"scroll":case"scrollend":de=u_;break;case"wheel":de=D_;break;case"copy":case"cut":case"paste":de=x_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=tp;break;case"toggle":case"beforetoggle":de=R_}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=Gi(te,se),ge!=null&&He.push(ka(te,ge,ae))),bt)break;te=te.return}0<He.length&&(le=new de(le,De,null,o,he),xe.push({event:le,listeners:He}))}}if((n&7)===0){e:{if(le=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",le&&o!==kc&&(De=o.relatedTarget||o.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=o.relatedTarget||o.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=Jf,ge="onMouseLeave",se="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(He=tp,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,o,he),le.target=bt,le.relatedTarget=ae,ge=null,Ws(he)===oe&&(He=new He(se,te+"enter",De,o,he),He.target=ae,He.relatedTarget=bt,ge=He),bt=ge,de&&De)t:{for(He=LS,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&&Gg(xe,le,de,He,!1),De!==null&&bt!==null&&Gg(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=cp;else if(op(le))if(up)ct=$_;else{ct=F_;var Re=H_}else de=le.nodeName,!de||de.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?oe&&Cc(oe.elementType)&&(ct=cp):ct=U_;if(ct&&(ct=ct(t,oe))){lp(xe,ct,o,he);break e}Re&&Re(t,le,oe),t==="focusout"&&oe&&le.type==="number"&&oe.memoizedProps.value!=null&&wc(le,"number",le.value)}switch(Re=oe?Wi(oe):window,t){case"focusin":(op(Re)||Re.contentEditable==="true")&&(ei=Re,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,bp(xe,o,he);break;case"selectionchange":if(W_)break;case"keydown":case"keyup":bp(xe,o,he)}var Ye;if(Oc)e:{switch(t){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else Js?ip(t,o)&&(st="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(st="onCompositionStart");st&&(np&&o.locale!=="ko"&&(Js||st!=="onCompositionStart"?st==="onCompositionEnd"&&Js&&(Ye=Zf()):(Pr=he,Tc="value"in Pr?Pr.value:Pr.textContent,Js=!0)),Re=hl(oe,st),0<Re.length&&(st=new ep(st,t,null,o,he),xe.push({event:st,listeners:Re}),Ye?st.data=Ye:(Ye=ap(o),Ye!==null&&(st.data=Ye)))),(Ye=M_?I_(t,o):B_(t,o))&&(st=hl(oe,"onBeforeInput"),0<st.length&&(Re=new ep("onBeforeInput","beforeinput",null,o,he),xe.push({event:Re,listeners:st}),Re.data=Ye)),NS(xe,t,oe,o,he)}qg(xe,n)})}function ka(t,n,o){return{instance:t,listener:n,currentTarget:o}}function hl(t,n){for(var o=n+"Capture",p=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Gi(t,o),w!=null&&p.unshift(ka(t,w,E)),w=Gi(t,n),w!=null&&p.push(ka(t,w,E))),t.tag===3)return p;t=t.return}return[]}function LS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Gg(t,n,o,p,w){for(var E=n._reactName,M=[];o!==null&&o!==p;){var K=o,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=Gi(o,E),oe!=null&&M.unshift(ka(o,oe,J))):w||(oe=Gi(o,E),oe!=null&&M.push(ka(o,oe,J)))),o=o.return}M.length!==0&&t.push({event:n,listeners:M})}var RS=/\r\n?/g,OS=/\u0000|\uFFFD/g;function Vg(t){return(typeof t=="string"?t:""+t).replace(RS,`
|
|
49
|
-
`).replace(OS,"")}function Kg(t,n){return n=Vg(n),Vg(t)===n}function xt(t,n,o,p,w,E){switch(o){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,o,p);break;case"style":Kf(t,p,E);break;case"data":if(n!=="object"){go(t,"data",p);break}case"src":case"href":if(p===""&&(n!=="a"||o!=="href")){t.removeAttribute(o);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){t.removeAttribute(o);break}p=bo(""+p),t.setAttribute(o,p);break;case"action":case"formAction":if(typeof p=="function"){t.setAttribute(o,"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"&&(o==="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(o);break}p=bo(""+p),t.setAttribute(o,p);break;case"onClick":p!=null&&(t.onclick=gr);break;case"onScroll":p!=null&&tt("scroll",t);break;case"onScrollEnd":p!=null&&tt("scrollend",t);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(i(61));if(o=p.__html,o!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=o}}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}o=bo(""+p),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);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(o,""+p):t.removeAttribute(o);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(o,""):t.removeAttribute(o);break;case"capture":case"download":p===!0?t.setAttribute(o,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?t.setAttribute(o,p):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?t.setAttribute(o,p):t.removeAttribute(o);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?t.removeAttribute(o):t.setAttribute(o,p);break;case"popover":tt("beforetoggle",t),tt("toggle",t),mo(t,"popover",p);break;case"xlinkActuate":mr(t,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":mr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":mr(t,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":mr(t,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":mr(t,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":mr(t,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":mr(t,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":mr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":mr(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<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=l_.get(o)||o,mo(t,o,p))}}function ud(t,n,o,p,w,E){switch(o){case"style":Kf(t,p,E);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(i(61));if(o=p.__html,o!=null){if(w.children!=null)throw Error(i(60));t.innerHTML=o}}break;case"children":typeof p=="string"?Xs(t,p):(typeof p=="number"||typeof p=="bigint")&&Xs(t,""+p);break;case"onScroll":p!=null&&tt("scroll",t);break;case"onScrollEnd":p!=null&&tt("scrollend",t);break;case"onClick":p!=null&&(t.onclick=gr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pf.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(w=o.endsWith("Capture"),n=o.slice(2,w?o.length-7:void 0),E=t[xn]||null,E=E!=null?E[o]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof p=="function")){typeof E!="function"&&E!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(n,p,w);break e}o in t?t[o]=p:p===!0?t.setAttribute(o,""):mo(t,o,p)}}}function on(t,n,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",t),tt("load",t);var p=!1,w=!1,E;for(E in o)if(o.hasOwnProperty(E)){var M=o[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,o,null)}}w&&xt(t,n,"srcSet",o.srcSet,o,null),p&&xt(t,n,"src",o.src,o,null);return;case"input":tt("invalid",t);var K=E=M=w=null,J=null,oe=null;for(p in o)if(o.hasOwnProperty(p)){var he=o[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,o,null)}}qf(t,E,K,J,oe,M,w,!1);return;case"select":tt("invalid",t),p=M=E=null;for(w in o)if(o.hasOwnProperty(w)&&(K=o[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,o,null)}n=E,o=M,t.multiple=!!p,n!=null?Ys(t,!!p,n,!1):o!=null&&Ys(t,!!p,o,!0);return;case"textarea":tt("invalid",t),E=w=p=null;for(M in o)if(o.hasOwnProperty(M)&&(K=o[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,o,null)}Gf(t,p,w,E);return;case"option":for(J in o)if(o.hasOwnProperty(J)&&(p=o[J],p!=null))switch(J){case"selected":t.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:xt(t,n,J,p,o,null)}return;case"dialog":tt("beforetoggle",t),tt("toggle",t),tt("cancel",t),tt("close",t);break;case"iframe":case"object":tt("load",t);break;case"video":case"audio":for(p=0;p<Ca.length;p++)tt(Ca[p],t);break;case"image":tt("error",t),tt("load",t);break;case"details":tt("toggle",t);break;case"embed":case"source":case"link":tt("error",t),tt("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 o)if(o.hasOwnProperty(oe)&&(p=o[oe],p!=null))switch(oe){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:xt(t,n,oe,p,o,null)}return;default:if(Cc(n)){for(he in o)o.hasOwnProperty(he)&&(p=o[he],p!==void 0&&ud(t,n,he,p,o,void 0));return}}for(K in o)o.hasOwnProperty(K)&&(p=o[K],p!=null&&xt(t,n,K,p,o,null))}function MS(t,n,o,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 o){var xe=o[de];if(o.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=o[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 o)if(J=o[E],o.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=o[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,o=M,p=de,le!=null?Ys(t,!!o,le,!1):!!p!=!!o&&(n!=null?Ys(t,!!o,n,!0):Ys(t,!!o,o?[]:"",!1));return;case"textarea":de=le=null;for(K in o)if(w=o[K],o.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=o[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)}Wf(t,le,de);return;case"option":for(var De in o)if(le=o[De],o.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=o[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 o)le=o[He],o.hasOwnProperty(He)&&le!=null&&!p.hasOwnProperty(He)&&xt(t,n,He,null,p,le);for(oe in p)if(le=p[oe],de=o[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 o)le=o[bt],o.hasOwnProperty(bt)&&le!==void 0&&!p.hasOwnProperty(bt)&&ud(t,n,bt,void 0,p,le);for(he in p)le=p[he],de=o[he],!p.hasOwnProperty(he)||le===de||le===void 0&&de===void 0||ud(t,n,he,le,p,de);return}}for(var se in o)le=o[se],o.hasOwnProperty(se)&&le!=null&&!p.hasOwnProperty(se)&&xt(t,n,se,null,p,le);for(xe in p)le=p[xe],de=o[xe],!p.hasOwnProperty(xe)||le===de||le==null&&de==null||xt(t,n,xe,le,p,de)}function Yg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function IS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,o=performance.getEntriesByType("resource"),p=0;p<o.length;p++){var w=o[p],E=w.transferSize,M=w.initiatorType,K=w.duration;if(E&&K&&Yg(M)){for(M=0,K=w.responseEnd,p+=1;p<o.length;p++){var J=o[p],oe=J.startTime;if(oe>K)break;var he=J.transferSize,xe=J.initiatorType;he&&Yg(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 Xg(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 Zg(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 BS(){var t=window.event;return t&&t.type==="popstate"?t===pd?!1:(pd=t,!0):(pd=null,!1)}var Qg=typeof setTimeout=="function"?setTimeout:void 0,zS=typeof clearTimeout=="function"?clearTimeout:void 0,Jg=typeof Promise=="function"?Promise:void 0,PS=typeof queueMicrotask=="function"?queueMicrotask:typeof Jg<"u"?function(t){return Jg.resolve(null).then(t).catch(HS)}:Qg;function HS(t){setTimeout(function(){throw t})}function ns(t){return t==="head"}function ex(t,n){var o=n,p=0;do{var w=o.nextSibling;if(t.removeChild(o),w&&w.nodeType===8)if(o=w.data,o==="/$"||o==="/&"){if(p===0){t.removeChild(w),ji(n);return}p--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")p++;else if(o==="html")Ea(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,Ea(o);for(var E=o.firstChild;E;){var M=E.nextSibling,K=E.nodeName;E[qi]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&E.rel.toLowerCase()==="stylesheet"||o.removeChild(E),E=M}}else o==="body"&&Ea(t.ownerDocument.body);o=w}while(o);ji(n)}function tx(t,n){var o=t;t=0;do{var p=o.nextSibling;if(o.nodeType===1?n?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(n?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),p&&p.nodeType===8)if(o=p.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=p}while(o)}function md(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var o=n;switch(n=n.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":md(o),yc(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function FS(t,n,o,p){for(;t.nodeType===1;){var w=o;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=Vn(t.nextSibling),t===null)break}return null}function US(t,n,o){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=Vn(t.nextSibling),t===null))return null;return t}function nx(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Vn(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 $S(t,n){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||o.readyState!=="loading")n();else{var p=function(){n(),o.removeEventListener("DOMContentLoaded",p)};o.addEventListener("DOMContentLoaded",p),t._reactRetry=p}}function Vn(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 rx(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(n===0)return Vn(t.nextSibling);n--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||n++}t=t.nextSibling}return null}function sx(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(n===0)return t;n--}else o!=="/$"&&o!=="/&"||n++}t=t.previousSibling}return null}function ix(t,n,o){switch(n=fl(o),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,ax=new Set;function pl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Lr=Z.d;Z.d={f:qS,r:WS,D:GS,C:VS,L:KS,m:YS,X:ZS,S:XS,M:QS};function qS(){var t=Lr.f(),n=il();return t||n}function WS(t){var n=Gs(t);n!==null&&n.tag===5&&n.type==="form"?wm(n):Lr.r(t)}var Ci=typeof document>"u"?null:document;function ox(t,n,o){var p=Ci;if(p&&typeof n=="string"&&n){var w=Hn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof o=="string"&&(w+='[crossorigin="'+o+'"]'),ax.has(w)||(ax.add(w),t={rel:t,crossOrigin:o,href:n},p.querySelector(w)===null&&(n=p.createElement("link"),on(n,"link",t),Xt(n),p.head.appendChild(n)))}}function GS(t){Lr.D(t),ox("dns-prefetch",t,null)}function VS(t,n){Lr.C(t,n),ox("preconnect",t,n)}function KS(t,n,o){Lr.L(t,n,o);var p=Ci;if(p&&t&&n){var w='link[rel="preload"][as="'+Hn(n)+'"]';n==="image"&&o&&o.imageSrcSet?(w+='[imagesrcset="'+Hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(w+='[imagesizes="'+Hn(o.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"&&o&&o.imageSrcSet?void 0:t,as:n},o),Kn.set(E,t),p.querySelector(w)!==null||n==="style"&&p.querySelector(ja(E))||n==="script"&&p.querySelector(Na(E))||(n=p.createElement("link"),on(n,"link",t),Xt(n),p.head.appendChild(n)))}}function YS(t,n){Lr.m(t,n);var o=Ci;if(o&&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),o.querySelector(w)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Na(E)))return}p=o.createElement("link"),on(p,"link",t),Xt(p),o.head.appendChild(p)}}}function XS(t,n,o){Lr.S(t,n,o);var p=Ci;if(p&&t){var w=Vs(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},o),(o=Kn.get(E))&&vd(t,o);var J=M=p.createElement("link");Xt(J),on(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 ZS(t,n){Lr.X(t,n);var o=Ci;if(o&&t){var p=Vs(o).hoistableScripts,w=Ei(t),E=p.get(w);E||(E=o.querySelector(Na(w)),E||(t=m({src:t,async:!0},n),(n=Kn.get(w))&&yd(t,n),E=o.createElement("script"),Xt(E),on(E,"link",t),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},p.set(w,E))}}function QS(t,n){Lr.M(t,n);var o=Ci;if(o&&t){var p=Vs(o).hoistableScripts,w=Ei(t),E=p.get(w);E||(E=o.querySelector(Na(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=Kn.get(w))&&yd(t,n),E=o.createElement("script"),Xt(E),on(E,"link",t),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},p.set(w,E))}}function lx(t,n,o,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 o.precedence=="string"&&typeof o.href=="string"?(n=ki(o.href),o=Vs(w).hoistableStyles,p=o.get(n),p||(p={type:"style",instance:null,count:0,state:null},o.set(n,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=ki(o.href);var E=Vs(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)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Kn.set(t,o),E||JS(w,t,o,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=o.async,o=o.src,typeof o=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ei(o),o=Vs(w).hoistableScripts,p=o.get(n),p||(p={type:"script",instance:null,count:0,state:null},o.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 cx(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function JS(t,n,o,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}),on(n,"link",o),Xt(n),t.head.appendChild(n))}function Ei(t){return'[src="'+Hn(t)+'"]'}function Na(t){return"script[async]"+t}function ux(t,n,o){if(n.count++,n.instance===null)switch(n.type){case"style":var p=t.querySelector('style[data-href~="'+Hn(o.href)+'"]');if(p)return n.instance=p,Xt(p),p;var w=m({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return p=(t.ownerDocument||t).createElement("style"),Xt(p),on(p,"style",w),ml(p,o.precedence,t),n.instance=p;case"stylesheet":w=ki(o.href);var E=t.querySelector(ja(w));if(E)return n.state.loading|=4,n.instance=E,Xt(E),E;p=cx(o),(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}),on(E,"link",p),n.state.loading|=4,ml(E,o.precedence,t),n.instance=E;case"script":return E=Ei(o.src),(w=t.querySelector(Na(E)))?(n.instance=w,Xt(w),w):(p=o,(w=Kn.get(E))&&(p=m({},o),yd(p,w)),t=t.ownerDocument||t,w=t.createElement("script"),Xt(w),on(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,o.precedence,t));return n.instance}function ml(t,n,o){for(var p=o.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=o.nodeType===9?o.head:o,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 dx(t,n,o){if(gl===null){var p=new Map,w=gl=new Map;w.set(o,p)}else w=gl,p=w.get(o),p||(p=new Map,w.set(o,p));if(p.has(t))return p;for(p.set(t,null),o=o.getElementsByTagName(t),w=0;w<o.length;w++){var E=o[w];if(!(E[qi]||E[nn]||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 hx(t,n,o){t=t.ownerDocument||t,t.head.insertBefore(o,n==="title"?t.querySelector("head > title"):null)}function e1(t,n,o){if(o===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 fx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function t1(t,n,o,p){if(o.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(o.state.loading&4)===0){if(o.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)),o.state.loading|=4,o.instance=E,Xt(E);return}E=n.ownerDocument||n,p=cx(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}),on(E,"link",p),o.instance=E}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,n),(n=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=xl.bind(t),n.addEventListener("load",o),n.addEventListener("error",o))}}var _d=0;function n1(t,n){return t.stylesheets&&t.count===0&&vl(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){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*IS());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=o,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(r1,t),bl=null,xl.call(t))}function r1(t,n){if(!(n.state.loading&4)){var o=bl.get(t);if(o)var p=o.get(null);else{o=new Map,bl.set(t,o);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")&&(o.set(M.dataset.precedence,M),p=M)}p&&o.set(null,p)}w=n.instance,M=w.getAttribute("data-precedence"),E=o.get(M)||p,E===p&&o.set(null,w),o.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 s1(t,n,o,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=Vt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.hiddenUpdates=Vt(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 px(t,n,o,p,w,E,M,K,J,oe,he,xe){return t=new s1(t,n,o,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:o,cache:n},su(E),t}function mx(t){return t?(t=ri,t):ri}function gx(t,n,o,p,w,E){w=mx(w),p.context===null?p.context=w:p.pendingContext=w,p=Wr(n),p.payload={element:o},E=E===void 0?null:E,E!==null&&(p.callback=E),o=Gr(t,p,n),o!==null&&(wn(o,t,n),oa(o,t,n))}function xx(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<n?o:n}}function Sd(t,n){xx(t,n),(t=t.alternate)&&xx(t,n)}function bx(t){if(t.tag===13||t.tag===31){var n=xs(t,67108864);n!==null&&wn(n,t,67108864),Sd(t,67108864)}}function vx(t){if(t.tag===13||t.tag===31){var n=Ln();n=xc(n);var o=xs(t,n);o!==null&&wn(o,t,n),Sd(t,n)}}var yl=!0;function i1(t,n,o,p){var w=H.T;H.T=null;var E=Z.p;try{Z.p=2,wd(t,n,o,p)}finally{Z.p=E,H.T=w}}function a1(t,n,o,p){var w=H.T;H.T=null;var E=Z.p;try{Z.p=8,wd(t,n,o,p)}finally{Z.p=E,H.T=w}}function wd(t,n,o,p){if(yl){var w=Cd(p);if(w===null)cd(t,n,p,_l,o),_x(t,p);else if(l1(w,t,n,o,p))p.stopPropagation();else if(_x(t,p),n&4&&-1<o1.indexOf(t)){for(;w!==null;){var E=Gs(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,o),E===w)break;w=E}w!==null&&p.stopPropagation()}else cd(t,n,p,null,o)}}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 o=n.tag;if(o===13){if(t=h(n),t!==null)return t;t=null}else if(o===31){if(t=c(n),t!==null)return t;t=null}else if(o===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 yx(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 Ge:return 268435456;default:return 32}default:return 32}}var Ed=!1,rs=null,ss=null,is=null,Aa=new Map,Da=new Map,as=[],o1="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 _x(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 La(t,n,o,p,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:o,eventSystemFlags:p,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Gs(n),n!==null&&bx(n)),t):(t.eventSystemFlags|=p,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function l1(t,n,o,p,w){switch(n){case"focusin":return rs=La(rs,t,n,o,p,w),!0;case"dragenter":return ss=La(ss,t,n,o,p,w),!0;case"mouseover":return is=La(is,t,n,o,p,w),!0;case"pointerover":var E=w.pointerId;return Aa.set(E,La(Aa.get(E)||null,t,n,o,p,w)),!0;case"gotpointercapture":return E=w.pointerId,Da.set(E,La(Da.get(E)||null,t,n,o,p,w)),!0}return!1}function Sx(t){var n=Ws(t.target);if(n!==null){var o=u(n);if(o!==null){if(n=o.tag,n===13){if(n=h(o),n!==null){t.blockedOn=n,If(t.priority,function(){vx(o)});return}}else if(n===31){if(n=c(o),n!==null){t.blockedOn=n,If(t.priority,function(){vx(o)});return}}else if(n===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.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 o=Cd(t.nativeEvent);if(o===null){o=t.nativeEvent;var p=new o.constructor(o.type,o);kc=p,o.target.dispatchEvent(p),kc=null}else return n=Gs(o),n!==null&&bx(n),t.blockedOn=o,!1;n.shift()}return!0}function wx(t,n,o){Sl(t)&&o.delete(n)}function c1(){Ed=!1,rs!==null&&Sl(rs)&&(rs=null),ss!==null&&Sl(ss)&&(ss=null),is!==null&&Sl(is)&&(is=null),Aa.forEach(wx),Da.forEach(wx)}function wl(t,n){t.blockedOn===n&&(t.blockedOn=null,Ed||(Ed=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,c1)))}var Cl=null;function Cx(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 o=t[n],p=t[n+1],w=t[n+2];if(typeof p!="function"){if(kd(p||o)===null)continue;break}var E=Gs(o);E!==null&&(t.splice(n,3),n-=3,Cu(E,{pending:!0,data:w,method:o.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 o=0;o<as.length;o++){var p=as[o];p.blockedOn===t&&(p.blockedOn=null)}for(;0<as.length&&(o=as[0],o.blockedOn===null);)Sx(o),o.blockedOn===null&&as.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(p=0;p<o.length;p+=3){var w=o[p],E=o[p+1],M=w[xn]||null;if(typeof E=="function")M||Cx(o);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"?o[p+1]=K:(o.splice(p,3),p-=3),Cx(o)}}}function kx(){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(o,20)}function o(){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(o,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 o=n.current,p=Ln();gx(o,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;gx(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=Mf();t={blockedOn:null,target:t,priority:n};for(var o=0;o<as.length&&n!==0&&n<as[o].priority;o++);as.splice(o,0,t),o===0&&Sx(t)}};var Ex=r.version;if(Ex!=="19.2.4")throw Error(i(527,Ex,"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 u1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,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(u1),Dt=El}catch{}}return Oa.createRoot=function(t,n){if(!l(t))throw Error(i(299));var o=!1,p="",w=Rm,E=Om,M=Mm;return n!=null&&(n.unstable_strictMode===!0&&(o=!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=px(t,1,!1,null,null,o,p,null,w,E,M,kx),t[qs]=n.current,ld(t),new jd(n)},Oa.hydrateRoot=function(t,n,o){if(!l(t))throw Error(i(299));var p=!1,w="",E=Rm,M=Om,K=Mm,J=null;return o!=null&&(o.unstable_strictMode===!0&&(p=!0),o.identifierPrefix!==void 0&&(w=o.identifierPrefix),o.onUncaughtError!==void 0&&(E=o.onUncaughtError),o.onCaughtError!==void 0&&(M=o.onCaughtError),o.onRecoverableError!==void 0&&(K=o.onRecoverableError),o.formState!==void 0&&(J=o.formState)),n=px(t,1,!0,n,o??null,p,w,J,E,M,K,kx),n.context=mx(null),o=n.current,p=Ln(),p=xc(p),w=Wr(p),w.callback=null,Gr(o,w,p),o=p,n.current.lanes=o,$s(n,o),ar(n),t[qs]=n.current,ld(t),new kl(n)},Oa.version="19.2.4",Oa}var Ix;function w1(){if(Ix)return Ad.exports;Ix=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=S1(),Ad.exports}var C1=w1();const k1=Zl(C1),Bx=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},E1=(e=>e?Bx(e):Bx),j1=e=>e;function N1(e,r=j1){const s=hn.useSyncExternalStore(e.subscribe,hn.useCallback(()=>r(e.getState()),[e,r]),hn.useCallback(()=>r(e.getInitialState()),[e,r]));return hn.useDebugValue(s),s}const zx=e=>{const r=E1(e),s=i=>N1(r,i);return Object.assign(s,r),s},Bn=(e=>e?zx(e):zx);async function Ce(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 T1(e,r){try{return(await Ce(`/api/sessions/${e}/truncate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageIndex:r})})).ok}catch{return!1}}const Qe={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",LLM_DISABLE_XML_PROTECTION:"llm.disableXmlProtection"};function jl(e,r){return s=>({loading:{...s.loading,[e]:r}})}function Px(e,r){return s=>({settings:{...s.settings,[e]:r},loading:{...s.loading,[e]:!1}})}const Mv=[Qe.DISPLAY_SHOW_THINKING,Qe.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,Qe.DISPLAY_SHOW_STATS,Qe.DISPLAY_SHOW_AGENT_DEFINITIONS,Qe.DISPLAY_SHOW_WORKFLOW_BARS];function Th(){return{showThinking:en(e=>e.settings[Qe.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:en(e=>e.settings[Qe.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:en(e=>e.settings[Qe.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:en(e=>e.settings[Qe.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:en(e=>e.settings[Qe.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const en=Bn(e=>({settings:{},loading:{},getSetting:async r=>{e(jl(r,!0));try{const i=await(await Ce(`/api/settings/${r}`)).json();return e(Px(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 Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:s})})).json();e(Px(r,l.value??""))}catch{e(jl(r,!1))}}})),Hx=Object.freeze(Object.defineProperty({__proto__:null,DISPLAY_SETTINGS_KEYS:Mv,SETTINGS_KEYS:Qe,useDisplaySettings:Th,useSettingsStore:en},Symbol.toStringTag,{value:"Module"}));function A1(){const[e,r]=I.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),s=I.useRef(window.innerHeight);return I.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 D1(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 Fx;function L1(){if(Fx)return Md;Fx=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 Ux;function R1(){return Ux||(Ux=1,Od.exports=L1()),Od.exports}var O1=R1();const M1=b1.useInsertionEffect,I1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",B1=I1?I.useLayoutEffect:I.useEffect,z1=M1||B1,Iv=e=>{const r=I.useRef([e,(...s)=>r[0](...s)]).current;return z1(()=>{r[0]=e}),r[1]},P1="popstate",Ah="pushState",Dh="replaceState",H1="hashchange",$x=[P1,Ah,Dh,H1],F1=e=>{for(const r of $x)addEventListener(r,e);return()=>{for(const r of $x)removeEventListener(r,e)}},Bv=(e,r)=>O1.useSyncExternalStore(F1,e,r),qx=()=>location.search,U1=({ssrSearch:e}={})=>Bv(qx,e!=null?()=>e:qx),Wx=()=>location.pathname,$1=({ssrPath:e}={})=>Bv(Wx,e!=null?()=>e:Wx),q1=(e,{replace:r=!1,state:s=null}={})=>history[r?Dh:Ah](s,"",e),W1=(e={})=>[$1(e),q1],Gx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Gx]>"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,Gx,{value:!0})}const G1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",zv=(e="")=>e==="/"?"":e,V1=(e,r)=>e[0]==="~"?e.slice(1):zv(r)+e,K1=(e="",r)=>G1(Vx(zv(e)),Vx(r)),Vx=e=>{try{return decodeURI(e)}catch{return e}},Pv={hook:W1,searchHook:U1,parser:D1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,s)=>e(r,s)},Hv=I.createContext(Pv),Hi=()=>I.useContext(Hv),Fv={},Uv=I.createContext(Fv),Y1=()=>I.useContext(Uv),Jl=e=>{const[r,s]=e.hook(e);return[K1(e.base,r),Iv((i,l)=>e.aroundNav(s,V1(i,e.base),l))]},nr=()=>Jl(Hi()),Lh=(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]},Rh=e=>Lh(Hi().parser,e,nr()[0]),X1=({children:e,...r})=>{var g,m,v;const s=Hi(),i=r.hook?Pv: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=I.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 I.createElement(Hv.Provider,{value:l,children:e})},Kx=({children:e,component:r},s)=>r?I.createElement(r,{params:s}):typeof e=="function"?e(s):e,Z1=e=>{let r=I.useRef(Fv);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??Lh(l.parser,e,u,r),f=Z1({...Y1(),...c});if(!h)return null;const g=d?I.createElement(X1,{base:d},Kx(i,f)):Kx(i,f);return I.createElement(Uv.Provider,{value:f,children:g})},Mn=I.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=Iv(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&&I.isValidElement(f)?I.cloneElement(f,{onClick:C,href:y}):I.createElement("a",{...k,onClick:C,href:y,className:g!=null&&g.call?g(i===h):g,children:f,ref:r})}),$v=e=>Array.isArray(e)?e.flatMap(r=>$v(r&&r.type===I.Fragment?r.props.children:r)):[e],Q1=({children:e,location:r})=>{const s=Hi(),[i]=Jl(s);for(const l of $v(e)){let u=0;if(I.isValidElement(l)&&(u=Lh(s.parser,l.props.path,r||i,l.props.nest))[0])return I.cloneElement(l,{match:u})}return null};function J1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function qv(){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 ew{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);J1(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=qv(),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 tw=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 nw=`${tw}//${window.location.hostname}:${lh}/ws`,Wt=new ew(nw),ds=async(e,r,s)=>{try{const i=await Ce(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 Wv(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=Wv(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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 rw(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 Yx(e,r,s){const i=await Ce(`/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 Xx(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 sw=3e4;function iw(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const kt=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 Ce("/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 Ce("/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 Ce(`/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 Yx(s,i,{contextWindow:l}),{providers:h}=r();return e({providers:Xx(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 Yx(s,i,l),{providers:h}=r(),c={...l.contextWindow!==void 0&&{contextWindow:l.contextWindow},...rw({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:Xx(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 Ce(`/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()},sw);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 Ce("/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 Ce("/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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=Wv(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 Ce(`/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}}}}}),aw=[{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"}],ow=[{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"}],Gv={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},Vv={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:{...Vv}},agentOverrides:{}};function Kv(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:()=>{en.getState().getSetting(Qe.NOTIFICATION_SETTINGS);const i=en.subscribe(u=>{const h=u.settings[Qe.NOTIFICATION_SETTINGS];if(h!==void 0)try{const c=JSON.parse(h);e({settings:Zx(c),loaded:!0})}catch{e({loaded:!0})}}),l=en.getState().settings[Qe.NOTIFICATION_SETTINGS];if(l)try{const u=JSON.parse(l);e({settings:Zx(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){en.getState().setSetting(Qe.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Zx(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:{...Vv,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Qx=new Map;function lw(e){let r=Qx.get(e);return r||(r=new Audio(e),r.volume=.5,Qx.set(e,r)),r}let Yv=typeof Notification<"u"?Notification.permission:"denied";function cw(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Yv=e,e))}const uw={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},dw={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 hw(e){typeof Notification>"u"||Yv==="granted"&&(document.hasFocus()||new Notification(uw[e],{body:dw[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function ao(e,r){const{settings:s}=Ms.getState(),i=Kv(s,e,r);if(s.soundEnabled&&i.soundEnabled){const l=i.customSoundUrl??Gv[e],u=lw(l);u.currentTime=0,u.play().catch(()=>{})}s.browserNotificationEnabled&&i.browserNotification&&hw(e)}const fw=e=>ao("complete",e),pw=e=>ao("phase_done",e),mw=e=>ao("phase_blocked",e),Jx=e=>ao("waiting_for_user",e),gw=e=>ao("new_message",e);let Ia=!1,lr=null;const Bd=new Set,qt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Mi=null,dn=null;function zd(){Mi===null&&(Mi=requestAnimationFrame(()=>{Mi=null,dn==null||dn()}))}function As(){Mi!==null&&(cancelAnimationFrame(Mi),Mi=null)}function zt(e,r){return r!==null&&e.sessionId===r}function xw(e,r,s){return e.id!==void 0||zt(e,r)||s===!0&&e.sessionId!==void 0}function bw(e,r){return e.includes(r)?e:[...e,r]}function Ba(e,r){return e.filter(s=>s!==r)}function vw(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 eb(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 tb=new Map;function Ga(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 yw(e,r){if(e.type==="chat.done"){const s=e.payload,i=Ga(r,e.sessionId),l=s.agentType??i;s.reason==="complete"&&fw(l),s.reason==="waiting_for_user"&&Jx(l);return}if(e.type==="chat.path_confirmation"){const s=Ga(r,e.sessionId);Jx(s);return}if(e.type==="task.completed"){const s=Ga(r,e.sessionId);pw(s);return}if(e.type==="phase.changed"&&e.sessionId){const s=e.payload,i=tb.get(e.sessionId)??null;if(tb.set(e.sessionId,s.phase),i===s.phase)return;const l=Ga(r,e.sessionId);s.phase==="blocked"&&mw(l)}}const Se=Bn((e,r)=>(dn=()=>{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:{},pendingPathConfirmations:[],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 Ce("/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}=kt.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 Ce("/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,pendingPathConfirmations:[],queuedMessages:[],abortInProgress:!1,error:null,pendingSessionCreate:!1})):e({unreadSessionIds:Ba(r().unreadSessionIds,s)});const l=await Ce(`/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 Ce(`/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 Ce(`/api/sessions?${l.toString()}`)).json(),c=h.sessions??[];e(d=>({sessions:eb(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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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(),dn==null||dn(),e({abortInProgress:!0});try{await Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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&&Ce(`/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 Ce(`/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 Ce(`/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=kt.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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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 Ce(`/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,R,F,q,W,V;const i=r();yw(s,i);const l=((h=i.currentSession)==null?void 0:h.id)??null,u=()=>{const z=s.sessionId;!z||z===l||e(H=>({unreadSessionIds:bw(H.unreadSessionIds,z)}))};switch(s.type){case"session.state":{const z=s.payload;if(!xw(s,l,i.pendingSessionCreate))break;As();const H=z.messages.find(Y=>Y.isStreaming)??null,Z=r().pendingSessionCreate===!0;if(e({currentSession:z.session,sessions:vw(r().sessions,z.session),unreadSessionIds:Ba(r().unreadSessionIds,z.session.id),messages:z.messages,streamingMessageId:(H==null?void 0:H.id)??null,streamingMessage:H,currentTodos:[],pendingPathConfirmations:z.pendingConfirmations??[],error:null,...Z?{pendingSessionCreate:z.session.id}:{}}),z.session.providerId){const Y=kt.getState();Y.providers.find(L=>L.id===z.session.providerId)&&Y.syncFromSession(z.session.providerId,z.session.providerModel??"")}break}case"session.list":{const z=s.payload;e(H=>({sessions:eb(z.sessions,H.sessions,H.currentSession)}));break}case"session.deleted":{const z=s.payload;e(H=>({unreadSessionIds:Ba(H.unreadSessionIds,z.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const z=s.payload,H=s.sessionId,Z=(c=r().currentSession)==null?void 0:c.id,Y=H&&H!==Z;e(B=>({sessions:B.sessions.map(L=>L.id===H?{...L,isRunning:z.isRunning}:L)})),Y||e(B=>({currentSession:B.currentSession?{...B.currentSession,isRunning:z.isRunning}:null,...z.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!zt(s,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const z=s.payload;e(H=>H.messages.some(Z=>Z.id===z.message.id)?H:{messages:[...H.messages,z.message],streamingMessageId:z.message.isStreaming?z.message.id:H.streamingMessageId,streamingMessage:z.message.isStreaming?z.message:H.streamingMessage});break}case"chat.message_updated":{if(!zt(s,((f=r().currentSession)==null?void 0:f.id)??null)){u();break}const z=s.payload,H=z.updates.isStreaming===!1&&r().streamingMessageId===z.messageId;H&&(As(),dn==null||dn()),e(Z=>{const Y=Z.streamingMessage,B=H;if(Y&&Y.id===z.messageId){const L={...Y,...z.updates};return{messages:Z.messages.map(O=>O.id===z.messageId?L:O),streamingMessageId:B?null:Z.streamingMessageId,streamingMessage:B?null:{...Y,...z.updates}}}return{messages:Z.messages.map(L=>L.id===z.messageId?{...L,...z.updates}:L),streamingMessageId:B?null:Z.streamingMessageId}});break}case"chat.delta":{if(!zt(s,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const z=s.payload;if(!Bd.has(z.messageId)){Bd.add(z.messageId);const H=Ga(r(),s.sessionId);gw(H)}qt.messageId=z.messageId,qt.deltaContent+=z.content,zd();break}case"chat.thinking":{if(!zt(s,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const z=s.payload;qt.messageId=z.messageId,qt.thinkingContent+=z.content,zd();break}case"chat.tool_preparing":{if(!zt(s,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const z=s.payload,H=r().streamingMessage;if(!H||H.id!==z.messageId||((S=H.toolCalls)==null?void 0:S.find((Y,B)=>B===z.index)))return;e(Y=>{const B=Y.streamingMessage.preparingToolCalls??[],L=B.findIndex($=>$.index===z.index);let O;return L>=0?O=B.map(($,U)=>U===L?{...$,arguments:z.arguments}:$):O=[...B,{index:z.index,name:z.name,...z.arguments?{arguments:z.arguments}:{}}],{streamingMessage:{...Y.streamingMessage,preparingToolCalls:O}}});break}case"chat.tool_call":{if(!zt(s,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const z=s.payload,H=Z=>{var L;const Y=(L=Z.preparingToolCalls)==null?void 0:L.filter((O,$)=>{var U;return O.name===z.tool?(U=Z.preparingToolCalls)==null?void 0:U.slice(0,$).some(Q=>Q.name===z.tool):!0}),B=qt.toolOutput.filter(O=>O.callId===z.callId);return B.length>0&&(qt.toolOutput=qt.toolOutput.filter(O=>O.callId!==z.callId)),{...Z,toolCalls:[...Z.toolCalls??[],{id:z.callId,name:z.tool,arguments:z.args,startedAt:Date.now(),...B.length>0?{streamingOutput:B.map(O=>({stream:O.stream,content:O.content,timestamp:Date.now()}))}:{}}],...Y&&Y.length>0?{preparingToolCalls:Y}:{preparingToolCalls:void 0}}};e(Z=>{const Y=Z.streamingMessage;return Y&&Y.id===z.messageId?{streamingMessage:H(Y)}:{messages:Z.messages.map(B=>B.id===z.messageId?H(B):B)}});break}case"chat.tool_output":{if(!zt(s,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const z=s.payload;qt.messageId=z.messageId,qt.toolOutput.push({messageId:z.messageId,callId:z.callId,stream:z.stream,content:z.output}),zd();break}case"chat.tool_result":{if(!zt(s,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const z=s.payload,H=Z=>{var B;const Y=(B=Z.toolCalls)==null?void 0:B.map(L=>L.id===z.callId?{...L,result:z.result}:L);return{...Z,toolCalls:Y}};e(Z=>{const Y=Z.streamingMessage;return Y&&Y.id===z.messageId?{streamingMessage:H(Y)}:{messages:Z.messages.map(B=>B.id===z.messageId?H(B):B)}});break}case"chat.vision_fallback":{if(!zt(s,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const z=s.payload;e(H=>{const Z=`${z.messageId}-${z.attachmentId}`,Y={...H.visionFallbackByMessage};return Y[Z]={type:z.type,attachmentId:z.attachmentId,filename:z.filename,description:z.description},{visionFallbackByMessage:Y}});break}case"chat.todo":{if(!zt(s,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const z=s.payload;e({currentTodos:z.todos});break}case"chat.summary":{if(!zt(s,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const z=s.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,summary:z.summary}:null}));break}case"chat.progress":{if(!zt(s,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const z=s.payload;console.warn("Progress:",z.message,z.phase);break}case"chat.format_retry":{if(!zt(s,((T=r().currentSession)==null?void 0:T.id)??null)){u();break}const z=s.payload;console.warn("Format retry:",z.attempt,"/",z.maxAttempts);break}case"chat.done":{if(!zt(s,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}As(),dn==null||dn();const z=s.payload,H=z.stats;qt.messageId=null,qt.deltaContent="",qt.thinkingContent="",qt.toolOutput=[],Bd.delete(z.messageId),e(Z=>{const Y=Z.streamingMessage,B=Y&&Y.id===z.messageId?{...Y,isStreaming:!1,stats:H??Y.stats}:null;return{messages:Z.messages.map(L=>L.id===z.messageId?B??{...L,isStreaming:!1,stats:H??L.stats,completeReason:z.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(),dn==null||dn();const z=s.payload;console.error("Chat error:",z.error,"recoverable:",z.recoverable),z.recoverable||(qt.messageId=null,qt.deltaContent="",qt.thinkingContent="",qt.toolOutput=[]),e(H=>({error:{code:"CHAT_ERROR",message:z.error},streamingMessageId:z.recoverable?H.streamingMessageId:null,...z.recoverable?{}:{messages:H.streamingMessage?H.messages.map(Z=>Z.id===H.streamingMessage.id?H.streamingMessage:Z):H.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!zt(s,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}const z=s.payload,H={callId:z.callId,tool:z.tool,paths:z.paths,workdir:z.workdir,reason:z.reason};e(Z=>({pendingPathConfirmations:[...Z.pendingPathConfirmations,H]}));break}case"chat.ask_user":{if(!zt(s,((P=r().currentSession)==null?void 0:P.id)??null)){u();return}const z=s.payload;e({pendingQuestion:{callId:z.callId,question:z.question}});break}case"mode.changed":{if(!zt(s,((R=r().currentSession)==null?void 0:R.id)??null)){u();break}const z=s.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,mode:z.mode}:null}));break}case"phase.changed":{const z=s.payload,H=s.sessionId,Z=(F=r().currentSession)==null?void 0:F.id,Y=H&&H!==Z;e(B=>({sessions:B.sessions.map(L=>L.id===H?{...L,phase:z.phase}:L)})),Y||e(B=>({currentSession:B.currentSession?{...B.currentSession,phase:z.phase}:null}));break}case"criteria.updated":{if(!zt(s,((q=r().currentSession)==null?void 0:q.id)??null)){u();break}const z=s.payload;e(H=>({currentSession:H.currentSession?{...H.currentSession,criteria:z.criteria}:null}));break}case"context.state":{const z=s.payload,H=zt(s,((W=r().currentSession)==null?void 0:W.id)??null);z.subAgentId?H&&r().updateSubAgentContextState(z.subAgentId,z.context):H?e({contextState:z.context}):u();break}case"session.name_generated":{const z=s.payload,H=s.sessionId,Z=(V=r().currentSession)==null?void 0:V.id;e(Y=>{const B=Y.sessions.map(O=>O.id===H?{...O,title:z.name,updatedAt:new Date().toISOString()}:O),L=Z===H?Y.currentSession?{...Y.currentSession,title:z.name,updatedAt:new Date().toISOString()}:null:Y.currentSession;return{sessions:B,currentSession:L}});break}case"queue.state":{const z=s.payload;e({queuedMessages:z.messages??[]});break}case"git.status":{const z=s.payload;e({gitStatus:{branch:z.branch,diff:z.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 z=s.payload;console.error("Server error:",z),e({error:{code:z.code,message:z.message},streamingMessageId:null});break}}}}));function Oh(){return Se(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function _w(){return Se(e=>e.queuedMessages)}function Sw(){return Se(e=>e.abortInProgress)}function ww(){const e=Se(i=>i.connect),r=Se(i=>i.connectionStatus),s=Ms(i=>i.load);return I.useEffect(()=>{e()},[e]),I.useEffect(()=>{r==="connected"&&s()},[r,s]),{connectionStatus:r}}const Cw="modulepreload",kw=function(e){return"/"+e},nb={},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=kw(f),f in nb)return;nb[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":Cw,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)})},Xv=[{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 rb(){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:rb(),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{...Xv.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(()=>Hx);return{useSettingsStore:l}},void 0);await i.getState().setSetting(Qe.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:rb()})},saveUserPresets:()=>{localStorage.setItem("openfox:userPresets",JSON.stringify(r().userPresets)),uh(async()=>{const{useSettingsStore:s}=await Promise.resolve().then(()=>Hx);return{useSettingsStore:s}},void 0).then(({useSettingsStore:s})=>{s.getState().setSetting(Qe.DISPLAY_USER_PRESETS,JSON.stringify(r().userPresets)).catch(()=>{})})}}));function Ew({className:e="w-5 h-5"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function Zv({className:e="w-3.5 h-3.5"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}function jw({className:e="w-5 h-5"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Nw({className:e="w-3 h-3 text-text-muted"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Tw({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:a.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 hr({className:e="w-3.5 h-3.5 text-text-muted"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function fr({className:e="w-3 h-3 text-text-muted",rotate:r}){return a.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:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Aw({className:e="w-4 h-4"}){return a.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),a.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 a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Dw({className:e="w-3 h-3"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 a.jsxs("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"12",cy:"5",r:"2"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"}),a.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}function ec({className:e="w-3.5 h-3.5"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 a.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:a.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 Lw({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Rw({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Ow({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:a.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 Mw({className:e="w-3 h-3"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Iw({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 sb({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}function Qv({className:e="w-[18px] h-[18px]"}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[a.jsx("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function Bw({className:e="w-4 h-4"}){return a.jsxs("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.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"}),a.jsx("path",{d:"M9.5 2h4.5v4.5"}),a.jsx("path",{d:"M14 2L7.5 8.5"})]})}function zw({className:e="w-3 h-3",color:r}){return a.jsx("svg",{className:e,fill:r??"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M8 5v14l11-7z"})})}function Bi({className:e="w-3 h-3 text-accent-primary"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function Pw({className:e="w-5 h-5"}){return a.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:a.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 Jv({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Hw({className:e="w-4 h-4"}){return a.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Fw({className:e="w-3 h-3 text-blue-400 animate-spin flex-shrink-0"}){return a.jsxs("svg",{"aria-label":"Session running",className:e,viewBox:"0 0 24 24",fill:"none",children:[a.jsx("title",{children:"Running"}),a.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),a.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function Uw({className:e="w-3.5 h-3.5 text-text-muted"}){return a.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:a.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 $w({className:e="w-3.5 h-3.5 text-text-muted"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 ey({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:a.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}function qw({className:e="w-3.5 h-3.5 shrink-0",color:r}){return a.jsx("svg",{className:e,fill:"none",stroke:r,viewBox:"0 0 24 24",children:a.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 Ww({className:e="w-4 h-4"}){return a.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"4 17 10 11 4 5"}),a.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function tc({className:e="w-3.5 h-3.5"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 a.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 Gw({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 a.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 a.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:a.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 ty({className:e="w-4 h-4"}){return a.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:a.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 ib(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 Ce(`/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 Ce("/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)=>{ib("terminal.write",{sessionId:s,data:i})},resizeSession:(s,i,l)=>{ib("terminal.resize",{sessionId:s,cols:i,rows:l})},killSession:async s=>{try{(await Ce(`/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=Ov();const nc=I.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:s="",...i},l)=>a.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:a.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));nc.displayName="IconButton";const Vw="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=I.forwardRef((e,r)=>a.jsx(nc,{ref:r,icon:Vw,title:"Edit",...e}));zi.displayName="EditButton";const Kw="M6 18L18 6M6 6l12 12",Hh=I.forwardRef((e,r)=>a.jsx(nc,{ref:r,icon:Kw,...e}));Hh.displayName="CloseButton";const Yw={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 St({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]=I.useState(!1),k=d!==void 0,C=k?d:v,y=I.useCallback(()=>{k||S(!0)},[k]),b=I.useCallback(()=>{k||S(!1),c==null||c()},[k,c]);I.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"?a.jsx("button",{type:"button",onClick:y,className:h,children:e}):a.jsx("span",{onClick:y,className:h,style:{cursor:"pointer"},children:e}));return a.jsxs(a.Fragment,{children:[x,C&&(typeof document<"u"?Fi.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:f?b:void 0}),a.jsxs("div",{className:`relative w-full ${Yw[s]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(r||m)&&a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r&&a.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:r}),m&&a.jsx(Hh,{onClick:b,className:"ml-auto","aria-label":"Close"})]}),a.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:i?{minHeight:i}:void 0,children:l}),u&&a.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const Ze=I.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 a.jsx("button",{ref:u,className:`${h} ${c[e]} ${d[r]} ${s}`,...l,children:i})});Ze.displayName="Button";function Xw({value:e,defaultUrl:r,disabled:s,onChange:i}){const l=e??r;return a.jsxs("div",{className:"relative",children:[a.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:ow.map(({url:u,label:h})=>a.jsx("option",{value:u,title:h,children:h.split(" ")[0]},u))}),a.jsx(fr,{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted"})]})}const ab=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Zw(){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);I.useEffect(()=>{l()},[l]);const u=async()=>{await cw()==="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 a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),a.jsx(ob,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),a.jsx(ob,{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&&a.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),a.jsx("div",{className:"border border-border rounded overflow-hidden",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),ab.map(d=>a.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),a.jsx("tbody",{children:aw.map(d=>a.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[a.jsx("td",{className:"px-3 py-2",children:a.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),ab.map(f=>{const g=Kv(e,d.key,f.key==="general"?void 0:f.key),m=Gv[d.key];return a.jsx("td",{className:"px-2 py-2 align-top",children:a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:a.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"})}),a.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:a.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&&a.jsx(Xw,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:v=>c(f.key,d.key,v)})]})},f.key)})]},d.key))})]})})]})]})}function ob({label:e,description:r,checked:s,onChange:i}){return a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[a.jsx("div",{className:"pt-0.5",children:a.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:a.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"}`})})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),a.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function Fh(e,r){r({loading:!0});try{const i=await(await Ce(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 Ce(`/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 Ce(`/api/skills/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await Ce(`/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 Ce(`/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 Ce(`/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]=I.useState({id:null,type:null}),s=I.useCallback(u=>r({id:u,type:"delete"}),[]),i=I.useCallback(()=>r({id:null,type:null}),[]),l=I.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 a.jsxs("div",{className:"flex items-center gap-1",children:[a.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"}),a.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 a.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:a.jsx(tc,{})})}function Ja({onClick:e}){return a.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:a.jsx(Mh,{})})}function Is({label:e,value:r,onChange:s,placeholder:i,readOnly:l,hint:u,mono:h}){return a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&a.jsx("span",{className:"text-text-muted ml-1",children:u})]}),a.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 Qw({onCancel:e,onSave:r,saving:s,saveDisabled:i}){return a.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[a.jsx(Ze,{variant:"secondary",onClick:e,children:"Cancel"}),a.jsx(Ze,{variant:"primary",onClick:r,disabled:s||i,children:s?"Saving...":"Save"})]})}function Wh({message:e}){return a.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function ny({label:e="Custom",children:r}){return a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),a.jsx("div",{className:"space-y-2",children:r})]})}function ry({description:e,onNew:r,newLabel:s="+ New"}){return a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("p",{className:"text-text-secondary text-sm",children:e}),a.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:a.jsx(Ze,{variant:"primary",size:"sm",onClick:r,children:s})})]})}function sy({isBuiltIn:e,isConfirmingDelete:r,onView:s,onEdit:i,onDuplicate:l,onDelete:u,children:h}){return a.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[a.jsx("div",{className:"min-w-0 flex-1 mr-3",children:h}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&s&&a.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:a.jsx(ec,{})}),a.jsx(Ja,{onClick:l}),!e&&i&&a.jsx(zi,{onClick:i}),!e&&(r?a.jsx($h,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):a.jsx(qh,{onClick:()=>u==null?void 0:u()}))]})]})}function Jw({id:e,name:r,description:s,isBuiltIn:i,isConfirmingDelete:l,onView:u,onEdit:h,onDuplicate:c,onDelete:d}){return a.jsxs(sy,{isBuiltIn:i,isConfirmingDelete:l,onView:u,onEdit:h,onDuplicate:c,onDelete:d,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),a.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),s&&a.jsx("p",{className:"text-text-muted text-xs truncate",children:s})]})}function iy({loading:e,hasItems:r,loadingLabel:s,emptyLabel:i,children:l}){return e&&!r?a.jsx("div",{className:"text-text-muted text-sm",children:s}):r?a.jsx("div",{className:"space-y-4",children:l}):i?a.jsx("div",{className:"text-text-muted text-sm",children:i}):null}function ay({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 a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Is,{label:s,value:e,onChange:f,placeholder:l,hint:h}),a.jsx(Is,{label:i,value:r,onChange:g,readOnly:c,placeholder:u,hint:c?d:void 0,mono:!0})]})}function oy(e={}){const{initialData:r={}}=e,[s,i]=I.useState("list"),[l,u]=I.useState(null),[h,c]=I.useState(""),[d,f]=I.useState(!1),[g,m]=I.useState(r),v=I.useCallback(()=>{m(r),c(""),u(null)},[r]),S=I.useCallback(b=>{i(b),b==="list"&&v()},[v]),k=I.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),C=I.useCallback((b,x={})=>{u(b),i("edit"),m({...x}),c("")},[]),y=I.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 Gh(){return a.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:[a.jsx("span",{children:"⚠️"}),a.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 lb({skill:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h}){return a.jsx(Jw,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h})}function eC({isOpen:e}){const r=Rr(V=>V.defaults),s=Rr(V=>V.userItems),i=Rr(V=>V.loading),l=Rr(V=>V.fetchSkills),u=Rr(V=>V.fetchSkill),h=Rr(V=>V.fetchDefaultContent),c=Rr(V=>V.createSkill),d=Rr(V=>V.updateSkill),f=Rr(V=>V.deleteSkill),{view:g,editingId:m,formError:v,saving:S,formData:k,setView:C,setEditingId:y,setFormError:b,setFormData:x,setSaving:_}=oy(),{clearConfirm:j}=Uh();I.useEffect(()=>{e&&(l(),C("list"),y(null),j())},[e,l,j]);const T=(V,z,H,Z)=>{x({name:Z??V.metadata.name,id:H??V.metadata.id,description:V.metadata.description??"",version:V.metadata.version??"1.0.0",prompt:V.prompt,isReadOnly:z})},N=async V=>{if(r.some(H=>H.id===V)){const H=await h(V);if(!H)return;T(H,!0),y(V),b(""),C("edit")}else{const H=await u(V);if(!H)return;T(H,!0),y(V),b(""),C("edit")}},D=async V=>{const H=r.some(Y=>Y.id===V)?await h(V):await u(V);if(!H)return;const Z=`${V}-copy-${Date.now()}`;T(H,!1,Z,`${H.metadata.name} (copy)`),y(null),b(""),C("edit")},A=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},P=async V=>{const z=await u(V);z&&(T(z,!1),y(V),b(""),C("edit"))},R=async V=>{await f(V),j()},F=async()=>{const V=m??k.id;if(!V||!k.name||!k.prompt){b("Name, ID, and prompt are required.");return}_(!0),b("");const z={metadata:{id:V,name:k.name,description:k.description,version:k.version},prompt:k.prompt},H=m?await d(m,z):await c(z);if(_(!1),!H.success){b(H.error??"Failed to save skill.");return}C("list")},q=V=>{x(z=>({...z,name:V})),m||x(z=>({...z,id:V.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},W=k.isReadOnly;return g==="edit"?a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex justify-between items-center mb-3",children:[a.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:W?k.name:m?"Edit Skill":"New Skill"}),a.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),v&&a.jsx(Wh,{message:v}),a.jsxs("div",{className:"space-y-3 mb-3",children:[a.jsx(ay,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:q,onIdChange:()=>{}}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Is,{label:"Description",value:k.description,onChange:V=>x(z=>({...z,description:V})),placeholder:"What this skill does...",readOnly:W}),a.jsx(Is,{label:"Version",value:k.version,onChange:V=>x(z=>({...z,version:V})),placeholder:"1.0.0",readOnly:W})]})]}),a.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),a.jsx("textarea",{value:k.prompt,onChange:V=>x(z=>({...z,prompt:V.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"})]}),a.jsx(Gh,{}),a.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[a.jsx(Ze,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),W?a.jsx(Ze,{variant:"primary",onClick:()=>{x(V=>({...V,name:V.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),y(null)},children:"Duplicate & Customize"}):a.jsx(Ze,{variant:"primary",onClick:F,disabled:S||!k.name||!k.id||!k.prompt,children:S?"Saving...":"Save"})]})]}):a.jsxs("div",{children:[a.jsx(ry,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:A}),a.jsxs(iy,{loading:i,hasItems:r.length>0||s.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),a.jsx("div",{className:"space-y-2",children:r.map(V=>a.jsx(lb,{skill:V,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(V.id),onDuplicate:()=>D(V.id)},V.id))})]}),s.length>0&&a.jsx(ny,{children:s.map(V=>a.jsx(lb,{skill:V,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(V.id),onEdit:()=>P(V.id),onDuplicate:()=>D(V.id),onDelete:()=>R(V.id)},V.id))})]})]})}function tC(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 nC({isOpen:e,isNew:r,basePresetId:s,presetName:i,initialTokens:l,onClose:u,onSave:h}){const[c,d]=I.useState(l),[f,g]=I.useState(i);I.useEffect(()=>{d(l),g(i)},[l,i]);const m=(y,b)=>{const x=b.startsWith("#")?tC(b):b;d(_=>({..._,[y]:x}))},v=()=>{h(f.trim()||"Untitled",{...c})},S=Xv.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 a.jsx(St,{isOpen:e,onClose:u,size:"lg",title:r?"New Theme":"Edit Theme",closeOnBackdropClick:!0,closeOnEscape:!0,footer:a.jsxs("div",{className:"flex gap-2 justify-end",children:[a.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"}),a.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:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs text-text-muted block mb-1",children:"Name"}),a.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&&a.jsxs("div",{className:"text-xs text-text-muted",children:["Based on ",a.jsx("span",{className:"text-text-primary",children:C==null?void 0:C.name})]}),Object.entries(S).map(([y,b])=>a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:k[y]??y}),a.jsx("div",{className:"grid grid-cols-2 gap-3",children:b.map(x=>a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("label",{htmlFor:x.key,className:"text-xs text-text-muted",children:x.label}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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"}),a.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 rC(){const[e,r]=I.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 a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Theme"}),a.jsx("div",{className:"grid grid-cols-5 gap-2",children:dr.map(x=>a.jsxs("div",{className:"relative group",children:[a.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:[a.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:a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Os(x.tokens["color-text-primary"]??"#fff")}})}),a.jsx("span",{className:"text-xs",children:x.name})]}),a.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:a.jsx("span",{className:"text-xs",children:"✎"})})]},x.id))}),u.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:"My Themes"}),a.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 a.jsxs("div",{className:"relative group",children:[a.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:[a.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:a.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Os(T["color-text-primary"]??"#fff")}})}),a.jsx("span",{className:"text-xs truncate w-full text-center",children:x.name})]}),a.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:a.jsx("span",{className:"text-xs",children:"✎"})}),a.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:a.jsx(Ph,{className:"w-3 h-3"})})]},x.id)})})]}),e&&a.jsx(nC,{isOpen:!0,isNew:e.type==="new",presetIndex:e.presetIndex,basePresetId:e.basePresetId,presetName:e.presetName,initialTokens:e.tokens,onClose:C,onSave:k})]})}function Vh(){const e=en(l=>l.settings),r=en(l=>l.loading),s=en(l=>l.getSetting),i=en(l=>l.setSetting);return{settings:e,loading:r,getSetting:s,setSetting:i}}function sC({isOpen:e,onClose:r}){const[s,i]=I.useState("instructions");return a.jsx(St,{isOpen:e,onClose:r,title:"Settings",size:"xl",minHeight:"500px",children:a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[a.jsx(za,{label:"Instructions",active:s==="instructions",onClick:()=>i("instructions")}),a.jsx(za,{label:"Skills",active:s==="skills",onClick:()=>i("skills")}),a.jsx(za,{label:"Notifications",active:s==="notifications",onClick:()=>i("notifications")}),a.jsx(za,{label:"Display",active:s==="display",onClick:()=>i("display")}),a.jsx(za,{label:"Advanced",active:s==="advanced",onClick:()=>i("advanced")})]}),s==="instructions"&&a.jsx(lC,{isOpen:e}),s==="skills"&&a.jsx(eC,{isOpen:e}),s==="notifications"&&a.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:a.jsx(Zw,{})}),s==="display"&&a.jsx(oC,{}),s==="advanced"&&a.jsx(iC,{onClose:r})]})})}function iC({onClose:e}){const[,r]=nr(),{settings:s,loading:i,getSetting:l,setSetting:u}=Vh(),h=s[Qe.LLM_DISABLE_XML_PROTECTION]==="true",c=i[Qe.LLM_DISABLE_XML_PROTECTION]??!1;I.useEffect(()=>{l(Qe.LLM_DISABLE_XML_PROTECTION)},[l]);const d=async()=>{const g=String(!h);await u(Qe.LLM_DISABLE_XML_PROTECTION,g)};function f(){e(),r("/onboarding")}return c?a.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{children:a.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-text-primary",children:"Disable XML Tool Call Protection"}),a.jsx("div",{className:"text-xs text-text-muted mt-0.5",children:"Allow the model to output XML tool call format instead of JSON function calls. Some third-party providers may require this."})]}),a.jsx("button",{type:"button",onClick:d,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${h?"bg-accent-primary":"bg-bg-tertiary"}`,children:a.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${h?"translate-x-6":"translate-x-1"}`})})]})}),a.jsx("hr",{className:"border-border"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),a.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),a.jsx(Ze,{variant:"secondary",onClick:f,children:"Launch Onboarding"})]})]})}function aC(){return a.jsx(rC,{})}function oC(){const{settings:e,loading:r,getSetting:s,setSetting:i}=Vh(),l=r[Qe.DISPLAY_SHOW_THINKING]??!1,u=[{key:Qe.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:Qe.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:Qe.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:Qe.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:Qe.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]=I.useState(()=>Object.fromEntries(u.map(g=>[g.key,h[g.key]==="true"])));I.useEffect(()=>{u.forEach(g=>s(g.key))},[s]),I.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?a.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):a.jsxs("div",{className:"space-y-6",children:[a.jsx(aC,{}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),a.jsx("div",{className:"space-y-4",children:u.map(({key:g,label:m,description:v})=>a.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm text-text-primary",children:m}),a.jsx("div",{className:"text-xs text-text-muted",children:v})]}),a.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:a.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 a.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 lC({isOpen:e}){const{settings:r,loading:s,getSetting:i,setSetting:l}=Vh(),u=r[Qe.GLOBAL_INSTRUCTIONS]??"",h=s[Qe.GLOBAL_INSTRUCTIONS]??!1,[c,d]=I.useState(u),[f,g]=I.useState(!1),[m,v]=I.useState(!1);I.useEffect(()=>{e&&i(Qe.GLOBAL_INSTRUCTIONS)},[e,i]),I.useEffect(()=>{d(u),g(!1)},[u]);const S=async()=>{v(!0),await l(Qe.GLOBAL_INSTRUCTIONS,c),v(!1),g(!1)},k=()=>{d(u),g(!1)},C=h||m;return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),a.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),a.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&&a.jsx(Gh,{}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{variant:"secondary",onClick:k,disabled:!f,children:"Discard"}),a.jsx(Ze,{variant:"primary",onClick:S,disabled:!f||C,children:m?"Saving...":"Save"})]})]})}var Pd={exports:{}},cb;function cC(){return cb||(cb=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))||"",R=(j.ydisp+N+1).toString(),F=this._rowElements[N];F&&(P.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=P,this._rowColumns.set(F,A)),F.setAttribute("aria-posinset",R),F.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:R,offset:F})=>{const q=R instanceof Text?R.parentNode:R;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 V=this._rowColumns.get(q);if(!V)return console.warn("columns is null. Race condition?"),null;let z=F<V.length?V[F]:V.slice(-1)[0]+1;return z>=this._terminal.cols&&(++W,z=0),{row:W,column:z}},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 R,F;if(this._isMouseOut)return;const P=A==null?void 0:A.map((q=>({link:q})));(R=this._activeProviderReplies)==null||R.set(N,P),_=this._checkLinkProviderResult(N,b,_),((F=this._activeProviderReplies)==null?void 0:F.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 R=A;R<=P;R++){if(_.has(R)){T.splice(N--,1);break}_.add(R)}}}}_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 R=0;R<T;R++)if(D!==-1||b.hasContent(R)){if(b.loadCell(R,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=R,N=j.extended.urlId;continue}A=j.extended.urlId!==N}else D!==-1&&(A=!0);if(A||D!==-1&&R===T-1){const F=(P=this._oscLinkService.getLinkData(N))==null?void 0:P.uri;if(F){const q={start:{x:D+1,y:C},end:{x:R+(A||R!==T-1?0:1),y:C}};let W=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const V=new URL(F);["http:","https:"].includes(V.protocol)||(W=!0)}catch{W=!0}W||x.push({text:F,range:q,activate:(V,z)=>_?_.activate(V,z,q):k(0,z),hover:(V,z)=>{var H;return(H=_==null?void 0:_.hover)==null?void 0:H.call(_,V,z,q)},leave:(V,z)=>{var H;return(H=_==null?void 0:_.leave)==null?void 0:H.call(_,V,z,q)}})}A=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=R,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),R=d(6731),F=d(8055),q=d(8969),W=d(8460),V=d(844),z=d(6114),H=d(8437),Z=d(2584),Y=d(7399),B=d(5941),L=d(9074),O=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=z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new V.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(O.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(((G,ie)=>this.refresh(G,ie)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((G=>this._reportWindowsOptions(G)))),this.register(this._inputHandler.onColor((G=>this._handleColorEvent(G)))),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((G=>this._afterResize(G.cols,G.rows)))),this.register((0,V.toDisposable)((()=>{var G,ie;this._customKeyEventHandler=void 0,(ie=(G=this.element)==null?void 0:G.parentNode)==null||ie.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const G of X){let ie,re="";switch(G.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;"+G.index}switch(G.type){case 0:const be=F.color.toColorRGB(ie==="ansi"?this._themeService.colors.ansi[G.index]:this._themeService.colors[ie]);this.coreService.triggerDataEvent(`${Z.C0.ESC}]${re};${(0,B.toRgbString)(be)}${Z.C1_ESCAPED.ST}`);break;case 1:if(ie==="ansi")this._themeService.modifyColors((ve=>ve.ansi[G.index]=F.channels.toColor(...G.color)));else{const ve=ie;this._themeService.modifyColors((Le=>Le[ve]=F.channels.toColor(...G.color)))}break;case 2:this._themeService.restoreColor(G.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,G=this.buffer.lines.get(X);if(!G)return;const ie=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,be=G.getWidth(ie),ve=this._renderService.dimensions.css.cell.width*be,Le=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=Le+"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",(G=>{this.hasSelection()&&(0,f.copyHandler)(G,this._selectionService)})));const X=G=>(0,f.handlePasteEvent)(G,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),z.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(G=>{G.button===2&&(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(G=>{(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),z.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(G=>{G.button===1&&(0,f.moveTextAreaUnderMouseCursor)(G,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 G=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),G.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),G.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),z.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(R.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(G);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,G=this.element;function ie(ve){const Le=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!Le)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:Le.col,row:Le.row,x:Le.x,y:Le.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||(G.addEventListener("mousemove",be.mousemove),re.mousemove=be.mousemove):(G.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&ve?re.wheel||(G.addEventListener("wheel",be.wheel,{passive:!1}),re.wheel=be.wheel):(G.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)(G,"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)(G,"wheel",(ve=>{if(!re.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const Le=this.viewport.getLinesScrolled(ve);if(Le===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(Le);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)(G,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(G,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,G){var ie;(ie=this._renderService)==null||ie.refreshRows(X,G)}updateCursorStyle(X){var G;(G=this._selectionService)!=null&&G.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,G,ie=0){var re;ie===1?(super.scrollLines(X,G,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 G=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),G}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,G,ie){this._selectionService.setSelection(X,G,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,G){var ie;(ie=this._selectionService)==null||ie.selectLines(X,G)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const G=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!G&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;G||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,G){const ie=X.isMac&&!this.options.macOptionIsMeta&&G.altKey&&!G.ctrlKey&&!G.metaKey||X.isWindows&&G.altKey&&G.ctrlKey&&!G.metaKey||X.isWindows&&G.getModifierState("AltGraph");return G.type==="keypress"?ie:ie&&(!G.keyCode||G.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(G){return G.keyCode===16||G.keyCode===17||G.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let G;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)G=X.charCode;else if(X.which===null||X.which===void 0)G=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;G=X.which}return!(!G||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(G=String.fromCharCode(G),this._onKey.fire({key:G,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(G,!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 G=X.data;return this.coreService.triggerDataEvent(G,!0),this.cancel(X),!0}return!1}resize(X,G){X!==this.cols||G!==this.rows?super.resize(X,G):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,G){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 G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(H.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 G,ie;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(G=this._selectionService)==null||G.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 G=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};${G}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,G){if(this.options.cancelEvents||G)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 R=D.get(P);if(!R)continue;const F=(A=D.get(P+1))==null?void 0:A.isWrapped;if(j+=R.translateToString(!F),!F||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 R=_.length-1;R>=0;R--)(D=_[R])&&(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 F;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(),(F=this._viewportElement.parentElement)==null||F.insertBefore(this._canvas,this._viewportElement);const R=this._canvas.getContext("2d");if(!R)throw new Error("Ctx cannot be null");this._ctx=R,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 R=0;const F=D-m(D,P),q=A-m(A,P);for(let W=0;W<Math.abs(F-q);W++){const V=v(D,A)==="A"?-1:1,z=P.buffer.lines.get(F+V*W);z!=null&&z.isWrapped&&R++}return R})(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,R,F,q,W){return g(P,F,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,R,F,q,W){let V;V=g(P,F,q,W).length>0?F-m(F,q):P;const z=F,H=(function(Z,Y,B,L,O,$){let U;return U=g(B,L,O,$).length>0?L-m(L,O):Y,Z<B&&U<=L||Z>=B&&U<L?"C":"D"})(A,P,R,F,q,W);return C(S(A,V,R,z,H==="C",q).length,k(H,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,V,z,H){var Z,Y=arguments.length,B=Y<3?V:H===null?H=Object.getOwnPropertyDescriptor(V,z):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(W,V,z,H);else for(var L=W.length-1;L>=0;L--)(Z=W[L])&&(B=(Y<3?Z(B):Y>3?Z(V,z,B):Z(V,z))||B);return Y>3&&B&&Object.defineProperty(V,z,B),B},g=this&&this.__param||function(W,V){return function(z,H){V(z,H,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",R="xterm-selection";let F=1,q=c.DomRenderer=class extends _.Disposable{constructor(W,V,z,H,Z,Y,B,L,O,$,U,ne,Q){super(),this._terminal=W,this._document=V,this._element=z,this._screenElement=H,this._viewportElement=Z,this._helperContainer=Y,this._linkifier2=B,this._charSizeService=O,this._optionsService=$,this._bufferService=U,this._coreBrowserService=ne,this._themeService=Q,this._terminalClass=F++,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(R),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 z of this._rowElements)z.style.width=`${this.dimensions.css.canvas.width}px`,z.style.height=`${this.dimensions.css.cell.height}px`,z.style.lineHeight=`${this.dimensions.css.cell.height}px`,z.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const V=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=V,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 V=`${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}`;V+=`${this._terminalSelector} .${N} .xterm-dim { color: ${b.color.multiplyOpacity(W.foreground,.5).css};}`,V+=`${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 z=`blink_underline_${this._terminalClass}`,H=`blink_bar_${this._terminalClass}`,Z=`blink_block_${this._terminalClass}`;V+=`@keyframes ${z} { 50% { border-bottom-style: hidden; }}`,V+=`@keyframes ${H} { 50% { box-shadow: none; }}`,V+=`@keyframes ${Z} { 0% { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css}; } 50% { background-color: inherit; color: ${W.cursor.css}; }}`,V+=`${this._terminalSelector} .${N}.${P} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${N}.${P} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${H} 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);}`,V+=`${this._terminalSelector} .${R} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${R} div { position: absolute; background-color: ${W.selectionBackgroundOpaque.css};}${this._terminalSelector} .${R} div { position: absolute; background-color: ${W.selectionInactiveBackgroundOpaque.css};}`;for(const[Y,B]of W.ansi.entries())V+=`${this._terminalSelector} .${D}${Y} { color: ${B.css}; }${this._terminalSelector} .${D}${Y}.xterm-dim { color: ${b.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${A}${Y} { background-color: ${B.css}; }`;V+=`${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=V}_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,V){for(let z=this._rowElements.length;z<=V;z++){const H=this._document.createElement("div");this._rowContainer.appendChild(H),this._rowElements.push(H)}for(;this._rowElements.length>V;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(W,V){this._refreshRowElements(W,V),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,V,z){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,V,z),this.renderRows(0,this._bufferService.rows-1),!W||!V)return;this._selectionRenderModel.update(this._terminal,W,V,z);const H=this._selectionRenderModel.viewportStartRow,Z=this._selectionRenderModel.viewportEndRow,Y=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(Y>=this._bufferService.rows||B<0)return;const L=this._document.createDocumentFragment();if(z){const O=W[0]>V[0];L.appendChild(this._createSelectionElement(Y,O?V[0]:W[0],O?W[0]:V[0],B-Y+1))}else{const O=H===Y?W[0]:0,$=Y===Z?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Y,O,$));const U=B-Y-1;if(L.appendChild(this._createSelectionElement(Y+1,0,this._bufferService.cols,U)),Y!==B){const ne=Z===B?V[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(B,0,ne))}}this._selectionContainer.appendChild(L)}_createSelectionElement(W,V,z,H=1){const Z=this._document.createElement("div"),Y=V*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*(z-V);return Y+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-Y),Z.style.height=H*this.dimensions.css.cell.height+"px",Z.style.top=W*this.dimensions.css.cell.height+"px",Z.style.left=`${Y}px`,Z.style.width=`${B}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,V){const z=this._bufferService.buffer,H=z.ybase+z.y,Z=Math.min(z.x,this._bufferService.cols-1),Y=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=W;O<=V;O++){const $=O+z.ydisp,U=this._rowElements[O],ne=z.lines.get($);if(!U||!ne)break;U.replaceChildren(...this._rowFactory.createRow(ne,$,$===H,B,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,V,z,H,Z,Y){z<0&&(W=0),H<0&&(V=0);const B=this._bufferService.rows-1;z=Math.max(Math.min(z,B),0),H=Math.max(Math.min(H,B),0),Z=Math.min(Z,this._bufferService.cols);const L=this._bufferService.buffer,O=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=z;ee<=H;++ee){const X=ee+L.ydisp,G=this._rowElements[ee],ie=L.lines.get(X);if(!G||!ie)break;G.replaceChildren(...this._rowFactory.createRow(ie,X,X===O,ne,Q,$,U,this.dimensions.css.cell.width,this._widthCache,Y?ee===z?W:0:-1,Y?(ee===H?V: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 R,F=arguments.length,q=F<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--)(R=N[W])&&(q=(F<3?R(q):F>3?R(D,A,q):R(D,A))||q);return F>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,R,F,q){this._document=N,this._characterJoinerService=D,this._optionsService=A,this._coreBrowserService=P,this._coreService=R,this._decorationService=F,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,R,F,q,W,V,z,H){const Z=[],Y=this._characterJoinerService.getJoinedCharacters(D),B=this._themeService.colors;let L,O=N.getNoBgTrimmedLength();A&&O<F+1&&(O=F+1);let $=0,U="",ne=0,Q=0,ee=0,X=!1,G=0,ie=!1,re=0;const be=[],ve=z!==-1&&H!==-1;for(let Le=0;Le<O;Le++){N.loadCell(Le,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let ze=!1,Ue=Le,Te=this._workCell;if(Y.length>0&&Le===Y[0][0]){ze=!0;const Je=Y.shift();Te=new b.JoinedCellData(this._workCell,N.translateToString(!0,Je[0],Je[1]),Je[1]-Je[0]),Ue=Je[1]-1,Oe=Te.getWidth()}const pe=this._isCellInSelection(Le,D),Ne=A&&Le===F,$e=ve&&Le>=z&&Le<=H;let Tt=!1;this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Je=>{Tt=!0}));let me=Te.getChars()||v.WHITESPACE_CELL_CHAR;if(me===" "&&(Te.isUnderline()||Te.isOverline())&&(me=" "),re=Oe*W-V.get(me,Te.isBold(),Te.isItalic()),L){if($&&(pe&&ie||!pe&&!ie&&Te.bg===ne)&&(pe&&ie&&B.selectionForeground||Te.fg===Q)&&Te.extended.ext===ee&&$e===X&&re===G&&!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,G=re,ie=pe,ze&&F>=Le&&F<=Ue&&(F=Le),!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(R)switch(R){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 Je=Te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Te.isBold()&&Je<8&&(Je+=8),L.style.textDecorationColor=B.ansi[Je].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 Je=je;je=ht,ht=Je;const Mt=Me;Me=ce,ce=Mt}let Ae,Ie,Ge,At=!1;switch(this._decorationService.forEachDecorationAtCell(Le,D,void 0,(Je=>{Je.options.layer!=="top"&&At||(Je.backgroundColorRGB&&(ce=50331648,ht=Je.backgroundColorRGB.rgba>>8&16777215,Ae=Je.backgroundColorRGB),Je.foregroundColorRGB&&(Me=50331648,je=Je.foregroundColorRGB.rgba>>8&16777215,Ie=Je.foregroundColorRGB),At=Je.options.layer==="top")})),!At&&pe&&(Ae=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,ht=Ae.rgba>>8&16777215,ce=50331648,At=!0,B.selectionForeground&&(Me=50331648,je=B.selectionForeground.rgba>>8&16777215,Ie=B.selectionForeground)),At&&be.push("xterm-decoration-top"),ce){case 16777216:case 33554432:Ge=B.ansi[ht],be.push(`xterm-bg-${ht}`);break;case 50331648:Ge=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?(Ge=B.foreground,be.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ge=B.background}switch(Ae||Te.isDim()&&(Ae=C.color.multiplyOpacity(Ge,.5)),Me){case 16777216:case 33554432:Te.isBold()&&je<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(je+=8),this._applyMinimumContrast(L,Ge,B.ansi[je],Te,Ae,void 0)||be.push(`xterm-fg-${je}`);break;case 50331648:const Je=C.channels.toColor(je>>16&255,je>>8&255,255&je);this._applyMinimumContrast(L,Ge,Je,Te,Ae,Ie)||this._addStyle(L,`color:#${T(je.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ge,B.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),Le=Ue}return L&&$&&(L.textContent=U),Z}_applyMinimumContrast(N,D,A,P,R,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(P.getCode()))return!1;const q=this._getContrastCache(P);let W;if(R||F||(W=q.getColor(D.rgba,A.rgba)),W===void 0){const V=this._optionsService.rawOptions.minimumContrastRatio/(P.isDim()?2:1);W=C.color.ensureContrastRatio(R||D,F||A,V),q.setColor((R||D).rgba,(F||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 ly{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),R=_.getBg(0);for(let F=0;F<_.getTrimmedLength();F++)if(_.loadCell(F,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==P||this._workCell.bg!==R){if(F-N>1){const q=this._getJoinedRanges(T,A,D,_,N);for(let W=0;W<q.length;W++)j.push(q[W])}N=F,A=D,P=this._workCell.fg,R=this._workCell.bg}D+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const F=this._getJoinedRanges(T,A,D,_,N);for(let q=0;q<F.length;q++)j.push(F[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 R=this._characterJoiners[P].handler(D);for(let F=0;F<R.length;F++)ly._mergeRanges(A,R[F])}catch(R){console.error(R)}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 R=_.getWidth(P),F=_.getString(P).length||v.WHITESPACE_CELL_CHAR.length;if(R!==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+=F}}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(((R,F)=>this._renderRows(R,F)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var R;return(R=this._renderer.value)==null?void 0:R.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((R=>this._registerIntersectionObserver(R,_))))}_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,R,F){var q,W=arguments.length,V=W<3?P:F===null?F=Object.getOwnPropertyDescriptor(P,R):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(A,P,R,F);else for(var z=A.length-1;z>=0;z--)(q=A[z])&&(V=(W<3?q(V):W>3?q(P,R,V):q(P,R))||V);return W>3&&V&&Object.defineProperty(P,R,V),V},g=this&&this.__param||function(A,P){return function(R,F){P(R,F,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,R,F,q,W,V,z,H){super(),this._element=A,this._screenElement=P,this._linkifier=R,this._bufferService=F,this._coreService=q,this._mouseService=W,this._optionsService=V,this._renderService=z,this._coreBrowserService=H,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 R=this._bufferService.buffer,F=[];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 V=A[1];V<=P[1];V++){const z=R.translateBufferLineToString(V,!0,q,W);F.push(z)}}else{const q=A[1]===P[1]?P[0]:void 0;F.push(R.translateBufferLineToString(A[1],!0,A[0],q));for(let W=A[1]+1;W<=P[1]-1;W++){const V=R.lines.get(W),z=R.translateBufferLineToString(W,!0);V!=null&&V.isWrapped?F[F.length-1]+=z:F.push(z)}if(A[1]!==P[1]){const W=R.lines.get(P[1]),V=R.translateBufferLineToString(P[1],!0,0,P[0]);W&&W.isWrapped?F[F.length-1]+=V:F.push(V)}}return F.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),R=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(R&&F&&P)&&this._areCoordsInSelection(P,R,F)}isCellInSelection(A,P){const R=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!R||!F)&&this._areCoordsInSelection([A,P],R,F)}_areCoordsInSelection(A,P,R){return A[1]>P[1]&&A[1]<R[1]||P[1]===R[1]&&A[1]===P[1]&&A[0]>=P[0]&&A[0]<R[0]||P[1]<R[1]&&A[1]===R[1]&&A[0]<R[0]||P[1]<R[1]&&A[1]===P[1]&&A[0]>=P[0]}_selectWordAtCursor(A,P){var q,W;const R=(W=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:W.range;if(R)return this._model.selectionStart=[R.start.x-1,R.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(R,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(A);return!!F&&(this._selectWordAt(F,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 R=this._renderService.dimensions.css.canvas.height;return P>=0&&P<=R?0:(P>R&&(P-=R),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 R=this._bufferService.buffer;if(this._model.selectionEnd[1]<R.lines.length){const F=R.lines.get(this._model.selectionEnd[1]);F&&F.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 R=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(R&&R[0]!==void 0&&R[1]!==void 0){const F=(0,v.moveToCellSequence)(R[0]-1,R[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,P=this._model.finalSelectionEnd,R=!(!A||!P||A[0]===P[0]&&A[1]===P[1]);R?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,R)):this._oldHasSelection&&this._fireOnSelectionChange(A,P,R)}_fireOnSelectionChange(A,P,R){this._oldSelectionStart=A,this._oldSelectionEnd=P,this._oldHasSelection=R,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((P=>this._handleTrim(P)))}_convertViewportColToCharacterIndex(A,P){let R=P;for(let F=0;P>=F;F++){const q=A.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?R--:q>1&&P!==F&&(R+=q-1)}return R}setSelection(A,P,R){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,P],this._model.selectionStartLength=R,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,P,R=!0,F=!0){if(A[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,W=q.lines.get(A[1]);if(!W)return;const V=q.translateBufferLineToString(A[1],!1);let z=this._convertViewportColToCharacterIndex(W,A[0]),H=z;const Z=A[0]-z;let Y=0,B=0,L=0,O=0;if(V.charAt(z)===" "){for(;z>0&&V.charAt(z-1)===" ";)z--;for(;H<V.length&&V.charAt(H+1)===" ";)H++}else{let ne=A[0],Q=A[0];W.getWidth(ne)===0&&(Y++,ne--),W.getWidth(Q)===2&&(B++,Q++);const ee=W.getString(Q).length;for(ee>1&&(O+=ee-1,H+=ee-1);ne>0&&z>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,z-=X-1),z--,ne--}for(;Q<W.length&&H+1<V.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?(B++,Q++):X>1&&(O+=X-1,H+=X-1),H++,Q++}}H++;let $=z+Z-Y+L,U=Math.min(this._bufferService.cols,H-z+Y+B-L-O);if(P||V.slice(z,H).trim()!==""){if(R&&$===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(F&&$+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 R=this._getWordAt(A,P);if(R){for(;R.start<0;)R.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[R.start,A[1]],this._model.selectionStartLength=R.length}}_selectToWordAt(A){const P=this._getWordAt(A,!0);if(P){let R=A[1];for(;P.start<0;)P.start+=this._bufferService.cols,R--;if(!this._model.areSelectionValuesReversed())for(;P.start+P.length>this._bufferService.cols;)P.length-=this._bufferService.cols,R++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?P.start:P.start+P.length,R]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const P=this._bufferService.buffer.getWrappedRangeForLine(A),R={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)(R,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,R){var F,q=arguments.length,W=q<3?A:R===null?R=Object.getOwnPropertyDescriptor(A,P):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,A,P,R);else for(var V=D.length-1;V>=0;V--)(F=D[V])&&(W=(q<3?F(W):q>3?F(A,P,W):F(A,P))||W);return q>3&&W&&Object.defineProperty(A,P,W),W},g=this&&this.__param||function(D,A){return function(P,R){A(P,R,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 R=A[P/36%6|0],F=A[P/6%6|0],q=A[P%6];D.push({css:v.channels.toCss(R,F,q),rgba:v.channels.toRgba(R,F,q)})}for(let P=0;P<24;P++){const R=8+10*P;D.push({css:v.channels.toCss(R,R,R),rgba:v.channels.toRgba(R,R,R)})}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 R=0;R<P;R++)A.ansi[R+16]=N(D.extendedAnsi[R],c.DEFAULT_ANSI_COLORS[R+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,R=T.rgba>>24&255,F=T.rgba>>16&255,q=T.rgba>>8&255;return d=R+Math.round((D-R)*m),f=F+Math.round((A-F)*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,R=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*(R<=.03928?R/12.92:Math.pow((R+.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,R=N>>16&255,F=N>>8&255;let q=D>>24&255,W=D>>16&255,V=D>>8&255,z=x(C.relativeLuminance2(q,W,V),C.relativeLuminance2(P,R,F));for(;z<A&&(q>0||W>0||V>0);)q-=Math.max(0,Math.ceil(.1*q)),W-=Math.max(0,Math.ceil(.1*W)),V-=Math.max(0,Math.ceil(.1*V)),z=x(C.relativeLuminance2(q,W,V),C.relativeLuminance2(P,R,F));return(q<<24|W<<16|V<<8|255)>>>0}function T(N,D,A){const P=N>>24&255,R=N>>16&255,F=N>>8&255;let q=D>>24&255,W=D>>16&255,V=D>>8&255,z=x(C.relativeLuminance2(q,W,V),C.relativeLuminance2(P,R,F));for(;z<A&&(q<255||W<255||V<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),W=Math.min(255,W+Math.ceil(.1*(255-W))),V=Math.min(255,V+Math.ceil(.1*(255-V))),z=x(C.relativeLuminance2(q,W,V),C.relativeLuminance2(P,R,F));return(q<<24|W<<16|V<<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,R=D>>8&255,F=N>>24&255,q=N>>16&255,W=N>>8&255;return d=F+Math.round((A-F)*m),f=q+Math.round((P-q)*m),g=W+Math.round((R-W)*m),v.toRgba(d,f,g)},_.ensureContrastRatio=function(N,D,A){const P=C.relativeLuminance(N>>8),R=C.relativeLuminance(D>>8);if(x(P,R)<A){if(R<P){const W=j(N,D,A),V=x(P,C.relativeLuminance(W>>8));if(V<A){const z=T(N,D,A);return V>x(P,C.relativeLuminance(z>>8))?W:z}return W}const F=T(N,D,A),q=x(P,C.relativeLuminance(F>>8));if(q<A){const W=j(N,D,A);return q>x(P,C.relativeLuminance(W>>8))?F:W}return F}},_.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((F=>{var q;(q=this._onScrollApi)==null||q.fire(F.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(F){for(const q in F)this.optionsService.options[q]=F[q]}constructor(F){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(F)),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(F,q){this._writeBuffer.write(F,q)}writeSync(F,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(F,q)}input(F,q=!0){this.coreService.triggerDataEvent(F,q)}resize(F,q){isNaN(F)||isNaN(q)||(F=Math.max(F,S.MINIMUM_COLS),q=Math.max(q,S.MINIMUM_ROWS),this._bufferService.resize(F,q))}scroll(F,q=!1){this._bufferService.scroll(F,q)}scrollLines(F,q,W){this._bufferService.scrollLines(F,q,W)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const q=F-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(F,q){return this._inputHandler.registerEscHandler(F,q)}registerDcsHandler(F,q){return this._inputHandler.registerDcsHandler(F,q)}registerCsiHandler(F,q){return this._inputHandler.registerCsiHandler(F,q)}registerOscHandler(F,q){return this._inputHandler.registerOscHandler(F,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?F=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const q of F)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,B,L,O){var $,U=arguments.length,ne=U<3?B:O===null?O=Object.getOwnPropertyDescriptor(B,L):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(Y,B,L,O);else for(var Q=Y.length-1;Q>=0;Q--)($=Y[Q])&&(ne=(U<3?$(ne):U>3?$(B,L,ne):$(B,L))||ne);return U>3&&ne&&Object.defineProperty(B,L,ne),ne},g=this&&this.__param||function(Y,B){return function(L,O){B(L,O,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),R={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function q(Y,B){if(Y>24)return B.setWinLines||!1;switch(Y){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.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 V=0;class z extends k.Disposable{getAttrData(){return this._curAttrData}constructor(B,L,O,$,U,ne,Q,ee,X=new S.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=L,this._coreService=O,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 H(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,ie)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:ie.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,ie,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:ie,data:re})})),this._parser.setDcsHandlerFallback(((G,ie,re)=>{ie==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:ie,payload:re})})),this._parser.setPrintHandler(((G,ie,re)=>this.print(G,ie,re))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!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((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new D.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new D.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new D.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new D.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new D.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new D.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new D.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new D.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new D.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new D.OscHandler((G=>this.restoreCursorColor(G)))),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 G in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((G,ie)=>this.requestStatusString(G,ie))))}_preserveStack(B,L,O,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=O,this._parseStack.position=$}_logSlowResolvingAsync(B){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([B,new Promise(((L,O)=>setTimeout((()=>O("#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(B,L){let O,$=this._activeBuffer.x,U=this._activeBuffer.y,ne=0;const Q=this._parseStack.paused;if(Q){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(O),O;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>F&&(ne=this._parseStack.position+F)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(G=>String.fromCharCode(G))).join("")}"`),typeof B=="string"?B.split("").map((G=>G.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<F&&(this._parseBuffer=new Uint32Array(Math.min(B.length,F))),Q||this._dirtyRowTracker.clearRange(),B.length>F)for(let G=ne;G<B.length;G+=F){const ie=G+F<B.length?G+F:B.length,re=typeof B=="string"?this._stringDecoder.decode(B.substring(G,ie),this._parseBuffer):this._utf8Decoder.decode(B.subarray(G,ie),this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,re))return this._preserveStack($,U,re,G),this._logSlowResolvingAsync(O),O}else if(!Q){const G=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,G))return this._preserveStack($,U,G,0),this._logSlowResolvingAsync(O),O}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(B,L,O){let $,U;const ne=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,G=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&&O-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<O;++ve){if($=B[ve],$<127&&ne){const Ue=ne[String.fromCharCode($)];Ue&&($=Ue.charCodeAt(0))}const Le=this._unicodeService.charProperties($,be);U=N.UnicodeService.extractWidth(Le);const Oe=N.UnicodeService.extractShouldJoin(Le),ze=Oe?N.UnicodeService.extractWidth(be):0;if(be=Le,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(G&&(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&&O-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(B,L){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,L):this._parser.registerCsiHandler(B,(O=>!q(O.params[0],this._optionsService.rawOptions.windowOptions)||L(O)))}registerDcsHandler(B,L){return this._parser.registerDcsHandler(B,new A.DcsHandler(L))}registerEscHandler(B,L){return this._parser.registerEscHandler(B,L)}registerOscHandler(B,L){return this._parser.registerOscHandler(B,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 B;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&&((B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&B.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 B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,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(B,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=B,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+L)}cursorUp(B){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const L=B.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const L=B.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,L,O,$=!1,U=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);ne.replaceCells(L,O,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(ne.isWrapped=!1)}_resetBufferLine(B,L=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),O.isWrapped=!1)}eraseInDisplay(B,L=!1){let O;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);O<this._bufferService.rows;O++)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(O);break;case 1:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,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(B,L=!1){switch(this._restrictCursor(this._bufferService.cols),B.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(B){this._restrictCursor();let L=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=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(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(B){this._restrictCursor();let L=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=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(O,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(B){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(B){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(B){let L=B.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(B){let L=B.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(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=B.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);$.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=B.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);$.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=B.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);$.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=B.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);$.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),$.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(B){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(B.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(B){const L=this._parser.precedingJoinState;if(!L)return!0;const O=B.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*O);let ee=0;for(let G=0;G<ne.length;){const ie=ne.codePointAt(G)||0;Q[ee++]=ie,G+=ie>65535?2:1}let X=ee;for(let G=1;G<O;++G)Q.copyWithin(X,0,ee),X+=ee;return this.print(Q,0,X),!0}sendDeviceAttributesPrimary(B){return B.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(B){return B.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(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let L=0;L<B.length;L++)switch(B.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(B){for(let L=0;L<B.length;L++)switch(B.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(B){for(let L=0;L<B.length;L++)switch(B.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(B){for(let L=0;L<B.length;L++)switch(B.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(),B.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(B,L){const O=this._coreService.decPrivateModes,{activeProtocol:$,activeEncoding:U}=this._coreMouseService,ne=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:X,alt:G}=Q,ie=this._optionsService.rawOptions,re=Oe=>Oe?1:2,be=B.params[0];return ve=be,Le=L?be===2?4:be===4?re(ne.modes.insertMode):be===12?3:be===20?re(ie.convertEol):0:be===1?re(O.applicationCursorKeys):be===3?ie.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:be===6?re(O.origin):be===7?re(O.wraparound):be===8?3:be===9?re($==="X10"):be===12?re(ie.cursorBlink):be===25?re(!ne.isCursorHidden):be===45?re(O.reverseWraparound):be===66?re(O.applicationKeypad):be===67?4:be===1e3?re($==="VT200"):be===1002?re($==="DRAG"):be===1003?re($==="ANY"):be===1004?re(O.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===G):be===2004?re(O.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${ve};${Le}$y`),!0;var ve,Le}_updateAttrColor(B,L,O,$,U){return L===2?(B|=50331648,B&=-16777216,B|=j.AttributeData.fromColorRGB([O,$,U])):L===5&&(B&=-50331904,B|=33554432|255&O),B}_extractColor(B,L,O){const $=[0,0,-1,0,0,0];let U=0,ne=0;do{if($[ne+U]=B.params[L+ne],B.hasSubParams(L+ne)){const Q=B.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<B.length&&ne+U<$.length);for(let Q=2;Q<$.length;++Q)$[Q]===-1&&($[Q]=0);switch($[0]){case 38:O.fg=this._updateAttrColor(O.fg,$[1],$[3],$[4],$[5]);break;case 48:O.bg=this._updateAttrColor(O.bg,$[1],$[3],$[4],$[5]);break;case 58:O.extended=O.extended.clone(),O.extended.underlineColor=this._updateAttrColor(O.extended.underlineColor,$[1],$[3],$[4],$[5])}return ne}_processUnderline(B,L){L.extended=L.extended.clone(),(!~B||B>5)&&(B=1),L.extended.underlineStyle=B,L.fg|=268435456,B===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(B){B.fg=y.DEFAULT_ATTR_DATA.fg,B.bg=y.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=B.length;let O;const $=this._curAttrData;for(let U=0;U<L;U++)O=B.params[U],O>=30&&O<=37?($.fg&=-50331904,$.fg|=16777216|O-30):O>=40&&O<=47?($.bg&=-50331904,$.bg|=16777216|O-40):O>=90&&O<=97?($.fg&=-50331904,$.fg|=16777224|O-90):O>=100&&O<=107?($.bg&=-50331904,$.bg|=16777224|O-100):O===0?this._processSGR0($):O===1?$.fg|=134217728:O===3?$.bg|=67108864:O===4?($.fg|=268435456,this._processUnderline(B.hasSubParams(U)?B.getSubParams(U)[0]:1,$)):O===5?$.fg|=536870912:O===7?$.fg|=67108864:O===8?$.fg|=1073741824:O===9?$.fg|=2147483648:O===2?$.bg|=134217728:O===21?this._processUnderline(2,$):O===22?($.fg&=-134217729,$.bg&=-134217729):O===23?$.bg&=-67108865:O===24?($.fg&=-268435457,this._processUnderline(0,$)):O===25?$.fg&=-536870913:O===27?$.fg&=-67108865:O===28?$.fg&=-1073741825:O===29?$.fg&=2147483647:O===39?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):O===49?($.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?U+=this._extractColor(B,U,$):O===53?$.bg|=1073741824:O===55?$.bg&=-1073741825:O===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):O===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.",O);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${O}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${O}R`)}return!0}softReset(B){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(B){const L=B.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 O=L%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(B){const L=B.params[0]||1;let O;return(B.length<2||(O=B.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(B){if(!q(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=B.length>1?B.params[1]:0;switch(B.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(B){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(B){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(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const L=[],O=B.split(";");for(;O.length>1;){const $=O.shift(),U=O.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(B){const L=B.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(B,L){this._getCurrentLinkId()&&this._finishHyperlink();const O=B.split(":");let $;const U=O.findIndex((ne=>ne.startsWith("id=")));return U!==-1&&($=O[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(B,L){const O=B.split(";");for(let $=0;$<O.length&&!(L>=this._specialColors.length);++$,++L)if(O[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const U=(0,P.parseColor)(O[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[L],color:U}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const L=[],O=B.split(";");for(let $=0;$<O.length;++$)if(/^\d+$/.exec(O[$])){const U=parseInt(O[$]);Z(U)&&L.push({type:2,index:U})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(B){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(B){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(B){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(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(R[B[0]],v.CHARSETS[B[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 B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,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(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new _.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const O=this._activeBuffer.ybase+this._activeBuffer.y+L,$=this._activeBuffer.lines.get(O);$&&($.fill(B),$.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,L){const O=this._bufferService.buffer,$=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,L){this._dirtyRowTracker.markRangeDirty(B,L)}}c.InputHandler=z;let H=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,B){Y>B&&(V=Y,Y=B,B=V),Y<this.start&&(this.start=Y),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Z(Y){return 0<=Y&&Y<256}H=f([g(0,T.IBufferService)],H)},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 R=this.ybase+this.y;if(R>=D&&R<D+P.length)continue;const F=P[P.length-1].getTrimmedLength(),q=(0,S.reflowSmallerGetNewLineLengths)(P,this._cols,x),W=q.length-P.length;let V;V=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 z=[];for(let O=0;O<W;O++){const $=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);z.push($)}z.length>0&&(T.push({start:D+P.length+N,newLines:z}),N+=z.length),P.push(...z);let H=q.length-1,Z=q[H];Z===0&&(H--,Z=q[H]);let Y=P.length-W-1,B=F;for(;Y>=0;){const O=Math.min(B,Z);if(P[H]===void 0)break;if(P[H].copyCellsFrom(P[Y],B-O,Z-O,O,!0),Z-=O,Z===0&&(H--,Z=q[H]),B-=O,B===0){Y--;const $=Math.max(Y,0);B=(0,S.getWrappedLineTrimmedLength)(P,$,this._cols)}}for(let O=0;O<P.length;O++)q[O]<x&&P[O].setCell(q[O],j);let L=W-V;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 H=0;H<this.lines.length;H++)A.push(this.lines.get(H));const P=this.lines.length;let R=P-1,F=0,q=T[F];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let W=0;for(let H=Math.min(this.lines.maxLength-1,P+N-1);H>=0;H--)if(q&&q.start>R+W){for(let Z=q.newLines.length-1;Z>=0;Z--)this.lines.set(H--,q.newLines[Z]);H++,D.push({index:R+1,amount:q.newLines.length}),W+=q.newLines.length,q=T[++F]}else this.lines.set(H,A[R--]);let V=0;for(let H=D.length-1;H>=0;H--)D[H].index+=V,this.lines.onInsertEmitter.fire(D[H]),V+=D[H].amount;const z=Math.max(0,P+N-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}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,R=m-j,F=Math.min(P,R);x[_].copyCellsFrom(x[T],N,j,F,!1),j+=F,j===m&&(_++,j=0),N+=F,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 R=P?P.length-1:-1;for(;R>=0&&(j=P[R](this._params),j!==!0);R--)if(j instanceof Promise)return this._preserveStack(3,P,R,N,A),j;R<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 F=this._escHandlers[this._collect<<8|T];let q=F?F.length-1:-1;for(;q>=0&&(j=F[q](),j!==!0);q--)if(j instanceof Promise)return this._preserveStack(4,F,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 R=_.length-1;R>=0;R--)(D=_[R])&&(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 uC=cC();/**
|
|
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 dC=2,hC=1,fC=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(dC,Math.floor(g/e.css.cell.width)),rows:Math.max(hC,Math.floor(f/e.css.cell.height))}}};function pC({sessionId:e,onClose:r,onEscape:s,autoFocus:i}){const l=I.useRef(null),u=I.useRef(e),h=I.useRef(null),c=I.useRef(null),d=Jn(g=>g.writeSession),f=Jn(g=>g.resizeSession);return I.useEffect(()=>{u.current=e},[e]),I.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]),I.useEffect(()=>{if(!l.current)return;const g=new uC.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new fC;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]),a.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[a.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[a.jsx("div",{}),a.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:a.jsx(ty,{})})]}),a.jsx("div",{ref:l,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{g.key==="Escape"&&s&&(g.preventDefault(),g.stopPropagation(),s())}})]})}const cy="openfox-chat-textarea";function uy(){const e=document.getElementById(cy);e&&e.focus()}function mC(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 gC({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]=I.useState(!0),g=I.useRef(null),m=I.useRef(!1),v=I.useRef(!1),S=I.useCallback(()=>{r()},[r]);return I.useEffect(()=>{c!=null&&c.workdir&&u(c.workdir)},[c==null?void 0:c.workdir,u]),I.useEffect(()=>{e?(f(!0),h(c==null?void 0:c.id).finally(()=>f(!1))):uy()},[e,h,c==null?void 0:c.id]),I.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]),I.useEffect(()=>{e?(m.current=!0,setTimeout(()=>{var k;(k=g.current)==null||k.focus(),setTimeout(()=>{m.current=!1},200)},100)):v.current=!1},[e]),I.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?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:S}),a.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:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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:a.jsx(Pw,{})}),a.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:a.jsx(Ph,{})})]})]}),a.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:d?a.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):l.length===0?a.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"mb-4",children:"No terminal sessions"}),a.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"})]})}):a.jsx("div",{className:`grid ${mC(l.length)} gap-2 h-full auto-rows-fr`,children:l.map(k=>a.jsx(pC,{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]=I.useState(!1),c=i!==void 0,d=c?i:u,f=R=>{if(c){const F=typeof R=="function"?R(u):R;l==null||l(F)}else h(R)},[g,m]=I.useState(null),v=I.useRef(null),S=I.useRef(null),[k,C]=I.useState(0),y=I.useRef(0),b=I.useRef(e),x=I.useCallback(()=>{if(!v.current)return;const R=v.current.getBoundingClientRect(),F=200,W=window.innerHeight-R.bottom<F;m({top:W?R.top-F-4:R.bottom+4,left:R.left,alignToTop:W})},[]);I.useEffect(()=>{b.current=e},[e]),I.useEffect(()=>{function R(F){if(S.current){const q=F.target;S.current.contains(q)||f(!1)}}return d&&document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}},[d]),I.useEffect(()=>{d&&x()},[d,x]),I.useEffect(()=>{if(!d)return;setTimeout(()=>{var F;(F=S.current)==null||F.focus()},0);function R(F){const q=b.current,W=q.filter(z=>!_(z)),V=j(y.current,q);switch(F.key){case"ArrowDown":if(F.preventDefault(),F.stopPropagation(),V<W.length-1){const z=T(y.current+1,q);y.current=z,C(z)}break;case"ArrowUp":if(F.preventDefault(),F.stopPropagation(),V>0){const z=N(y.current-1,q);y.current=z,C(z)}break;case"Enter":F.preventDefault(),F.stopPropagation(),D(y.current,q);break;case"Escape":F.preventDefault(),F.stopPropagation(),f(!1);break}}return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[d,e]);function _(R){var W;const F=R.label;return F?String(((W=F.props)==null?void 0:W.className)??"").includes("cursor-default"):!1}function j(R,F){let q=0;for(let W=0;W<R;W++){const V=F[W];V&&!_(V)&&q++}return q}function T(R,F){for(let q=R;q<F.length;q++){const W=F[q];if(W&&!_(W))return q}return R}function N(R,F){for(let q=R;q>=0;q--){const W=F[q];if(W&&!_(W))return q}return R}function D(R,F){var W;const q=F[R];!q||_(q)||((W=q.onClick)==null||W.call(q),q.href&&(window.history.pushState(null,"",q.href),window.dispatchEvent(new PopStateEvent("popstate"))),f(!1))}I.useEffect(()=>{d&&(C(e.findIndex(R=>!_(R))),y.current=e.findIndex(R=>!_(R)))},[d,e]);const A=R=>{R.stopPropagation(),d||x(),f(!d)},P=g&&a.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((R,F)=>{const W=!_(R)&&F===k,V=a.jsxs(a.Fragment,{children:[R.icon&&a.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:R.icon}),R.label]});return R.href?a.jsx(Mn,{href:R.href,onClick:z=>{var H;(H=R.onClick)==null||H.call(R,z),f(!1)},onAuxClick:()=>f(!1),className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${R.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${F!==e.length-1?"border-b border-border":""}`,children:V},F):a.jsx("button",{onClick:z=>{var H;(H=R.onClick)==null||H.call(R,z),R.closeOnClick!==!1&&f(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${R.danger?"text-accent-error hover:bg-accent-error/10":W?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${F!==e.length-1?"border-b border-border":""}`,children:V},F)})});return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"relative",children:a.jsx("div",{ref:v,onClick:A,children:r})}),d&&Fi.createPortal(P,document.body)]})}function dy(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 xC(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 hy(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 bC(e){const{year:r,month:s,day:i}=hy(e);return`${r}-${s}-${i}`}function fy(e){const r=new Map;for(const l of e){const u=bC(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 vC({items:e,trigger:r,isActive:s=!1}){const[i,l]=I.useState(!1),u=I.useRef(null);return I.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]),a.jsxs("div",{className:"relative",ref:u,children:[a.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"?a.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,a.jsx(fr,{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",rotate:i?180:0})]}),i&&e.length>0&&a.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 a.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?a.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):a.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 yC({projects:e,currentProject:r}){const s=Ot(h=>h.loadProject),i=Ot(h=>h.toggleStar),u=I.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:a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[a.jsx("span",{className:"truncate flex-1",children:h.name}),a.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?a.jsx(Uw,{className:"w-3.5 h-3.5 text-yellow-500"}):a.jsx($w,{className:"w-3.5 h-3.5 text-text-muted hover:text-yellow-500"})})]}),icon:h.id===r.id?a.jsx(hr,{}):void 0,href:`/p/${h.id}`,closeOnClick:!0,onClick:()=>{s(h.id)}}));return a.jsx(oo,{items:u,trigger:a.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,a.jsx(fr,{})]}),minWidth:"250px"})}function _C({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:a.jsxs(Mn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[a.jsx(Bi,{className:"w-3 h-3 text-accent-primary"}),a.jsx("span",{className:"text-sm",children:"New Session"})]})},...l.map(h=>({label:a.jsx(Mn,{href:`/p/${e.id}/s/${h.id}`,className:"flex items-center gap-2 truncate text-sm",children:a.jsx("span",{children:h.title??h.id.slice(0,8)})}),icon:h.id===(s==null?void 0:s.id)?a.jsx(hr,{className:"w-3 h-3"}):void 0})),{label:a.jsxs(Mn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[a.jsx(Nw,{className:"w-3 h-3"}),a.jsx("span",{className:"text-sm",children:"Projects"})]})}];return a.jsx(vC,{items:u,trigger:a.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function SC({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=fy(h),d=I.useMemo(()=>{const m=[];m.push({label:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Bi,{className:"w-4 h-4 text-accent-primary"}),a.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:a.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:dy(k.updatedAt)}),onClick:()=>{}});for(const C of S)m.push({label:a.jsxs("div",{className:"min-w-[160px]",children:[a.jsx("div",{className:"truncate text-sm",children:C.title??C.id.slice(0,8)}),a.jsx("div",{className:"text-text-muted text-xs",children:rc(C.updatedAt)})]}),icon:C.id===(s==null?void 0:s.id)?a.jsx(hr,{}):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 a.jsx(oo,{items:d,isOpen:i,onOpenChange:l,trigger:a.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,a.jsx(fr,{})]}),minWidth:"280px"})}function wC({onMenuClick:e,onCriteriaToggle:r}){const[s,i]=I.useState(!1),[l,u]=I.useState(!1),[h,c]=I.useState(!!document.fullscreenElement);I.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=kt(j=>j.startAutoRefresh),y=kt(j=>j.stopAutoRefresh),b=Jn(j=>j.setOpen),x=Jn(j=>j.isOpen);I.useEffect(()=>{const j=()=>u(!0);return window.addEventListener("open-session-dropdown",j),()=>window.removeEventListener("open-session-dropdown",j)},[]);const _=I.useRef(0);return I.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)},[]),I.useEffect(()=>(C(),()=>y()),[C,y]),a.jsxs("header",{className:"h-8 bg-secondary border-b border-border flex items-center justify-between px-2",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&f&&a.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:a.jsx(sb,{})}),a.jsx(Mn,{href:"/",className:"text-accent-primary font-semibold text-sm hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),S&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),a.jsx("span",{className:"hidden md:inline",children:a.jsx(yC,{projects:k,currentProject:S})}),a.jsx("span",{className:"md:hidden",children:a.jsx(_C,{currentProject:S,sessions:v,currentSession:m,projectIdFromUrl:f&&d.split("/")[2]||null},S==null?void 0:S.id)}),a.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),a.jsx("span",{className:"hidden md:inline",children:a.jsx(SC,{sessions:v,currentProject:S,currentSession:m,isOpen:l,onOpenChange:u})})]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[g&&a.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?a.jsx(Lw,{}):a.jsx(Rw,{})}),f&&a.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:a.jsx(Ww,{})}),a.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:a.jsx(Hw,{})}),a.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:a.jsx(Iw,{})}),r&&g&&a.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:a.jsx(sb,{})})]}),a.jsx(sC,{isOpen:s,onClose:()=>i(!1)}),a.jsx(gC,{isOpen:x,onClose:()=>b(!1)})]})}function CC({onCancel:e,onSave:r,saving:s,saveDisabled:i,cancelLabel:l="Cancel",saveLabel:u=s?"Saving...":"Save"}){return a.jsxs("div",{className:"flex justify-end gap-2 flex-shrink-0",children:[a.jsx(Ze,{variant:"secondary",onClick:e,children:l}),a.jsx(Ze,{variant:"primary",onClick:r,disabled:i??s,children:u})]})}function kC({isOpen:e,onClose:r,project:s}){const i=Ot(_=>_.updateProject),[l,u]=I.useState(s.customInstructions??""),[h,c]=I.useState(s.dangerLevel??""),[d,f]=I.useState(!1),[g,m]=I.useState(!1),[v,S]=I.useState(!1),k=d||g;I.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 a.jsx(St,{isOpen:e,onClose:x,title:`${s.name} Settings`,size:"lg",footer:a.jsx(CC,{onCancel:x,onSave:b,saving:v,saveDisabled:!k||v}),children:a.jsxs("div",{className:"flex flex-col gap-5 -mt-1",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Default Danger Level"}),a.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."}),a.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1 rounded bg-bg-tertiary/50 w-fit",children:[a.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"}),a.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"}),a.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"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Path"}),a.jsx("p",{className:"text-sm text-text-muted font-mono",children:s.workdir})]}),a.jsxs("div",{className:"flex-1 min-h-[150px] pb-4",children:[a.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Instructions"}),a.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."}),a.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&&a.jsx(Gh,{})]})})}const EC={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},jC="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 a.jsx(nc,{onClick:e,icon:jC,iconSize:EC[s],className:`${l} ${r}`,title:"Close"})}function py({projectId:e,isOpen:r=!0,onClose:s}){const[,i]=nr(),[l,u]=I.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=I.useRef(null),y=I.useCallback(()=>{v&&!S&&k&&m(k.id)},[v,S,k,m]);I.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(R=>R.id===T),A=(D==null?void 0:D.title)??T.slice(0,6),P=prompt("Rename session:",A);if(P!==null&&P.trim()!==""){const R=Se.getState().renameSession;R(T,P.trim())}},j=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),i(`/p/${e}`))};return a.jsxs(a.Fragment,{children:[r&&s&&a.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:s}),a.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:[a.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[a.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"}),a.jsx(oo,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:j,danger:!0}],trigger:a.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:a.jsx(Ih,{})})}),s&&a.jsx(lo,{onClick:s,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&a.jsx(kC,{isOpen:l,onClose:()=>u(!1),project:k}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?a.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"divide-y divide-border",children:NC(b,c,d,x,_,e)}),S&&a.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),a.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function NC(e,r,s,i,l,u){const h=fy(e);return Array.from(h).map(([c,d])=>{const f=d[0];return f?a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:dy(f.updatedAt)}),d.map(g=>{const m=(r==null?void 0:r.id)===g.id,v=s.includes(g.id),S=g.isRunning;return a.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${m?"bg-bg-tertiary":""}`,children:a.jsxs(Mn,{href:`/p/${u}/s/${g.id}`,className:`block ${m?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[a.jsxs("div",{className:"flex justify-between items-center mb-1",children:[a.jsx("span",{className:`font-medium truncate text-sm ${m?"text-accent-primary":"text-text-primary"}`,children:g.title??g.id.slice(0,6)}),a.jsx(oo,{items:[{label:"Rename session",onClick:k=>l(g.id,k)},{label:"Delete session",onClick:k=>i(g.id,k),danger:!0}],trigger:a.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:a.jsx(Ih,{})})})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[S?a.jsx(Fw,{}):v&&!m?a.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,a.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:rc(g.updatedAt)}),a.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[g.messageCount," messages"]})]})]})},g.id)})]},c):null})}const ub=["⠋","⠙","⠹","⠸","⠼","⠴"];function TC(){var c;const e=Ot(d=>d.currentProject),r=Se(d=>d.currentSession),s=Oh(),i=!1,l=I.useRef(0),u=I.useRef(null);I.useEffect(()=>(s?(u.current=window.setInterval(()=>{l.current=(l.current+1)%ub.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?`${ub[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 my(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 AC({isOpen:e,onClose:r,projectName:s,onConfirm:i}){const l=()=>{i(),r()};return a.jsx(St,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project"," ",a.jsx("span",{className:"font-semibold text-text-primary",children:s})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{variant:"secondary",onClick:r,children:"Cancel"}),a.jsx(Ze,{variant:"danger",onClick:l,children:"Delete"})]})]})})}const sc=I.forwardRef(({className:e="",...r},s)=>a.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 DC(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 gy({isOpen:e,onClose:r,path:s,onRetry:i}){const[l,u]=I.useState(!1),[h,c]=I.useState(null),[d,f]=I.useState(null);I.useEffect(()=>{e&&g()},[e]);const g=async()=>{try{const j=await(await Ce("/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=I.useCallback(async _=>{u(!0),c(null);try{const T=await(await Ce("/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 a.jsx(St,{isOpen:e,onClose:r,title:"Permission Denied",size:"sm",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-text-secondary",children:[a.jsx("p",{children:y?a.jsxs(a.Fragment,{children:["The group ",a.jsx("strong",{children:C})," doesn't have write access:"]}):b?a.jsxs(a.Fragment,{children:["You're not a member of group ",a.jsx("strong",{children:C}),":"]}):a.jsxs(a.Fragment,{children:["You're not a member of group ",a.jsx("strong",{children:C})," and it doesn't have write access:"]})}),a.jsx("p",{className:"mt-2 font-mono text-xs bg-bg-tertiary p-2 rounded break-all",children:s})]}),h?a.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?a.jsxs("div",{className:"flex flex-col gap-2",children:[y&&a.jsxs(a.Fragment,{children:[a.jsx(Ze,{type:"button",variant:"primary",onClick:()=>m("group"),disabled:l||!k,className:"w-full",children:l?"Granting access...":"Extend group permissions"}),a.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),a.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',s,'"']})]}),b&&a.jsxs(a.Fragment,{children:[a.jsx(Ze,{type:"button",variant:"primary",onClick:()=>m("join_group"),disabled:l||!k,className:"w-full",children:l?"Joining group...":"Join group"}),a.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),a.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",C," $USER"]})]}),x&&a.jsxs(a.Fragment,{children:[a.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"}),a.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),a.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",C," $USER",a.jsx("br",{}),'sudo chmod g+w "',s,'"']})]}),!k&&!h&&a.jsxs("div",{className:"text-xs text-text-secondary",children:[a.jsx("p",{children:"Passwordless sudo is not available. Please fix permissions manually:"}),a.jsxs("code",{className:"block mt-1 p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',s,'"']})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Ze,{type:"button",variant:"secondary",onClick:r,disabled:l,children:"Cancel"})})]}):null]})})}function LC({isOpen:e,onClose:r}){const[,s]=nr(),[i,l]=I.useState(""),[u,h]=I.useState(null),[c,d]=I.useState(!1),[f,g]=I.useState(""),[m,v]=I.useState(null),S=I.useRef(null);I.useEffect(()=>{e&&(Ce("/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=I.useCallback(async j=>{j.preventDefault();const T=DC(i);if(!T.valid){h(T.error);return}const N=`${f}/${i}`;await b(N)},[i,s,r,f]),C=I.useCallback(()=>{v(null)},[]),y=I.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 Ce("/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=I.useCallback(()=>{l(""),h(null),r()},[r]),_=i?`${f}/${i}`:"";return a.jsxs(a.Fragment,{children:[a.jsx(St,{isOpen:e,onClose:x,title:"Create New Project",size:"sm",children:a.jsxs("form",{onSubmit:k,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),a.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&&a.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",a.jsx("span",{className:"font-mono",children:_})]}),u&&a.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{type:"button",variant:"secondary",onClick:x,disabled:c,children:"Cancel"}),a.jsx(Ze,{type:"submit",variant:"primary",disabled:c||!i.trim(),"data-testid":"create-project-submit-button",className:"min-w-[100px]",children:c?a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Bi,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})}),m&&a.jsx(gy,{isOpen:!!m,onClose:C,path:m,onRetry:y})]})}const RC={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function co({size:e="md",className:r=""}){return a.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${RC[e]} ${r}`})}function OC({text:e,...r}){return a.jsxs("div",{className:"text-center",children:[a.jsx(co,{...r,className:"mx-auto mb-4"}),e&&a.jsx("div",{className:"text-text-secondary",children:e})]})}function xy({onSelect:e,onClose:r,initialPath:s}){const[i,l]=I.useState(null),[u,h]=I.useState(!0),[c,d]=I.useState(""),[f,g]=I.useState(-1),m=I.useRef(null),v=I.useRef([]),S=I.useCallback(async x=>{h(!0),d(""),g(-1);try{const _=x?`/api/directories?path=${encodeURIComponent(x)}`:"/api/directories",T=await(await Ce(_)).json();l(T)}catch(_){console.error("Failed to load directories:",_)}finally{h(!1)}},[]);I.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}))];I.useEffect(()=>{g(c?0:-1)},[c,C.length]),I.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 a.jsxs(St,{isOpen:!0,onClose:r,title:"Select Folder",size:"lg",children:[i&&a.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:a.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[k.map((x,_)=>a.jsxs("span",{className:"flex items-center shrink-0",children:[a.jsx("span",{className:"text-text-muted",children:"/"}),a.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&&a.jsx("button",{onClick:()=>S("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),a.jsx("div",{className:"px-4 mb-3",children:a.jsxs("div",{className:"relative",children:[a.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:a.jsx(zh,{})}),a.jsx(sc,{autoFocus:!0,ref:m,value:c,onChange:x=>d(x.target.value),onKeyDown:b,placeholder:"Filter directories...",className:"w-full pl-9"})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:u?a.jsx("div",{className:"p-8 text-center",children:a.jsx(co,{size:"sm"})}):y.length===0?a.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:c?"No matching directories":"No subdirectories"}):a.jsx("div",{className:"divide-y divide-border",children:y.map((x,_)=>a.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"?a.jsx(Ew,{className:"w-5 h-5 text-text-muted"}):a.jsx(Bh,{className:"w-5 h-5"}),a.jsx("span",{className:"flex-1",children:x.name}),_===f&&a.jsx("span",{className:"text-xs text-text-muted",children:"⏎ navigate · dbl-click select"})]},x.path))})}),a.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)&&a.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"}),a.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})}function MC({isOpen:e,onClose:r}){const[,s]=nr(),[i,l]=I.useState(!1),[u,h]=I.useState(null),[c,d]=I.useState(!1),f=Ot(R=>R.projects),g=Ot(R=>R.createProject),m=Ot(R=>R.listProjects),v=Ot(R=>R.deleteProject),[S,k]=I.useState(null),[C,y]=I.useState(null),[b,x]=I.useState(null);I.useEffect(()=>{Ce("/api/config").then(R=>R.json()).then(R=>{R.workdir&&h(R.workdir)})},[]),I.useEffect(()=>{e&&m()},[e,m]);const _=R=>{s(`/p/${R}`),r()},j=(R,F)=>{F.stopPropagation(),k(R)},T=()=>{S&&(v(S.id),k(null))},N=async R=>{const F=R.split("/").filter(Boolean).pop()??"",q=await g(F,R);return m(),y(R),D(q)?(x(q.error.path||R),!1):!0};function D(R){return R!=null&&typeof R=="object"&&"error"in R&&R.error!=null&&typeof R.error=="object"&&"code"in R.error&&R.error.code==="EACCES"}const A=I.useCallback(()=>{x(null)},[]),P=I.useCallback(async()=>{if(x(null),C){const R=C.split("/").filter(Boolean).pop()??"",F=await g(R,C);m(),y(C),D(F)&&x(F.error.path||C)}},[C,g,m,x]);return I.useEffect(()=>{if(C){const R=f.find(F=>F.workdir===C);R&&(s(`/p/${R.id}`),r(),y(null))}},[f,C,s,r]),e?a.jsxs(St,{isOpen:e,onClose:r,title:"Open Project",size:"xl",footer:a.jsx("div",{className:"flex justify-end gap-2",children:a.jsx(Ze,{variant:"secondary",onClick:r,children:"Close"})}),children:[a.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 -m-4",children:[a.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:[a.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 shrink-0",children:a.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:f.length===0?a.jsxs("div",{className:"p-6 text-center text-text-muted text-sm",children:[a.jsx("p",{className:"mb-2",children:"No recent projects"}),a.jsx("p",{className:"text-xs",children:'Click "Create new project" to add one'})]}):a.jsx("div",{className:"divide-y divide-border",children:f.map(R=>a.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[a.jsxs("button",{onClick:()=>_(R.id),className:"flex-1 flex items-center gap-3 text-left",children:[a.jsx(Bh,{className:"w-5 h-5 text-accent-primary"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium truncate",children:R.name}),a.jsx("div",{className:"text-xs text-text-muted truncate",children:my(R.workdir,32)})]})]}),a.jsx("button",{onClick:F=>j(R,F),className:"text-accent-error/70 hover:text-accent-error p-1",title:"Delete project",children:a.jsx(tc,{className:"w-4 h-4"})})]},R.id))})})]}),a.jsx("div",{className:"w-full sm:w-1/2 flex flex-col items-center justify-center p-6 sm:p-8 text-center",children:a.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-sm",children:[a.jsx(Ze,{variant:"primary",onClick:()=>d(!0),children:"Select existing project"}),a.jsx(Ze,{variant:"secondary",onClick:()=>l(!0),"data-testid":"open-project-create-button",children:"Create new project"})]})})]}),i&&a.jsx(LC,{isOpen:i,onClose:()=>l(!1)}),S&&a.jsx(AC,{isOpen:!0,onClose:()=>k(null),projectName:S.name,onConfirm:T}),c&&a.jsx(xy,{initialPath:u??void 0,onSelect:R=>{N(R).then(F=>{F&&d(!1)})},onClose:()=>d(!1)}),b&&a.jsx(gy,{isOpen:!0,onClose:A,path:b,onRetry:P})]}):null}function IC(){const[e,r]=I.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);I.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 a.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto bg-primary",children:[a.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[a.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),a.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),a.jsx(Ze,{variant:"primary",onClick:g,children:"Open Project"})]}),d.map(m=>{const v=f(m.id);return a.jsx("div",{className:"mb-6 md:mb-8",children:a.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[a.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[a.jsxs(Mn,{href:`/p/${m.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[a.jsx(Bh,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),a.jsx("span",{className:"text-text-primary font-semibold",children:m.name})]}),a.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"})]}),a.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 a.jsx(Mn,{href:C,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("div",{className:"text-sm text-text-muted truncate",children:S.title??S.id.slice(0,8)})})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("span",{className:"text-text-muted text-xs",children:xC(S.updatedAt)}),a.jsxs("span",{className:"text-text-muted text-xs",children:[S.messageCount," msgs"]})]})]})},S.id)}):a.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},m.id)}),d.length===0&&!l&&a.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."}),l&&a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(co,{})})]}),e&&a.jsx(MC,{isOpen:e,onClose:()=>r(!1)})]})}function BC(){const[,e]=Rh("/p/:projectId/new"),[,r]=nr(),s=e==null?void 0:e.projectId,i=Se(h=>h.createSession),l=Se(h=>h.resetPendingSessionCreate),u=I.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 I.useEffect(()=>{u()},[u]),a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(co,{})})}function zC(){const e=Ot(r=>r.currentProject);return a.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:a.jsxs("div",{className:"max-w-md",children:[a.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),a.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),a.jsxs("div",{className:"flex flex-col gap-3",children:[e&&a.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"}),a.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 PC(e){return`${e.providerId}::${e.model}`}function HC(e){return`${e.providerName} > ${e.model}`}function db(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 FC(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=PC(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=db(u);return{...h,key:l,label:HC(h),...c}});return{...db(r),modelGroups:i}}function UC(e){return I.useMemo(()=>FC(e),[e])}function by(){var l;const e=Se(u=>u.gitStatus),r=Se(u=>u.currentSession),[s,i]=I.useState(!0);return I.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 hb(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function $C(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 fb=["▁","▂","▃","▄","▅","▆","▇","█"];function qC(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 WC(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 GC(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}=WC(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]=fb[qC(S,c,d)]??fb[0]}return{blocks:f.join(""),minX:i,maxX:l,minY:c,maxY:d}}function pb(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function mb({data:e,width:r=60,height:s=78,label:i,xLabel:l,yLabel:u,showAxes:h=!0,formatY:c=pb,formatX:d=pb}){const f=I.useMemo(()=>{const g=GC(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?a.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[i&&a.jsx("div",{className:"mb-1",children:i}),a.jsx("div",{children:"No data"})]}):a.jsxs("div",{className:"font-mono text-xs",children:[i&&a.jsx("div",{className:"text-text-secondary mb-2",children:i}),a.jsxs("div",{className:"flex gap-3",children:[h&&a.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(g=>a.jsx("span",{children:c(g.value)},`${g.value}-${g.y}`))}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"relative h-[78px]",children:[a.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=>a.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=>a.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&&a.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(g=>a.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:a.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:a.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),h&&a.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[a.jsx("span",{className:"w-12"}),a.jsxs("span",{className:"flex-1 flex justify-between",children:[a.jsx("span",{children:d(f.minX)}),a.jsx("span",{children:l}),a.jsx("span",{children:d(f.maxX)})]})]}),u&&h&&a.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function VC({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 a.jsxs("div",{className:"space-y-5",children:[a.jsx(mb,{data:u,width:l,label:r,xLabel:i}),a.jsx(mb,{data:h,width:l,label:s,xLabel:i})]})}function KC(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 YC(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 XC(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 ZC(e){return e.callDataPoints.length>0?XC(e):YC(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 Va(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function QC(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`${Va(e)} t/s`}function vy(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function JC(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 e2({isOpen:e,onClose:r,stats:s}){const i=I.useRef(null),[l,u]=I.useState({}),[h,c]=I.useState(()=>{var k;return((k=s.modelGroups[0])==null?void 0:k.key)??""});I.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=I.useMemo(()=>s.modelGroups.find(k=>k.key===h)??s.modelGroups[0],[h,s.modelGroups]),f=I.useMemo(()=>d?KC(d):[],[d]),g=I.useMemo(()=>d?ZC(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=I.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),v=I.useCallback(()=>{if(!d)return;const k=JC(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),S=I.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 a.jsx(St,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:a.jsxs("div",{ref:i,className:"space-y-6",children:[a.jsx("section",{children:a.jsx("div",{className:"flex flex-wrap gap-2",children:s.modelGroups.map(k=>a.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&&a.jsxs("section",{children:[a.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[a.jsx(Or,{label:"AI Time",value:Hd(d.aiTime)}),a.jsx(Or,{label:"Total Time",value:Hd(d.totalTime)}),a.jsx(Or,{label:"Tool Time",value:Hd(d.toolTime)}),a.jsx(Or,{label:"Responses",value:d.responseCount.toString()}),a.jsx(Or,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[a.jsx(Or,{label:"Prefill Tokens",value:Bs(d.prefillTokens),subValue:`@ ${Va(d.avgPrefillSpeed)} tok/s`}),a.jsx(Or,{label:"Gen Tokens",value:Bs(d.generationTokens),subValue:`@ ${Va(d.avgGenerationSpeed)} tok/s`}),a.jsx(Or,{label:"Avg PP Speed",value:`${Va(d.avgPrefillSpeed)}`,subValue:"tok/s"}),a.jsx(Or,{label:"Avg TG Speed",value:`${Va(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&a.jsxs("section",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.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"}),a.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"})]})]}),a.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:a.jsx(VC,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&a.jsxs("section",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),a.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:a.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"w-[7%]"}),a.jsx("col",{className:"w-[14%]"}),a.jsx("col",{className:"w-[10%]"}),a.jsx("col",{className:"w-[14%]"}),a.jsx("col",{className:"w-[14%]"}),a.jsx("col",{className:"w-[14%]"}),a.jsx("col",{className:"w-[11%]"}),a.jsx("col",{className:"w-[2%]"})]}),a.jsx("thead",{children:a.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[a.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),a.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),a.jsx("th",{className:"px-2 py-2"})]})}),a.jsx("tbody",{children:f.map((k,C)=>a.jsxs(I.Fragment,{children:[a.jsx(t2,{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)=>a.jsx(n2,{dataPoint:y,index:b},`${y.messageId}-${y.callIndex}`))]},k.messageId))})]})})]})]})})}function Or({label:e,value:r,subValue:s}){return a.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[a.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),a.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),s&&a.jsx("div",{className:"text-text-muted text-xs",children:s})]})}function t2({row:e,index:r,isExpanded:s,onToggle:i}){const l=e.calls.length>0?QC(e.calls.map(u=>u.promptTokens)):`${Bs(e.prefillTokens)} ctx`;return a.jsxs("tr",{onClick:i,className:`${r%2===0?"bg-bg-tertiary/20":""} ${i?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[a.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),a.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:vy(e.timestamp)}),a.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:l.replace(/ ctx$/,"")}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.prefillSpeed)}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.generationSpeed)}),a.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),a.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?s?"v":">":""})]})}function n2({dataPoint:e,index:r}){const s=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[a.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]}),a.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:vy(e.timestamp)}),a.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Bs(e.promptTokens)}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.prefillSpeed)}),a.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:$l(e.generationSpeed)}),a.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),a.jsx("td",{className:"px-2 py-2"})]}),s&&a.jsx("tr",{className:`${r%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:a.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:a.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&a.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&a.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&a.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&a.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const r2={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"}},s2=I.memo(function({criteria:r}){if(r.length===0)return a.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 a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),a.jsx("span",{className:"text-text-secondary",children:r.length})]}),a.jsx("div",{className:"space-y-1",children:i.map(l=>{const u=r2[l];return a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),a.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),a.jsx("span",{className:"text-text-primary font-medium",children:s[l]})]},l)})})]})});function i2({isOpen:e,onClose:r}){const s=ur(C=>C.config),i=ur(C=>C.saveConfig),[l,u]=I.useState(""),[h,c]=I.useState(""),[d,f]=I.useState(!1),[g,m]=I.useState(!1),[v,S]=I.useState(!1);I.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 a.jsx(St,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),a.jsx("input",{className:"input w-full",type:"text",value:l,onChange:C=>u(C.target.value),placeholder:"npm run dev"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),a.jsx("input",{className:"input w-full",type:"text",value:h,onChange:C=>c(C.target.value),placeholder:"http://localhost:3000"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:C=>f(C.target.checked),className:"rounded border-border bg-bg-tertiary"}),a.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"checkbox",id:"disableInspect",checked:g,onChange:C=>m(C.target.checked),className:"rounded border-border bg-bg-tertiary"}),a.jsx("label",{htmlFor:"disableInspect",className:"text-xs text-text-secondary",children:"Disable inspect feedback"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),a.jsx("button",{className:"btn btn-primary",onClick:k,disabled:v||!l.trim()||!h.trim(),children:v?"Saving...":"Save"})]})]})})}const gb={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"},a2={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"},xb={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},o2="text-text-primary";function l2(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=gb[f];g&&d.push(g)}else if(f>=40&&f<=47){const g=a2[f];g&&d.push(g)}else if(f>=90&&f<=97){const g=gb[f];g&&d.push(g)}else if(f in xb){const g=xb[f];g&&d.push(g)}else f===39?d.push(o2):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:c2(e),className:"text-text-primary"}]}}function c2(e){return e.replace(new RegExp("\x1B\\[([0-9;]+)m","g"),"")}function ql(e){const r=l2(e),s=[];return r.forEach((i,l)=>{const u=i.text.split(`
|
|
87
|
-
`);u.forEach((h,c)=>{s.push(hn.createElement("span",{key:`${l}-${c}`,className:i.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},h)),c<u.length-1&&s.push(hn.createElement("br",{key:`${l}-${c}-br`}))})}),s.length===1?s[0]:s}function yy({logs:e,preRef:r,preClassName:s="text-sm font-mono"}){return a.jsx("pre",{ref:r,className:s,children:e.length===0?a.jsx("span",{className:"text-text-muted",children:"No output yet"}):e.map((i,l)=>a.jsx("span",{className:i.stream==="stderr"?"text-accent-warning":"",children:ql(i.content)},l))})}const _y=I.memo(function({title:r,logs:s,onClose:i,preClassName:l}){const u=I.useRef(null);return I.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[s]),a.jsx(St,{isOpen:!0,onClose:i,title:r,size:"full",children:a.jsx(yy,{logs:s,preRef:u,preClassName:l})})}),u2=I.memo(function({logs:r,anchorRef:s,isHiding:i,onExpand:l,onClose:u}){const[h,c]=I.useState(null),d=I.useRef(null);return I.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]),I.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),h?a.jsxs("div",{className:"relative",children:[a.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)=>a.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:ql(f.content)},g))}),a.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}),d2=I.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]=I.useState(!1),[v,S]=I.useState(!1),[k,C]=I.useState(!1),[y,b]=I.useState(!1),x=I.useRef(null),_=I.useRef(null),j=I.useRef(null),T=I.useRef(null),N=I.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}`,V=window.open(W,"_blank");if(V){N.current=V;const z=()=>{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)},"*"))},H=setInterval(()=>{z(),(!N.current||N.current.closed)&&clearInterval(H)},500);setTimeout(()=>clearInterval(H),5e3)}},A=(i==null?void 0:i.state)??"off",P=l!==null,R=A==="running"||A==="warning";I.useEffect(()=>{s(r??null)},[r,s]),I.useEffect(()=>{R&&d()},[R,d]),I.useEffect(()=>{j.current&&R&&(j.current.scrollTop=j.current.scrollHeight)},[u,R]);const F=()=>{R?c():h()};return a.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.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"}`}),a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),a.jsx("button",{onClick:()=>m(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:a.jsx(Ow,{})})]}),P?a.jsxs(a.Fragment,{children:[A==="running"||A==="warning"?a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:F,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:[a.jsx(ey,{}),"Stop"]}),(i==null?void 0:i.url)&&a.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:[a.jsx(Bw,{}),"Open"]})]}):a.jsx("button",{onClick:F,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"}),R&&a.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:[a.jsx(yy,{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(a.jsx(u2,{logs:u,anchorRef:T,isHiding:y,onExpand:()=>S(!0),onClose:()=>C(!1)}),document.body)]})]}):a.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"}),a.jsx(i2,{isOpen:g,onClose:()=>m(!1)}),v&&a.jsx(_y,{title:"Dev Server Logs",logs:u,onClose:()=>S(!1)})]})}),h2=I.memo(function({sessionId:r}){var S;const s=Ka(k=>k.processes),i=Ka(k=>k.stopProcess),[l,u]=I.useState(null),[h,c]=I.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 a.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),a.jsxs("span",{className:"text-xs text-text-muted",children:["(",f," running)"]})]})}),a.jsx("div",{className:"space-y-2",children:d.map(k=>a.jsx("div",{className:"border border-border rounded p-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[a.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(k.status)}`}),a.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),a.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),a.jsxs("div",{className:"flex gap-1 ml-2",children:[a.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"}),a.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&&a.jsx(_y,{title:((S=d.find(k=>k.id===l))==null?void 0:S.name)??"",logs:h,onClose:()=>{u(null),c([])}})]})});function f2({isOpen:e,onClose:r,versionInfo:s}){const[i,l]=I.useState("ready"),[u,h]=I.useState(""),[c,d]=I.useState(s);I.useEffect(()=>{if(e){if(s){d(s);return}fetch("/api/auto-update/check").then(g=>g.json()).then(g=>d({current:g.current,latest:g.latest})).catch(()=>{})}},[e]),I.useEffect(()=>{if(!e||i!=="updating")return;const g=setInterval(()=>{h(m=>m.length>=3?"":m+".")},400);return()=>clearInterval(g)},[e,i]);const f=I.useCallback(async()=>{l("updating");const g=(c==null?void 0:c.current)==="1.0.0"&&(c==null?void 0:c.latest)==="1.1.0";if(await Ce("/api/auto-update",{method:"POST"}),g){setTimeout(()=>{l("reloading"),localStorage.setItem("openfox_updated_to",(c==null?void 0:c.latest)??"unknown"),localStorage.setItem("update_pending","true"),setTimeout(()=>window.location.reload(),1e3)},5e3);return}let m=!1,v=!1;const S=setInterval(async()=>{try{(await fetch("/api/health")).ok&&m&&(v=!0,clearInterval(S),l("reloading"),localStorage.setItem("openfox_updated_to",(c==null?void 0:c.latest)??"unknown"),localStorage.setItem("update_pending","true"),window.location.reload())}catch{m=!0}},2e3);setTimeout(()=>{v||clearInterval(S)},3e5)},[c==null?void 0:c.current,c==null?void 0:c.latest]);return I.useEffect(()=>{e&&(l("ready"),h(""))},[e]),a.jsxs(St,{isOpen:e,onClose:i==="updating"?void 0:r,title:"New OpenFox Version Available",size:"sm",closeOnBackdropClick:i!=="updating",showCloseButton:i!=="updating",children:[a.jsxs("div",{className:"flex flex-col gap-4",children:[c&&a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{className:"text-text-muted",children:"Current version"}),a.jsx("span",{className:"text-text-primary font-mono",children:c.current})]}),c&&a.jsxs("div",{className:"flex justify-between text-sm pb-2",children:[a.jsx("span",{className:"text-text-muted",children:"Latest version"}),a.jsx("span",{className:"text-accent-primary font-mono font-semibold",children:c.latest})]}),i==="updating"&&a.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[a.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),a.jsxs("p",{className:"text-xs text-text-muted text-center",children:["Updating",u]})]}),i==="reloading"&&a.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[a.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),a.jsxs("p",{className:"text-xs text-text-muted text-center",children:["Update complete, reloading",u]})]})]}),i==="ready"&&a.jsx("button",{onClick:f,className:"w-full px-3 py-2 text-sm rounded bg-accent-primary hover:brightness-110 transition-all text-white font-medium",children:"Update OpenFox"}),i==="ready"&&a.jsx("div",{className:"flex justify-center mt-2",children:a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[a.jsx("span",{children:"⚠️"}),a.jsx("p",{className:"text-text-secondary",children:"Server will restart to apply this update. Sessions in progress will be interrupted."})]})})]})}function p2({file:e}){const r=my(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 a.jsxs("div",{className:"flex items-center justify-between gap-1 py-0.5 text-xs min-w-0",children:[a.jsx("span",{className:`truncate ${s}`,title:e.path,children:r}),i&&a.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 m2(){const{diff:e}=by();return e.loading?a.jsx("div",{className:"mt-3",children:a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[a.jsx("span",{className:"w-3 h-3 border border-border border-t-accent-primary rounded-full animate-spin"}),a.jsx("span",{children:"Checking changes..."})]})}):e.files.length===0?a.jsx("div",{className:"mt-3",children:a.jsx("p",{className:"text-xs text-text-muted text-center",children:"No changes"})}):a.jsx("div",{className:"mt-3 max-h-[150px] overflow-y-auto",children:a.jsx("div",{className:"pr-1",children:e.files.map((r,s)=>a.jsx(p2,{file:r},s))})})}function bb({summary:e,messages:r,workdir:s}){const[i,l]=I.useState(!1),[u,h]=I.useState(!1),[c,d]=I.useState(!1),[f,g]=I.useState(!1),m=UC(r),{branch:v}=by(),S=kt(y=>y.version),k=Se(y=>y.currentSession),C=I.useCallback(async()=>{h(!0);try{const y=await fetch("/api/auto-update/check");if(y.ok){const b=await y.json();d(b.isUpdateAvailable)}}catch{}finally{h(!1)}},[]);return I.useEffect(()=>{C()},[C]),I.useEffect(()=>{if(new URLSearchParams(window.location.search).get("test-update")==="1"){d(!0),g(!0);const b=new URL(window.location.href);b.searchParams.delete("test-update"),window.history.replaceState({},"",b.toString())}},[]),a.jsxs("div",{className:"flex flex-col h-full",children:[m&&a.jsxs("div",{className:"mb-4",children:[a.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:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[a.jsx("span",{className:"text-text-secondary",children:$C(m.aiTime)}),a.jsx("span",{className:"w-px h-3 bg-border"}),a.jsx("span",{className:"text-text-secondary",children:hb(m.avgPrefillSpeed)}),a.jsx("span",{children:"pp"}),a.jsx("span",{className:"w-px h-3 bg-border"}),a.jsx("span",{className:"text-text-secondary",children:hb(m.avgGenerationSpeed)}),a.jsx("span",{children:"tg"})]})}),a.jsx(e2,{isOpen:i,onClose:()=>l(!1),stats:m})]}),a.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?a.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):a.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),a.jsx(s2,{criteria:(k==null?void 0:k.criteria)??[]})]})]}),v&&a.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[a.jsx(Tw,{}),a.jsx("span",{className:"truncate text-text-secondary",title:v,children:v})]}),a.jsx(m2,{}),a.jsx(d2,{workdir:s}),a.jsx(h2,{sessionId:k==null?void 0:k.id}),S&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[a.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",a.jsxs("span",{className:"font-mono",children:["v",S]}),a.jsx("button",{onClick:()=>C(),disabled:u,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors disabled:opacity-50",title:"Check for updates",children:a.jsx(Jv,{className:`w-3 h-3 ${u?"animate-spin":""}`})})]}),c&&a.jsx("button",{onClick:()=>g(!0),className:"text-accent-primary hover:underline mt-1",children:"Update OpenFox →"})]}),a.jsx(f2,{isOpen:f,onClose:()=>g(!1),versionInfo:null})]})}function g2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:s,messages:i}){const l=Se(u=>u.currentSession);return a.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&a.jsx("div",{className:"fixed md:hidden inset-0 bg-secondary/50 z-40",onClick:s}),a.jsxs("div",{className:"flex h-full",children:[a.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden bg-secondary",children:e}),r?a.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-secondary",children:a.jsx(bb,{summary:(l==null?void 0:l.summary)??null,messages:i,workdir:l==null?void 0:l.workdir})}):a.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),a.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:a.jsx(bb,{summary:(l==null?void 0:l.summary)??null,messages:i,workdir:l==null?void 0:l.workdir})})]})]})}function x2(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Sy({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 a.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${l} ${i}`,children:a.jsx("div",{className:`h-full transition-all duration-300 ${x2(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function b2({dangerZone:e,size:r="md"}){return e?a.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function vb(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function v2(){const e=Se(m=>m.contextState),r=Se(m=>m.currentSession),s=Se(m=>m.compactContext),[i,l]=I.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 a.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-secondary",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("div",{className:"flex-1"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:vb(f,d),children:[Ul(u)," / ",Ul(h)]}),a.jsxs("span",{className:vb(f,d),children:["(",f,"%)"]}),a.jsx(Sy,{percent:f,dangerZone:d}),a.jsx(b2,{dangerZone:d}),c>0&&a.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[c,"x"]})]}),a.jsx("div",{className:"flex-1 flex justify-end",children:a.jsxs("div",{className:"relative",children:[a.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:a.jsx(Qv,{})}),i&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>l(!1)}),a.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:a.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:a.jsx("span",{className:d?"text-accent-error":"",children:"Compact"})})})]})]})})]})})}function y2({stats:e,onClose:r}){var s;return a.jsx(St,{isOpen:!0,onClose:r,title:"Turn Stats",size:"md",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[a.jsx(Al,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),a.jsx(Al,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),a.jsx(Al,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),a.jsx(Al,{label:"LLM Calls",value:String(((s=e.llmCalls)==null?void 0:s.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((i,l)=>a.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",l+1]}),a.jsxs("span",{className:"text-xs text-text-muted",children:[i.ttft.toFixed(2),"s TTFT · ",i.completionTime.toFixed(2),"s gen"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",a.jsxs("span",{className:"text-text-primary",children:[i.promptTokens," → ",i.completionTokens]})]}),a.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[i.temperature!==void 0&&a.jsx(Dl,{label:"temp",value:i.temperature.toFixed(2)}),i.topP!==void 0&&a.jsx(Dl,{label:"topP",value:i.topP.toFixed(2)}),i.topK!==void 0&&a.jsx(Dl,{label:"topK",value:String(i.topK)}),i.maxTokens!==void 0&&a.jsx(Dl,{label:"maxTok",value:String(i.maxTokens)})]})]})]},l))]})]})})}function Al({label:e,value:r}){return a.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[a.jsx("div",{className:"text-xs text-text-muted",children:e}),a.jsx("div",{className:"text-lg font-semibold text-text-primary",children:r})]})}function Dl({label:e,value:r}){return a.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[a.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 Ce("/api/workflows/template-variables")).json();e({templateVariables:i.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const i=await(await Ce("/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 Ce(`/api/workflows/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await Ce(`/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 Ce(`/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 Ce(`/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 yb(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 _2(e,r){const s={};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const S2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,w2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C2={};function _b(e,r){return(C2.jsx?w2:S2).test(e)}const k2=/[ \t\n\f\r]/g;function E2(e){return typeof e=="object"?e.type==="text"?Sb(e.value):!1:Sb(e)}function Sb(e){return e.replace(k2,"")===""}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 wy(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 j2=0;const Xe=Hs(),Gt=Hs(),ph=Hs(),we=Hs(),_t=Hs(),Ii=Hs(),On=Hs();function Hs(){return 2**++j2}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:Gt,commaOrSpaceSeparated:On,commaSeparated:Ii,number:we,overloadedBoolean:ph,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Fd=Object.keys(mh);class Kh extends kn{constructor(r,s,i,l){let u=-1;if(super(r,s),wb(this,"space",l),typeof i=="number")for(;++u<Fd.length;){const h=Fd[u];wb(this,Fd[u],(i&mh[h])===mh[h])}}}Kh.prototype.defined=!0;function wb(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 Kh(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 Cy=Ui({properties:{ariaActiveDescendant:null,ariaAtomic:Gt,ariaAutoComplete:null,ariaBusy:Gt,ariaChecked:Gt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:Gt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:Gt,ariaFlowTo:_t,ariaGrabbed:Gt,ariaHasPopup:null,ariaHidden:Gt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:we,ariaLive:null,ariaModal:Gt,ariaMultiLine:Gt,ariaMultiSelectable:Gt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Gt,ariaReadOnly:Gt,ariaRelevant:null,ariaRequired:Gt,ariaRoleDescription:_t,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Gt,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 ky(e,r){return r in e?e[r]:r}function Ey(e,r){return ky(e,r.toLowerCase())}const N2=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:Gt,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:Gt,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:Gt,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:Gt,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:Gt,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:Ey}),T2=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:ky}),jy=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()}}),Ny=Ui({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ey}),Ty=Ui({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),A2={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"},D2=/[A-Z]/g,Cb=/-[a-z]/g,L2=/^data[-\w.:]+$/i;function Ay(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"&&L2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Cb,O2);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Cb.test(u)){let h=u.replace(D2,R2);h.charAt(0)!=="-"&&(h="-"+h),r="data"+h}}l=Kh}return new l(i,r)}function R2(e){return"-"+e.toLowerCase()}function O2(e){return e.charAt(1).toUpperCase()}const Dy=wy([Cy,N2,jy,Ny,Ty],"html"),ic=wy([Cy,T2,jy,Ny,Ty],"svg");function kb(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function M2(e){return e.join(" ").trim()}var Ni={},Ud,Eb;function I2(){if(Eb)return Ud;Eb=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(V){var z=V.match(r);z&&(x+=z.length);var H=V.lastIndexOf(d);_=~H?V.length-H:_+V.length}function T(){var V={line:x,column:_};return function(z){return z.position=new N(V),P(),z}}function N(V){this.start=V,this.end={line:x,column:_},this.source=b.source}N.prototype.content=y;function D(V){var z=new Error(b.source+":"+x+":"+_+": "+V);if(z.reason=V,z.filename=b.source,z.line=x,z.column=_,z.source=y,!b.silent)throw z}function A(V){var z=V.exec(y);if(z){var H=z[0];return j(H),y=y.slice(H.length),z}}function P(){A(s)}function R(V){var z;for(V=V||[];z=F();)z!==!1&&V.push(z);return V}function F(){var V=T();if(!(f!=y.charAt(0)||g!=y.charAt(1))){for(var z=2;m!=y.charAt(z)&&(g!=y.charAt(z)||f!=y.charAt(z+1));)++z;if(z+=2,m===y.charAt(z-1))return D("End of comment missing");var H=y.slice(2,z-2);return _+=2,j(H),y=y.slice(z),_+=2,V({type:v,comment:H})}}function q(){var V=T(),z=A(i);if(z){if(F(),!A(l))return D("property missing ':'");var H=A(u),Z=V({type:S,property:C(z[0].replace(e,m)),value:H?C(H[0].replace(e,m)):m});return A(h),Z}}function W(){var V=[];R(V);for(var z;z=q();)z!==!1&&(V.push(z),R(V));return V}return P(),W()}function C(y){return y?y.replace(c,m):m}return Ud=k,Ud}var jb;function B2(){if(jb)return Ni;jb=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(I2());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={},Nb;function z2(){if(Nb)return Ha;Nb=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,Tb;function P2(){if(Tb)return Fa;Tb=1;var e=Fa&&Fa.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(B2()),s=z2();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 H2=P2();const F2=Zl(H2),Ly=Ry("end"),Yh=Ry("start");function Ry(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 U2(e){const r=Yh(e),s=Ly(e);if(r&&s)return{start:r,end:s}}function Ya(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ab(e.position):"start"in e||"end"in e?Ab(e):"line"in e||"column"in e?gh(e):""}function gh(e){return Db(e&&e.line)+":"+Db(e&&e.column)}function Ab(e){return gh(e&&e.start)+"-"+gh(e&&e.end)}function Db(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 Xh={}.hasOwnProperty,$2=new Map,q2=/[A-Z]/g,W2=new Set(["table","tbody","thead","tfoot","tr"]),G2=new Set(["td","th"]),Oy="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function V2(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=tk(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=ek(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:Dy,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=My(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function My(e,r,s){if(r.type==="element")return K2(e,r,s);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return Y2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return Z2(e,r,s);if(r.type==="mdxjsEsm")return X2(e,r);if(r.type==="root")return Q2(e,r,s);if(r.type==="text")return J2(e,r)}function K2(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=By(e,r.tagName,!1),h=nk(e,r);let c=Qh(e,r);return W2.has(r.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!E2(d):!0})),Iy(e,h,u,r),Zh(h,c),e.ancestors.pop(),e.schema=i,e.create(r,u,h,s)}function Y2(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 X2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);to(e,r.position)}function Z2(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:By(e,r.name,!0),h=rk(e,r),c=Qh(e,r);return Iy(e,h,u,r),Zh(h,c),e.ancestors.pop(),e.schema=i,e.create(r,u,h,s)}function Q2(e,r,s){const i={};return Zh(i,Qh(e,r)),e.create(r,e.Fragment,i,s)}function J2(e,r){return r.value}function Iy(e,r,s,i){typeof s!="string"&&s!==e.Fragment&&e.passNode&&(r.node=i)}function Zh(e,r){if(r.length>0){const s=r.length>1?r:r[0];s&&(e.children=s)}}function ek(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 tk(e,r){return s;function s(i,l,u,h){const c=Array.isArray(u.children),d=Yh(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 nk(e,r){const s={};let i,l;for(l in r.properties)if(l!=="children"&&Xh.call(r.properties,l)){const u=sk(e,l,r.properties[l]);if(u){const[h,c]=u;e.tableCellAlignToStyle&&h==="align"&&typeof c=="string"&&G2.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 rk(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 Qh(e,r){const s=[];let i=-1;const l=e.passKeys?new Map:$2;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=My(e,u,h);c!==void 0&&s.push(c)}return s}function sk(e,r,s){const i=Ay(e.schema,r);if(!(s==null||typeof s=="number"&&Number.isNaN(s))){if(Array.isArray(s)&&(s=i.commaSeparated?_2(s):M2(s)),i.property==="style"){let l=typeof s=="object"?s:ik(e,String(s));return e.stylePropertyNameCase==="css"&&(l=ak(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&i.space?A2[i.property]||i.property:i.attribute,s]}}function ik(e,r){try{return F2(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=Oy+"#cannot-parse-style-attribute",l}}function By(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=_b(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=_b(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(i.type==="Literal"){const l=i.value;return Xh.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=Oy+"#cannot-handle-mdx-estrees-without-createevaluater",s}function ak(e){const r={};let s;for(s in e)Xh.call(e,s)&&(r[ok(s)]=e[s]);return r}function ok(e){let r=e.replace(q2,lk);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function lk(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"]},ck={};function Jh(e,r){const s=ck,i=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,l=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return zy(e,i,l)}function zy(e,r,s){if(uk(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 Lb(e.children,r,s)}return Array.isArray(e)?Lb(e,r,s):""}function Lb(e,r,s){const i=[];let l=-1;for(;++l<e.length;)i[l]=zy(e[l],r,s);return i.join("")}function uk(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 Ob={}.hasOwnProperty;function Py(e){const r={};let s=-1;for(;++s<e.length;)dk(r,e[s]);return r}function dk(e,r){let s;for(s in r){const l=(Ob.call(e,s)?e[s]:void 0)||(e[s]={}),u=r[s];let h;if(u)for(h in u){Ob.call(l,h)||(l[h]=[]);const c=u[h];hk(l[h],Array.isArray(c)?c:c?[c]:[])}}}function hk(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 Hy(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]/),fk=hs(/[#-'*+\--9=?A-Z^-~]/);function Wl(e){return e!==null&&(e<32||e===127)}const xh=hs(/\d/),pk=hs(/[\dA-Fa-f]/),mk=hs(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function nt(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 ot(e,r,s,i){const l=i?i-1:Number.POSITIVE_INFINITY;let u=0;return h;function h(d){return nt(d)?(e.enter(s),c(d)):r(d)}function c(d){return nt(d)&&u++<l?(e.consume(d),c):(e.exit(s),r(d))}}const gk={tokenize:xk};function xk(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"),ot(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 bk={tokenize:vk},Mb={tokenize:yk};function vk(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(Mb,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(Mb,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,R;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){if(P){R=r.events[A][1].end;break}P=!0}for(b(i),N=D;N<r.events.length;)r.events[N][1].end={...R},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 yk(e,r,s){return ot(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:_k,tokenize:Sk};function _k(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};Ib(m,-d),Ib(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 Sk(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 Ib(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const wk={name:"autolink",tokenize:Ck};function Ck(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):fk(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:kk};function kk(e,r,s){return i;function i(u){return nt(u)?ot(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?r(u):s(u)}}const Fy={continuation:{tokenize:jk},exit:Nk,name:"blockQuote",tokenize:Ek};function Ek(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 nt(h)?(e.enter("blockQuotePrefixWhitespace"),e.consume(h),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(h))}}function jk(e,r,s){const i=this;return l;function l(h){return nt(h)?ot(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):u(h)}function u(h){return e.attempt(Fy,r,s)(h)}}function Nk(e){e.exit("blockQuote")}const Uy={name:"characterEscape",tokenize:Tk};function Tk(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 mk(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):s(u)}}const $y={name:"characterReference",tokenize:Ak};function Ak(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=pk,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 Bb={partial:!0,tokenize:Lk},zb={concrete:!0,name:"codeFenced",tokenize:Dk};function Dk(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"),nt(N)?ot(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Pe(N)?(e.exit("codeFencedFence"),i.interrupt?r(N):e.check(Bb,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)):nt(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(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&&nt(N)?ot(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||Pe(N)?e.check(Bb,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 R;function R(z){return N.enter("lineEnding"),N.consume(z),N.exit("lineEnding"),F}function F(z){return N.enter("codeFencedFence"),nt(z)?ot(N,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):q(z)}function q(z){return z===c?(N.enter("codeFencedFenceSequence"),W(z)):A(z)}function W(z){return z===c?(P++,N.consume(z),W):P>=h?(N.exit("codeFencedFenceSequence"),nt(z)?ot(N,V,"whitespace")(z):V(z)):A(z)}function V(z){return z===null||Pe(z)?(N.exit("codeFencedFence"),D(z)):A(z)}}}function Lk(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:Ok},Rk={partial:!0,tokenize:Mk};function Ok(e,r,s){const i=this;return l;function l(f){return e.enter("codeIndented"),ot(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(Rk,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 Mk(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):ot(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 Ik={name:"codeText",previous:zk,resolve:Bk,tokenize:Pk};function Bk(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 zk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Pk(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 Hk{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 qy(e){const r={};let s=-1,i,l,u,h,c,d,f;const g=new Hk(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,Fk(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 Fk(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 Uk={resolve:qk,tokenize:Wk},$k={partial:!0,tokenize:Gk};function qk(e){return qy(e),e}function Wk(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($k,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 Gk(e,r,s){const i=this;return l;function l(h){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ot(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 Wy(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 Gy(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=!nt(S)),S===92?v:m)}function v(S){return S===91||S===92||S===93?(e.consume(S),c++,m):m(S)}}function Vy(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"),ot(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):nt(l)?ot(e,i,s?"linePrefix":"lineSuffix")(l):r(l)}}const Vk={name:"definition",tokenize:Yk},Kk={partial:!0,tokenize:Xk};function Yk(e,r,s){const i=this;let l;return u;function u(S){return e.enter("definition"),h(S)}function h(S){return Gy.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 Wy(e,g,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(Kk,m,m)(S)}function m(S){return nt(S)?ot(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 Xk(e,r,s){return i;function i(c){return yt(c)?Xa(e,l)(c):s(c)}function l(c){return Vy(e,u,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function u(c){return nt(c)?ot(e,h,"whitespace")(c):h(c)}function h(c){return c===null||Pe(c)?r(c):s(c)}}const Zk={name:"hardBreakEscape",tokenize:Qk};function Qk(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 Jk={name:"headingAtx",resolve:eE,tokenize:tE};function eE(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 tE(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)):nt(g)?ot(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 nE=["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"],Pb=["pre","script","style","textarea"],rE={concrete:!0,name:"htmlFlow",resolveTo:aE,tokenize:oE},sE={partial:!0,tokenize:cE},iE={partial:!0,tokenize:lE};function aE(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 oE(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&&Pb.includes(Q)?(l=1,i.interrupt?r(U):q(U)):nE.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 nt(U)?(e.consume(U),x):R(U)}function _(U){return U===47?(e.consume(U),R):U===58||U===95||gn(U)?(e.consume(U),j):nt(U)?(e.consume(U),_):R(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):nt(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):nt(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||nt(U)?_(U):s(U)}function R(U){return U===62?(e.consume(U),F):s(U)}function F(U){return U===null||Pe(U)?q(U):nt(U)?(e.consume(U),F):s(U)}function q(U){return U===45&&l===2?(e.consume(U),H):U===60&&l===1?(e.consume(U),Z):U===62&&l===4?(e.consume(U),O):U===63&&l===3?(e.consume(U),L):U===93&&l===5?(e.consume(U),B):Pe(U)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(sE,$,W)(U)):U===null||Pe(U)?(e.exit("htmlFlowData"),W(U)):(e.consume(U),q)}function W(U){return e.check(iE,V,$)(U)}function V(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),z}function z(U){return U===null||Pe(U)?W(U):(e.enter("htmlFlowData"),q(U))}function H(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 Pb.includes(ne)?(e.consume(U),O):q(U)}return gn(U)&&h.length<8?(e.consume(U),h+=String.fromCharCode(U),Y):q(U)}function B(U){return U===93?(e.consume(U),L):q(U)}function L(U){return U===62?(e.consume(U),O):U===45&&l===2?(e.consume(U),L):q(U)}function O(U){return U===null||Pe(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),O)}function $(U){return e.exit("htmlFlow"),r(U)}}function lE(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 cE(e,r,s){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(ho,r,s)}}const uE={name:"htmlText",tokenize:dE};function dE(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?H(L):L===45?v(L):m(L)}function k(L){const O="CDATA[";return L===O.charCodeAt(u++)?(e.consume(L),u===O.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?H(L):L===93?(e.consume(L),b):C(L)}function x(L){return L===null||L===62?H(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?H(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)):nt(L)?(e.consume(L),D):H(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),H):L===58||L===95||gn(L)?(e.consume(L),R):Pe(L)?(h=P,Z(L)):nt(L)?(e.consume(L),P):H(L)}function R(L){return L===45||L===46||L===58||L===95||fn(L)?(e.consume(L),R):F(L)}function F(L){return L===61?(e.consume(L),q):Pe(L)?(h=F,Z(L)):nt(L)?(e.consume(L),F):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)):nt(L)?(e.consume(L),q):(e.consume(L),V)}function W(L){return L===l?(e.consume(L),l=void 0,z):L===null?s(L):Pe(L)?(h=W,Z(L)):(e.consume(L),W)}function V(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),V)}function z(L){return L===47||L===62||yt(L)?P(L):s(L)}function H(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 nt(L)?ot(e,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):B(L)}function B(L){return e.enter("htmlTextData"),h(L)}}const ef={name:"labelEnd",resolveAll:mE,resolveTo:gE,tokenize:xE},hE={tokenize:bE},fE={tokenize:vE},pE={tokenize:yE};function mE(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 gE(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 xE(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(hE,g,h?g:m)(v):v===91?e.attempt(fE,g,h?f:m)(v):h?g(v):m(v)}function f(v){return e.attempt(pE,g,m)(v)}function g(v){return r(v)}function m(v){return u._balanced=!0,s(v)}}function bE(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):Wy(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?Vy(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 vE(e,r,s){const i=this;return l;function l(c){return Gy.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 yE(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 _E={name:"labelStartImage",resolveAll:ef.resolveAll,tokenize:SE};function SE(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 wE={name:"labelStartLink",resolveAll:ef.resolveAll,tokenize:CE};function CE(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:kE};function kE(e,r){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),ot(e,r,"linePrefix")}}const zl={name:"thematicBreak",tokenize:EE};function EE(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"),nt(f)?ot(e,c,"whitespace")(f):c(f))}}const Cn={continuation:{tokenize:AE},exit:LE,name:"list",tokenize:TE},jE={partial:!0,tokenize:RE},NE={partial:!0,tokenize:DE};function TE(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(jE,v,m))}function g(S){return i.containerState.initialBlankLine=!0,u++,v(S)}function m(S){return nt(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 AE(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,ot(e,r,"listItemIndent",i.containerState.size+1)(c)}function u(c){return i.containerState.furtherBlankLines||!nt(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(NE,r,h)(c))}function h(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,ot(e,e.attempt(Cn,r,s),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function DE(e,r,s){const i=this;return ot(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 LE(e){e.exit(this.containerState.type)}function RE(e,r,s){const i=this;return ot(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!nt(u)&&h&&h[1].type==="listItemPrefixWhitespace"?r(u):s(u)}}const Hb={name:"setextUnderline",resolveTo:OE,tokenize:ME};function OE(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 ME(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"),nt(f)?ot(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Pe(f)?(e.exit("setextHeadingLine"),r(f)):s(f)}}const IE={tokenize:BE};function BE(e){const r=this,s=e.attempt(ho,i,e.attempt(this.parser.constructs.flowInitial,l,ot(e,e.attempt(this.parser.constructs.flow,l,e.attempt(Uk,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 zE={resolveAll:Yy()},PE=Ky("string"),HE=Ky("text");function Ky(e){return{resolveAll:Yy(e==="text"?FE: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 Yy(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 FE(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 UE={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:Fy},$E={91:Vk},qE={[-2]:qd,[-1]:qd,32:qd},WE={35:Jk,42:zl,45:[Hb,zl],60:rE,61:Hb,95:zl,96:zb,126:zb},GE={38:$y,92:Uy},VE={[-5]:Wd,[-4]:Wd,[-3]:Wd,33:_E,38:$y,42:bh,60:[wk,uE],91:wE,92:[Zk,Uy],93:ef,95:bh,96:Ik},KE={null:[bh,zE]},YE={null:[42,95]},XE={null:[]},ZE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YE,contentInitial:$E,disable:XE,document:UE,flow:WE,flowInitial:qE,insideSpan:KE,string:GE,text:VE},Symbol.toStringTag,{value:"Module"}));function QE(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(F){return h=Yn(h,F),y(),h[h.length-1]!==null?[]:(A(r,0),f.events=oc(u,f.events,f),f.events)}function v(F,q){return ej(S(F),q)}function S(F){return JE(h,F)}function k(){const{_bufferIndex:F,_index:q,line:W,column:V,offset:z}=i;return{_bufferIndex:F,_index:q,line:W,column:V,offset:z}}function C(F){l[F.line]=F.column,R()}function y(){let F;for(;i._index<h.length;){const q=h[i._index];if(typeof q=="string")for(F=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===F&&i._bufferIndex<q.length;)b(q.charCodeAt(i._bufferIndex));else b(q)}}function b(F){g=g(F)}function x(F){Pe(F)?(i.line++,i.column=1,i.offset+=F===-3?2:1,R()):F!==-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=F}function _(F,q){const W=q||{};return W.type=F,W.start=k(),f.events.push(["enter",W,f]),c.push(W),W}function j(F){const q=c.pop();return q.end=k(),f.events.push(["exit",q,f]),q}function T(F,q){A(F,q.from)}function N(F,q){q.restore()}function D(F,q){return W;function W(V,z,H){let Z,Y,B,L;return Array.isArray(V)?$(V):"tokenize"in V?$([V]):O(V);function O(ee){return X;function X(G){const ie=G!==null&&ee[G],re=G!==null&&ee.null,be=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(re)?re:re?[re]:[]];return $(be)(G)}}function $(ee){return Z=ee,Y=0,ee.length===0?H:U(ee[Y])}function U(ee){return X;function X(G){return L=P(),B=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)(G)}}function ne(ee){return F(B,L),z}function Q(ee){return L.restore(),++Y<Z.length?U(Z[Y]):H}}}function A(F,q){F.resolveAll&&!u.includes(F)&&u.push(F),F.resolve&&In(f.events,q,f.events.length-q,F.resolve(f.events.slice(q),f)),F.resolveTo&&(f.events=F.resolveTo(f.events,f))}function P(){const F=k(),q=f.previous,W=f.currentConstruct,V=f.events.length,z=Array.from(c);return{from:V,restore:H};function H(){i=F,f.previous=q,f.currentConstruct=W,f.events.length=V,c=z,R()}}function R(){i.line in l&&i.column<2&&(i.column=l[i.line],i.offset+=l[i.line]-1)}}function JE(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 ej(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 tj(e){const i={constructs:Py([ZE,...(e||{}).extensions||[]]),content:l(gk),defined:[],document:l(bk),flow:l(IE),lazy:{},string:l(PE),text:l(HE)};return i;function l(u){return h;function h(c){return QE(i,u,c)}}}function nj(e){for(;!qy(e););return e}const Fb=/[\0\t\n\r]/g;function rj(){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(Fb.lastIndex=m,f=Fb.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 sj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ij(e){return e.replace(sj,aj)}function aj(e,r,s){if(r)return r;if(s.charCodeAt(0)===35){const l=s.charCodeAt(1),u=l===120||l===88;return Hy(s.slice(u?2:1),u?16:10)}return no(s)||e}const Xy={}.hasOwnProperty;function oj(e,r,s){return r&&typeof r=="object"&&(s=r,r=void 0),lj(s)(nj(tj(s).document().write(rj()(e,r,!0))))}function lj(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(Le),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:G,blockQuote:d(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:X,codeFenced:d(y),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:k,codeFlowValue:R,codeIndented:d(b),codeText:d(z),codeTextData:R,data:R,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:_,emphasis:d(),hardBreakEscape:d(q),hardBreakTrailing:d(q),htmlFlow:d(W),htmlFlowData:R,htmlText:d(V),htmlTextData:R,image:d(Z),label:B,labelText:Y,lineEnding:F,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ne,resourceDestinationString:L,resourceTitleString:O,resource:$,setextHeading:d(A),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};Zy(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 Ge=-1;for(;++Ge<ce.length;)if(ce[Ge][1].type==="listOrdered"||ce[Ge][1].type==="listUnordered")if(ce[Ge][0]==="enter")Ie.push(Ge);else{const At=Ie.pop();Ge=l(ce,At,Ge)}for(Ge=-1;++Ge<ce.length;){const At=r[ce[Ge][0]];Xy.call(At,ce[Ge][1].type)&&At[ce[Ge][1].type].call(Object.assign({sliceSerialize:ce[Ge][2].sliceSerialize},Ae),ce[Ge][1])}if(Ae.tokenStack.length>0){const At=Ae.tokenStack[Ae.tokenStack.length-1];(At[1]||Ub).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})},Ge=-1;++Ge<r.transforms.length;)_e=r.transforms[Ge](_e)||_e;return _e}function l(ce,_e,Ae){let Ie=_e-1,Ge=-1,At=!1,Je,Mt,Dt,ue;for(;++Ie<=Ae;){const Ee=ce[Ie];switch(Ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ee[0]==="enter"?Ge++:Ge--,ue=void 0;break}case"lineEndingBlank":{Ee[0]==="enter"&&(Je&&!ue&&!Ge&&!Dt&&(Dt=Ie),ue=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ue=void 0}if(!Ge&&Ee[0]==="enter"&&Ee[1].type==="listItemPrefix"||Ge===-1&&Ee[0]==="exit"&&(Ee[1].type==="listUnordered"||Ee[1].type==="listOrdered")){if(Je){let Ve=Ie;for(Mt=void 0;Ve--;){const lt=ce[Ve];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=Ve}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)&&(Je._spread=!0),Je.end=Object.assign({},Mt?ce[Mt][1].start:Ee[1].end),ce.splice(Mt||Ie,0,["exit",Je,Ee[2]]),Ie++,Ae++}if(Ee[1].type==="listItemPrefix"){const Ve={type:"listItem",_spread:!1,start:Object.assign({},Ee[1].start),end:void 0};Je=Ve,ce.splice(Ie,0,["enter",Ve,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]||Ub).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 Jh(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 R(ce){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ce),_e.position.end=ls(ce.end)}function F(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),R.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 V(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function z(){const ce=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ce}function H(){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=ij(_e),Ae.identifier=tr(_e).toLowerCase()}function B(){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 O(){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=Hy(_e,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=no(_e);const Ge=this.stack[this.stack.length-1];Ge.value+=Ie}function X(ce){const _e=this.stack.pop();_e.position.end=ls(ce.end)}function G(ce){R.call(this,ce);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ce)}function ie(ce){R.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 Le(){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 Zy(e,r){let s=-1;for(;++s<r.length;){const i=r[s];Array.isArray(i)?Zy(e,i):cj(e,i)}}function cj(e,r){let s;for(s in r)if(Xy.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 Ub(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 uj(e){const r=this;r.parser=s;function s(i){return oj(i,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function dj(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 hj(e,r){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,s),[e.applyData(r,s),{type:"text",value:`
|
|
97
|
-
`}]}function fj(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 pj(e,r){const s={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function mj(e,r){const s={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function gj(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 xj(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 bj(e,r){if(e.options.allowDangerousHtml){const s={type:"raw",value:r.value};return e.patch(r,s),e.applyData(r,s)}}function Qy(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 vj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Qy(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 yj(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 _j(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 Sj(e,r){const s=String(r.identifier).toUpperCase(),i=e.definitionById.get(s);if(!i)return Qy(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 wj(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 Cj(e,r,s){const i=e.all(r),l=s?kj(s):Jy(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 kj(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=Jy(s[i])}return r}function Jy(e){const r=e.spread;return r??e.children.length>1}function Ej(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 jj(e,r){const s={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function Nj(e,r){const s={type:"root",children:e.wrap(e.all(r))};return e.patch(r,s),e.applyData(r,s)}function Tj(e,r){const s={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function Aj(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=Yh(r.children[1]),d=Ly(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 Dj(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 Lj(e,r){const s={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}const $b=9,qb=32;function Rj(e){const r=String(e),s=/\r?\n|\r/g;let i=s.exec(r),l=0;const u=[];for(;i;)u.push(Wb(r.slice(l,i.index),l>0,!0),i[0]),l=i.index+i[0].length,i=s.exec(r);return u.push(Wb(r.slice(l),l>0,!1)),u.join("")}function Wb(e,r,s){let i=0,l=e.length;if(r){let u=e.codePointAt(i);for(;u===$b||u===qb;)i++,u=e.codePointAt(i)}if(s){let u=e.codePointAt(l-1);for(;u===$b||u===qb;)l--,u=e.codePointAt(l-1)}return l>i?e.slice(i,l):""}function Oj(e,r){const s={type:"text",value:Rj(String(r.value))};return e.patch(r,s),e.applyData(r,s)}function Mj(e,r){const s={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,s),e.applyData(r,s)}const Ij={blockquote:dj,break:hj,code:fj,delete:pj,emphasis:mj,footnoteReference:gj,heading:xj,html:bj,imageReference:vj,image:yj,inlineCode:_j,linkReference:Sj,link:wj,listItem:Cj,list:Ej,paragraph:jj,root:Nj,strong:Tj,table:Aj,tableCell:Lj,tableRow:Dj,text:Oj,thematicBreak:Mj,toml:Ll,yaml:Ll,definition:Ll,footnoteDefinition:Ll};function Ll(){}const e0=-1,lc=0,Za=1,Gl=2,tf=3,nf=4,rf=5,sf=6,t0=7,n0=8,Gb=typeof self=="object"?self:globalThis,Bj=(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 e0:return s(h,l);case Za:{const c=s([],l);for(const d of h)c.push(i(d));return c}case Gl:{const c=s({},l);for(const[d,f]of h)c[i(d)]=i(f);return c}case tf:return s(new Date(h),l);case nf:{const{source:c,flags:d}=h;return s(new RegExp(c,d),l)}case rf:{const c=s(new Map,l);for(const[d,f]of h)c.set(i(d),i(f));return c}case sf:{const c=s(new Set,l);for(const d of h)c.add(i(d));return c}case t0:{const{name:c,message:d}=h;return s(new Gb[c](d),l)}case n0: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 Gb[u](h),l)};return i},Vb=e=>Bj(new Map,e)(0),Ti="",{toString:zj}={},{keys:Pj}=Object,$a=e=>{const r=typeof e;if(r!=="object"||!e)return[lc,r];const s=zj.call(e).slice(8,-1);switch(s){case"Array":return[Za,Ti];case"Object":return[Gl,Ti];case"Date":return[tf,Ti];case"RegExp":return[nf,Ti];case"Map":return[rf,Ti];case"Set":return[sf,Ti];case"DataView":return[Za,s]}return s.includes("Array")?[Za,s]:s.includes("Error")?[t0,s]:[Gl,s]},Rl=([e,r])=>e===lc&&(r==="function"||r==="symbol"),Hj=(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=n0,g=h.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([e0],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 Gl:{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 Pj(h))(e||!Rl($a(h[v])))&&g.push([u(v),u(h[v])]);return m}case tf:return l([c,h.toISOString()],h);case nf:{const{source:g,flags:m}=h;return l([c,{source:g,flags:m}],h)}case rf:{const g=[],m=l([c,g],h);for(const[v,S]of h)(e||!(Rl($a(v))||Rl($a(S))))&&g.push([u(v),u(S)]);return m}case sf:{const g=[],m=l([c,g],h);for(const v of h)(e||!Rl($a(v)))&&g.push(u(v));return m}}const{message:f}=h;return l([c,{name:d,message:f}],h)};return u},Kb=(e,{json:r,lossy:s}={})=>{const i=[];return Hj(!(r||s),!!r,new Map,i)(e),i},Vl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?Vb(Kb(e,r)):structuredClone(e):(e,r)=>Vb(Kb(e,r));function Fj(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 Uj(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function $j(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=e.options.footnoteBackContent||Fj,i=e.options.footnoteBackLabel||Uj,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:{...Vl(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 Vj;if(typeof e=="function")return uc(e);if(typeof e=="object")return Array.isArray(e)?qj(e):Wj(e);if(typeof e=="string")return Gj(e);throw new Error("Expected function, string, or object as test")});function qj(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 Wj(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 Gj(e){return uc(r);function r(s){return s&&s.type===e}}function uc(e){return r;function r(s,i,l){return!!(Kj(s)&&e.call(this,s,typeof i=="number"?i:void 0,l||void 0))}}function Vj(){return!0}function Kj(e){return e!==null&&typeof e=="object"&&"type"in e}const r0=[],Yj=!0,vh=!1,Xj="skip";function s0(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=r0,k,C,y;if((!r||u(d,f,g[g.length-1]||void 0))&&(S=Zj(s(d,g)),S[0]===vh))return S;if("children"in d&&d.children){const b=d;if(b.children&&S[0]!==Xj)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 Zj(e){return Array.isArray(e)?e:typeof e=="number"?[Yj,e]:e==null?r0:[e]}function af(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),s0(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,Qj={};function Jj(e,r){const s=r||Qj,i=new Map,l=new Map,u=new Map,h={...Ij,...s.handlers},c={all:f,applyData:tN,definitionById:i,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:h,one:d,options:s,patch:eN,wrap:rN};return af(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=Vl(y);return b.children=c.all(g),b}return Vl(g)}return(c.options.unknownHandler||nN)(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=Yb(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=Yb(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function eN(e,r){e.position&&(r.position=U2(e))}function tN(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,Vl(u)),"children"in s&&s.children&&l!==null&&l!==void 0&&(s.children=l)}return s}function nN(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 rN(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 Yb(e){let r=0,s=e.charCodeAt(r);for(;s===9||s===32;)r++,s=e.charCodeAt(r);return e.slice(r)}function Xb(e,r){const s=Jj(e,r),i=s.one(e,void 0),l=$j(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 sN(e,r){return e&&"run"in e?async function(s,i){const l=Xb(s,{file:i,...r});await e.run(l,i)}:function(s,i){return Xb(s,{file:i,...e||r})}}function Zb(e){if(e)throw e}var Gd,Qb;function iN(){if(Qb)return Gd;Qb=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 Gd=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},Gd}var aN=iN();const Vd=Zl(aN);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 oN(){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?lN(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 lN(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:cN,dirname:uN,extname:dN,join:hN,sep:"/"};function cN(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 uN(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 dN(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 hN(...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?".":fN(s)}function fN(e){fo(e);const r=e.codePointAt(0)===47;let s=pN(e,!r);return s.length===0&&!r&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),r?"/"+s:s}function pN(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 mN={cwd:gN};function gN(){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 xN(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 bN(e)}function bN(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 i0{constructor(r){let s;r?Sh(r)?s={path:r}:typeof r=="string"||vN(r)?s={value:r}:s=r:s={},this.cwd="cwd"in s?"":mN.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){Jb(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"),Jb(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=xN(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 Jb(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function vN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yN=(function(e){const i=this.constructor.prototype,l=i[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),_N={}.hasOwnProperty;class of extends yN{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=oN()}copy(){const r=new of;let s=-1;for(;++s<this.attachers.length;){const i=this.attachers[s];r.use(...i)}return r.data(Vd(!0,{},this.namespace)),r}data(r,s){return typeof r=="string"?arguments.length===2?(Jd("data",this.frozen),this.namespace[r]=s,this):_N.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);CN(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),tv("processSync","process",s),i;function l(u,h){s=!0,Zb(u),i=h}}run(r,s,i){ev(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),tv("runSync","run",i),l;function u(h,c){Zb(h),l=c,i=!0}}stringify(r,s){this.freeze();const i=Ol(s),l=this.compiler||this.Compiler;return Qd("stringify",l),ev(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=Vd(!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=Vd(!0,C,S)),i[v]=[f,S,...k]}}}}const SN=new of().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 ev(e){if(!_h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function tv(e,r,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Ol(e){return wN(e)?e:new i0(e)}function wN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function CN(e){return typeof e=="string"||kN(e)}function kN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const EN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nv=[],rv={allowDangerousHtml:!0},jN=/^(https?|ircs?|mailto|xmpp)$/i,NN=[{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 TN(e){const r=AN(e),s=DN(e);return LN(r.runSync(r.parse(s),s),e)}function AN(e){const r=e.rehypePlugins||nv,s=e.remarkPlugins||nv,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...rv}:rv;return SN().use(uj).use(s).use(sN,i).use(r)}function DN(e){const r=e.children||"",s=new i0;return typeof r=="string"&&(s.value=r),s}function LN(e,r){const s=r.allowedElements,i=r.allowElement,l=r.components,u=r.disallowedElements,h=r.skipHtml,c=r.unwrapDisallowed,d=r.urlTransform||RN;for(const g of NN)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+EN+g.id,void 0);return af(e,f),V2(e,{Fragment:a.Fragment,components:l,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.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 RN(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||jN.test(e.slice(0,r))?e:""}function sv(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 ON(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function MN(e,r,s){const l=cc((s||{}).ignore||[]),u=IN(r);let h=-1;for(;++h<u.length;)s0(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 IN(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([BN(l[0]),zN(l[1])])}return r}function BN(e){return typeof e=="string"?new RegExp(ON(e),"g"):e}function zN(e){return typeof e=="function"?e:function(){return e}}const eh="phrasing",th=["autolink","link","image","label"];function PN(){return{transforms:[GN],enter:{literalAutolink:FN,literalAutolinkEmail:nh,literalAutolinkHttp:nh,literalAutolinkWww:nh},exit:{literalAutolink:WN,literalAutolinkEmail:qN,literalAutolinkHttp:UN,literalAutolinkWww:$N}}}function HN(){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 FN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function nh(e){this.config.enter.autolinkProtocol.call(this,e)}function UN(e){this.config.exit.autolinkProtocol.call(this,e)}function $N(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 qN(e){this.config.exit.autolinkEmail.call(this,e)}function WN(e){this.exit(e)}function GN(e){MN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,VN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),KN]],{ignore:["link","linkReference"]})}function VN(e,r,s,i,l){let u="";if(!a0(l)||(/^w/i.test(r)&&(s=r+s,r="",u="http://"),!YN(s)))return!1;const h=XN(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 KN(e,r,s,i){return!a0(i,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+s,children:[{type:"text",value:r+"@"+s}]}}function YN(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 XN(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=sv(e,"(");let u=sv(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 a0(e,r){const s=e.input.charCodeAt(e.index-1);return(e.index===0||Ps(s)||ac(s))&&(!r||s!==47)}o0.peek=iT;function ZN(){this.buffer()}function QN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function JN(){this.buffer()}function eT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tT(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 nT(e){this.exit(e)}function rT(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 sT(e){this.exit(e)}function iT(){return"["}function o0(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 aT(){return{enter:{gfmFootnoteCallString:ZN,gfmFootnoteCall:QN,gfmFootnoteDefinitionLabelString:JN,gfmFootnoteDefinition:eT},exit:{gfmFootnoteCallString:tT,gfmFootnoteCall:nT,gfmFootnoteDefinitionLabelString:rT,gfmFootnoteDefinition:sT}}}function oT(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:s,footnoteReference:o0},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?l0:lT))),f(),d}}function lT(e,r,s){return r===0?e:l0(e,r,s)}function l0(e,r,s){return(s?"":" ")+e}const cT=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];c0.peek=pT;function uT(){return{canContainEols:["delete"],enter:{strikethrough:hT},exit:{strikethrough:fT}}}function dT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cT}],handlers:{delete:c0}}}function hT(e){this.enter({type:"delete",children:[]},e)}function fT(e){this.exit(e)}function c0(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 pT(){return"~"}function mT(e){return e.length}function gT(e,r){const s=r||{},i=(s.align||[]).concat(),l=s.stringLength||mT,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=xT(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]=iv(i[m]);else{const C=iv(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 xT(e){return e==null?"":String(e)}function iv(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 bT(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()),vT);return l(),h}function vT(e,r,s){return">"+(s?"":" ")+e}function yT(e,r){return av(e,r.inConstruct,!0)&&!av(e,r.notInConstruct,!1)}function av(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 ov(e,r,s,i){let l=-1;for(;++l<s.unsafe.length;)if(s.unsafe[l].character===`
|
|
109
|
-
`&&yT(s.stack,s.unsafe[l]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
110
|
-
`}function _T(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 ST(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 wT(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 CT(e,r,s,i){const l=wT(s),u=e.value||"",h=l==="`"?"GraveAccent":"Tilde";if(ST(e,s)){const m=s.enter("codeIndented"),v=s.indentLines(u,kT);return m(),v}const c=s.createTracker(i),d=l.repeat(Math.max(_T(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 kT(e,r,s){return(s?"":" ")+e}function lf(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 ET(e,r,s,i){const l=lf(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 jT(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}}u0.peek=NT;function u0(e,r,s,i){const l=jT(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 NT(e,r,s){return s.options.emphasis||"*"}function TT(e,r){let s=!1;return af(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)&&Jh(e)&&(r.options.setext||s))}function AT(e,r,s,i){const l=Math.max(Math.min(6,e.depth||1),1),u=s.createTracker(i);if(TT(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}d0.peek=DT;function d0(e){return e.value||""}function DT(){return"<"}h0.peek=LT;function h0(e,r,s,i){const l=lf(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 LT(){return"!"}f0.peek=RT;function f0(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 RT(){return"!"}p0.peek=OT;function p0(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 OT(){return"`"}function m0(e,r){const s=Jh(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))}g0.peek=MT;function g0(e,r,s,i){const l=lf(s),u=l==='"'?"Quote":"Apostrophe",h=s.createTracker(i);let c,d;if(m0(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 MT(e,r,s){return m0(e,s)?"<":"["}x0.peek=IT;function x0(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 IT(){return"["}function cf(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 BT(e){const r=cf(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 zT(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 b0(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 PT(e,r,s,i){const l=s.enter("list"),u=s.bulletCurrent;let h=e.ordered?zT(s):cf(s);const c=e.ordered?h==="."?")":".":BT(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),b0(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 HT(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 FT(e,r,s,i){const l=HT(s);let u=s.bulletCurrent||cf(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 UT(e,r,s,i){const l=s.enter("paragraph"),u=s.enter("phrasing"),h=s.containerPhrasing(e,i);return u(),l(),h}const $T=cc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function qT(e,r,s,i){return(e.children.some(function(h){return $T(h)})?s.containerPhrasing:s.containerFlow).call(s,e,i)}function WT(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}v0.peek=GT;function v0(e,r,s,i){const l=WT(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 GT(e,r,s){return s.options.strong||"*"}function VT(e,r,s,i){return s.safe(e.value,i)}function KT(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 YT(e,r,s){const i=(b0(s)+(s.options.ruleSpaces?" ":"")).repeat(KT(s));return s.options.ruleSpaces?i.slice(0,-1):i}const y0={blockquote:bT,break:ov,code:CT,definition:ET,emphasis:u0,hardBreak:ov,heading:AT,html:d0,image:h0,imageReference:f0,inlineCode:p0,link:g0,linkReference:x0,list:PT,listItem:FT,paragraph:UT,root:qT,strong:v0,text:VT,thematicBreak:YT};function XT(){return{enter:{table:ZT,tableData:lv,tableHeader:lv,tableRow:JT},exit:{codeText:e3,table:QT,tableData:rh,tableHeader:rh,tableRow:rh}}}function ZT(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 QT(e){this.exit(e),this.data.inTable=void 0}function JT(e){this.enter({type:"tableRow",children:[]},e)}function rh(e){this.exit(e)}function lv(e){this.enter({type:"tableCell",children:[]},e)}function e3(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,t3));const s=this.stack[this.stack.length-1];s.type,s.value=r,this.exit(e)}function t3(e,r){return r==="|"?r:e}function n3(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 gT(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=y0.inlineCode(S,k,C);return C.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function r3(){return{exit:{taskListCheckValueChecked:cv,taskListCheckValueUnchecked:cv,paragraph:i3}}}function s3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:a3}}}function cv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function i3(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 a3(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=y0.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 o3(){return[PN(),aT(),uT(),XT(),r3()]}function l3(e){return{extensions:[HN(),oT(e),dT(),n3(e),s3()]}}const c3={tokenize:m3,partial:!0},_0={tokenize:g3,partial:!0},S0={tokenize:x3,partial:!0},w0={tokenize:b3,partial:!0},u3={tokenize:v3,partial:!0},C0={name:"wwwAutolink",tokenize:f3,previous:E0},k0={name:"protocolAutolink",tokenize:p3,previous:j0},Br={name:"emailAutolink",tokenize:h3,previous:N0},pr={};function d3(){return{text:pr}}let Ds=48;for(;Ds<123;)pr[Ds]=Br,Ds++,Ds===58?Ds=65:Ds===91&&(Ds=97);pr[43]=Br;pr[45]=Br;pr[46]=Br;pr[95]=Br;pr[72]=[Br,k0];pr[104]=[Br,k0];pr[87]=[Br,C0];pr[119]=[Br,C0];function h3(e,r,s){const i=this;let l,u;return h;function h(m){return!wh(m)||!N0.call(i,i.previous)||uf(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(u3,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 f3(e,r,s){const i=this;return l;function l(h){return h!==87&&h!==119||!E0.call(i,i.previous)||uf(i.events)?s(h):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(c3,e.attempt(_0,e.attempt(S0,u),s),s)(h))}function u(h){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(h)}}function p3(e,r,s){const i=this;let l="",u=!1;return h;function h(m){return(m===72||m===104)&&j0.call(i,i.previous)&&!uf(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(_0,e.attempt(S0,g),s)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function m3(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 g3(e,r,s){let i,l,u;return h;function h(f){return f===46||f===95?e.check(w0,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 x3(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(w0,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 b3(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 v3(e,r,s){return i;function i(u){return e.consume(u),l}function l(u){return fn(u)?s(u):r(u)}}function E0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function j0(e){return!gn(e)}function N0(e){return!(e===47||wh(e))}function wh(e){return e===43||e===45||e===46||e===95||fn(e)}function uf(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 y3={tokenize:N3,partial:!0};function _3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:k3,continuation:{tokenize:E3},exit:j3}},text:{91:{name:"gfmFootnoteCall",tokenize:C3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:S3,resolveTo:w3}}}}function S3(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 w3(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 C3(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 k3(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),ot(e,S,"gfmFootnoteDefinitionWhitespace")):s(k)}function S(k){return r(k)}}function E3(e,r,s){return e.check(ho,r,e.attempt(y3,r,s))}function j3(e){e.exit("gfmFootnoteDefinition")}function N3(e,r,s){const i=this;return ot(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 T3(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 A3{constructor(){this.map=[]}add(r,s,i){D3(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 D3(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 L3(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 R3(){return{flow:{null:{name:"table",tokenize:O3,resolveAll:M3}}}}function O3(e,r,s){const i=this;let l=0,u=0,h;return c;function c(R){let F=i.events.length-1;for(;F>-1;){const V=i.events[F][1].type;if(V==="lineEnding"||V==="linePrefix")F--;else break}const q=F>-1?i.events[F][1].type:null,W=q==="tableHead"||q==="tableRow"?N:d;return W===N&&i.parser.lazy[i.now().line]?s(R):W(R)}function d(R){return e.enter("tableHead"),e.enter("tableRow"),f(R)}function f(R){return R===124||(h=!0,u+=1),g(R)}function g(R){return R===null?s(R):Pe(R)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),S):s(R):nt(R)?ot(e,g,"whitespace")(R):(u+=1,h&&(h=!1,l+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),h=!0,g):(e.enter("data"),m(R)))}function m(R){return R===null||R===124||yt(R)?(e.exit("data"),g(R)):(e.consume(R),R===92?v:m)}function v(R){return R===92||R===124?(e.consume(R),m):m(R)}function S(R){return i.interrupt=!1,i.parser.lazy[i.now().line]?s(R):(e.enter("tableDelimiterRow"),h=!1,nt(R)?ot(e,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):k(R))}function k(R){return R===45||R===58?y(R):R===124?(h=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),C):T(R)}function C(R){return nt(R)?ot(e,y,"whitespace")(R):y(R)}function y(R){return R===58?(u+=1,h=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),b):R===45?(u+=1,b(R)):R===null||Pe(R)?j(R):T(R)}function b(R){return R===45?(e.enter("tableDelimiterFiller"),x(R)):T(R)}function x(R){return R===45?(e.consume(R),x):R===58?(h=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(R))}function _(R){return nt(R)?ot(e,j,"whitespace")(R):j(R)}function j(R){return R===124?k(R):R===null||Pe(R)?!h||l!==u?T(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(R)):T(R)}function T(R){return s(R)}function N(R){return e.enter("tableRow"),D(R)}function D(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),D):R===null||Pe(R)?(e.exit("tableRow"),r(R)):nt(R)?ot(e,D,"whitespace")(R):(e.enter("data"),A(R))}function A(R){return R===null||R===124||yt(R)?(e.exit("data"),D(R)):(e.consume(R),R===92?P:A)}function P(R){return R===92||R===124?(e.consume(R),A):A(R)}}function M3(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 A3;for(;++s<e.length;){const S=e[s],k=S[1];S[0]==="enter"?k.type==="tableHead"?(c=!1,d!==0&&(uv(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&&uv(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=L3(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({},Ri(r.events,s[0])),e.add(s[0],0,[["exit",u,r]]));const d=Ri(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=Ri(r.events,s[2]),g=Ri(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({},Ri(r.events,l)),e.add(l,0,[["exit",u,r]]),u=void 0),u}function uv(e,r,s,i,l){const u=[],h=Ri(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 Ri(e,r){const s=e[r],i=s[0]==="enter"?"start":"end";return s[1][i]}const I3={name:"tasklistCheck",tokenize:z3};function B3(){return{text:{91:I3}}}function z3(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):nt(d)?e.check({tokenize:P3},r,s)(d):s(d)}}function P3(e,r,s){return ot(e,i,"whitespace");function i(l){return l===null?s(l):r(l)}}function H3(e){return Py([d3(),_3(),T3(e),R3(),B3()])}const F3={};function U3(e){const r=this,s=e||F3,i=r.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),h=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(H3(s)),u.push(o3()),h.push(l3(s))}function $3(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 q3(e,r){if(e==null)return{};var s,i,l=$3(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 W3(e){if(Array.isArray(e))return Ch(e)}function G3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function V3(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 K3(){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 W3(e)||G3(e)||V3(e)||K3()}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 Y3(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 X3(e){var r=Y3(e,"string");return so(r)=="symbol"?r:r+""}function T0(e,r,s){return(r=X3(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 dv(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?dv(Object(s),!0).forEach(function(i){T0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):dv(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}function Z3(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 Q3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return sh[r]||(sh[r]=Z3(e)),sh[r]}function J3(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=Q3(i);return l.reduce(function(u,h){return Oi(Oi({},u),s[h])},r)}function hv(e){return e.join(" ")}function e5(e,r){var s=0;return function(i){return s+=1,i.map(function(l,u){return A0({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(s,"-").concat(u)})})}}function A0(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=e5(s,u),v;if(!u)v=Oi(Oi({},c),{},{className:hv(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:hv(C)||void 0,style:J3(c.className,Object.assign({},c.style,l),s)})}var y=m(r.children);return hn.createElement(f,Eh({key:h},v),y)}}const t5=(function(e,r){var s=e.listLanguages();return s.indexOf(r)!==-1});var n5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function fv(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?fv(Object(s),!0).forEach(function(i){T0(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):fv(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var r5=/\n/g;function s5(e){return e.match(r5)}function i5(e){var r=e.lines,s=e.startingLineNumber,i=e.style;return r.map(function(l,u){var h=u+s;return hn.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof i=="function"?i(h):i},"".concat(h,`
|
|
123
|
-
`))})}function a5(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 hn.createElement("code",{style:Object.assign({},s,l)},i5({lines:r.replace(/\n$/,"").split(`
|
|
124
|
-
`),style:h,startingLineNumber:c}))}function o5(e){return"".concat(e.toString().length,".25em")}function D0(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 L0(e,r,s){var i={display:"inline-block",minWidth:o5(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=L0(i,s,l);r.unshift(D0(s,C))}return m&g&&(k.style=us({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function R0(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)||[]);R0(l.children,h).forEach(function(c){return s.push(c)})}}return s}function l5(e,r,s,i,l,u,h,c,d){var f,g=R0(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=L0(c,N,h);T.unshift(D0(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=s5(D);if(A){var P=D.split(`
|
|
125
|
-
`);P.forEach(function(R,F){var q=i&&m.length+u,W={type:"text",value:"".concat(R,`
|
|
126
|
-
`)};if(F===0){var V=g.slice(v+1,S).concat(Pl({children:[W],className:N.properties.className})),z=y(V,q);m.push(z)}else if(F===P.length-1){var H=g[S+1]&&g[S+1].children&&g[S+1].children[0],Z={type:"text",value:"".concat(R)};if(H){var Y=Pl({children:[Z],className:N.properties.className});g.splice(S+1,0,Y)}else{var B=[Z],L=y(B,q,N.properties.className);m.push(L)}}else{var O=[W],$=y(O,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 c5(e){var r=e.rows,s=e.stylesheet,i=e.useInlineStyles;return r.map(function(l,u){return A0({node:l,stylesheet:s,useInlineStyles:i,key:"code-segment-".concat(u)})})}function O0(e){return e&&typeof e.highlightAuto<"u"}function u5(e){var r=e.astGenerator,s=e.language,i=e.code,l=e.defaultCodeValue;if(O0(r)){var u=t5(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 d5(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,R=i.wrapLongLines,F=R===void 0?!1:R,q=i.lineProps,W=q===void 0?{}:q,V=i.renderer,z=i.PreTag,H=z===void 0?"pre":z,Z=i.CodeTag,Y=Z===void 0?"code":Z,B=i.code,L=B===void 0?(Array.isArray(c)?c[0]:c)||"":B,O=i.astGenerator,$=q3(i,n5);O=O||e;var U=b?hn.createElement(a5,{containerStyle:N,codeStyle:S.style||{},numberStyle:A,startingLineNumber:T,codeString:L}):null,ne=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=O0(O)?"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(F?S.style=us({whiteSpace:"pre-wrap"},S.style):S.style=us({whiteSpace:"pre"},S.style),!O)return hn.createElement(H,ee,U,hn.createElement(Y,S,L));(P===void 0&&V||F)&&(P=!0),V=V||c5;var X=[{type:"text",value:L}],G=u5({astGenerator:O,language:h,code:L,defaultCodeValue:X});G.language===null&&(G.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=l5(G,P,W,b,_,T,re,A,F);return hn.createElement(H,ee,hn.createElement(Y,S,!_&&U,V({rows:be,stylesheet:f,useInlineStyles:C})))}}const pv=/[#.]/g;function h5(e,r){const s=e||"",i={};let l=0,u,h;for(;l<s.length;){pv.lastIndex=l;const c=pv.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 M0(e,r,s){const i=s?g5(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=h5(u,r);const f=d.tagName.toLowerCase(),g=i?i.get(f):void 0;if(d.tagName=g||f,f5(h))c.unshift(h);else for(const[m,v]of Object.entries(h))p5(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 f5(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 p5(e,r,s,i){const l=Ay(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=kb(i):l.commaSeparated?u=yb(i):l.commaOrSpaceSeparated?u=kb(yb(i).join(" ")):u=mv(l,l.property,i):Array.isArray(i)?u=[...i]:u=l.property==="style"?m5(i):String(i);if(Array.isArray(u)){const h=[];for(const c of u)h.push(mv(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 mv(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 m5(e){const r=[];for(const[s,i]of Object.entries(e))r.push([s,i].join(": "));return r.join("; ")}function g5(e){const r=new Map;for(const s of e)r.set(s.toLowerCase(),s);return r}const x5=["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"],b5=M0(Dy,"div");M0(ic,"g",x5);const v5=["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"],gv={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 I0(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function y5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function _5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function xv(e){return _5(e)||I0(e)}const S5=["","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 w5(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"?xv:T==="decimal"?I0:y5;for(j--;++j<=e.length;){const W=e.charCodeAt(j);if(!P(W))break;A+=String.fromCharCode(W),T==="named"&&v5.includes(A)&&(N=A,D=no(A))}let R=e.charCodeAt(j)===59;if(R){j++;const W=T==="named"?no(A):!1;W&&(N=A,D=W)}let F=1+j-x,q="";if(!(!R&&s.nonTerminated===!1))if(!A)T!=="named"&&C(4,F);else if(T==="named"){if(R&&!D)C(5,1);else if(N!==A&&(j=_+N.length,F=1+j-_,R=!1),!R){const W=N?1:3;if(s.attribute){const V=e.charCodeAt(j);V===61?(C(W,F),D=""):xv(V)?D="":C(W,F)}else C(W,F)}q=D}else{R||C(2,F);let W=Number.parseInt(A,T==="hexadecimal"?16:10);if(C5(W))C(7,F),q="�";else if(W in gv)C(6,F),q=gv[W];else{let V="";k5(W)&&C(6,F),W>65535&&(W-=65536,V+=String.fromCharCode(W>>>10|55296),W=56320|W&1023),q=V+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,S5[b],_,b))}function y(){c&&(l.push(c),s.text&&s.text.call(s.textContext||void 0,c,{start:v,end:k()}),c="")}}function C5(e){return e>=55296&&e<=57343||e>1114111}function k5(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 E5=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:++E5}),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 j5;return Hl(l,l.head,e),B0(e,l,r,l.head,0),T5(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 bv(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 B0(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=bv(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=bv(C,0,x,m),!j)continue;var A=j.index,P=j[0],R=x.slice(0,A),F=x.slice(A+P.length),q=b+x.length;u&&q>u.reach&&(u.reach=q);var W=y.prev;R&&(W=Hl(r,W,R),b+=R.length),N5(r,W,_);var V=new Qa(h,g?Qt.tokenize(P,g):P,S,P);if(y=Hl(r,W,V),F&&Hl(r,y,F),_>1){var z={cause:h+","+d,reach:q};B0(e,r,s,y.prev,b,z),u&&z.reach>u.reach&&(u.reach=z.reach)}}}}}}function j5(){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 N5(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 T5(e){for(var r=[],s=e.head.next;s!==e.tail;)r.push(s.value),s=s.next;return r}const z0=Qt;function P0(){}P0.prototype=z0;const Yt=new P0;Yt.highlight=A5;Yt.register=D5;Yt.alias=L5;Yt.registered=R5;Yt.listLanguages=O5;Yt.util.encode=M5;Yt.Token.stringify=Nh;function A5(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:z0.highlight.call(Yt,e,s,i)}}function D5(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 L5(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 R5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Yt.languages,e)}function O5(){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),b5(s.tag+"."+s.classes.join("."),I5(s.attributes),s.content)}function M5(e){return e}function I5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=w5(e[r]));return e}var mt=d5(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}df.displayName="sql";df.aliases=[];function df(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}hf.displayName="cpp";hf.aliases=[];function hf(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)}ff.displayName="bash";ff.aliases=["sh","shell"];function ff(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)}pf.displayName="yaml";pf.aliases=["yml"];function pf(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)}mf.displayName="markdown";mf.aliases=["md"];function mf(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)}gf.displayName="ruby";gf.aliases=["rb"];function gf(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)}xf.displayName="diff";xf.aliases=[];function xf(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)}bf.displayName="docker";bf.aliases=["dockerfile"];function bf(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)}vf.displayName="go";vf.aliases=[];function vf(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"]}yf.displayName="graphql";yf.aliases=[];function yf(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")}}}}})}_f.displayName="scss";_f.aliases=[];function _f(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}Sf.displayName="json";Sf.aliases=["webmanifest"];function Sf(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}wf.displayName="java";wf.aliases=[];function wf(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)}Cf.displayName="python";Cf.aliases=["py"];function Cf(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)}kf.displayName="tsx";kf.aliases=[];function kf(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)}Ef.displayName="rust";Ef.aliases=[];function Ef(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)}jf.displayName="toml";jf.aliases=[];function jf(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",kf);mt.registerLanguage("jsx",pc);mt.registerLanguage("python",Cf);mt.registerLanguage("bash",ff);mt.registerLanguage("json",Sf);mt.registerLanguage("css",dc);mt.registerLanguage("html",Fs);mt.registerLanguage("markup",Fs);mt.registerLanguage("xml",Fs);mt.registerLanguage("sql",df);mt.registerLanguage("yaml",pf);mt.registerLanguage("markdown",mf);mt.registerLanguage("diff",xf);mt.registerLanguage("rust",Ef);mt.registerLanguage("go",vf);mt.registerLanguage("java",wf);mt.registerLanguage("c",hc);mt.registerLanguage("cpp",hf);mt.registerLanguage("ruby",gf);mt.registerLanguage("toml",jf);mt.registerLanguage("scss",_f);mt.registerLanguage("graphql",yf);mt.registerLanguage("docker",bf);function H0(e=2e3){const[r,s]=I.useState(!1),i=I.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 B5(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 a.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}=H0();return a.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[a.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:[a.jsx("span",{children:d}),a.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?a.jsx(hr,{}):a.jsx(Mh,{})})]}),a.jsx("div",{className:"overflow-x-auto",children:a.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 a.jsx("p",{className:`${l} mb-1.5 last:mb-0 leading-tight`,children:i})},ul({children:i}){return a.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:i})},ol({children:i}){return a.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 a.jsx("li",{className:`${l} text-sm list-item`,children:i})},h1({children:i}){return a.jsx("h1",{className:`text-base font-bold mb-1.5 mt-2 first:mt-0 ${r}`,children:i})},h2({children:i}){return a.jsx("h2",{className:`text-sm font-bold mb-1.5 mt-2 first:mt-0 ${r}`,children:i})},h3({children:i}){return a.jsx("h3",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${r}`,children:i})},h4({children:i}){return a.jsx("h4",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${r}`,children:i})},strong({children:i}){return a.jsx("strong",{className:`font-bold ${s}`,children:i})},em({children:i}){return a.jsx("em",{className:e?"italic text-text-secondary":"italic",children:i})},a({href:i,children:l}){return a.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 a.jsx("blockquote",{className:`border-l-2 border-accent-primary pl-2 my-1.5 ${l} italic text-sm`,children:i})},table({children:i}){return a.jsx("div",{className:"overflow-x-auto my-1.5",children:a.jsx("table",{className:"min-w-full border border-border",children:i})})},th({children:i}){return a.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 a.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:i})},hr(){return a.jsx("hr",{className:"border-border my-2"})},input({checked:i,...l}){return a.jsx("input",{type:"checkbox",checked:i,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...l})}}}const Ir=I.memo(function({content:r,className:s="",muted:i=!1}){const l=I.useMemo(()=>{let h=z5(r);return h=P5(h),h},[r]),u=I.useMemo(()=>B5(i),[i]);return a.jsx("div",{className:`markdown-content [&_li>p]:inline ${s}`,children:a.jsx(TN,{remarkPlugins:[U3],components:u,children:l})})});function z5(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 P5(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 H5=I.memo(function({content:r,variant:s="default"}){return s==="labeled"?a.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[a.jsx("span",{className:"text-purple-400",children:"thinking:"}),a.jsx("div",{className:"ml-1.5 mt-0.5",children:a.jsx(Ir,{content:r})})]}):a.jsx("div",{className:"text-text-muted text-sm italic bg-secondary rounded p-1.5 feed-item",children:a.jsx(Ir,{content:r,muted:!0})})});function F0({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?a.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"?a.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})}):a.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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 F5={...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"}},U5={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?U5[i]??"text":"text"}const U0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},$5={...U0,display:"inline"},q5={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},io=I.memo(function({code:r,language:s,variant:i}){const l=i==="inline"?"span":i==="block-nowrap"?"div":"pre",u=i==="inline"?$5:i==="block-nowrap"?U0:q5;return a.jsx(mt,{style:F5,language:s,PreTag:l,customStyle:u,children:r})});function $0({src:e,alt:r,isOpen:s,onClose:i}){return s?a.jsx(St,{isOpen:s,onClose:i,title:"",size:"full",children:a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const W5=I.memo(function({oldString:r,newString:s,filePath:i}){const l=I.useMemo(()=>mc(i),[i]),u=r.split(`
|
|
131
|
-
`),h=s.split(`
|
|
132
|
-
`),c=r.length>0,d=s.length>0;return!c&&!d?a.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):a.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[c&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"bg-red-400/60"}),a.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:u.map((f,g)=>a.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),a.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:a.jsx(io,{code:r,language:l,variant:"block-nowrap"})})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"bg-green-400/60"}),a.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:h.map((f,g)=>a.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),a.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:a.jsx(io,{code:s,language:l,variant:"block-nowrap"})})]})]})}),G5=I.memo(function({content:r,filePath:s}){const i=I.useMemo(()=>mc(s),[s]);return a.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:a.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[a.jsx("div",{className:"bg-green-400/60"}),a.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
|
|
133
|
-
`).map((l,u)=>a.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),a.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:a.jsx(io,{code:r,language:i,variant:"block"})})]})})}),V5=I.memo(function({regions:r,filePath:s}){const i=I.useMemo(()=>mc(s),[s]);return r.length===0?a.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):a.jsx("div",{className:"space-y-2",children:r.map((l,u)=>a.jsx(K5,{region:l,language:i},u))})}),K5=I.memo(function({region:r,language:s}){const i=Y5(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 a.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:i.map((h,c)=>a.jsx(X5,{item:h,language:s,lineNumWidth:u},c))})});function Y5(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 X5=I.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 a.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${u}`,children:[a.jsx("div",{className:f}),a.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:l}),a.jsx("div",{className:`text-center select-none leading-[1.5rem] ${h}`,children:c}),a.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:a.jsx(io,{code:r.content||" ",language:s,variant:"inline"})})]})}),Z5=I.memo(function({result:r,metadata:s,filePath:i,heightExpanded:l=!1}){const[u,h]=I.useState(!1),c=I.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 a.jsxs(a.Fragment,{children:[a.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:a.jsx("img",{src:v,alt:i,className:"max-w-full max-h-[45vh] object-contain"})}),a.jsx($0,{src:v,alt:i,isOpen:u,onClose:()=>h(!1)})]})}if(!r)return a.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 a.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto p-2`,children:a.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 a.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto`,children:a.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[a.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 a.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:S+1},S)})}),a.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:a.jsx(io,{code:m,language:c,variant:"block"})})]})})}),Q5={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"}},vv=I.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 a.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[a.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[a.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),s.length>0&&a.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[s.length," error",s.length!==1?"s":""]}),i.length>0&&a.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[i.length," warning",i.length!==1?"s":""]}),l.length>0&&a.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),a.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,h)=>{const c=Q5[u.severity];return a.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${c.bg} border-b border-border last:border-b-0`,children:[a.jsx("span",{className:`${c.color} text-xs flex-shrink-0 w-4 text-center`,children:c.icon}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&a.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),a.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},h)})})]})}),J5=I.memo(function({command:r,timeout:s,startedAt:i,streamingOutput:l,status:u,result:h,error:c,durationMs:d}){const f=I.useRef(null),[g,m]=I.useState(0);I.useEffect(()=>{f.current&&u==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[l,u]),I.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 a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[a.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),a.jsx("code",{className:"text-text-primary break-all",children:r})]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&a.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&a.jsx("span",{className:"text-red-400",children:"interrupted"}),a.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",v,"s"]})]})]}),u==="pending"&&a.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:a.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/s*100)}%`}})}),(k||u==="pending")&&a.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)=>a.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:ql(C.content)},y)):ql(k)}),u==="error"&&c&&a.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:c}),u!=="pending"&&d!==void 0&&a.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function eA(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 tA({confirmation:e}){const r=Se(m=>m.confirmPath),s=Se(m=>m.currentSession),i=Se(m=>m.switchDangerLevel),{title:l,description:u}=eA(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 a.jsxs("div",{className:`border ${c} ${d} rounded p-3 my-2`,children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(dh,{}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:`text-sm font-medium ${h?"text-red-400":"text-amber-400"}`,children:l}),a.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),a.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[a.jsx("span",{className:"font-medium",children:e.tool})," wants to access:"]}),a.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:a.jsx("ul",{className:"space-y-0.5",children:e.paths.map((m,v)=>a.jsx("li",{className:`text-xs font-mono ${h?"text-red-300":"text-amber-300"} break-all`,children:m},v))})}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.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"}),a.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 nA(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 yv(e,r,s){return nA(e,r)}function rA(e){return JSON.stringify(e,null,2)}const sA={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}},iA=I.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]=I.useState(_),N=sA[i],D=Se(P=>P.pendingPathConfirmations),A=i==="pending"&&k?D.find(P=>P.callId===k)??null:null;return l==="compact"?a.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-secondary rounded px-2 py-1.5",children:[a.jsx(F0,{tool:r}),a.jsx("span",{className:"text-accent-primary font-medium",children:r}),a.jsx("span",{className:"text-text-muted truncate flex-1",children:yv(r,s)}),a.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:i==="pending"?"...":"done"})]}):a.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[a.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:[a.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:N.icon}),a.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),a.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:yv(r,s)}),a.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),A&&a.jsx(tA,{confirmation:A}),(j||b)&&a.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&a.jsx(J5,{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"&&a.jsxs(a.Fragment,{children:[g&&g.regions.length>0?a.jsx(V5,{regions:g.regions,filePath:String(s.path??"")}):a.jsx(W5,{oldString:String(s.old_string??""),newString:String(s.new_string??""),filePath:String(s.path??"")}),f&&f.length>0&&a.jsx(vv,{diagnostics:f})]}),r==="write_file"&&i==="success"&&a.jsxs(a.Fragment,{children:[a.jsx(G5,{content:String(s.content??""),filePath:String(s.path??"")}),f&&f.length>0&&a.jsx(vv,{diagnostics:f})]}),r==="read_file"&&i==="success"&&a.jsx(Z5,{result:h,metadata:S,filePath:String(s.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const P=(v==null?void 0:v.map(F=>F.content).join(""))??"",R=i==="pending"&&P?P:String(s.content??"");return a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),a.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:a.jsx(Ir,{content:R})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),a.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:rA(s)})]}),i==="success"&&h!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",d!==void 0&&` (${d}ms)`,":"]}),a.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&&a.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",d,"ms"]}),i==="error"&&c&&r!=="run_command"&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),a.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:c})]})]})]})}),aA={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 oA(e){return aA[e]??`Preparing ${e}`}function lA(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 cA=I.memo(function({name:r,arguments:s}){let l=oA(r)+"...";if(r==="run_command"&&s){const u=lA(s);u&&(l=u)}return a.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:a.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[a.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),a.jsx(F0,{tool:r}),a.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),r==="run_command"&&s?a.jsx("code",{className:"text-text-muted text-xs flex-1 truncate",children:l}):a.jsx("span",{className:"text-text-muted text-xs flex-1",children:l})]})})}),uA={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},dA=I.memo(function({todos:r}){return Array.isArray(r)?r.length===0?a.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):a.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[a.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:a.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),a.jsx("div",{children:r.map((s,i)=>{const l=uA[s.status];return a.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${i>0?"border-t border-border":""}`,children:[a.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)??"○"}),a.jsx("span",{className:`text-sm leading-tight ${s.status==="completed"?"text-text-muted":"text-text-primary"}`,children:s.content})]},i)})})]}):a.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),_v={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"}},q0=I.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 a.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[a.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-secondary",children:a.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),a.jsx("div",{className:"bg-primary",children:l?(()=>{const u=l.result.output;if(u==="No criteria defined yet.")return a.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[a.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),a.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)=>a.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[a.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx(Ir,{content:`[${c.id}] ${c.description}`})})]},c.id??d))}catch{return r.map((h,c)=>a.jsx(Sv,{tc:h,index:c,criteriaMap:i},h.id??c))}})():r.map((u,h)=>a.jsx(Sv,{tc:u,index:h,criteriaMap:i},u.id??h))})]})});function Sv({tc:e,index:r,criteriaMap:s}){const i=e.arguments.action,l=i&&_v[i]?_v[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 a.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[a.jsx("span",{className:`${l.color} text-sm leading-tight flex-shrink-0`,children:l.icon}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:h?"line-through text-text-muted":"",children:a.jsx(Ir,{content:g})}),m&&a.jsxs("div",{className:`mt-1 text-sm ${v?"text-accent-error":"text-text-muted"}`,children:[a.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function hA(e){return e==="criterion"}const fA="#6b7280";function Yl(e,r){var s;return((s=e.find(i=>i.id===r))==null?void 0:s.color)??fA}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 Ce(`/api/agents/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await Ce(`/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 Ce(`/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 Ce(`/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 pA(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"&&hA(l.toolCall.name)?s.push(l.toolCall):(i(),r.push(l));return i(),r}function mA(e,r){if(e.segments&&e.segments.length>0)return gA(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 gA(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 Nf=I.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=mA(r,s),g=i?f:f.filter(v=>v.type!=="thinking"),m=pA(g);return m.length===0?null:a.jsx("div",{className:"feed-item",children:a.jsxs("div",{className:"min-w-0",children:[m.map((v,S)=>{var k,C;switch(v.type){case"thinking":return a.jsx(H5,{content:v.content},S);case"text":return a.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:a.jsx(Ir,{content:v.content})},S);case"preparing_tool_call":return a.jsx(cA,{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 a.jsx(dA,{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 a.jsx(iA,{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 a.jsx(q0,{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 a.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[a.jsx("span",{className:"flex-1 h-px bg-border"}),a.jsx("span",{className:"text-text-secondary",children:b}),a.jsx("span",{className:"text-text-muted",children:"·"}),a.jsx("span",{style:{color:x},children:y.mode}),a.jsx("span",{className:"text-text-muted",children:"·"}),a.jsxs("span",{children:[y.totalTime.toFixed(1),"s"]}),y.toolTime>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-text-muted",children:"·"}),a.jsxs("span",{children:[y.toolTime.toFixed(1),"s tools"]})]}),a.jsx("span",{className:"text-text-muted",children:"·"}),a.jsxs("span",{children:[_(y.prefillTokens)," @ ",j(y.prefillSpeed)," pp"]}),a.jsx("span",{className:"text-text-muted",children:"·"}),a.jsxs("span",{children:[_(y.generationTokens)," @ ",j(y.generationSpeed)," tg"]}),a.jsx("span",{className:"text-text-muted",children:"·"}),a.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:a.jsx(Mw,{className:"w-3 h-3"})}),a.jsx("span",{className:"flex-1 h-px bg-border"})]},S)}}}),r.partial&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[a.jsx(dh,{}),a.jsx("span",{children:"Aborted"})]}),r.completeReason==="truncated"&&a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber-400/80 mt-1",children:[a.jsx(dh,{}),a.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 xA(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 bA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const vA=I.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 a.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Xl(u,.3),backgroundColor:Xl(u,.08)},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(qw,{color:u}),a.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),a.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[a.jsx(qa,{label:"Iterations",value:String(r.iterations)}),a.jsx(qa,{label:"Total time",value:xA(r.totalTimeSeconds)}),a.jsx(qa,{label:"Tool calls",value:String(r.totalToolCalls)}),a.jsx(qa,{label:"Tokens",value:bA(r.totalTokensGenerated)}),a.jsx(qa,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function qa({label:e,value:r}){return a.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[a.jsx("div",{className:"text-sm text-text-muted",children:e}),a.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const yA=I.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 a.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:[a.jsx(zw,{className:"w-3 h-3 shrink-0",color:u}),a.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),a.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function _A({attachments:e,messageId:r}){const[s,i]=I.useState(null),l=Se(g=>g.visionFallbackByMessage),u=Se(g=>g.messages),h=I.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:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=f(g.id);return a.jsxs("div",{className:"relative inline-block",children:[a.jsxs("button",{onClick:()=>c(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[a.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"&&a.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:a.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&a.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&&a.jsx($0,{src:s,alt:"Attached image",isOpen:!0,onClose:d})]})}function SA({isOpen:e,onClose:r,promptContext:s}){const[i,l]=I.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=h=>{l(c=>({...c,[h]:!c[h]}))};return a.jsx(St,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Ai,{title:"User Message",expanded:i.userMessage??!0,onToggle:()=>u("userMessage"),children:a.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&&a.jsx(Ai,{title:`Prompt Messages (${s.messages.length})`,expanded:i.messages??!0,onToggle:()=>u("messages"),children:a.jsx("div",{className:"space-y-2",children:s.messages.map((h,c)=>a.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[a.jsx("span",{className:"font-mono text-text-primary",children:h.role}),a.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:h.source}),h.toolCallId&&a.jsx("span",{className:"font-mono",children:h.toolCallId}),h.attachments&&h.attachments.length>0&&a.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&&a.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:h.attachments.map(d=>d.filename).join(", ")}),a.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}`))})}),a.jsx(Ai,{title:`Tools (${s.tools.length})`,expanded:i.tools??!0,onToggle:()=>u("tools"),children:a.jsxs("div",{className:"space-y-2",children:[s.tools.length===0&&a.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),s.tools.map((h,c)=>a.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"font-mono text-sm text-text-primary",children:h.name}),a.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),a.jsx("div",{className:"text-sm text-text-secondary",children:h.description}),a.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}`))]})}),a.jsx(Ai,{title:"Request Options",expanded:i.requestOptions??!0,onToggle:()=>u("requestOptions"),children:a.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&&a.jsx(Ai,{title:`Injected Files (${s.injectedFiles.length})`,expanded:i.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:a.jsx("div",{className:"space-y-2",children:s.injectedFiles.map((h,c)=>a.jsx(wA,{file:h,expanded:i[`file-${c}`]??!1,onToggle:()=>u(`file-${c}`)},c))})}),a.jsx(Ai,{title:"System Prompt",expanded:i.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(s.systemPrompt.length/1e3)}K chars`,children:a.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 wA({file:e,expanded:r,onToggle:s}){return a.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[a.jsxs("button",{onClick:s,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[a.jsx(fr,{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`}),a.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}),a.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&a.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&a.jsx("div",{className:"border-t border-border/50 p-2",children:a.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 a.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[a.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:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(fr,{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`}),a.jsx("span",{className:"font-medium text-text-primary",children:e}),i&&a.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:i})]})}),r&&a.jsx("div",{className:"p-3 border-t border-border",children:l})]})}function CA({content:e,promptContext:r,align:s="right",messageIndex:i,sessionId:l}){const[u,h]=I.useState(!1),[c,d]=I.useState(!1),[f,g]=I.useState(!1),[m,v]=I.useState(!1),S=I.useRef(null),k=Se(x=>x.loadSession);I.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 T1(l,i)&&k(l),v(!1)},b=s==="right";return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`flex items-start gap-1.5 ${b?"":"order-first"}`,children:[f&&a.jsx(hr,{className:"w-4 h-4 text-accent-success"}),a.jsxs("div",{ref:S,className:"relative",children:[a.jsx("button",{onClick:()=>h(!u),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:a.jsx(Ih,{})}),u&&a.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:[a.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:[a.jsx(Mh,{className:"w-4 h-4"}),"Copy"]}),l&&i!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"border-t border-border my-1"}),a.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:[a.jsx(tc,{className:"w-4 h-4"}),m?"Deleting...":"Delete after"]})]}),r&&a.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:[a.jsx(ec,{className:"w-4 h-4"}),"Inspect"]})]})]})]}),r&&a.jsx(SA,{isOpen:c,onClose:()=>d(!1),promptContext:r})]})}function kA({message:e}){const[r,s]=I.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 a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[a.jsx("span",{className:"flex-1 h-px bg-border"}),a.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${f?"":"cursor-pointer"}`,style:{backgroundColor:l},onClick:()=>!f&&s(!0)}),a.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},onClick:()=>!f&&s(!0),children:u}),a.jsx("span",{children:"·"}),a.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&s(!0),children:d}),a.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&a.jsx("div",{className:"flex justify-center feed-item mb-4",children:a.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${l}`},children:a.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),a.jsx(St,{isOpen:r,onClose:()=>s(!1),title:`${u} Prompt`,size:"lg",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l}}),a.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),a.jsxs("span",{className:"text-xs text-text-muted",children:["(",h,")"]})]}),a.jsx("div",{className:"h-full min-h-96",children:a.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 EA({message:e,promptContext:r,messageIndex:s,sessionId:i}){const l=e.messageKind==="auto-prompt",u=e.messageKind==="command",h=e.isSystemGenerated;return a.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!h&&a.jsx(CA,{content:e.content,promptContext:r,align:"right",messageIndex:s,sessionId:i}),a.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&&a.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"}),a.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&&a.jsx(_A,{attachments:e.attachments,messageId:e.id})]})]})}function jA({message:e}){const r=en(i=>i.settings[Qe.LLM_DISABLE_XML_PROTECTION])!=="true",s=async()=>{await en.getState().setSetting(Qe.LLM_DISABLE_XML_PROTECTION,r?"true":"false")};return a.jsx("div",{className:"flex justify-end feed-item",children:a.jsxs("div",{className:"max-w-[75%] rounded p-2 bg-amber-500/10 border border-amber-500/30",children:[a.jsx("span",{className:"text-[10px] block mb-0.5 text-amber-400",children:"System"}),a.jsx("div",{className:"whitespace-pre-wrap text-sm text-amber-200 italic",children:e.content}),a.jsx("button",{onClick:s,className:"mt-2 text-xs text-amber-400 hover:text-amber-300 underline",children:r?"Disable XML protection":"Enable XML protection"})]})})}const W0=I.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 a.jsx(Nf,{message:r,showStats:s});if(d&&r.isCompacted)return a.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[a.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),a.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
|
|
143
|
-
`,"")})]});if(f)return a.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[a.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),a.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 a.jsx(yA,{data:g})}catch{}if(r.messageKind==="task-completed")try{const g=JSON.parse(r.content);return a.jsx(vA,{data:g})}catch{}return r.messageKind==="context-reset"?a.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[a.jsx("div",{className:"flex-1 border-t border-border"}),a.jsx("span",{children:r.content}),a.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?a.jsx(kA,{message:r}):r.messageKind==="correction"&&r.isSystemGenerated?a.jsx(jA,{message:r}):h?a.jsx(EA,{message:r,promptContext:i,messageIndex:l,sessionId:u}):a.jsx("div",{className:"flex justify-start feed-item",children:a.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:a.jsx(Ir,{content:r.content})})})}),G0=(e,r)=>{const s=I.useRef(!0),i=I.useRef(null),[l,u]=I.useState(!0),h=()=>{const c=e.current;c&&(c.scrollTop=c.scrollHeight)};return I.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()}}},NA={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function TA(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function wv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function AA({contextState:e}){const{currentTokens:r,maxTokens:s,compactionCount:i,dangerZone:l}=e,u=Math.round(r/s*100);return a.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[a.jsxs("span",{className:wv(u,l),children:[Ul(r),"/",Ul(s)]}),a.jsxs("span",{className:wv(u,l),children:["(",u,"%)"]}),a.jsx(Sy,{percent:u,dangerZone:l,size:"sm"}),l&&a.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),i>0&&a.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[i,"x"]})]})}const DA=I.memo(function({messages:r,subAgentType:s,subAgentId:i,isStreaming:l}){const u=I.useRef(null),h=I.useRef(null),[c,d]=I.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}=G0(h,null);I.useEffect(()=>{l||y(!0)},[l]);const b=I.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)??NA[s]??s,j=Yl(m,s),T=TA(j),N=r.filter(D=>D.role!=="tool");return a.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-secondary",children:[a.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:T,children:[a.jsx("span",{className:"text-xs font-medium",children:_}),a.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:v&&a.jsx(AA,{contextState:v})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>y(!C),children:[a.jsx("span",{className:`w-1 h-1 rounded-full ${C?"bg-accent-success":"border border-text-muted"}`}),"live"]}),a.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:b,children:[c?"▼":"▶"," Expand"]})]})]}),a.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"?a.jsx(Nf,{message:D,showStats:!0,showThinking:S,showVerboseToolOutput:k},D.id):a.jsx(W0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function LA(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 RA=I.memo(function({displayItems:r,scrollContainerRef:s,highlightedMessageId:i}){const l=Se(F=>{var q;return(q=F.currentSession)==null?void 0:q.criteria}),u=Se(F=>{var q;return(q=F.currentSession)==null?void 0:q.id}),h=Se(F=>{var q;return(q=F.currentSession)==null?void 0:q.mode}),c=Se(F=>{var q;return(q=F.currentSession)==null?void 0:q.phase}),d=Se(F=>F.messages),f=Se(F=>F.error),g=Se(F=>F.clearError),m=Se(F=>F.acceptAndBuild),v=Oh(),{showThinking:S,showVerboseToolOutput:k,showStats:C,showAgentDefinitions:y,showWorkflowBars:b}=Th(),x=jt(F=>F.defaults),_=jt(F=>F.userItems),j=[...x,..._],T=I.useMemo(()=>LA(d),[d]),N=h==="planner",D=((l==null?void 0:l.length)??0)>0,A=c==="done",P=r.some(F=>F.type==="message"&&F.message.role==="assistant"),R=N&&D&&!v&&P&&!A;return a.jsxs("div",{ref:s,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative bg-primary",children:[a.jsx("div",{className:"pt-4",children:r.map((F,q)=>{if(F.type==="context-divider")return a.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[a.jsx("div",{className:"flex-1 border-t border-border"}),a.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),a.jsx("div",{className:"flex-1 border-t border-border"})]},q);if(F.type==="subagent"){const H=F.messages.some(Z=>Z.isStreaming);return a.jsx("div",{className:"px-2 md:px-4",children:a.jsx(DA,{messages:F.messages,subAgentType:F.subAgentType,subAgentId:F.subAgentId,isStreaming:H})},q)}if(F.type==="criteria-batch")return a.jsx("div",{className:"feed-item px-2 md:px-4",children:a.jsx(q0,{toolCalls:F.toolCalls,criteria:l})},q);const W=F.message;if(W.role==="assistant")return a.jsx("div",{className:"px-2 md:px-4",children:a.jsx(Nf,{message:W,showStats:C,showThinking:S,showVerboseToolOutput:k})},q);const V=!y&&W.messageKind==="auto-prompt",z=!b&&(W.messageKind==="workflow-started"||W.messageKind==="task-completed");return V||z?null:a.jsx("div",{className:"px-2 md:px-4",children:a.jsx("div",{"data-message-id":W.id,className:i===W.id?"rounded animate-highlight-fade":void 0,children:a.jsx(W0,{message:W,messageIndex:q,sessionId:u,isLastAssistantMessage:!1,promptContext:W.role==="user"?T[W.id]:void 0})})},q)})}),a.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[f&&a.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-red-400 text-sm font-medium",children:f.code}),a.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:f.message})]}),a.jsx(lo,{onClick:g,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),R&&a.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:j.map(F=>{const q=F.color??"#3b82f6",W=parseInt(q.slice(1,3),16),V=parseInt(q.slice(3,5),16),z=parseInt(q.slice(5,7),16),H=`rgba(${W},${V},${z},0.12)`,Z=`rgba(${W},${V},${z},0.22)`,Y=`rgba(${W},${V},${z},0.25)`;return a.jsxs("button",{onClick:()=>m(F.id),"data-testid":"workflow-run-button",className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:H,color:q,border:`1px solid ${Y}`},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=Z},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=H},children:["▶ ",F.name]},F.id)})})]})]})});function OA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function MA({agent:e,isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h}){return a.jsxs(sy,{isBuiltIn:r,isConfirmingDelete:s,onView:i,onEdit:l,onDuplicate:u,onDelete:h,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),a.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),a.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&a.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&&a.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),a.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(c=>a.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&&a.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function Cv({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=>a.jsx(MA,{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 a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),a.jsxs("div",{className:"space-y-2",children:[r.map(d),s.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),a.jsx("div",{className:"space-y-2",children:s.map(d)})]})]})]})}function IA({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]=I.useState("list"),[k,C]=I.useState(null),[y,b]=I.useState(!1),[x,_]=I.useState(""),[j,T]=I.useState(""),[N,D]=I.useState(""),[A,P]=I.useState(!0),[R,F]=I.useState([]),[q,W]=I.useState("#6b7280"),[V,z]=I.useState(""),[H,Z]=I.useState(""),[Y,B]=I.useState(!1),[L,O]=I.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=$(R),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),F(U(Me))},ee=me=>{const je=new Map(ne);je.has(me)?je.delete(me):je.set(me,new Set),F(U(je))},X=me=>{_(me.metadata.name),T(me.metadata.id),D(me.metadata.description),P(me.metadata.subagent),F(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),z(me.prompt),Z("")},G=(me,je,Me)=>{_(me.metadata.name+" (copy)"),T(`${je}-copy-${Date.now()}`),D(me.metadata.description),P(me.metadata.subagent),F(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),z(me.prompt),Z(""),C(null),b(!1),S("edit")},ie=(me,je)=>{X(me),C(je),b(!0),S("edit")};I.useEffect(()=>{e&&(h(),Ce("/api/tools").then(me=>me.json()).then(me=>O(me.tools||[])).catch(()=>O([])),s?i.some(je=>je.id===s)?d(s).then(je=>{je&&G(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&&G(je,me)},ve=()=>{C(null),_(""),T(""),D(""),P(!0),F(["read_file"]),W("#6b7280"),z(""),Z(""),b(!1),S("edit")},Le=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||!V){Z("Name and prompt are required.");return}B(!0),Z("");const je={metadata:{id:me,name:x,description:N,subagent:A,allowedTools:R,color:q},prompt:V},Me=k?await g(k,je):await f(je);if(B(!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(OA(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"?a.jsx(St,{isOpen:e,onClose:Ue,title:y?`${x}`:k?"Edit Agent":"New Agent",size:"xl",children:a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"space-y-3",children:[H&&a.jsx(Wh,{message:H}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Is,{label:"Name",value:x,onChange:Te,placeholder:"My Agent",readOnly:y}),a.jsx(Is,{label:"ID",value:j,onChange:T,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(Is,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:y}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),a.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[a.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"}),a.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"}),a.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[a.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),a.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"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),a.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=a.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:[a.jsx("span",{children:me.name}),Me&&a.jsx("span",{className:`text-[10px] ${je&&ht.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},me.name);return Me?y?a.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:[a.jsx("span",{children:me.name}),a.jsx("span",{className:"text-[10px]",children:"*"})]},me.name):a.jsx(oo,{trigger:ce,minWidth:"160px",items:[...me.actions.map(_e=>({label:a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${me.name}-${_e}`,children:[a.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"}),a.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)),F(U(_e))}}}]},me.name):a.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:a.jsx("span",{children:me.name})},me.name)})})]})]}),a.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),a.jsx("textarea",{value:V,onChange:me=>!y&&z(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":""}`})]}),a.jsx(Qw,{onCancel:Ue,onSave:ze,saving:Y,saveDisabled:!x||!V||y}),y&&a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(Ze,{variant:"primary",onClick:()=>{_(x+" (copy)"),T(`${k}-copy-${Date.now()}`),C(null),b(!1)},children:"Duplicate & Customize"})})]})}):a.jsxs(St,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),a.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:a.jsx(Ze,{variant:"primary",size:"sm",onClick:ve,children:"+ New"})})]}),u&&i.length===0&&l.length===0?a.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):i.length===0&&l.length===0?a.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):a.jsxs("div",{className:"space-y-4",children:[i.length>0&&a.jsx(Cv,{title:"Built-in",agents:Ne,subagents:pe,isBuiltIn:!0,onView:re,onDuplicate:be}),l.length>0&&a.jsx(Cv,{title:"Custom",agents:Tt,subagents:$e,isBuiltIn:!1,onView:re,onDuplicate:be,onEdit:Le,onDelete:Oe})]})]})}function BA(){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]=I.useState(!1),[d,f]=I.useState(!1),[g,m]=I.useState(null),v=I.useRef(null);if(I.useEffect(()=>{l()},[l]),I.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 a.jsxs("div",{className:"relative",ref:v,children:[a.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:[a.jsx("span",{className:"text-sm font-medium",style:{color:y},children:C}),a.jsx(fr,{className:`w-3 h-3 text-text-muted transition-transform ${h?"rotate-180":""}`})]}),h&&S.length>0&&a.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 a.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:[a.jsxs("button",{type:"button",onClick:()=>{_||r(b.id),c(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",style:{color:j},children:b.name}),_&&a.jsx(hr,{className:"w-3.5 h-3.5 text-text-muted shrink-0"})]}),T&&a.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)}),a.jsx("div",{className:"border-t border-border p-1",children:a.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..."})})]}),a.jsx(IA,{isOpen:d,onClose:()=>{f(!1),m(null)},initialEditId:g})]})}function zA(){const e=Se(i=>i.currentSession),r=Se(i=>i.switchDangerLevel);if(!e)return null;const s=e.dangerLevel??"normal";return a.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[a.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"}),a.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 PA({question:e}){const r=Se(h=>h.answerQuestion),[s,i]=I.useState(""),l=()=>{r(e.callId,s)},u=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),l())};return a.jsx(St,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-text-primary",children:e.question}),a.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}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),a.jsx(Ze,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})})}function HA(){const e=Se(i=>i.connectionStatus),r=Se(i=>i.reconnect);if(e==="connected")return null;const s=e==="reconnecting";return a.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:[a.jsx("div",{className:"flex items-center gap-2",children:s?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex gap-1",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),a.jsx("span",{children:"Reconnecting to server..."})]}):a.jsxs(a.Fragment,{children:[a.jsx(Gw,{}),a.jsx("span",{children:"Connection lost"})]})}),a.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 FA({attachment:e,onRemove:r}){const s=i=>i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1048576).toFixed(1)} MB`;return a.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[a.jsx(lo,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),a.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),a.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),a.jsx("div",{className:"text-[10px] text-text-muted",children:s(e.size)})]})}function UA({history:e,selectedIndex:r,onSelect:s,onEscape:i,onNavigate:l}){const u=I.useRef(null),h=I.useRef(null);I.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 a.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)=>a.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:[a.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&a.jsxs(a.Fragment,{children:[" | ",a.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),a.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}function $A(){const e=Sw(),r=e?"bg-amber-400":"bg-accent-primary";return a.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs("span",{className:"flex gap-0.5",children:[a.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),a.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),a.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),a.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&a.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}const ln=Bn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await Fh("/api/commands",e)},fetchCommand:async s=>{try{const i=await Ce(`/api/commands/${s}`);return i.ok?await i.json():null}catch{return null}},fetchDefaultContent:async s=>{try{const i=await Ce(`/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 Ce(`/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 Ce(`/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"}}}})),qA={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function WA(e,r={}){const s={...qA,...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=QA(l),h=`data:${e.type};base64,${u}`,c=await V0(h);return{dataUrl:h,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await GA(e,s)}async function GA(e,r){const s=await KA(e),i=await V0(s),{width:l,height:u}=VA(i.width,i.height,r.maxWidth,r.maxHeight),h=YA();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),!(kv(f)<=r.maxSizeBytes||d<=.3));m++)d-=.1;const g=kv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:u}}function VA(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 KA(e){return new Promise((r,s)=>{const i=ZA(),l=new i;l.onload=()=>r(l.result),l.onerror=()=>s(new Error("Failed to read file")),l.readAsDataURL(e)})}function V0(e){return new Promise((r,s)=>{const i=XA(),l=new i;l.onload=()=>r(l),l.onerror=()=>s(new Error("Failed to load image")),l.src=e})}function YA(){var r;const e=Tf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function XA(){const e=Tf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function ZA(){const e=Tf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Tf(){return globalThis}function QA(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 kv(e){const s=e.split(",")[1];return s?Math.round(s.length*3/4):0}function JA(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function e4(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Ev(e.size)}). Maximum size is ${Ev(r)}.`}:{valid:!0}}function Ev(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(!JA(e)){s(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const h=e4(e,l);if(!h.valid){s(h.error??"Image file is too large");return}try{const c=await WA(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:qv(),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 t4({content:e,children:r,position:s="top",delay:i=200}){const[l,u]=I.useState(!1),[h,c]=I.useState({top:0,left:0}),d=I.useRef(void 0),f=I.useRef(null);I.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 a.jsxs(a.Fragment,{children:[a.jsx("span",{ref:f,className:"inline-flex",onMouseEnter:g,onMouseLeave:m,onFocus:g,onBlur:m,children:r}),l&&Fi.createPortal(a.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 n4({label:e,children:r}){return a.jsxs("div",{className:"space-y-3",children:[a.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]=I.useState((r==null?void 0:r.toString())??""),[v,S]=I.useState(r===null);I.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=a.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[f&&a.jsx(t4,{content:f,children:a.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,a.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 a.jsxs("div",{children:[y,a.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&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("p",{className:"text-xs text-text-muted",children:h}),d!==void 0&&a.jsxs("span",{className:"text-xs text-text-muted/60",children:["(default: ",d,")"]})]}),!h&&d!==void 0&&a.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Profile default: ",d]})]})}function r4({isOpen:e,onClose:r,providerId:s,model:i}){const[l,u]=I.useState(()=>ah(i)),[h,c]=I.useState(!1),d=kt(m=>m.updateModelSettings);I.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?a.jsx(St,{isOpen:e,onClose:r,title:"Model Properties",size:"lg",footer:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{variant:"secondary",onClick:g,disabled:h,children:"Cancel"}),a.jsx(Ze,{variant:"primary",onClick:f,disabled:h||l.contextWindow<1024||l.contextWindow>1e7,children:h?"Saving...":"Save"})]}),children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),a.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded font-mono text-sm break-all",children:i.id})]}),a.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"}),a.jsxs(n4,{label:"Sampling Parameters",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.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."}),a.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."})]}),a.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."})]}),a.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."}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[a.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"]}),a.jsx("p",{className:"text-xs text-text-muted",children:"Allow sending images directly to this model. Disable if the model doesn't support vision."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),a.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 s4(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function i4(){var Z;const[,e]=nr(),r=Se(Y=>Y.currentSession),s=Se(Y=>Y.setSessionProvider),[i,l]=I.useState(!1),[u,h]=I.useState([]),[c,d]=I.useState(null),f=I.useRef(null),[g,m]=I.useState(null),v=I.useRef(new Set),S=kt(Y=>Y.providers),k=kt(Y=>Y.activeProviderId),C=kt(Y=>Y.defaultModelSelection);kt(Y=>Y.backend);const y=kt(Y=>Y.activating),b=kt(Y=>Y.activateProvider),x=kt(Y=>Y.refreshModel),_=kt(Y=>Y.refreshProviderModels);I.useEffect(()=>{function Y(B){f.current&&!f.current.contains(B.target)&&(l(!1),h([]),v.current=new Set)}return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[]),I.useEffect(()=>{if(i){const Y=S.map(B=>B.id);h(Y),Y.forEach(B=>{v.current.has(B)||(v.current.add(B),P(B))})}},[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,B)=>C?C===`${Y}/${B}`:!1,P=async Y=>{d(Y);try{await _(Y)}catch{}finally{d(null)}},R=Y=>{u.includes(Y.id)?h(u.filter(B=>B!==Y.id)):(h([...u,Y.id]),P(Y.id))},F=async Y=>{if(Y.id===k){R(Y);return}r?(s(Y.id,void 0),kt.getState().syncFromSession(Y.id,""),l(!1),h([])):await b(Y.id)&&(l(!1),h([]))},q=Y=>{R(Y)},W=async(Y,B)=>{Y.stopPropagation(),v.current.delete(B),await _(B),await P(B)},V=(Y,B)=>{m({providerId:Y,model:B})},z=()=>{m(null)},H=async(Y,B)=>{if(r){s(Y,B),kt.getState().syncFromSession(Y,B),h([]),l(!1);return}d("activating");try{kt.getState().syncFromSession(Y,B),h([]),l(!1);const L=await Ce(`/api/providers/${Y}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:B})});if(L.ok){const O=await L.json();kt.getState().syncFromSession(O.activeProviderId,O.model)}}catch{}finally{d(null)}};return S.length===0?a.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?a.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):a.jsx("span",{className:"text-sm text-accent-primary",children:D}),a.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):a.jsxs("div",{className:"relative",ref:f,children:[a.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?a.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):a.jsx("span",{className:"text-sm text-accent-primary",children:D}),a.jsx(fr,{className:"w-3 h-3 text-text-muted transition-transform",rotate:i?180:0})]}),i&&a.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:[a.jsx("div",{className:"py-1",children:S.map(Y=>{var B;return a.jsxs("div",{children:[a.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:[a.jsxs("div",{onClick:()=>!y&&F(Y),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[a.jsx("span",{className:`text-sm font-medium truncate ${Y.id===k?"text-accent-primary":"text-text-primary"}`,children:Y.name}),a.jsx("span",{className:"text-xs text-text-muted truncate",children:Y.backend!=="auto"&&iw(Y.backend)})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Y.id===k?a.jsx("span",{className:"text-accent-success",title:"Active",children:a.jsx(hr,{className:"w-4 h-4"})}):a.jsx("span",{className:"w-4"}),a.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:a.jsx(Jv,{className:`w-4 h-4 ${c===Y.id?"animate-spin":""} ${Y.id===k?"text-accent-primary":"text-text-muted"}`})}),a.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:a.jsx(fr,{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)&&a.jsx("div",{className:"bg-bg-primary border-t border-border max-h-40 overflow-y-auto",children:c===Y.id?a.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(B=Y.models)!=null&&B.length?Y.models.map(L=>{var O;return a.jsxs("button",{type:"button",onClick:()=>H(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:[a.jsx("span",{className:"truncate flex-1",children:((O=L.id.split("/").pop())==null?void 0:O.replace(/-/g," "))??L.id}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("span",{className:"text-xs text-text-muted",children:s4(L.contextWindow)}),a.jsx("button",{type:"button",onClick:$=>{$.stopPropagation(),V(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:a.jsx(Dw,{className:"w-3 h-3 text-text-muted"})})]}),A(Y.id,L.id)&&a.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:a.jsx(hr,{className:"w-3.5 h-3.5"})})]},L.id)}):a.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},Y.id)})}),a.jsx("div",{className:"border-t border-border px-3 py-2",children:a.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&a.jsx(r4,{isOpen:!0,onClose:z,providerId:g.providerId,model:g.model})]})}function a4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function o4({onClick:e}){return a.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:a.jsx(ec,{})})}function K0({isOpen:e,onClose:r,initialEditId:s}){const i=ln(pe=>pe.defaults),l=ln(pe=>pe.userItems),u=ln(pe=>pe.loading),h=ln(pe=>pe.fetchCommands),c=ln(pe=>pe.fetchCommand),d=ln(pe=>pe.fetchDefaultContent),f=ln(pe=>pe.createCommand),g=ln(pe=>pe.updateCommand),m=ln(pe=>pe.deleteCommand),[v,S]=I.useState(null),[k,C]=I.useState(null),{view:y,editingId:b,formError:x,saving:_,formData:j,setView:T,setEditingId:N,setFormError:D,setFormData:A,setSaving:P}=oy(),{requestDelete:R,clearConfirm:F,isConfirming:q}=Uh(),W=I.useRef(!1),V=Nt(pe=>pe.defaults),z=Nt(pe=>pe.userItems),H=Nt(pe=>pe.fetchAgents),Y=[...V,...z].filter(pe=>!pe.subagent),B=I.useRef(h),L=I.useRef(H),O=I.useRef(c),$=I.useRef(d),U=I.useRef(s),ne=I.useRef(T),Q=I.useRef(N),ee=I.useRef(D),X=I.useRef(F);I.useEffect(()=>{B.current=h,L.current=H,O.current=c,$.current=d,U.current=s,ne.current=T,Q.current=N,ee.current=D,X.current=F}),I.useEffect(()=>{if(e)if(B.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})}):O.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 G=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),F()},Le=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:a4(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 a.jsx(St,{isOpen:e,onClose:Ue,title:`Default: ${(pe==null?void 0:pe.name)??v}`,size:"xl",children:a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"space-y-3 mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[a.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),a.jsx("span",{className:"font-mono",children:v})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),a.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:pe==null?void 0:pe.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),a.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"})]})]}),a.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),a.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"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[a.jsx(Ze,{variant:"secondary",onClick:Ue,children:"Close"}),a.jsx(Ze,{variant:"primary",onClick:Te,children:"Duplicate & Customize"})]})]})})}return y==="edit"?a.jsx(St,{isOpen:e,onClose:Oe,title:b?"Edit Command":"New Command",size:"xl",children:a.jsxs("div",{className:"flex flex-col h-full",children:[x&&a.jsx(Wh,{message:x}),a.jsxs("div",{className:"space-y-3 mb-3",children:[a.jsx(ay,{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}))}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",a.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),a.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:[a.jsx("option",{value:"",children:"None (keep current mode)"}),Y.map(pe=>a.jsx("option",{value:pe.id,children:pe.name},pe.id))]})]})]}),a.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[a.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),a.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"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[a.jsx(Ze,{variant:"secondary",onClick:Oe,children:"Cancel"}),a.jsx(Ze,{variant:"primary",onClick:Le,disabled:_||!j.name||!j.prompt,children:_?"Saving...":"Save"})]})]})}):a.jsxs(St,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[a.jsx(ry,{description:"Commands are pre-defined messages you can send with a single click.",onNew:re}),a.jsxs(iy,{loading:u,hasItems:i.length>0||l.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[i.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),a.jsx("div",{className:"space-y-2",children:i.map(pe=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[a.jsx("div",{className:"min-w-0 flex-1 mr-3",children:a.jsx("span",{className:"text-text-primary text-sm font-medium",children:pe.name})}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx(o4,{onClick:()=>G(pe.id)}),a.jsx(Ja,{onClick:()=>ie(pe.id)})]})]},pe.id))})]}),l.length>0&&a.jsx(ny,{children:l.map(pe=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[a.jsx("div",{className:"min-w-0 flex-1 mr-3",children:a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"text-text-primary text-sm font-medium",children:pe.name})})}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx(zi,{onClick:()=>be(pe.id)}),a.jsx(Ja,{onClick:()=>ie(pe.id)}),q(pe.id,"delete")?a.jsx($h,{onConfirm:()=>ve(pe.id),onCancel:F}):a.jsx(qh,{onClick:()=>R(pe.id)})]})]},pe.id))})]})]})}function l4(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function c4(e){let r=1;for(;e.some(s=>s.id===`s${r}`);)r++;return`s${r}`}const u4=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],Y0={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"},X0=[{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)"}],Ls=150,Mr=54,Di=80,Rn=30,Li=70,jv=100,Rs=50,Bl=50,Nv=4;function Af(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 d4(e,r,s,i){const l=Bl+Rs+Ls+jv+Ls+Rs+Bl,u=l/2,h=Bl+Rs+Ls/2,c=Bl+Rs+Ls+jv+Ls/2,d=[],f=[],g=new Map,m=e.filter(V=>V.type==="agent"||V.type==="shell"),v=e.filter(V=>V.type==="sub_agent"),S=v.length>0,k=S?h:u,C=m.length>0?c:u,y=Rs+Rn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:y,w:Di,h:Rn}),g.set("$start",{cx:k,cy:y,w:Di,h:Rn}),e.length===0){const V=y+Rn/2+Li*2+Rn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:V,w:Di,h:Rn}),g.set("$done",{cx:k,cy:V,w:Di,h:Rn}),{nodes:d,edges:f,width:l,height:V+Rn/2+Rs,posMap:g}}const b=y+Rn/2+Li,x=(V,z)=>{V.forEach((H,Z)=>{const Y=b+Z*(Mr+Li)+Mr/2,{name:B,color:L}=Af(H,i);d.push({id:H.id,type:"step",label:B,color:L,cx:z,cy:Y,w:Ls,h:Mr}),g.set(H.id,{cx:z,cy:Y,w:Ls,h:Mr})})};x(m,k),x(v,C);const _=m.length>0?b+(m.length-1)*(Mr+Li)+Mr/2:y,j=S?b+(v.length-1)*(Mr+Li)+Mr/2:y,T=Math.max(_,j)+Mr/2+Li+Rn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:T,w:Di,h:Rn}),g.set("$done",{cx:k,cy:T,w:Di,h:Rn});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 V of e)V.transitions.forEach((z,H)=>{if(!z.goto||!g.has(z.goto))return;const Z=g.get(V.id),Y=g.get(z.goto),B=z.when.type==="step_result"?`${z.when.result}`:Y0[z.when.type]??z.when.type,L=V.id===z.goto;let O;L?O="back":Y.cy>Z.cy+1?O="down":Y.cy<Z.cy-1?O="back":O="same",N.push({from:V.id,to:z.goto,label:B,edgeKey:`${V.id}:${H}`,direction:O,backEdgeIndex:O==="back"?D++:0})});const A=new Map,P=new Map,R=new Map,F=new Map;for(const V of N)V.direction==="down"&&(A.set(V.from,(A.get(V.from)??0)+1),P.set(V.to,(P.get(V.to)??0)+1));const q=new Map,W=new Map;for(const V of N){if(V.direction!=="same")continue;const z=[V.from,V.to].sort().join("|");q.set(z,(q.get(z)??0)+1)}for(const V of N){if(V.direction==="back"||V.direction==="same"){let O=0;if(V.direction==="same"){const $=[V.from,V.to].sort().join("|");O=W.get($)??0,W.set($,O+1)}f.push({...V,fromPort:0,toPort:0,sameEdgeIndex:O});continue}const z=A.get(V.from)??1,H=P.get(V.to)??1,Z=R.get(V.from)??0,Y=F.get(V.to)??0;R.set(V.from,Z+1),F.set(V.to,Y+1);const B=z===1?0:-.6+1.2*Z/(z-1),L=H===1?0:-.6+1.2*Y/(H-1);f.push({...V,fromPort:B,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:f,width:l,height:T+Rn/2+Rs,posMap:g}}function h4({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=I.useRef(null),C=I.useRef(!1),[y,b]=I.useState(null),[x,_]=I.useState(null),[j,T]=I.useState(null),{nodes:N,edges:D,width:A,height:P,posMap:R}=I.useMemo(()=>d4(e,r,l,u),[e,r,l,u]),F=I.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 G=(re=ee.getScreenCTM())==null?void 0:re.inverse();if(!G)return{x:0,y:0};const ie=X.matrixTransform(G);return{x:ie.x,y:ie.y}},[]),q=I.useCallback(Q=>!Q||!x||Q==="$start"?!1:x.type==="reconnect-from"?Q!=="$done":!0,[x]),W=I.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=F(Q);_({type:"new",fromNodeId:ee,mouseX:X.x,mouseY:X.y})},[F,h]),V=I.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=F(Q);_({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[F,h]),z=I.useCallback((Q,ee)=>{if(h)return;Q.stopPropagation(),Q.preventDefault();const X=F(Q);_({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:X.x,mouseY:X.y})},[F,h]),H=I.useCallback(Q=>{if(!x)return;const ee=F(Q);_(X=>X?{...X,mouseX:ee.x,mouseY:ee.y}:null)},[x,F]),Z=I.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=I.useCallback(()=>{if(C.current){C.current=!1;return}c(null),d(null)},[c,d]);I.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 B=Q=>{const ee=R.get(Q.from),X=R.get(Q.to);if(!ee||!X)return null;let G,ie,re,be="middle",ve,Le;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;G=`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},Le={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;G=`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},Le={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;G=`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},Le={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;G=`M ${Ue} ${pe} C ${$e} ${pe}, ${$e} ${Ne}, ${Te} ${Ne}`,ie=$e,re=(pe+Ne)/2-6,ve={x:Ue,y:pe},Le={x:Te,y:Ne}}return{path:G,labelX:ie,labelY:re,labelAnchor:be,fromPt:ve,toPt:Le}},L=(Q,ee)=>{const X=B(Q);if(!X)return null;const{path:G,labelX:ie,labelY:re,labelAnchor:be}=X,ve=i===Q.edgeKey,Le=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return a.jsxs("g",{children:[a.jsx("path",{d:G,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Oe=>{Oe.stopPropagation(),d(ve?null:Q.edgeKey)}}),a.jsx("path",{d:G,fill:"none",stroke:ve?"#58a6ff":"#484f58",strokeWidth:ve?2.2:1.2,markerEnd:ve?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Le&&a.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)},O=()=>{if(!i||x)return null;const Q=D.find(re=>re.edgeKey===i);if(!Q)return null;const ee=B(Q);if(!ee)return null;const{fromPt:X,toPt:G}=ee,ie=6;return a.jsxs(a.Fragment,{children:[Q.edgeKey!=="start"&&a.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=>z(re,Q)}),a.jsx("circle",{cx:G.x,cy:G.y,r:ie,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:re=>V(re,Q)})]})},$=()=>{if(!x)return null;let Q,ee,X,G;if(x.type==="reconnect-from"){const be=R.get(x.fixedTargetId);if(!be)return null;Q=x.mouseX,ee=x.mouseY,X=be.cx,G=be.cy-be.h/2}else{const be=R.get(x.fromNodeId);if(!be)return null;Q=be.cx,ee=be.cy+be.h/2,X=x.mouseX,G=x.mouseY}const ie=G-ee,re=Math.abs(ie)>10?`M ${Q} ${ee} C ${Q} ${ee+ie*.4}, ${X} ${G-ie*.4}, ${X} ${G}`:`M ${Q} ${ee} L ${X} ${G}`;return a.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 a.jsx("circle",{cx:Q.cx,cy:ee,r:Nv,fill:X?"#58a6ff":"#1c2128",stroke:X?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5,className:"cursor-crosshair",onMouseDown:G=>W(G,Q.id)})},ne=Q=>{const ee=Q.cy-Q.h/2,X=x&&j===Q.id&&q(Q.id);return a.jsx("circle",{cx:Q.cx,cy:ee,r:Nv,fill:X?"#3fb950":"#1c2128",stroke:X?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:X?1:.5})};return a.jsxs("svg",{ref:k,viewBox:`0 0 ${A} ${P}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:H,onMouseUp:Z,onClick:Y,children:[a.jsxs("defs",{children:[a.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:a.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),a.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:a.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,G=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",Le=ve?"#58a6ff":"#3fb950",Oe=ve,ze=!ve;return a.jsxs("g",{onClick:Ue=>{Ue.stopPropagation(),ve&&!h&&d("start")},className:ve&&!h?"cursor-pointer":void 0,children:[re&&a.jsx("rect",{x:X-3,y:G-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"&&a.jsx("rect",{x:X-3,y:G-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),a.jsx("rect",{x:X,y:G,width:Q.w,height:Q.h,rx:Q.h/2,fill:Le,fillOpacity:.08,stroke:Le,strokeOpacity:.4,strokeWidth:1.5}),a.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:Le,className:"text-[10px] font-medium",pointerEvents:"none",children:Q.label}),Oe&&U(Q),ze&&ne(Q)]},Q.id)}const be=Q.color??"#6b7280";return a.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&&a.jsx("rect",{x:X-3,y:G-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&a.jsx("rect",{x:X-3,y:G-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),a.jsx("rect",{x:X,y:G,width:Q.w,height:Q.h,rx:10,fill:be,fillOpacity:.08,stroke:be,strokeOpacity:.6,strokeWidth:ee?2:1.5}),a.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&&a.jsxs("g",{onClick:ve=>{ve.stopPropagation(),f(Q.id)},className:"cursor-pointer",children:[a.jsx("circle",{cx:X+Q.w-2,cy:G+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),a.jsx("line",{x1:X+Q.w-5,y1:G-1,x2:X+Q.w+1,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),a.jsx("line",{x1:X+Q.w+1,y1:G-1,x2:X+Q.w-5,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),x&&N.map(Q=>q(Q.id)?a.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),$(),O()]})}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",cn="block text-[11px] text-text-secondary mb-0.5";function f4({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 a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),a.jsx("button",{onClick:h,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[a.jsx("span",{className:"font-medium text-text-primary",children:e}),a.jsx(Zv,{}),a.jsx("span",{className:"font-medium text-text-primary",children:r})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Condition"}),a.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:X0.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))})]}),s.type==="step_result"&&a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Result"}),d?a.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=>a.jsx("option",{value:f,children:f},f))}):a.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})]}),a.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:a.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(s=>a.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 p4({step:e,isEntry:r,agentTypes:s,transitionCount:i,templateVariables:l,onUpdate:u,onRemove:h,onSetEntry:c}){const{color:d,name:f}=Af(e,s);return a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:f}),r&&a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[!r&&a.jsx("button",{onClick:c,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),a.jsx("button",{onClick:h,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Type"}),a.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:u4.map(g=>a.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Agent Type"}),a.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=>a.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Sub-Agent Type"}),a.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:[a.jsx("option",{value:"",children:"— select —"}),s.filter(g=>g.subagent).map(g=>a.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Prompt"}),a.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..."}),a.jsx(oh,{variables:l,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Nudge Prompt"}),a.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..."}),a.jsx(oh,{variables:l,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Command"}),a.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"}),a.jsx(oh,{variables:l,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Timeout (ms)"}),a.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${er} font-mono text-xs`})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Success Codes"}),a.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`})]})]})]}),a.jsx("div",{className:"pt-1 border-t border-border/50",children:a.jsxs("p",{className:"text-text-muted text-[10px]",children:[i," outgoing transition",i!==1?"s":""," — drag from the bottom port to connect."]})})]})}const Tv=[];function Z0({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]=I.useState("list"),[_,j]=I.useState(null),[T,N]=I.useState(!1),[D,A]=I.useState(null),[P,R]=I.useState(null),[F,q]=I.useState(""),[W,V]=I.useState(""),[z,H]=I.useState(""),[Z,Y]=I.useState("1.0.0"),[B,L]=I.useState("#3b82f6"),[O,$]=I.useState(""),[U,ne]=I.useState(50),[Q,ee]=I.useState(Tv),[X,G]=I.useState({type:"always"}),[ie,re]=I.useState(""),[be,ve]=I.useState(!1),[Le,Oe]=I.useState([]),[ze]=I.useState(null);I.useEffect(()=>{e&&(c(),g(),Ce("/api/agents").then(fe=>fe.json()).then(fe=>Oe(fe.agents??[])).catch(()=>{}),A(null),R(null),s?i.some(ye=>ye.id===s)?f(s).then(ye=>{ye&&(q(ye.metadata.name+" (copy)"),V(`${s}-copy-${Date.now()}`),H(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(ye.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))}):d(s).then(ye=>{ye&&(q(ye.metadata.name),V(ye.metadata.id),H(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(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),V(ye.metadata.id),H(ye.metadata.description),Y(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),$(ye.entryStep),ne(ye.settings.maxIterations),ee(ye.steps),G(ye.startCondition??{type:"always"}),re(""),A(null),R(null),x("edit"))},Te=async()=>{var it;const fe=_??W;if(!fe||!F)return re("Name is required."),!1;if(Q.length===0)return re("Add at least one step."),!1;let ye=O;if(!ye||!Q.some(Fe=>Fe.id===ye)){if(ye=((it=Q.find(Fe=>Fe.id))==null?void 0:it.id)??"",!ye)return re("All steps need an ID."),!1;$(ye)}ve(!0),re("");const ke={metadata:{id:fe,name:F,description:z,version:Z||"1.0.0",color:B},entryStep:ye,settings:{maxIterations:U},steps:Q,startCondition:X},qe=_?await v(_,ke):await m(ke);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),_||V(l4(fe))},me=async fe=>{if(i.some(ke=>ke.id===fe)){const ke=await f(fe);if(!ke)return;q(ke.metadata.name),V(ke.metadata.id),H(ke.metadata.description),Y(ke.metadata.version),L(ke.metadata.color??"#3b82f6"),$(ke.entryStep),ne(ke.settings.maxIterations),ee(ke.steps),G(ke.startCondition??{type:"always"}),re(""),j(fe),N(!0)}else{const ke=await d(fe);if(!ke)return;q(ke.metadata.name),V(ke.metadata.id),H(ke.metadata.description),Y(ke.metadata.version),L(ke.metadata.color??"#3b82f6"),$(ke.entryStep),ne(ke.settings.maxIterations),ee(ke.steps),G(ke.startCondition??{type:"always"}),re(""),j(fe),N(!0)}x("edit")},je=async fe=>{const ke=i.some(qe=>qe.id===fe)?await f(fe):await d(fe);ke&&(q(ke.metadata.name+" (copy)"),V(`${fe}-copy-${Date.now()}`),H(ke.metadata.description),Y(ke.metadata.version),L(ke.metadata.color??"#3b82f6"),$(ke.entryStep),ne(ke.settings.maxIterations),ee(ke.steps),G(ke.startCondition??{type:"always"}),re(""),j(null),N(!1),x("edit"))},Me=()=>{j(null),q(""),V(""),H(""),Y("1.0.0"),L("#3b82f6"),$(""),ne(50),ee(structuredClone(Tv)),G({type:"always"}),re(""),A(null),R(null),N(!1),x("edit")},ht=async fe=>{await S(fe),C()},ce=I.useCallback(fe=>{A(fe),R(null)},[]),_e=I.useCallback(fe=>{R(fe),A(null)},[]),Ae=D!==null?Number(D):-1,Ie=Ae>=0?Q[Ae]??null:null,Ge=I.useCallback(fe=>{ee(ye=>ye.map((ke,qe)=>qe===Ae?fe:ke))},[Ae]),At=X.type==="step_result"?`${X.result}`:Y0[X.type]??X.type,Je=()=>{const fe=Q.length,ye=c4(Q),ke=Le.find(qe=>!qe.subagent);ee([...Q,{id:ye,name:(ke==null?void 0:ke.name)??"Agent",type:"agent",phase:"build",toolMode:(ke==null?void 0:ke.id)??"builder",transitions:[]}]),O||$(ye),ce(String(fe))},Mt=I.useCallback((fe,ye)=>{fe==="$start"?($(ye),_e("start")):ee(ke=>{const qe=ke.find(Fe=>Fe.id===fe),it=qe?qe.transitions.length:0;return _e(`${fe}:${it}`),ke.map(Fe=>Fe.id===fe?{...Fe,transitions:[...Fe.transitions,{when:{type:"always"},goto:ye}]}:Fe)})},[_e]),Dt=I.useCallback((fe,ye)=>{if(fe==="start")$(ye);else{const ke=fe.lastIndexOf(":"),qe=fe.slice(0,ke),it=parseInt(fe.slice(ke+1));ee(Fe=>Fe.map(tn=>tn.id===qe?{...tn,transitions:tn.transitions.map((Pt,Vt)=>Vt===it?{...Pt,goto:ye}:Pt)}:tn))}},[]),ue=I.useCallback((fe,ye)=>{const ke=fe.lastIndexOf(":"),qe=fe.slice(0,ke),it=parseInt(fe.slice(ke+1));ee(Fe=>{const tn=Fe.find(Vt=>Vt.id===qe);if(!tn)return Fe;const Pt=tn.transitions[it];return Pt?Fe.map(Vt=>Vt.id===qe?{...Vt,transitions:Vt.transitions.filter(($s,gc)=>gc!==it)}:Vt.id===ye?{...Vt,transitions:[...Vt.transitions,Pt]}:Vt):Fe}),R(null)},[]),Ee=I.useCallback(fe=>{if(fe==="start")$("");else{const ye=fe.lastIndexOf(":"),ke=fe.slice(0,ye),qe=parseInt(fe.slice(ye+1));ee(it=>it.map(Fe=>Fe.id===ke?{...Fe,transitions:Fe.transitions.filter((tn,Pt)=>Pt!==qe)}:Fe))}R(null)},[]),Ve=I.useCallback((fe,ye)=>{if(fe==="start")G(ye);else{const ke=fe.lastIndexOf(":"),qe=fe.slice(0,ke),it=parseInt(fe.slice(ke+1));ee(Fe=>Fe.map(tn=>tn.id===qe?{...tn,transitions:tn.transitions.map((Pt,Vt)=>Vt===it?{...Pt,when:ye}:Pt)}:tn))}},[]),lt=fe=>Af(fe,Le).name,zn=()=>{if(!P)return null;if(P==="start"){const Pt=Q.find(Vt=>Vt.id===O);return{type:"start",fromLabel:"Start",toLabel:Pt?lt(Pt):"(none)",condition:X}}const fe=P.lastIndexOf(":"),ye=P.slice(0,fe),ke=parseInt(P.slice(fe+1)),qe=Q.find(Pt=>Pt.id===ye);if(!qe)return null;const it=qe.transitions[ke];if(!it)return null;const Fe=Q.find(Pt=>Pt.id===it.goto),tn=it.goto==="$done"?"Done":Fe?lt(Fe):it.goto;return{type:"step",fromLabel:lt(qe),toLabel:tn,condition:it.when}};if(b==="edit"){const fe=zn();return a.jsxs(St,{isOpen:e,onClose:$e,title:T?F:_?"Edit Workflow":"New Workflow",size:"full",children:[ie&&a.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ie}),a.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[a.jsxs("div",{className:"min-w-[140px]",children:[a.jsx("label",{className:cn,children:"Name"}),a.jsx("input",{value:F,onChange:ye=>Tt(ye.target.value),placeholder:"Workflow name",className:`${er} ${T?"opacity-50":""}`,readOnly:T})]}),a.jsxs("div",{className:"min-w-[100px]",children:[a.jsx("label",{className:cn,children:"ID"}),a.jsx("input",{value:W,readOnly:!0,className:`${er} font-mono opacity-50`})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:cn,children:"Description"}),a.jsx("input",{value:z,onChange:ye=>!T&&H(ye.target.value),readOnly:T,placeholder:"What does this workflow do?",className:`${er} ${T?"opacity-50":""}`})]}),a.jsxs("div",{className:"w-20",children:[a.jsx("label",{className:cn,children:"Max Iter."}),a.jsx("input",{type:"number",value:U,onChange:ye=>!T&&ne(Number(ye.target.value)),readOnly:T,className:`${er} font-mono ${T?"opacity-50":""}`})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Color"}),a.jsx("input",{type:"color",value:B,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"}`})]})]}),a.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[a.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[a.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!T&&a.jsx("button",{onClick:Je,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),a.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[a.jsx(h4,{steps:Q,entryStep:O,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:P,startConditionLabel:At,agentTypes:Le,isReadOnly:T,onSelectNode:ye=>{if(ye===null){ce(null);return}const ke=Q.findIndex(qe=>qe.id===ye);ce(ke>=0?String(ke):null)},onSelectEdge:_e,onRemoveStep:ye=>{var qe;const ke=Q.findIndex(it=>it.id===ye);if(ee(it=>it.filter(Fe=>Fe.id!==ye)),Ae===ke&&ce(null),O===ye){const it=Q.filter(Fe=>Fe.id!==ye);$(((qe=it[0])==null?void 0:qe.id)??"")}},onCreateTransition:Mt,onReconnectTo:Dt,onReconnectFrom:ue,onDeleteTransition:Ee}),Q.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[a.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),a.jsx("button",{onClick:Je,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"})]})]})]}),a.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:a.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),a.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:T&&(fe||Ie)?a.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):fe?fe.type==="start"?a.jsxs("div",{className:"space-y-3 text-sm",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),O&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[a.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),a.jsx(Zv,{}),a.jsx("span",{className:"text-text-primary font-medium",children:fe.toLabel})]}),a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Activation Condition"}),a.jsx("select",{value:X.type,onChange:ye=>G(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:zs,children:X0.map(ye=>a.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),X.type==="step_result"&&a.jsxs("div",{children:[a.jsx("label",{className:cn,children:"Result"}),O&&(()=>{const ye=Q.find(Fe=>Fe.id===O),ke=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Le.find(Fe=>Fe.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,qe=(ke==null?void 0:ke.results)&&ke.results.length>0,it=(ke==null?void 0:ke.results)??[];return qe?a.jsx("select",{value:X.result??it[0],onChange:Fe=>G({type:"step_result",result:Fe.target.value}),className:zs,children:it.map(Fe=>a.jsx("option",{value:Fe,children:Fe},Fe))}):a.jsx("input",{type:"text",value:X.result??"success",onChange:Fe=>G({type:"step_result",result:Fe.target.value}),placeholder:"e.g. success, passed, failed",className:er})})()]}),a.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."})]}):a.jsx(f4,{fromLabel:fe.fromLabel,toLabel:fe.toLabel,condition:fe.condition,fromStep:fe.type==="step"?Q.find(ye=>ye.id===fe.fromLabel):void 0,agentTypes:Le,onUpdateCondition:ye=>Ve(P,ye),onDelete:()=>Ee(P)}):Ie?a.jsx(p4,{step:Ie,isEntry:Ie.id===O,agentTypes:Le,transitionCount:Ie.transitions.length,templateVariables:h,onUpdate:Ge,onRemove:()=>{var ye;if(Ie&&(ee(Q.filter((ke,qe)=>qe!==Ae)),ce(null),O===Ie.id)){const ke=Q.filter((qe,it)=>it!==Ae);$(((ye=ke[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>$(Ie.id)}):a.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",a.jsx("br",{}),"Drag from a port to connect."]})})]})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[a.jsx(Ze,{variant:"secondary",onClick:$e,children:"Close"}),T?a.jsx(Ze,{variant:"primary",onClick:()=>{q(F+" (copy)"),V(`${_}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):a.jsxs(a.Fragment,{children:[a.jsx(Ze,{variant:"secondary",onClick:pe,disabled:be||!F,children:be?"Saving...":"Save"}),a.jsx(Ze,{variant:"primary",onClick:Ne,disabled:be||!F,children:"Save & Close"})]})]})]})}return a.jsxs(St,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),a.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:a.jsx(Ze,{variant:"primary",size:"sm",onClick:Me,children:"+ New"})})]}),u&&i.length===0&&l.length===0?a.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):i.length===0&&l.length===0?a.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):a.jsxs("div",{className:"space-y-4",children:[i.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),a.jsx("div",{className:"space-y-2",children:i.map(fe=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[a.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),a.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),a.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.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:a.jsx(ec,{})}),a.jsx(Ja,{onClick:()=>je(fe.id)})]})]},fe.id))})]}),l.length>0&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),a.jsx("div",{className:"space-y-2",children:l.map(fe=>a.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[a.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),a.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),a.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[a.jsx(Ja,{onClick:()=>je(fe.id)}),a.jsx(zi,{onClick:()=>Ue(fe.id)}),y(fe.id,"delete")?a.jsx($h,{onConfirm:()=>ht(fe.id),onCancel:()=>{}}):a.jsx(qh,{onClick:()=>k(fe.id)})]})]},fe.id))})]})]})]})}function m4(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 g4({onSendCommand:e,onSelectWorkflow:r,onOpenCommandsManager:s,onOpenWorkflowsManager:i,onAttach:l,textareaContent:u,attachments:h,criteria:c}){const[d,f]=I.useState(!1),[g,m]=I.useState("commands"),[v,S]=I.useState(""),[k,C]=I.useState(0),[y,b]=I.useState(null),[x,_]=I.useState(null),j=I.useRef(null),T=I.useRef(null),N=ln($=>$.defaults),D=ln($=>$.userItems),A=ln($=>$.fetchCommands),P=jt($=>$.defaults),R=jt($=>$.userItems),F=jt($=>$.fetchWorkflows),q=[...N,...D],W=[...P,...R];I.useEffect(()=>{d&&(g==="commands"?A():g==="workflows"&&F())},[d,g,A,F]),I.useEffect(()=>{d&&(S(""),C(0),requestAnimationFrame(()=>{var $;return($=j.current)==null?void 0:$.focus()}))},[d,g]),I.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 V=$=>{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}},z=$=>{S($),C(0)},H=q.filter($=>!v||$.name.toLowerCase().includes(v.toLowerCase())),Z=W.filter($=>!v||$.name.toLowerCase().includes(v.toLowerCase())),Y=async $=>{const U=await ln.getState().fetchCommand($);U&&e(U.prompt,U.metadata.agentMode,u,h),f(!1)},B=$=>{r($),f(!1)},L=($,U)=>{U.stopPropagation(),f(!1),b($)},O=($,U)=>{U.stopPropagation(),f(!1),_($)};return a.jsxs("div",{ref:T,className:"relative",children:[a.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:a.jsx(Qv,{className:"w-4 h-4"})}),d&&a.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:[a.jsxs("div",{className:"flex border-b border-border",children:[a.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"}),a.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"}),a.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"&&a.jsx("div",{className:"p-2 border-b border-border",children:a.jsx("input",{ref:j,value:v,onChange:$=>z($.target.value),onKeyDown:V,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"})}),a.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:g==="commands"?H.length===0?a.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:q.length===0?"No commands yet":"No matches"}):H.map(($,U)=>a.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:[a.jsx("button",{type:"button",onClick:()=>Y($.id),className:"flex-1 text-left",children:a.jsx("div",{className:"text-sm text-text-primary font-medium",children:$.name})}),a.jsx(zi,{className:"opacity-0 group-hover:opacity-100",onClick:ne=>L($.id,ne)})]},$.id)):g==="workflows"?Z.length===0?a.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=m4($,c),Q=$.color??"#3b82f6";return a.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:[a.jsxs("button",{type:"button",onClick:()=>B($.id),className:"flex-1 text-left flex items-center gap-2",children:[a.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:Q}}),a.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:$.name}),ne!==null&&a.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"})]}),a.jsx(zi,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>O($.id,ee)})]},$.id)}):a.jsxs("div",{className:"p-4 flex flex-col items-center gap-3",children:[a.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:[a.jsx(jw,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium",children:"Attach image"})]}),a.jsx("span",{className:"text-xs text-text-muted",children:"or drag & drop into chat"})]})}),g!=="attach"&&a.jsx("div",{className:"border-t border-border p-1",children:a.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..."})})]}),a.jsx(K0,{isOpen:!!y,onClose:()=>b(null),initialEditId:y}),a.jsx(Z0,{isOpen:!!x,onClose:()=>_(null),initialEditId:x})]})}function Q0(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 J0(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 x4(e){const r=e.match(/^\/p\/([^/]+)/);return r==null?void 0:r[1]}function b4({isOpen:e,onClose:r,onCloseComplete:s,onSelectCommand:i,onSelectWorkflow:l,onCloseCompleteAction:u,textareaContent:h,onSearchMessages:c,onToggleAutoScroll:d,isAutoScrollActive:f}){const[,g]=nr(),m=ln(O=>O.fetchCommands),v=jt(O=>O.fetchWorkflows),S=Nt(O=>O.fetchAgents),k=ln(O=>O.defaults),C=ln(O=>O.userItems),y=jt(O=>O.defaults),b=jt(O=>O.userItems),x=Nt(O=>O.defaults),_=Nt(O=>O.userItems),j=Se(O=>{var $;return($=O.currentSession)==null?void 0:$.mode}),T=Se(O=>{var $;return(($=O.currentSession)==null?void 0:$.dangerLevel)??"normal"}),N=Se(O=>O.switchMode),D=Se(O=>O.switchDangerLevel),A=Se(O=>{var $;return($=O.currentSession)==null?void 0:$.projectId}),P=I.useRef(void 0),[R,F]=I.useState(""),[q,W]=I.useState(0),V=I.useRef(null),z=I.useRef(!1);I.useEffect(()=>{e&&(z.current=!0)},[e]),I.useEffect(()=>{if(e){m(),v(),S(),F(""),W(0);const O=setTimeout(()=>{var $;return($=V.current)==null?void 0:$.focus()},50);return()=>clearTimeout(O)}},[e,m,v,S]),I.useEffect(()=>{var O;!e&&z.current&&(s==null||s(),(O=P.current)==null||O.call(P),P.current=void 0)},[e,s]);const H=(O,$)=>{const U=new Set($.map(ne=>ne.id));return[...O.filter(ne=>!U.has(ne.id)),...$]},Y=[{id:"create-session",name:"New Session",prefix:"Action > Create",action:()=>{const O=A??x4(window.location.pathname);O&&g(`/p/${O}/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)}},...H(x,_).filter(O=>!O.subagent&&O.id!==j).map(O=>({id:O.id,name:O.name,prefix:"Agent > Switch to",action:()=>N(O.id)})),...H(k,C).map(O=>({id:O.id,name:O.name,prefix:"Command > Launch",action:()=>i(O.id,h)})),...H(y,b).map(O=>({id:O.id,name:O.name,prefix:"Workflow > Run",action:()=>l(O.id)})),...["normal","dangerous"].filter(O=>O!==T).map(O=>({id:O,name:O.charAt(0).toUpperCase()+O.slice(1),prefix:"Mode > Switch to",action:()=>D(O)}))].filter(O=>Q0(`${O.prefix} ${O.name}`,R)),B=Y.length-1,L=O=>{J0(O,B,W,()=>{var $;($=Y[q])==null||$.action(),r()},r)};return e?Fi.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),a.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[a.jsx("input",{ref:V,type:"text",value:R,onChange:O=>{F(O.target.value),W(0)},onKeyDown:L,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),a.jsx(Hh,{onClick:r,className:"shrink-0","aria-label":"Close"})]}),a.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:Y.length===0?a.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((O,$)=>a.jsxs("button",{type:"button",onClick:()=>{O.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:[a.jsxs("span",{className:"text-text-muted font-normal",children:[O.prefix," "]}),a.jsx("span",{children:O.name})]},O.id))})]})]}),document.body):null}function v4(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 y4({isOpen:e,onClose:r,messages:s,onSelectMessage:i}){const[l,u]=I.useState(""),[h,c]=I.useState(0),d=I.useRef(null),f=I.useRef(!1),g=s.filter(C=>C.role==="user"&&!C.isSystemGenerated&&C.messageKind!=="auto-prompt"&&C.messageKind!=="command");I.useEffect(()=>{e&&(f.current=!0)},[e]),I.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=>Q0(C.content,l)),v=m.length-1,S=C=>{J0(C,v,c,()=>{m[h]&&(i(m[h].id),r())},r)},k=C=>{i(C),r()};return e?Fi.createPortal(a.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),a.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[a.jsx(zh,{}),a.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"}),a.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:a.jsx(Ph,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:m.length===0?a.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)=>a.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:a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("span",{className:"truncate flex-1",children:C.content}),a.jsx("span",{className:"text-text-muted text-xs shrink-0",children:v4(C.timestamp)})]})},C.id))})]})]}),document.body):null}function _4(e){return e==="criterion"}function S4(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=>_4(i.name))}function w4(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,S4(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 C4(e){const{year:r,month:s,day:i}=hy(e);return`${r}/${s}/${i} ${rc(e)}`}function k4(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const E4=10,j4=150;function N4(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 T4(e){return[...e].sort((i,l)=>new Date(l.timestamp).getTime()-new Date(i.timestamp).getTime()).slice(0,E4).reverse().map(i=>({id:i.id,content:i.content,timestamp:i.timestamp,formattedTimestamp:C4(i.timestamp),trimmedContent:k4(i.content,j4),sessionId:i.sessionId,sessionName:i.sessionName}))}function A4(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(...N4(u));return T4(i)}function D4(e,r=[],s=null){const[i,l]=I.useState(0),[u,h]=I.useState(!1),c=I.useMemo(()=>A4(e,r,s),[e,r,s]),d=I.useCallback(()=>{c.length>0&&(l(c.length-1),h(!0))},[c.length]),f=I.useCallback(()=>{h(!1),l(0)},[]),g=I.useCallback(()=>{l(S=>c.length===0?S:S===0?c.length-1:S-1)},[c.length]),m=I.useCallback(()=>{l(S=>c.length===0?S:S===c.length-1?0:S+1)},[c.length]),v=I.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 L4({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const s=e??!0,[i,l]=I.useState(""),[u,h]=I.useState([]),[c,d]=I.useState(!1),[f,g]=I.useState(null),[m,v]=I.useState(!1),[S,k]=I.useState(!1),[C,y]=I.useState(!1),[b,x]=I.useState(!1),[_,j]=I.useState(null),[T,N]=I.useState(null),D=I.useRef(null),A=I.useRef(null),P=I.useRef(null),R=Se(ue=>ue.currentSession),F=Se(ue=>ue.messages),q=Se(ue=>ue.streamingMessage),W=Se(ue=>ue.sessions),V=Se(ue=>ue.pendingQuestion),z=Oh(),H=Se(ue=>ue.sendMessage),Z=Se(ue=>ue.acceptAndBuild),Y=Se(ue=>ue.stopGeneration),B=Se(ue=>ue.launchRunner),L=Se(ue=>ue.cancelQueued),O=_w(),$=Nt(ue=>ue.defaults),U=Nt(ue=>ue.userItems),ne=[...$,...U].filter(ue=>!ue.subagent),{history:Q,selectedIndex:ee,showHistory:X,openHistory:G,closeHistory:ie,navigateUp:re,navigateDown:be,selectCurrent:ve}=D4(F,W,R==null?void 0:R.id),Le=I.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)},[]);I.useEffect(()=>{const ue=Ee=>{N(Ee.detail.stats)};return window.addEventListener("open-turn-stats",ue),()=>window.removeEventListener("open-turn-stats",ue)},[]),I.useEffect(()=>{jt.getState().fetchWorkflows()},[]);const Oe=I.useMemo(()=>q?F.map(ue=>ue.id===q.id?q:ue):F,[F,q]),ze=I.useRef([]),Ue=I.useMemo(()=>{const ue=w4(Oe,ze.current);return ze.current=ue,ue},[Oe]),{force_scroll_to_bottom:Te,isAutoScrollActive:pe,setAutoScroll:Ne}=G0(D,R),$e=I.useRef(0),Tt=I.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]);I.useEffect(()=>{if(!(R!=null&&R.id))return;const ue=`openfox:draft:${R.id}`,Ee=localStorage.getItem(ue);Ee!==null&&l(Ee)},[R==null?void 0:R.id]),I.useEffect(()=>{var ue;(ue=A.current)==null||ue.focus(),Tt()},[R==null?void 0:R.id,Tt]),I.useEffect(()=>{if(!(R!=null&&R.id))return;const ue=`openfox:draft:${R.id}`,Ee=setTimeout(()=>{i?localStorage.setItem(ue,i):localStorage.removeItem(ue)},500);return()=>clearTimeout(Ee)},[R==null?void 0:R.id,i]),I.useEffect(()=>{Tt()},[i,Tt]),I.useEffect(()=>{const ue=Ee=>{const Ve=C||m||S||b||T;Ee.key==="Escape"&&z&&!Ve&&Y(),Ee.key==="ScrollLock"&&Ne(!pe)};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[z,Y,pe,C,m,S,b,T]);const me=I.useRef(0);I.useEffect(()=>{const ue=Ee=>{if(Ee.key==="Shift"&&!Ee.ctrlKey&&!Ee.metaKey&&!Ee.altKey){const Ve=Date.now();Ve-me.current<300?(Ee.preventDefault(),y(!0),me.current=0):me.current=Ve}};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[]),I.useEffect(()=>{const ue=A.current;if(!ue)return;const Ee=async Ve=>{var zn;if(document.activeElement!==ue)return;const lt=(zn=Ve.clipboardData)==null?void 0:zn.items;if(lt){for(const fe of Array.from(lt))if(fe.type.startsWith("image/")){Ve.preventDefault();const ye=fe.getAsFile();if(!ye)continue;await ih(ye,ke=>h(qe=>[...qe,ke]),g,{filename:"pasted-image"})}}};return ue.addEventListener("paste",Ee),()=>ue.removeEventListener("paste",Ee)},[]);const je=()=>{l(""),h([]),R!=null&&R.id&&localStorage.removeItem(`openfox:draft:${R.id}`)},Me=async ue=>{ue.preventDefault(),!(!i.trim()&&u.length===0)&&(Te(),H(i,u.length>0?u:void 0),je())},ht=ue=>{if((ue.ctrlKey||ue.metaKey)&&ue.code.startsWith("Digit")){const Ve=parseInt(ue.code.slice(-1),10)-1,lt=ne[Ve];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(),z&&Y();return;case"ArrowUp":ue.preventDefault(),re();return;case"ArrowDown":ue.preventDefault(),be();return}if(ue.key==="ArrowUp"&&i.trim()===""&&!X){ue.preventDefault(),G();return}ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),Me(ue))},ce=I.useCallback(async ue=>{const Ee=ue.target.files;if(!(!Ee||Ee.length===0)){g(null);for(const Ve of Array.from(Ee))await ih(Ve,lt=>h(zn=>[...zn,lt]),g);P.current&&(P.current.value="")}},[]),_e=I.useCallback(ue=>{ue.preventDefault(),ue.stopPropagation(),d(!0)},[]),Ae=I.useCallback(ue=>{ue.preventDefault(),ue.stopPropagation(),d(!1)},[]),Ie=I.useCallback(async ue=>{ue.preventDefault(),ue.stopPropagation(),d(!1),g(null);const Ee=ue.dataTransfer.files;if(!(!Ee||Ee.length===0))for(const Ve of Array.from(Ee))await ih(Ve,lt=>h(zn=>[...zn,lt]),g)},[]),Ge=I.useCallback(ue=>{h(Ee=>Ee.filter(Ve=>Ve.id!==ue))},[]),At=I.useCallback(()=>{var ue;(ue=P.current)==null||ue.click()},[]),Je=(R==null?void 0:R.mode)==="planner",Mt=(R==null?void 0:R.mode)==="builder",Dt=ue=>{const Ee=i.trim()?i:void 0,Ve=u.length>0?u:void 0;Je?Z(ue,Ee,Ve):Mt&&B(Ee,Ve,ue),je()};return a.jsxs(a.Fragment,{children:[a.jsxs(g2,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:r,messages:Oe,children:[V&&a.jsx(PA,{question:V}),a.jsx(v2,{}),T&&a.jsx(y2,{stats:T,onClose:()=>N(null)}),a.jsx(HA,{}),a.jsx(RA,{displayItems:Ue,scrollContainerRef:D,highlightedMessageId:_}),a.jsxs("form",{onSubmit:Me,className:"relative p-2 md:p-4 bg-secondary",children:[z&&a.jsx("div",{className:"absolute -top-8 left-2 md:left-4 z-10",children:a.jsx($A,{})}),a.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?a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-success"}):a.jsx(fr,{className:"w-3 h-3 text-text-muted"}),pe?"live":"scroll to bottom"]}),a.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:a.jsx(zh,{})}),a.jsx("input",{ref:P,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:ce,className:"hidden",multiple:!0}),f&&a.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&&a.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(ue=>a.jsx(FA,{attachment:ue,onRemove:Ge},ue.id))}),X&&a.jsx(UA,{history:Q,selectedIndex:ee,onSelect:ue=>{l(ue),ie()},onEscape:ie,onNavigate:ue=>{ue==="up"?re():be()}}),(O==null?void 0:O.length)>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:O.map(ue=>a.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:[a.jsxs("span",{className:"font-medium",children:[ue.mode==="asap"?"ASAP":"Queue",":"]}),a.jsx("span",{className:"truncate max-w-[200px]",children:ue.content}),a.jsx(lo,{onClick:()=>L(ue.queueId),size:"sm"})]},ue.queueId))}),a.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:[a.jsx("textarea",{id:cy,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}),a.jsxs("div",{className:"flex items-center self-center gap-1.5",children:[z&&a.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:[a.jsx(ey,{}),"Abort"]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>{var ue;!i.trim()&&u.length===0||((ue=D.current)==null||ue.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),H(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"}),a.jsx(g4,{onSendCommand:(ue,Ee,Ve,lt)=>{var fe;Ee&&(R==null?void 0:R.mode)!==Ee&&Se.getState().switchMode(Ee);const zn=Ve&&Ve.trim()?`${Ve.trim()}
|
|
155
|
-
|
|
156
|
-
${ue}`:ue;(fe=D.current)==null||fe.scrollTo({top:D.current.scrollHeight,behavior:"smooth"}),H(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:(R==null?void 0:R.criteria)??[]})]})]})]}),a.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(BA,{}),a.jsx(zA,{})]}),a.jsx(i4,{})]})]}),a.jsx(K0,{isOpen:m,onClose:()=>v(!1)}),a.jsx(Z0,{isOpen:S,onClose:()=>k(!1)}),a.jsx(b4,{isOpen:C,onClose:()=>y(!1),onSearchMessages:()=>x(!0),isAutoScrollActive:pe,onToggleAutoScroll:Ne,textareaContent:i,onCloseComplete:uy,onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(ue,Ee)=>{const Ve=await ln.getState().fetchCommand(ue);if(Ve){const lt=Ee!=null&&Ee.trim()?`${Ee.trim()}
|
|
157
|
-
|
|
158
|
-
${Ve.prompt}`:Ve.prompt;Ve.metadata.agentMode&&Se.getState().switchMode(Ve.metadata.agentMode),H(lt,u!=null&&u.length?u:void 0,{messageKind:"command",isSystemGenerated:!0}),je()}},onSelectWorkflow:ue=>{const Ee=i.trim()||void 0,Ve=u.length>0?u:void 0;(R==null?void 0:R.mode)==="planner"?Se.getState().acceptAndBuild(ue,Ee,Ve):Se.getState().launchRunner(Ee,Ve,ue),je()}})]}),b&&a.jsx(y4,{isOpen:b,onClose:()=>x(!1),messages:F,onSelectMessage:Le})]})}I.memo(function({item:r}){const[s,i]=I.useState(!1);return r.type==="start"?a.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:[a.jsx("span",{className:"animate-pulse",children:"●"}),a.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&a.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[a.jsx("span",{className:"text-accent-success",children:"✓"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),a.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&&a.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:a.jsx(Ir,{content:r.description})})]})]})});function Av({isOpen:e,isRetry:r,onSubmit:s,onCancel:i}){const[l,u]=I.useState(""),h=I.useRef(null);I.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 a.jsx(St,{isOpen:e,onClose:i,title:r?"Invalid Password":"Password Required",size:"sm",children:a.jsxs("form",{onSubmit:c,className:"space-y-4",children:[a.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."}),a.jsx(sc,{ref:h,type:"password",value:l,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ze,{type:"button",variant:"secondary",onClick:i,children:"Cancel"}),a.jsx(Ze,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}const R4=[8e3,11434,8080],O4=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function Dv(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 M4({currentStep:e,totalSteps:r,labels:s,onStepClick:i}){return a.jsx("div",{className:"flex justify-center py-6",children:a.jsx("div",{className:"flex items-center",children:Array.from({length:r},(l,u)=>{const h=u+1,c=h<e,d=h===e;return a.jsxs("div",{className:"flex items-center",children:[a.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}),a.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&&a.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${c?"bg-accent-primary":"bg-border"}`})]},u)})})})}function I4({onNext:e}){const[r,s]=I.useState([]),[i,l]=I.useState([]),[u,h]=I.useState(!1),[c,d]=I.useState(""),[f,g]=I.useState(""),[m,v]=I.useState(""),[S,k]=I.useState("auto"),[C,y]=I.useState(!1),[b,x]=I.useState(null),[_,j]=I.useState(null),[T,N]=I.useState(null),[D,A]=I.useState("");I.useEffect(()=>{P()},[]);async function P(){try{const z=await Ce("/api/providers");if(z.ok){const Z=(await z.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 R(z){y(!0),x(null);const H=S!=="auto";try{const Y=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:z,skipBackendDetection:H})})).json();Y.success?(H||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 F(){if(!f)return;const z=c||`Provider ${i.length+1}`,H={id:`temp-${Date.now()}`,name:z,url:f,backend:b!=null&&b.success?S:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};l([...i,H]),d(""),g(""),v(""),x(null)}function q(z){j(z),r.some(Z=>Z.id===z)?Ce(`/api/providers/${z}`,{method:"DELETE"}).then(()=>{l(i.filter(Z=>Z.id!==z)),s(r.filter(Z=>Z.id!==z)),j(null)}).catch(()=>{j(null)}):(l(i.filter(Z=>Z.id!==z)),j(null))}async function W(){for(const H of i)(H.id.startsWith("temp-")||!r.some(Z=>Z.id===H.id))&&((await Ce("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:H.name,url:H.url,backend:H.backend,model:H.model,apiKey:H.apiKey})})).ok||console.error("Failed to add provider",H));const z=i.filter(H=>!H.id.startsWith("temp-"));e({providers:z})}const V=i.length>0;return a.jsxs("div",{className:"max-w-xl mx-auto",children:[a.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),a.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),a.jsxs("div",{className:"space-y-4",children:[i.length>0?a.jsx("div",{className:"space-y-2",children:i.map(z=>a.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:Dv(z.backend)}),T===z.id?a.jsx("input",{type:"text",value:D,onChange:H=>A(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(l(i.map(Z=>Z.id===z.id?{...Z,name:D}:Z)),N(null)),H.key==="Escape"&&N(null)},onBlur:()=>{l(i.map(H=>H.id===z.id?{...H,name:D}:H)),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}):a.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(z.id),A(z.name)},title:"Click to edit",children:z.name})]}),a.jsx("p",{className:"text-text-muted text-sm mt-1",children:z.url}),z.model&&a.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",z.model]})]}),a.jsx("button",{onClick:()=>q(z.id),disabled:_===z.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:a.jsx(tc,{})})]},z.id))}):a.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:a.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?a.jsxs("form",{onSubmit:z=>{z.preventDefault(),f&&F()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:O4.map(z=>a.jsx("button",{type:"button",onClick:()=>{d(z.name),g(z.url),k(z.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===z.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:z.name},z.name))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:R4.map(z=>a.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${z}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${z}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",z]},z))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),a.jsx("input",{type:"text",name:"url",value:f,onChange:z=>{g(z.target.value),x(null)},onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),R(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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),a.jsx("input",{type:"text",name:"name",value:c,onChange:z=>d(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),F())},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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),a.jsx("input",{type:"password",name:"apiKey",value:m,onChange:z=>v(z.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&&a.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?a.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",Dv(S),b.model&&` (${b.model})`]}):a.jsx("p",{className:"text-red-500",children:b.error})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>R(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?a.jsx(Bi,{className:"w-4 h-4"}):"Test Connection"}),a.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"})]}),a.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"})]}):a.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:[a.jsx(Bi,{className:"w-4 h-4"}),"Add Provider"]}),a.jsx("button",{onClick:W,disabled:!V,"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 B4({onNext:e}){const[r,s]=I.useState(""),[i,l]=I.useState(!1);return I.useEffect(()=>{Ce("/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(()=>{})})},[]),a.jsxs("div",{className:"max-w-xl mx-auto",children:[a.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),a.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),a.jsxs("div",{className:"flex gap-2",children:[a.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"}),a.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&&a.jsx(xy,{initialPath:r||void 0,onSelect:u=>{s(u),l(!1)},onClose:()=>l(!1)}),a.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 z4({onNext:e}){const[r,s]=I.useState(!1),[i,l]=I.useState("http://localhost:11434"),[u,h]=I.useState("qwen3-vl:2b"),{copied:c,copy:d}=H0();I.useEffect(()=>{Ce("/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 a.jsxs("div",{className:"max-w-xl mx-auto",children:[a.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),a.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[a.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),a.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),a.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[a.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),a.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:c?a.jsx(hr,{className:"w-4 h-4 text-accent-primary"}):a.jsx(Aw,{className:"w-4 h-4"})})]})]}),a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[a.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"}),a.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&a.jsxs("div",{className:"space-y-4 pl-8",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),a.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"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),a.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"})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-4",children:[a.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"}),a.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 P4({onComplete:e}){const[r,s]=I.useState(1),[i,l]=I.useState(!1),[u,h]=I.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 Ce("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(v){console.error("Failed to save onboarding data:",v),l(!1)}}const g=m=>{s(m)};return a.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[a.jsx(lo,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),a.jsx(M4,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),a.jsx("div",{className:"max-w-xl mx-auto",children:i?a.jsxs("div",{className:"text-center",children:[a.jsx(Bi,{className:"w-6 h-6"}),a.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):a.jsxs(a.Fragment,{children:[r===1&&a.jsx(I4,{onNext:c}),r===2&&a.jsx(B4,{onNext:d}),r===3&&a.jsx(z4,{onNext:f})]})})]})}const Lv="openfox_updated_to",Rv="update_pending";function H4(){const[e,r]=I.useState(!1),s=localStorage.getItem(Lv),i=localStorage.getItem(Rv);I.useEffect(()=>{if(!s||!i)return;const u=setTimeout(()=>r(!0),3e4);return()=>clearTimeout(u)},[s,i]);const l=()=>{localStorage.removeItem(Lv),localStorage.removeItem(Rv),r(!0)};return e||i!=="true"||!s?null:a.jsxs("div",{className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-[100] flex items-center gap-3 px-4 py-2.5 bg-bg-secondary border border-border rounded-lg shadow-xl animate-slide-down",role:"status","aria-live":"polite",children:[a.jsx("div",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent-primary/20",children:a.jsx(hr,{className:"w-3 h-3 text-accent-primary"})}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-medium text-text-primary",children:"OpenFox updated successfully"}),a.jsxs("span",{className:"text-xs text-text-muted",children:["Now running ",s]})]}),a.jsx("button",{onClick:l,className:"ml-2 p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Dismiss",children:a.jsx(ty,{className:"w-3.5 h-3.5"})})]})}typeof window<"u"&&(Jt.getState().loadUserPresets(),Jt.getState().applySavedTheme());function Df(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function e_(){return a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(co,{})})}function F4({sidebarOpen:e,onSidebarToggle:r}){const[,s]=Rh("/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=Df(),d=l==="connected"||c;return I.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?a.jsx(e_,{}):a.jsxs(a.Fragment,{children:[a.jsx(py,{projectId:i,isOpen:e,onClose:r}),a.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:a.jsx(zC,{})})]})}function U4({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:s,onRightSidebarToggle:i}){const[,l]=Rh("/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=Df(),x=d==="connected"||b;return I.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]),I.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&u&&(k(),c(`/p/${u}`))},[S,u,k,c]),!C||C.id!==u?a.jsx(e_,{}):a.jsxs(a.Fragment,{children:[a.jsx(py,{projectId:u,isOpen:e,onClose:r}),a.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:a.jsx(L4,{criteriaSidebarOpen:s,onCriteriaSidebarToggle:i})})]})}function $4(){const e=kt(s=>s.fetchConfig);function r(){e(),window.history.back()}return a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsx(P4,{onComplete:r})})}function q4(){const{connectionStatus:e}=ww(),r=kt(H=>H.fetchConfig),s=kt(H=>H.refreshProviderModels),i=en(H=>H.getSetting),l=kt(H=>H.providers),u=kt(H=>H.activeProviderId),[,h]=nr(),c=Df(),[d,f]=I.useState(!1);I.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{f(!0);for(const H of Mv)i(H);i(Qe.DISPLAY_THEME),i(Qe.DISPLAY_USER_PRESETS)})},[e,c,r,i]),I.useEffect(()=>{d&&u&&s(u).then(()=>{const H=kt.getState().defaultModelSelection;(H?H.split("/")[0]:null)!==u&&r()})},[d,u,s,r]);const g=en(H=>H.settings);I.useEffect(()=>{d&&l.length===0&&h("/onboarding")},[d,l.length]),I.useEffect(()=>{const{applyPreset:H,applyTokens:Z}=Jt.getState(),Y=g[Qe.DISPLAY_THEME],B=g[Qe.DISPLAY_USER_PRESETS];if(B&&localStorage.setItem("openfox:userPresets",B),Y){localStorage.setItem("openfox:theme",Y);try{const L=JSON.parse(Y);L.preset&&L.tokens?(H(L.preset),Jt.setState({basePreset:L.preset}),Z(L.tokens)):L.preset?H(L.preset):L.tokens&&Z(L.tokens)}catch{H("dark")}}else H("dark")},[g[Qe.DISPLAY_THEME],g[Qe.DISPLAY_USER_PRESETS]]);const m=()=>{const H=localStorage.getItem("openfox:leftSidebar");return H!==null?H==="true":!0},v=()=>{const H=localStorage.getItem("openfox:rightSidebar");return H!==null?H==="true":!0},[S,k]=I.useState(m),[C,y]=I.useState(v),[b,x]=I.useState(!1),[_,j]=I.useState(!1),[T,N]=I.useState(!1),D=A1();I.useEffect(()=>{const H=()=>{N(window.innerWidth<768)};return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[]);const A=T?b:S,P=T?_:C,R=()=>{T?x(!b):k(!S)},F=()=>{T?j(!_):y(!C)};I.useEffect(()=>{T||localStorage.setItem("openfox:leftSidebar",String(S))},[S,T]),I.useEffect(()=>{T||localStorage.setItem("openfox:rightSidebar",String(C))},[C,T]),I.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const q=Se(H=>H.showPasswordModal),W=Se(H=>H.passwordModalRetry),V=Se(H=>H.submitPassword),z=Se(H=>H.cancelPassword);return e!=="connected"&&!q&&!c?a.jsxs(a.Fragment,{children:[a.jsx(Av,{isOpen:!0,isRetry:W,onSubmit:V,onCancel:z}),a.jsx("div",{className:"h-screen flex items-center justify-center",children:a.jsx(OC,{text:"Connecting to server..."})})]}):a.jsxs(a.Fragment,{children:[a.jsx(Av,{isOpen:q,isRetry:W,onSubmit:V,onCancel:z}),a.jsxs("div",{className:"flex flex-col",style:{height:T?`calc(${D.offsetTop}px + ${D.height}px)`:"100vh"},children:[a.jsx(TC,{}),a.jsx(wC,{onMenuClick:R,onCriteriaToggle:F}),a.jsx("div",{className:"flex-1 flex overflow-hidden",children:a.jsxs(Q1,{children:[a.jsx(Ma,{path:"/onboarding",children:a.jsx($4,{})}),a.jsx(Ma,{path:"/p/:projectId/s/:sessionId",children:a.jsx(U4,{sidebarOpen:A,onSidebarToggle:R,rightSidebarOpen:P,onRightSidebarToggle:F})}),a.jsx(Ma,{path:"/p/:projectId/new",children:a.jsx(BC,{})}),a.jsx(Ma,{path:"/p/:projectId",children:a.jsx(F4,{sidebarOpen:A,onSidebarToggle:R})}),a.jsx(Ma,{path:"/",children:a.jsx(IC,{})})]})})]}),a.jsx(H4,{})]})}k1.createRoot(document.getElementById("root")).render(a.jsx(hn.StrictMode,{children:a.jsx(q4,{})}));
|