openfox 1.6.21 → 1.6.25

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.
Files changed (29) hide show
  1. package/README.md +46 -13
  2. package/dist/{auto-compaction-U75EINMB.js → auto-compaction-7LK3QGPI.js} +4 -3
  3. package/dist/{chat-handler-JEMPI5UF.js → chat-handler-ZU74RXED.js} +6 -5
  4. package/dist/{chunk-HWOYZ245.js → chunk-2V7VPPBP.js} +6 -6
  5. package/dist/{chunk-HZP2V5Z6.js → chunk-4O3C2JMB.js} +5 -9
  6. package/dist/{chunk-SJVEX2NR.js → chunk-7LPL774T.js} +19 -19
  7. package/dist/{chunk-AU33PQAB.js → chunk-BOEXJCOD.js} +2 -2
  8. package/dist/{chunk-6NPMZFMP.js → chunk-CJNQGEYG.js} +2 -2
  9. package/dist/{chunk-XYD5JXRM.js → chunk-D4ZLSV6P.js} +292 -1
  10. package/dist/{chunk-FX4SUY2S.js → chunk-KSASIV4B.js} +10 -287
  11. package/dist/{chunk-XRGMFOVG.js → chunk-P6GUT2QQ.js} +3 -3
  12. package/dist/{chunk-WINI5HX7.js → chunk-PYBB34ZK.js} +3 -3
  13. package/dist/cli/dev.js +1 -1
  14. package/dist/cli/index.js +1 -1
  15. package/dist/{config-SWDAJMQ3.js → config-ACVEHBKG.js} +5 -5
  16. package/dist/{orchestrator-T2IPRZ7B.js → orchestrator-OE7WFEW6.js} +5 -4
  17. package/dist/package.json +3 -3
  18. package/dist/{processor-VKFEOK46.js → processor-GAOK7TPI.js} +2 -2
  19. package/dist/{provider-CDM4LQAC.js → provider-RLQMVV2Z.js} +7 -7
  20. package/dist/{serve-X3PKC27B.js → serve-3L3HLUVT.js} +9 -9
  21. package/dist/server/index.js +7 -7
  22. package/dist/{tools-4ODVFMW7.js → tools-CSV7G554.js} +4 -3
  23. package/dist/{vision-fallback-VXGCQKLA.js → vision-fallback-QJ26DCEF.js} +2 -2
  24. package/dist/web/assets/index-VCGZnpy0.js +153 -0
  25. package/dist/web/assets/{index-B9-lT3Kc.css → index-y9uYQYP-.css} +1 -1
  26. package/dist/web/index.html +2 -2
  27. package/dist/web/sw.js +1 -1
  28. package/package.json +3 -3
  29. package/dist/web/assets/index-DHP3d5Cl.js +0 -151
@@ -1,151 +0,0 @@
1
- var L1=Object.defineProperty;var R1=(e,r,i)=>r in e?L1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var ir=(e,r,i)=>R1(e,typeof r!="symbol"?r+"":r,i);function O1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in e)){const u=Object.getOwnPropertyDescriptor(s,l);u&&Object.defineProperty(e,l,u.get?u:{enumerable:!0,get:()=>s[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"]'))s(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function i(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 s(l){if(l.ep)return;l.ep=!0;const u=i(l);fetch(l.href,u)}})();function $l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bd={exports:{}},Ea={};/**
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 ox;function M1(){if(ox)return Ea;ox=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,l,u){var f=null;if(u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+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:s,key:f,ref:l!==void 0?l:null,props:u}}return Ea.Fragment=r,Ea.jsx=i,Ea.jsxs=i,Ea}var lx;function I1(){return lx||(lx=1,bd.exports=M1()),bd.exports}var o=I1(),yd={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 cx;function B1(){if(cx)return We;cx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),x=Symbol.iterator;function _(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function v(M,V,F){this.props=M,this.context=V,this.refs=b,this.updater=F||E}v.prototype.isReactComponent={},v.prototype.setState=function(M,V){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,V,"setState")},v.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function y(){}y.prototype=v.prototype;function S(M,V,F){this.props=M,this.context=V,this.refs=b,this.updater=F||E}var j=S.prototype=new y;j.constructor=S,C(j,v.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(M,V,F){var re=F.ref;return{$$typeof:e,type:M,key:V,ref:re!==void 0?re:null,props:F}}function z(M,V){return I(M.type,V,M.props)}function q(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function K(M){var V={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(F){return V[F]})}var W=/\/+/g;function R(M,V){return typeof M=="object"&&M!==null&&M.key!=null?K(""+M.key):V.toString(36)}function U(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(N,N):(M.status="pending",M.then(function(V){M.status==="pending"&&(M.status="fulfilled",M.value=V)},function(V){M.status==="pending"&&(M.status="rejected",M.reason=V)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function H(M,V,F,re,Q){var ee=typeof M;(ee==="undefined"||ee==="boolean")&&(M=null);var Y=!1;if(M===null)Y=!0;else switch(ee){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(M.$$typeof){case e:case r:Y=!0;break;case g:return Y=M._init,H(Y(M._payload),V,F,re,Q)}}if(Y)return Q=Q(M),Y=re===""?"."+R(M,0):re,A(Q)?(F="",Y!=null&&(F=Y.replace(W,"$&/")+"/"),H(Q,V,F,"",function(ne){return ne})):Q!=null&&(q(Q)&&(Q=z(Q,F+(Q.key==null||M&&M.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+Y)),V.push(Q)),1;Y=0;var $=re===""?".":re+":";if(A(M))for(var ae=0;ae<M.length;ae++)re=M[ae],ee=$+R(re,ae),Y+=H(re,V,F,ee,Q);else if(ae=_(M),typeof ae=="function")for(M=ae.call(M),ae=0;!(re=M.next()).done;)re=re.value,ee=$+R(re,ae++),Y+=H(re,V,F,ee,Q);else if(ee==="object"){if(typeof M.then=="function")return H(U(M),V,F,re,Q);throw V=String(M),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Y}function X(M,V,F){if(M==null)return M;var re=[],Q=0;return H(M,re,"","",function(ee){return V.call(F,ee,Q++)}),re}function Z(M){if(M._status===-1){var V=M._result;V=V(),V.then(function(F){(M._status===0||M._status===-1)&&(M._status=1,M._result=F)},function(F){(M._status===0||M._status===-1)&&(M._status=2,M._result=F)}),M._status===-1&&(M._status=0,M._result=V)}if(M._status===1)return M._result.default;throw M._result}var B=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},L={map:X,forEach:function(M,V,F){X(M,function(){V.apply(this,arguments)},F)},count:function(M){var V=0;return X(M,function(){V++}),V},toArray:function(M){return X(M,function(V){return V})||[]},only:function(M){if(!q(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return We.Activity=m,We.Children=L,We.Component=v,We.Fragment=i,We.Profiler=l,We.PureComponent=S,We.StrictMode=s,We.Suspense=d,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,We.__COMPILER_RUNTIME={__proto__:null,c:function(M){return D.H.useMemoCache(M)}},We.cache=function(M){return function(){return M.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(M,V,F){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var re=C({},M.props),Q=M.key;if(V!=null)for(ee in V.key!==void 0&&(Q=""+V.key),V)!T.call(V,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&V.ref===void 0||(re[ee]=V[ee]);var ee=arguments.length-2;if(ee===1)re.children=F;else if(1<ee){for(var Y=Array(ee),$=0;$<ee;$++)Y[$]=arguments[$+2];re.children=Y}return I(M.type,Q,re)},We.createContext=function(M){return M={$$typeof:f,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},We.createElement=function(M,V,F){var re,Q={},ee=null;if(V!=null)for(re in V.key!==void 0&&(ee=""+V.key),V)T.call(V,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Q[re]=V[re]);var Y=arguments.length-2;if(Y===1)Q.children=F;else if(1<Y){for(var $=Array(Y),ae=0;ae<Y;ae++)$[ae]=arguments[ae+2];Q.children=$}if(M&&M.defaultProps)for(re in Y=M.defaultProps,Y)Q[re]===void 0&&(Q[re]=Y[re]);return I(M,ee,Q)},We.createRef=function(){return{current:null}},We.forwardRef=function(M){return{$$typeof:c,render:M}},We.isValidElement=q,We.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:Z}},We.memo=function(M,V){return{$$typeof:p,type:M,compare:V===void 0?null:V}},We.startTransition=function(M){var V=D.T,F={};D.T=F;try{var re=M(),Q=D.S;Q!==null&&Q(F,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(N,B)}catch(ee){B(ee)}finally{V!==null&&F.types!==null&&(V.types=F.types),D.T=V}},We.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},We.use=function(M){return D.H.use(M)},We.useActionState=function(M,V,F){return D.H.useActionState(M,V,F)},We.useCallback=function(M,V){return D.H.useCallback(M,V)},We.useContext=function(M){return D.H.useContext(M)},We.useDebugValue=function(){},We.useDeferredValue=function(M,V){return D.H.useDeferredValue(M,V)},We.useEffect=function(M,V){return D.H.useEffect(M,V)},We.useEffectEvent=function(M){return D.H.useEffectEvent(M)},We.useId=function(){return D.H.useId()},We.useImperativeHandle=function(M,V,F){return D.H.useImperativeHandle(M,V,F)},We.useInsertionEffect=function(M,V){return D.H.useInsertionEffect(M,V)},We.useLayoutEffect=function(M,V){return D.H.useLayoutEffect(M,V)},We.useMemo=function(M,V){return D.H.useMemo(M,V)},We.useOptimistic=function(M,V){return D.H.useOptimistic(M,V)},We.useReducer=function(M,V,F){return D.H.useReducer(M,V,F)},We.useRef=function(M){return D.H.useRef(M)},We.useState=function(M){return D.H.useState(M)},We.useSyncExternalStore=function(M,V,F){return D.H.useSyncExternalStore(M,V,F)},We.useTransition=function(){return D.H.useTransition()},We.version="19.2.4",We}var ux;function ql(){return ux||(ux=1,yd.exports=B1()),yd.exports}var P=ql();const un=$l(P),z1=O1({__proto__:null,default:un},[P]);var _d={exports:{}},ja={},Sd={exports:{}},wd={};/**
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 H1(){return dx||(dx=1,(function(e){function r(H,X){var Z=H.length;H.push(X);e:for(;0<Z;){var B=Z-1>>>1,L=H[B];if(0<l(L,X))H[B]=X,H[Z]=L,Z=B;else break e}}function i(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var X=H[0],Z=H.pop();if(Z!==X){H[0]=Z;e:for(var B=0,L=H.length,M=L>>>1;B<M;){var V=2*(B+1)-1,F=H[V],re=V+1,Q=H[re];if(0>l(F,Z))re<L&&0>l(Q,F)?(H[B]=Q,H[re]=Z,B=re):(H[B]=F,H[V]=Z,B=V);else if(re<L&&0>l(Q,Z))H[B]=Q,H[re]=Z,B=re;else break e}}return X}function l(H,X){var Z=H.sortIndex-X.sortIndex;return Z!==0?Z:H.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var f=Date,c=f.now();e.unstable_now=function(){return f.now()-c}}var d=[],p=[],g=1,m=null,x=3,_=!1,E=!1,C=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function j(H){for(var X=i(p);X!==null;){if(X.callback===null)s(p);else if(X.startTime<=H)s(p),X.sortIndex=X.expirationTime,r(d,X);else break;X=i(p)}}function A(H){if(C=!1,j(H),!E)if(i(d)!==null)E=!0,N||(N=!0,K());else{var X=i(p);X!==null&&U(A,X.startTime-H)}}var N=!1,D=-1,T=5,I=-1;function z(){return b?!0:!(e.unstable_now()-I<T)}function q(){if(b=!1,N){var H=e.unstable_now();I=H;var X=!0;try{e:{E=!1,C&&(C=!1,y(D),D=-1),_=!0;var Z=x;try{t:{for(j(H),m=i(d);m!==null&&!(m.expirationTime>H&&z());){var B=m.callback;if(typeof B=="function"){m.callback=null,x=m.priorityLevel;var L=B(m.expirationTime<=H);if(H=e.unstable_now(),typeof L=="function"){m.callback=L,j(H),X=!0;break t}m===i(d)&&s(d),j(H)}else s(d);m=i(d)}if(m!==null)X=!0;else{var M=i(p);M!==null&&U(A,M.startTime-H),X=!1}}break e}finally{m=null,x=Z,_=!1}X=void 0}}finally{X?K():N=!1}}}var K;if(typeof S=="function")K=function(){S(q)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,R=W.port2;W.port1.onmessage=q,K=function(){R.postMessage(null)}}else K=function(){v(q,0)};function U(H,X){D=v(function(){H(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(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"):T=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(H){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var Z=x;x=X;try{return H()}finally{x=Z}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(H,X){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var Z=x;x=H;try{return X()}finally{x=Z}},e.unstable_scheduleCallback=function(H,X,Z){var B=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?B+Z:B):Z=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=Z+L,H={id:g++,callback:X,priorityLevel:H,startTime:Z,expirationTime:L,sortIndex:-1},Z>B?(H.sortIndex=Z,r(p,H),i(d)===null&&H===i(p)&&(C?(y(D),D=-1):C=!0,U(A,Z-B))):(H.sortIndex=L,r(d,H),E||_||(E=!0,N||(N=!0,K()))),H},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(H){var X=x;return function(){var Z=x;x=X;try{return H.apply(this,arguments)}finally{x=Z}}}})(wd)),wd}var hx;function P1(){return hx||(hx=1,Sd.exports=H1()),Sd.exports}var Cd={exports:{}},ln={};/**
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 fx;function F1(){if(fx)return ln;fx=1;var e=ql();function r(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(d,p,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:m==null?null:""+m,children:d,containerInfo:p,implementation:g}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,ln.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return u(d,p,null,g)},ln.flushSync=function(d){var p=f.T,g=s.p;try{if(f.T=null,s.p=2,d)return d()}finally{f.T=p,s.p=g,s.d.f()}},ln.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(d,p))},ln.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},ln.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,m=c(g,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:x,fetchPriority:_}):g==="script"&&s.d.X(d,{crossOrigin:m,integrity:x,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},ln.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=c(p.as,p.crossOrigin);s.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(d)},ln.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=c(g,p.crossOrigin);s.d.L(d,g,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},ln.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=c(p.as,p.crossOrigin);s.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(d)},ln.requestFormReset=function(d){s.d.r(d)},ln.unstable_batchedUpdates=function(d,p){return d(p)},ln.useFormState=function(d,p,g){return f.H.useFormState(d,p,g)},ln.useFormStatus=function(){return f.H.useHostTransitionStatus()},ln.version="19.2.4",ln}var px;function ab(){if(px)return Cd.exports;px=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),Cd.exports=F1(),Cd.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 U1(){if(mx)return ja;mx=1;var e=P1(),r=ql(),i=ab();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function f(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function 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(s(188))}function p(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,h=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return d(w),t;if(k===h)return d(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==h.return)a=w,h=k;else{for(var O=!1,G=w.child;G;){if(G===a){O=!0,a=w,h=k;break}if(G===h){O=!0,h=w,a=k;break}G=G.sibling}if(!O){for(G=k.child;G;){if(G===a){O=!0,a=k,h=w;break}if(G===h){O=!0,h=k,a=w;break}G=G.sibling}if(!O)throw Error(s(189))}}if(a.alternate!==h)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),S=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function K(t){return t===null||typeof t!="object"?null:(t=q&&t[q]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function R(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 v:return"Profiler";case b:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case S:return t.displayName||"Context";case y: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:R(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return R(t(n))}catch{}}return null}var U=Array.isArray,H=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},B=[],L=-1;function M(t){return{current:t}}function V(t){0>L||(t.current=B[L],B[L]=null,L--)}function F(t,n){L++,B[L]=t.current,t.current=n}var re=M(null),Q=M(null),ee=M(null),Y=M(null);function $(t,n){switch(F(ee,n),F(Q,t),F(re,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Ag(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Ag(n),t=Dg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}V(re),F(re,t)}function ae(){V(re),V(Q),V(ee)}function ne(t){t.memoizedState!==null&&F(Y,t);var n=re.current,a=Dg(n,t.type);n!==a&&(F(Q,t),F(re,a))}function ve(t){Q.current===t&&(V(re),V(Q)),Y.current===t&&(V(Y),Sa._currentValue=Z)}var ye,Ae;function Re(t){if(ye===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ye=n&&n[1]||"",Ae=-1<a.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ye+t+Ae}var He=!1;function Ue(t,n){if(!t||He)return"";He=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(n){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(de){var ce=de}Reflect.construct(t,[],be)}else{try{be.call()}catch(de){ce=de}t.call(be.prototype)}}else{try{throw Error()}catch(de){ce=de}(be=t())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(de){if(de&&ce&&typeof de.stack=="string")return[de.stack,ce.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=h.DetermineComponentFrameRoot(),O=k[0],G=k[1];if(O&&G){var J=O.split(`
44
- `),le=G.split(`
45
- `);for(w=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(h===J.length||w===le.length)for(h=J.length-1,w=le.length-1;1<=h&&0<=w&&J[h]!==le[w];)w--;for(;1<=h&&0<=w;h--,w--)if(J[h]!==le[w]){if(h!==1||w!==1)do if(h--,w--,0>w||J[h]!==le[w]){var pe=`
46
- `+J[h].replace(" at new "," at ");return t.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",t.displayName)),pe}while(1<=h&&0<=w);break}}}finally{He=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Re(a):""}function Ee(t,n){switch(t.tag){case 26:case 27:case 5:return Re(t.type);case 16:return Re("Lazy");case 13:return t.child!==n&&n!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("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 Re("Activity");default:return""}}function xe(t){try{var n="",a=null;do n+=Ee(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
47
- Error generating stack: `+h.message+`
48
- `+h.stack}}var Ne=Object.prototype.hasOwnProperty,$e=e.unstable_scheduleCallback,At=e.unstable_cancelCallback,me=e.unstable_shouldYield,je=e.unstable_requestPaint,Oe=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,kt=e.log,Xe=e.unstable_setDisableYieldValue,Dt=null,Et=null;function Yt(t){if(typeof kt=="function"&&Xe(t),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(Dt,t)}catch{}}var st=Math.clz32?Math.clz32:he,In=Math.log,en=Math.LN2;function he(t){return t>>>=0,t===0?32:31-(In(t)/en|0)|0}var se=256,fe=262144,Se=4194304;function Me(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 qe(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,k=t.suspendedLanes,O=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~k,h!==0?w=Me(h):(O&=G,O!==0?w=Me(O):a||(a=G&~t,a!==0&&(w=Me(a))))):(G=h&~k,G!==0?w=Me(G):O!==0?w=Me(O):a||(a=h&~t,a!==0&&(w=Me(a)))),w===0?0:n!==0&&n!==w&&(n&k)===0&&(k=w&-w,a=n&-n,k>=a||k===32&&(a&4194048)!==0)?n:w}function Be(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Lt(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 vt(){var t=Se;return Se<<=1,(Se&62914560)===0&&(Se=4194304),t}function qt(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Hi(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function oc(t,n,a,h,w,k){var O=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=O&~a;0<a;){var pe=31-st(a),be=1<<pe;G[pe]=0,J[pe]=-1;var ce=le[pe];if(ce!==null)for(le[pe]=null,pe=0;pe<ce.length;pe++){var de=ce[pe];de!==null&&(de.lane&=-536870913)}a&=~be}h!==0&&hf(t,h,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(O&~n))}function hf(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-st(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function ff(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-st(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function pf(t,n){var a=n&-n;return a=(a&42)!==0?1:lc(a),(a&(t.suspendedLanes|n))!==0?0:a}function lc(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 cc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function mf(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:ex(t.type))}function gf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Rr=Math.random().toString(36).slice(2),tn="__reactFiber$"+Rr,mn="__reactProps$"+Rr,Pi="__reactContainer$"+Rr,uc="__reactEvents$"+Rr,_0="__reactListeners$"+Rr,S0="__reactHandles$"+Rr,xf="__reactResources$"+Rr,Bs="__reactMarker$"+Rr;function dc(t){delete t[tn],delete t[mn],delete t[uc],delete t[_0],delete t[S0]}function Fi(t){var n=t[tn];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Pi]||a[tn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=zg(t);t!==null;){if(a=t[tn])return a;t=zg(t)}return n}t=a,a=t.parentNode}return null}function Ui(t){if(t=t[tn]||t[Pi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function zs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function $i(t){var n=t[xf];return n||(n=t[xf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Xt(t){t[Bs]=!0}var vf=new Set,bf={};function li(t,n){qi(t,n),qi(t+"Capture",n)}function qi(t,n){for(bf[t]=n,t=0;t<n.length;t++)vf.add(n[t])}var w0=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]*$"),yf={},_f={};function C0(t){return Ne.call(_f,t)?!0:Ne.call(yf,t)?!1:w0.test(t)?_f[t]=!0:(yf[t]=!0,!1)}function oo(t,n,a){if(C0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function lo(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function dr(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function Bn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Sf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function k0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,k=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(O){a=""+O,k.call(this,O)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(O){a=""+O},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function hc(t){if(!t._valueTracker){var n=Sf(t)?"checked":"value";t._valueTracker=k0(t,n,""+t[n])}}function wf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=Sf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function co(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 E0=/[\n"\\]/g;function zn(t){return t.replace(E0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function fc(t,n,a,h,w,k,O,G){t.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?t.type=O:t.removeAttribute("type"),n!=null?O==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Bn(n)):t.value!==""+Bn(n)&&(t.value=""+Bn(n)):O!=="submit"&&O!=="reset"||t.removeAttribute("value"),n!=null?pc(t,O,Bn(n)):a!=null?pc(t,O,Bn(a)):h!=null&&t.removeAttribute("value"),w==null&&k!=null&&(t.defaultChecked=!!k),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Bn(G):t.removeAttribute("name")}function Cf(t,n,a,h,w,k,O,G){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.type=k),n!=null||a!=null){if(!(k!=="submit"&&k!=="reset"||n!=null)){hc(t);return}a=a!=null?""+Bn(a):"",n=n!=null?""+Bn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(t.name=O),hc(t)}function pc(t,n,a){n==="number"&&co(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Wi(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+Bn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function kf(t,n,a){if(n!=null&&(n=""+Bn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Bn(a):""}function Ef(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(U(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Bn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),hc(t)}function Gi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var j0=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 jf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||j0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Nf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&jf(t,w,h)}else for(var k in n)n.hasOwnProperty(k)&&jf(t,k,n[k])}function mc(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 N0=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"]]),T0=/^[\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 uo(t){return T0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function hr(){}var gc=null;function xc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vi=null,Ki=null;function Tf(t){var n=Ui(t);if(n&&(t=n.stateNode)){var a=t[mn]||null;e:switch(t=n.stateNode,n.type){case"input":if(fc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+zn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[mn]||null;if(!w)throw Error(s(90));fc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&wf(h)}break e;case"textarea":kf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Wi(t,!!a.multiple,n,!1)}}}var vc=!1;function Af(t,n,a){if(vc)return t(n,a);vc=!0;try{var h=t(n);return h}finally{if(vc=!1,(Vi!==null||Ki!==null)&&(Qo(),Vi&&(n=Vi,t=Ki,Ki=Vi=null,Tf(n),t)))for(n=0;n<t.length;n++)Tf(t[n])}}function Hs(t,n){var a=t.stateNode;if(a===null)return null;var h=a[mn]||null;if(h===null)return null;a=h[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bc=!1;if(fr)try{var Ps={};Object.defineProperty(Ps,"passive",{get:function(){bc=!0}}),window.addEventListener("test",Ps,Ps),window.removeEventListener("test",Ps,Ps)}catch{bc=!1}var Or=null,yc=null,ho=null;function Df(){if(ho)return ho;var t,n=yc,a=n.length,h,w="value"in Or?Or.value:Or.textContent,k=w.length;for(t=0;t<a&&n[t]===w[t];t++);var O=a-t;for(h=1;h<=O&&n[a-h]===w[k-h];h++);return ho=w.slice(t,1<h?1-h:void 0)}function fo(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 po(){return!0}function Lf(){return!1}function gn(t){function n(a,h,w,k,O){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=k,this.target=O,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(k):k[G]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?po:Lf,this.isPropagationStopped=Lf,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=po)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=po)},persist:function(){},isPersistent:po}),n}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mo=gn(ci),Fs=m({},ci,{view:0,detail:0}),A0=gn(Fs),_c,Sc,Us,go=m({},Fs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cc,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!==Us&&(Us&&t.type==="mousemove"?(_c=t.screenX-Us.screenX,Sc=t.screenY-Us.screenY):Sc=_c=0,Us=t),_c)},movementY:function(t){return"movementY"in t?t.movementY:Sc}}),Rf=gn(go),D0=m({},go,{dataTransfer:0}),L0=gn(D0),R0=m({},Fs,{relatedTarget:0}),wc=gn(R0),O0=m({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),M0=gn(O0),I0=m({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),B0=gn(I0),z0=m({},ci,{data:0}),Of=gn(z0),H0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P0={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"},F0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function U0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=F0[t])?!!n[t]:!1}function Cc(){return U0}var $0=m({},Fs,{key:function(t){if(t.key){var n=H0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=fo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?P0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cc,charCode:function(t){return t.type==="keypress"?fo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?fo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),q0=gn($0),W0=m({},go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mf=gn(W0),G0=m({},Fs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cc}),V0=gn(G0),K0=m({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),Y0=gn(K0),X0=m({},go,{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}),Z0=gn(X0),Q0=m({},ci,{newState:0,oldState:0}),J0=gn(Q0),e_=[9,13,27,32],kc=fr&&"CompositionEvent"in window,$s=null;fr&&"documentMode"in document&&($s=document.documentMode);var t_=fr&&"TextEvent"in window&&!$s,If=fr&&(!kc||$s&&8<$s&&11>=$s),Bf=" ",zf=!1;function Hf(t,n){switch(t){case"keyup":return e_.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yi=!1;function n_(t,n){switch(t){case"compositionend":return Pf(n);case"keypress":return n.which!==32?null:(zf=!0,Bf);case"textInput":return t=n.data,t===Bf&&zf?null:t;default:return null}}function r_(t,n){if(Yi)return t==="compositionend"||!kc&&Hf(t,n)?(t=Df(),ho=yc=Or=null,Yi=!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 If&&n.locale!=="ko"?null:n.data;default:return null}}var i_={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 Ff(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!i_[t.type]:n==="textarea"}function Uf(t,n,a,h){Vi?Ki?Ki.push(h):Ki=[h]:Vi=h,n=sl(n,"onChange"),0<n.length&&(a=new mo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var qs=null,Ws=null;function s_(t){Cg(t,0)}function xo(t){var n=zs(t);if(wf(n))return t}function $f(t,n){if(t==="change")return n}var qf=!1;if(fr){var Ec;if(fr){var jc="oninput"in document;if(!jc){var Wf=document.createElement("div");Wf.setAttribute("oninput","return;"),jc=typeof Wf.oninput=="function"}Ec=jc}else Ec=!1;qf=Ec&&(!document.documentMode||9<document.documentMode)}function Gf(){qs&&(qs.detachEvent("onpropertychange",Vf),Ws=qs=null)}function Vf(t){if(t.propertyName==="value"&&xo(Ws)){var n=[];Uf(n,Ws,t,xc(t)),Af(s_,n)}}function a_(t,n,a){t==="focusin"?(Gf(),qs=n,Ws=a,qs.attachEvent("onpropertychange",Vf)):t==="focusout"&&Gf()}function o_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return xo(Ws)}function l_(t,n){if(t==="click")return xo(n)}function c_(t,n){if(t==="input"||t==="change")return xo(n)}function u_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Cn=typeof Object.is=="function"?Object.is:u_;function Gs(t,n){if(Cn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!Ne.call(n,w)||!Cn(t[w],n[w]))return!1}return!0}function Kf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Yf(t,n){var a=Kf(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Kf(a)}}function Xf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Xf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Zf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=co(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=co(t.document)}return n}function Nc(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 d_=fr&&"documentMode"in document&&11>=document.documentMode,Xi=null,Tc=null,Vs=null,Ac=!1;function Qf(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ac||Xi==null||Xi!==co(h)||(h=Xi,"selectionStart"in h&&Nc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Vs&&Gs(Vs,h)||(Vs=h,h=sl(Tc,"onSelect"),0<h.length&&(n=new mo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Xi)))}function ui(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Zi={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},Dc={},Jf={};fr&&(Jf=document.createElement("div").style,"AnimationEvent"in window||(delete Zi.animationend.animation,delete Zi.animationiteration.animation,delete Zi.animationstart.animation),"TransitionEvent"in window||delete Zi.transitionend.transition);function di(t){if(Dc[t])return Dc[t];if(!Zi[t])return t;var n=Zi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Jf)return Dc[t]=n[a];return t}var ep=di("animationend"),tp=di("animationiteration"),np=di("animationstart"),h_=di("transitionrun"),f_=di("transitionstart"),p_=di("transitioncancel"),rp=di("transitionend"),ip=new Map,Lc="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(" ");Lc.push("scrollEnd");function Yn(t,n){ip.set(t,n),li(n,[t])}var vo=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)},Hn=[],Qi=0,Rc=0;function bo(){for(var t=Qi,n=Rc=Qi=0;n<t;){var a=Hn[n];Hn[n++]=null;var h=Hn[n];Hn[n++]=null;var w=Hn[n];Hn[n++]=null;var k=Hn[n];if(Hn[n++]=null,h!==null&&w!==null){var O=h.pending;O===null?w.next=w:(w.next=O.next,O.next=w),h.pending=w}k!==0&&sp(a,w,k)}}function yo(t,n,a,h){Hn[Qi++]=t,Hn[Qi++]=n,Hn[Qi++]=a,Hn[Qi++]=h,Rc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Oc(t,n,a,h){return yo(t,n,a,h),_o(t)}function hi(t,n){return yo(t,null,null,n),_o(t)}function sp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,h=k.alternate,h!==null&&(h.childLanes|=a),k.tag===22&&(t=k.stateNode,t===null||t._visibility&1||(w=!0)),t=k,k=k.return;return t.tag===3?(k=t.stateNode,w&&n!==null&&(w=31-st(a),t=k.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),k):null}function _o(t){if(50<ma)throw ma=0,$u=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Ji={};function m_(t,n,a,h){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kn(t,n,a,h){return new m_(t,n,a,h)}function Mc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function pr(t,n){var a=t.alternate;return a===null?(a=kn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function ap(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function So(t,n,a,h,w,k){var O=0;if(h=t,typeof t=="function")Mc(t)&&(O=1);else if(typeof t=="string")O=y1(t,a,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=kn(31,a,n,w),t.elementType=I,t.lanes=k,t;case C:return fi(a.children,w,k,n);case b:O=8,w|=24;break;case v:return t=kn(12,a,n,w|2),t.elementType=v,t.lanes=k,t;case A:return t=kn(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=kn(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:O=10;break e;case y:O=9;break e;case j:O=11;break e;case D:O=14;break e;case T:O=16,h=null;break e}O=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=kn(O,a,n,w),n.elementType=t,n.type=h,n.lanes=k,n}function fi(t,n,a,h){return t=kn(7,t,h,n),t.lanes=a,t}function Ic(t,n,a){return t=kn(6,t,null,n),t.lanes=a,t}function op(t){var n=kn(18,null,null,0);return n.stateNode=t,n}function Bc(t,n,a){return n=kn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var lp=new WeakMap;function Pn(t,n){if(typeof t=="object"&&t!==null){var a=lp.get(t);return a!==void 0?a:(n={value:t,source:n,stack:xe(n)},lp.set(t,n),n)}return{value:t,source:n,stack:xe(n)}}var es=[],ts=0,wo=null,Ks=0,Fn=[],Un=0,Mr=null,er=1,tr="";function mr(t,n){es[ts++]=Ks,es[ts++]=wo,wo=t,Ks=n}function cp(t,n,a){Fn[Un++]=er,Fn[Un++]=tr,Fn[Un++]=Mr,Mr=t;var h=er;t=tr;var w=32-st(h)-1;h&=~(1<<w),a+=1;var k=32-st(n)+w;if(30<k){var O=w-w%5;k=(h&(1<<O)-1).toString(32),h>>=O,w-=O,er=1<<32-st(n)+w|a<<w|h,tr=k+t}else er=1<<k|a<<w|h,tr=t}function zc(t){t.return!==null&&(mr(t,1),cp(t,1,0))}function Hc(t){for(;t===wo;)wo=es[--ts],es[ts]=null,Ks=es[--ts],es[ts]=null;for(;t===Mr;)Mr=Fn[--Un],Fn[Un]=null,tr=Fn[--Un],Fn[Un]=null,er=Fn[--Un],Fn[Un]=null}function up(t,n){Fn[Un++]=er,Fn[Un++]=tr,Fn[Un++]=Mr,er=n.id,tr=n.overflow,Mr=t}var nn=null,yt=null,rt=!1,Ir=null,$n=!1,Pc=Error(s(519));function Br(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ys(Pn(n,t)),Pc}function dp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[tn]=t,n[mn]=h,a){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(a=0;a<xa.length;a++)Qe(xa[a],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":Qe("invalid",n),Cf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Qe("invalid",n);break;case"textarea":Qe("invalid",n),Ef(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Ng(n.textContent,a)?(h.popover!=null&&(Qe("beforetoggle",n),Qe("toggle",n)),h.onScroll!=null&&Qe("scroll",n),h.onScrollEnd!=null&&Qe("scrollend",n),h.onClick!=null&&(n.onclick=hr),n=!0):n=!1,n||Br(t,!0)}function hp(t){for(nn=t.return;nn;)switch(nn.tag){case 5:case 31:case 13:$n=!1;return;case 27:case 3:$n=!0;return;default:nn=nn.return}}function ns(t){if(t!==nn)return!1;if(!rt)return hp(t),rt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||id(t.type,t.memoizedProps)),a=!a),a&&yt&&Br(t),hp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));yt=Bg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));yt=Bg(t)}else n===27?(n=yt,Zr(t.type)?(t=cd,cd=null,yt=t):yt=n):yt=nn?Wn(t.stateNode.nextSibling):null;return!0}function pi(){yt=nn=null,rt=!1}function Fc(){var t=Ir;return t!==null&&(yn===null?yn=t:yn.push.apply(yn,t),Ir=null),t}function Ys(t){Ir===null?Ir=[t]:Ir.push(t)}var Uc=M(null),mi=null,gr=null;function zr(t,n,a){F(Uc,n._currentValue),n._currentValue=a}function xr(t){t._currentValue=Uc.current,V(Uc)}function $c(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function qc(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var O=w.child;k=k.firstContext;e:for(;k!==null;){var G=k;k=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){k.lanes|=a,G=k.alternate,G!==null&&(G.lanes|=a),$c(k.return,a,t),h||(O=null);break e}k=G.next}}else if(w.tag===18){if(O=w.return,O===null)throw Error(s(341));O.lanes|=a,k=O.alternate,k!==null&&(k.lanes|=a),$c(O,a,t),O=null}else O=w.child;if(O!==null)O.return=w;else for(O=w;O!==null;){if(O===t){O=null;break}if(w=O.sibling,w!==null){w.return=O.return,O=w;break}O=O.return}w=O}}function rs(t,n,a,h){t=null;for(var w=n,k=!1;w!==null;){if(!k){if((w.flags&524288)!==0)k=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var O=w.alternate;if(O===null)throw Error(s(387));if(O=O.memoizedProps,O!==null){var G=w.type;Cn(w.pendingProps.value,O.value)||(t!==null?t.push(G):t=[G])}}else if(w===Y.current){if(O=w.alternate,O===null)throw Error(s(387));O.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(Sa):t=[Sa])}w=w.return}t!==null&&qc(n,t,a,h),n.flags|=262144}function Co(t){for(t=t.firstContext;t!==null;){if(!Cn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function gi(t){mi=t,gr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function rn(t){return fp(mi,t)}function ko(t,n){return mi===null&&gi(t),fp(t,n)}function fp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},gr===null){if(t===null)throw Error(s(308));gr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else gr=gr.next=n;return a}var g_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},x_=e.unstable_scheduleCallback,v_=e.unstable_NormalPriority,Bt={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wc(){return{controller:new g_,data:new Map,refCount:0}}function Xs(t){t.refCount--,t.refCount===0&&x_(v_,function(){t.controller.abort()})}var Zs=null,Gc=0,is=0,ss=null;function b_(t,n){if(Zs===null){var a=Zs=[];Gc=0,is=Yu(),ss={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Gc++,n.then(pp,pp),n}function pp(){if(--Gc===0&&Zs!==null){ss!==null&&(ss.status="fulfilled");var t=Zs;Zs=null,is=0,ss=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function y_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var mp=H.S;H.S=function(t,n){Qm=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&b_(t,n),mp!==null&&mp(t,n)};var xi=M(null);function Vc(){var t=xi.current;return t!==null?t:gt.pooledCache}function Eo(t,n){n===null?F(xi,xi.current):F(xi,n.pool)}function gp(){var t=Vc();return t===null?null:{parent:Bt._currentValue,pool:t}}var as=Error(s(460)),Kc=Error(s(474)),jo=Error(s(542)),No={then:function(){}};function xp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function vp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(hr,hr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,yp(t),t;default:if(typeof n.status=="string")n.then(hr,hr);else{if(t=gt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,yp(t),t}throw bi=n,as}}function vi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bi=a,as):a}}var bi=null;function bp(){if(bi===null)throw Error(s(459));var t=bi;return bi=null,t}function yp(t){if(t===as||t===jo)throw Error(s(483))}var os=null,Qs=0;function To(t){var n=Qs;return Qs+=1,os===null&&(os=[]),vp(os,t,n)}function Js(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Ao(t,n){throw n.$$typeof===x?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function _p(t){function n(ie,te){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[te],ie.flags|=16):oe.push(te)}}function a(ie,te){if(!t)return null;for(;te!==null;)n(ie,te),te=te.sibling;return null}function h(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function w(ie,te){return ie=pr(ie,te),ie.index=0,ie.sibling=null,ie}function k(ie,te,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<te?(ie.flags|=67108866,te):oe):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function O(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function G(ie,te,oe,ge){return te===null||te.tag!==6?(te=Ic(oe,ie.mode,ge),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function J(ie,te,oe,ge){var ze=oe.type;return ze===C?pe(ie,te,oe.props.children,ge,oe.key):te!==null&&(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type)?(te=w(te,oe.props),Js(te,oe),te.return=ie,te):(te=So(oe.type,oe.key,oe.props,null,ie.mode,ge),Js(te,oe),te.return=ie,te)}function le(ie,te,oe,ge){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Bc(oe,ie.mode,ge),te.return=ie,te):(te=w(te,oe.children||[]),te.return=ie,te)}function pe(ie,te,oe,ge,ze){return te===null||te.tag!==7?(te=fi(oe,ie.mode,ge,ze),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function be(ie,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Ic(""+te,ie.mode,oe),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return oe=So(te.type,te.key,te.props,null,ie.mode,oe),Js(oe,te),oe.return=ie,oe;case E:return te=Bc(te,ie.mode,oe),te.return=ie,te;case T:return te=vi(te),be(ie,te,oe)}if(U(te)||K(te))return te=fi(te,ie.mode,oe,null),te.return=ie,te;if(typeof te.then=="function")return be(ie,To(te),oe);if(te.$$typeof===S)return be(ie,ko(ie,te),oe);Ao(ie,te)}return null}function ce(ie,te,oe,ge){var ze=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return ze!==null?null:G(ie,te,""+oe,ge);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return oe.key===ze?J(ie,te,oe,ge):null;case E:return oe.key===ze?le(ie,te,oe,ge):null;case T:return oe=vi(oe),ce(ie,te,oe,ge)}if(U(oe)||K(oe))return ze!==null?null:pe(ie,te,oe,ge,null);if(typeof oe.then=="function")return ce(ie,te,To(oe),ge);if(oe.$$typeof===S)return ce(ie,te,ko(ie,oe),ge);Ao(ie,oe)}return null}function de(ie,te,oe,ge,ze){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ie=ie.get(oe)||null,G(te,ie,""+ge,ze);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case _:return ie=ie.get(ge.key===null?oe:ge.key)||null,J(te,ie,ge,ze);case E:return ie=ie.get(ge.key===null?oe:ge.key)||null,le(te,ie,ge,ze);case T:return ge=vi(ge),de(ie,te,oe,ge,ze)}if(U(ge)||K(ge))return ie=ie.get(oe)||null,pe(te,ie,ge,ze,null);if(typeof ge.then=="function")return de(ie,te,oe,To(ge),ze);if(ge.$$typeof===S)return de(ie,te,oe,ko(te,ge),ze);Ao(te,ge)}return null}function De(ie,te,oe,ge){for(var ze=null,at=null,Le=te,Ke=te=0,nt=null;Le!==null&&Ke<oe.length;Ke++){Le.index>Ke?(nt=Le,Le=null):nt=Le.sibling;var ot=ce(ie,Le,oe[Ke],ge);if(ot===null){Le===null&&(Le=nt);break}t&&Le&&ot.alternate===null&&n(ie,Le),te=k(ot,te,Ke),at===null?ze=ot:at.sibling=ot,at=ot,Le=nt}if(Ke===oe.length)return a(ie,Le),rt&&mr(ie,Ke),ze;if(Le===null){for(;Ke<oe.length;Ke++)Le=be(ie,oe[Ke],ge),Le!==null&&(te=k(Le,te,Ke),at===null?ze=Le:at.sibling=Le,at=Le);return rt&&mr(ie,Ke),ze}for(Le=h(Le);Ke<oe.length;Ke++)nt=de(Le,ie,Ke,oe[Ke],ge),nt!==null&&(t&&nt.alternate!==null&&Le.delete(nt.key===null?Ke:nt.key),te=k(nt,te,Ke),at===null?ze=nt:at.sibling=nt,at=nt);return t&&Le.forEach(function(ni){return n(ie,ni)}),rt&&mr(ie,Ke),ze}function Fe(ie,te,oe,ge){if(oe==null)throw Error(s(151));for(var ze=null,at=null,Le=te,Ke=te=0,nt=null,ot=oe.next();Le!==null&&!ot.done;Ke++,ot=oe.next()){Le.index>Ke?(nt=Le,Le=null):nt=Le.sibling;var ni=ce(ie,Le,ot.value,ge);if(ni===null){Le===null&&(Le=nt);break}t&&Le&&ni.alternate===null&&n(ie,Le),te=k(ni,te,Ke),at===null?ze=ni:at.sibling=ni,at=ni,Le=nt}if(ot.done)return a(ie,Le),rt&&mr(ie,Ke),ze;if(Le===null){for(;!ot.done;Ke++,ot=oe.next())ot=be(ie,ot.value,ge),ot!==null&&(te=k(ot,te,Ke),at===null?ze=ot:at.sibling=ot,at=ot);return rt&&mr(ie,Ke),ze}for(Le=h(Le);!ot.done;Ke++,ot=oe.next())ot=de(Le,ie,Ke,ot.value,ge),ot!==null&&(t&&ot.alternate!==null&&Le.delete(ot.key===null?Ke:ot.key),te=k(ot,te,Ke),at===null?ze=ot:at.sibling=ot,at=ot);return t&&Le.forEach(function(D1){return n(ie,D1)}),rt&&mr(ie,Ke),ze}function mt(ie,te,oe,ge){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:e:{for(var ze=oe.key;te!==null;){if(te.key===ze){if(ze=oe.type,ze===C){if(te.tag===7){a(ie,te.sibling),ge=w(te,oe.props.children),ge.return=ie,ie=ge;break e}}else if(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type){a(ie,te.sibling),ge=w(te,oe.props),Js(ge,oe),ge.return=ie,ie=ge;break e}a(ie,te);break}else n(ie,te);te=te.sibling}oe.type===C?(ge=fi(oe.props.children,ie.mode,ge,oe.key),ge.return=ie,ie=ge):(ge=So(oe.type,oe.key,oe.props,null,ie.mode,ge),Js(ge,oe),ge.return=ie,ie=ge)}return O(ie);case E:e:{for(ze=oe.key;te!==null;){if(te.key===ze)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){a(ie,te.sibling),ge=w(te,oe.children||[]),ge.return=ie,ie=ge;break e}else{a(ie,te);break}else n(ie,te);te=te.sibling}ge=Bc(oe,ie.mode,ge),ge.return=ie,ie=ge}return O(ie);case T:return oe=vi(oe),mt(ie,te,oe,ge)}if(U(oe))return De(ie,te,oe,ge);if(K(oe)){if(ze=K(oe),typeof ze!="function")throw Error(s(150));return oe=ze.call(oe),Fe(ie,te,oe,ge)}if(typeof oe.then=="function")return mt(ie,te,To(oe),ge);if(oe.$$typeof===S)return mt(ie,te,ko(ie,oe),ge);Ao(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(a(ie,te.sibling),ge=w(te,oe),ge.return=ie,ie=ge):(a(ie,te),ge=Ic(oe,ie.mode,ge),ge.return=ie,ie=ge),O(ie)):a(ie,te)}return function(ie,te,oe,ge){try{Qs=0;var ze=mt(ie,te,oe,ge);return os=null,ze}catch(Le){if(Le===as||Le===jo)throw Le;var at=kn(29,Le,null,ie.mode);return at.lanes=ge,at.return=ie,at}finally{}}}var yi=_p(!0),Sp=_p(!1),Hr=!1;function Yc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xc(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 Pr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Fr(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(lt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=_o(t),sp(t,null,a),n}return yo(t,h,n,a),_o(t)}function ea(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,ff(t,a)}}function Zc(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var O={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=O:k=k.next=O,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Qc=!1;function ta(){if(Qc){var t=ss;if(t!==null)throw t}}function na(t,n,a,h){Qc=!1;var w=t.updateQueue;Hr=!1;var k=w.firstBaseUpdate,O=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,O===null?k=le:O.next=le,O=J;var pe=t.alternate;pe!==null&&(pe=pe.updateQueue,G=pe.lastBaseUpdate,G!==O&&(G===null?pe.firstBaseUpdate=le:G.next=le,pe.lastBaseUpdate=J))}if(k!==null){var be=w.baseState;O=0,pe=le=J=null,G=k;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(tt&ce)===ce:(h&ce)===ce){ce!==0&&ce===is&&(Qc=!0),pe!==null&&(pe=pe.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var De=t,Fe=G;ce=n;var mt=a;switch(Fe.tag){case 1:if(De=Fe.payload,typeof De=="function"){be=De.call(mt,be,ce);break e}be=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Fe.payload,ce=typeof De=="function"?De.call(mt,be,ce):De,ce==null)break e;be=m({},be,ce);break e;case 2:Hr=!0}}ce=G.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},pe===null?(le=pe=de,J=be):pe=pe.next=de,O|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);pe===null&&(J=be),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=pe,k===null&&(w.shared.lanes=0),Gr|=O,t.lanes=O,t.memoizedState=be}}function wp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Cp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)wp(a[t],n)}var ls=M(null),Do=M(0);function kp(t,n){t=Er,F(Do,t),F(ls,n),Er=t|n.baseLanes}function Jc(){F(Do,Er),F(ls,ls.current)}function eu(){Er=Do.current,V(ls),V(Do)}var En=M(null),qn=null;function Ur(t){var n=t.alternate;F(Rt,Rt.current&1),F(En,t),qn===null&&(n===null||ls.current!==null||n.memoizedState!==null)&&(qn=t)}function tu(t){F(Rt,Rt.current),F(En,t),qn===null&&(qn=t)}function Ep(t){t.tag===22?(F(Rt,Rt.current),F(En,t),qn===null&&(qn=t)):$r()}function $r(){F(Rt,Rt.current),F(En,En.current)}function jn(t){V(En),qn===t&&(qn=null),V(Rt)}var Rt=M(0);function Lo(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||od(a)||ld(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var vr=0,Ve=null,ft=null,zt=null,Ro=!1,cs=!1,_i=!1,Oo=0,ra=0,us=null,__=0;function Nt(){throw Error(s(321))}function nu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Cn(t[a],n[a]))return!1;return!0}function ru(t,n,a,h,w,k){return vr=k,Ve=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=t===null||t.memoizedState===null?cm:vu,_i=!1,k=a(h,w),_i=!1,cs&&(k=Np(n,a,h,w)),jp(t),k}function jp(t){H.H=aa;var n=ft!==null&&ft.next!==null;if(vr=0,zt=ft=Ve=null,Ro=!1,ra=0,us=null,n)throw Error(s(300));t===null||Ht||(t=t.dependencies,t!==null&&Co(t)&&(Ht=!0))}function Np(t,n,a,h){Ve=t;var w=0;do{if(cs&&(us=null),ra=0,cs=!1,25<=w)throw Error(s(301));if(w+=1,zt=ft=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}H.H=um,k=n(a,h)}while(cs);return k}function S_(){var t=H.H,n=t.useState()[0];return n=typeof n.then=="function"?ia(n):n,t=t.useState()[0],(ft!==null?ft.memoizedState:null)!==t&&(Ve.flags|=1024),n}function iu(){var t=Oo!==0;return Oo=0,t}function su(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function au(t){if(Ro){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Ro=!1}vr=0,zt=ft=Ve=null,cs=!1,ra=Oo=0,us=null}function fn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Ve.memoizedState=zt=t:zt=zt.next=t,zt}function Ot(){if(ft===null){var t=Ve.alternate;t=t!==null?t.memoizedState:null}else t=ft.next;var n=zt===null?Ve.memoizedState:zt.next;if(n!==null)zt=n,ft=t;else{if(t===null)throw Ve.alternate===null?Error(s(467)):Error(s(310));ft=t,t={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},zt===null?Ve.memoizedState=zt=t:zt=zt.next=t}return zt}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ia(t){var n=ra;return ra+=1,us===null&&(us=[]),t=vp(us,t,n),n=Ve,(zt===null?n.memoizedState:zt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?cm:vu),t}function Io(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ia(t);if(t.$$typeof===S)return rn(t)}throw Error(s(438,String(t)))}function ou(t){var n=null,a=Ve.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=Ve.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Mo(),Ve.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=z;return n.index++,a}function br(t,n){return typeof n=="function"?n(t):n}function Bo(t){var n=Ot();return lu(n,ft,t)}function lu(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,k=h.pending;if(k!==null){if(w!==null){var O=w.next;w.next=k.next,k.next=O}n.baseQueue=w=k,h.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var G=O=null,J=null,le=n,pe=!1;do{var be=le.lane&-536870913;if(be!==le.lane?(tt&be)===be:(vr&be)===be){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),be===is&&(pe=!0);else if((vr&ce)===ce){le=le.next,ce===is&&(pe=!0);continue}else be={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=be,O=k):J=J.next=be,Ve.lanes|=ce,Gr|=ce;be=le.action,_i&&a(k,be),k=le.hasEagerState?le.eagerState:a(k,be)}else ce={lane:be,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,O=k):J=J.next=ce,Ve.lanes|=be,Gr|=be;le=le.next}while(le!==null&&le!==n);if(J===null?O=k:J.next=G,!Cn(k,t.memoizedState)&&(Ht=!0,pe&&(a=ss,a!==null)))throw a;t.memoizedState=k,t.baseState=O,t.baseQueue=J,h.lastRenderedState=k}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function cu(t){var n=Ot(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var O=w=w.next;do k=t(k,O.action),O=O.next;while(O!==w);Cn(k,n.memoizedState)||(Ht=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,h]}function Tp(t,n,a){var h=Ve,w=Ot(),k=rt;if(k){if(a===void 0)throw Error(s(407));a=a()}else a=n();var O=!Cn((ft||w).memoizedState,a);if(O&&(w.memoizedState=a,Ht=!0),w=w.queue,hu(Lp.bind(null,h,w,t),[t]),w.getSnapshot!==n||O||zt!==null&&zt.memoizedState.tag&1){if(h.flags|=2048,ds(9,{destroy:void 0},Dp.bind(null,h,w,a,n),null),gt===null)throw Error(s(349));k||(vr&127)!==0||Ap(h,n,a)}return a}function Ap(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ve.updateQueue,n===null?(n=Mo(),Ve.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Dp(t,n,a,h){n.value=a,n.getSnapshot=h,Rp(n)&&Op(t)}function Lp(t,n,a){return a(function(){Rp(n)&&Op(t)})}function Rp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Cn(t,a)}catch{return!0}}function Op(t){var n=hi(t,2);n!==null&&_n(n,t,2)}function uu(t){var n=fn();if(typeof t=="function"){var a=t;if(t=a(),_i){Yt(!0);try{a()}finally{Yt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:t},n}function Mp(t,n,a,h){return t.baseState=a,lu(t,ft,typeof h=="function"?h:br)}function w_(t,n,a,h,w){if(Po(t))throw Error(s(485));if(t=n.action,t!==null){var k={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){k.listeners.push(O)}};H.T!==null?a(!0):k.isTransition=!1,h(k),a=n.pending,a===null?(k.next=n.pending=k,Ip(n,k)):(k.next=a.next,n.pending=a.next=k)}}function Ip(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var k=H.T,O={};H.T=O;try{var G=a(w,h),J=H.S;J!==null&&J(O,G),Bp(t,n,G)}catch(le){du(t,n,le)}finally{k!==null&&O.types!==null&&(k.types=O.types),H.T=k}}else try{k=a(w,h),Bp(t,n,k)}catch(le){du(t,n,le)}}function Bp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){zp(t,n,h)},function(h){return du(t,n,h)}):zp(t,n,a)}function zp(t,n,a){n.status="fulfilled",n.value=a,Hp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Ip(t,a)))}function du(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Hp(n),n=n.next;while(n!==h)}t.action=null}function Hp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Pp(t,n){return n}function Fp(t,n){if(rt){var a=gt.formState;if(a!==null){e:{var h=Ve;if(rt){if(yt){t:{for(var w=yt,k=$n;w.nodeType!==8;){if(!k){w=null;break t}if(w=Wn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){yt=Wn(w.nextSibling),h=w.data==="F!";break e}}Br(h)}h=!1}h&&(n=a[0])}}return a=fn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pp,lastRenderedState:n},a.queue=h,a=am.bind(null,Ve,h),h.dispatch=a,h=uu(!1),k=xu.bind(null,Ve,!1,h.queue),h=fn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=w_.bind(null,Ve,w,k,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Up(t){var n=Ot();return $p(n,ft,t)}function $p(t,n,a){if(n=lu(t,n,Pp)[0],t=Bo(br)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=ia(n)}catch(O){throw O===as?jo:O}else h=n;n=Ot();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Ve.flags|=2048,ds(9,{destroy:void 0},C_.bind(null,w,a),null)),[h,k,t]}function C_(t,n){t.action=n}function qp(t){var n=Ot(),a=ft;if(a!==null)return $p(n,a,t);Ot(),n=n.memoizedState,a=Ot();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function ds(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ve.updateQueue,n===null&&(n=Mo(),Ve.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function Wp(){return Ot().memoizedState}function zo(t,n,a,h){var w=fn();Ve.flags|=t,w.memoizedState=ds(1|n,{destroy:void 0},a,h===void 0?null:h)}function Ho(t,n,a,h){var w=Ot();h=h===void 0?null:h;var k=w.memoizedState.inst;ft!==null&&h!==null&&nu(h,ft.memoizedState.deps)?w.memoizedState=ds(n,k,a,h):(Ve.flags|=t,w.memoizedState=ds(1|n,k,a,h))}function Gp(t,n){zo(8390656,8,t,n)}function hu(t,n){Ho(2048,8,t,n)}function k_(t){Ve.flags|=4;var n=Ve.updateQueue;if(n===null)n=Mo(),Ve.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Vp(t){var n=Ot().memoizedState;return k_({ref:n,nextImpl:t}),function(){if((lt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Kp(t,n){return Ho(4,2,t,n)}function Yp(t,n){return Ho(4,4,t,n)}function Xp(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Zp(t,n,a){a=a!=null?a.concat([t]):null,Ho(4,4,Xp.bind(null,n,t),a)}function fu(){}function Qp(t,n){var a=Ot();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&nu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function Jp(t,n){var a=Ot();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&nu(n,h[1]))return h[0];if(h=t(),_i){Yt(!0);try{t()}finally{Yt(!1)}}return a.memoizedState=[h,n],h}function pu(t,n,a){return a===void 0||(vr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=eg(),Ve.lanes|=t,Gr|=t,a)}function em(t,n,a,h){return Cn(a,n)?a:ls.current!==null?(t=pu(t,a,h),Cn(t,n)||(Ht=!0),t):(vr&42)===0||(vr&1073741824)!==0&&(tt&261930)===0?(Ht=!0,t.memoizedState=a):(t=eg(),Ve.lanes|=t,Gr|=t,n)}function tm(t,n,a,h,w){var k=X.p;X.p=k!==0&&8>k?k:8;var O=H.T,G={};H.T=G,xu(t,!1,n,a);try{var J=w(),le=H.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var pe=y_(J,h);sa(t,n,pe,An(t))}else sa(t,n,h,An(t))}catch(be){sa(t,n,{then:function(){},status:"rejected",reason:be},An())}finally{X.p=k,O!==null&&G.types!==null&&(O.types=G.types),H.T=O}}function E_(){}function mu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=nm(t).queue;tm(t,w,n,Z,a===null?E_:function(){return rm(t),a(h)})}function nm(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:Z},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function rm(t){var n=nm(t);n.next===null&&(n=t.alternate.memoizedState),sa(t,n.next.queue,{},An())}function gu(){return rn(Sa)}function im(){return Ot().memoizedState}function sm(){return Ot().memoizedState}function j_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=An();t=Pr(a);var h=Fr(n,t,a);h!==null&&(_n(h,n,a),ea(h,n,a)),n={cache:Wc()},t.payload=n;return}n=n.return}}function N_(t,n,a){var h=An();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Po(t)?om(n,a):(a=Oc(t,n,a,h),a!==null&&(_n(a,t,h),lm(a,n,h)))}function am(t,n,a){var h=An();sa(t,n,a,h)}function sa(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Po(t))om(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var O=n.lastRenderedState,G=k(O,a);if(w.hasEagerState=!0,w.eagerState=G,Cn(G,O))return yo(t,n,w,0),gt===null&&bo(),!1}catch{}finally{}if(a=Oc(t,n,w,h),a!==null)return _n(a,t,h),lm(a,n,h),!0}return!1}function xu(t,n,a,h){if(h={lane:2,revertLane:Yu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Po(t)){if(n)throw Error(s(479))}else n=Oc(t,a,h,2),n!==null&&_n(n,t,2)}function Po(t){var n=t.alternate;return t===Ve||n!==null&&n===Ve}function om(t,n){cs=Ro=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function lm(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,ff(t,a)}}var aa={readContext:rn,use:Io,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};aa.useEffectEvent=Nt;var cm={readContext:rn,use:Io,useCallback:function(t,n){return fn().memoizedState=[t,n===void 0?null:n],t},useContext:rn,useEffect:Gp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,zo(4194308,4,Xp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return zo(4194308,4,t,n)},useInsertionEffect:function(t,n){zo(4,2,t,n)},useMemo:function(t,n){var a=fn();n=n===void 0?null:n;var h=t();if(_i){Yt(!0);try{t()}finally{Yt(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=fn();if(a!==void 0){var w=a(n);if(_i){Yt(!0);try{a(n)}finally{Yt(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=N_.bind(null,Ve,t),[h.memoizedState,t]},useRef:function(t){var n=fn();return t={current:t},n.memoizedState=t},useState:function(t){t=uu(t);var n=t.queue,a=am.bind(null,Ve,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:fu,useDeferredValue:function(t,n){var a=fn();return pu(a,t,n)},useTransition:function(){var t=uu(!1);return t=tm.bind(null,Ve,t.queue,!0,!1),fn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ve,w=fn();if(rt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),gt===null)throw Error(s(349));(tt&127)!==0||Ap(h,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,Gp(Lp.bind(null,h,k,t),[t]),h.flags|=2048,ds(9,{destroy:void 0},Dp.bind(null,h,k,a,n),null),a},useId:function(){var t=fn(),n=gt.identifierPrefix;if(rt){var a=tr,h=er;a=(h&~(1<<32-st(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Oo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=__++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:gu,useFormState:Fp,useActionState:Fp,useOptimistic:function(t){var n=fn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=xu.bind(null,Ve,!0,a),a.dispatch=n,[t,n]},useMemoCache:ou,useCacheRefresh:function(){return fn().memoizedState=j_.bind(null,Ve)},useEffectEvent:function(t){var n=fn(),a={impl:t};return n.memoizedState=a,function(){if((lt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},vu={readContext:rn,use:Io,useCallback:Qp,useContext:rn,useEffect:hu,useImperativeHandle:Zp,useInsertionEffect:Kp,useLayoutEffect:Yp,useMemo:Jp,useReducer:Bo,useRef:Wp,useState:function(){return Bo(br)},useDebugValue:fu,useDeferredValue:function(t,n){var a=Ot();return em(a,ft.memoizedState,t,n)},useTransition:function(){var t=Bo(br)[0],n=Ot().memoizedState;return[typeof t=="boolean"?t:ia(t),n]},useSyncExternalStore:Tp,useId:im,useHostTransitionStatus:gu,useFormState:Up,useActionState:Up,useOptimistic:function(t,n){var a=Ot();return Mp(a,ft,t,n)},useMemoCache:ou,useCacheRefresh:sm};vu.useEffectEvent=Vp;var um={readContext:rn,use:Io,useCallback:Qp,useContext:rn,useEffect:hu,useImperativeHandle:Zp,useInsertionEffect:Kp,useLayoutEffect:Yp,useMemo:Jp,useReducer:cu,useRef:Wp,useState:function(){return cu(br)},useDebugValue:fu,useDeferredValue:function(t,n){var a=Ot();return ft===null?pu(a,t,n):em(a,ft.memoizedState,t,n)},useTransition:function(){var t=cu(br)[0],n=Ot().memoizedState;return[typeof t=="boolean"?t:ia(t),n]},useSyncExternalStore:Tp,useId:im,useHostTransitionStatus:gu,useFormState:qp,useActionState:qp,useOptimistic:function(t,n){var a=Ot();return ft!==null?Mp(a,ft,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:ou,useCacheRefresh:sm};um.useEffectEvent=Vp;function bu(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var yu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=An(),w=Pr(h);w.payload=n,a!=null&&(w.callback=a),n=Fr(t,w,h),n!==null&&(_n(n,t,h),ea(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=An(),w=Pr(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Fr(t,w,h),n!==null&&(_n(n,t,h),ea(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=An(),h=Pr(a);h.tag=2,n!=null&&(h.callback=n),n=Fr(t,h,a),n!==null&&(_n(n,t,a),ea(n,t,a))}};function dm(t,n,a,h,w,k,O){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,k,O):n.prototype&&n.prototype.isPureReactComponent?!Gs(a,h)||!Gs(w,k):!0}function hm(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&yu.enqueueReplaceState(n,n.state,null)}function Si(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function fm(t){vo(t)}function pm(t){console.error(t)}function mm(t){vo(t)}function Fo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function gm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function _u(t,n,a){return a=Pr(a),a.tag=3,a.payload={element:null},a.callback=function(){Fo(t,n)},a}function xm(t){return t=Pr(t),t.tag=3,t}function vm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=h.value;t.payload=function(){return w(k)},t.callback=function(){gm(n,a,h)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(t.callback=function(){gm(n,a,h),typeof w!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function T_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&rs(n,a,w,!0),a=En.current,a!==null){switch(a.tag){case 31:case 13:return qn===null?Jo():a.alternate===null&&Tt===0&&(Tt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===No?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Gu(t,h,w)),!1;case 22:return a.flags|=65536,h===No?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),Gu(t,h,w)),!1}throw Error(s(435,a.tag))}return Gu(t,h,w),Jo(),!1}if(rt)return n=En.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==Pc&&(t=Error(s(422),{cause:h}),Ys(Pn(t,a)))):(h!==Pc&&(n=Error(s(423),{cause:h}),Ys(Pn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=Pn(h,a),w=_u(t.stateNode,h,w),Zc(t,w),Tt!==4&&(Tt=2)),!1;var k=Error(s(520),{cause:h});if(k=Pn(k,a),pa===null?pa=[k]:pa.push(k),Tt!==4&&(Tt=2),n===null)return!0;h=Pn(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=_u(a.stateNode,h,t),Zc(a,t),!1;case 1:if(n=a.type,k=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Vr===null||!Vr.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=xm(w),vm(w,t,a,h),Zc(a,w),!1}a=a.return}while(a!==null);return!1}var Su=Error(s(461)),Ht=!1;function sn(t,n,a,h){n.child=t===null?Sp(n,null,a,h):yi(n,t.child,a,h)}function bm(t,n,a,h,w){a=a.render;var k=n.ref;if("ref"in h){var O={};for(var G in h)G!=="ref"&&(O[G]=h[G])}else O=h;return gi(n),h=ru(t,n,a,O,k,w),G=iu(),t!==null&&!Ht?(su(t,n,w),yr(t,n,w)):(rt&&G&&zc(n),n.flags|=1,sn(t,n,h,w),n.child)}function ym(t,n,a,h,w){if(t===null){var k=a.type;return typeof k=="function"&&!Mc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,_m(t,n,k,h,w)):(t=So(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!Au(t,w)){var O=k.memoizedProps;if(a=a.compare,a=a!==null?a:Gs,a(O,h)&&t.ref===n.ref)return yr(t,n,w)}return n.flags|=1,t=pr(k,h),t.ref=n.ref,t.return=n,n.child=t}function _m(t,n,a,h,w){if(t!==null){var k=t.memoizedProps;if(Gs(k,h)&&t.ref===n.ref)if(Ht=!1,n.pendingProps=h=k,Au(t,w))(t.flags&131072)!==0&&(Ht=!0);else return n.lanes=t.lanes,yr(t,n,w)}return wu(t,n,a,h,w)}function Sm(t,n,a,h){var w=h.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~k}else h=0,n.child=null;return wm(t,n,k,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Eo(n,k!==null?k.cachePool:null),k!==null?kp(n,k):Jc(),Ep(n);else return h=n.lanes=536870912,wm(t,n,k!==null?k.baseLanes|a:a,a,h)}else k!==null?(Eo(n,k.cachePool),kp(n,k),$r(),n.memoizedState=null):(t!==null&&Eo(n,null),Jc(),$r());return sn(t,n,w,a),n.child}function oa(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function wm(t,n,a,h,w){var k=Vc();return k=k===null?null:{parent:Bt._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&Eo(n,null),Jc(),Ep(n),t!==null&&rs(t,n,h,!0),n.childLanes=w,null}function Uo(t,n){return n=qo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Cm(t,n,a){return yi(n,t.child,null,a),t=Uo(n,n.pendingProps),t.flags|=2,jn(n),n.memoizedState=null,t}function A_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(rt){if(h.mode==="hidden")return t=Uo(n,h),n.lanes=536870912,oa(null,t);if(tu(n),(t=yt)?(t=Ig(t,$n),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},a=op(t),a.return=n,n.child=a,nn=n,yt=null)):t=null,t===null)throw Br(n);return n.lanes=536870912,null}return Uo(n,h)}var k=t.memoizedState;if(k!==null){var O=k.dehydrated;if(tu(n),w)if(n.flags&256)n.flags&=-257,n=Cm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Ht||rs(t,n,a,!1),w=(a&t.childLanes)!==0,Ht||w){if(h=gt,h!==null&&(O=pf(h,a),O!==0&&O!==k.retryLane))throw k.retryLane=O,hi(t,O),_n(h,t,O),Su;Jo(),n=Cm(t,n,a)}else t=k.treeContext,yt=Wn(O.nextSibling),nn=n,rt=!0,Ir=null,$n=!1,t!==null&&up(n,t),n=Uo(n,h),n.flags|=4096;return n}return t=pr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function $o(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function wu(t,n,a,h,w){return gi(n),a=ru(t,n,a,h,void 0,w),h=iu(),t!==null&&!Ht?(su(t,n,w),yr(t,n,w)):(rt&&h&&zc(n),n.flags|=1,sn(t,n,a,w),n.child)}function km(t,n,a,h,w,k){return gi(n),n.updateQueue=null,a=Np(n,h,a,w),jp(t),h=iu(),t!==null&&!Ht?(su(t,n,k),yr(t,n,k)):(rt&&h&&zc(n),n.flags|=1,sn(t,n,a,k),n.child)}function Em(t,n,a,h,w){if(gi(n),n.stateNode===null){var k=Ji,O=a.contextType;typeof O=="object"&&O!==null&&(k=rn(O)),k=new a(h,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=yu,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=h,k.state=n.memoizedState,k.refs={},Yc(n),O=a.contextType,k.context=typeof O=="object"&&O!==null?rn(O):Ji,k.state=n.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(bu(n,a,O,h),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(O=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),O!==k.state&&yu.enqueueReplaceState(k,k.state,null),na(n,h,k,w),ta(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){k=n.stateNode;var G=n.memoizedProps,J=Si(a,G);k.props=J;var le=k.context,pe=a.contextType;O=Ji,typeof pe=="object"&&pe!==null&&(O=rn(pe));var be=a.getDerivedStateFromProps;pe=typeof be=="function"||typeof k.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,pe||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(G||le!==O)&&hm(n,k,h,O),Hr=!1;var ce=n.memoizedState;k.state=ce,na(n,h,k,w),ta(),le=n.memoizedState,G||ce!==le||Hr?(typeof be=="function"&&(bu(n,a,be,h),le=n.memoizedState),(J=Hr||dm(n,a,J,h,ce,le,O))?(pe||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(n.flags|=4194308)):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),k.props=h,k.state=le,k.context=O,h=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{k=n.stateNode,Xc(t,n),O=n.memoizedProps,pe=Si(a,O),k.props=pe,be=n.pendingProps,ce=k.context,le=a.contextType,J=Ji,typeof le=="object"&&le!==null&&(J=rn(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(O!==be||ce!==J)&&hm(n,k,h,J),Hr=!1,ce=n.memoizedState,k.state=ce,na(n,h,k,w),ta();var de=n.memoizedState;O!==be||ce!==de||Hr||t!==null&&t.dependencies!==null&&Co(t.dependencies)?(typeof G=="function"&&(bu(n,a,G,h),de=n.memoizedState),(pe=Hr||dm(n,a,pe,h,ce,de,J)||t!==null&&t.dependencies!==null&&Co(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(h,de,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(h,de,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),k.props=h,k.state=de,k.context=J,h=pe):(typeof k.componentDidUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||O===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return k=h,$o(t,n),h=(n.flags&128)!==0,k||h?(k=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&h?(n.child=yi(n,t.child,null,w),n.child=yi(n,null,a,w)):sn(t,n,a,w),n.memoizedState=k.state,t=n.child):t=yr(t,n,w),t}function jm(t,n,a,h){return pi(),n.flags|=256,sn(t,n,a,h),n.child}var Cu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ku(t){return{baseLanes:t,cachePool:gp()}}function Eu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=Tn),t}function Nm(t,n,a){var h=n.pendingProps,w=!1,k=(n.flags&128)!==0,O;if((O=k)||(O=t!==null&&t.memoizedState===null?!1:(Rt.current&2)!==0),O&&(w=!0,n.flags&=-129),O=(n.flags&32)!==0,n.flags&=-33,t===null){if(rt){if(w?Ur(n):$r(),(t=yt)?(t=Ig(t,$n),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Mr!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},a=op(t),a.return=n,n.child=a,nn=n,yt=null)):t=null,t===null)throw Br(n);return ld(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?($r(),w=n.mode,G=qo({mode:"hidden",children:G},w),h=fi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=ku(a),h.childLanes=Eu(t,O,a),n.memoizedState=Cu,oa(null,h)):(Ur(n),ju(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(k)n.flags&256?(Ur(n),n.flags&=-257,n=Nu(t,n,a)):n.memoizedState!==null?($r(),n.child=t.child,n.flags|=128,n=null):($r(),G=h.fallback,w=n.mode,h=qo({mode:"visible",children:h.children},w),G=fi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,yi(n,t.child,null,a),h=n.child,h.memoizedState=ku(a),h.childLanes=Eu(t,O,a),n.memoizedState=Cu,n=oa(null,h));else if(Ur(n),ld(G)){if(O=G.nextSibling&&G.nextSibling.dataset,O)var le=O.dgst;O=le,h=Error(s(419)),h.stack="",h.digest=O,Ys({value:h,source:null,stack:null}),n=Nu(t,n,a)}else if(Ht||rs(t,n,a,!1),O=(a&t.childLanes)!==0,Ht||O){if(O=gt,O!==null&&(h=pf(O,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,hi(t,h),_n(O,t,h),Su;od(G)||Jo(),n=Nu(t,n,a)}else od(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,yt=Wn(G.nextSibling),nn=n,rt=!0,Ir=null,$n=!1,t!==null&&up(n,t),n=ju(n,h.children),n.flags|=4096);return n}return w?($r(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=pr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=pr(le,G):(G=fi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,oa(null,h),h=n.child,G=t.child.memoizedState,G===null?G=ku(a):(w=G.cachePool,w!==null?(J=Bt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=gp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=Eu(t,O,a),n.memoizedState=Cu,oa(t.child,h)):(Ur(n),a=t.child,t=a.sibling,a=pr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(O=n.deletions,O===null?(n.deletions=[t],n.flags|=16):O.push(t)),n.child=a,n.memoizedState=null,a)}function ju(t,n){return n=qo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function qo(t,n){return t=kn(22,t,null,n),t.lanes=0,t}function Nu(t,n,a){return yi(n,t.child,null,a),t=ju(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Tm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),$c(t.return,n,a)}function Tu(t,n,a,h,w,k){var O=t.memoizedState;O===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:k}:(O.isBackwards=n,O.rendering=null,O.renderingStartTime=0,O.last=h,O.tail=a,O.tailMode=w,O.treeForkCount=k)}function Am(t,n,a){var h=n.pendingProps,w=h.revealOrder,k=h.tail;h=h.children;var O=Rt.current,G=(O&2)!==0;if(G?(O=O&1|2,n.flags|=128):O&=1,F(Rt,O),sn(t,n,h,a),h=rt?Ks:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Tm(t,a,n);else if(t.tag===19)Tm(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&Lo(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Tu(n,!1,w,a,k,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Lo(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Tu(n,!0,a,null,k,h);break;case"together":Tu(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function yr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Gr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(rs(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=pr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=pr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Au(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Co(t)))}function D_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),zr(n,Bt,t.memoizedState.cache),pi();break;case 27:case 5:ne(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:zr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,tu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Ur(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Nm(t,n,a):(Ur(n),t=yr(t,n,a),t!==null?t.sibling:null);Ur(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(rs(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Am(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Rt,Rt.current),h)break;return null;case 22:return n.lanes=0,Sm(t,n,a,n.pendingProps);case 24:zr(n,Bt,t.memoizedState.cache)}return yr(t,n,a)}function Dm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ht=!0;else{if(!Au(t,a)&&(n.flags&128)===0)return Ht=!1,D_(t,n,a);Ht=(t.flags&131072)!==0}else Ht=!1,rt&&(n.flags&1048576)!==0&&cp(n,Ks,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=vi(n.elementType),n.type=t,typeof t=="function")Mc(t)?(h=Si(t,h),n.tag=1,n=Em(null,n,t,h,a)):(n.tag=0,n=wu(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=bm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=ym(null,n,t,h,a);break e}}throw n=R(t)||t,Error(s(306,n,""))}}return n;case 0:return wu(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Si(h,n.pendingProps),Em(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var k=n.memoizedState;w=k.element,Xc(t,n),na(n,h,null,a);var O=n.memoizedState;if(h=O.cache,zr(n,Bt,h),h!==k.cache&&qc(n,[Bt],a,!0),ta(),h=O.element,k.isDehydrated)if(k={element:h,isDehydrated:!1,cache:O.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=jm(t,n,h,a);break e}else if(h!==w){w=Pn(Error(s(424)),n),Ys(w),n=jm(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(yt=Wn(t.firstChild),nn=n,rt=!0,Ir=null,$n=!0,a=Sp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(pi(),h===w){n=yr(t,n,a);break e}sn(t,n,h,a)}n=n.child}return n;case 26:return $o(t,n),t===null?(a=Ug(n.type,null,n.pendingProps,null))?n.memoizedState=a:rt||(a=n.type,t=n.pendingProps,h=al(ee.current).createElement(a),h[tn]=n,h[mn]=t,an(h,a,t),Xt(h),n.stateNode=h):n.memoizedState=Ug(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ne(n),t===null&&rt&&(h=n.stateNode=Hg(n.type,n.pendingProps,ee.current),nn=n,$n=!0,w=yt,Zr(n.type)?(cd=w,yt=Wn(h.firstChild)):yt=w),sn(t,n,n.pendingProps.children,a),$o(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&rt&&((w=h=yt)&&(h=o1(h,n.type,n.pendingProps,$n),h!==null?(n.stateNode=h,nn=n,yt=Wn(h.firstChild),$n=!1,w=!0):w=!1),w||Br(n)),ne(n),w=n.type,k=n.pendingProps,O=t!==null?t.memoizedProps:null,h=k.children,id(w,k)?h=null:O!==null&&id(w,O)&&(n.flags|=32),n.memoizedState!==null&&(w=ru(t,n,S_,null,null,a),Sa._currentValue=w),$o(t,n),sn(t,n,h,a),n.child;case 6:return t===null&&rt&&((t=a=yt)&&(a=l1(a,n.pendingProps,$n),a!==null?(n.stateNode=a,nn=n,yt=null,t=!0):t=!1),t||Br(n)),null;case 13:return Nm(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=yi(n,null,h,a):sn(t,n,h,a),n.child;case 11:return bm(t,n,n.type,n.pendingProps,a);case 7:return sn(t,n,n.pendingProps,a),n.child;case 8:return sn(t,n,n.pendingProps.children,a),n.child;case 12:return sn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,zr(n,n.type,h.value),sn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,gi(n),w=rn(w),h=h(w),n.flags|=1,sn(t,n,h,a),n.child;case 14:return ym(t,n,n.type,n.pendingProps,a);case 15:return _m(t,n,n.type,n.pendingProps,a);case 19:return Am(t,n,a);case 31:return A_(t,n,a);case 22:return Sm(t,n,a,n.pendingProps);case 24:return gi(n),h=rn(Bt),t===null?(w=Vc(),w===null&&(w=gt,k=Wc(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:h,cache:w},Yc(n),zr(n,Bt,w)):((t.lanes&a)!==0&&(Xc(t,n),na(n,null,null,a),ta()),w=t.memoizedState,k=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),zr(n,Bt,h)):(h=k.cache,zr(n,Bt,h),h!==w.cache&&qc(n,[Bt],a,!0))),sn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function _r(t){t.flags|=4}function Du(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(ig())t.flags|=8192;else throw bi=No,Kc}else t.flags&=-16777217}function Lm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Vg(n))if(ig())t.flags|=8192;else throw bi=No,Kc}function Wo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?vt():536870912,t.lanes|=n,ms|=n)}function la(t,n){if(!rt)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function _t(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function L_(t,n,a){var h=n.pendingProps;switch(Hc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(n),null;case 1:return _t(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),xr(Bt),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(ns(n)?_r(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Fc())),_t(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(_r(n),k!==null?(_t(n),Lm(n,k)):(_t(n),Du(n,w,null,h,a))):k?k!==t.memoizedState?(_r(n),_t(n),Lm(n,k)):(_t(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&_r(n),_t(n),Du(n,w,t,h,a)),null;case 27:if(ve(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&_r(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return _t(n),null}t=re.current,ns(n)?dp(n):(t=Hg(w,h,a),n.stateNode=t,_r(n))}return _t(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&_r(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return _t(n),null}if(k=re.current,ns(n))dp(n);else{var O=al(ee.current);switch(k){case 1:k=O.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=O.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=O.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=O.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof h.is=="string"?O.createElement("select",{is:h.is}):O.createElement("select"),h.multiple?k.multiple=!0:h.size&&(k.size=h.size);break;default:k=typeof h.is=="string"?O.createElement(w,{is:h.is}):O.createElement(w)}}k[tn]=n,k[mn]=h;e:for(O=n.child;O!==null;){if(O.tag===5||O.tag===6)k.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===n)break e;for(;O.sibling===null;){if(O.return===null||O.return===n)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}n.stateNode=k;e:switch(an(k,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&_r(n)}}return _t(n),Du(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&_r(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,ns(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=nn,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[tn]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Ng(t.nodeValue,a)),t||Br(n,!0)}else t=al(t).createTextNode(h),t[tn]=n,n.stateNode=t}return _t(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=ns(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[tn]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),t=!1}else a=Fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(jn(n),n):(jn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return _t(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=ns(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[tn]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),w=!1}else w=Fc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(jn(n),n):(jn(n),null)}return jn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Wo(n,n.updateQueue),_t(n),null);case 4:return ae(),t===null&&Ju(n.stateNode.containerInfo),_t(n),null;case 10:return xr(n.type),_t(n),null;case 19:if(V(Rt),h=n.memoizedState,h===null)return _t(n),null;if(w=(n.flags&128)!==0,k=h.rendering,k===null)if(w)la(h,!1);else{if(Tt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=Lo(t),k!==null){for(n.flags|=128,la(h,!1),t=k.updateQueue,n.updateQueue=t,Wo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)ap(a,t),a=a.sibling;return F(Rt,Rt.current&1|2),rt&&mr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Oe()>Xo&&(n.flags|=128,w=!0,la(h,!1),n.lanes=4194304)}else{if(!w)if(t=Lo(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Wo(n,t),la(h,!0),h.tail===null&&h.tailMode==="hidden"&&!k.alternate&&!rt)return _t(n),null}else 2*Oe()-h.renderingStartTime>Xo&&a!==536870912&&(n.flags|=128,w=!0,la(h,!1),n.lanes=4194304);h.isBackwards?(k.sibling=n.child,n.child=k):(t=h.last,t!==null?t.sibling=k:n.child=k,h.last=k)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Oe(),t.sibling=null,a=Rt.current,F(Rt,w?a&1|2:a&1),rt&&mr(n,h.treeForkCount),t):(_t(n),null);case 22:case 23:return jn(n),eu(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(_t(n),n.subtreeFlags&6&&(n.flags|=8192)):_t(n),a=n.updateQueue,a!==null&&Wo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&V(xi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),xr(Bt),_t(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function R_(t,n){switch(Hc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return xr(Bt),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(n.memoizedState!==null){if(jn(n),n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(jn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return V(Rt),null;case 4:return ae(),null;case 10:return xr(n.type),null;case 22:case 23:return jn(n),eu(),t!==null&&V(xi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return xr(Bt),null;case 25:return null;default:return null}}function Rm(t,n){switch(Hc(n),n.tag){case 3:xr(Bt),ae();break;case 26:case 27:case 5:ve(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&jn(n);break;case 13:jn(n);break;case 19:V(Rt);break;case 10:xr(n.type);break;case 22:case 23:jn(n),eu(),t!==null&&V(xi);break;case 24:xr(Bt)}}function ca(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var k=a.create,O=a.inst;h=k(),O.destroy=h}a=a.next}while(a!==w)}}catch(G){dt(n,n.return,G)}}function qr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var k=w.next;h=k;do{if((h.tag&t)===t){var O=h.inst,G=O.destroy;if(G!==void 0){O.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(pe){dt(w,J,pe)}}}h=h.next}while(h!==k)}}catch(pe){dt(n,n.return,pe)}}function Om(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Cp(n,a)}catch(h){dt(t,t.return,h)}}}function Mm(t,n,a){a.props=Si(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){dt(t,n,h)}}function ua(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){dt(t,n,w)}}function nr(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){dt(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){dt(t,n,w)}else a.current=null}function Im(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){dt(t,t.return,w)}}function Lu(t,n,a){try{var h=t.stateNode;t1(h,t.type,a,n),h[mn]=n}catch(w){dt(t,t.return,w)}}function Bm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Zr(t.type)||t.tag===4}function Ru(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Bm(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&&Zr(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 Ou(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=hr));else if(h!==4&&(h===27&&Zr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ou(t,n,a),t=t.sibling;t!==null;)Ou(t,n,a),t=t.sibling}function Go(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&Zr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Go(t,n,a),t=t.sibling;t!==null;)Go(t,n,a),t=t.sibling}function zm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);an(n,h,a),n[tn]=t,n[mn]=a}catch(k){dt(t,t.return,k)}}var Sr=!1,Pt=!1,Mu=!1,Hm=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function O_(t,n){if(t=t.containerInfo,nd=fl,t=Zf(t),Nc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,k=h.focusNode;h=h.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var O=0,G=-1,J=-1,le=0,pe=0,be=t,ce=null;t:for(;;){for(var de;be!==a||w!==0&&be.nodeType!==3||(G=O+w),be!==k||h!==0&&be.nodeType!==3||(J=O+h),be.nodeType===3&&(O+=be.nodeValue.length),(de=be.firstChild)!==null;)ce=be,be=de;for(;;){if(be===t)break t;if(ce===a&&++le===w&&(G=O),ce===k&&++pe===h&&(J=O),(de=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(rd={focusedElem:t,selectionRange:a},fl=!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,k=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&k!==null){t=void 0,a=n,w=k.memoizedProps,k=k.memoizedState,h=a.stateNode;try{var De=Si(a.type,w);t=h.getSnapshotBeforeUpdate(De,k),h.__reactInternalSnapshotBeforeUpdate=t}catch(Fe){dt(a,a.return,Fe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)ad(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":ad(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Zt=t;break}Zt=n.return}}function Pm(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:Cr(t,a),h&4&&ca(5,a);break;case 1:if(Cr(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(O){dt(a,a.return,O)}else{var w=Si(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(O){dt(a,a.return,O)}}h&64&&Om(a),h&512&&ua(a,a.return);break;case 3:if(Cr(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Cp(t,n)}catch(O){dt(a,a.return,O)}}break;case 27:n===null&&h&4&&zm(a);case 26:case 5:Cr(t,a),n===null&&h&4&&Im(a),h&512&&ua(a,a.return);break;case 12:Cr(t,a);break;case 31:Cr(t,a),h&4&&$m(t,a);break;case 13:Cr(t,a),h&4&&qm(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=$_.bind(null,a),c1(t,a))));break;case 22:if(h=a.memoizedState!==null||Sr,!h){n=n!==null&&n.memoizedState!==null||Pt,w=Sr;var k=Pt;Sr=h,(Pt=n)&&!k?kr(t,a,(a.subtreeFlags&8772)!==0):Cr(t,a),Sr=w,Pt=k}break;case 30:break;default:Cr(t,a)}}function Fm(t){var n=t.alternate;n!==null&&(t.alternate=null,Fm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&dc(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 St=null,xn=!1;function wr(t,n,a){for(a=a.child;a!==null;)Um(t,n,a),a=a.sibling}function Um(t,n,a){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(Dt,a)}catch{}switch(a.tag){case 26:Pt||nr(a,n),wr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Pt||nr(a,n);var h=St,w=xn;Zr(a.type)&&(St=a.stateNode,xn=!1),wr(t,n,a),ba(a.stateNode),St=h,xn=w;break;case 5:Pt||nr(a,n);case 6:if(h=St,w=xn,St=null,wr(t,n,a),St=h,xn=w,St!==null)if(xn)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(a.stateNode)}catch(k){dt(a,n,k)}else try{St.removeChild(a.stateNode)}catch(k){dt(a,n,k)}break;case 18:St!==null&&(xn?(t=St,Og(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ws(t)):Og(St,a.stateNode));break;case 4:h=St,w=xn,St=a.stateNode.containerInfo,xn=!0,wr(t,n,a),St=h,xn=w;break;case 0:case 11:case 14:case 15:qr(2,a,n),Pt||qr(4,a,n),wr(t,n,a);break;case 1:Pt||(nr(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Mm(a,n,h)),wr(t,n,a);break;case 21:wr(t,n,a);break;case 22:Pt=(h=Pt)||a.memoizedState!==null,wr(t,n,a),Pt=h;break;default:wr(t,n,a)}}function $m(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ws(t)}catch(a){dt(n,n.return,a)}}}function qm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ws(t)}catch(a){dt(n,n.return,a)}}function M_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Hm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Hm),n;default:throw Error(s(435,t.tag))}}function Vo(t,n){var a=M_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=q_.bind(null,t,h);h.then(w,w)}})}function vn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],k=t,O=n,G=O;e:for(;G!==null;){switch(G.tag){case 27:if(Zr(G.type)){St=G.stateNode,xn=!1;break e}break;case 5:St=G.stateNode,xn=!1;break e;case 3:case 4:St=G.stateNode.containerInfo,xn=!0;break e}G=G.return}if(St===null)throw Error(s(160));Um(k,O,w),St=null,xn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Wm(n,t),n=n.sibling}var Xn=null;function Wm(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:vn(n,t),bn(t),h&4&&(qr(3,t,t.return),ca(3,t),qr(5,t,t.return));break;case 1:vn(n,t),bn(t),h&512&&(Pt||a===null||nr(a,a.return)),h&64&&Sr&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=Xn;if(vn(n,t),bn(t),h&512&&(Pt||a===null||nr(a,a.return)),h&4){var k=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Bs]||k[tn]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(h),w.head.insertBefore(k,w.querySelector("head > title"))),an(k,h,a),k[tn]=t,Xt(k),h=k;break e;case"link":var O=Wg("link","href",w).get(h+(a.href||""));if(O){for(var G=0;G<O.length;G++)if(k=O[G],k.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&k.getAttribute("rel")===(a.rel==null?null:a.rel)&&k.getAttribute("title")===(a.title==null?null:a.title)&&k.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){O.splice(G,1);break t}}k=w.createElement(h),an(k,h,a),w.head.appendChild(k);break;case"meta":if(O=Wg("meta","content",w).get(h+(a.content||""))){for(G=0;G<O.length;G++)if(k=O[G],k.getAttribute("content")===(a.content==null?null:""+a.content)&&k.getAttribute("name")===(a.name==null?null:a.name)&&k.getAttribute("property")===(a.property==null?null:a.property)&&k.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&k.getAttribute("charset")===(a.charSet==null?null:a.charSet)){O.splice(G,1);break t}}k=w.createElement(h),an(k,h,a),w.head.appendChild(k);break;default:throw Error(s(468,h))}k[tn]=t,Xt(k),h=k}t.stateNode=h}else Gg(w,t.type,t.stateNode);else t.stateNode=qg(w,h,t.memoizedProps);else k!==h?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,h===null?Gg(w,t.type,t.stateNode):qg(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Lu(t,t.memoizedProps,a.memoizedProps)}break;case 27:vn(n,t),bn(t),h&512&&(Pt||a===null||nr(a,a.return)),a!==null&&h&4&&Lu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(vn(n,t),bn(t),h&512&&(Pt||a===null||nr(a,a.return)),t.flags&32){w=t.stateNode;try{Gi(w,"")}catch(De){dt(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Lu(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Mu=!0);break;case 6:if(vn(n,t),bn(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){dt(t,t.return,De)}}break;case 3:if(cl=null,w=Xn,Xn=ol(n.containerInfo),vn(n,t),Xn=w,bn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ws(n.containerInfo)}catch(De){dt(t,t.return,De)}Mu&&(Mu=!1,Gm(t));break;case 4:h=Xn,Xn=ol(t.stateNode.containerInfo),vn(n,t),bn(t),Xn=h;break;case 12:vn(n,t),bn(t);break;case 31:vn(n,t),bn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Vo(t,h)));break;case 13:vn(n,t),bn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Yo=Oe()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Vo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=Sr,pe=Pt;if(Sr=le||w,Pt=pe||J,vn(n,t),Pt=pe,Sr=le,bn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||Sr||Pt||wi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)O=k.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{G=J.stateNode;var be=J.memoizedProps.style,ce=be!=null&&be.hasOwnProperty("display")?be.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){dt(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){dt(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Mg(de,!0):Mg(J.stateNode,!1)}catch(De){dt(J,J.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,Vo(t,a))));break;case 19:vn(n,t),bn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Vo(t,h)));break;case 30:break;case 21:break;default:vn(n,t),bn(t)}}function bn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Bm(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=Ru(t);Go(t,k,w);break;case 5:var O=a.stateNode;a.flags&32&&(Gi(O,""),a.flags&=-33);var G=Ru(t);Go(t,G,O);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Ru(t);Ou(t,le,J);break;default:throw Error(s(161))}}catch(pe){dt(t,t.return,pe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Gm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Gm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Cr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Pm(t,n.alternate,n),n=n.sibling}function wi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:qr(4,n,n.return),wi(n);break;case 1:nr(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Mm(n,n.return,a),wi(n);break;case 27:ba(n.stateNode);case 26:case 5:nr(n,n.return),wi(n);break;case 22:n.memoizedState===null&&wi(n);break;case 30:wi(n);break;default:wi(n)}t=t.sibling}}function kr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,k=n,O=k.flags;switch(k.tag){case 0:case 11:case 15:kr(w,k,a),ca(4,k);break;case 1:if(kr(w,k,a),h=k,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){dt(h,h.return,le)}if(h=k,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)wp(J[w],G)}catch(le){dt(h,h.return,le)}}a&&O&64&&Om(k),ua(k,k.return);break;case 27:zm(k);case 26:case 5:kr(w,k,a),a&&h===null&&O&4&&Im(k),ua(k,k.return);break;case 12:kr(w,k,a);break;case 31:kr(w,k,a),a&&O&4&&$m(w,k);break;case 13:kr(w,k,a),a&&O&4&&qm(w,k);break;case 22:k.memoizedState===null&&kr(w,k,a),ua(k,k.return);break;case 30:break;default:kr(w,k,a)}n=n.sibling}}function Iu(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Xs(a))}function Bu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Xs(t))}function Zn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Vm(t,n,a,h),n=n.sibling}function Vm(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Zn(t,n,a,h),w&2048&&ca(9,n);break;case 1:Zn(t,n,a,h);break;case 3:Zn(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Xs(t)));break;case 12:if(w&2048){Zn(t,n,a,h),t=n.stateNode;try{var k=n.memoizedProps,O=k.id,G=k.onPostCommit;typeof G=="function"&&G(O,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){dt(n,n.return,J)}}else Zn(t,n,a,h);break;case 31:Zn(t,n,a,h);break;case 13:Zn(t,n,a,h);break;case 23:break;case 22:k=n.stateNode,O=n.alternate,n.memoizedState!==null?k._visibility&2?Zn(t,n,a,h):da(t,n):k._visibility&2?Zn(t,n,a,h):(k._visibility|=2,hs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Iu(O,n);break;case 24:Zn(t,n,a,h),w&2048&&Bu(n.alternate,n);break;default:Zn(t,n,a,h)}}function hs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,O=n,G=a,J=h,le=O.flags;switch(O.tag){case 0:case 11:case 15:hs(k,O,G,J,w),ca(8,O);break;case 23:break;case 22:var pe=O.stateNode;O.memoizedState!==null?pe._visibility&2?hs(k,O,G,J,w):da(k,O):(pe._visibility|=2,hs(k,O,G,J,w)),w&&le&2048&&Iu(O.alternate,O);break;case 24:hs(k,O,G,J,w),w&&le&2048&&Bu(O.alternate,O);break;default:hs(k,O,G,J,w)}n=n.sibling}}function da(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:da(a,h),w&2048&&Iu(h.alternate,h);break;case 24:da(a,h),w&2048&&Bu(h.alternate,h);break;default:da(a,h)}n=n.sibling}}var ha=8192;function fs(t,n,a){if(t.subtreeFlags&ha)for(t=t.child;t!==null;)Km(t,n,a),t=t.sibling}function Km(t,n,a){switch(t.tag){case 26:fs(t,n,a),t.flags&ha&&t.memoizedState!==null&&_1(a,Xn,t.memoizedState,t.memoizedProps);break;case 5:fs(t,n,a);break;case 3:case 4:var h=Xn;Xn=ol(t.stateNode.containerInfo),fs(t,n,a),Xn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=ha,ha=16777216,fs(t,n,a),ha=h):fs(t,n,a));break;default:fs(t,n,a)}}function Ym(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 fa(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Zt=h,Zm(h,t)}Ym(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xm(t),t=t.sibling}function Xm(t){switch(t.tag){case 0:case 11:case 15:fa(t),t.flags&2048&&qr(9,t,t.return);break;case 3:fa(t);break;case 12:fa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Ko(t)):fa(t);break;default:fa(t)}}function Ko(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Zt=h,Zm(h,t)}Ym(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:qr(8,n,n.return),Ko(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Ko(n));break;default:Ko(n)}t=t.sibling}}function Zm(t,n){for(;Zt!==null;){var a=Zt;switch(a.tag){case 0:case 11:case 15:qr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Xs(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Zt=h;else e:for(a=t;Zt!==null;){h=Zt;var w=h.sibling,k=h.return;if(Fm(h),h===a){Zt=null;break e}if(w!==null){w.return=k,Zt=w;break e}Zt=k}}}var I_={getCacheForType:function(t){var n=rn(Bt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return rn(Bt).controller.signal}},B_=typeof WeakMap=="function"?WeakMap:Map,lt=0,gt=null,Ze=null,tt=0,ut=0,Nn=null,Wr=!1,ps=!1,zu=!1,Er=0,Tt=0,Gr=0,Ci=0,Hu=0,Tn=0,ms=0,pa=null,yn=null,Pu=!1,Yo=0,Qm=0,Xo=1/0,Zo=null,Vr=null,Wt=0,Kr=null,gs=null,jr=0,Fu=0,Uu=null,Jm=null,ma=0,$u=null;function An(){return(lt&2)!==0&&tt!==0?tt&-tt:H.T!==null?Yu():mf()}function eg(){if(Tn===0)if((tt&536870912)===0||rt){var t=fe;fe<<=1,(fe&3932160)===0&&(fe=262144),Tn=t}else Tn=536870912;return t=En.current,t!==null&&(t.flags|=32),Tn}function _n(t,n,a){(t===gt&&(ut===2||ut===9)||t.cancelPendingCommit!==null)&&(xs(t,0),Yr(t,tt,Tn,!1)),Hi(t,a),((lt&2)===0||t!==gt)&&(t===gt&&((lt&2)===0&&(Ci|=a),Tt===4&&Yr(t,tt,Tn,!1)),rr(t))}function tg(t,n,a){if((lt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Be(t,n),w=h?P_(t,n):Wu(t,n,!0),k=h;do{if(w===0){ps&&!h&&Yr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!z_(a)){w=Wu(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)var O=0;else O=t.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){n=O;e:{var G=t;w=pa;var J=G.current.memoizedState.isDehydrated;if(J&&(xs(G,O).flags|=256),O=Wu(G,O,!1),O!==2){if(zu&&!J){G.errorRecoveryDisabledLanes|=k,Ci|=k,w=4;break e}k=yn,yn=w,k!==null&&(yn===null?yn=k:yn.push.apply(yn,k))}w=O}if(k=!1,w!==2)continue}}if(w===1){xs(t,0),Yr(t,n,0,!0);break}e:{switch(h=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Yr(h,n,Tn,!Wr);break e;case 2:yn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Yo+300-Oe(),10<w)){if(Yr(h,n,Tn,!Wr),qe(h,0,!0)!==0)break e;jr=n,h.timeoutHandle=Lg(ng.bind(null,h,a,yn,Zo,Pu,n,Tn,Ci,ms,Wr,k,"Throttled",-0,0),w);break e}ng(h,a,yn,Zo,Pu,n,Tn,Ci,ms,Wr,k,null,-0,0)}}break}while(!0);rr(t)}function ng(t,n,a,h,w,k,O,G,J,le,pe,be,ce,de){if(t.timeoutHandle=-1,be=n.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hr},Km(n,k,be);var De=(k&62914560)===k?Yo-Oe():(k&4194048)===k?Qm-Oe():0;if(De=S1(be,De),De!==null){jr=k,t.cancelPendingCommit=De(ug.bind(null,t,n,k,a,h,w,O,G,J,pe,be,null,ce,de)),Yr(t,k,O,!le);return}}ug(t,n,k,a,h,w,O,G,J)}function z_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],k=w.getSnapshot;w=w.value;try{if(!Cn(k(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Yr(t,n,a,h){n&=~Hu,n&=~Ci,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var k=31-st(w),O=1<<k;h[k]=-1,w&=~O}a!==0&&hf(t,a,n)}function Qo(){return(lt&6)===0?(ga(0),!1):!0}function qu(){if(Ze!==null){if(ut===0)var t=Ze.return;else t=Ze,gr=mi=null,au(t),os=null,Qs=0,t=Ze;for(;t!==null;)Rm(t.alternate,t),t=t.return;Ze=null}}function xs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,i1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),jr=0,qu(),gt=t,Ze=a=pr(t.current,null),tt=n,ut=0,Nn=null,Wr=!1,ps=Be(t,n),zu=!1,ms=Tn=Hu=Ci=Gr=Tt=0,yn=pa=null,Pu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-st(h),k=1<<w;n|=t[w],h&=~k}return Er=n,bo(),a}function rg(t,n){Ve=null,H.H=aa,n===as||n===jo?(n=bp(),ut=3):n===Kc?(n=bp(),ut=4):ut=n===Su?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Nn=n,Ze===null&&(Tt=1,Fo(t,Pn(n,t.current)))}function ig(){var t=En.current;return t===null?!0:(tt&4194048)===tt?qn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===qn:!1}function sg(){var t=H.H;return H.H=aa,t===null?aa:t}function ag(){var t=H.A;return H.A=I_,t}function Jo(){Tt=4,Wr||(tt&4194048)!==tt&&En.current!==null||(ps=!0),(Gr&134217727)===0&&(Ci&134217727)===0||gt===null||Yr(gt,tt,Tn,!1)}function Wu(t,n,a){var h=lt;lt|=2;var w=sg(),k=ag();(gt!==t||tt!==n)&&(Zo=null,xs(t,n)),n=!1;var O=Tt;e:do try{if(ut!==0&&Ze!==null){var G=Ze,J=Nn;switch(ut){case 8:qu(),O=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(n=!0);var le=ut;if(ut=0,Nn=null,vs(t,G,J,le),a&&ps){O=0;break e}break;default:le=ut,ut=0,Nn=null,vs(t,G,J,le)}}H_(),O=Tt;break}catch(pe){rg(t,pe)}while(!0);return n&&t.shellSuspendCounter++,gr=mi=null,lt=h,H.H=w,H.A=k,Ze===null&&(gt=null,tt=0,bo()),O}function H_(){for(;Ze!==null;)og(Ze)}function P_(t,n){var a=lt;lt|=2;var h=sg(),w=ag();gt!==t||tt!==n?(Zo=null,Xo=Oe()+500,xs(t,n)):ps=Be(t,n);e:do try{if(ut!==0&&Ze!==null){n=Ze;var k=Nn;t:switch(ut){case 1:ut=0,Nn=null,vs(t,n,k,1);break;case 2:case 9:if(xp(k)){ut=0,Nn=null,lg(n);break}n=function(){ut!==2&&ut!==9||gt!==t||(ut=7),rr(t)},k.then(n,n);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:xp(k)?(ut=0,Nn=null,lg(n)):(ut=0,Nn=null,vs(t,n,k,7));break;case 5:var O=null;switch(Ze.tag){case 26:O=Ze.memoizedState;case 5:case 27:var G=Ze;if(O?Vg(O):G.stateNode.complete){ut=0,Nn=null;var J=G.sibling;if(J!==null)Ze=J;else{var le=G.return;le!==null?(Ze=le,el(le)):Ze=null}break t}}ut=0,Nn=null,vs(t,n,k,5);break;case 6:ut=0,Nn=null,vs(t,n,k,6);break;case 8:qu(),Tt=6;break e;default:throw Error(s(462))}}F_();break}catch(pe){rg(t,pe)}while(!0);return gr=mi=null,H.H=h,H.A=w,lt=a,Ze!==null?0:(gt=null,tt=0,bo(),Tt)}function F_(){for(;Ze!==null&&!me();)og(Ze)}function og(t){var n=Dm(t.alternate,t,Er);t.memoizedProps=t.pendingProps,n===null?el(t):Ze=n}function lg(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=km(a,n,n.pendingProps,n.type,void 0,tt);break;case 11:n=km(a,n,n.pendingProps,n.type.render,n.ref,tt);break;case 5:au(n);default:Rm(a,n),n=Ze=ap(n,Er),n=Dm(a,n,Er)}t.memoizedProps=t.pendingProps,n===null?el(t):Ze=n}function vs(t,n,a,h){gr=mi=null,au(n),os=null,Qs=0;var w=n.return;try{if(T_(t,w,n,a,tt)){Tt=1,Fo(t,Pn(a,t.current)),Ze=null;return}}catch(k){if(w!==null)throw Ze=w,k;Tt=1,Fo(t,Pn(a,t.current)),Ze=null;return}n.flags&32768?(rt||h===1?t=!0:ps||(tt&536870912)!==0?t=!1:(Wr=t=!0,(h===2||h===9||h===3||h===6)&&(h=En.current,h!==null&&h.tag===13&&(h.flags|=16384))),cg(n,t)):el(n)}function el(t){var n=t;do{if((n.flags&32768)!==0){cg(n,Wr);return}t=n.return;var a=L_(n.alternate,n,Er);if(a!==null){Ze=a;return}if(n=n.sibling,n!==null){Ze=n;return}Ze=n=t}while(n!==null);Tt===0&&(Tt=5)}function cg(t,n){do{var a=R_(t.alternate,t);if(a!==null){a.flags&=32767,Ze=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Ze=t;return}Ze=t=a}while(t!==null);Tt=6,Ze=null}function ug(t,n,a,h,w,k,O,G,J){t.cancelPendingCommit=null;do tl();while(Wt!==0);if((lt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(k=n.lanes|n.childLanes,k|=Rc,oc(t,a,k,O,G,J),t===gt&&(Ze=gt=null,tt=0),gs=n,Kr=t,jr=a,Fu=k,Uu=w,Jm=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,W_(Te,function(){return mg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=H.T,H.T=null,w=X.p,X.p=2,O=lt,lt|=4;try{O_(t,n,a)}finally{lt=O,X.p=w,H.T=h}}Wt=1,dg(),hg(),fg()}}function dg(){if(Wt===1){Wt=0;var t=Kr,n=gs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var h=X.p;X.p=2;var w=lt;lt|=4;try{Wm(n,t);var k=rd,O=Zf(t.containerInfo),G=k.focusedElem,J=k.selectionRange;if(O!==G&&G&&G.ownerDocument&&Xf(G.ownerDocument.documentElement,G)){if(J!==null&&Nc(G)){var le=J.start,pe=J.end;if(pe===void 0&&(pe=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(pe,G.value.length);else{var be=G.ownerDocument||document,ce=be&&be.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=G.textContent.length,Fe=Math.min(J.start,De),mt=J.end===void 0?Fe:Math.min(J.end,De);!de.extend&&Fe>mt&&(O=mt,mt=Fe,Fe=O);var ie=Yf(G,Fe),te=Yf(G,mt);if(ie&&te&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var oe=be.createRange();oe.setStart(ie.node,ie.offset),de.removeAllRanges(),Fe>mt?(de.addRange(oe),de.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),de.addRange(oe))}}}}for(be=[],de=G;de=de.parentNode;)de.nodeType===1&&be.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<be.length;G++){var ge=be[G];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}fl=!!nd,rd=nd=null}finally{lt=w,X.p=h,H.T=a}}t.current=n,Wt=2}}function hg(){if(Wt===2){Wt=0;var t=Kr,n=gs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var h=X.p;X.p=2;var w=lt;lt|=4;try{Pm(t,n.alternate,n)}finally{lt=w,X.p=h,H.T=a}}Wt=3}}function fg(){if(Wt===4||Wt===3){Wt=0,je();var t=Kr,n=gs,a=jr,h=Jm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Wt=5:(Wt=0,gs=Kr=null,pg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Vr=null),cc(a),n=n.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(Dt,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=H.T,w=X.p,X.p=2,H.T=null;try{for(var k=t.onRecoverableError,O=0;O<h.length;O++){var G=h[O];k(G.value,{componentStack:G.stack})}}finally{H.T=n,X.p=w}}(jr&3)!==0&&tl(),rr(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===$u?ma++:(ma=0,$u=t):ma=0,ga(0)}}function pg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Xs(n)))}function tl(){return dg(),hg(),fg(),mg()}function mg(){if(Wt!==5)return!1;var t=Kr,n=Fu;Fu=0;var a=cc(jr),h=H.T,w=X.p;try{X.p=32>a?32:a,H.T=null,a=Uu,Uu=null;var k=Kr,O=jr;if(Wt=0,gs=Kr=null,jr=0,(lt&6)!==0)throw Error(s(331));var G=lt;if(lt|=4,Xm(k.current),Vm(k,k.current,O,a),lt=G,ga(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(Dt,k)}catch{}return!0}finally{X.p=w,H.T=h,pg(t,n)}}function gg(t,n,a){n=Pn(a,n),n=_u(t.stateNode,n,2),t=Fr(t,n,2),t!==null&&(Hi(t,2),rr(t))}function dt(t,n,a){if(t.tag===3)gg(t,t,a);else for(;n!==null;){if(n.tag===3){gg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Vr===null||!Vr.has(h))){t=Pn(a,t),a=xm(2),h=Fr(n,a,2),h!==null&&(vm(a,h,n,t),Hi(h,2),rr(h));break}}n=n.return}}function Gu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new B_;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(zu=!0,w.add(a),t=U_.bind(null,t,n,a),n.then(t,t))}function U_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,gt===t&&(tt&a)===a&&(Tt===4||Tt===3&&(tt&62914560)===tt&&300>Oe()-Yo?(lt&2)===0&&xs(t,0):Hu|=a,ms===tt&&(ms=0)),rr(t)}function xg(t,n){n===0&&(n=vt()),t=hi(t,n),t!==null&&(Hi(t,n),rr(t))}function $_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),xg(t,a)}function q_(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(n),xg(t,a)}function W_(t,n){return $e(t,n)}var nl=null,bs=null,Vu=!1,rl=!1,Ku=!1,Xr=0;function rr(t){t!==bs&&t.next===null&&(bs===null?nl=bs=t:bs=bs.next=t),rl=!0,Vu||(Vu=!0,V_())}function ga(t,n){if(!Ku&&rl){Ku=!0;do for(var a=!1,h=nl;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var k=0;else{var O=h.suspendedLanes,G=h.pingedLanes;k=(1<<31-st(42|t)+1)-1,k&=w&~(O&~G),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,_g(h,k))}else k=tt,k=qe(h,h===gt?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(k&3)===0||Be(h,k)||(a=!0,_g(h,k));h=h.next}while(a);Ku=!1}}function G_(){vg()}function vg(){rl=Vu=!1;var t=0;Xr!==0&&r1()&&(t=Xr);for(var n=Oe(),a=null,h=nl;h!==null;){var w=h.next,k=bg(h,n);k===0?(h.next=null,a===null?nl=w:a.next=w,w===null&&(bs=a)):(a=h,(t!==0||(k&3)!==0)&&(rl=!0)),h=w}Wt!==0&&Wt!==5||ga(t),Xr!==0&&(Xr=0)}function bg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var O=31-st(k),G=1<<O,J=w[O];J===-1?((G&a)===0||(G&h)!==0)&&(w[O]=Lt(G,n)):J<=n&&(t.expiredLanes|=G),k&=~G}if(n=gt,a=tt,a=qe(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ut===2||ut===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&At(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Be(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&At(h),cc(a)){case 2:case 8:a=_e;break;case 32:a=Te;break;case 268435456:a=Ge;break;default:a=Te}return h=yg.bind(null,t),a=$e(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&At(h),t.callbackPriority=2,t.callbackNode=null,2}function yg(t,n){if(Wt!==0&&Wt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(tl()&&t.callbackNode!==a)return null;var h=tt;return h=qe(t,t===gt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(tg(t,h,n),bg(t,Oe()),t.callbackNode!=null&&t.callbackNode===a?yg.bind(null,t):null)}function _g(t,n){if(tl())return null;tg(t,n,!0)}function V_(){s1(function(){(lt&6)!==0?$e(ue,G_):vg()})}function Yu(){if(Xr===0){var t=is;t===0&&(t=se,se<<=1,(se&261888)===0&&(se=256)),Xr=t}return Xr}function Sg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:uo(""+t)}function wg(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function K_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var k=Sg((w[mn]||null).action),O=h.submitter;O&&(n=(n=O[mn]||null)?Sg(n.formAction):O.getAttribute("formAction"),n!==null&&(k=n,O=null));var G=new mo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Xr!==0){var J=O?wg(w,O):new FormData(w);mu(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&(G.preventDefault(),J=O?wg(w,O):new FormData(w),mu(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var Xu=0;Xu<Lc.length;Xu++){var Zu=Lc[Xu],Y_=Zu.toLowerCase(),X_=Zu[0].toUpperCase()+Zu.slice(1);Yn(Y_,"on"+X_)}Yn(ep,"onAnimationEnd"),Yn(tp,"onAnimationIteration"),Yn(np,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(h_,"onTransitionRun"),Yn(f_,"onTransitionStart"),Yn(p_,"onTransitionCancel"),Yn(rp,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),li("onBeforeInput",["compositionend","keypress","textInput","paste"]),li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xa="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(" "),Z_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xa));function Cg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var k=void 0;if(n)for(var O=h.length-1;0<=O;O--){var G=h[O],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(pe){vo(pe)}w.currentTarget=null,k=J}else for(O=0;O<h.length;O++){if(G=h[O],J=G.instance,le=G.currentTarget,G=G.listener,J!==k&&w.isPropagationStopped())break e;k=G,w.currentTarget=le;try{k(w)}catch(pe){vo(pe)}w.currentTarget=null,k=J}}}}function Qe(t,n){var a=n[uc];a===void 0&&(a=n[uc]=new Set);var h=t+"__bubble";a.has(h)||(kg(n,t,2,!1),a.add(h))}function Qu(t,n,a){var h=0;n&&(h|=4),kg(a,t,h,n)}var il="_reactListening"+Math.random().toString(36).slice(2);function Ju(t){if(!t[il]){t[il]=!0,vf.forEach(function(a){a!=="selectionchange"&&(Z_.has(a)||Qu(a,!1,t),Qu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[il]||(n[il]=!0,Qu("selectionchange",!1,n))}}function kg(t,n,a,h){switch(ex(n)){case 2:var w=k1;break;case 8:w=E1;break;default:w=pd}a=w.bind(null,n,a,t),w=void 0,!bc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function ed(t,n,a,h,w){var k=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var O=h.tag;if(O===3||O===4){var G=h.stateNode.containerInfo;if(G===w)break;if(O===4)for(O=h.return;O!==null;){var J=O.tag;if((J===3||J===4)&&O.stateNode.containerInfo===w)return;O=O.return}for(;G!==null;){if(O=Fi(G),O===null)return;if(J=O.tag,J===5||J===6||J===26||J===27){h=k=O;continue e}G=G.parentNode}}h=h.return}Af(function(){var le=k,pe=xc(a),be=[];e:{var ce=ip.get(t);if(ce!==void 0){var de=mo,De=t;switch(t){case"keypress":if(fo(a)===0)break e;case"keydown":case"keyup":de=q0;break;case"focusin":De="focus",de=wc;break;case"focusout":De="blur",de=wc;break;case"beforeblur":case"afterblur":de=wc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Rf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=L0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=V0;break;case ep:case tp:case np:de=M0;break;case rp:de=Y0;break;case"scroll":case"scrollend":de=A0;break;case"wheel":de=Z0;break;case"copy":case"cut":case"paste":de=B0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Mf;break;case"toggle":case"beforetoggle":de=J0}var Fe=(n&4)!==0,mt=!Fe&&(t==="scroll"||t==="scrollend"),ie=Fe?ce!==null?ce+"Capture":null:ce;Fe=[];for(var te=le,oe;te!==null;){var ge=te;if(oe=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||oe===null||ie===null||(ge=Hs(te,ie),ge!=null&&Fe.push(va(te,ge,oe))),mt)break;te=te.return}0<Fe.length&&(ce=new de(ce,De,null,a,pe),be.push({event:ce,listeners:Fe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==gc&&(De=a.relatedTarget||a.fromElement)&&(Fi(De)||De[Pi]))break e;if((de||ce)&&(ce=pe.window===pe?pe:(ce=pe.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=le,De=De?Fi(De):null,De!==null&&(mt=u(De),Fe=De.tag,De!==mt||Fe!==5&&Fe!==27&&Fe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Fe=Rf,ge="onMouseLeave",ie="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=Mf,ge="onPointerLeave",ie="onPointerEnter",te="pointer"),mt=de==null?ce:zs(de),oe=De==null?ce:zs(De),ce=new Fe(ge,te+"leave",de,a,pe),ce.target=mt,ce.relatedTarget=oe,ge=null,Fi(pe)===le&&(Fe=new Fe(ie,te+"enter",De,a,pe),Fe.target=oe,Fe.relatedTarget=mt,ge=Fe),mt=ge,de&&De)t:{for(Fe=Q_,ie=de,te=De,oe=0,ge=ie;ge;ge=Fe(ge))oe++;ge=0;for(var ze=te;ze;ze=Fe(ze))ge++;for(;0<oe-ge;)ie=Fe(ie),oe--;for(;0<ge-oe;)te=Fe(te),ge--;for(;oe--;){if(ie===te||te!==null&&ie===te.alternate){Fe=ie;break t}ie=Fe(ie),te=Fe(te)}Fe=null}else Fe=null;de!==null&&Eg(be,ce,de,Fe,!1),De!==null&&mt!==null&&Eg(be,mt,De,Fe,!0)}}e:{if(ce=le?zs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var at=$f;else if(Ff(ce))if(qf)at=c_;else{at=o_;var Le=a_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&mc(le.elementType)&&(at=$f):at=l_;if(at&&(at=at(t,le))){Uf(be,at,a,pe);break e}Le&&Le(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&pc(ce,"number",ce.value)}switch(Le=le?zs(le):window,t){case"focusin":(Ff(Le)||Le.contentEditable==="true")&&(Xi=Le,Tc=le,Vs=null);break;case"focusout":Vs=Tc=Xi=null;break;case"mousedown":Ac=!0;break;case"contextmenu":case"mouseup":case"dragend":Ac=!1,Qf(be,a,pe);break;case"selectionchange":if(d_)break;case"keydown":case"keyup":Qf(be,a,pe)}var Ke;if(kc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Yi?Hf(t,a)&&(nt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(nt="onCompositionStart");nt&&(If&&a.locale!=="ko"&&(Yi||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Yi&&(Ke=Df()):(Or=pe,yc="value"in Or?Or.value:Or.textContent,Yi=!0)),Le=sl(le,nt),0<Le.length&&(nt=new Of(nt,t,null,a,pe),be.push({event:nt,listeners:Le}),Ke?nt.data=Ke:(Ke=Pf(a),Ke!==null&&(nt.data=Ke)))),(Ke=t_?n_(t,a):r_(t,a))&&(nt=sl(le,"onBeforeInput"),0<nt.length&&(Le=new Of("onBeforeInput","beforeinput",null,a,pe),be.push({event:Le,listeners:nt}),Le.data=Ke)),K_(be,t,le,a,pe)}Cg(be,n)})}function va(t,n,a){return{instance:t,listener:n,currentTarget:a}}function sl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=Hs(t,a),w!=null&&h.unshift(va(t,w,k)),w=Hs(t,n),w!=null&&h.push(va(t,w,k))),t.tag===3)return h;t=t.return}return[]}function Q_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Eg(t,n,a,h,w){for(var k=n._reactName,O=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Hs(a,k),le!=null&&O.unshift(va(a,le,J))):w||(le=Hs(a,k),le!=null&&O.push(va(a,le,J)))),a=a.return}O.length!==0&&t.push({event:n,listeners:O})}var J_=/\r\n?/g,e1=/\u0000|\uFFFD/g;function jg(t){return(typeof t=="string"?t:""+t).replace(J_,`
49
- `).replace(e1,"")}function Ng(t,n){return n=jg(n),jg(t)===n}function pt(t,n,a,h,w,k){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&Gi(t,""+h);break;case"className":lo(t,"class",h);break;case"tabIndex":lo(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":lo(t,a,h);break;case"style":Nf(t,h,k);break;case"data":if(n!=="object"){lo(t,"data",h);break}case"src":case"href":if(h===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=uo(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(a==="formAction"?(n!=="input"&&pt(t,n,"name",w.name,w,null),pt(t,n,"formEncType",w.formEncType,w,null),pt(t,n,"formMethod",w.formMethod,w,null),pt(t,n,"formTarget",w.formTarget,w,null)):(pt(t,n,"encType",w.encType,w,null),pt(t,n,"method",w.method,w,null),pt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=uo(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=hr);break;case"onScroll":h!=null&&Qe("scroll",t);break;case"onScrollEnd":h!=null&&Qe("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=uo(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":Qe("beforetoggle",t),Qe("toggle",t),oo(t,"popover",h);break;case"xlinkActuate":dr(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":dr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":dr(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":dr(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":dr(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":dr(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":dr(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":dr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":dr(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":oo(t,"is",h);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=N0.get(a)||a,oo(t,a,h))}}function td(t,n,a,h,w,k){switch(a){case"style":Nf(t,h,k);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof h=="string"?Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&Gi(t,""+h);break;case"onScroll":h!=null&&Qe("scroll",t);break;case"onScrollEnd":h!=null&&Qe("scrollend",t);break;case"onClick":h!=null&&(t.onclick=hr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),k=t[mn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof h=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):oo(t,a,h)}}}function an(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",t),Qe("load",t);var h=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var O=a[k];if(O!=null)switch(k){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:pt(t,n,k,O,a,null)}}w&&pt(t,n,"srcSet",a.srcSet,a,null),h&&pt(t,n,"src",a.src,a,null);return;case"input":Qe("invalid",t);var G=k=O=w=null,J=null,le=null;for(h in a)if(a.hasOwnProperty(h)){var pe=a[h];if(pe!=null)switch(h){case"name":w=pe;break;case"type":O=pe;break;case"checked":J=pe;break;case"defaultChecked":le=pe;break;case"value":k=pe;break;case"defaultValue":G=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(s(137,n));break;default:pt(t,n,h,pe,a,null)}}Cf(t,k,G,J,le,O,w,!1);return;case"select":Qe("invalid",t),h=O=k=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":k=G;break;case"defaultValue":O=G;break;case"multiple":h=G;default:pt(t,n,w,G,a,null)}n=k,a=O,t.multiple=!!h,n!=null?Wi(t,!!h,n,!1):a!=null&&Wi(t,!!h,a,!0);return;case"textarea":Qe("invalid",t),k=w=h=null;for(O in a)if(a.hasOwnProperty(O)&&(G=a[O],G!=null))switch(O){case"value":h=G;break;case"defaultValue":w=G;break;case"children":k=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:pt(t,n,O,G,a,null)}Ef(t,h,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:pt(t,n,J,h,a,null)}return;case"dialog":Qe("beforetoggle",t),Qe("toggle",t),Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":Qe("load",t);break;case"video":case"audio":for(h=0;h<xa.length;h++)Qe(xa[h],t);break;case"image":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"embed":case"source":case"link":Qe("error",t),Qe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:pt(t,n,le,h,a,null)}return;default:if(mc(n)){for(pe in a)a.hasOwnProperty(pe)&&(h=a[pe],h!==void 0&&td(t,n,pe,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&&pt(t,n,G,h,a,null))}function t1(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,k=null,O=null,G=null,J=null,le=null,pe=null;for(de in a){var be=a[de];if(a.hasOwnProperty(de)&&be!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":J=be;default:h.hasOwnProperty(de)||pt(t,n,de,null,h,be)}}for(var ce in h){var de=h[ce];if(be=a[ce],h.hasOwnProperty(ce)&&(de!=null||be!=null))switch(ce){case"type":k=de;break;case"name":w=de;break;case"checked":le=de;break;case"defaultChecked":pe=de;break;case"value":O=de;break;case"defaultValue":G=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,n));break;default:de!==be&&pt(t,n,ce,de,h,be)}}fc(t,O,G,J,le,pe,k,w);return;case"select":de=O=G=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(k)||pt(t,n,k,null,h,J)}for(w in h)if(k=h[w],J=a[w],h.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":G=k;break;case"multiple":O=k;default:k!==J&&pt(t,n,w,k,h,J)}n=G,a=O,h=de,ce!=null?Wi(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Wi(t,!!a,n,!0):Wi(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!h.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:pt(t,n,G,null,h,w)}for(O in h)if(w=h[O],k=a[O],h.hasOwnProperty(O)&&(w!=null||k!=null))switch(O){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==k&&pt(t,n,O,w,h,k)}kf(t,ce,de);return;case"option":for(var De in a)if(ce=a[De],a.hasOwnProperty(De)&&ce!=null&&!h.hasOwnProperty(De))switch(De){case"selected":t.selected=!1;break;default:pt(t,n,De,null,h,ce)}for(J in h)if(ce=h[J],de=a[J],h.hasOwnProperty(J)&&ce!==de&&(ce!=null||de!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:pt(t,n,J,ce,h,de)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Fe in a)ce=a[Fe],a.hasOwnProperty(Fe)&&ce!=null&&!h.hasOwnProperty(Fe)&&pt(t,n,Fe,null,h,ce);for(le in h)if(ce=h[le],de=a[le],h.hasOwnProperty(le)&&ce!==de&&(ce!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:pt(t,n,le,ce,h,de)}return;default:if(mc(n)){for(var mt in a)ce=a[mt],a.hasOwnProperty(mt)&&ce!==void 0&&!h.hasOwnProperty(mt)&&td(t,n,mt,void 0,h,ce);for(pe in h)ce=h[pe],de=a[pe],!h.hasOwnProperty(pe)||ce===de||ce===void 0&&de===void 0||td(t,n,pe,ce,h,de);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!h.hasOwnProperty(ie)&&pt(t,n,ie,null,h,ce);for(be in h)ce=h[be],de=a[be],!h.hasOwnProperty(be)||ce===de||ce==null&&de==null||pt(t,n,be,ce,h,de)}function Tg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n1(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],k=w.transferSize,O=w.initiatorType,G=w.duration;if(k&&G&&Tg(O)){for(O=0,G=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>G)break;var pe=J.transferSize,be=J.initiatorType;pe&&Tg(be)&&(J=J.responseEnd,O+=pe*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(k+O)/(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 nd=null,rd=null;function al(t){return t.nodeType===9?t:t.ownerDocument}function Ag(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 Dg(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 id(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 sd=null;function r1(){var t=window.event;return t&&t.type==="popstate"?t===sd?!1:(sd=t,!0):(sd=null,!1)}var Lg=typeof setTimeout=="function"?setTimeout:void 0,i1=typeof clearTimeout=="function"?clearTimeout:void 0,Rg=typeof Promise=="function"?Promise:void 0,s1=typeof queueMicrotask=="function"?queueMicrotask:typeof Rg<"u"?function(t){return Rg.resolve(null).then(t).catch(a1)}:Lg;function a1(t){setTimeout(function(){throw t})}function Zr(t){return t==="head"}function Og(t,n){var a=n,h=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(h===0){t.removeChild(w),ws(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")ba(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ba(a);for(var k=a.firstChild;k;){var O=k.nextSibling,G=k.nodeName;k[Bs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=O}}else a==="body"&&ba(t.ownerDocument.body);a=w}while(a);ws(n)}function Mg(t,n){var a=t;t=0;do{var h=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=h}while(a)}function ad(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":ad(a),dc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function o1(t,n,a,h){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!h&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(h){if(!t[Bs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(k=t.getAttribute("rel"),k==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(k!==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(k=t.getAttribute("src"),(k!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&k&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var k=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===k)return t}else return t;if(t=Wn(t.nextSibling),t===null)break}return null}function l1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Wn(t.nextSibling),t===null))return null;return t}function Ig(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Wn(t.nextSibling),t===null))return null;return t}function od(t){return t.data==="$?"||t.data==="$~"}function ld(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function c1(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var h=function(){n(),a.removeEventListener("DOMContentLoaded",h)};a.addEventListener("DOMContentLoaded",h),t._reactRetry=h}}function Wn(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 cd=null;function Bg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Wn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function zg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function Hg(t,n,a){switch(n=al(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function ba(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);dc(t)}var Gn=new Map,Pg=new Set;function ol(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Nr=X.d;X.d={f:u1,r:d1,D:h1,C:f1,L:p1,m:m1,X:x1,S:g1,M:v1};function u1(){var t=Nr.f(),n=Qo();return t||n}function d1(t){var n=Ui(t);n!==null&&n.tag===5&&n.type==="form"?rm(n):Nr.r(t)}var ys=typeof document>"u"?null:document;function Fg(t,n,a){var h=ys;if(h&&typeof n=="string"&&n){var w=zn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Pg.has(w)||(Pg.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),an(n,"link",t),Xt(n),h.head.appendChild(n)))}}function h1(t){Nr.D(t),Fg("dns-prefetch",t,null)}function f1(t,n){Nr.C(t,n),Fg("preconnect",t,n)}function p1(t,n,a){Nr.L(t,n,a);var h=ys;if(h&&t&&n){var w='link[rel="preload"][as="'+zn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+zn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+zn(a.imageSizes)+'"]')):w+='[href="'+zn(t)+'"]';var k=w;switch(n){case"style":k=_s(t);break;case"script":k=Ss(t)}Gn.has(k)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Gn.set(k,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(ya(k))||n==="script"&&h.querySelector(_a(k))||(n=h.createElement("link"),an(n,"link",t),Xt(n),h.head.appendChild(n)))}}function m1(t,n){Nr.m(t,n);var a=ys;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+zn(h)+'"][href="'+zn(t)+'"]',k=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=Ss(t)}if(!Gn.has(k)&&(t=m({rel:"modulepreload",href:t},n),Gn.set(k,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(_a(k)))return}h=a.createElement("link"),an(h,"link",t),Xt(h),a.head.appendChild(h)}}}function g1(t,n,a){Nr.S(t,n,a);var h=ys;if(h&&t){var w=$i(h).hoistableStyles,k=_s(t);n=n||"default";var O=w.get(k);if(!O){var G={loading:0,preload:null};if(O=h.querySelector(ya(k)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Gn.get(k))&&ud(t,a);var J=O=h.createElement("link");Xt(J),an(J,"link",t),J._p=new Promise(function(le,pe){J.onload=le,J.onerror=pe}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,ll(O,n,h)}O={type:"stylesheet",instance:O,count:1,state:G},w.set(k,O)}}}function x1(t,n){Nr.X(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),k=h.get(w);k||(k=a.querySelector(_a(w)),k||(t=m({src:t,async:!0},n),(n=Gn.get(w))&&dd(t,n),k=a.createElement("script"),Xt(k),an(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function v1(t,n){Nr.M(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),k=h.get(w);k||(k=a.querySelector(_a(w)),k||(t=m({src:t,async:!0,type:"module"},n),(n=Gn.get(w))&&dd(t,n),k=a.createElement("script"),Xt(k),an(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},h.set(w,k))}}function Ug(t,n,a,h){var w=(w=ee.current)?ol(w):null;if(!w)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=_s(a.href),a=$i(w).hoistableStyles,h=a.get(n),h||(h={type:"style",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=_s(a.href);var k=$i(w).hoistableStyles,O=k.get(t);if(O||(w=w.ownerDocument||w,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,O),(k=w.querySelector(ya(t)))&&!k._p&&(O.instance=k,O.state.loading=5),Gn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Gn.set(t,a),k||b1(w,t,a,O.state))),n&&h===null)throw Error(s(528,""));return O}if(n&&h!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ss(a),a=$i(w).hoistableScripts,h=a.get(n),h||(h={type:"script",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function _s(t){return'href="'+zn(t)+'"'}function ya(t){return'link[rel="stylesheet"]['+t+"]"}function $g(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function b1(t,n,a,h){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?h.loading=1:(n=t.createElement("link"),h.preload=n,n.addEventListener("load",function(){return h.loading|=1}),n.addEventListener("error",function(){return h.loading|=2}),an(n,"link",a),Xt(n),t.head.appendChild(n))}function Ss(t){return'[src="'+zn(t)+'"]'}function _a(t){return"script[async]"+t}function qg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+zn(a.href)+'"]');if(h)return n.instance=h,Xt(h),h;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return h=(t.ownerDocument||t).createElement("style"),Xt(h),an(h,"style",w),ll(h,a.precedence,t),n.instance=h;case"stylesheet":w=_s(a.href);var k=t.querySelector(ya(w));if(k)return n.state.loading|=4,n.instance=k,Xt(k),k;h=$g(a),(w=Gn.get(w))&&ud(h,w),k=(t.ownerDocument||t).createElement("link"),Xt(k);var O=k;return O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(k,"link",h),n.state.loading|=4,ll(k,a.precedence,t),n.instance=k;case"script":return k=Ss(a.src),(w=t.querySelector(_a(k)))?(n.instance=w,Xt(w),w):(h=a,(w=Gn.get(k))&&(h=m({},a),dd(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),Xt(w),an(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,ll(h,a.precedence,t));return n.instance}function ll(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,k=w,O=0;O<h.length;O++){var G=h[O];if(G.dataset.precedence===n)k=G;else if(k!==w)break}k?k.parentNode.insertBefore(t,k.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function ud(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function dd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var cl=null;function Wg(t,n,a){if(cl===null){var h=new Map,w=cl=new Map;w.set(a,h)}else w=cl,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Bs]||k[tn]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var O=k.getAttribute(n)||"";O=t+O;var G=h.get(O);G?G.push(k):h.set(O,[k])}}return h}function Gg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function y1(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Vg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function _1(t,n,a,h){if(a.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=_s(h.href),k=n.querySelector(ya(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ul.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,Xt(k);return}k=n.ownerDocument||n,h=$g(h),(w=Gn.get(w))&&ud(h,w),k=k.createElement("link"),Xt(k);var O=k;O._p=new Promise(function(G,J){O.onload=G,O.onerror=J}),an(k,"link",h),a.instance=k}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ul.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var hd=0;function S1(t,n){return t.stylesheets&&t.count===0&&hl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&hl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&hd===0&&(hd=62500*n1());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&hl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>hd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function ul(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var dl=null;function hl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,dl=new Map,n.forEach(w1,t),dl=null,ul.call(t))}function w1(t,n){if(!(n.state.loading&4)){var a=dl.get(t);if(a)var h=a.get(null);else{a=new Map,dl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var O=w[k];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(a.set(O.dataset.precedence,O),h=O)}h&&a.set(null,h)}w=n.instance,O=w.getAttribute("data-precedence"),k=a.get(O)||h,k===h&&a.set(null,w),a.set(O,w),this.count++,h=ul.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var Sa={$$typeof:S,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function C1(t,n,a,h,w,k,O,G,J){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.hiddenUpdates=qt(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Kg(t,n,a,h,w,k,O,G,J,le,pe,be){return t=new C1(t,n,a,O,J,le,pe,be,G),n=1,k===!0&&(n|=24),k=kn(3,null,null,n),t.current=k,k.stateNode=t,n=Wc(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:h,isDehydrated:a,cache:n},Yc(k),t}function Yg(t){return t?(t=Ji,t):Ji}function Xg(t,n,a,h,w,k){w=Yg(w),h.context===null?h.context=w:h.pendingContext=w,h=Pr(n),h.payload={element:a},k=k===void 0?null:k,k!==null&&(h.callback=k),a=Fr(t,h,n),a!==null&&(_n(a,t,n),ea(a,t,n))}function Zg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function fd(t,n){Zg(t,n),(t=t.alternate)&&Zg(t,n)}function Qg(t){if(t.tag===13||t.tag===31){var n=hi(t,67108864);n!==null&&_n(n,t,67108864),fd(t,67108864)}}function Jg(t){if(t.tag===13||t.tag===31){var n=An();n=lc(n);var a=hi(t,n);a!==null&&_n(a,t,n),fd(t,n)}}var fl=!0;function k1(t,n,a,h){var w=H.T;H.T=null;var k=X.p;try{X.p=2,pd(t,n,a,h)}finally{X.p=k,H.T=w}}function E1(t,n,a,h){var w=H.T;H.T=null;var k=X.p;try{X.p=8,pd(t,n,a,h)}finally{X.p=k,H.T=w}}function pd(t,n,a,h){if(fl){var w=md(h);if(w===null)ed(t,n,h,pl,a),tx(t,h);else if(N1(w,t,n,a,h))h.stopPropagation();else if(tx(t,h),n&4&&-1<j1.indexOf(t)){for(;w!==null;){var k=Ui(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var O=Me(k.pendingLanes);if(O!==0){var G=k;for(G.pendingLanes|=2,G.entangledLanes|=2;O;){var J=1<<31-st(O);G.entanglements[1]|=J,O&=~J}rr(k),(lt&6)===0&&(Xo=Oe()+500,ga(0))}}break;case 31:case 13:G=hi(k,2),G!==null&&_n(G,k,2),Qo(),fd(k,2)}if(k=md(h),k===null&&ed(t,n,h,pl,a),k===w)break;w=k}w!==null&&h.stopPropagation()}else ed(t,n,h,null,a)}}function md(t){return t=xc(t),gd(t)}var pl=null;function gd(t){if(pl=null,t=Fi(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=f(n),t!==null)return t;t=null}else if(a===31){if(t=c(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return pl=t,null}function ex(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(ct()){case ue:return 2;case _e:return 8;case Te:case Ie:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var xd=!1,Qr=null,Jr=null,ei=null,wa=new Map,Ca=new Map,ti=[],j1="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 tx(t,n){switch(t){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Jr=null;break;case"mouseover":case"mouseout":ei=null;break;case"pointerover":case"pointerout":wa.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ca.delete(n.pointerId)}}function ka(t,n,a,h,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Ui(n),n!==null&&Qg(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function N1(t,n,a,h,w){switch(n){case"focusin":return Qr=ka(Qr,t,n,a,h,w),!0;case"dragenter":return Jr=ka(Jr,t,n,a,h,w),!0;case"mouseover":return ei=ka(ei,t,n,a,h,w),!0;case"pointerover":var k=w.pointerId;return wa.set(k,ka(wa.get(k)||null,t,n,a,h,w)),!0;case"gotpointercapture":return k=w.pointerId,Ca.set(k,ka(Ca.get(k)||null,t,n,a,h,w)),!0}return!1}function nx(t){var n=Fi(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){t.blockedOn=n,gf(t.priority,function(){Jg(a)});return}}else if(n===31){if(n=c(a),n!==null){t.blockedOn=n,gf(t.priority,function(){Jg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ml(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=md(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);gc=h,a.target.dispatchEvent(h),gc=null}else return n=Ui(a),n!==null&&Qg(n),t.blockedOn=a,!1;n.shift()}return!0}function rx(t,n,a){ml(t)&&a.delete(n)}function T1(){xd=!1,Qr!==null&&ml(Qr)&&(Qr=null),Jr!==null&&ml(Jr)&&(Jr=null),ei!==null&&ml(ei)&&(ei=null),wa.forEach(rx),Ca.forEach(rx)}function gl(t,n){t.blockedOn===n&&(t.blockedOn=null,xd||(xd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,T1)))}var xl=null;function ix(t){xl!==t&&(xl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){xl===t&&(xl=null);for(var n=0;n<t.length;n+=3){var a=t[n],h=t[n+1],w=t[n+2];if(typeof h!="function"){if(gd(h||a)===null)continue;break}var k=Ui(a);k!==null&&(t.splice(n,3),n-=3,mu(k,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function ws(t){function n(J){return gl(J,t)}Qr!==null&&gl(Qr,t),Jr!==null&&gl(Jr,t),ei!==null&&gl(ei,t),wa.forEach(n),Ca.forEach(n);for(var a=0;a<ti.length;a++){var h=ti[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<ti.length&&(a=ti[0],a.blockedOn===null);)nx(a),a.blockedOn===null&&ti.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],k=a[h+1],O=w[mn]||null;if(typeof k=="function")O||ix(a);else if(O){var G=null;if(k&&k.hasAttribute("formAction")){if(w=k,O=k[mn]||null)G=O.formAction;else if(gd(w)!==null)continue}else G=O.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),ix(a)}}}function sx(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(O){return w=O})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),h||setTimeout(a,20)}function a(){if(!h&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function vd(t){this._internalRoot=t}vl.prototype.render=vd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=An();Xg(a,h,t,n,null,null)},vl.prototype.unmount=vd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Xg(t.current,2,null,t,null,null),Qo(),n[Pi]=null}};function vl(t){this._internalRoot=t}vl.prototype.unstable_scheduleHydration=function(t){if(t){var n=mf();t={blockedOn:null,target:t,priority:n};for(var a=0;a<ti.length&&n!==0&&n<ti[a].priority;a++);ti.splice(a,0,t),a===0&&nx(t)}};var ax=r.version;if(ax!=="19.2.4")throw Error(s(527,ax,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=p(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var A1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bl.isDisabled&&bl.supportsFiber)try{Dt=bl.inject(A1),Et=bl}catch{}}return ja.createRoot=function(t,n){if(!l(t))throw Error(s(299));var a=!1,h="",w=fm,k=pm,O=mm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(O=n.onRecoverableError)),n=Kg(t,1,!1,null,null,a,h,null,w,k,O,sx),t[Pi]=n.current,Ju(t),new vd(n)},ja.hydrateRoot=function(t,n,a){if(!l(t))throw Error(s(299));var h=!1,w="",k=fm,O=pm,G=mm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(O=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Kg(t,1,!0,n,a??null,h,w,J,k,O,G,sx),n.context=Yg(null),a=n.current,h=An(),h=lc(h),w=Pr(h),w.callback=null,Fr(a,w,h),a=h,n.current.lanes=a,Hi(n,a),rr(n),t[Pi]=n.current,Ju(t),new vl(n)},ja.version="19.2.4",ja}var gx;function $1(){if(gx)return _d.exports;gx=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(),_d.exports=U1(),_d.exports}var q1=$1();const W1=$l(q1);function G1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,l,u,f=[],c="",d=e.split("/");for(d[0]||d.shift();l=d.shift();)i=l[0],i==="*"?(f.push(i),c+=l[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=l.indexOf("?",1),u=l.indexOf(".",1),f.push(l.substring(1,~s?s:~u?u:l.length)),c+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(c+=(~s?"?":"")+"\\"+l.substring(u))):c+="/"+l;return{keys:f,pattern:new RegExp("^"+c+(r?"(?=$|/)":"/?$"),"i")}}var kd={exports:{}},Ed={};/**
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 xx;function V1(){if(xx)return Ed;xx=1;var e=ql();function r(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,l=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function c(m,x){var _=x(),E=s({inst:{value:_,getSnapshot:x}}),C=E[0].inst,b=E[1];return u(function(){C.value=_,C.getSnapshot=x,d(C)&&b({inst:C})},[m,_,x]),l(function(){return d(C)&&b({inst:C}),m(function(){d(C)&&b({inst:C})})},[m]),f(_),_}function d(m){var x=m.getSnapshot;m=m.value;try{var _=x();return!i(m,_)}catch{return!0}}function p(m,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return Ed.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Ed}var vx;function K1(){return vx||(vx=1,kd.exports=V1()),kd.exports}var Y1=K1();const X1=z1.useInsertionEffect,Z1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Q1=Z1?P.useLayoutEffect:P.useEffect,J1=X1||Q1,ob=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return J1(()=>{r[0]=e}),r[1]},eS="popstate",xh="pushState",vh="replaceState",tS="hashchange",bx=[eS,xh,vh,tS],nS=e=>{for(const r of bx)addEventListener(r,e);return()=>{for(const r of bx)removeEventListener(r,e)}},lb=(e,r)=>Y1.useSyncExternalStore(nS,e,r),yx=()=>location.search,rS=({ssrSearch:e}={})=>lb(yx,e!=null?()=>e:yx),_x=()=>location.pathname,iS=({ssrPath:e}={})=>lb(_x,e!=null?()=>e:_x),sS=(e,{replace:r=!1,state:i=null}={})=>history[r?vh:xh](i,"",e),aS=(e={})=>[iS(e),sS],Sx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Sx]>"u"){for(const e of[xh,vh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,Sx,{value:!0})}const oS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",cb=(e="")=>e==="/"?"":e,lS=(e,r)=>e[0]==="~"?e.slice(1):cb(r)+e,cS=(e="",r)=>oS(wx(cb(e)),wx(r)),wx=e=>{try{return decodeURI(e)}catch{return e}},ub={hook:aS,searchHook:rS,parser:G1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},db=P.createContext(ub),Os=()=>P.useContext(db),hb={},fb=P.createContext(hb),uS=()=>P.useContext(fb),Wl=e=>{const[r,i]=e.hook(e);return[cS(e.base,r),ob((s,l)=>e.aroundNav(i,lS(s,e.base),l))]},cr=()=>Wl(Os()),bh=(e,r,i,s)=>{const{pattern:l,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=l.exec(i)||[],[c,...d]=f;return c!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,x)=>[m,d[x]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[c]:[]]:[!1,null]},yh=e=>bh(Os().parser,e,cr()[0]),dS=({children:e,...r})=>{var g,m,x;const i=Os(),s=r.hook?ub:i;let l=s;const[u,f=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=f,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((x=r.hook)==null?void 0:x.searchHook);let c=P.useRef({}),d=c.current,p=d;for(let _ in s){const E=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&E!==p[_]&&(c.current=p={...p}),p[_]=E,(E!==s[_]||E!==l[_])&&(l=p)}return P.createElement(db.Provider,{value:l,children:e})},Cx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,hS=e=>{let r=P.useRef(hb);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,l])=>l!==i[s])?e:i},Na=({path:e,nest:r,match:i,...s})=>{const l=Os(),[u]=Wl(l),[f,c,d]=i??bh(l.parser,e,u,r),p=hS({...uS(),...c});if(!f)return null;const g=d?P.createElement(dS,{base:d},Cx(s,p)):Cx(s,p);return P.createElement(fb.Provider,{value:p,children:g})},On=P.forwardRef((e,r)=>{const i=Os(),[s,l]=Wl(i),{to:u="",href:f=u,onClick:c,asChild:d,children:p,className:g,replace:m,state:x,transition:_,...E}=e,C=ob(v=>{v.ctrlKey||v.metaKey||v.altKey||v.shiftKey||v.button!==0||(c==null||c(v),v.defaultPrevented||(v.preventDefault(),l(f,e)))}),b=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:b}):P.createElement("a",{...E,onClick:C,href:b,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),pb=e=>Array.isArray(e)?e.flatMap(r=>pb(r&&r.type===P.Fragment?r.props.children:r)):[e],fS=({children:e,location:r})=>{const i=Os(),[s]=Wl(i);for(const l of pb(e)){let u=0;if(P.isValidElement(l)&&(u=bh(i.parser,l.props.path,r||s,l.props.nest))[0])return P.cloneElement(l,{match:u})}return null},kx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const x=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,x))}},l=()=>r,c={setState:s,getState:l,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,l,c);return c},pS=(e=>e?kx(e):kx),mS=e=>e;function gS(e,r=mS){const i=un.useSyncExternalStore(e.subscribe,un.useCallback(()=>r(e.getState()),[e,r]),un.useCallback(()=>r(e.getInitialState()),[e,r]));return un.useDebugValue(i),i}const Ex=e=>{const r=pS(e),i=s=>gS(r,s);return Object.assign(i,r),i},Kn=(e=>e?Ex(e):Ex);async function Ce(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function xS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function mb(){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 vS{constructor(r){ir(this,"ws",null);ir(this,"handlers",new Set);ir(this,"statusHandler",null);ir(this,"baseUrl");ir(this,"isReconnecting",!1);ir(this,"connectingPromise",null);ir(this,"lastCloseCode",0);ir(this,"reconnectAttempts",0);ir(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,l)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=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(f),this.isReconnecting=!1,this.connectingPromise=null,(c=this.statusHandler)==null||c.call(this,"connected"),s()},this.ws.onclose=c=>{var d,p,g;clearTimeout(f),this.lastCloseCode=c.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.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(f),console.error("WebSocket error:",c),this.connectingPromise=null,l(c)},this.ws.onmessage=c=>{try{const d=JSON.parse(c.data);xS(d)&&this.handlers.forEach(p=>p(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.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(l=this.statusHandler)==null||l.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=mb(),l={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(l)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const bS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Ut=new vS(bS),ai=async(e,r,i)=>{try{const s=await Ce(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function gb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let yl=[];const or=Kn()((e,r)=>{function i(){if(yl.length===0)return;const l=yl;yl=[],e(u=>({logs:[...u.logs,...l]}))}const s=gb(i);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 f=await(await Ce(`/api/dev-server?workdir=${encodeURIComponent(l)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const l=r().workdir;if(l)try{const f=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(l)}`)).json();e({config:f.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 f=await(await Ce(`/api/dev-server/start?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const l=r().workdir;if(l)try{const f=await(await Ce(`/api/dev-server/stop?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const l=r().workdir;if(l)try{const f=await(await Ce(`/api/dev-server/restart?workdir=${encodeURIComponent(l)}`,{method:"POST"})).json();e({status:f,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 f=l.payload;if(f.workdir!==u)return;yl.push({stream:f.stream,content:f.content}),s();break}case"devServer.state":{const f=l.payload;if(f.workdir!==u)return;e(c=>({status:c.status?{...c.status,state:f.state,errorMessage:f.errorMessage}:c.status}));break}}}}}),yS=3e4;function _S(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 jt=Kn((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const i=await Ce("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await Ce("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=ke.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:l}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const c=await u.json();throw new Error(c.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:l.map(c=>({...c,isActive:c.id===f.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:l}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:l.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,l)=>{e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:l})});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model context")}const f=await u.json(),{providers:c}=r();return e({providers:c.map(d=>d.id===i?{...d,models:d.models.map(p=>p.id===s?{...p,contextWindow:l,source:"user"}:p)}:d),activating:!1}),f.contextState&&ke.getState().updateContextState(f.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},updateModelSettings:async(i,s,l)=>{e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model settings")}const f=await u.json(),{providers:c}=r();return e({providers:c.map(d=>d.id===i?{...d,models:d.models.map(p=>{if(p.id!==s)return p;const g={...p,source:"user"};return l.contextWindow!==void 0&&(g.contextWindow=l.contextWindow),l.temperature!==void 0&&(g.temperature=l.temperature??void 0),l.topP!==void 0&&(g.topP=l.topP??void 0),l.topK!==void 0&&(g.topK=l.topK??void 0),l.maxTokens!==void 0&&(g.maxTokens=l.maxTokens??void 0),g})}:d),activating:!1}),f.contextState&&ke.getState().updateContextState(f.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model settings",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await Ce(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const f=await s.json();throw new Error(f.error??"Failed to refresh models")}const l=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:l.models}:f),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const l=setInterval(()=>{s()},yS);e({autoRefreshInterval:l})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(l=>l.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:l}=r(),u=s.find(c=>c.id===l);if(!u)return 2e5;const f=u.models.find(c=>c.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Vt=Kn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Ce("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const l=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!l.ok)return null;const u=await l.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await Ce(`/api/projects/${i}`);if(!s.ok)return null;const l=await s.json();return e({currentProject:l.project}),r().projects.length===0&&await r().listProjects(),l.project}catch{return null}},updateProject:async(i,s)=>{var l;try{const u=await Ce(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const f=await u.json();return((l=r().currentProject)==null?void 0:l.id)===i&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async i=>{var s;try{return(await Ce(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let _l=[];const Fa=Kn()((e,r)=>{function i(){if(_l.length===0)return;const l=_l;_l=[],e(u=>{const f={...u.logs};for(const c of l){const d=f[c.processId]??[];f[c.processId]=[...d,{offset:d.length,content:c.content,timestamp:Date.now(),stream:c.stream}]}return{logs:f}})}const s=gb(i);return{processes:[],logs:{},loading:!1,setProcesses:l=>e({processes:l}),addProcess:l=>e(u=>({processes:[...u.processes,l]})),updateProcess:(l,u)=>e(f=>({processes:f.processes.map(c=>c.id===l?{...c,...u}:c)})),removeProcess:l=>e(u=>({processes:u.processes.filter(f=>f.id!==l),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==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,f)=>{_l.push({processId:l,stream:u,content:f}),s()},setLogs:(l,u)=>e(f=>({logs:{...f.logs,[l]:u}})),clearLogs:l=>e(u=>({logs:{...u.logs,[l]:[]}})),handleMessage:(l,u)=>{switch(l){case"backgroundProcess.started":{const{processId:f,name:c,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:c,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,c=u.stream,d=u.content;r().appendLog(f,c,d);break}case"backgroundProcess.exited":{const f=u.processId,c=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:c}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),wt={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"};function Sl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function jx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const SS=[wt.DISPLAY_SHOW_THINKING,wt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,wt.DISPLAY_SHOW_STATS,wt.DISPLAY_SHOW_AGENT_DEFINITIONS,wt.DISPLAY_SHOW_WORKFLOW_BARS];function xb(){return{showThinking:Jt(e=>e.settings[wt.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:Jt(e=>e.settings[wt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:Jt(e=>e.settings[wt.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:Jt(e=>e.settings[wt.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:Jt(e=>e.settings[wt.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true"}}const Jt=Kn(e=>({settings:{},loading:{},getSetting:async r=>{e(Sl(r,!0));try{const s=await(await Ce(`/api/settings/${r}`)).json();return e(jx(r,s.value??"")),s.value}catch{return e(Sl(r,!1)),null}},setSetting:async(r,i)=>{e(Sl(r,!0));try{const l=await(await Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(jx(r,l.value??""))}catch{e(Sl(r,!1))}}})),wS=[{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"}],CS=[{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"}],vb={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"},ii={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},bb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Jd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ii},waiting_for_user:{...ii},phase_done:{...ii},phase_blocked:{...ii},new_message:{...bb}},agentOverrides:{}};function yb(e,r,i){var u;const s=e.events[r];if(!i)return s;const l=(u=e.agentOverrides[i])==null?void 0:u[r];return l?{soundEnabled:l.soundEnabled??s.soundEnabled,browserNotification:l.browserNotification??s.browserNotification,customSoundUrl:l.customSoundUrl!==void 0?l.customSoundUrl:s.customSoundUrl}:s}const Ti=Kn((e,r)=>({settings:Jd,loaded:!1,load:()=>{Jt.getState().getSetting(wt.NOTIFICATION_SETTINGS);const s=Jt.subscribe(u=>{const f=u.settings[wt.NOTIFICATION_SETTINGS];if(f!==void 0)try{const c=JSON.parse(f);e({settings:Nx(c),loaded:!0})}catch{e({loaded:!0})}}),l=Jt.getState().settings[wt.NOTIFICATION_SETTINGS];if(l)try{const u=JSON.parse(l);e({settings:Nx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),jd(i)},updateEvent:(i,s)=>{const l=r().settings,u={...l,events:{...l.events,[i]:{...l.events[i],...s}}};e({settings:u}),jd(u)},updateAgentOverride:(i,s,l)=>{var d;const u=r().settings,f={...u.agentOverrides};if(l===null){if(f[i]){const p={...f[i]};delete p[s],Object.keys(p).length===0?delete f[i]:f[i]=p}}else f[i]={...f[i],[s]:{...((d=f[i])==null?void 0:d[s])??{},...l}};const c={...u,agentOverrides:f};e({settings:c}),jd(c)}}));function jd(e){Jt.getState().setSetting(wt.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Nx(e){var r,i,s,l,u;return{soundEnabled:e.soundEnabled??Jd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Jd.browserNotificationEnabled,events:{complete:{...ii,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ii,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ii,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ii,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...bb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const Tx=new Map;function kS(e){let r=Tx.get(e);return r||(r=new Audio(e),r.volume=.5,Tx.set(e,r)),r}let _b=typeof Notification<"u"?Notification.permission:"denied";function ES(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(_b=e,e))}const jS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},NS={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 TS(e){typeof Notification>"u"||_b==="granted"&&(document.hasFocus()||new Notification(jS[e],{body:NS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function to(e,r){const{settings:i}=Ti.getState(),s=yb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const l=s.customSoundUrl??vb[e],u=kS(l);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&TS(e)}const AS=e=>to("complete",e),DS=e=>to("phase_done",e),LS=e=>to("phase_blocked",e),Ax=e=>to("waiting_for_user",e),RS=e=>to("new_message",e);let Ta=!1,sr=null;const Nd=new Set,Ft={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ds=null,cn=null;function Td(){Ds===null&&(Ds=requestAnimationFrame(()=>{Ds=null,cn==null||cn()}))}function ki(){Ds!==null&&(cancelAnimationFrame(Ds),Ds=null)}function Mt(e,r){return r!==null&&e.sessionId===r}function OS(e,r,i){return e.id!==void 0||Mt(e,r)||i===!0&&e.sessionId!==void 0}function MS(e,r){return e.includes(r)?e:[...e,r]}function Aa(e,r){return e.filter(i=>i!==r)}function IS(e,r){const i=e.find(l=>l.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(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 i?e.map(l=>l.id===r.id?s:l):[s,...e]}function BS(e,r,i){return e.map(s=>{const l=(i==null?void 0:i.id)===s.id?i:null,u=r.find(f=>f.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(l==null?void 0:l.mode)??(u==null?void 0:u.mode)??s.mode,phase:(l==null?void 0:l.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(l==null?void 0:l.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Dx=new Map;function Ha(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(f=>f.id===r),l=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return l==="planner"?"planner":l==="builder"?"build":"planner"}function zS(e,r){if(e.type==="chat.done"){const i=e.payload,s=Ha(r,e.sessionId),l=i.agentType??s;i.reason==="complete"&&AS(l),i.reason==="waiting_for_user"&&Ax(l);return}if(e.type==="chat.path_confirmation"){const i=Ha(r,e.sessionId);Ax(i);return}if(e.type==="task.completed"){const i=Ha(r,e.sessionId);DS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Dx.get(e.sessionId)??null;if(Dx.set(e.sessionId,i.phase),s===i.phase)return;const l=Ha(r,e.sessionId);i.phase==="blocked"&&LS(l)}}const ke=Kn((e,r)=>(cn=()=>{const i=Ft;if(!i.messageId)return;const s=i.deltaContent.length>0,l=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!l&&!u)return;const f=i.deltaContent,c=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===i.messageId){let x={...g};if(s&&(x.content=x.content+f),l&&(x.thinkingContent=(x.thinkingContent??"")+c),u){const _=new Set;x.toolCalls=(m=x.toolCalls)==null?void 0:m.map(C=>{const b=d.filter(v=>v.callId===C.id);return b.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...b.map(v=>({stream:v.stream,content:v.content}))]})});const E=d.filter(C=>!_.has(C.callId));E.length>0&&Ft.toolOutput.push(...E)}return{streamingMessage:x}}if(u){const x=new Set,_=p.messages.map(C=>{var v;if(C.id!==i.messageId)return C;const b=(v=C.toolCalls)==null?void 0:v.map(y=>{const S=d.filter(j=>j.callId===y.id);return S.length===0?y:(x.add(y.id),{...y,streamingOutput:[...y.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:b}}),E=d.filter(C=>!x.has(C.callId));return E.length>0&&Ft.toolOutput.push(...E),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Ce("/api/auth")).json()).requiresAuth}catch{}if(s&&!Ut.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Ut.onStatusChange(l=>{e({connectionStatus:l}),l==="connected"&&r().listSessions(void 0)});try{if(await Ut.connect(),!Ta){Ta=!0;const l=r().handleServerMessage;sr=Ut.subscribe(l)}}catch(l){console.error("Failed to connect:",l);const u=Ut.getLastCloseCode();if(!Ut.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}sr&&(sr(),sr=null),Ta=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Ut.disconnect(),sr&&(sr(),sr=null),Ta=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Ut.disconnect(),sr&&(sr(),sr=null),Ta=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:l}=await s.json();Ut.setToken(l),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Vt.getState(),{fetchConfig:f}=jt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Ut.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const l=await Ce("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!l.ok)return e({pendingSessionCreate:!1}),null;const u=await l.json();return Ut.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(ki(),e({currentSession:null,unreadSessionIds:Aa(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Aa(r().unreadSessionIds,i)});const l=await Ce(`/api/sessions/${i}`);if(!l.ok)return;const u=await l.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Ut.send("session.load",{sessionId:i});try{const f=await Ce(`/api/sessions/${i}/background-processes`);if(f.ok){const c=await f.json();Fa.getState().setProcesses(c.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const l=new URLSearchParams;l.set("limit",String(s)),i&&l.set("projectId",i);const f=await(await Ce(`/api/sessions?${l.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:i?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const l=new URLSearchParams;l.set("limit","20"),l.set("offset",String(s.sessions.length)),l.set("projectId",i);const f=await(await Ce(`/api/sessions?${l.toString()}`)).json();e(c=>({sessions:[...c.sessions,...f.sessions??[]],sessionsHasMore:f.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await Ce(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await Ce(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{ki(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Aa(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,l)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u){e({streamingMessageId:null});try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l==null?void 0:l.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error sending message:",c)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){ki(),cn==null||cn(),e({abortInProgress:!0});try{await Ce(`/api/sessions/${i}/stop`,{method:"POST"})}catch(l){console.error("Error stopping generation:",l)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await Ce(`/api/sessions/${i}/continue`,{method:"POST"})}catch(l){console.error("Error continuing generation:",l)}}},launchRunner:(i,s,l)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),l&&(u.workflowId=l),Ut.send("runner.launch",u)},switchMode:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const u=await Ce(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const u=await Ce(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,l)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),l&&l.length>0&&(u.attachments=l),Ut.send("mode.accept",u)},editCriteria:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const u=await Ce(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Ut.send("context.compact",{})},setSessionProvider:async(i,s)=>{var l;try{const u=(l=r().currentSession)==null?void 0:l.id;if(!u)return null;const f=await Ce(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!f.ok)return null;const c=await f.json();return e({currentSession:c.session,messages:c.messages??[],contextState:c.contextState}),c.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(l=>({subAgentContextStates:{...l.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const l={...s.subAgentContextStates};return delete l[i],{subAgentContextStates:l}})},confirmPath:async(i,s,l=!1)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{await Ce(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:l})})}catch(c){console.error("Error confirming path:",c)}},answerQuestion:async(i,s)=>{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:i,answer:s})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(i,s,l)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing ASAP message:",c)}},queueCompletion:async(i,s,l)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error queueing completion message:",c)}},cancelQueued:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const f=await(await Ce(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();f.queueState&&e({queuedMessages:f.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var f,c,d,p,g,m,x,_,E,C,b,v,y,S,j,A,N,D,T,I,z,q,K,W;const s=r();zS(i,s);const l=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const R=i.sessionId;!R||R===l||e(U=>({unreadSessionIds:MS(U.unreadSessionIds,R)}))};switch(i.type){case"session.state":{const R=i.payload;if(!OS(i,l,s.pendingSessionCreate))break;ki();const U=R.messages.find(L=>L.isStreaming)??null,H=r().pendingSessionCreate===!0,X=R.pendingConfirmations??[],B=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:R.session,sessions:IS(r().sessions,R.session),unreadSessionIds:Aa(r().unreadSessionIds,R.session.id),messages:R.messages,streamingMessageId:(U==null?void 0:U.id)??null,streamingMessage:U,currentTodos:[],pendingPathConfirmation:B,error:null,...H?{pendingSessionCreate:R.session.id}:{}}),R.session.providerId&&R.session.providerModel){const L=jt.getState();L.providers.find(V=>V.id===R.session.providerId)&&L.syncFromSession(R.session.providerId,R.session.providerModel)}break}case"session.list":{const R=i.payload;e(U=>({sessions:BS(R.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const R=i.payload;e(U=>({unreadSessionIds:Aa(U.unreadSessionIds,R.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const R=i.payload,U=i.sessionId,H=(c=r().currentSession)==null?void 0:c.id,X=U&&U!==H;e(Z=>({sessions:Z.sessions.map(B=>B.id===U?{...B,isRunning:R.isRunning}:B)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,isRunning:R.isRunning}:null,...R.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Mt(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const R=i.payload;e(U=>U.messages.some(H=>H.id===R.message.id)?U:{messages:[...U.messages,R.message],streamingMessageId:R.message.isStreaming?R.message.id:U.streamingMessageId,streamingMessage:R.message.isStreaming?R.message:U.streamingMessage});break}case"chat.message_updated":{if(!Mt(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const R=i.payload,U=R.updates.isStreaming===!1&&r().streamingMessageId===R.messageId;U&&(ki(),cn==null||cn()),e(H=>{const X=H.streamingMessage,Z=U;if(X&&X.id===R.messageId){const B={...X,...R.updates};return{messages:H.messages.map(L=>L.id===R.messageId?B:L),streamingMessageId:Z?null:H.streamingMessageId,streamingMessage:Z?null:{...X,...R.updates}}}return{messages:H.messages.map(B=>B.id===R.messageId?{...B,...R.updates}:B),streamingMessageId:Z?null:H.streamingMessageId}});break}case"chat.delta":{if(!Mt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const R=i.payload;if(!Nd.has(R.messageId)){Nd.add(R.messageId);const U=Ha(r(),i.sessionId);RS(U)}Ft.messageId=R.messageId,Ft.deltaContent+=R.content,Td();break}case"chat.thinking":{if(!Mt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const R=i.payload;Ft.messageId=R.messageId,Ft.thinkingContent+=R.content,Td();break}case"chat.tool_preparing":{if(!Mt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const R=i.payload;e(U=>{const H=U.streamingMessage;return H&&H.id===R.messageId?{streamingMessage:{...H,preparingToolCalls:[...H.preparingToolCalls??[],{index:R.index,name:R.name}]}}:{messages:U.messages.map(X=>X.id===R.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:R.index,name:R.name}]}:X)}});break}case"chat.tool_call":{if(!Mt(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const R=i.payload,U=H=>{var B;const X=(B=H.preparingToolCalls)==null?void 0:B.filter((L,M)=>{var V;return L.name===R.tool?(V=H.preparingToolCalls)==null?void 0:V.slice(0,M).some(re=>re.name===R.tool):!0}),Z=Ft.toolOutput.filter(L=>L.callId===R.callId);return Z.length>0&&(Ft.toolOutput=Ft.toolOutput.filter(L=>L.callId!==R.callId)),{...H,toolCalls:[...H.toolCalls??[],{id:R.callId,name:R.tool,arguments:R.args,startedAt:Date.now(),...Z.length>0?{streamingOutput:Z.map(L=>({stream:L.stream,content:L.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(H=>{const X=H.streamingMessage;return X&&X.id===R.messageId?{streamingMessage:U(X)}:{messages:H.messages.map(Z=>Z.id===R.messageId?U(Z):Z)}});break}case"chat.tool_output":{if(!Mt(i,((E=r().currentSession)==null?void 0:E.id)??null)){u();break}const R=i.payload;Ft.messageId=R.messageId,Ft.toolOutput.push({messageId:R.messageId,callId:R.callId,stream:R.stream,content:R.output}),Td();break}case"chat.tool_result":{if(!Mt(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const R=i.payload,U=H=>{var Z;const X=(Z=H.toolCalls)==null?void 0:Z.map(B=>B.id===R.callId?{...B,result:R.result}:B);return{...H,toolCalls:X}};e(H=>{const X=H.streamingMessage;return X&&X.id===R.messageId?{streamingMessage:U(X)}:{messages:H.messages.map(Z=>Z.id===R.messageId?U(Z):Z)}});break}case"chat.vision_fallback":{if(!Mt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const R=i.payload;e(U=>{const H=`${R.messageId}-${R.attachmentId}`,X={...U.visionFallbackByMessage};return X[H]={type:R.type,attachmentId:R.attachmentId,filename:R.filename,description:R.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!Mt(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const R=i.payload;e({currentTodos:R.todos});break}case"chat.summary":{if(!Mt(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:R.summary}:null}));break}case"chat.progress":{if(!Mt(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const R=i.payload;console.log("Progress:",R.message,R.phase);break}case"chat.format_retry":{if(!Mt(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const R=i.payload;console.log("Format retry:",R.attempt,"/",R.maxAttempts);break}case"chat.done":{if(!Mt(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}ki(),cn==null||cn();const R=i.payload,U=R.stats;Ft.messageId=null,Ft.deltaContent="",Ft.thinkingContent="",Ft.toolOutput=[],Nd.delete(R.messageId),e(H=>{const X=H.streamingMessage,Z=X&&X.id===R.messageId?{...X,isStreaming:!1,stats:U??X.stats}:null;return{messages:H.messages.map(B=>B.id===R.messageId?Z??{...B,isStreaming:!1,stats:U??B.stats}:B),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Mt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}ki(),cn==null||cn();const R=i.payload;console.error("Chat error:",R.error,"recoverable:",R.recoverable),R.recoverable||(Ft.messageId=null,Ft.deltaContent="",Ft.thinkingContent="",Ft.toolOutput=[]),e(U=>({error:{code:"CHAT_ERROR",message:R.error},streamingMessageId:R.recoverable?U.streamingMessageId:null,...R.recoverable?{}:{messages:U.streamingMessage?U.messages.map(H=>H.id===U.streamingMessage.id?U.streamingMessage:H):U.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Mt(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const R=i.payload;e({pendingPathConfirmation:{callId:R.callId,tool:R.tool,paths:R.paths,workdir:R.workdir,reason:R.reason}});break}case"chat.ask_user":{if(!Mt(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const R=i.payload;e({pendingQuestion:{callId:R.callId,question:R.question}});break}case"mode.changed":{if(!Mt(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,mode:R.mode}:null}));break}case"phase.changed":{const R=i.payload,U=i.sessionId,H=(z=r().currentSession)==null?void 0:z.id,X=U&&U!==H;e(Z=>({sessions:Z.sessions.map(B=>B.id===U?{...B,phase:R.phase}:B)})),X||e(Z=>({currentSession:Z.currentSession?{...Z.currentSession,phase:R.phase}:null}));break}case"criteria.updated":{if(!Mt(i,((q=r().currentSession)==null?void 0:q.id)??null)){u();break}const R=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,criteria:R.criteria}:null}));break}case"context.state":{const R=i.payload,U=Mt(i,((K=r().currentSession)==null?void 0:K.id)??null);R.subAgentId?U&&r().updateSubAgentContextState(R.subAgentId,R.context):U?e({contextState:R.context}):u();break}case"session.name_generated":{const R=i.payload,U=i.sessionId,H=(W=r().currentSession)==null?void 0:W.id;e(X=>{const Z=X.sessions.map(L=>L.id===U?{...L,title:R.name,updatedAt:new Date().toISOString()}:L),B=H===U?X.currentSession?{...X.currentSession,title:R.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Z,currentSession:B}});break}case"queue.state":{const R=i.payload;e({queuedMessages:R.messages});break}case"devServer.output":case"devServer.state":{or.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Fa.getState().handleMessage(i.type,i.payload);break}case"error":{const R=i.payload;console.error("Server error:",R),e({error:{code:R.code,message:R.message},streamingMessageId:null});break}}}}));function Sb(){return ke(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function HS(){return ke(e=>e.queuedMessages)}function PS(){return ke(e=>e.abortInProgress)}function FS(){const e=ke(s=>s.connect),r=ke(s=>s.connectionStatus),i=Ti(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function eh(){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 Lx(e,r){const i=Ut.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:eh(),type:e,payload:r}))}const lr=Kn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await Ce("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const l=Ut.ws;if(l&&l.readyState===WebSocket.OPEN)for(const u of s)l.send(JSON.stringify({id:eh(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Ce("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const l=await s.json();e(f=>({sessions:[...f.sessions,l]}));const u=Ut.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:eh(),type:"terminal.subscribe",payload:{sessionId:l.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Lx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,l)=>{Lx("terminal.resize",{sessionId:i,cols:s,rows:l})},killSession:async i=>{try{(await Ce(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(l=>({sessions:l.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(l=>{const u=l.sessions.filter(f=>f.id!==s);return u.length===0&&l.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Ut.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&lr.getState().handleMessage(e)});var _h=ab();const Sh=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},l)=>o.jsx("button",{ref:l,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));Sh.displayName="IconButton";const US="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",Oi=P.forwardRef((e,r)=>o.jsx(Sh,{ref:r,icon:US,title:"Edit",...e}));Oi.displayName="EditButton";const $S="M6 18L18 6M6 6l12 12",wb=P.forwardRef((e,r)=>o.jsx(Sh,{ref:r,icon:$S,...e}));wb.displayName="CloseButton";const qS={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 Ct({label:e,title:r,size:i="md",minHeight:s,children:l,footer:u,className:f,onClose:c,isOpen:d,closeOnBackdropClick:p=!0,closeOnEscape:g=!0,showCloseButton:m=!0}){const[x,_]=P.useState(!1),E=d!==void 0,C=E?d:x,b=P.useCallback(()=>{E||_(!0)},[E]),v=P.useCallback(()=>{E||_(!1),c==null||c()},[E,c]);P.useEffect(()=>{if(!C||!g)return;const S=j=>{j.key==="Escape"&&v()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[C,v,g]);const y=e&&(typeof e=="string"?o.jsx("button",{type:"button",onClick:b,className:f,children:e}):o.jsx("span",{onClick:b,className:f,style:{cursor:"pointer"},children:e}));return o.jsxs(o.Fragment,{children:[y,C&&(typeof document<"u"?_h.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:p?v:void 0}),o.jsxs("div",{className:`relative w-full ${qS[i]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(r||m)&&o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[r&&o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:r}),m&&o.jsx(wb,{onClick:v,className:"ml-auto","aria-label":"Close"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:s?{minHeight:s}:void 0,children:l}),u&&o.jsx("div",{className:"px-4 py-3 border-t border-border",children:u})]})]}),document.body):null)]})}const et=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...l},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",c={primary:"bg-accent-primary/25 text-white hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return o.jsx("button",{ref:u,className:`${f} ${c[e]} ${d[r]} ${i}`,...l,children:s})});et.displayName="Button";function WS({value:e,defaultUrl:r,disabled:i,onChange:s}){const l=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:l,disabled:i,onChange:u=>{const f=u.target.value;s(f===r?null:f)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:CS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Rx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function GS(){const e=Ti(d=>d.settings),r=Ti(d=>d.update),i=Ti(d=>d.updateEvent),s=Ti(d=>d.updateAgentOverride),l=Ti(d=>d.load);P.useEffect(()=>{l()},[l]);const u=async()=>{await ES()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},c=(d,p,g)=>{d==="general"?i(p,{customSoundUrl:g}):s(d,p,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Ox,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Ox,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Rx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:wS.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Rx.map(p=>{const g=yb(e,d.key,p.key==="general"?void 0:p.key),m=vb[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:x=>f(p.key,d.key,"soundEnabled",x.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:x=>f(p.key,d.key,"browserNotification",x.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(WS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:x=>c(p.key,d.key,x)})]})},p.key)})]},d.key))})]})})]})]})}function Ox({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:l=>{l.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function wh(e,r){r({loading:!0});try{const s=await(await Ce(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Tr=Kn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await wh("/api/skills",e)},toggleSkill:async i=>{try{const l=await(await Ce(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:l.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:l.enabled}:f)}))}catch{}},fetchSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await ai("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const l=await ai("PUT",`/api/skills/${i}`,s);return l.success&&await r().fetchSkills(),l},deleteSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async i=>{try{const s=await Ce(`/api/skills/${i}/duplicate`,{method:"POST"}),l=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Ch(){const[e,r]=P.useState({id:null,type:null}),i=P.useCallback(u=>r({id:u,type:"delete"}),[]),s=P.useCallback(()=>r({id:null,type:null}),[]),l=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:l}}function kh({onConfirm:e,onCancel:r}){return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),o.jsx("button",{onClick:r,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function Eh({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})}function Ga({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}function Ai({label:e,value:r,onChange:i,placeholder:s,readOnly:l,hint:u,mono:f}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:c=>i(c.target.value),readOnly:l,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"font-mono":""} ${l?"opacity-60":""}`})]})}function VS({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(et,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(et,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function jh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function Cb({description:e,onNew:r,newLabel:i="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(et,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function kb({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,onDuplicate:l,onDelete:u,children:f}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:f}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&i&&o.jsx("button",{onClick:i,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Ga,{onClick:l}),!e&&s&&o.jsx(Oi,{onClick:s}),!e&&(r?o.jsx(kh,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Eh,{onClick:()=>u==null?void 0:u()}))]})]})}function KS({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:l,onView:u,onEdit:f,onDuplicate:c,onDelete:d}){return o.jsxs(kb,{isBuiltIn:s,isConfirmingDelete:l,onView:u,onEdit:f,onDuplicate:c,onDelete:d,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),i&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:i})]})}function Eb({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:l}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:l}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function jb({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:l="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:c=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:i,value:e,onChange:p,placeholder:l,hint:f}),o.jsx(Ai,{label:s,value:r,onChange:g,readOnly:c,placeholder:u,hint:c?d:void 0,mono:!0})]})}function Nb(e={}){const{initialData:r={}}=e,[i,s]=P.useState("list"),[l,u]=P.useState(null),[f,c]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),x=P.useCallback(()=>{m(r),c(""),u(null)},[r]),_=P.useCallback(v=>{s(v),v==="list"&&x()},[x]),E=P.useCallback(v=>{m(y=>typeof v=="function"?v(y):v)},[]),C=P.useCallback((v,y={})=>{u(v),s("edit"),m({...y}),c("")},[]),b=P.useCallback(()=>{u(null),s("edit"),m(r),c("")},[r]);return{view:i,editingId:l,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:c,setFormData:E,setSaving:p,resetForm:x,startEditing:C,startNew:b}}function Mx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsx(KS,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f})}function YS({isOpen:e}){const r=Tr(R=>R.defaults),i=Tr(R=>R.userItems),s=Tr(R=>R.loading),l=Tr(R=>R.fetchSkills),u=Tr(R=>R.fetchSkill),f=Tr(R=>R.fetchDefaultContent),c=Tr(R=>R.createSkill),d=Tr(R=>R.updateSkill),p=Tr(R=>R.deleteSkill),{view:g,editingId:m,formError:x,saving:_,formData:E,setView:C,setEditingId:b,setFormError:v,setFormData:y,setSaving:S}=Nb(),{clearConfirm:j}=Ch();P.useEffect(()=>{e&&(l(),C("list"),b(null),j())},[e,l,j]);const A=(R,U,H,X)=>{y({name:X??R.metadata.name,id:H??R.metadata.id,description:R.metadata.description??"",version:R.metadata.version??"1.0.0",prompt:R.prompt,isReadOnly:U})},N=async R=>{if(r.some(H=>H.id===R)){const H=await f(R);if(!H)return;A(H,!0),b(R),v(""),C("edit")}else{const H=await u(R);if(!H)return;A(H,!0),b(R),v(""),C("edit")}},D=async R=>{const H=r.some(Z=>Z.id===R)?await f(R):await u(R);if(!H)return;const X=`${R}-copy-${Date.now()}`;A(H,!1,X,`${H.metadata.name} (copy)`),b(null),v(""),C("edit")},T=()=>{y({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},I=async R=>{const U=await u(R);U&&(A(U,!1),b(R),v(""),C("edit"))},z=async R=>{await p(R),j()},q=async()=>{const R=m??E.id;if(!R||!E.name||!E.prompt){v("Name, ID, and prompt are required.");return}S(!0),v("");const U={metadata:{id:R,name:E.name,description:E.description,version:E.version},prompt:E.prompt},H=m?await d(m,U):await c(U);if(S(!1),!H.success){v(H.error??"Failed to save skill.");return}C("list")},K=R=>{y(U=>({...U,name:R})),m||y(U=>({...U,id:R.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},W=E.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:W?E.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),x&&o.jsx(jh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(jb,{name:E.name,id:E.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:K,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:E.description,onChange:R=>y(U=>({...U,description:R})),placeholder:"What this skill does...",readOnly:W}),o.jsx(Ai,{label:"Version",value:E.version,onChange:R=>y(U=>({...U,version:R})),placeholder:"1.0.0",readOnly:W})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:E.prompt,onChange:R=>y(U=>({...U,prompt:R.target.value})),readOnly:W,placeholder:"The system prompt for this skill...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(et,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),W?o.jsx(et,{variant:"primary",onClick:()=>{y(R=>({...R,name:R.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),b(null)},children:"Duplicate & Customize"}):o.jsx(et,{variant:"primary",onClick:q,disabled:_||!E.name||!E.id||!E.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(Cb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(Eb,{loading:s,hasItems:r.length>0||i.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:r.map(R=>o.jsx(Mx,{skill:R,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(R.id),onDuplicate:()=>D(R.id)},R.id))})]}),i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:i.map(R=>o.jsx(Mx,{skill:R,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(R.id),onEdit:()=>I(R.id),onDuplicate:()=>D(R.id),onDelete:()=>z(R.id)},R.id))})]})]})]})}function XS({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(Ct,{isOpen:e,onClose:r,title:"Settings",size:"xl",minHeight:"500px",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(Da,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(Da,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(Da,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(Da,{label:"Display",active:i==="display",onClick:()=>s("display")}),o.jsx(Da,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(JS,{isOpen:e}),i==="skills"&&o.jsx(YS,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(GS,{})}),i==="display"&&o.jsx(QS,{}),i==="advanced"&&o.jsx(ZS,{onClose:r})]})})}function ZS({onClose:e}){const[,r]=cr();function i(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(et,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function QS(){const e=Jt(g=>g.settings),r=Jt(g=>g.loading),i=Jt(g=>g.getSetting),s=Jt(g=>g.setSetting),l=r[wt.DISPLAY_SHOW_THINKING]??!1,u=[{key:wt.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:wt.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:wt.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:wt.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:wt.DISPLAY_SHOW_WORKFLOW_BARS,label:"Show workflow bars",description:"Display workflow start and end markers"}],f=Object.fromEntries(u.map(g=>[g.key,e[g.key]??"true"])),[c,d]=P.useState(()=>Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])));P.useEffect(()=>{u.forEach(g=>i(g.key))},[i]),P.useEffect(()=>{d(Object.fromEntries(u.map(g=>[g.key,f[g.key]==="true"])))},[JSON.stringify(f)]);const p=async g=>{const m=String(!c[g]);d(x=>({...x,[g]:!x[g]})),await s(g,m)};return l?o.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),o.jsx("div",{className:"space-y-4",children:u.map(({key:g,label:m,description:x})=>o.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary",children:m}),o.jsx("div",{className:"text-xs text-text-muted",children:x})]}),o.jsx("button",{type:"button",onClick:()=>p(g),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${c[g]?"bg-accent-primary":"bg-bg-tertiary"}`,children:o.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${c[g]?"translate-x-6":"translate-x-1"}`})})]},g))})]})})}function Da({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function JS({isOpen:e}){const r=Jt(b=>b.settings),i=Jt(b=>b.loading),s=Jt(b=>b.getSetting),l=Jt(b=>b.setSetting),u=r[wt.GLOBAL_INSTRUCTIONS]??"",f=i[wt.GLOBAL_INSTRUCTIONS]??!1,[c,d]=P.useState(u),[p,g]=P.useState(!1),[m,x]=P.useState(!1);P.useEffect(()=>{e&&s(wt.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{x(!0),l(wt.GLOBAL_INSTRUCTIONS,c),x(!1),g(!1)},E=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:c,onChange:b=>{d(b.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{variant:"secondary",onClick:E,disabled:!p,children:"Discard"}),o.jsx(et,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Ad={exports:{}},Ix;function ew(){return Ix||(Ix=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var I=y.length-1;I>=0;I--)(N=y[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=d(9042),x=d(9924),_=d(844),E=d(4725),C=d(2585),b=d(3656);let v=c.AccessibilityManager=class extends _.Disposable{constructor(y,S,j,A){super(),this._terminal=y,this._coreBrowserService=j,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.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,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(y){for(let S=0;S<y;S++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
59
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,S){this._liveRegionDebouncer.refresh(y,S,this._terminal.rows)}_renderRows(y,S){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=y;N<=S;N++){const D=j.lines.get(j.ydisp+N),T=[],I=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",z=(j.ydisp+N+1).toString(),q=this._rowElements[N];q&&(I.length===0?(q.innerText=" ",this._rowColumns.set(q,[0,1])):(q.textContent=I,this._rowColumns.set(q,T)),q.setAttribute("aria-posinset",z),q.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,S){const j=y.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==A)return;let N,D;if(S===0?(N=j,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:y.anchorNode,offset:y.anchorOffset},j={node:y.focusNode,offset:y.focusOffset};if((S.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===j.node&&S.offset>j.offset)&&([S,j]=[j,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:z,offset:q})=>{const K=z instanceof Text?z.parentNode:z;let W=parseInt(K==null?void 0:K.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const R=this._rowColumns.get(K);if(!R)return console.warn("columns is null. Race condition?"),null;let U=q<R.length?R[q]:R.slice(-1)[0]+1;return U>=this._terminal.cols&&(++W,U=0),{row:W,column:U}},D=N(S),T=N(j);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(y){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=v=p([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],v)},3614:(f,c)=>{function d(x){return x.replace(/\r?\n/g,"\r")}function p(x,_){return _?"\x1B[200~"+x+"\x1B[201~":x}function g(x,_,E,C){x=p(x=d(x),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(x,!0),_.value=""}function m(x,_,E){const C=E.getBoundingClientRect(),b=x.clientX-C.left-10,v=x.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${b}px`,_.style.top=`${v}px`,_.style.zIndex="1000",_.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=p,c.copyHandler=function(x,_){x.clipboardData&&x.clipboardData.setData("text/plain",_.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,_,E,C){x.stopPropagation(),x.clipboardData&&g(x.clipboardData.getData("text/plain"),_,E,C)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(x,_,E,C,b){m(x,_,E),b&&C.rightClickSelect(x),_.value=C.selectionText,_.select()}},7239:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const p=d(1505);c.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,x){this._css.set(g,m,x)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,x){this._color.set(g,m,x)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(d,p,g,m){d.addEventListener(p,g,m);let x=!1;return{dispose:()=>{x||(x=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=d(3656),x=d(8460),_=d(844),E=d(2585),C=d(4725);let b=c.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(v,y,S,j,A){super(),this._element=v,this._mouseService=y,this._renderService=S,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(v){this._lastMouseEvent=v;const y=this._positionFromMouseEvent(v,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const S=v.composedPath();for(let j=0;j<S.length;j++){const A=S[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(v){if(this._activeLine!==v.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(v,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,v)||(this._clearCurrentLink(),this._askForLink(v,!0))}_askForLink(v,y){var j,A;this._activeProviderReplies&&y||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=v.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())y?(A=this._activeProviderReplies)!=null&&A.get(N)&&(S=this._checkLinkProviderResult(N,v,S)):D.provideLinks(v.y,(T=>{var z,q;if(this._isMouseOut)return;const I=T==null?void 0:T.map((K=>({link:K})));(z=this._activeProviderReplies)==null||z.set(N,I),S=this._checkLinkProviderResult(N,v,S),((q=this._activeProviderReplies)==null?void 0:q.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(v.y,this._activeProviderReplies)}))}_removeIntersectingLinks(v,y){const S=new Set;for(let j=0;j<y.size;j++){const A=y.get(j);if(A)for(let N=0;N<A.length;N++){const D=A[N],T=D.link.range.start.y<v?0:D.link.range.start.x,I=D.link.range.end.y>v?this._bufferService.cols:D.link.range.end.x;for(let z=T;z<=I;z++){if(S.has(z)){A.splice(N--,1);break}S.add(z)}}}}_checkLinkProviderResult(v,y,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(v);let A=!1;for(let D=0;D<v;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(A=!0);if(!A&&j){const D=j.find((T=>this._linkAtPosition(T.link,y)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const T=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((I=>this._linkAtPosition(I.link,y)));if(T){S=!0,this._handleNewLink(T);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(v){if(!this._currentLink)return;const y=this._positionFromMouseEvent(v,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(v,this._currentLink.link.text)}_clearCurrentLink(v,y){this._currentLink&&this._lastMouseEvent&&(!v||!y||this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(v){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(v.link,y)&&(this._currentLink=v,this._currentLink.state={decorations:{underline:v.link.decorations===void 0||v.link.decorations.underline,pointerCursor:v.link.decorations===void 0||v.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,v.link,this._lastMouseEvent),v.link.decorations={},Object.defineProperties(v.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,A,N;(j=this._currentLink)!=null&&j.state&&((N=(A=this._currentLink)==null?void 0:A.state)==null?void 0:N.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(v.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(v,y,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&v.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(S,y.text)}_fireUnderlineEvent(v,y){const S=v.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(v,y,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&v.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(S,y.text)}_linkAtPosition(v,y){const S=v.range.start.y*this._bufferService.cols+v.range.start.x,j=v.range.end.y*this._bufferService.cols+v.range.end.x,A=y.y*this._bufferService.cols+y.x;return S<=A&&A<=j}_positionFromMouseEvent(v,y,S){const j=S.getCoords(v,y,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(v,y,S,j,A){return{x1:v,y1:y,x2:S,y2:j,cols:this._bufferService.cols,fg:A}}};c.Linkifier=b=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],b)},9042:(f,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(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=d(511),x=d(2585);let _=c.OscLinkProvider=class{constructor(C,b,v){this._bufferService=C,this._optionsService=b,this._oscLinkService=v}provideLinks(C,b){var I;const v=this._bufferService.buffer.lines.get(C-1);if(!v)return void b(void 0);const y=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=v.getTrimmedLength();let N=-1,D=-1,T=!1;for(let z=0;z<A;z++)if(D!==-1||v.hasContent(z)){if(v.loadCell(z,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=z,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else D!==-1&&(T=!0);if(T||D!==-1&&z===A-1){const q=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(q){const K={start:{x:D+1,y:C},end:{x:z+(T||z!==A-1?0:1),y:C}};let W=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const R=new URL(q);["http:","https:"].includes(R.protocol)||(W=!0)}catch{W=!0}W||y.push({text:q,range:K,activate:(R,U)=>S?S.activate(R,U,K):E(0,U),hover:(R,U)=>{var H;return(H=S==null?void 0:S.hover)==null?void 0:H.call(S,R,U,K)},leave:(R,U)=>{var H;return(H=S==null?void 0:S.leave)==null?void 0:H.call(S,R,U,K)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=z,N=j.extended.urlId):(D=-1,N=-1)}}b(y)}};function E(C,b){if(confirm(`Do you want to navigate to ${b}?
60
-
61
- WARNING: This link could potentially be dangerous`)){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=_=p([g(0,x.IBufferService),g(1,x.IOptionsService),g(2,x.IOscLinkService)],_)},6193:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(d,p){this._renderCallback=d,this._coreBrowserService=p,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const p=d(3614),g=d(3656),m=d(3551),x=d(9042),_=d(3730),E=d(1680),C=d(3107),b=d(5744),v=d(2950),y=d(1296),S=d(428),j=d(4269),A=d(5114),N=d(8934),D=d(3230),T=d(9312),I=d(4725),z=d(6731),q=d(8055),K=d(8969),W=d(8460),R=d(844),U=d(6114),H=d(8437),X=d(2584),Z=d(7399),B=d(5941),L=d(9074),M=d(2585),V=d(5435),F=d(4567),re=d(779);class Q extends K.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Y={}){super(Y),this.browser=U,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new R.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(M.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows((($,ae)=>this.refresh($,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport(($=>this._reportWindowsOptions($)))),this.register(this._inputHandler.onColor(($=>this._handleColorEvent($)))),this.register((0,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(($=>this._afterResize($.cols,$.rows)))),this.register((0,R.toDisposable)((()=>{var $,ae;this._customKeyEventHandler=void 0,(ae=($=this.element)==null?void 0:$.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const $ of Y){let ae,ne="";switch($.index){case 256:ae="foreground",ne="10";break;case 257:ae="background",ne="11";break;case 258:ae="cursor",ne="12";break;default:ae="ansi",ne="4;"+$.index}switch($.type){case 0:const ve=q.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[$.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ne};${(0,B.toRgbString)(ve)}${X.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((ye=>ye.ansi[$.index]=q.channels.toColor(...$.color)));else{const ye=ae;this._themeService.modifyColors((Ae=>Ae[ye]=q.channels.toColor(...$.color)))}break;case 2:this._themeService.restoreColor($.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Y){Y?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Y;return(Y=this.textarea)==null?void 0:Y.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Y=this.buffer.ybase+this.buffer.y,$=this.buffer.lines.get(Y);if(!$)return;const ae=Math.min(this.buffer.x,this.cols-1),ne=this._renderService.dimensions.css.cell.height,ve=$.getWidth(ae),ye=this._renderService.dimensions.css.cell.width*ve,Ae=this.buffer.y*this._renderService.dimensions.css.cell.height,Re=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Re+"px",this.textarea.style.top=Ae+"px",this.textarea.style.width=ye+"px",this.textarea.style.height=ne+"px",this.textarea.style.lineHeight=ne+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",($=>{this.hasSelection()&&(0,p.copyHandler)($,this._selectionService)})));const Y=$=>(0,p.handlePasteEvent)($,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Y)),U.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",($=>{$.button===2&&(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",($=>{(0,p.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),U.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",($=>{$.button===1&&(0,p.moveTextAreaUnderMouseCursor)($,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Y=>this._inputEvent(Y)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Y){var ae;if(!Y)throw new Error("Terminal requires a parent element.");if(Y.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Y.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Y.appendChild(this.element);const $=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(ne=>this.updateCursorStyle(ne)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),U.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(A.CoreBrowserService,this.textarea,Y.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(ne=>this._handleTextAreaFocus(ne)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ne=>this._onRender.fire(ne)))),this.onResize((ne=>this._renderService.resize(ne.cols,ne.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(v.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild($);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(E.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(T.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ne=>this.scrollLines(ne.amount,ne.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ne=>this._renderService.handleSelectionChanged(ne.start,ne.end,ne.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ne=>{this.textarea.value=ne,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ne=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(ne=>this._selectionService.handleMouseDown(ne)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(F.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ne=>this._handleScreenReaderModeOptionChange(ne)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ne=>{!this._overviewRulerRenderer&&ne&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,$=this.element;function ae(ye){const Ae=Y._mouseService.getMouseReportCoords(ye,Y.screenElement);if(!Ae)return!1;let Re,He;switch(ye.overrideType||ye.type){case"mousemove":He=32,ye.buttons===void 0?(Re=3,ye.button!==void 0&&(Re=ye.button<3?ye.button:3)):Re=1&ye.buttons?0:4&ye.buttons?1:2&ye.buttons?2:3;break;case"mouseup":He=0,Re=ye.button<3?ye.button:3;break;case"mousedown":He=1,Re=ye.button<3?ye.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(ye)===!1||Y.viewport.getLinesScrolled(ye)===0)return!1;He=ye.deltaY<0?0:1,Re=4;break;default:return!1}return!(He===void 0||Re===void 0||Re>4)&&Y.coreMouseService.triggerMouseEvent({col:Ae.col,row:Ae.row,x:Ae.x,y:Ae.y,button:Re,action:He,ctrl:ye.ctrlKey,alt:ye.altKey,shift:ye.shiftKey})}const ne={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ve={mouseup:ye=>(ae(ye),ye.buttons||(this._document.removeEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.removeEventListener("mousemove",ne.mousedrag)),this.cancel(ye)),wheel:ye=>(ae(ye),this.cancel(ye,!0)),mousedrag:ye=>{ye.buttons&&ae(ye)},mousemove:ye=>{ye.buttons||ae(ye)}};this.register(this.coreMouseService.onProtocolChange((ye=>{ye?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ye)),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&ye?ne.mousemove||($.addEventListener("mousemove",ve.mousemove),ne.mousemove=ve.mousemove):($.removeEventListener("mousemove",ne.mousemove),ne.mousemove=null),16&ye?ne.wheel||($.addEventListener("wheel",ve.wheel,{passive:!1}),ne.wheel=ve.wheel):($.removeEventListener("wheel",ne.wheel),ne.wheel=null),2&ye?ne.mouseup||(ne.mouseup=ve.mouseup):(this._document.removeEventListener("mouseup",ne.mouseup),ne.mouseup=null),4&ye?ne.mousedrag||(ne.mousedrag=ve.mousedrag):(this._document.removeEventListener("mousemove",ne.mousedrag),ne.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)($,"mousedown",(ye=>{if(ye.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ye))return ae(ye),ne.mouseup&&this._document.addEventListener("mouseup",ne.mouseup),ne.mousedrag&&this._document.addEventListener("mousemove",ne.mousedrag),this.cancel(ye)}))),this.register((0,g.addDisposableDomListener)($,"wheel",(ye=>{if(!ne.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ye)===!1)return!1;if(!this.buffer.hasScrollback){const Ae=this.viewport.getLinesScrolled(ye);if(Ae===0)return;const Re=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ye.deltaY<0?"A":"B");let He="";for(let Ue=0;Ue<Math.abs(Ae);Ue++)He+=Re;return this.coreService.triggerDataEvent(He,!0),this.cancel(ye,!0)}return this.viewport.handleWheel(ye)?this.cancel(ye):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)($,"touchstart",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ye),this.cancel(ye)}),{passive:!0})),this.register((0,g.addDisposableDomListener)($,"touchmove",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ye)?void 0:this.cancel(ye)}),{passive:!1}))}refresh(Y,$){var ae;(ae=this._renderService)==null||ae.refreshRows(Y,$)}updateCursorStyle(Y){var $;($=this._selectionService)!=null&&$.shouldColumnSelect(Y)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Y,$,ae=0){var ne;ae===1?(super.scrollLines(Y,$,ae),this.refresh(0,this.rows-1)):(ne=this.viewport)==null||ne.scrollLines(Y)}paste(Y){(0,p.paste)(Y,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Y){this._customKeyEventHandler=Y}attachCustomWheelEventHandler(Y){this._customWheelEventHandler=Y}registerLinkProvider(Y){return this._linkProviderService.registerLinkProvider(Y)}registerCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const $=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),$}deregisterCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Y)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Y){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Y)}registerDecoration(Y){return this._decorationService.registerDecoration(Y)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Y,$,ae){this._selectionService.setSelection(Y,$,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Y;(Y=this._selectionService)==null||Y.clearSelection()}selectAll(){var Y;(Y=this._selectionService)==null||Y.selectAll()}selectLines(Y,$){var ae;(ae=this._selectionService)==null||ae.selectLines(Y,$)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const $=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!$&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;$||Y.key!=="Dead"&&Y.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,Z.evaluateKeyboardEvent)(Y,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Y),ae.type===3||ae.type===2){const ne=this.rows-1;return this.scrollLines(ae.type===2?-ne:ne),this.cancel(Y,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Y)||(ae.cancel&&this.cancel(Y,!0),!ae.key||!!(Y.key&&!Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&Y.key.length===1&&Y.key.charCodeAt(0)>=65&&Y.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==X.C0.ETX&&ae.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||Y.altKey||Y.ctrlKey?this.cancel(Y,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Y,$){const ae=Y.isMac&&!this.options.macOptionIsMeta&&$.altKey&&!$.ctrlKey&&!$.metaKey||Y.isWindows&&$.altKey&&$.ctrlKey&&!$.metaKey||Y.isWindows&&$.getModifierState("AltGraph");return $.type==="keypress"?ae:ae&&(!$.keyCode||$.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function($){return $.keyCode===16||$.keyCode===17||$.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let $;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)$=Y.charCode;else if(Y.which===null||Y.which===void 0)$=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;$=Y.which}return!(!$||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||($=String.fromCharCode($),this._onKey.fire({key:$,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent($,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Y){if(Y.data&&Y.inputType==="insertText"&&(!Y.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const $=Y.data;return this.coreService.triggerDataEvent($,!0),this.cancel(Y),!0}return!1}resize(Y,$){Y!==this.cols||$!==this.rows?super.resize(Y,$):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,$){var ae,ne;(ae=this._charSizeService)==null||ae.measure(),(ne=this.viewport)==null||ne.syncScrollArea(!0)}clear(){var Y;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let $=1;$<this.rows;$++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Y=this.viewport)==null||Y.reset(),this.refresh(0,this.rows-1)}}reset(){var $,ae;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),($=this._selectionService)==null||$.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=Y,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Y;(Y=this._renderService)==null||Y.clearTextureAtlas()}_reportFocus(){var Y;(Y=this.element)!=null&&Y.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const $=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${ae};${$}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ne=this._renderService.dimensions.css.cell.width.toFixed(0),ve=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${ve};${ne}t`)}}cancel(Y,$){if(this.options.cancelEvents||$)return Y.preventDefault(),Y.stopPropagation(),!1}}c.Terminal=Q},9924:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(d,p=1e3){this._renderCallback=d,this._debounceThresholdMS=p,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,p,g){this._rowCount=g,d=d!==void 0?d:0,p=p!==void 0?p:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,p):p;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=m-this._lastRefreshMs,_=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),p=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,p)}}},1680:function(f,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=d(3656),x=d(4725),_=d(8460),E=d(844),C=d(2585);let b=c.Viewport=class extends E.Disposable{constructor(v,y,S,j,A,N,D,T){super(),this._viewportElement=v,this._scrollArea=y,this._bufferService=S,this._optionsService=j,this._charSizeService=A,this._renderService=N,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(v){this._viewportElement.style.backgroundColor=v.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(v){if(v)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const y=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==y&&(this._lastRecordedBufferHeight=y,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const v=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==v&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=v),this._refreshAnimationFrame=null}syncScrollArea(v=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(v);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(v)}_handleScroll(v){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const y=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const v=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(v*(this._smoothScrollState.target-this._smoothScrollState.origin)),v<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(v,y){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(y<0&&this._viewportElement.scrollTop!==0||y>0&&S<this._lastRecordedBufferHeight)||(v.cancelable&&v.preventDefault(),!1)}handleWheel(v){const y=this._getPixelsScrolled(v);return y!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+y:this._smoothScrollState.target+=y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=y,this._bubbleScroll(v,y))}scrollLines(v){if(v!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const y=v*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!1})}_getPixelsScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let y=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_LINE?y*=this._currentRowHeight:v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._currentRowHeight*this._bufferService.rows),y}getBufferElements(v,y){var T;let S,j="";const A=[],N=y??this._bufferService.buffer.lines.length,D=this._bufferService.buffer.lines;for(let I=v;I<N;I++){const z=D.get(I);if(!z)continue;const q=(T=D.get(I+1))==null?void 0:T.isWrapped;if(j+=z.translateToString(!q),!q||I===D.length-1){const K=document.createElement("div");K.textContent=j,A.push(K),j.length>0&&(S=K),j=""}}return{bufferElements:A,cursorElement:S}}getLinesScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let y=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(y/=this._currentRowHeight+0,this._wheelPartialScroll+=y,y=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._bufferService.rows),y}_applyScrollModifier(v,y){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&y.altKey||S==="ctrl"&&y.ctrlKey||S==="shift"&&y.shiftKey?v*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:v*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(v){this._lastTouchY=v.touches[0].pageY}handleTouchMove(v){const y=this._lastTouchY-v.touches[0].pageY;return this._lastTouchY=v.touches[0].pageY,y!==0&&(this._viewportElement.scrollTop+=y,this._bubbleScroll(v,y))}};c.Viewport=b=p([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,x.ICharSizeService),g(5,x.IRenderService),g(6,x.ICoreBrowserService),g(7,x.IThemeService)],b)},3107:function(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=d(4725),x=d(844),_=d(2585);let E=c.BufferDecorationRenderer=class extends x.Disposable{constructor(C,b,v,y,S){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=v,this._decorationService=y,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((j=>this._removeDecoration(j)))),this.register((0,x.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 y;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((y=C==null?void 0:C.options)==null?void 0:y.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const v=C.options.x??0;return v&&v>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let v=this._decorationElements.get(C);v||(v=this._createElement(C),C.element=v,this._decorationElements.set(C,v),this._container.appendChild(v),C.onDispose((()=>{this._decorationElements.delete(C),v.remove()}))),v.style.top=b*this._renderService.dimensions.css.cell.height+"px",v.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(v)}}_refreshXPosition(C,b=C.element){if(!b)return;const v=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=v?v*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=v?v*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};c.BufferDecorationRenderer=E=p([g(1,_.IBufferService),g(2,m.ICoreBrowserService),g(3,_.IDecorationService),g(4,m.IRenderService)],E)},5871:(f,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 p of this._zones)if(p.color===d.options.overviewRulerOptions.color&&p.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(p,d.marker.line))return;if(this._lineAdjacentToZone(p,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(p,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,p){return p>=d.startBufferLine&&p<=d.endBufferLine}_lineAdjacentToZone(d,p,g){return p>=d.startBufferLine-this._linePadding[g||"full"]&&p<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,p){d.startBufferLine=Math.min(d.startBufferLine,p),d.endBufferLine=Math.max(d.endBufferLine,p)}}},5744:function(f,c,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,j,A,N);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(I=(T<3?D(I):T>3?D(j,A,I):D(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=d(5871),x=d(4725),_=d(844),E=d(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0};let y=c.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,j,A,N,D,T,I){var q;super(),this._viewportElement=S,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=D,this._optionsService=T,this._coreBrowserService=I,this._colorZoneStore=new m.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(q=this._viewportElement.parentElement)==null||q.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var K;(K=this._canvas)==null||K.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=S,b.center=j,b.right=S,this._refreshDrawHeightConstants(),v.full=0,v.left=0,v.center=b.left,v.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const j of S)j.position!=="full"&&this._renderColorZone(j);for(const j of S)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(v[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-C[S.position||"full"]/2),b[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[S.position||"full"]))}_queueRefresh(S,j){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=y=p([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,x.IRenderService),g(5,E.IOptionsService),g(6,x.ICoreBrowserService)],y)},2950:function(f,c,d){var p=this&&this.__decorate||function(C,b,v,y){var S,j=arguments.length,A=j<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,v,y);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(b,v,A):S(b,v))||A);return j>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(C,b){return function(v,y){b(v,y,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=d(4725),x=d(2585),_=d(2584);let E=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,v,y,S,j){this._textarea=C,this._compositionView=b,this._bufferService=v,this._optionsService=y,this._coreService=S,this._renderService=j,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let v;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,v=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),v.length>0&&this._coreService.triggerDataEvent(v,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,v=b.replace(C,"");this._dataAlreadySent=v,b.length>C.length?this._coreService.triggerDataEvent(v,!0):b.length<C.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):b.length===C.length&&b!==C&&this._coreService.triggerDataEvent(b,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),v=this._renderService.dimensions.css.cell.height,y=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=y+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=S+"px",this._textarea.style.top=y+"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=E=p([g(2,x.IBufferService),g(3,x.IOptionsService),g(4,x.ICoreService),g(5,m.IRenderService)],E)},9806:(f,c)=>{function d(p,g,m){const x=m.getBoundingClientRect(),_=p.getComputedStyle(m),E=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-x.left-E,g.clientY-x.top-C]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=d,c.getCoords=function(p,g,m,x,_,E,C,b,v){if(!E)return;const y=d(p,g,m);return y?(y[0]=Math.ceil((y[0]+(v?C/2:0))/C),y[1]=Math.ceil(y[1]/b),y[0]=Math.min(Math.max(y[0],1),x+(v?1:0)),y[1]=Math.min(Math.max(y[1],1),_),y):void 0}},9504:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const p=d(2584);function g(b,v,y,S){const j=b-m(b,y),A=v-m(v,y),N=Math.abs(j-A)-(function(D,T,I){let z=0;const q=D-m(D,I),K=T-m(T,I);for(let W=0;W<Math.abs(q-K);W++){const R=x(D,T)==="A"?-1:1,U=I.buffer.lines.get(q+R*W);U!=null&&U.isWrapped&&z++}return z})(b,v,y);return C(N,E(x(b,v),S))}function m(b,v){let y=0,S=v.buffer.lines.get(b),j=S==null?void 0:S.isWrapped;for(;j&&b>=0&&b<v.rows;)y++,S=v.buffer.lines.get(--b),j=S==null?void 0:S.isWrapped;return y}function x(b,v){return b>v?"A":"B"}function _(b,v,y,S,j,A){let N=b,D=v,T="";for(;N!==y||D!==S;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(D,!1,b,N),N=0,b=0,D++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(D,!1,0,b+1),N=A.cols-1,b=N,D--);return T+A.buffer.translateBufferLineToString(D,!1,b,N)}function E(b,v){const y=v?"O":"[";return p.C0.ESC+y+b}function C(b,v){b=Math.floor(b);let y="";for(let S=0;S<b;S++)y+=v;return y}c.moveToCellSequence=function(b,v,y,S){const j=y.buffer.x,A=y.buffer.y;if(!y.buffer.hasScrollback)return(function(T,I,z,q,K,W){return g(I,q,K,W).length===0?"":C(_(T,I,T,I-m(I,K),!1,K).length,E("D",W))})(j,A,0,v,y,S)+g(A,v,y,S)+(function(T,I,z,q,K,W){let R;R=g(I,q,K,W).length>0?q-m(q,K):I;const U=q,H=(function(X,Z,B,L,M,V){let F;return F=g(B,L,M,V).length>0?L-m(L,M):Z,X<B&&F<=L||X>=B&&F<L?"C":"D"})(T,I,z,q,K,W);return C(_(T,R,z,U,H==="C",K).length,E(H,W))})(j,A,b,v,y,S);let N;if(A===v)return N=j>b?"D":"C",C(Math.abs(j-b),E(N,S));N=A>v?"D":"C";const D=Math.abs(A-v);return C((function(T,I){return I.cols-T})(A>v?b:j,y)+(D-1)*y.cols+1+((A>v?j:b)-1),E(N,S))}},1296:function(f,c,d){var p=this&&this.__decorate||function(W,R,U,H){var X,Z=arguments.length,B=Z<3?R:H===null?H=Object.getOwnPropertyDescriptor(R,U):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(W,R,U,H);else for(var L=W.length-1;L>=0;L--)(X=W[L])&&(B=(Z<3?X(B):Z>3?X(R,U,B):X(R,U))||B);return Z>3&&B&&Object.defineProperty(R,U,B),B},g=this&&this.__param||function(W,R){return function(U,H){R(U,H,W)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=d(3787),x=d(2550),_=d(2223),E=d(6171),C=d(6052),b=d(4725),v=d(8055),y=d(8460),S=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",D="xterm-fg-",T="xterm-bg-",I="xterm-focus",z="xterm-selection";let q=1,K=c.DomRenderer=class extends S.Disposable{constructor(W,R,U,H,X,Z,B,L,M,V,F,re,Q){super(),this._terminal=W,this._document=R,this._element=U,this._screenElement=H,this._viewportElement=X,this._helperContainer=Z,this._linkifier2=B,this._charSizeService=M,this._optionsService=V,this._bufferService=F,this._coreBrowserService=re,this._themeService=Q,this._terminalClass=q++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new y.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(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ee=>this._injectCss(ee)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ee=>this._handleLinkHover(ee)))),this.register(this._linkifier2.onHideLinkUnderline((ee=>this._handleLinkLeave(ee)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.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 U of this._rowElements)U.style.width=`${this.dimensions.css.canvas.width}px`,U.style.height=`${this.dimensions.css.cell.height}px`,U.style.lineHeight=`${this.dimensions.css.cell.height}px`,U.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const R=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=R,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 R=`${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}`;R+=`${this._terminalSelector} .${N} .xterm-dim { color: ${v.color.multiplyOpacity(W.foreground,.5).css};}`,R+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const U=`blink_underline_${this._terminalClass}`,H=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;R+=`@keyframes ${U} { 50% { border-bottom-style: hidden; }}`,R+=`@keyframes ${H} { 50% { box-shadow: none; }}`,R+=`@keyframes ${X} { 0% { background-color: ${W.cursor.css}; color: ${W.cursorAccent.css}; } 50% { background-color: inherit; color: ${W.cursor.css}; }}`,R+=`${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${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);}`,R+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${W.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${W.selectionInactiveBackgroundOpaque.css};}`;for(const[Z,B]of W.ansi.entries())R+=`${this._terminalSelector} .${D}${Z} { color: ${B.css}; }${this._terminalSelector} .${D}${Z}.xterm-dim { color: ${v.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${T}${Z} { background-color: ${B.css}; }`;R+=`${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR} { color: ${v.color.opaque(W.background).css}; }${this._terminalSelector} .${D}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${v.color.multiplyOpacity(v.color.opaque(W.background),.5).css}; }${this._terminalSelector} .${T}${_.INVERTED_DEFAULT_COLOR} { background-color: ${W.foreground.css}; }`,this._themeStyleElement.textContent=R}_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,R){for(let U=this._rowElements.length;U<=R;U++){const H=this._document.createElement("div");this._rowContainer.appendChild(H),this._rowElements.push(H)}for(;this._rowElements.length>R;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(W,R){this._refreshRowElements(W,R),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(W,R,U){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(W,R,U),this.renderRows(0,this._bufferService.rows-1),!W||!R)return;this._selectionRenderModel.update(this._terminal,W,R,U);const H=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||B<0)return;const L=this._document.createDocumentFragment();if(U){const M=W[0]>R[0];L.appendChild(this._createSelectionElement(Z,M?R[0]:W[0],M?W[0]:R[0],B-Z+1))}else{const M=H===Z?W[0]:0,V=Z===X?R[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(Z,M,V));const F=B-Z-1;if(L.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,F)),Z!==B){const re=X===B?R[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(B,0,re))}}this._selectionContainer.appendChild(L)}_createSelectionElement(W,R,U,H=1){const X=this._document.createElement("div"),Z=R*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*(U-R);return Z+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-Z),X.style.height=H*this.dimensions.css.cell.height+"px",X.style.top=W*this.dimensions.css.cell.height+"px",X.style.left=`${Z}px`,X.style.width=`${B}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const W of this._rowElements)W.replaceChildren()}renderRows(W,R){const U=this._bufferService.buffer,H=U.ybase+U.y,X=Math.min(U.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=W;M<=R;M++){const V=M+U.ydisp,F=this._rowElements[M],re=U.lines.get(V);if(!F||!re)break;F.replaceChildren(...this._rowFactory.createRow(re,V,V===H,B,L,X,Z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${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,R,U,H,X,Z){U<0&&(W=0),H<0&&(R=0);const B=this._bufferService.rows-1;U=Math.max(Math.min(U,B),0),H=Math.max(Math.min(H,B),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,M=L.ybase+L.y,V=Math.min(L.x,X-1),F=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=U;ee<=H;++ee){const Y=ee+L.ydisp,$=this._rowElements[ee],ae=L.lines.get(Y);if(!$||!ae)break;$.replaceChildren(...this._rowFactory.createRow(ae,Y,Y===M,re,Q,V,F,this.dimensions.css.cell.width,this._widthCache,Z?ee===U?W:0:-1,Z?(ee===H?R:X)-1:-1))}}};c.DomRenderer=K=p([g(7,j.IInstantiationService),g(8,b.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,b.ICoreBrowserService),g(12,b.IThemeService)],K)},3787:function(f,c,d){var p=this&&this.__decorate||function(N,D,T,I){var z,q=arguments.length,K=q<3?D:I===null?I=Object.getOwnPropertyDescriptor(D,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(N,D,T,I);else for(var W=N.length-1;W>=0;W--)(z=N[W])&&(K=(q<3?z(K):q>3?z(D,T,K):z(D,T))||K);return q>3&&K&&Object.defineProperty(D,T,K),K},g=this&&this.__param||function(N,D){return function(T,I){D(T,I,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=d(2223),x=d(643),_=d(511),E=d(2585),C=d(8055),b=d(4725),v=d(4269),y=d(6171),S=d(3734);let j=c.DomRendererRowFactory=class{constructor(N,D,T,I,z,q,K){this._document=N,this._characterJoinerService=D,this._optionsService=T,this._coreBrowserService=I,this._coreService=z,this._decorationService=q,this._themeService=K,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,D,T){this._selectionStart=N,this._selectionEnd=D,this._columnSelectMode=T}createRow(N,D,T,I,z,q,K,W,R,U,H){const X=[],Z=this._characterJoinerService.getJoinedCharacters(D),B=this._themeService.colors;let L,M=N.getNoBgTrimmedLength();T&&M<q+1&&(M=q+1);let V=0,F="",re=0,Q=0,ee=0,Y=!1,$=0,ae=!1,ne=0;const ve=[],ye=U!==-1&&H!==-1;for(let Ae=0;Ae<M;Ae++){N.loadCell(Ae,this._workCell);let Re=this._workCell.getWidth();if(Re===0)continue;let He=!1,Ue=Ae,Ee=this._workCell;if(Z.length>0&&Ae===Z[0][0]){He=!0;const Xe=Z.shift();Ee=new v.JoinedCellData(this._workCell,N.translateToString(!0,Xe[0],Xe[1]),Xe[1]-Xe[0]),Ue=Xe[1]-1,Re=Ee.getWidth()}const xe=this._isCellInSelection(Ae,D),Ne=T&&Ae===q,$e=ye&&Ae>=U&&Ae<=H;let At=!1;this._decorationService.forEachDecorationAtCell(Ae,D,void 0,(Xe=>{At=!0}));let me=Ee.getChars()||x.WHITESPACE_CELL_CHAR;if(me===" "&&(Ee.isUnderline()||Ee.isOverline())&&(me=" "),ne=Re*W-R.get(me,Ee.isBold(),Ee.isItalic()),L){if(V&&(xe&&ae||!xe&&!ae&&Ee.bg===re)&&(xe&&ae&&B.selectionForeground||Ee.fg===Q)&&Ee.extended.ext===ee&&$e===Y&&ne===$&&!Ne&&!He&&!At){Ee.isInvisible()?F+=x.WHITESPACE_CELL_CHAR:F+=me,V++;continue}V&&(L.textContent=F),L=this._document.createElement("span"),V=0,F=""}else L=this._document.createElement("span");if(re=Ee.bg,Q=Ee.fg,ee=Ee.extended.ext,Y=$e,$=ne,ae=xe,He&&q>=Ae&&q<=Ue&&(q=Ae),!this._coreService.isCursorHidden&&Ne&&this._coreService.isCursorInitialized){if(ve.push("xterm-cursor"),this._coreBrowserService.isFocused)K&&ve.push("xterm-cursor-blink"),ve.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":ve.push("xterm-cursor-outline");break;case"block":ve.push("xterm-cursor-block");break;case"bar":ve.push("xterm-cursor-bar");break;case"underline":ve.push("xterm-cursor-underline")}}if(Ee.isBold()&&ve.push("xterm-bold"),Ee.isItalic()&&ve.push("xterm-italic"),Ee.isDim()&&ve.push("xterm-dim"),F=Ee.isInvisible()?x.WHITESPACE_CELL_CHAR:Ee.getChars()||x.WHITESPACE_CELL_CHAR,Ee.isUnderline()&&(ve.push(`xterm-underline-${Ee.extended.underlineStyle}`),F===" "&&(F=" "),!Ee.isUnderlineColorDefault()))if(Ee.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ee.getUnderlineColor()).join(",")})`;else{let Xe=Ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ee.isBold()&&Xe<8&&(Xe+=8),L.style.textDecorationColor=B.ansi[Xe].css}Ee.isOverline()&&(ve.push("xterm-overline"),F===" "&&(F=" ")),Ee.isStrikethrough()&&ve.push("xterm-strikethrough"),$e&&(L.style.textDecoration="underline");let je=Ee.getFgColor(),Oe=Ee.getFgColorMode(),ct=Ee.getBgColor(),ue=Ee.getBgColorMode();const _e=!!Ee.isInverse();if(_e){const Xe=je;je=ct,ct=Xe;const Dt=Oe;Oe=ue,ue=Dt}let Te,Ie,Ge,kt=!1;switch(this._decorationService.forEachDecorationAtCell(Ae,D,void 0,(Xe=>{Xe.options.layer!=="top"&&kt||(Xe.backgroundColorRGB&&(ue=50331648,ct=Xe.backgroundColorRGB.rgba>>8&16777215,Te=Xe.backgroundColorRGB),Xe.foregroundColorRGB&&(Oe=50331648,je=Xe.foregroundColorRGB.rgba>>8&16777215,Ie=Xe.foregroundColorRGB),kt=Xe.options.layer==="top")})),!kt&&xe&&(Te=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,ct=Te.rgba>>8&16777215,ue=50331648,kt=!0,B.selectionForeground&&(Oe=50331648,je=B.selectionForeground.rgba>>8&16777215,Ie=B.selectionForeground)),kt&&ve.push("xterm-decoration-top"),ue){case 16777216:case 33554432:Ge=B.ansi[ct],ve.push(`xterm-bg-${ct}`);break;case 50331648:Ge=C.channels.toColor(ct>>16,ct>>8&255,255&ct),this._addStyle(L,`background-color:#${A((ct>>>0).toString(16),"0",6)}`);break;default:_e?(Ge=B.foreground,ve.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ge=B.background}switch(Te||Ee.isDim()&&(Te=C.color.multiplyOpacity(Ge,.5)),Oe){case 16777216:case 33554432:Ee.isBold()&&je<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(je+=8),this._applyMinimumContrast(L,Ge,B.ansi[je],Ee,Te,void 0)||ve.push(`xterm-fg-${je}`);break;case 50331648:const Xe=C.channels.toColor(je>>16&255,je>>8&255,255&je);this._applyMinimumContrast(L,Ge,Xe,Ee,Te,Ie)||this._addStyle(L,`color:#${A(je.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ge,B.foreground,Ee,Te,Ie)||_e&&ve.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ve.length&&(L.className=ve.join(" "),ve.length=0),Ne||He||At?L.textContent=F:V++,ne!==this.defaultSpacing&&(L.style.letterSpacing=`${ne}px`),X.push(L),Ae=Ue}return L&&V&&(L.textContent=F),X}_applyMinimumContrast(N,D,T,I,z,q){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,y.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const K=this._getContrastCache(I);let W;if(z||q||(W=K.getColor(D.rgba,T.rgba)),W===void 0){const R=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);W=C.color.ensureContrastRatio(z||D,q||T,R),K.setColor((z||D).rgba,(q||T).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 T=this._selectionStart,I=this._selectionEnd;return!(!T||!I)&&(this._columnSelectMode?T[0]<=I[0]?N>=T[0]&&D>=T[1]&&N<I[0]&&D<=I[1]:N<T[0]&&D>=T[1]&&N>=I[0]&&D<=I[1]:D>T[1]&&D<I[1]||T[1]===I[1]&&D===T[1]&&N>=T[0]&&N<I[0]||T[1]<I[1]&&D===I[1]&&N<I[0]||T[1]<I[1]&&D===T[1]&&N>=T[0])}};function A(N,D,T){for(;N.length<T;)N=D+N;return N}c.DomRendererRowFactory=j=p([g(1,b.ICharacterJoinerService),g(2,E.IOptionsService),g(3,b.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,b.IThemeService)],j)},2550:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(d,p){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=d.createElement("span");g.classList.add("xterm-char-measure-element");const m=d.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,m,x,_],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(x),this._container.appendChild(_),p.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,p,g,m){d===this._font&&p===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=p,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,p,g){let m=0;if(!p&&!g&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const E=this._measure(d,0);return E>0&&(this._flat[m]=E),E}let x=d;p&&(x+="B"),g&&(x+="I");let _=this._holey.get(x);if(_===void 0){let E=0;p&&(E|=1),g&&(E|=2),_=this._measure(d,E),_>0&&this._holey.set(x,_)}return _}_measure(d,p){const g=this._measureElements[p];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const p=d(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=p.isFirefox||p.isLegacyEdge?"bottom":"ideographic"},6171:(f,c)=>{function d(g){return 57508<=g&&g<=57558}function p(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(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=p,c.allowRescaling=function(g,m,x,_){return m===1&&x>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!p(g)&&!d(g)&&!(function(E){return 57344<=E&&E<=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,x=0){return(g-(2*Math.round(m)-x))%(2*Math.round(m))}},6052:(f,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,x,_=!1){if(this.selectionStart=m,this.selectionEnd=x,!m||!x||m[0]===x[0]&&m[1]===x[1])return void this.clear();const E=g.buffers.active.ydisp,C=m[1]-E,b=x[1]-E,v=Math.max(C,0),y=Math.min(b,g.rows-1);v>=g.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=v,this.viewportCappedEndRow=y,this.startCol=m[0],this.endCol=x[0])}isCellSelected(g,m,x){return!!this.hasSelection&&(x-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&x>=this.viewportCappedStartRow&&m<this.endCol&&x<=this.viewportCappedEndRow:m<this.startCol&&x>=this.viewportCappedStartRow&&m>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol)}}c.createSelectionRenderModel=function(){return new d}},456:(f,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,p=this.selectionEnd;return!(!d||!p)&&(d[1]>p[1]||d[1]===p[1]&&d[0]>p[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var I=y.length-1;I>=0;I--)(N=y[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=d(2585),x=d(8460),_=d(844);let E=c.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(y,S,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new v(this._optionsService))}catch{this._measureStrategy=this.register(new b(y,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const y=this._measureStrategy.measure();y.width===this.width&&y.height===this.height||(this.width=y.width,this.height=y.height,this._onCharSizeChange.fire())}};c.CharSizeService=E=p([g(2,m.IOptionsService)],E);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,j){S!==void 0&&S>0&&j!==void 0&&j>0&&(this._result.width=S,this._result.height=j)}}class b extends C{constructor(S,j,A){super(),this._document=S,this._parentElement=j,this._optionsService=A,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class v extends C{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(f,c,d){var p=this&&this.__decorate||function(v,y,S,j){var A,N=arguments.length,D=N<3?y:j===null?j=Object.getOwnPropertyDescriptor(y,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(v,y,S,j);else for(var T=v.length-1;T>=0;T--)(A=v[T])&&(D=(N<3?A(D):N>3?A(y,S,D):A(y,S))||D);return N>3&&D&&Object.defineProperty(y,S,D),D},g=this&&this.__param||function(v,y){return function(S,j){y(S,j,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=d(3734),x=d(643),_=d(511),E=d(2585);class C extends m.AttributeData{constructor(y,S,j){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=S,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=C;let b=c.CharacterJoinerService=class Tb{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(y){const S={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(S),S.id}deregister(y){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===y)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(y){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(y);if(!S||S.length===0)return[];const j=[],A=S.translateToString(!0);let N=0,D=0,T=0,I=S.getFg(0),z=S.getBg(0);for(let q=0;q<S.getTrimmedLength();q++)if(S.loadCell(q,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==z){if(q-N>1){const K=this._getJoinedRanges(A,T,D,S,N);for(let W=0;W<K.length;W++)j.push(K[W])}N=q,T=D,I=this._workCell.fg,z=this._workCell.bg}D+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const q=this._getJoinedRanges(A,T,D,S,N);for(let K=0;K<q.length;K++)j.push(q[K])}return j}_getJoinedRanges(y,S,j,A,N){const D=y.substring(S,j);let T=[];try{T=this._characterJoiners[0].handler(D)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const z=this._characterJoiners[I].handler(D);for(let q=0;q<z.length;q++)Tb._mergeRanges(T,z[q])}catch(z){console.error(z)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(y,S,j){let A=0,N=!1,D=0,T=y[A];if(T){for(let I=j;I<this._bufferService.cols;I++){const z=S.getWidth(I),q=S.getString(I).length||x.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!N&&T[0]<=D&&(T[0]=I,N=!0),T[1]<=D){if(T[1]=I,T=y[++A],!T)break;T[0]<=D?(T[0]=I,N=!0):N=!1}D+=q}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(y,S){let j=!1;for(let A=0;A<y.length;A++){const N=y[A];if(j){if(S[1]<=N[0])return y[A-1][1]=S[1],y;if(S[1]<=N[1])return y[A-1][1]=Math.max(S[1],N[1]),y.splice(A,1),y;y.splice(A,1),A--}else{if(S[1]<=N[0])return y.splice(A,0,S),y;if(S[1]<=N[1])return N[0]=Math.min(S[0],N[0]),y;S[0]<N[1]&&(N[0]=Math.min(S[0],N[0]),j=!0)}}return j?y[y.length-1][1]=S[1]:y.push(S),y}};c.CharacterJoinerService=b=p([g(0,E.IBufferService)],b)},5114:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const p=d(844),g=d(8460),m=d(3656);class x extends p.Disposable{constructor(C,b,v){super(),this._textarea=C,this._window=b,this.mainDocument=v,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),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=x;class _ extends p.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new p.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,p.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const p=d(844);class g extends p.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,p.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const _=this.linkProviders.indexOf(x);_!==-1&&this.linkProviders.splice(_,1)}}}}c.LinkProviderService=g},8934:function(f,c,d){var p=this&&this.__decorate||function(E,C,b,v){var y,S=arguments.length,j=S<3?C:v===null?v=Object.getOwnPropertyDescriptor(C,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,b,v);else for(var A=E.length-1;A>=0;A--)(y=E[A])&&(j=(S<3?y(j):S>3?y(C,b,j):y(C,b))||j);return S>3&&j&&Object.defineProperty(C,b,j),j},g=this&&this.__param||function(E,C){return function(b,v){C(b,v,E)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=d(4725),x=d(9806);let _=c.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,b,v,y){return(0,x.getCoords)(window,E,C,b,v,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(E,C){const b=(0,x.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};c.MouseService=_=p([g(0,m.IRenderService),g(1,m.ICharSizeService)],_)},3230:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var I=y.length-1;I>=0;I--)(N=y[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=d(6193),x=d(4725),_=d(8460),E=d(844),C=d(7226),b=d(2585);let v=c.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(y,S,j,A,N,D,T,I){super(),this._rowCount=y,this._charSizeService=A,this._renderer=this.register(new E.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new E.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((z,q)=>this._renderRows(z,q)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,S),this.register(T.onWindowChange((z=>this._registerIntersectionObserver(z,S))))}_registerIntersectionObserver(y,S){if("IntersectionObserver"in y){const j=new y.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(S),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(y){this._isPaused=y.isIntersecting===void 0?y.intersectionRatio===0:!y.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(y,S,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(y,S,this._rowCount))}_renderRows(y,S){this._renderer.value&&(y=Math.min(y,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(y,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:y,end:S}),this._onRender.fire({start:y,end:S}),this._isNextRenderRedrawOnly=!0)}resize(y,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(y){this._renderer.value=y,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(y){return this._renderDebouncer.addRefreshCallback(y)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var y,S;this._renderer.value&&((S=(y=this._renderer.value).clearTextureAtlas)==null||S.call(y),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(y,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(y,S)})):this._renderer.value.handleResize(y,S),this._fullRefresh())}handleCharSizeChanged(){var y;(y=this._renderer.value)==null||y.handleCharSizeChanged()}handleBlur(){var y;(y=this._renderer.value)==null||y.handleBlur()}handleFocus(){var y;(y=this._renderer.value)==null||y.handleFocus()}handleSelectionChanged(y,S,j){var A;this._selectionState.start=y,this._selectionState.end=S,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(y,S,j)}handleCursorMove(){var y;(y=this._renderer.value)==null||y.handleCursorMove()}clear(){var y;(y=this._renderer.value)==null||y.clear()}};c.RenderService=v=p([g(2,b.IOptionsService),g(3,x.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,x.ICoreBrowserService),g(7,x.IThemeService)],v)},9312:function(f,c,d){var p=this&&this.__decorate||function(T,I,z,q){var K,W=arguments.length,R=W<3?I:q===null?q=Object.getOwnPropertyDescriptor(I,z):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(T,I,z,q);else for(var U=T.length-1;U>=0;U--)(K=T[U])&&(R=(W<3?K(R):W>3?K(I,z,R):K(I,z))||R);return W>3&&R&&Object.defineProperty(I,z,R),R},g=this&&this.__param||function(T,I){return function(z,q){I(z,q,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=d(9806),x=d(9504),_=d(456),E=d(4725),C=d(8460),b=d(844),v=d(6114),y=d(4841),S=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let D=c.SelectionService=class extends b.Disposable{constructor(T,I,z,q,K,W,R,U,H){super(),this._element=T,this._screenElement=I,this._linkifier=z,this._bufferService=q,this._coreService=K,this._mouseService=W,this._optionsService=R,this._renderService=U,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I||T[0]===I[0]&&T[1]===I[1])}get selectionText(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!T||!I)return"";const z=this._bufferService.buffer,q=[];if(this._activeSelectionMode===3){if(T[0]===I[0])return"";const K=T[0]<I[0]?T[0]:I[0],W=T[0]<I[0]?I[0]:T[0];for(let R=T[1];R<=I[1];R++){const U=z.translateBufferLineToString(R,!0,K,W);q.push(U)}}else{const K=T[1]===I[1]?I[0]:void 0;q.push(z.translateBufferLineToString(T[1],!0,T[0],K));for(let W=T[1]+1;W<=I[1]-1;W++){const R=z.lines.get(W),U=z.translateBufferLineToString(W,!0);R!=null&&R.isWrapped?q[q.length-1]+=U:q.push(U)}if(T[1]!==I[1]){const W=z.lines.get(I[1]),R=z.translateBufferLineToString(I[1],!0,0,I[0]);W&&W.isWrapped?q[q.length-1]+=R:q.push(R)}}return q.map((K=>K.replace(N," "))).join(v.isWindows?`\r
62
- `:`
63
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),v.isLinux&&T&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(T){const I=this._getMouseBufferCoords(T),z=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!!(z&&q&&I)&&this._areCoordsInSelection(I,z,q)}isCellInSelection(T,I){const z=this._model.finalSelectionStart,q=this._model.finalSelectionEnd;return!(!z||!q)&&this._areCoordsInSelection([T,I],z,q)}_areCoordsInSelection(T,I,z){return T[1]>I[1]&&T[1]<z[1]||I[1]===z[1]&&T[1]===I[1]&&T[0]>=I[0]&&T[0]<z[0]||I[1]<z[1]&&T[1]===z[1]&&T[0]<z[0]||I[1]<z[1]&&T[1]===I[1]&&T[0]>=I[0]}_selectWordAtCursor(T,I){var K,W;const z=(W=(K=this._linkifier.currentLink)==null?void 0:K.link)==null?void 0:W.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,y.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const q=this._getMouseBufferCoords(T);return!!q&&(this._selectWordAt(q,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,I){this._model.clearSelection(),T=Math.max(T,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const I=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(T){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=z?0:(I>z&&(I-=z),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(T){return v.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const I=this._getMouseBufferCoords(T);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(T){return T.altKey&&!(v.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(T),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const q=z.lines.get(this._model.selectionEnd[1]);q&&q.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const I=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const q=(0,x.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(q,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,z=!(!T||!I||T[0]===I[0]&&T[1]===I[1]);z?T&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,I,z)):this._oldHasSelection&&this._fireOnSelectionChange(T,I,z)}_fireOnSelectionChange(T,I,z){this._oldSelectionStart=T,this._oldSelectionEnd=I,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(T,I){let z=I;for(let q=0;I>=q;q++){const K=T.loadCell(q,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:K>1&&I!==q&&(z+=K-1)}return z}setSelection(T,I,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,I],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,I,z=!0,q=!0){if(T[0]>=this._bufferService.cols)return;const K=this._bufferService.buffer,W=K.lines.get(T[1]);if(!W)return;const R=K.translateBufferLineToString(T[1],!1);let U=this._convertViewportColToCharacterIndex(W,T[0]),H=U;const X=T[0]-U;let Z=0,B=0,L=0,M=0;if(R.charAt(U)===" "){for(;U>0&&R.charAt(U-1)===" ";)U--;for(;H<R.length&&R.charAt(H+1)===" ";)H++}else{let re=T[0],Q=T[0];W.getWidth(re)===0&&(Z++,re--),W.getWidth(Q)===2&&(B++,Q++);const ee=W.getString(Q).length;for(ee>1&&(M+=ee-1,H+=ee-1);re>0&&U>0&&!this._isCharWordSeparator(W.loadCell(re-1,this._workCell));){W.loadCell(re-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(Z++,re--):Y>1&&(L+=Y-1,U-=Y-1),U--,re--}for(;Q<W.length&&H+1<R.length&&!this._isCharWordSeparator(W.loadCell(Q+1,this._workCell));){W.loadCell(Q+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,Q++):Y>1&&(M+=Y-1,H+=Y-1),H++,Q++}}H++;let V=U+X-Z+L,F=Math.min(this._bufferService.cols,H-U+Z+B-L-M);if(I||R.slice(U,H).trim()!==""){if(z&&V===0&&W.getCodePoint(0)!==32){const re=K.lines.get(T[1]-1);if(re&&W.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(Q){const ee=this._bufferService.cols-Q.start;V-=ee,F+=ee}}}if(q&&V+F===this._bufferService.cols&&W.getCodePoint(this._bufferService.cols-1)!==32){const re=K.lines.get(T[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const Q=this._getWordAt([0,T[1]+1],!1,!1,!0);Q&&(F+=Q.length)}}return{start:V,length:F}}}_selectWordAt(T,I){const z=this._getWordAt(T,I);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[z.start,T[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(T){const I=this._getWordAt(T,!0);if(I){let z=T[1];for(;I.start<0;)I.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,z]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const I=this._bufferService.buffer.getWrappedRangeForLine(T),z={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,y.getRangeLength)(z,this._bufferService.cols)}};c.SelectionService=D=p([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],D)},4725:(f,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 p=d(8343);c.ICharSizeService=(0,p.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,p.createDecorator)("CoreBrowserService"),c.IMouseService=(0,p.createDecorator)("MouseService"),c.IRenderService=(0,p.createDecorator)("RenderService"),c.ISelectionService=(0,p.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,p.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,p.createDecorator)("ThemeService"),c.ILinkProviderService=(0,p.createDecorator)("LinkProviderService")},6731:function(f,c,d){var p=this&&this.__decorate||function(D,T,I,z){var q,K=arguments.length,W=K<3?T:z===null?z=Object.getOwnPropertyDescriptor(T,I):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(D,T,I,z);else for(var R=D.length-1;R>=0;R--)(q=D[R])&&(W=(K<3?q(W):K>3?q(T,I,W):q(T,I))||W);return K>3&&W&&Object.defineProperty(T,I,W),W},g=this&&this.__param||function(D,T){return function(I,z){T(I,z,D)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),x=d(8055),_=d(8460),E=d(844),C=d(2585),b=x.css.toColor("#ffffff"),v=x.css.toColor("#000000"),y=x.css.toColor("#ffffff"),S=x.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let I=0;I<216;I++){const z=T[I/36%6|0],q=T[I/6%6|0],K=T[I%6];D.push({css:x.channels.toCss(z,q,K),rgba:x.channels.toRgba(z,q,K)})}for(let I=0;I<24;I++){const z=8+10*I;D.push({css:x.channels.toCss(z,z,z),rgba:x.channels.toRgba(z,z,z)})}return D})());let A=c.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:v,cursor:y,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:x.color.blend(v,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:x.color.blend(v,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 T=this._colors;if(T.foreground=N(D.foreground,b),T.background=N(D.background,v),T.cursor=N(D.cursor,y),T.cursorAccent=N(D.cursorAccent,S),T.selectionBackgroundTransparent=N(D.selectionBackground,j),T.selectionBackgroundOpaque=x.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(D.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=x.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=D.selectionForeground?N(D.selectionForeground,x.NULL_COLOR):void 0,T.selectionForeground===x.NULL_COLOR&&(T.selectionForeground=void 0),x.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=x.color.opacity(T.selectionBackgroundTransparent,.3)),x.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=x.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=c.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(D.black,c.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(D.red,c.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(D.green,c.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(D.yellow,c.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(D.blue,c.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(D.magenta,c.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(D.cyan,c.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(D.white,c.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(D.brightBlack,c.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(D.brightRed,c.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(D.brightGreen,c.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(D.brightYellow,c.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(D.brightBlue,c.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(D.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(D.brightCyan,c.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(D.brightWhite,c.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const I=Math.min(T.ansi.length-16,D.extendedAnsi.length);for(let z=0;z<I;z++)T.ansi[z+16]=N(D.extendedAnsi[z],c.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(D){this._restoreColor(D),this._onChangeColors.fire(this.colors)}_restoreColor(D){if(D!==void 0)switch(D){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[D]=this._restoreColors.ansi[D]}else for(let T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}modifyColors(D){D(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function N(D,T){if(D!==void 0)try{return x.css.toColor(D)}catch{}return T}c.ThemeService=A=p([g(0,C.IOptionsService)],A)},6349:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new p.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new p.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new p.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const E=new Array(_);for(let C=0;C<Math.min(_,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let E=this._length;E<_;E++)this._array[E]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,E){this._array[this._getCyclicIndex(_)]=E}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,E,...C){if(E){for(let b=_;b<this._length-E;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+E)];this._length-=E,this.onDeleteEmitter.fire({index:_,amount:E})}for(let b=this._length-1;b>=_;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<C.length;b++)this._array[this._getCyclicIndex(_+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:_,amount:C.length}),this._length+C.length>this._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,E,C){if(!(E<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let v=E-1;v>=0;v--)this.set(_+v+C,this.get(_+v));const b=_+E+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<E;b++)this.set(_+b+C,this.get(_+b))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}c.CircularList=m},1439:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function d(p,g=5){if(typeof p!="object")return p;const m=Array.isArray(p)?[]:{};for(const x in p)m[x]=g<=1?p[x]:p[x]&&d(p[x],g-1);return m}},8055:(f,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,p=0,g=0,m=0;var x,_,E,C,b;function v(S){const j=S.toString(16);return j.length<2?"0"+j:j}function y(S,j){return S<j?(j+.05)/(S+.05):(S+.05)/(j+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(j,A,N,D){return D!==void 0?`#${v(j)}${v(A)}${v(N)}${v(D)}`:`#${v(j)}${v(A)}${v(N)}`},S.toRgba=function(j,A,N,D=255){return(j<<24|A<<16|N<<8|D)>>>0},S.toColor=function(j,A,N,D){return{css:S.toCss(j,A,N,D),rgba:S.toRgba(j,A,N,D)}}})(x||(c.channels=x={})),(function(S){function j(A,N){return m=Math.round(255*N),[d,p,g]=b.toChannels(A.rgba),{css:x.toCss(d,p,g,m),rgba:x.toRgba(d,p,g,m)}}S.blend=function(A,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const D=N.rgba>>24&255,T=N.rgba>>16&255,I=N.rgba>>8&255,z=A.rgba>>24&255,q=A.rgba>>16&255,K=A.rgba>>8&255;return d=z+Math.round((D-z)*m),p=q+Math.round((T-q)*m),g=K+Math.round((I-K)*m),{css:x.toCss(d,p,g),rgba:x.toRgba(d,p,g)}},S.isOpaque=function(A){return(255&A.rgba)==255},S.ensureContrastRatio=function(A,N,D){const T=b.ensureContrastRatio(A.rgba,N.rgba,D);if(T)return x.toColor(T>>24&255,T>>16&255,T>>8&255)},S.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,p,g]=b.toChannels(N),{css:x.toCss(d,p,g),rgba:N}},S.opacity=j,S.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},S.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(_||(c.color=_={})),(function(S){let j,A;try{const N=document.createElement("canvas");N.width=1,N.height=1;const D=N.getContext("2d",{willReadFrequently:!0});D&&(j=D,j.globalCompositeOperation="copy",A=j.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),x.toColor(d,p,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),p=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),m=parseInt(N.slice(4,5).repeat(2),16),x.toColor(d,p,g,m);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const D=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return d=parseInt(D[1]),p=parseInt(D[2]),g=parseInt(D[3]),m=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),x.toColor(d,p,g,m);if(!j||!A)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=A,j.fillStyle=N,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[d,p,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(d,p,g,m),css:N}}})(E||(c.css=E={})),(function(S){function j(A,N,D){const T=A/255,I=N/255,z=D/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},S.relativeLuminance2=j})(C||(c.rgb=C={})),(function(S){function j(N,D,T){const I=N>>24&255,z=N>>16&255,q=N>>8&255;let K=D>>24&255,W=D>>16&255,R=D>>8&255,U=y(C.relativeLuminance2(K,W,R),C.relativeLuminance2(I,z,q));for(;U<T&&(K>0||W>0||R>0);)K-=Math.max(0,Math.ceil(.1*K)),W-=Math.max(0,Math.ceil(.1*W)),R-=Math.max(0,Math.ceil(.1*R)),U=y(C.relativeLuminance2(K,W,R),C.relativeLuminance2(I,z,q));return(K<<24|W<<16|R<<8|255)>>>0}function A(N,D,T){const I=N>>24&255,z=N>>16&255,q=N>>8&255;let K=D>>24&255,W=D>>16&255,R=D>>8&255,U=y(C.relativeLuminance2(K,W,R),C.relativeLuminance2(I,z,q));for(;U<T&&(K<255||W<255||R<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),W=Math.min(255,W+Math.ceil(.1*(255-W))),R=Math.min(255,R+Math.ceil(.1*(255-R))),U=y(C.relativeLuminance2(K,W,R),C.relativeLuminance2(I,z,q));return(K<<24|W<<16|R<<8|255)>>>0}S.blend=function(N,D){if(m=(255&D)/255,m===1)return D;const T=D>>24&255,I=D>>16&255,z=D>>8&255,q=N>>24&255,K=N>>16&255,W=N>>8&255;return d=q+Math.round((T-q)*m),p=K+Math.round((I-K)*m),g=W+Math.round((z-W)*m),x.toRgba(d,p,g)},S.ensureContrastRatio=function(N,D,T){const I=C.relativeLuminance(N>>8),z=C.relativeLuminance(D>>8);if(y(I,z)<T){if(z<I){const W=j(N,D,T),R=y(I,C.relativeLuminance(W>>8));if(R<T){const U=A(N,D,T);return R>y(I,C.relativeLuminance(U>>8))?W:U}return W}const q=A(N,D,T),K=y(I,C.relativeLuminance(q>>8));if(K<T){const W=j(N,D,T);return K>y(I,C.relativeLuminance(W>>8))?q:W}return q}},S.reduceLuminance=j,S.increaseLuminance=A,S.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(c.rgba=b={})),c.toPaddedHex=v,c.contrastRatio=y},8969:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const p=d(844),g=d(2585),m=d(4348),x=d(7866),_=d(744),E=d(7302),C=d(6975),b=d(8460),v=d(1753),y=d(1480),S=d(7994),j=d(9282),A=d(5435),N=d(5981),D=d(2660);let T=!1;class I extends p.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((q=>{var K;(K=this._onScrollApi)==null||K.fire(q.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(q){for(const K in q)this.optionsService.options[K]=q[K]}constructor(q){super(),this._windowsWrappingHeuristics=this.register(new p.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new E.OptionsService(q)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.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(v.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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((K=>{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((K=>{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(((K,W)=>this._inputHandler.parse(K,W)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(q,K){this._writeBuffer.write(q,K)}writeSync(q,K){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(q,K)}input(q,K=!0){this.coreService.triggerDataEvent(q,K)}resize(q,K){isNaN(q)||isNaN(K)||(q=Math.max(q,_.MINIMUM_COLS),K=Math.max(K,_.MINIMUM_ROWS),this._bufferService.resize(q,K))}scroll(q,K=!1){this._bufferService.scroll(q,K)}scrollLines(q,K,W){this._bufferService.scrollLines(q,K,W)}scrollPages(q){this.scrollLines(q*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(q){const K=q-this._bufferService.buffer.ydisp;K!==0&&this.scrollLines(K)}registerEscHandler(q,K){return this._inputHandler.registerEscHandler(q,K)}registerDcsHandler(q,K){return this._inputHandler.registerDcsHandler(q,K)}registerCsiHandler(q,K){return this._inputHandler.registerCsiHandler(q,K)}registerOscHandler(q,K){return this._inputHandler.registerOscHandler(q,K)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let q=!1;const K=this.optionsService.rawOptions.windowsPty;K&&K.buildNumber!==void 0&&K.buildNumber!==void 0?q=K.backend==="conpty"&&K.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(q=!0),q?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const q=[];q.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),q.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,p.toDisposable)((()=>{for(const K of q)K.dispose()}))}}}c.CoreTerminal=I},8460:(f,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 p=0;p<this._listeners.length;p++)if(this._listeners[p]===d)return void this._listeners.splice(p,1)}}})),this._event}fire(d,p){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,d,p)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(d,p){return d((g=>p.fire(g)))},c.runAndSubscribe=function(d,p){return p(void 0),d((g=>p(g)))}},5435:function(f,c,d){var p=this&&this.__decorate||function(Z,B,L,M){var V,F=arguments.length,re=F<3?B:M===null?M=Object.getOwnPropertyDescriptor(B,L):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(Z,B,L,M);else for(var Q=Z.length-1;Q>=0;Q--)(V=Z[Q])&&(re=(F<3?V(re):F>3?V(B,L,re):V(B,L))||re);return F>3&&re&&Object.defineProperty(B,L,re),re},g=this&&this.__param||function(Z,B){return function(L,M){B(L,M,Z)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=d(2584),x=d(7116),_=d(2015),E=d(844),C=d(482),b=d(8437),v=d(8460),y=d(643),S=d(511),j=d(3734),A=d(2585),N=d(1480),D=d(6242),T=d(6351),I=d(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function K(Z,B){if(Z>24)return B.setWinLines||!1;switch(Z){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(Z){Z[Z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Z[Z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(W||(c.WindowsOptionsReportType=W={}));let R=0;class U extends E.Disposable{getAttrData(){return this._curAttrData}constructor(B,L,M,V,F,re,Q,ee,Y=new _.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=L,this._coreService=M,this._logService=V,this._optionsService=F,this._oscLinkService=re,this._coreMouseService=Q,this._unicodeService=ee,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new v.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new v.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new v.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new v.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new v.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new v.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new v.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new v.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new v.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(($=>this._activeBuffer=$.activeBuffer))),this._parser.setCsiHandlerFallback((($,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString($),params:ae.toArray()})})),this._parser.setEscHandlerFallback(($=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString($)})})),this._parser.setExecuteHandlerFallback(($=>{this._logService.debug("Unknown EXECUTE code: ",{code:$})})),this._parser.setOscHandlerFallback((($,ae,ne)=>{this._logService.debug("Unknown OSC code: ",{identifier:$,action:ae,data:ne})})),this._parser.setDcsHandlerFallback((($,ae,ne)=>{ae==="HOOK"&&(ne=ne.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString($),action:ae,payload:ne})})),this._parser.setPrintHandler((($,ae,ne)=>this.print($,ae,ne))),this._parser.registerCsiHandler({final:"@"},($=>this.insertChars($))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},($=>this.scrollLeft($))),this._parser.registerCsiHandler({final:"A"},($=>this.cursorUp($))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},($=>this.scrollRight($))),this._parser.registerCsiHandler({final:"B"},($=>this.cursorDown($))),this._parser.registerCsiHandler({final:"C"},($=>this.cursorForward($))),this._parser.registerCsiHandler({final:"D"},($=>this.cursorBackward($))),this._parser.registerCsiHandler({final:"E"},($=>this.cursorNextLine($))),this._parser.registerCsiHandler({final:"F"},($=>this.cursorPrecedingLine($))),this._parser.registerCsiHandler({final:"G"},($=>this.cursorCharAbsolute($))),this._parser.registerCsiHandler({final:"H"},($=>this.cursorPosition($))),this._parser.registerCsiHandler({final:"I"},($=>this.cursorForwardTab($))),this._parser.registerCsiHandler({final:"J"},($=>this.eraseInDisplay($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},($=>this.eraseInDisplay($,!0))),this._parser.registerCsiHandler({final:"K"},($=>this.eraseInLine($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},($=>this.eraseInLine($,!0))),this._parser.registerCsiHandler({final:"L"},($=>this.insertLines($))),this._parser.registerCsiHandler({final:"M"},($=>this.deleteLines($))),this._parser.registerCsiHandler({final:"P"},($=>this.deleteChars($))),this._parser.registerCsiHandler({final:"S"},($=>this.scrollUp($))),this._parser.registerCsiHandler({final:"T"},($=>this.scrollDown($))),this._parser.registerCsiHandler({final:"X"},($=>this.eraseChars($))),this._parser.registerCsiHandler({final:"Z"},($=>this.cursorBackwardTab($))),this._parser.registerCsiHandler({final:"`"},($=>this.charPosAbsolute($))),this._parser.registerCsiHandler({final:"a"},($=>this.hPositionRelative($))),this._parser.registerCsiHandler({final:"b"},($=>this.repeatPrecedingCharacter($))),this._parser.registerCsiHandler({final:"c"},($=>this.sendDeviceAttributesPrimary($))),this._parser.registerCsiHandler({prefix:">",final:"c"},($=>this.sendDeviceAttributesSecondary($))),this._parser.registerCsiHandler({final:"d"},($=>this.linePosAbsolute($))),this._parser.registerCsiHandler({final:"e"},($=>this.vPositionRelative($))),this._parser.registerCsiHandler({final:"f"},($=>this.hVPosition($))),this._parser.registerCsiHandler({final:"g"},($=>this.tabClear($))),this._parser.registerCsiHandler({final:"h"},($=>this.setMode($))),this._parser.registerCsiHandler({prefix:"?",final:"h"},($=>this.setModePrivate($))),this._parser.registerCsiHandler({final:"l"},($=>this.resetMode($))),this._parser.registerCsiHandler({prefix:"?",final:"l"},($=>this.resetModePrivate($))),this._parser.registerCsiHandler({final:"m"},($=>this.charAttributes($))),this._parser.registerCsiHandler({final:"n"},($=>this.deviceStatus($))),this._parser.registerCsiHandler({prefix:"?",final:"n"},($=>this.deviceStatusPrivate($))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},($=>this.softReset($))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},($=>this.setCursorStyle($))),this._parser.registerCsiHandler({final:"r"},($=>this.setScrollRegion($))),this._parser.registerCsiHandler({final:"s"},($=>this.saveCursor($))),this._parser.registerCsiHandler({final:"t"},($=>this.windowOptions($))),this._parser.registerCsiHandler({final:"u"},($=>this.restoreCursor($))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},($=>this.insertColumns($))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},($=>this.deleteColumns($))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},($=>this.selectProtected($))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},($=>this.requestMode($,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},($=>this.requestMode($,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler(($=>(this.setTitle($),this.setIconName($),!0)))),this._parser.registerOscHandler(1,new D.OscHandler(($=>this.setIconName($)))),this._parser.registerOscHandler(2,new D.OscHandler(($=>this.setTitle($)))),this._parser.registerOscHandler(4,new D.OscHandler(($=>this.setOrReportIndexedColor($)))),this._parser.registerOscHandler(8,new D.OscHandler(($=>this.setHyperlink($)))),this._parser.registerOscHandler(10,new D.OscHandler(($=>this.setOrReportFgColor($)))),this._parser.registerOscHandler(11,new D.OscHandler(($=>this.setOrReportBgColor($)))),this._parser.registerOscHandler(12,new D.OscHandler(($=>this.setOrReportCursorColor($)))),this._parser.registerOscHandler(104,new D.OscHandler(($=>this.restoreIndexedColor($)))),this._parser.registerOscHandler(110,new D.OscHandler(($=>this.restoreFgColor($)))),this._parser.registerOscHandler(111,new D.OscHandler(($=>this.restoreBgColor($)))),this._parser.registerOscHandler(112,new D.OscHandler(($=>this.restoreCursorColor($)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const $ in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:$},(()=>this.selectCharset("("+$))),this._parser.registerEscHandler({intermediates:")",final:$},(()=>this.selectCharset(")"+$))),this._parser.registerEscHandler({intermediates:"*",final:$},(()=>this.selectCharset("*"+$))),this._parser.registerEscHandler({intermediates:"+",final:$},(()=>this.selectCharset("+"+$))),this._parser.registerEscHandler({intermediates:"-",final:$},(()=>this.selectCharset("-"+$))),this._parser.registerEscHandler({intermediates:".",final:$},(()=>this.selectCharset("."+$))),this._parser.registerEscHandler({intermediates:"/",final:$},(()=>this.selectCharset("/"+$)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler(($=>(this._logService.error("Parsing error: ",$),$))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler((($,ae)=>this.requestStatusString($,ae))))}_preserveStack(B,L,M,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=M,this._parseStack.position=V}_logSlowResolvingAsync(B){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([B,new Promise(((L,M)=>setTimeout((()=>M("#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 M,V=this._activeBuffer.x,F=this._activeBuffer.y,re=0;const Q=this._parseStack.paused;if(Q){if(M=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(M),M;V=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>q&&(re=this._parseStack.position+q)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,($=>String.fromCharCode($))).join("")}"`),typeof B=="string"?B.split("").map(($=>$.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(B.length,q))),Q||this._dirtyRowTracker.clearRange(),B.length>q)for(let $=re;$<B.length;$+=q){const ae=$+q<B.length?$+q:B.length,ne=typeof B=="string"?this._stringDecoder.decode(B.substring($,ae),this._parseBuffer):this._utf8Decoder.decode(B.subarray($,ae),this._parseBuffer);if(M=this._parser.parse(this._parseBuffer,ne))return this._preserveStack(V,F,ne,$),this._logSlowResolvingAsync(M),M}else if(!Q){const $=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(M=this._parser.parse(this._parseBuffer,$))return this._preserveStack(V,F,$,0),this._logSlowResolvingAsync(M),M}this._activeBuffer.x===V&&this._activeBuffer.y===F||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(B,L,M){let V,F;const re=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,$=this._coreService.modes.insertMode,ae=this._curAttrData;let ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&M-L>0&&ne.getWidth(this._activeBuffer.x-1)===2&&ne.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ve=this._parser.precedingJoinState;for(let ye=L;ye<M;++ye){if(V=B[ye],V<127&&re){const Ue=re[String.fromCharCode(V)];Ue&&(V=Ue.charCodeAt(0))}const Ae=this._unicodeService.charProperties(V,ve);F=N.UnicodeService.extractWidth(Ae);const Re=N.UnicodeService.extractShouldJoin(Ae),He=Re?N.UnicodeService.extractWidth(ve):0;if(ve=Ae,Q&&this._onA11yChar.fire((0,C.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-He>ee){if(Y){const Ue=ne;let Ee=this._activeBuffer.x-He;for(this._activeBuffer.x=He,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),He>0&&ne instanceof b.BufferLine&&ne.copyCellsFrom(Ue,Ee,0,He,!1);Ee<ee;)Ue.setCellFromCodepoint(Ee++,0,1,ae)}else if(this._activeBuffer.x=ee-1,F===2)continue}if(Re&&this._activeBuffer.x){const Ue=ne.getWidth(this._activeBuffer.x-1)?1:2;ne.addCodepointToCell(this._activeBuffer.x-Ue,V,F);for(let Ee=F-He;--Ee>=0;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if($&&(ne.insertCells(this._activeBuffer.x,F-He,this._activeBuffer.getNullCell(ae)),ne.getWidth(ee-1)===2&&ne.setCellFromCodepoint(ee-1,y.NULL_CELL_CODE,y.NULL_CELL_WIDTH,ae)),ne.setCellFromCodepoint(this._activeBuffer.x++,V,F,ae),F>0)for(;--F;)ne.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ve,this._activeBuffer.x<ee&&M-L>0&&ne.getWidth(this._activeBuffer.x)===0&&!ne.hasContent(this._activeBuffer.x)&&ne.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,L){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,L):this._parser.registerCsiHandler(B,(M=>!K(M.params[0],this._optionsService.rawOptions.windowOptions)||L(M)))}registerDcsHandler(B,L){return this._parser.registerDcsHandler(B,new T.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,M,V=!1,F=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);re.replaceCells(L,M,this._activeBuffer.getNullCell(this._eraseAttrData()),F),V&&(re.isWrapped=!1)}_resetBufferLine(B,L=!1){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);M&&(M.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),M.isWrapped=!1)}eraseInDisplay(B,L=!1){let M;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);M<this._bufferService.rows;M++)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(M);break;case 1:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowTracker.markDirty(M-1);M--;)this._resetBufferLine(M,L);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,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 M=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(M,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 M=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;L--;)this._activeBuffer.lines.splice(M,1),this._activeBuffer.lines.splice(V,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(b.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 M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);V.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);V.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);V.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);V.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),V.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 M=B.params[0]||1,V=N.UnicodeService.extractWidth(L),F=this._activeBuffer.x-V,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),Q=new Uint32Array(re.length*M);let ee=0;for(let $=0;$<re.length;){const ae=re.codePointAt($)||0;Q[ee++]=ae,$+=ae>65535?2:1}let Y=ee;for(let $=1;$<M;++$)Q.copyWithin(Y,0,ee),Y+=ee;return this.print(Q,0,Y),!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,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.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 M=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:F}=this._coreMouseService,re=this._coreService,{buffers:Q,cols:ee}=this._bufferService,{active:Y,alt:$}=Q,ae=this._optionsService.rawOptions,ne=Re=>Re?1:2,ve=B.params[0];return ye=ve,Ae=L?ve===2?4:ve===4?ne(re.modes.insertMode):ve===12?3:ve===20?ne(ae.convertEol):0:ve===1?ne(M.applicationCursorKeys):ve===3?ae.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:ve===6?ne(M.origin):ve===7?ne(M.wraparound):ve===8?3:ve===9?ne(V==="X10"):ve===12?ne(ae.cursorBlink):ve===25?ne(!re.isCursorHidden):ve===45?ne(M.reverseWraparound):ve===66?ne(M.applicationKeypad):ve===67?4:ve===1e3?ne(V==="VT200"):ve===1002?ne(V==="DRAG"):ve===1003?ne(V==="ANY"):ve===1004?ne(M.sendFocus):ve===1005?4:ve===1006?ne(F==="SGR"):ve===1015?4:ve===1016?ne(F==="SGR_PIXELS"):ve===1048?1:ve===47||ve===1047||ve===1049?ne(Y===$):ve===2004?ne(M.bracketedPasteMode):0,re.triggerDataEvent(`${m.C0.ESC}[${L?"":"?"}${ye};${Ae}$y`),!0;var ye,Ae}_updateAttrColor(B,L,M,V,F){return L===2?(B|=50331648,B&=-16777216,B|=j.AttributeData.fromColorRGB([M,V,F])):L===5&&(B&=-50331904,B|=33554432|255&M),B}_extractColor(B,L,M){const V=[0,0,-1,0,0,0];let F=0,re=0;do{if(V[re+F]=B.params[L+re],B.hasSubParams(L+re)){const Q=B.getSubParams(L+re);let ee=0;do V[1]===5&&(F=1),V[re+ee+1+F]=Q[ee];while(++ee<Q.length&&ee+re+1+F<V.length);break}if(V[1]===5&&re+F>=2||V[1]===2&&re+F>=5)break;V[1]&&(F=1)}while(++re+L<B.length&&re+F<V.length);for(let Q=2;Q<V.length;++Q)V[Q]===-1&&(V[Q]=0);switch(V[0]){case 38:M.fg=this._updateAttrColor(M.fg,V[1],V[3],V[4],V[5]);break;case 48:M.bg=this._updateAttrColor(M.bg,V[1],V[3],V[4],V[5]);break;case 58:M.extended=M.extended.clone(),M.extended.underlineColor=this._updateAttrColor(M.extended.underlineColor,V[1],V[3],V[4],V[5])}return re}_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=b.DEFAULT_ATTR_DATA.fg,B.bg=b.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 M;const V=this._curAttrData;for(let F=0;F<L;F++)M=B.params[F],M>=30&&M<=37?(V.fg&=-50331904,V.fg|=16777216|M-30):M>=40&&M<=47?(V.bg&=-50331904,V.bg|=16777216|M-40):M>=90&&M<=97?(V.fg&=-50331904,V.fg|=16777224|M-90):M>=100&&M<=107?(V.bg&=-50331904,V.bg|=16777224|M-100):M===0?this._processSGR0(V):M===1?V.fg|=134217728:M===3?V.bg|=67108864:M===4?(V.fg|=268435456,this._processUnderline(B.hasSubParams(F)?B.getSubParams(F)[0]:1,V)):M===5?V.fg|=536870912:M===7?V.fg|=67108864:M===8?V.fg|=1073741824:M===9?V.fg|=2147483648:M===2?V.bg|=134217728:M===21?this._processUnderline(2,V):M===22?(V.fg&=-134217729,V.bg&=-134217729):M===23?V.bg&=-67108865:M===24?(V.fg&=-268435457,this._processUnderline(0,V)):M===25?V.fg&=-536870913:M===27?V.fg&=-67108865:M===28?V.fg&=-1073741825:M===29?V.fg&=2147483647:M===39?(V.fg&=-67108864,V.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):M===49?(V.bg&=-67108864,V.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?F+=this._extractColor(B,F,V):M===53?V.bg|=1073741824:M===55?V.bg&=-1073741825:M===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):M===100?(V.fg&=-67108864,V.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M);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,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${L};${M}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const L=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${L};${M}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=b.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 M=L%2==1;return this._optionsService.options.cursorBlink=M,!0}setScrollRegion(B){const L=B.params[0]||1;let M;return(B.length<2||(M=B.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=M-1,this._setCursor(0,0)),!0}windowOptions(B){if(!K(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=[],M=B.split(";");for(;M.length>1;){const V=M.shift(),F=M.shift();if(/^\d+$/.exec(V)){const re=parseInt(V);if(X(re))if(F==="?")L.push({type:0,index:re});else{const Q=(0,I.parseColor)(F);Q&&L.push({type:1,index:re,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 M=B.split(":");let V;const F=M.findIndex((re=>re.startsWith("id=")));return F!==-1&&(V=M[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,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 M=B.split(";");for(let V=0;V<M.length&&!(L>=this._specialColors.length);++V,++L)if(M[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,I.parseColor)(M[V]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}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=[],M=B.split(";");for(let V=0;V<M.length;++V)if(/^\d+$/.exec(M[V])){const F=parseInt(M[V]);X(F)&&L.push({type:2,index:F})}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,x.DEFAULT_CHARSET),!0}selectCharset(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(z[B[0]],x.CHARSETS[B[1]]||x.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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.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 S.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 M=this._activeBuffer.ybase+this._activeBuffer.y+L,V=this._activeBuffer.lines.get(M);V&&(V.fill(B),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,L){const M=this._bufferService.buffer,V=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${F}${m.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${M.scrollTop+1};${M.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,L){this._dirtyRowTracker.markRangeDirty(B,L)}}c.InputHandler=U;let H=class{constructor(Z){this._bufferService=Z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Z){Z<this.start?this.start=Z:Z>this.end&&(this.end=Z)}markRangeDirty(Z,B){Z>B&&(R=Z,Z=B,B=R),Z<this.start&&(this.start=Z),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(Z){return 0<=Z&&Z<256}H=p([g(0,A.IBufferService)],H)},844:(f,c)=>{function d(p){for(const g of p)g.dispose();p.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 p of this._disposables)p.dispose();this._disposables.length=0}register(p){return this._disposables.push(p),p}unregister(p){const g=this._disposables.indexOf(p);g!==-1&&this._disposables.splice(g,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(p){var g;this._isDisposed||p===this._value||((g=this._value)==null||g.dispose(),this._value=p)}clear(){this.value=void 0}dispose(){var p;this._isDisposed=!0,(p=this._value)==null||p.dispose(),this._value=void 0}},c.toDisposable=function(p){return{dispose:p}},c.disposeArray=d,c.getDisposeArrayDisposable=function(p){return{dispose:()=>d(p)}}},1505:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,x){this._data[g]||(this._data[g]={}),this._data[g][m]=x}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(p,g,m,x,_){this._data.get(p,g)||this._data.set(p,g,new d),this._data.get(p,g).set(m,x,_)}get(p,g,m,x){var _;return(_=this._data.get(p,g))==null?void 0:_.get(m,x)}clear(){this._data.clear()}}},6114:(f,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,p=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(p),c.isIpad=p==="iPad",c.isIphone=p==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(p),c.isLinux=p.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(d)},6106:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let d=0;c.SortedList=class{constructor(p){this._getKey=p,this._array=[]}clear(){this._array.length=0}insert(p){this._array.length!==0?(d=this._search(this._getKey(p)),this._array.splice(d,0,p)):this._array.push(p)}delete(p){if(this._array.length===0)return!1;const g=this._getKey(p);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)return!1;do if(this._array[d]===p)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===g);return!1}*getKeyIterator(p){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===p)}forEachByKey(p,g){if(this._array.length!==0&&(d=this._search(p),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===p))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===p)}values(){return[...this._array].values()}_search(p){let g=0,m=this._array.length-1;for(;m>=g;){let x=g+m>>1;const _=this._getKey(this._array[x]);if(_>p)m=x-1;else{if(!(_<p)){for(;x>0&&this._getKey(this._array[x-1])===p;)x--;return x}g=x+1}}return g}}},7226:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const p=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let E=0,C=0,b=_.timeRemaining(),v=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),C=Math.max(E,C),v=_.timeRemaining(),1.5*C>v)return b-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-E))}ms`),void this._start();b=v}this.clear()}}class m extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const E=Date.now()+_;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!p.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const p=d(643);c.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),x=m==null?void 0:m.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&x&&(_.isWrapped=x[p.CHAR_DATA_CODE_INDEX]!==p.NULL_CELL_CODE&&x[p.CHAR_DATA_CODE_INDEX]!==p.WHITESPACE_CELL_CODE)}},3734:(f,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 p}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new d;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=d;class p{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,x=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=x}clone(){return new p(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=p},9092:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const p=d(6349),g=d(7226),m=d(3734),x=d(8437),_=d(4634),E=d(511),C=d(643),b=d(4863),v=d(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(y,S,j){this._hasScrollback=y,this._optionsService=S,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=v.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=E.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(y){return y?(this._nullCell.fg=y.fg,this._nullCell.bg=y.bg,this._nullCell.extended=y.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(y){return y?(this._whitespaceCell.fg=y.fg,this._whitespaceCell.bg=y.bg,this._whitespaceCell.extended=y.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,S){return new x.BufferLine(this._bufferService.cols,this.getNullCell(y),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const y=this.ybase+this.y-this.ydisp;return y>=0&&y<this._rows}_getCorrectBufferLength(y){if(!this._hasScrollback)return y;const S=y+this._optionsService.rawOptions.scrollback;return S>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:S}fillViewportRows(y){if(this.lines.length===0){y===void 0&&(y=x.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(y))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new p.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(y,S){const j=this.getNullCell(x.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(S);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<y)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(y,j);let D=0;if(this._rows<S)for(let T=this._rows;T<S;T++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(y,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 x.BufferLine(y,j)));else for(let T=this._rows;T>S;T--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const T=this.lines.length-N;T>0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,y-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,y-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(y,S),this._cols>y))for(let D=0;D<this.lines.length;D++)A+=+this.lines.get(D).resize(y,j);this._cols=y,this._rows=S,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let y=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,y=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return y}get _isReflowEnabled(){const y=this._optionsService.rawOptions.windowsPty;return y&&y.buildNumber?this._hasScrollback&&y.backend==="conpty"&&y.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(y,S){this._cols!==y&&(y>this._cols?this._reflowLarger(y,S):this._reflowSmaller(y,S))}_reflowLarger(y,S){const j=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,_.reflowLargerCreateNewLayout)(this.lines,j);(0,_.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(y,S,A.countRemoved)}}_reflowLargerAdjustViewport(y,S,j){const A=this.getNullCell(x.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new x.BufferLine(y,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(y,S){const j=this.getNullCell(x.DEFAULT_ATTR_DATA),A=[];let N=0;for(let D=this.lines.length-1;D>=0;D--){let T=this.lines.get(D);if(!T||!T.isWrapped&&T.getTrimmedLength()<=y)continue;const I=[T];for(;T.isWrapped&&D>0;)T=this.lines.get(--D),I.unshift(T);const z=this.ybase+this.y;if(z>=D&&z<D+I.length)continue;const q=I[I.length-1].getTrimmedLength(),K=(0,_.reflowSmallerGetNewLineLengths)(I,this._cols,y),W=K.length-I.length;let R;R=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 U=[];for(let M=0;M<W;M++){const V=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);U.push(V)}U.length>0&&(A.push({start:D+I.length+N,newLines:U}),N+=U.length),I.push(...U);let H=K.length-1,X=K[H];X===0&&(H--,X=K[H]);let Z=I.length-W-1,B=q;for(;Z>=0;){const M=Math.min(B,X);if(I[H]===void 0)break;if(I[H].copyCellsFrom(I[Z],B-M,X-M,M,!0),X-=M,X===0&&(H--,X=K[H]),B-=M,B===0){Z--;const V=Math.max(Z,0);B=(0,_.getWrappedLineTrimmedLength)(I,V,this._cols)}}for(let M=0;M<I.length;M++)K[M]<y&&I[M].setCell(K[M],j);let L=W-R;for(;L-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+W,this.ybase+S-1)}if(A.length>0){const D=[],T=[];for(let H=0;H<this.lines.length;H++)T.push(this.lines.get(H));const I=this.lines.length;let z=I-1,q=0,K=A[q];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let W=0;for(let H=Math.min(this.lines.maxLength-1,I+N-1);H>=0;H--)if(K&&K.start>z+W){for(let X=K.newLines.length-1;X>=0;X--)this.lines.set(H--,K.newLines[X]);H++,D.push({index:z+1,amount:K.newLines.length}),W+=K.newLines.length,K=A[++q]}else this.lines.set(H,T[z--]);let R=0;for(let H=D.length-1;H>=0;H--)D[H].index+=R,this.lines.onInsertEmitter.fire(D[H]),R+=D[H].amount;const U=Math.max(0,I+N-this.lines.maxLength);U>0&&this.lines.onTrimEmitter.fire(U)}}translateBufferLineToString(y,S,j=0,A){const N=this.lines.get(y);return N?N.translateToString(S,j,A):""}getWrappedRangeForLine(y){let S=y,j=y;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:S,last:j}}setupTabStops(y){for(y!=null?this.tabs[y]||(y=this.prevStop(y)):(this.tabs={},y=0);y<this._cols;y+=this._optionsService.rawOptions.tabStopWidth)this.tabs[y]=!0}prevStop(y){for(y==null&&(y=this.x);!this.tabs[--y]&&y>0;);return y>=this._cols?this._cols-1:y<0?0:y}nextStop(y){for(y==null&&(y=this.x);!this.tabs[++y]&&y<this._cols;);return y>=this._cols?this._cols-1:y<0?0:y}clearMarkers(y){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===y&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].dispose(),this.markers.splice(y--,1);this._isClearing=!1}addMarker(y){const S=new b.Marker(y);return this.markers.push(S),S.register(this.lines.onTrim((j=>{S.line-=j,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((j=>{S.line>=j.index&&(S.line+=j.amount)}))),S.register(this.lines.onDelete((j=>{S.line>=j.index&&S.line<j.index+j.amount&&S.dispose(),S.line>j.index&&(S.line-=j.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(y){this._isClearing||this.markers.splice(this.markers.indexOf(y),1)}}},8437:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const p=d(3734),g=d(511),m=d(643),x=d(482);c.DEFAULT_ATTR_DATA=Object.freeze(new p.AttributeData);let _=0;class E{constructor(b,v,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const S=v||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<b;++j)this.setCell(j,S);this.length=b}get(b){const v=this._data[3*b+0],y=2097151&v;return[this._data[3*b+1],2097152&v?this._combined[b]:y?(0,x.stringFromCodePoint)(y):"",v>>22,2097152&v?this._combined[b].charCodeAt(this._combined[b].length-1):y]}set(b,v){this._data[3*b+1]=v[m.CHAR_DATA_ATTR_INDEX],v[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=v[1],this._data[3*b+0]=2097152|b|v[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=v[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const v=this._data[3*b+0];return 2097152&v?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&v}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const v=this._data[3*b+0];return 2097152&v?this._combined[b]:2097151&v?(0,x.stringFromCodePoint)(2097151&v):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,v){return _=3*b,v.content=this._data[_+0],v.fg=this._data[_+1],v.bg=this._data[_+2],2097152&v.content&&(v.combinedData=this._combined[b]),268435456&v.bg&&(v.extended=this._extendedAttrs[b]),v}setCell(b,v){2097152&v.content&&(this._combined[b]=v.combinedData),268435456&v.bg&&(this._extendedAttrs[b]=v.extended),this._data[3*b+0]=v.content,this._data[3*b+1]=v.fg,this._data[3*b+2]=v.bg}setCellFromCodepoint(b,v,y,S){268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=v|y<<22,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}addCodepointToCell(b,v,y){let S=this._data[3*b+0];2097152&S?this._combined[b]+=(0,x.stringFromCodePoint)(v):2097151&S?(this._combined[b]=(0,x.stringFromCodePoint)(2097151&S)+(0,x.stringFromCodePoint)(v),S&=-2097152,S|=2097152):S=v|4194304,y&&(S&=-12582913,S|=y<<22),this._data[3*b+0]=S}insertCells(b,v,y){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length-b){const S=new g.CellData;for(let j=this.length-b-v-1;j>=0;--j)this.setCell(b+v+j,this.loadCell(b+j,S));for(let j=0;j<v;++j)this.setCell(b+j,y)}else for(let S=b;S<this.length;++S)this.setCell(S,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(b,v,y){if(b%=this.length,v<this.length-b){const S=new g.CellData;for(let j=0;j<this.length-b-v;++j)this.setCell(b+j,this.loadCell(b+v+j,S));for(let j=this.length-v;j<this.length;++j)this.setCell(j,y)}else for(let S=b;S<this.length;++S)this.setCell(S,y);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,y)}replaceCells(b,v,y,S=!1){if(S)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length&&this.getWidth(v-1)===2&&!this.isProtected(v)&&this.setCellFromCodepoint(v,0,1,y);b<v&&b<this.length;)this.isProtected(b)||this.setCell(b,y),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,y),v<this.length&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v,0,1,y);b<v&&b<this.length;)this.setCell(b++,y)}resize(b,v){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*y)this._data=new Uint32Array(this._data.buffer,0,y);else{const S=new Uint32Array(y);S.set(this._data),this._data=S}for(let S=this.length;S<b;++S)this.setCell(S,v)}else{this._data=this._data.subarray(0,y);const S=Object.keys(this._combined);for(let A=0;A<S.length;A++){const N=parseInt(S[A],10);N>=b&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let A=0;A<j.length;A++){const N=parseInt(j[A],10);N>=b&&delete this._extendedAttrs[N]}}return this.length=b,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,v=!1){if(v)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,b);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const v in b._combined)this._combined[v]=b._combined[v];this._extendedAttrs={};for(const v in b._extendedAttrs)this._extendedAttrs[v]=b._extendedAttrs[v];this.isWrapped=b.isWrapped}clone(){const b=new E(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const v in this._combined)b._combined[v]=this._combined[v];for(const v in this._extendedAttrs)b._extendedAttrs[v]=this._extendedAttrs[v];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,v,y,S,j){const A=b._data;if(j)for(let D=S-1;D>=0;D--){for(let T=0;T<3;T++)this._data[3*(y+D)+T]=A[3*(v+D)+T];268435456&A[3*(v+D)+2]&&(this._extendedAttrs[y+D]=b._extendedAttrs[v+D])}else for(let D=0;D<S;D++){for(let T=0;T<3;T++)this._data[3*(y+D)+T]=A[3*(v+D)+T];268435456&A[3*(v+D)+2]&&(this._extendedAttrs[y+D]=b._extendedAttrs[v+D])}const N=Object.keys(b._combined);for(let D=0;D<N.length;D++){const T=parseInt(N[D],10);T>=v&&(this._combined[T-v+y]=b._combined[T])}}translateToString(b,v,y,S){v=v??0,y=y??this.length,b&&(y=Math.min(y,this.getTrimmedLength())),S&&(S.length=0);let j="";for(;v<y;){const A=this._data[3*v+0],N=2097151&A,D=2097152&A?this._combined[v]:N?(0,x.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=D,S)for(let T=0;T<D.length;++T)S.push(v);v+=A>>22||1}return S&&S.push(v),j}}c.BufferLine=E},4841:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(d,p){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return p*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(f,c)=>{function d(p,g,m){if(g===p.length-1)return p[g].getTrimmedLength();const x=!p[g].hasContent(m-1)&&p[g].getWidth(m-1)===1,_=p[g+1].getWidth(0)===2;return x&&_?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(p,g,m,x,_){const E=[];for(let C=0;C<p.length-1;C++){let b=C,v=p.get(++b);if(!v.isWrapped)continue;const y=[p.get(C)];for(;b<p.length&&v.isWrapped;)y.push(v),v=p.get(++b);if(x>=C&&x<b){C+=y.length-1;continue}let S=0,j=d(y,S,g),A=1,N=0;for(;A<y.length;){const T=d(y,A,g),I=T-N,z=m-j,q=Math.min(I,z);y[S].copyCellsFrom(y[A],N,j,q,!1),j+=q,j===m&&(S++,j=0),N+=q,N===T&&(A++,N=0),j===0&&S!==0&&y[S-1].getWidth(m-1)===2&&(y[S].copyCellsFrom(y[S-1],m-1,j++,1,!1),y[S-1].setCell(m-1,_))}y[S].replaceCells(j,m,_);let D=0;for(let T=y.length-1;T>0&&(T>S||y[T].getTrimmedLength()===0);T--)D++;D>0&&(E.push(C+y.length-D),E.push(D)),C+=y.length-1}return E},c.reflowLargerCreateNewLayout=function(p,g){const m=[];let x=0,_=g[x],E=0;for(let C=0;C<p.length;C++)if(_===C){const b=g[++x];p.onDeleteEmitter.fire({index:C-E,amount:b}),C+=b-1,E+=b,_=g[++x]}else m.push(C);return{layout:m,countRemoved:E}},c.reflowLargerApplyNewLayout=function(p,g){const m=[];for(let x=0;x<g.length;x++)m.push(p.get(g[x]));for(let x=0;x<m.length;x++)p.set(x,m[x]);p.length=g.length},c.reflowSmallerGetNewLineLengths=function(p,g,m){const x=[],_=p.map(((v,y)=>d(p,y,g))).reduce(((v,y)=>v+y));let E=0,C=0,b=0;for(;b<_;){if(_-b<m){x.push(_-b);break}E+=m;const v=d(p,C,g);E>v&&(E-=v,C++);const y=p[C].getWidth(E-1)===2;y&&E--;const S=y?m-1:m;x.push(S),b+=S}return x},c.getWrappedLineTrimmedLength=d},5295:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const p=d(8460),g=d(844),m=d(9092);class x extends g.Disposable{constructor(E,C){super(),this._optionsService=E,this._bufferService=C,this._onBufferActivate=this.register(new p.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),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(E,C){this._normal.resize(E,C),this._alt.resize(E,C),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}c.BufferSet=x},511:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const p=d(482),g=d(643),m=d(3734);class x extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new x;return C.setFromCharData(E),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,p.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(E){this.fg=E[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(E[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(E[g.CHAR_DATA_CHAR_INDEX].length===2){const b=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const v=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(b-55296)+v-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=x},643:(f,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:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const p=d(8460),g=d(844);class m{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}c.Marker=m,m._nextId=1},7116:(f,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:(f,c)=>{var d,p,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="Ÿ"})(p||(c.C1=p={})),(function(m){m.ST=`${d.ESC}\\`})(g||(c.C1_ESCAPED=g={}))},7399:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const p=d(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};c.evaluateKeyboardEvent=function(m,x,_,E){const C={type:0,cancel:!1,key:void 0},b=(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=x?p.C0.ESC+"OA":p.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=x?p.C0.ESC+"OD":p.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=x?p.C0.ESC+"OC":p.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=x?p.C0.ESC+"OB":p.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":p.C0.DEL,m.altKey&&(C.key=p.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=p.C0.ESC+"[Z";break}C.key=p.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?p.C0.ESC+p.C0.CR:p.C0.CR,C.cancel=!0;break;case 27:C.key=p.C0.ESC,m.altKey&&(C.key=p.C0.ESC+p.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"D",C.key===p.C0.ESC+"[1;3D"&&(C.key=p.C0.ESC+(_?"b":"[1;5D"))):C.key=x?p.C0.ESC+"OD":p.C0.ESC+"[D";break;case 39:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"C",C.key===p.C0.ESC+"[1;3C"&&(C.key=p.C0.ESC+(_?"f":"[1;5C"))):C.key=x?p.C0.ESC+"OC":p.C0.ESC+"[C";break;case 38:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"A",_||C.key!==p.C0.ESC+"[1;3A"||(C.key=p.C0.ESC+"[1;5A")):C.key=x?p.C0.ESC+"OA":p.C0.ESC+"[A";break;case 40:if(m.metaKey)break;b?(C.key=p.C0.ESC+"[1;"+(b+1)+"B",_||C.key!==p.C0.ESC+"[1;3B"||(C.key=p.C0.ESC+"[1;5B")):C.key=x?p.C0.ESC+"OB":p.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=p.C0.ESC+"[2~");break;case 46:C.key=b?p.C0.ESC+"[3;"+(b+1)+"~":p.C0.ESC+"[3~";break;case 36:C.key=b?p.C0.ESC+"[1;"+(b+1)+"H":x?p.C0.ESC+"OH":p.C0.ESC+"[H";break;case 35:C.key=b?p.C0.ESC+"[1;"+(b+1)+"F":x?p.C0.ESC+"OF":p.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=p.C0.ESC+"[5;"+(b+1)+"~":C.key=p.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=p.C0.ESC+"[6;"+(b+1)+"~":C.key=p.C0.ESC+"[6~";break;case 112:C.key=b?p.C0.ESC+"[1;"+(b+1)+"P":p.C0.ESC+"OP";break;case 113:C.key=b?p.C0.ESC+"[1;"+(b+1)+"Q":p.C0.ESC+"OQ";break;case 114:C.key=b?p.C0.ESC+"[1;"+(b+1)+"R":p.C0.ESC+"OR";break;case 115:C.key=b?p.C0.ESC+"[1;"+(b+1)+"S":p.C0.ESC+"OS";break;case 116:C.key=b?p.C0.ESC+"[15;"+(b+1)+"~":p.C0.ESC+"[15~";break;case 117:C.key=b?p.C0.ESC+"[17;"+(b+1)+"~":p.C0.ESC+"[17~";break;case 118:C.key=b?p.C0.ESC+"[18;"+(b+1)+"~":p.C0.ESC+"[18~";break;case 119:C.key=b?p.C0.ESC+"[19;"+(b+1)+"~":p.C0.ESC+"[19~";break;case 120:C.key=b?p.C0.ESC+"[20;"+(b+1)+"~":p.C0.ESC+"[20~";break;case 121:C.key=b?p.C0.ESC+"[21;"+(b+1)+"~":p.C0.ESC+"[21~";break;case 122:C.key=b?p.C0.ESC+"[23;"+(b+1)+"~":p.C0.ESC+"[23~";break;case 123:C.key=b?p.C0.ESC+"[24;"+(b+1)+"~":p.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(_&&!E||!m.altKey||m.metaKey)!_||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=p.C0.US),m.key==="@"&&(C.key=p.C0.NUL)):m.keyCode===65&&(C.type=1);else{const v=g[m.keyCode],y=v==null?void 0:v[m.shiftKey?1:0];if(y)C.key=p.C0.ESC+y;else if(m.keyCode>=65&&m.keyCode<=90){const S=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(S);m.shiftKey&&(j=j.toUpperCase()),C.key=p.C0.ESC+j}else if(m.keyCode===32)C.key=p.C0.ESC+(m.ctrlKey?p.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let S=m.code.slice(3,4);m.shiftKey||(S=S.toLowerCase()),C.key=p.C0.ESC+S,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=p.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=p.C0.DEL:m.keyCode===219?C.key=p.C0.ESC:m.keyCode===220?C.key=p.C0.FS:m.keyCode===221&&(C.key=p.C0.GS)}return C}},482:(f,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,p=0,g=d.length){let m="";for(let x=p;x<g;++x){let _=d[x];_>65535?(_-=65536,m+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):m+=String.fromCharCode(_)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,p){const g=d.length;if(!g)return 0;let m=0,x=0;if(this._interim){const _=d.charCodeAt(x++);56320<=_&&_<=57343?p[m++]=1024*(this._interim-55296)+_-56320+65536:(p[m++]=this._interim,p[m++]=_),this._interim=0}for(let _=x;_<g;++_){const E=d.charCodeAt(_);if(55296<=E&&E<=56319){if(++_>=g)return this._interim=E,m;const C=d.charCodeAt(_);56320<=C&&C<=57343?p[m++]=1024*(E-55296)+C-56320+65536:(p[m++]=E,p[m++]=C)}else E!==65279&&(p[m++]=E)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,p){const g=d.length;if(!g)return 0;let m,x,_,E,C=0,b=0,v=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,D=0;for(;(N=63&this.interim[++D])&&D<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=T-D;for(;v<I;){if(v>=g)return 0;if(N=d[v++],(192&N)!=128){v--,j=!0;break}this.interim[D++]=N,A<<=6,A|=63&N}j||(T===2?A<128?v--:p[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(p[C++]=A):A<65536||A>1114111||(p[C++]=A)),this.interim.fill(0)}const y=g-4;let S=v;for(;S<g;){for(;!(!(S<y)||128&(m=d[S])||128&(x=d[S+1])||128&(_=d[S+2])||128&(E=d[S+3]));)p[C++]=m,p[C++]=x,p[C++]=_,p[C++]=E,S+=4;if(m=d[S++],m<128)p[C++]=m;else if((224&m)==192){if(S>=g)return this.interim[0]=m,C;if(x=d[S++],(192&x)!=128){S--;continue}if(b=(31&m)<<6|63&x,b<128){S--;continue}p[C++]=b}else if((240&m)==224){if(S>=g)return this.interim[0]=m,C;if(x=d[S++],(192&x)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,C;if(_=d[S++],(192&_)!=128){S--;continue}if(b=(15&m)<<12|(63&x)<<6|63&_,b<2048||b>=55296&&b<=57343||b===65279)continue;p[C++]=b}else if((248&m)==240){if(S>=g)return this.interim[0]=m,C;if(x=d[S++],(192&x)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,C;if(_=d[S++],(192&_)!=128){S--;continue}if(S>=g)return this.interim[0]=m,this.interim[1]=x,this.interim[2]=_,C;if(E=d[S++],(192&E)!=128){S--;continue}if(b=(7&m)<<18|(63&x)<<12|(63&_)<<6|63&E,b<65536||b>1114111)continue;p[C++]=b}}return C}}},225:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const p=d(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let _=0;_<g.length;++_)x.fill(0,g[_][0],g[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?x[_]:(function(E,C){let b,v=0,y=C.length-1;if(E<C[0][0]||E>C[y][1])return!1;for(;y>=v;)if(b=v+y>>1,E>C[b][1])v=b+1;else{if(!(E<C[b][0]))return!0;y=b-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,E){let C=this.wcwidth(_),b=C===0&&E!==0;if(b){const v=p.UnicodeService.extractWidth(E);v===0?b=!1:v>C&&(C=v)}return p.UnicodeService.createPropertyValue(0,C,b)}}},5981:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const p=d(8460),g=d(844);class m extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new p.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,E){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(E)}_innerWrite(_=0,E=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],v=this._action(b,E);if(v){const S=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void v.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(S)}const y=this._callbacks[this._bufferOffset];if(y&&y(),this._bufferOffset++,this._pendingData-=b.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:(f,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})$/,p=/^[\da-f]+$/;function g(m,x){const _=m.toString(16),E=_.length<2?"0"+_:_;switch(x){case 4:return _[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}c.parseColor=function(m){if(!m)return;let x=m.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const _=d.exec(x);if(_){const E=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/E*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/E*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/E*255)]}}else if(x.indexOf("#")===0&&(x=x.slice(1),p.exec(x)&&[3,6,9,12].includes(x.length))){const _=x.length/3,E=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(x.slice(_*C,_*C+_),16);E[C]=_===1?b<<4:_===2?b:_===3?b>>4:b>>8}return E}},c.toRgbString=function(m,x=16){const[_,E,C]=m;return`rgb:${g(_,x)}/${g(E,x)}/${g(C,x)}`}},5770:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const p=d(482),g=d(8742),m=d(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const b=this._handlers[E];return b.push(C),{dispose:()=>{const v=b.indexOf(C);v!==-1&&b.splice(v,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||x,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,b){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(E,C,b);else this._handlerFb(this._ident,"PUT",(0,p.utf32ToString)(E,C,b))}unhook(E,C=!0){if(this._active.length){let b=!1,v=this._active.length-1,y=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,b=C,y=this._stack.fallThrough,this._stack.paused=!1),!y&&b===!1){for(;v>=0&&(b=this._active[v].unhook(E),b!==!0);v--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,b;v--}for(;v>=0;v--)if(b=this._active[v].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",E);this._active=x,this._ident=0}};const _=new g.Params;_.addParam(0),c.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=_,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():_,this._data="",this._hitLimit=!1}put(E,C,b){this._hitLimit||(this._data+=(0,p.utf32ToString)(E,C,b),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let C=!1;if(this._hitLimit)C=!1;else if(E&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=_,this._data="",this._hitLimit=!1,b)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const p=d(844),g=d(8742),m=d(6242),x=d(6351);class _{constructor(v){this.table=new Uint8Array(v)}setDefault(v,y){this.table.fill(v<<4|y)}add(v,y,S,j){this.table[y<<8|v]=S<<4|j}addMany(v,y,S,j){for(let A=0;A<v.length;A++)this.table[y<<8|v[A]]=S<<4|j}}c.TransitionTable=_;const E=160;c.VT500_TRANSITION_TABLE=(function(){const b=new _(4095),v=Array.apply(null,Array(256)).map(((D,T)=>T)),y=(D,T)=>v.slice(D,T),S=y(32,127),j=y(0,24);j.push(25),j.push.apply(j,y(28,32));const A=y(0,14);let N;for(N in b.setDefault(1,0),b.addMany(S,0,2,0),A)b.addMany([24,26,153,154],N,3,0),b.addMany(y(128,144),N,3,0),b.addMany(y(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(j,0,3,0),b.addMany(j,1,3,1),b.add(127,1,0,1),b.addMany(j,8,0,8),b.addMany(j,3,3,3),b.add(127,3,0,3),b.addMany(j,4,3,4),b.add(127,4,0,4),b.addMany(j,6,3,6),b.addMany(j,5,3,5),b.add(127,5,0,5),b.addMany(j,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(S,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(y(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(S,7,0,7),b.addMany(j,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(y(64,127),3,7,0),b.addMany(y(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(y(48,60),4,8,4),b.addMany(y(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(y(32,64),6,0,6),b.add(127,6,0,6),b.addMany(y(64,127),6,0,0),b.addMany(y(32,48),3,9,5),b.addMany(y(32,48),5,9,5),b.addMany(y(48,64),5,0,6),b.addMany(y(64,127),5,7,0),b.addMany(y(32,48),4,9,5),b.addMany(y(32,48),1,9,2),b.addMany(y(32,48),2,9,2),b.addMany(y(48,127),2,10,0),b.addMany(y(48,80),1,10,0),b.addMany(y(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(y(96,127),1,10,0),b.add(80,1,11,9),b.addMany(j,9,0,9),b.add(127,9,0,9),b.addMany(y(28,32),9,0,9),b.addMany(y(32,48),9,9,12),b.addMany(y(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(j,11,0,11),b.addMany(y(32,128),11,0,11),b.addMany(y(28,32),11,0,11),b.addMany(j,10,0,10),b.add(127,10,0,10),b.addMany(y(28,32),10,0,10),b.addMany(y(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(y(32,48),10,9,12),b.addMany(j,12,0,12),b.add(127,12,0,12),b.addMany(y(28,32),12,0,12),b.addMany(y(32,48),12,9,12),b.addMany(y(48,64),12,0,11),b.addMany(y(64,127),12,12,13),b.addMany(y(64,127),10,12,13),b.addMany(y(64,127),9,12,13),b.addMany(j,13,13,13),b.addMany(S,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(E,0,2,0),b.add(E,8,5,8),b.add(E,6,0,6),b.add(E,11,0,11),b.add(E,13,13,13),b})();class C extends p.Disposable{constructor(v=c.VT500_TRANSITION_TABLE){super(),this._transitions=v,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=(y,S,j)=>{},this._executeHandlerFb=y=>{},this._csiHandlerFb=(y,S)=>{},this._escHandlerFb=y=>{},this._errorHandlerFb=y=>y,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,p.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(v,y=[64,126]){let S=0;if(v.prefix){if(v.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=v.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(v.intermediates){if(v.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<v.intermediates.length;++A){const N=v.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=N}}if(v.final.length!==1)throw new Error("final must be a single byte");const j=v.final.charCodeAt(0);if(y[0]>j||j>y[1])throw new Error(`final must be in range ${y[0]} .. ${y[1]}`);return S<<=8,S|=j,S}identToString(v){const y=[];for(;v;)y.push(String.fromCharCode(255&v)),v>>=8;return y.reverse().join("")}setPrintHandler(v){this._printHandler=v}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(v,y){const S=this._identifier(v,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const j=this._escHandlers[S];return j.push(y),{dispose:()=>{const A=j.indexOf(y);A!==-1&&j.splice(A,1)}}}clearEscHandler(v){this._escHandlers[this._identifier(v,[48,126])]&&delete this._escHandlers[this._identifier(v,[48,126])]}setEscHandlerFallback(v){this._escHandlerFb=v}setExecuteHandler(v,y){this._executeHandlers[v.charCodeAt(0)]=y}clearExecuteHandler(v){this._executeHandlers[v.charCodeAt(0)]&&delete this._executeHandlers[v.charCodeAt(0)]}setExecuteHandlerFallback(v){this._executeHandlerFb=v}registerCsiHandler(v,y){const S=this._identifier(v);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const j=this._csiHandlers[S];return j.push(y),{dispose:()=>{const A=j.indexOf(y);A!==-1&&j.splice(A,1)}}}clearCsiHandler(v){this._csiHandlers[this._identifier(v)]&&delete this._csiHandlers[this._identifier(v)]}setCsiHandlerFallback(v){this._csiHandlerFb=v}registerDcsHandler(v,y){return this._dcsParser.registerHandler(this._identifier(v),y)}clearDcsHandler(v){this._dcsParser.clearHandler(this._identifier(v))}setDcsHandlerFallback(v){this._dcsParser.setHandlerFallback(v)}registerOscHandler(v,y){return this._oscParser.registerHandler(v,y)}clearOscHandler(v){this._oscParser.clearHandler(v)}setOscHandlerFallback(v){this._oscParser.setHandlerFallback(v)}setErrorHandler(v){this._errorHandler=v}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(v,y,S,j,A){this._parseStack.state=v,this._parseStack.handlers=y,this._parseStack.handlerPos=S,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(v,y,S){let j,A=0,N=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&I>-1){for(;I>=0&&(j=T[I](this._params),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 4:if(S===!1&&I>-1){for(;I>=0&&(j=T[I](),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 6:if(A=v[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,S),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=v[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,S),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=D;T<y;++T){switch(A=v[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let W=T+1;;++W){if(W>=y||(A=v[W])<32||A>126&&A<E){this._printHandler(v,T,W),T=W-1;break}if(++W>=y||(A=v[W])<32||A>126&&A<E){this._printHandler(v,T,W),T=W-1;break}if(++W>=y||(A=v[W])<32||A>126&&A<E){this._printHandler(v,T,W),T=W-1;break}if(++W>=y||(A=v[W])<32||A>126&&A<E){this._printHandler(v,T,W),T=W-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|A];let z=I?I.length-1:-1;for(;z>=0&&(j=I[z](this._params),j!==!0);z--)if(j instanceof Promise)return this._preserveStack(3,I,z,N,T),j;z<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++T<y&&(A=v[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const q=this._escHandlers[this._collect<<8|A];let K=q?q.length-1:-1;for(;K>=0&&(j=q[K](),j!==!0);K--)if(j instanceof Promise)return this._preserveStack(4,q,K,N,T),j;K<0&&this._escHandlerFb(this._collect<<8|A),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|A,this._params);break;case 13:for(let W=T+1;;++W)if(W>=y||(A=v[W])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(v,T,W),T=W-1;break}break;case 14:if(j=this._dcsParser.unhook(A!==24&&A!==26),j)return this._preserveStack(6,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let W=T+1;;W++)if(W>=y||(A=v[W])<32||A>127&&A<E){this._oscParser.put(v,T,W),T=W-1;break}break;case 6:if(j=this._oscParser.end(A!==24&&A!==26),j)return this._preserveStack(5,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}c.EscapeSequenceParser=C},6242:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const p=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(x,_){this._handlers[x]===void 0&&(this._handlers[x]=[]);const E=this._handlers[x];return E.push(_),{dispose:()=>{const C=E.indexOf(_);C!==-1&&E.splice(C,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].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 x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,_,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(x,_,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(x,_,E))}start(){this.reset(),this._state=1}put(x,_,E){if(this._state!==3){if(this._state===1)for(;_<E;){const C=x[_++];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&&E-_>0&&this._put(x,_,E)}}end(x,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=_,b=this._stack.fallThrough,this._stack.paused=!1),!b&&E===!1){for(;C>=0&&(E=this._active[C].end(x),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",x);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,_,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(x,_,E),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let _=!1;if(this._hitLimit)_=!1;else if(x&&(_=this._handler(this._data),_ instanceof Promise))return _.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,_}}},8742:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const d=2147483647;class p{static fromArray(m){const x=new p;if(!m.length)return x;for(let _=Array.isArray(m[0])?1:0;_<m.length;++_){const E=m[_];if(Array.isArray(E))for(let C=0;C<E.length;++C)x.addSubParam(E[C]);else x.addParam(E)}return x}constructor(m=32,x=32){if(this.maxLength=m,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new p(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let x=0;x<this.length;++x){m.push(this.params[x]);const _=this._subParamsIdx[x]>>8,E=255&this._subParamsIdx[x];E-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,E))}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 x=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-x>0?this._subParams.subarray(x,_):null}getSubParamsAll(){const m={};for(let x=0;x<this.length;++x){const _=this._subParamsIdx[x]>>8,E=255&this._subParamsIdx[x];E-_>0&&(m[x]=this._subParams.slice(_,E))}return m}addDigit(m){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,E=_[x-1];_[x-1]=~E?Math.min(10*E+m,d):m}}c.Params=p},5741:(f,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,p){const g={instance:p,dispose:p.dispose,isDisposed:!1};this._addons.push(g),p.dispose=()=>this._wrappedAddonDispose(g),p.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let p=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){p=g;break}if(p===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(p,1)}}},8771:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const p=d(3785),g=d(511);c.BufferApiView=class{constructor(m,x){this._buffer=m,this.type=x}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 x=this._buffer.lines.get(m);if(x)return new p.BufferLineApiView(x)}getNullCell(){return new g.CellData}}},3785:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const p=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 p.CellData)}translateToString(g,m,x){return this._line.translateToString(g,m,x)}}},8285:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const p=d(8771),g=d(8460),m=d(844);class x extends m.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new p.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new p.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=x},7975:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,p){return this._core.registerCsiHandler(d,(g=>p(g.toArray())))}addCsiHandler(d,p){return this.registerCsiHandler(d,p)}registerDcsHandler(d,p){return this._core.registerDcsHandler(d,((g,m)=>p(g,m.toArray())))}addDcsHandler(d,p){return this.registerDcsHandler(d,p)}registerEscHandler(d,p){return this._core.registerEscHandler(d,p)}addEscHandler(d,p){return this.registerEscHandler(d,p)}registerOscHandler(d,p){return this._core.registerOscHandler(d,p)}addOscHandler(d,p){return this.registerOscHandler(d,p)}}},7090:(f,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(f,c,d){var p=this&&this.__decorate||function(b,v,y,S){var j,A=arguments.length,N=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,y):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,S);else for(var D=b.length-1;D>=0;D--)(j=b[D])&&(N=(A<3?j(N):A>3?j(v,y,N):j(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,S){v(y,S,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),x=d(844),_=d(5295),E=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let C=c.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(b){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(b.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(b,this))}resize(b,v){this.cols=b,this.rows=v,this.buffers.resize(b,v),this._onResize.fire({cols:b,rows:v})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,v=!1){const y=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===b.fg&&S.getBg(0)===b.bg||(S=y.getBlankLine(b,v),this._cachedBlankLine=S),S.isWrapped=v;const j=y.ybase+y.scrollTop,A=y.ybase+y.scrollBottom;if(y.scrollTop===0){const N=y.lines.isFull;A===y.lines.length-1?N?y.lines.recycle().copyFrom(S):y.lines.push(S.clone()):y.lines.splice(A+1,0,S.clone()),N?this.isUserScrolling&&(y.ydisp=Math.max(y.ydisp-1,0)):(y.ybase++,this.isUserScrolling||y.ydisp++)}else{const N=A-j+1;y.lines.shiftElements(j+1,N-1,-1),y.lines.set(A,S.clone())}this.isUserScrolling||(y.ydisp=y.ybase),this._onScroll.fire(y.ydisp)}scrollLines(b,v,y){const S=this.buffer;if(b<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else b+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const j=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+b,S.ybase),0),j!==S.ydisp&&(v||this._onScroll.fire(S.ydisp))}};c.BufferService=C=p([g(0,E.IOptionsService)],C)},7994:(f,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,p){this._charsets[d]=p,this.glevel===d&&(this.charset=p)}}},1753:function(f,c,d){var p=this&&this.__decorate||function(S,j,A,N){var D,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(S,j,A,N);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(I=(T<3?D(I):T>3?D(j,A,I):D(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(S,j){return function(A,N){j(A,N,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=d(2585),x=d(8460),_=d(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function C(S,j){let A=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(A|=64,A|=S.action):(A|=3&S.button,4&S.button&&(A|=64),8&S.button&&(A|=128),S.action===32?A|=32:S.action!==0||j||(A|=3)),A}const b=String.fromCharCode,v={DEFAULT:S=>{const j=[C(S,!1)+32,S.col+32,S.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${b(j[0])}${b(j[1])}${b(j[2])}`},SGR:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.col};${S.row}${j}`},SGR_PIXELS:S=>{const j=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${C(S,!0)};${S.x};${S.y}${j}`}};let y=c.CoreMouseService=class extends _.Disposable{constructor(S,j){super(),this._bufferService=S,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(v))this.addEncoding(A,v[A]);this.reset()}addProtocol(S,j){this._protocols[S]=j}addEncoding(S,j){this._encodings[S]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const j=this._encodings[this._activeEncoding](S);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,j,A){if(A){if(S.x!==j.x||S.y!==j.y)return!1}else if(S.col!==j.col||S.row!==j.row)return!1;return S.button===j.button&&S.action===j.action&&S.ctrl===j.ctrl&&S.alt===j.alt&&S.shift===j.shift}};c.CoreMouseService=y=p([g(0,m.IBufferService),g(1,m.ICoreService)],y)},6975:function(f,c,d){var p=this&&this.__decorate||function(y,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,S,j,A);else for(var I=y.length-1;I>=0;I--)(N=y[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(y,S){return function(j,A){S(j,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),x=d(8460),_=d(844),E=d(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let v=c.CoreService=class extends _.Disposable{constructor(y,S,j){super(),this._bufferService=y,this._logService=S,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(b)}triggerDataEvent(y,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${y}"`,(()=>y.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(y)}triggerBinaryEvent(y){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${y}"`,(()=>y.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(y))}};c.CoreService=v=p([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],v)},9074:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const p=d(8055),g=d(8460),m=d(844),x=d(6106);let _=0,E=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((y=>y==null?void 0:y.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(y){if(y.marker.isDisposed)return;const S=new b(y);if(S){const j=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),j.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const y of this._decorations.values())y.dispose();this._decorations.clear()}*getDecorationsAtCell(y,S,j){let A=0,N=0;for(const D of this._decorations.getKeyIterator(S))A=D.options.x??0,N=A+(D.options.width??1),y>=A&&y<N&&(!j||(D.options.layer??"bottom")===j)&&(yield D)}forEachDecorationAtCell(y,S,j,A){this._decorations.forEachByKey(S,(N=>{_=N.options.x??0,E=_+(N.options.width??1),y>=_&&y<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}c.DecorationService=C;class b extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=p.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=p.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(y){super(),this.options=y,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=y.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const p=d(2585),g=d(8343);class m{constructor(..._){this._entries=new Map;for(const[E,C]of _)this.set(E,C)}set(_,E){const C=this._entries.get(_);return this._entries.set(_,E),C}forEach(_){for(const[E,C]of this._entries.entries())_(E,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(p.IInstantiationService,this)}setService(x,_){this._services.set(x,_)}getService(x){return this._services.get(x)}createInstance(x,..._){const E=(0,g.getServiceDependencies)(x).sort(((v,y)=>v.index-y.index)),C=[];for(const v of E){const y=this._services.get(v.id);if(!y)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${v.id}.`);C.push(y)}const b=E.length>0?E[0].index:_.length;if(_.length!==b)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${b+1} conflicts with ${_.length} static arguments`);return new x(..._,...C)}}},7866:function(f,c,d){var p=this&&this.__decorate||function(b,v,y,S){var j,A=arguments.length,N=A<3?v:S===null?S=Object.getOwnPropertyDescriptor(v,y):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,S);else for(var D=b.length-1;D>=0;D--)(j=b[D])&&(N=(A<3?j(N):A>3?j(v,y,N):j(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,S){v(y,S,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),x=d(2585),_={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let E,C=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let v=0;v<b.length;v++)typeof b[v]=="function"&&(b[v]=b[v]())}_log(b,v,y){this._evalLazyOptionalParams(y),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...y)}trace(b,...v){var y;this._logLevel<=x.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,b,v)}debug(b,...v){var y;this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,b,v)}info(b,...v){var y;this._logLevel<=x.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,b,v)}warn(b,...v){var y;this._logLevel<=x.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,b,v)}error(b,...v){var y;this._logLevel<=x.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,b,v)}};c.LogService=C=p([g(0,x.IOptionsService)],C),c.setTraceLogger=function(b){E=b},c.traceCall=function(b,v,y){if(typeof y.value!="function")throw new Error("not supported");const S=y.value;y.value=function(...j){if(E.logLevel!==x.LogLevelEnum.TRACE)return S.apply(this,j);E.trace(`GlyphRenderer#${S.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=S.apply(this,j);return E.trace(`GlyphRenderer#${S.name} return`,A),A}}},7302:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const p=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 x=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new p.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...c.DEFAULT_OPTIONS};for(const v in C)if(v in b)try{const y=C[v];b[v]=this._sanitizeAndValidateOption(v,y)}catch(y){console.error(y)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((v=>{v===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((v=>{C.indexOf(v)!==-1&&b()}))}_setupOptions(){const C=v=>{if(!(v in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);return this.rawOptions[v]},b=(v,y)=>{if(!(v in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);y=this._sanitizeAndValidateOption(v,y),this.rawOptions[v]!==y&&(this.rawOptions[v]=y,this._onOptionChange.fire(v))};for(const v in this.rawOptions){const y={get:C.bind(this,v),set:b.bind(this,v)};Object.defineProperty(this.options,v,y)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=c.DEFAULT_OPTIONS[C]),!(function(v){return v==="block"||v==="underline"||v==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=c.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=x.includes(b)?b:c.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}c.OptionsService=_},2660:function(f,c,d){var p=this&&this.__decorate||function(_,E,C,b){var v,y=arguments.length,S=y<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(_,E,C,b);else for(var j=_.length-1;j>=0;j--)(v=_[j])&&(S=(y<3?v(S):y>3?v(E,C,S):v(E,C))||S);return y>3&&S&&Object.defineProperty(E,C,S),S},g=this&&this.__param||function(_,E){return function(C,b){E(C,b,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let x=c.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const E=this._bufferService.buffer;if(_.id===void 0){const j=E.addMarker(E.ybase+E.y),A={data:_,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=_,b=this._getEntryIdKey(C),v=this._entriesWithId.get(b);if(v)return this.addLineToLink(v.id,E.ybase+E.y),v.id;const y=E.addMarker(E.ybase+E.y),S={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(S,y))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(_,E){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((b=>b.line!==E))){const b=this._bufferService.buffer.addMarker(E);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(_){var E;return(E=this._dataByLinkId.get(_))==null?void 0:E.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,E){const C=_.lines.indexOf(E);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};c.OscLinkService=x=p([g(0,m.IBufferService)],x)},8343:(f,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const d="di$target",p="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(g){return g[p]||[]},c.createDecorator=function(g){if(c.serviceRegistry.has(g))return c.serviceRegistry.get(g);const m=function(x,_,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,v){b[d]===b?b[p].push({id:C,index:v}):(b[p]=[{id:C,index:v}],b[d]=b)})(m,x,E)};return m.toString=()=>g,c.serviceRegistry.set(g,m),m}},2585:(f,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 p=d(8343);var g;c.IBufferService=(0,p.createDecorator)("BufferService"),c.ICoreMouseService=(0,p.createDecorator)("CoreMouseService"),c.ICoreService=(0,p.createDecorator)("CoreService"),c.ICharsetService=(0,p.createDecorator)("CharsetService"),c.IInstantiationService=(0,p.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(c.LogLevelEnum=g={})),c.ILogService=(0,p.createDecorator)("LogService"),c.IOptionsService=(0,p.createDecorator)("OptionsService"),c.IOscLinkService=(0,p.createDecorator)("OscLinkService"),c.IUnicodeService=(0,p.createDecorator)("UnicodeService"),c.IDecorationService=(0,p.createDecorator)("DecorationService")},1480:(f,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const p=d(8460),g=d(225);class m{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,E,C=!1){return(16777215&_)<<3|(3&E)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new p.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let E=0,C=0;const b=_.length;for(let v=0;v<b;++v){let y=_.charCodeAt(v);if(55296<=y&&y<=56319){if(++v>=b)return E+this.wcwidth(y);const A=_.charCodeAt(v);56320<=A&&A<=57343?y=1024*(y-55296)+A-56320+65536:E+=this.wcwidth(A)}const S=this.charProperties(y,C);let j=m.extractWidth(S);m.extractShouldJoin(S)&&(j-=m.extractWidth(C)),E+=j,C=S}return E}charProperties(_,E){return this._activeProvider.charProperties(_,E)}}c.UnicodeService=m}},s={};function l(f){var c=s[f];if(c!==void 0)return c.exports;var d=s[f]={exports:{}};return i[f].call(d.exports,d,d.exports,l),d.exports}var u={};return(()=>{var f=u;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const c=l(9042),d=l(3236),p=l(844),g=l(5741),m=l(8285),x=l(7975),_=l(7090),E=["cols","rows"];class C extends p.Disposable{constructor(v){super(),this._core=this.register(new d.Terminal(v)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const y=j=>this._core.options[j],S=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:y.bind(this,j),set:S.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(v){if(E.includes(v))throw new Error(`Option "${v}" 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 x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const v=this._core.coreService.decPrivateModes;let y="none";switch(this._core.coreMouseService.activeProtocol){case"X10":y="x10";break;case"VT200":y="vt200";break;case"DRAG":y="drag";break;case"ANY":y="any"}return{applicationCursorKeysMode:v.applicationCursorKeys,applicationKeypadMode:v.applicationKeypad,bracketedPasteMode:v.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:y,originMode:v.origin,reverseWraparoundMode:v.reverseWraparound,sendFocusMode:v.sendFocus,wraparoundMode:v.wraparound}}get options(){return this._publicOptions}set options(v){for(const y in v)this._publicOptions[y]=v[y]}blur(){this._core.blur()}focus(){this._core.focus()}input(v,y=!0){this._core.input(v,y)}resize(v,y){this._verifyIntegers(v,y),this._core.resize(v,y)}open(v){this._core.open(v)}attachCustomKeyEventHandler(v){this._core.attachCustomKeyEventHandler(v)}attachCustomWheelEventHandler(v){this._core.attachCustomWheelEventHandler(v)}registerLinkProvider(v){return this._core.registerLinkProvider(v)}registerCharacterJoiner(v){return this._checkProposedApi(),this._core.registerCharacterJoiner(v)}deregisterCharacterJoiner(v){this._checkProposedApi(),this._core.deregisterCharacterJoiner(v)}registerMarker(v=0){return this._verifyIntegers(v),this._core.registerMarker(v)}registerDecoration(v){return this._checkProposedApi(),this._verifyPositiveIntegers(v.x??0,v.width??0,v.height??0),this._core.registerDecoration(v)}hasSelection(){return this._core.hasSelection()}select(v,y,S){this._verifyIntegers(v,y,S),this._core.select(v,y,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(v,y){this._verifyIntegers(v,y),this._core.selectLines(v,y)}dispose(){super.dispose()}scrollLines(v){this._verifyIntegers(v),this._core.scrollLines(v)}scrollPages(v){this._verifyIntegers(v),this._core.scrollPages(v)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(v){this._verifyIntegers(v),this._core.scrollToLine(v)}clear(){this._core.clear()}write(v,y){this._core.write(v,y)}writeln(v,y){this._core.write(v),this._core.write(`\r
65
- `,y)}paste(v){this._core.paste(v)}refresh(v,y){this._verifyIntegers(v,y),this._core.refresh(v,y)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(v){this._addonManager.loadAddon(this,v)}static get strings(){return c}_verifyIntegers(...v){for(const y of v)if(y===1/0||isNaN(y)||y%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...v){for(const y of v)if(y&&(y===1/0||isNaN(y)||y%1!=0||y<0))throw new Error("This API only accepts positive integers")}}f.Terminal=C})(),u})()))})(Ad)),Ad.exports}var tw=ew();/**
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 nw=2,rw=1,iw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),f={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},c=f.top+f.bottom,d=f.right+f.left,p=s-c,g=l-d-r;return{cols:Math.max(nw,Math.floor(g/e.css.cell.width)),rows:Math.max(rw,Math.floor(p/e.css.cell.height))}}};function sw({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const l=P.useRef(null),u=P.useRef(e),f=P.useRef(null),c=P.useRef(null),d=lr(g=>g.writeSession),p=lr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!l.current)return;const g=new tw.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new iw;g.loadAddon(m),f.current={term:g,fitAddon:m},l.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(l.current);const x=l.current.querySelector(".xterm");x&&(x.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{requestAnimationFrame(()=>{var b;m.fit&&m.fit();const C=(b=f.current)==null?void 0:b.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(l.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const E=Ut.subscribe(C=>{var b,v;if(C.type==="terminal.output"&&((b=C.payload)==null?void 0:b.sessionId)===u.current){const y=(v=C.payload)==null?void 0:v.data;y&&g.write(y)}});return()=>{E(),_.disconnect(),c.current&&clearTimeout(c.current),g.dispose(),f.current=null}},[e,d,p]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:l,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function aw(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 ow({isOpen:e,onClose:r,onFocusChat:i}){const s=lr(C=>C.createSession),l=lr(C=>C.killSession),u=lr(C=>C.sessions),f=lr(C=>C.setWorkdir),c=lr(C=>C.fetchSessions),d=Vt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),x=P.useRef(!1),_=P.useRef(!1),E=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),c().finally(()=>g(!1)))},[e,c]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),P.useEffect(()=>{e?(x.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{x.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=b=>{x.current||(b.key==="Escape"||b.key==="²"||b.key==="`")&&(b.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:E}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),E())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:p?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${aw(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(sw,{sessionId:C.id,onClose:()=>l(C.id),onEscape:E,autoFocus:u.length===1},C.id))})})]})]}):null}function no({items:e,trigger:r,minWidth:i="120px"}){const[s,l]=P.useState(!1),[u,f]=P.useState(null),c=P.useRef(null),d=P.useRef(null);P.useEffect(()=>{function x(_){d.current&&!d.current.contains(_.target)&&l(!1)}return s&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[s]);const p=P.useCallback(()=>{if(!c.current)return;const x=c.current.getBoundingClientRect(),_=200,C=window.innerHeight-x.bottom<_;f({top:C?x.top-_-4:x.bottom+4,left:x.left,alignToTop:C})},[]),g=x=>{x.stopPropagation(),s||p(),l(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((x,_)=>{const E=o.jsxs(o.Fragment,{children:[x.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:x.icon}),x.label]});return x.href?o.jsx(On,{href:x.href,onClick:C=>{var b;(b=x.onClick)==null||b.call(x,C),l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${x.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:E},_):o.jsx("button",{onClick:C=>{var b;(b=x.onClick)==null||b.call(x,C),x.closeOnClick!==!1&&l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${x.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:E},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:c,onClick:g,children:r})}),s&&_h.createPortal(m,document.body)]})}function Ab({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Gl({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function Db(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${s} ${l}/${u}/${f}`}function Vl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function lw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-l.getTime())/(1e3*60*60*24)),f=Vl(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const c=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${c}/${d}/${p} ${f}`}}function Lb(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 cw(e){const{year:r,month:i,day:s}=Lb(e);return`${r}-${i}-${s}`}function Rb(e){const r=new Map;for(const l of e){const u=cw(l.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(l)}for(const[l,u]of r)u.sort((f,c)=>{const d=new Date(f.updatedAt).getTime();return new Date(c.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((l,u)=>u.localeCompare(l)),s=new Map;for(const l of i)s.set(l,r.get(l));return s}function uw({items:e,trigger:r,isActive:i=!1}){const[s,l]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(c){u.current&&!u.current.contains(c.target)&&l(!1)}if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>l(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&e.length>0&&o.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((f,c)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===On?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(On,{href:p,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,d.props.children]},c)}return f.href?o.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},c):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),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:[f.icon,f.label]},c)})})]})}function dw({projects:e,currentProject:r}){const i=Vt(u=>u.loadProject),l=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Gl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(no,{items:l,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(Ab,{})]}),minWidth:"250px"})}function hw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const l=r.filter(f=>f.projectId===e.id).sort((f,c)=>new Date(c.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(On,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...l.map(f=>({label:o.jsx(On,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(i==null?void 0:i.id)?o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(On,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(uw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function fw({sessions:e,currentProject:r,currentSession:i}){var d;const s=ke(p=>p.loadSession),l=e.filter(p=>p.projectId===r.id).slice(0,15),u=Rb(l),f=[];f.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[p,g]of u){const m=g[0];if(m){f.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:Db(m.updatedAt)}),onClick:()=>{}});for(const x of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:x.title??x.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Vl(x.updatedAt)})]}),icon:x.id===(i==null?void 0:i.id)?o.jsx(Gl,{}):void 0,href:`/p/${r.id}/s/${x.id}`,onClick:()=>{s(x.id)}})}}const c=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(no,{items:f,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:c,"data-testid":"header-session-dropdown",children:[c,o.jsx(Ab,{})]}),minWidth:"280px"})}function pw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[l]=cr(),u=l.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(l),c=ke(b=>b.currentSession),d=ke(b=>b.sessions),p=Vt(b=>b.currentProject),g=Vt(b=>b.projects),m=jt(b=>b.startAutoRefresh),x=jt(b=>b.stopAutoRefresh),_=lr(b=>b.setOpen),E=lr(b=>b.isOpen),C=P.useCallback(()=>{const b=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');b&&b.focus()},[]);return P.useEffect(()=>{const b=v=>{(v.key==="²"||v.key==="`")&&(v.preventDefault(),E||_(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[E,_]),P.useEffect(()=>(m(),()=>x()),[m,x]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),o.jsx(On,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(dw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(hw,{currentProject:p,sessions:d,currentSession:c,projectIdFromUrl:u&&l.split("/")[2]||null},p==null?void 0:p.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(fw,{sessions:d,currentProject:p,currentSession:c})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!E),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${E?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}),r&&f&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),o.jsx(XS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(ow,{isOpen:E,onClose:()=>_(!1),onFocusChat:C})]})}function mw({isOpen:e,onClose:r,title:i,label:s,description:l,placeholder:u,value:f,isLoading:c=!1,onSave:d}){const[p,g]=P.useState(f),[m,x]=P.useState(!1),[_,E]=P.useState(!1);P.useEffect(()=>{g(f),x(!1)},[f]);const C=S=>{g(S.target.value),x(!0)},b=async()=>{E(!0),await d(p),E(!1),x(!1),r()},v=()=>{g(f),x(!1),r()},y=c||_;return o.jsx(Ct,{isOpen:e,onClose:v,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:l}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:p,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:y})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(et,{variant:"secondary",onClick:v,children:"Cancel"}),o.jsx(et,{variant:"primary",onClick:b,disabled:!m||y,children:_?"Saving...":"Save"})]})]})})}function gw({isOpen:e,onClose:r,project:i}){const s=Vt(u=>u.updateProject),l=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(mw,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:l})}const xw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Va({onClick:e,className:r="",size:i="md",variant:s="default"}){const l=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx("button",{onClick:e,className:`${l} ${r}`,title:"Close",children:o.jsx("svg",{className:xw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function Ob({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=cr(),[l,u]=P.useState(!1),f=ke(j=>j.sessions),c=ke(j=>j.currentSession),d=ke(j=>j.unreadSessionIds),p=ke(j=>j.deleteSession),g=ke(j=>j.deleteAllSessions),m=ke(j=>j.loadMoreSessions),x=ke(j=>j.sessionsHasMore),_=ke(j=>j.sessionsPaginationLoading),E=Vt(j=>j.currentProject),C=P.useRef(null),b=P.useCallback(()=>{x&&!_&&E&&m(E.id)},[x,_,E,m]);P.useEffect(()=>{if(!C.current||!x)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&b()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[x,b]);const v=f.filter(j=>j.projectId===(E==null?void 0:E.id)),y=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(p(j),(c==null?void 0:c.id)===j&&s(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("aside",{className:`
77
- ${r?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
78
- md:relative md:h-auto md:translate-x-0
79
-
80
- fixed z-50 h-[calc(100vh-32px)]
81
- w-[300px] bg-bg-secondary border-r border-border flex flex-col
82
- transition-all duration-300 ease-in-out
83
- ${r?"translate-x-0":"-translate-x-full"}
84
- `,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(On,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(no,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:S,danger:!0}],trigger:o.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&o.jsx(Va,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),E&&o.jsx(gw,{isOpen:l,onClose:()=>u(!1),project:E}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:v.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:vw(v,c,d,y,e)}),_&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function vw(e,r,i,s,l){const u=Rb(e);return Array.from(u).map(([f,c])=>{const d=c[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:Db(d.updatedAt)}),c.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),x=p.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(On,{href:`/p/${l}/s/${p.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),o.jsx(no,{items:[{label:"Delete session",onClick:_=>s(p.id,_),danger:!0}],trigger:o.jsx("button",{onClick:_=>_.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[x?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Vl(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Bx=["⠋","⠙","⠹","⠸","⠼","⠴"];function bw(){var c;const e=Vt(d=>d.currentProject),r=ke(d=>d.currentSession),i=Sb(),s=!1,l=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{l.current=(l.current+1)%Bx.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Bx[l.current]} `:"";e&&p?document.title=`${g}${e.name} - ${p} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((c=r==null?void 0:r.metadata)!=null&&c.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Kl=P.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));Kl.displayName="Input";function yw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const l=()=>{s(),r()};return o.jsx(Ct,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(et,{variant:"danger",onClick:l,children:"Delete"})]})]})})}function _w(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 Sw({isOpen:e,onClose:r}){const[,i]=cr(),[s,l]=P.useState(""),[u,f]=P.useState(null),[c,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(Ce("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),l(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const x=P.useCallback(async C=>{C.preventDefault();const b=_w(s);if(!b.valid){f(b.error);return}d(!0),f(null);const v=`${p}/${s}`;try{const y=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:v})});if(!y.ok){const A=await y.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await y.json()).project;r(),i(`/p/${j.id}`)}catch(y){f(y instanceof Error?y.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{l(""),f(null),r()},[r]),E=s?`${p}/${s}`:"";return o.jsx(Ct,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:x,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Kl,{ref:m,id:"project-name",value:s,onChange:C=>{l(C.target.value),f(null)},placeholder:"my-project",disabled:c,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:E})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{type:"button",variant:"secondary",onClick:_,disabled:c,children:"Cancel"}),o.jsx(et,{type:"submit",variant:"primary",disabled:c||!s.trim(),className:"min-w-[100px]",children:c?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create"})]})]})})}const ww={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Yl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${ww[e]} ${r}`})}function Cw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Yl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Mb({onSelect:e,onClose:r,initialPath:i}){const[s,l]=P.useState(null),[u,f]=P.useState(!0),c=P.useCallback(async p=>{f(!0);try{const g=p?`/api/directories?path=${encodeURIComponent(p)}`:"/api/directories",x=await(await Ce(g)).json();l(x)}catch(g){console.error("Failed to load directories:",g)}finally{f(!1)}},[]);P.useEffect(()=>{c(i)},[i,c]);const d=((s==null?void 0:s.current)??"").split("/").filter(Boolean).map((p,g,m)=>({name:p,path:"/"+m.slice(0,g+1).join("/")}));return o.jsxs(Ct,{isOpen:!0,onClose:r,title:"Select Folder",size:"lg",children:[s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[d.map((p,g)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>c(p.path),className:`px-1 ${g===d.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:p.name})]},p.path)),d.length===0&&o.jsx("button",{onClick:()=>c("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Yl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>c(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(p=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>c(p.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{children:p.name})]}),o.jsx("button",{onClick:()=>e(p.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},p.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border mt-4 -mx-4 -mb-4 p-4",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>e(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})}async function Dd(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await Ce(i)).json()}function kw({isOpen:e,onClose:r}){const[,i]=cr(),[s,l]=P.useState(!1),[u,f]=P.useState(""),[c,d]=P.useState(null),[p,g]=P.useState(!1),[m,x]=P.useState(null),_=Vt(Z=>Z.projects),E=Vt(Z=>Z.createProject),C=Vt(Z=>Z.listProjects),b=Vt(Z=>Z.deleteProject),[v,y]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),I=P.useRef([]);P.useEffect(()=>{Ce("/api/config").then(Z=>Z.json()).then(Z=>{Z.workdir&&x(Z.workdir)})},[]);const z=P.useCallback(async Z=>{g(!0);try{const B=await Dd(Z,m??void 0);d(B)}catch(B){console.error("Failed to load directories:",B)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Dd(m),C())},[e,m,z,C]);const q=(c==null?void 0:c.directories.filter(Z=>u===""||Z.name.toLowerCase().includes(u.toLowerCase())))??[],K=[...c!=null&&c.parent&&!u?[{type:"parent",path:c.parent,name:".."}]:[],...q.map(Z=>({type:"directory",path:Z.path,name:Z.name}))],W=Z=>{i(`/p/${Z}`),r()},R=(Z,B)=>{B.stopPropagation(),N(Z)},U=()=>{A&&(b(A.id),N(null))},H=Z=>{const B=Z.split("/").filter(Boolean).pop()??"";E(B,Z),C(),y(Z)};P.useEffect(()=>{if(v){const Z=_.find(B=>B.workdir===v);Z&&(i(`/p/${Z.id}`),r(),y(null))}},[_,v,i,r]),P.useEffect(()=>{j(K.length>0?0:-1)},[u,K.length]);const X=Z=>{f(""),Dd(Z)};return P.useEffect(()=>{S>=0&&I.current[S]&&I.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs(Ct,{isOpen:e,onClose:r,title:"Open Project",size:"xl",footer:o.jsxs("div",{className:"flex justify-between gap-2",children:[o.jsx(et,{variant:"secondary",onClick:()=>l(!0),children:"Create Project"}),o.jsx(et,{variant:"secondary",onClick:r,children:"Cancel"})]}),children:[o.jsxs("div",{className:"flex flex-1 -m-4",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:_.map(Z=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>W(Z.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:Z.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:Z.workdir})]})]}),o.jsx("button",{onClick:B=>R(Z,B),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},Z.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Kl,{value:u,onChange:Z=>f(Z.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:p?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):K.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:K.map((Z,B)=>o.jsxs("button",{ref:L=>{L&&(I.current[B]=L)},onClick:()=>Z.type==="parent"?X(Z.path):H(Z.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${B===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"flex-1",children:Z.name})]},Z.path))})})]})]}),s&&o.jsx(Sw,{isOpen:s,onClose:()=>l(!1)}),A&&o.jsx(yw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Mb,{initialPath:m??void 0,onSelect:Z=>{H(Z),T(!1)},onClose:()=>T(!1)})]}):null}function Ew(){const[e,r]=P.useState(!1),i=ke(g=>g.sessions),s=Vt(g=>g.projects),l=Vt(g=>g.listProjects),u=ke(g=>g.listSessions),f=ke(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(l(),u())},[f,l,u]);const c=[...s].sort((g,m)=>{const x=i.filter(b=>b.workdir.startsWith(g.workdir)),_=i.filter(b=>b.workdir.startsWith(m.workdir)),E=x.length>0?new Date(x.reduce((b,v)=>new Date(v.updatedAt)>new Date(b.updatedAt)?v:b).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((b,v)=>new Date(v.updatedAt)>new Date(b.updatedAt)?v:b).updatedAt).getTime():new Date(m.updatedAt).getTime())-E}),d=g=>{const m=s.find(x=>x.id===g);return m?i.filter(x=>x.workdir.startsWith(m.workdir)).sort((x,_)=>new Date(_.updatedAt).getTime()-new Date(x.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(et,{variant:"primary",onClick:p,children:"Open Project"})]}),c.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(On,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(On,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(x=>{const _=s.find(C=>x.workdir.startsWith(C.workdir)),E=_?`/p/${_.id}/s/${x.id}`:"#";return o.jsx(On,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:x.title??x.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:lw(x.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[x.messageCount," msgs"]})]})]})},x.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),c.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(kw,{isOpen:e,onClose:()=>r(!1)})]})}function jw(){const[,e]=yh("/p/:projectId/new"),[,r]=cr(),i=e==null?void 0:e.projectId,s=ke(l=>l.createSession);return P.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function Nw(){const e=Vt(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(On,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const La=e=>Math.round(e*10)/10;function th(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function Tw(e){return`${e.providerId}::${e.model}`}function Aw(e){return`${e.providerName} > ${e.model}`}function zx(e){let r=0,i=0,s=0,l=0,u=0,f=0;const c=[],d=[];let p=0;for(const[x,_]of e.entries()){const E=_.stats,C=th(E);r+=E.totalTime,i+=E.toolTime,s+=E.prefillTokens,l+=E.generationTokens;const b=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,v=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;u+=b,f+=v,c.push({messageId:_.id,timestamp:_.timestamp,...C,mode:E.mode,responseIndex:x+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const y=E.llmCalls??[];for(const S of y)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:E.mode,responseIndex:x+1,sessionCallIndex:p,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime,...S.temperature!==void 0&&{temperature:S.temperature},...S.topP!==void 0&&{topP:S.topP},...S.topK!==void 0&&{topK:S.topK},...S.maxTokens!==void 0&&{maxTokens:S.maxTokens}})}const g=u>0?La(s/u):0,m=f>0?La(l/f):0;return{totalTime:La(r),aiTime:La(r-i),toolTime:La(i),prefillTokens:s,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:c,callDataPoints:d}}function Dw(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 i=new Map;for(const l of r){const u=Tw(th(l.stats)),f=i.get(u)??[];i.set(u,[...f,l])}const s=Array.from(i.entries()).map(([l,u])=>{const f=th(u[0].stats),c=zx(u);return{...f,key:l,label:Aw(f),...c}});return{...zx(r),modelGroups:s}}function Lw(e){return P.useMemo(()=>Dw(e),[e])}function Rw(e){const[r,i]=P.useState(null),[s,l]=P.useState(!0),[u,f]=P.useState(null),c=e||"";return P.useEffect(()=>{if(!c){l(!1);return}let d=!0,p=null;const g=async()=>{try{const x=await(await Ce(`/api/branch?workdir=${encodeURIComponent(c)}`)).json();d&&(i(x.branch),f(x.error||null),l(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),l(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[c]),{branch:r,loading:s,error:u}}function Ml(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Hx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Ow(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const Mw="modulepreload",Iw=function(e){return"/"+e},Px={},Bw=function(r,i,s){let l=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));l=f(i.map(p=>{if(p=Iw(p),p in Px)return;Px[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":Mw,g||(x.as="script"),x.crossOrigin="",x.href=p,d&&x.setAttribute("nonce",d),document.head.appendChild(x),g)return new Promise((_,E)=>{x.addEventListener("load",_),x.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=f,window.dispatchEvent(c),!c.defaultPrevented)throw f}return l.then(f=>{for(const c of f||[])c.status==="rejected"&&u(c.reason);return r().catch(u)})},Fx=["▁","▂","▃","▄","▅","▆","▇","█"];function zw(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function Hw(e,r){if(e===r){const l=Math.max(Math.abs(e)*.05,1);return{minY:e-l,maxY:r+l}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Pw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,x)=>m.x-x.x),s=i[0].x,l=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:c,maxY:d}=Hw(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const x=l===s?0:Math.round((m.x-s)/(l-s)*(r-1)),_=g.get(x)??[];g.set(x,[..._,m.y])}for(const[m,x]of g){const _=Math.max(...x);p[m]=Fx[zw(_,c,d)]??Fx[0]}return{blocks:p.join(""),minX:s,maxX:l,minY:c,maxY:d}}function Ux(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function $x({data:e,width:r=60,height:i=78,label:s,xLabel:l,yLabel:u,showAxes:f=!0,formatY:c=Ux,formatX:d=Ux}){const p=P.useMemo(()=>{const g=Pw(e,r),m=Math.max(r*6,240),x=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:x+(S.x-g.minX)/(g.maxX-g.minX)*(m-x*2),A=g.maxY===g.minY?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),b=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),y=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:b,gridLines:y}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[f&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:p.gridLines.map(g=>o.jsx("span",{children:c(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${p.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[p.gridLines.map(g=>o.jsx("line",{x1:"0",x2:p.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),p.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:i-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),p.points.length>1&&o.jsx("path",{d:p.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),p.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${c(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),f&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(p.minX)}),o.jsx("span",{children:l}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Fw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:l=60}){const u=e.map(c=>({x:c.x,y:c.ppSpeed})),f=e.map(c=>({x:c.x,y:c.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx($x,{data:u,width:l,label:r,xLabel:s}),o.jsx($x,{data:f,width:l,label:i,xLabel:s})]})}function Uw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((l,u)=>l.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function $w(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 qw(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 Ww(e){return e.callDataPoints.length>0?qw(e):$w(e)}function Ld(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Di(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Pa(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Gw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Di(r)} ctx`:`${Di(r)}-${Di(i)} ctx`}function Il(e){return`${Pa(e)} t/s`}function Ib(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Vw(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 Kw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[l,u]=P.useState({}),[f,c]=P.useState(()=>{var E;return((E=i.modelGroups[0])==null?void 0:E.key)??""});P.useEffect(()=>{var E;i.modelGroups.some(C=>C.key===f)||c(((E=i.modelGroups[0])==null?void 0:E.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(E=>E.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Uw(d):[],[d]),g=P.useMemo(()=>d?Ww(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(E=>{u(C=>({...C,[E]:!C[E]}))},[]),x=P.useCallback(()=>{if(!d)return;const E=Vw(d);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const E=(await Bw(async()=>{const{default:v}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:v}},[])).default,C=await E(s.current,{backgroundColor:"#1a1a1a",scale:2}),b=document.createElement("a");b.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,b.href=C.toDataURL("image/png"),b.click()}catch(E){console.error("Failed to export PNG:",E),x()}},[x]);return o.jsx(Ct,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(E=>o.jsx("button",{onClick:()=>c(E.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${E.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:E.label,children:E.label},E.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(Ar,{label:"AI Time",value:Ld(d.aiTime)}),o.jsx(Ar,{label:"Total Time",value:Ld(d.totalTime)}),o.jsx(Ar,{label:"Tool Time",value:Ld(d.toolTime)}),o.jsx(Ar,{label:"Responses",value:d.responseCount.toString()}),o.jsx(Ar,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(Ar,{label:"Prefill Tokens",value:Di(d.prefillTokens),subValue:`@ ${Pa(d.avgPrefillSpeed)} tok/s`}),o.jsx(Ar,{label:"Gen Tokens",value:Di(d.generationTokens),subValue:`@ ${Pa(d.avgGenerationSpeed)} tok/s`}),o.jsx(Ar,{label:"Avg PP Speed",value:`${Pa(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Ar,{label:"Avg TG Speed",value:`${Pa(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:x,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(Fw,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((E,C)=>o.jsxs(P.Fragment,{children:[o.jsx(Yw,{row:E,index:C,isExpanded:l[E.messageId]??!1,onToggle:E.isExpandable?()=>m(E.messageId):void 0}),(l[E.messageId]??!1)&&E.calls.map((b,v)=>o.jsx(Xw,{dataPoint:b,index:v},`${b.messageId}-${b.callIndex}`))]},E.messageId))})]})})]})]})})}function Ar({label:e,value:r,subValue:i}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function Yw({row:e,index:r,isExpanded:i,onToggle:s}){const l=e.calls.length>0?Gw(e.calls.map(u=>u.promptTokens)):`${Di(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Ib(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:l.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Il(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Il(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function Xw({dataPoint:e,index:r}){const i=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Ib(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Di(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Il(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Il(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]}),i&&o.jsx("tr",{className:`${r%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:o.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:o.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&o.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&o.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&o.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&o.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const Zw={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"}},Qw=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const l of r){const u=l.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(l=>i[l]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(l=>{const u=Zw[l];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[l]})]},l)})})]})});function Jw({isOpen:e,onClose:r}){const i=or(_=>_.config),s=or(_=>_.saveConfig),[l,u]=P.useState(""),[f,c]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),c((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const x=async()=>{!l.trim()||!f.trim()||(m(!0),await s({command:l.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(Ct,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:l,onChange:_=>u(_.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:f,onChange:_=>c(_.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:_=>p(_.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:x,disabled:g||!l.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const qx={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"},eC={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"},Wx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},tC="text-text-primary";function nC(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,l="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const p=e.slice(s,u.index);p&&r.push({text:p,className:l})}const f=u[1];if(!f)continue;const c=f.split(";").map(Number);if(c.length===0||c[0]===0){l="text-text-primary";continue}const d=[];for(const p of c)if(p>=30&&p<=37){const g=qx[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=eC[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=qx[p];g&&d.push(g)}else if(p in Wx){const g=Wx[p];g&&d.push(g)}else p===39?d.push(tC):p===49&&(l=l.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(l=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:l})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:rC(e),className:"text-text-primary"}]}}function rC(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Ka(e){const r=nC(e),i=[];return r.forEach((s,l)=>{const u=s.text.split(`
85
- `);u.forEach((f,c)=>{i.push(un.createElement("span",{key:`${l}-${c}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},f)),c<u.length-1&&i.push(un.createElement("br",{key:`${l}-${c}-br`}))})}),i.length===1?i[0]:i}const iC=P.memo(function({title:r,logs:i,onClose:s,preClassName:l}){const u=P.useRef(null);return P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx(Ct,{isOpen:!0,onClose:s,title:r,size:"full",children:o.jsx("pre",{ref:u,className:l,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,c)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Ka(f.content)},c))})})}),sC=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:l,onClose:u}){const[f,c]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&c({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Ka(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),l()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),aC=P.memo(function({workdir:r}){const i=or(z=>z.setWorkdir),s=or(z=>z.status),l=or(z=>z.config),u=or(z=>z.logs),f=or(z=>z.start),c=or(z=>z.stop),d=or(z=>z.fetchLogs),[p,g]=P.useState(!1),[m,x]=P.useState(!1),[_,E]=P.useState(!1),[C,b]=P.useState(!1),v=P.useRef(null),y=P.useRef(null),S=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=l!==null,D=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const T=()=>{D?c():f()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{y.current&&clearTimeout(y.current),v.current=setTimeout(()=>{E(!0),b(!1)},500)},onMouseLeave:()=>{v.current&&clearTimeout(v.current),b(!0),y.current=setTimeout(()=>E(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((z,q)=>o.jsx("span",{className:z.stream==="stderr"?"text-accent-warning":"",children:Ka(z.content)},q))}),(_||C)&&j.current&&_h.createPortal(o.jsx(sC,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>x(!0),onClose:()=>E(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(Jw,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(iC,{title:"Dev Server Logs",logs:u,onClose:()=>x(!1)})]})});function oC({isOpen:e,onClose:r,processName:i,logs:s}){return e?o.jsx(Ct,{isOpen:e,onClose:r,title:i,size:"lg",children:o.jsx("pre",{className:"flex-1 overflow-auto text-sm font-mono text-text-primary whitespace-pre-wrap",children:s.map((l,u)=>o.jsx("span",{className:l.stream==="stderr"?"text-accent-error":"",children:l.content},u))})}):null}const lC=P.memo(function({sessionId:r}){var _;const i=Fa(E=>E.processes),s=Fa(E=>E.stopProcess),[l,u]=P.useState(null),[f,c]=P.useState([]),d=i.filter(E=>E.status!=="exited"),p=d.filter(E=>E.status==="running").length;if(i.length===0)return null;const g=E=>{switch(E){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=E=>{const C=Fa.getState().logs[E]??[];c(C.map(b=>({content:b.content,stream:b.stream}))),u(E)},x=E=>{r&&s(E,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(E=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(E.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:E.name,children:E.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",E.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(E.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>x(E.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"})]})]})},E.id))}),l&&o.jsx(oC,{isOpen:!!l,onClose:()=>{u(null),c([])},processName:((_=d.find(E=>E.id===l))==null?void 0:_.name)??"",logs:f})]})});function Gx({summary:e,messages:r,workdir:i}){const[s,l]=P.useState(!1),u=Lw(r),{branch:f}=Rw(i),c=jt(p=>p.version),d=ke(p=>p.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>l(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:Ow(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Hx(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Hx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Kw,{isOpen:s,onClose:()=>l(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(Qw,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(aC,{workdir:i}),o.jsx(lC,{sessionId:d==null?void 0:d.id}),c&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",c]})]})]})}function cC({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const l=ke(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(Gx,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
86
- md:hidden
87
- p-4 overflow-y-auto bg-bg-secondary
88
- transition-all duration-300 ease-in-out
89
- fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
90
- ${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
91
- `,children:o.jsx(Gx,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})})]})]})}function uC(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Bb({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const l=i==="sm"?"w-12":"w-20",u=i==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${l} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${uC(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function dC({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Vx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function hC(){const e=ke(p=>p.contextState),r=ke(p=>p.currentSession),i=ke(p=>p.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:l,compactionCount:u,dangerZone:f}=e,c=Math.round(s/l*100),d=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:"Context:"}),o.jsxs("span",{className:Vx(c,f),children:[Ml(s)," / ",Ml(l)]}),o.jsxs("span",{className:Vx(c,f),children:["(",c,"%)"]})]}),o.jsx(Bb,{percent:c,dangerZone:f}),o.jsx(dC,{dangerZone:f}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(et,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:f?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Kx(e){const r=[],i=String(e||"");let s=i.indexOf(","),l=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const f=i.slice(l,s).trim();(f||!u)&&r.push(f),l=s+1,s=i.indexOf(",",l)}return r}function fC(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const pC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gC={};function Yx(e,r){return(gC.jsx?mC:pC).test(e)}const xC=/[ \t\n\f\r]/g;function vC(e){return typeof e=="object"?e.type==="text"?Xx(e.value):!1:Xx(e)}function Xx(e){return e.replace(xC,"")===""}class ro{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}ro.prototype.normal={};ro.prototype.property={};ro.prototype.space=void 0;function zb(e,r){const i={},s={};for(const l of e)Object.assign(i,l.property),Object.assign(s,l.normal);return new ro(i,s,r)}function Ya(e){return e.toLowerCase()}class wn{constructor(r,i){this.attribute=i,this.property=r}}wn.prototype.attribute="";wn.prototype.booleanish=!1;wn.prototype.boolean=!1;wn.prototype.commaOrSpaceSeparated=!1;wn.prototype.commaSeparated=!1;wn.prototype.defined=!1;wn.prototype.mustUseProperty=!1;wn.prototype.number=!1;wn.prototype.overloadedBoolean=!1;wn.prototype.property="";wn.prototype.spaceSeparated=!1;wn.prototype.space=void 0;let bC=0;const Ye=Mi(),$t=Mi(),nh=Mi(),we=Mi(),bt=Mi(),Ls=Mi(),Ln=Mi();function Mi(){return 2**++bC}const rh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:$t,commaOrSpaceSeparated:Ln,commaSeparated:Ls,number:we,overloadedBoolean:nh,spaceSeparated:bt},Symbol.toStringTag,{value:"Module"})),Rd=Object.keys(rh);class Nh extends wn{constructor(r,i,s,l){let u=-1;if(super(r,i),Zx(this,"space",l),typeof s=="number")for(;++u<Rd.length;){const f=Rd[u];Zx(this,Rd[u],(s&rh[f])===rh[f])}}}Nh.prototype.defined=!0;function Zx(e,r,i){i&&(e[r]=i)}function Ms(e){const r={},i={};for(const[s,l]of Object.entries(e.properties)){const u=new Nh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Ya(s)]=s,i[Ya(u.attribute)]=s}return new ro(r,i,e.space)}const Hb=Ms({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:bt,ariaCurrent:null,ariaDescribedBy:bt,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:bt,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:bt,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bt,ariaLevel:we,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:bt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:bt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:$t,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 Pb(e,r){return r in e?e[r]:r}function Fb(e,r){return Pb(e,r.toLowerCase())}const yC=Ms({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:bt,accessKey:bt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:bt,autoFocus:Ye,autoPlay:Ye,blocking:bt,capture:null,charSet:null,checked:Ye,cite:null,className:bt,cols:we,colSpan:null,content:null,contentEditable:$t,controls:Ye,controlsList:bt,coords:we|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:nh,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:bt,height:we,hidden:nh,high:we,href:null,hrefLang:null,htmlFor:bt,httpEquiv:bt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:bt,itemRef:bt,itemScope:Ye,itemType:bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:we,pattern:null,ping:bt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:bt,required:Ye,reversed:Ye,rows:we,rowSpan:we,sandbox:bt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:$t,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:Ye,useMap:null,value:$t,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bt,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:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:$t,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:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Fb}),_C=Ms({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:Ln,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:bt,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:Ye,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:Ls,g2:Ls,glyphName:Ls,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:Ln,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:bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ln,rev:Ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ln,requiredFeatures:Ln,requiredFonts:Ln,requiredFormats:Ln,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:Ln,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:Ln,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:Ln,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:Pb}),Ub=Ms({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()}}),$b=Ms({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fb}),qb=Ms({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),SC={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"},wC=/[A-Z]/g,Qx=/-[a-z]/g,CC=/^data[-\w.:]+$/i;function Wb(e,r){const i=Ya(r);let s=r,l=wn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&CC.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Qx,EC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Qx.test(u)){let f=u.replace(wC,kC);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}l=Nh}return new l(s,r)}function kC(e){return"-"+e.toLowerCase()}function EC(e){return e.charAt(1).toUpperCase()}const Gb=zb([Hb,yC,Ub,$b,qb],"html"),Xl=zb([Hb,_C,Ub,$b,qb],"svg");function Jx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function jC(e){return e.join(" ").trim()}var Cs={},Od,ev;function NC(){if(ev)return Od;ev=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
92
- `,p="/",g="*",m="",x="comment",_="declaration";function E(b,v){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];v=v||{};var y=1,S=1;function j(R){var U=R.match(r);U&&(y+=U.length);var H=R.lastIndexOf(d);S=~H?R.length-H:S+R.length}function A(){var R={line:y,column:S};return function(U){return U.position=new N(R),I(),U}}function N(R){this.start=R,this.end={line:y,column:S},this.source=v.source}N.prototype.content=b;function D(R){var U=new Error(v.source+":"+y+":"+S+": "+R);if(U.reason=R,U.filename=v.source,U.line=y,U.column=S,U.source=b,!v.silent)throw U}function T(R){var U=R.exec(b);if(U){var H=U[0];return j(H),b=b.slice(H.length),U}}function I(){T(i)}function z(R){var U;for(R=R||[];U=q();)U!==!1&&R.push(U);return R}function q(){var R=A();if(!(p!=b.charAt(0)||g!=b.charAt(1))){for(var U=2;m!=b.charAt(U)&&(g!=b.charAt(U)||p!=b.charAt(U+1));)++U;if(U+=2,m===b.charAt(U-1))return D("End of comment missing");var H=b.slice(2,U-2);return S+=2,j(H),b=b.slice(U),S+=2,R({type:x,comment:H})}}function K(){var R=A(),U=T(s);if(U){if(q(),!T(l))return D("property missing ':'");var H=T(u),X=R({type:_,property:C(U[0].replace(e,m)),value:H?C(H[0].replace(e,m)):m});return T(f),X}}function W(){var R=[];z(R);for(var U;U=K();)U!==!1&&(R.push(U),z(R));return R}return I(),W()}function C(b){return b?b.replace(c,m):m}return Od=E,Od}var tv;function TC(){if(tv)return Cs;tv=1;var e=Cs&&Cs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.default=i;const r=e(NC());function i(s,l){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),c=typeof l=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;c?l(p,g,d):g&&(u=u||{},u[p]=g)}),u}return Cs}var Ra={},nv;function AC(){if(nv)return Ra;nv=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(p){return!p||i.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},c=function(p,g){return"".concat(g,"-")},d=function(p,g){return g===void 0&&(g={}),u(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(l,c):p=p.replace(s,c),p.replace(r,f))};return Ra.camelCase=d,Ra}var Oa,rv;function DC(){if(rv)return Oa;rv=1;var e=Oa&&Oa.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(TC()),i=AC();function s(l,u){var f={};return!l||typeof l!="string"||(0,r.default)(l,function(c,d){c&&d&&(f[(0,i.camelCase)(c,u)]=d)}),f}return s.default=s,Oa=s,Oa}var LC=DC();const RC=$l(LC),Vb=Kb("end"),Th=Kb("start");function Kb(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function OC(e){const r=Th(e),i=Vb(e);if(r&&i)return{start:r,end:i}}function Ua(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?iv(e.position):"start"in e||"end"in e?iv(e):"line"in e||"column"in e?ih(e):""}function ih(e){return sv(e&&e.line)+":"+sv(e&&e.column)}function iv(e){return ih(e&&e.start)+"-"+ih(e&&e.end)}function sv(e){return e&&typeof e=="number"?e:1}class hn extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let l="",u={},f=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?l=r:!u.cause&&r&&(f=!0,l=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const 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=Ua(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=f&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const Ah={}.hasOwnProperty,MC=new Map,IC=/[A-Z]/g,BC=new Set(["table","tbody","thead","tfoot","tr"]),zC=new Set(["td","th"]),Yb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HC(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=VC(i,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=GC(i,r.jsx,r.jsxs)}const l={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Xl:Gb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Xb(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Xb(e,r,i){if(r.type==="element")return PC(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return FC(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return $C(e,r,i);if(r.type==="mdxjsEsm")return UC(e,r);if(r.type==="root")return qC(e,r,i);if(r.type==="text")return WC(e,r)}function PC(e,r,i){const s=e.schema;let l=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Xl,e.schema=l),e.ancestors.push(r);const u=Qb(e,r.tagName,!1),f=KC(e,r);let c=Lh(e,r);return BC.has(r.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!vC(d):!0})),Zb(e,f,u,r),Dh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function FC(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Xa(e,r.position)}function UC(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Xa(e,r.position)}function $C(e,r,i){const s=e.schema;let l=s;r.name==="svg"&&s.space==="html"&&(l=Xl,e.schema=l),e.ancestors.push(r);const u=r.name===null?e.Fragment:Qb(e,r.name,!0),f=YC(e,r),c=Lh(e,r);return Zb(e,f,u,r),Dh(f,c),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function qC(e,r,i){const s={};return Dh(s,Lh(e,r)),e.create(r,e.Fragment,s,i)}function WC(e,r){return r.value}function Zb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Dh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function GC(e,r,i){return s;function s(l,u,f,c){const p=Array.isArray(f.children)?i:r;return c?p(u,f,c):p(u,f)}}function VC(e,r){return i;function i(s,l,u,f){const c=Array.isArray(u.children),d=Th(s);return r(l,u,f,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function KC(e,r){const i={};let s,l;for(l in r.properties)if(l!=="children"&&Ah.call(r.properties,l)){const u=XC(e,l,r.properties[l]);if(u){const[f,c]=u;e.tableCellAlignToStyle&&f==="align"&&typeof c=="string"&&zC.has(r.tagName)?s=c:i[f]=c}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function YC(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const f=u.expression;f.type;const c=f.properties[0];c.type,Object.assign(i,e.evaluater.evaluateExpression(c.argument))}else Xa(e,r.position);else{const l=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const c=s.value.data.estree.body[0];c.type,u=e.evaluater.evaluateExpression(c.expression)}else Xa(e,r.position);else u=s.value===null?!0:s.value;i[l]=u}return i}function Lh(e,r){const i=[];let s=-1;const l=e.passKeys?new Map:MC;for(;++s<r.children.length;){const u=r.children[s];let f;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const p=l.get(d)||0;f=d+"-"+p,l.set(d,p+1)}}const c=Xb(e,u,f);c!==void 0&&i.push(c)}return i}function XC(e,r,i){const s=Wb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?fC(i):jC(i)),s.property==="style"){let l=typeof i=="object"?i:ZC(e,String(i));return e.stylePropertyNameCase==="css"&&(l=QC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?SC[s.property]||s.property:s.attribute,i]}}function ZC(e,r){try{return RC(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,l=new hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Yb+"#cannot-parse-style-attribute",l}}function Qb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const l=r.split(".");let u=-1,f;for(;++u<l.length;){const c=Yx(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};f=f?{type:"MemberExpression",object:f,property:c,computed:!!(u&&c.type==="Literal"),optional:!1}:c}s=f}else s=Yx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const l=s.value;return Ah.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Xa(e)}function Xa(e,r){const i=new hn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Yb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function QC(e){const r={};let i;for(i in e)Ah.call(e,i)&&(r[JC(i)]=e[i]);return r}function JC(e){let r=e.replace(IC,e2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function e2(e){return"-"+e.toLowerCase()}const Md={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},t2={};function Rh(e,r){const i=t2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Jb(e,s,l)}function Jb(e,r,i){if(n2(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return av(e.children,r,i)}return Array.isArray(e)?av(e,r,i):""}function av(e,r,i){const s=[];let l=-1;for(;++l<e.length;)s[l]=Jb(e[l],r,i);return s.join("")}function n2(e){return!!(e&&typeof e=="object")}const ov=document.createElement("i");function Za(e){const r="&"+e+";";ov.innerHTML=r;const i=ov.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Mn(e,r,i,s){const l=e.length;let u=0,f;if(r<0?r=-r>l?0:l+r:r=r>l?l:r,i=i>0?i:0,s.length<1e4)f=Array.from(s),f.unshift(r,i),e.splice(...f);else for(i&&e.splice(r,i);u<s.length;)f=s.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function Vn(e,r){return e.length>0?(Mn(e,e.length,0,r),e):r}const lv={}.hasOwnProperty;function ey(e){const r={};let i=-1;for(;++i<e.length;)r2(r,e[i]);return r}function r2(e,r){let i;for(i in r){const l=(lv.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){lv.call(l,f)||(l[f]=[]);const c=u[f];i2(l[f],Array.isArray(c)?c:c?[c]:[])}}}function i2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Mn(e,0,0,s)}function ty(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pn=oi(/[A-Za-z]/),dn=oi(/[\dA-Za-z]/),s2=oi(/[#-'*+\--9=?A-Z^-~]/);function Bl(e){return e!==null&&(e<32||e===127)}const sh=oi(/\d/),a2=oi(/[\dA-Fa-f]/),o2=oi(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const Zl=oi(new RegExp("\\p{P}|\\p{S}","u")),Ri=oi(/\s/);function oi(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Is(e){const r=[];let i=-1,s=0,l=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&dn(e.charCodeAt(i+1))&&dn(e.charCodeAt(i+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const c=e.charCodeAt(i+1);u<56320&&c>56319&&c<57344?(f=String.fromCharCode(u,c),l=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(s,i),encodeURIComponent(f)),s=i+l+1,f=""),l&&(i+=l,l=0)}return r.join("")+e.slice(s)}function it(e,r,i,s){const l=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return Je(d)?(e.enter(i),c(d)):r(d)}function c(d){return Je(d)&&u++<l?(e.consume(d),c):(e.exit(i),r(d))}}const l2={tokenize:c2};function c2(e){const r=e.attempt(this.parser.constructs.contentInitial,s,l);let i;return r;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),it(e,r,"linePrefix")}function l(c){return e.enter("paragraph"),u(c)}function u(c){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,f(c)}function f(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),f)}}const u2={tokenize:d2},cv={tokenize:h2};function d2(e){const r=this,i=[];let s=0,l,u,f;return c;function c(S){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,l&&y();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}v(s);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return Mn(r.events,A+1,0,r.events.slice(j)),r.events.length=D,p(S)}return c(S)}function p(S){if(s===i.length){if(!l)return x(S);if(l.currentConstruct&&l.currentConstruct.concrete)return E(S);r.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(cv,g,m)(S)}function g(S){return l&&y(),v(s),x(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,E(S)}function x(S){return r.containerState={},e.attempt(cv,_,E)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),x(S)}function E(S){if(S===null){l&&y(),v(0),e.consume(S);return}return l=l||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(S);return}return Pe(S)?(e.consume(S),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,c):(e.consume(S),C)}function b(S,j){const A=r.sliceStream(S);if(j&&A.push(null),S.previous=u,u&&(u.next=S),u=S,l.defineSkip(S.start),l.write(A),r.parser.lazy[S.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<f&&(!l.events[N][1].end||l.events[N][1].end.offset>f))return;const D=r.events.length;let T=D,I,z;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){z=r.events[T][1].end;break}I=!0}for(v(s),N=D;N<r.events.length;)r.events[N][1].end={...z},N++;Mn(r.events,T+1,0,r.events.slice(D)),r.events.length=N}}function v(S){let j=i.length;for(;j-- >S;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=S}function y(){l.write([null]),u=void 0,l=void 0,r.containerState._closeFlow=void 0}}function h2(e,r,i){return it(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rs(e){if(e===null||xt(e)||Ri(e))return 1;if(Zl(e))return 2}function Ql(e,r,i){const s=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const ah={name:"attention",resolveAll:f2,tokenize:p2};function f2(e,r){let i=-1,s,l,u,f,c,d,p,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},x={...e[i][1].start};uv(m,-d),uv(x,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:x},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},l={type:d>1?"strong":"emphasis",start:{...f.start},end:{...c.end}},e[s][1].end={...f.start},e[i][1].start={...c.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Vn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=Vn(p,[["enter",l,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=Vn(p,Ql(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=Vn(p,[["exit",u,r],["enter",c,r],["exit",c,r],["exit",l,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=Vn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Mn(e,s-1,i-s+3,p),i=s+p.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function p2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Rs(s);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===u)return e.consume(d),c;const p=e.exit("attentionSequence"),g=Rs(d),m=!g||g===2&&l||i.includes(d),x=!l||l===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(l||!x)),p._close=!!(u===42?x:x&&(g||!m)),r(d)}}function uv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const m2={name:"autolink",tokenize:g2};function g2(e,r,i){let s=0;return l;function l(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return pn(_)?(e.consume(_),f):_===64?i(_):p(_)}function f(_){return _===43||_===45||_===46||dn(_)?(s=1,c(_)):p(_)}function c(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||dn(_))&&s++<32?(e.consume(_),c):(s=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Bl(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):s2(_)?(e.consume(_),p):i(_)}function g(_){return dn(_)?m(_):i(_)}function m(_){return _===46?(e.consume(_),s=0,g):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):x(_)}function x(_){if((_===45||dn(_))&&s++<63){const E=_===45?x:m;return e.consume(_),E}return i(_)}}const io={partial:!0,tokenize:x2};function x2(e,r,i){return s;function s(u){return Je(u)?it(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Pe(u)?r(u):i(u)}}const ny={continuation:{tokenize:b2},exit:y2,name:"blockQuote",tokenize:v2};function v2(e,r,i){const s=this;return l;function l(f){if(f===62){const c=s.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return i(f)}function u(f){return Je(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function b2(e,r,i){const s=this;return l;function l(f){return Je(f)?it(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(ny,r,i)(f)}}function y2(e){e.exit("blockQuote")}const ry={name:"characterEscape",tokenize:_2};function _2(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return o2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const iy={name:"characterReference",tokenize:S2};function S2(e,r,i){const s=this;let l=0,u,f;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"),p):(e.enter("characterReferenceValue"),u=31,f=dn,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,f=a2,g):(e.enter("characterReferenceValue"),u=7,f=sh,g(m))}function g(m){if(m===59&&l){const x=e.exit("characterReferenceValue");return f===dn&&!Za(s.sliceSerialize(x))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&l++<u?(e.consume(m),g):i(m)}}const dv={partial:!0,tokenize:C2},hv={concrete:!0,name:"codeFenced",tokenize:w2};function w2(e,r,i){const s=this,l={partial:!0,tokenize:A};let u=0,f=0,c;return d;function d(N){return p(N)}function p(N){const D=s.events[s.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,c=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===c?(f++,e.consume(N),g):f<3?i(N):(e.exit("codeFencedFenceSequence"),Je(N)?it(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Pe(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(dv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):Je(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,_,"whitespace")(N)):N===96&&N===c?i(N):(e.consume(N),x)}function _(N){return N===null||Pe(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Pe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===c?i(N):(e.consume(N),E)}function C(N){return e.attempt(l,j,b)(N)}function b(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v}function v(N){return u>0&&Je(N)?it(e,y,"linePrefix",u+1)(N):y(N)}function y(N){return N===null||Pe(N)?e.check(dv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||Pe(N)?(e.exit("codeFlowValue"),y(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,D,T){let I=0;return z;function z(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),q}function q(U){return N.enter("codeFencedFence"),Je(U)?it(N,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):K(U)}function K(U){return U===c?(N.enter("codeFencedFenceSequence"),W(U)):T(U)}function W(U){return U===c?(I++,N.consume(U),W):I>=f?(N.exit("codeFencedFenceSequence"),Je(U)?it(N,R,"whitespace")(U):R(U)):T(U)}function R(U){return U===null||Pe(U)?(N.exit("codeFencedFence"),D(U)):T(U)}}}function C2(e,r,i){const s=this;return l;function l(f){return f===null?i(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}const Id={name:"codeIndented",tokenize:E2},k2={partial:!0,tokenize:j2};function E2(e,r,i){const s=this;return l;function l(p){return e.enter("codeIndented"),it(e,u,"linePrefix",5)(p)}function u(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):i(p)}function f(p){return p===null?d(p):Pe(p)?e.attempt(k2,f,d)(p):(e.enter("codeFlowValue"),c(p))}function c(p){return p===null||Pe(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),c)}function d(p){return e.exit("codeIndented"),r(p)}}function j2(e,r,i){const s=this;return l;function l(f){return s.parser.lazy[s.now().line]?i(f):Pe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):it(e,u,"linePrefix",5)(f)}function u(f){const c=s.events[s.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(f):Pe(f)?l(f):i(f)}}const N2={name:"codeText",previous:A2,resolve:T2,tokenize:D2};function T2(e){let r=e.length-4,i=3,s,l;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)l===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(l=s):(s===r||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),r-=s-l-2,s=l+2),l=void 0);return e}function A2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function D2(e,r,i){let s=0,l,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),s++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),l=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),l++,g):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class L2{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const l=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Ma(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Ma(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Ma(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const i=this.left.splice(r,Number.POSITIVE_INFINITY);Ma(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Ma(this.left,i.reverse())}}}function Ma(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function sy(e){const r={};let i=-1,s,l,u,f,c,d,p;const g=new L2(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,R2(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,l=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),f[1].type="lineEnding",l=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;l&&(s[1].end={...g.get(l)[1].start},c=g.slice(l,i),c.unshift(s),g.splice(l,i-l+1,c))}}return Mn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function R2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let l=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const c=f.events,d=[],p={};let g,m,x=-1,_=i,E=0,C=0;const b=[C];for(;_;){for(;e.get(++l)[1]!==_;);u.push(l),_._tokenizer||(g=s.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=i;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(C=x+1,b.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):b.pop(),x=b.length;x--;){const v=c.slice(b[x],b[x+1]),y=u.pop();d.push([y,y+v.length-1]),e.splice(y,2,v)}for(d.reverse(),x=-1;++x<d.length;)p[E+d[x][0]]=E+d[x][1],E+=d[x][1]-d[x][0]-1;return p}const O2={resolve:I2,tokenize:B2},M2={partial:!0,tokenize:z2};function I2(e){return sy(e),e}function B2(e,r){let i;return s;function s(c){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),l(c)}function l(c){return c===null?u(c):Pe(c)?e.check(M2,f,u)(c):(e.consume(c),l)}function u(c){return e.exit("chunkContent"),e.exit("content"),r(c)}function f(c){return e.consume(c),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,l}}function z2(e,r,i){const s=this;return l;function l(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),it(e,u,"linePrefix")}function u(f){if(f===null||Pe(f))return i(f);const c=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function ay(e,r,i,s,l,u,f,c,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(v){return v===60?(e.enter(s),e.enter(l),e.enter(u),e.consume(v),e.exit(u),x):v===null||v===32||v===41||Bl(v)?i(v):(e.enter(s),e.enter(f),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(v))}function x(v){return v===62?(e.enter(u),e.consume(v),e.exit(u),e.exit(l),e.exit(s),r):(e.enter(c),e.enter("chunkString",{contentType:"string"}),_(v))}function _(v){return v===62?(e.exit("chunkString"),e.exit(c),x(v)):v===null||v===60||Pe(v)?i(v):(e.consume(v),v===92?E:_)}function E(v){return v===60||v===62||v===92?(e.consume(v),_):_(v)}function C(v){return!g&&(v===null||v===41||xt(v))?(e.exit("chunkString"),e.exit(c),e.exit(f),e.exit(s),r(v)):g<p&&v===40?(e.consume(v),g++,C):v===41?(e.consume(v),g--,C):v===null||v===32||v===40||Bl(v)?i(v):(e.consume(v),v===92?b:C)}function b(v){return v===40||v===41||v===92?(e.consume(v),C):C(v)}}function oy(e,r,i,s,l,u){const f=this;let c=0,d;return p;function p(_){return e.enter(s),e.enter(l),e.consume(_),e.exit(l),e.enter(u),g}function g(_){return c>999||_===null||_===91||_===93&&!d||_===94&&!c&&"_hiddenFootnoteSupport"in f.parser.constructs?i(_):_===93?(e.exit(u),e.enter(l),e.consume(_),e.exit(l),e.exit(s),r):Pe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||Pe(_)||c++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!Je(_)),_===92?x:m)}function x(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function ly(e,r,i,s,l,u){let f;return c;function c(x){return x===34||x===39||x===40?(e.enter(s),e.enter(l),e.consume(x),e.exit(l),f=x===40?41:x,d):i(x)}function d(x){return x===f?(e.enter(l),e.consume(x),e.exit(l),e.exit(s),r):(e.enter(u),p(x))}function p(x){return x===f?(e.exit(u),d(f)):x===null?i(x):Pe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),it(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===f||x===null||Pe(x)?(e.exit("chunkString"),p(x)):(e.consume(x),x===92?m:g)}function m(x){return x===f||x===92?(e.consume(x),g):g(x)}}function $a(e,r){let i;return s;function s(l){return Pe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,s):Je(l)?it(e,s,i?"linePrefix":"lineSuffix")(l):r(l)}}const H2={name:"definition",tokenize:F2},P2={partial:!0,tokenize:U2};function F2(e,r,i){const s=this;let l;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return oy.call(s,e,c,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function c(_){return l=Jn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):i(_)}function d(_){return xt(_)?$a(e,p)(_):p(_)}function p(_){return ay(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(P2,m,m)(_)}function m(_){return Je(_)?it(e,x,"whitespace")(_):x(_)}function x(_){return _===null||Pe(_)?(e.exit("definition"),s.parser.defined.push(l),r(_)):i(_)}}function U2(e,r,i){return s;function s(c){return xt(c)?$a(e,l)(c):i(c)}function l(c){return ly(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function u(c){return Je(c)?it(e,f,"whitespace")(c):f(c)}function f(c){return c===null||Pe(c)?r(c):i(c)}}const $2={name:"hardBreakEscape",tokenize:q2};function q2(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Pe(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const W2={name:"headingAtx",resolve:G2,tokenize:V2};function G2(e,r){let i=e.length-2,s=3,l,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Mn(e,s,i-s+1,[["enter",l,r],["enter",u,r],["exit",u,r],["exit",l,r]])),e}function V2(e,r,i){let s=0;return l;function l(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&s++<6?(e.consume(g),f):g===null||xt(g)?(e.exit("atxHeadingSequence"),c(g)):i(g)}function c(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Pe(g)?(e.exit("atxHeading"),r(g)):Je(g)?it(e,c,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),c(g))}function p(g){return g===null||g===35||xt(g)?(e.exit("atxHeadingText"),c(g)):(e.consume(g),p)}}const K2=["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"],fv=["pre","script","style","textarea"],Y2={concrete:!0,name:"htmlFlow",resolveTo:Q2,tokenize:J2},X2={partial:!0,tokenize:tk},Z2={partial:!0,tokenize:ek};function Q2(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 J2(e,r,i){const s=this;let l,u,f,c,d;return p;function p(F){return g(F)}function g(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),x):F===47?(e.consume(F),u=!0,C):F===63?(e.consume(F),l=3,s.interrupt?r:L):pn(F)?(e.consume(F),f=String.fromCharCode(F),b):i(F)}function x(F){return F===45?(e.consume(F),l=2,_):F===91?(e.consume(F),l=5,c=0,E):pn(F)?(e.consume(F),l=4,s.interrupt?r:L):i(F)}function _(F){return F===45?(e.consume(F),s.interrupt?r:L):i(F)}function E(F){const re="CDATA[";return F===re.charCodeAt(c++)?(e.consume(F),c===re.length?s.interrupt?r:K:E):i(F)}function C(F){return pn(F)?(e.consume(F),f=String.fromCharCode(F),b):i(F)}function b(F){if(F===null||F===47||F===62||xt(F)){const re=F===47,Q=f.toLowerCase();return!re&&!u&&fv.includes(Q)?(l=1,s.interrupt?r(F):K(F)):K2.includes(f.toLowerCase())?(l=6,re?(e.consume(F),v):s.interrupt?r(F):K(F)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?y(F):S(F))}return F===45||dn(F)?(e.consume(F),f+=String.fromCharCode(F),b):i(F)}function v(F){return F===62?(e.consume(F),s.interrupt?r:K):i(F)}function y(F){return Je(F)?(e.consume(F),y):z(F)}function S(F){return F===47?(e.consume(F),z):F===58||F===95||pn(F)?(e.consume(F),j):Je(F)?(e.consume(F),S):z(F)}function j(F){return F===45||F===46||F===58||F===95||dn(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):Je(F)?(e.consume(F),A):S(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),d=F,D):Je(F)?(e.consume(F),N):T(F)}function D(F){return F===d?(e.consume(F),d=null,I):F===null||Pe(F)?i(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||xt(F)?A(F):(e.consume(F),T)}function I(F){return F===47||F===62||Je(F)?S(F):i(F)}function z(F){return F===62?(e.consume(F),q):i(F)}function q(F){return F===null||Pe(F)?K(F):Je(F)?(e.consume(F),q):i(F)}function K(F){return F===45&&l===2?(e.consume(F),H):F===60&&l===1?(e.consume(F),X):F===62&&l===4?(e.consume(F),M):F===63&&l===3?(e.consume(F),L):F===93&&l===5?(e.consume(F),B):Pe(F)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(X2,V,W)(F)):F===null||Pe(F)?(e.exit("htmlFlowData"),W(F)):(e.consume(F),K)}function W(F){return e.check(Z2,R,V)(F)}function R(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||Pe(F)?W(F):(e.enter("htmlFlowData"),K(F))}function H(F){return F===45?(e.consume(F),L):K(F)}function X(F){return F===47?(e.consume(F),f="",Z):K(F)}function Z(F){if(F===62){const re=f.toLowerCase();return fv.includes(re)?(e.consume(F),M):K(F)}return pn(F)&&f.length<8?(e.consume(F),f+=String.fromCharCode(F),Z):K(F)}function B(F){return F===93?(e.consume(F),L):K(F)}function L(F){return F===62?(e.consume(F),M):F===45&&l===2?(e.consume(F),L):K(F)}function M(F){return F===null||Pe(F)?(e.exit("htmlFlowData"),V(F)):(e.consume(F),M)}function V(F){return e.exit("htmlFlow"),r(F)}}function ek(e,r,i){const s=this;return l;function l(f){return Pe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):i(f)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}function tk(e,r,i){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(io,r,i)}}const nk={name:"htmlText",tokenize:rk};function rk(e,r,i){const s=this;let l,u,f;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),p):L===47?(e.consume(L),A):L===63?(e.consume(L),S):pn(L)?(e.consume(L),T):i(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,E):pn(L)?(e.consume(L),y):i(L)}function g(L){return L===45?(e.consume(L),_):i(L)}function m(L){return L===null?i(L):L===45?(e.consume(L),x):Pe(L)?(f=m,X(L)):(e.consume(L),m)}function x(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?H(L):L===45?x(L):m(L)}function E(L){const M="CDATA[";return L===M.charCodeAt(u++)?(e.consume(L),u===M.length?C:E):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),b):Pe(L)?(f=C,X(L)):(e.consume(L),C)}function b(L){return L===93?(e.consume(L),v):C(L)}function v(L){return L===62?H(L):L===93?(e.consume(L),v):C(L)}function y(L){return L===null||L===62?H(L):Pe(L)?(f=y,X(L)):(e.consume(L),y)}function S(L){return L===null?i(L):L===63?(e.consume(L),j):Pe(L)?(f=S,X(L)):(e.consume(L),S)}function j(L){return L===62?H(L):S(L)}function A(L){return pn(L)?(e.consume(L),N):i(L)}function N(L){return L===45||dn(L)?(e.consume(L),N):D(L)}function D(L){return Pe(L)?(f=D,X(L)):Je(L)?(e.consume(L),D):H(L)}function T(L){return L===45||dn(L)?(e.consume(L),T):L===47||L===62||xt(L)?I(L):i(L)}function I(L){return L===47?(e.consume(L),H):L===58||L===95||pn(L)?(e.consume(L),z):Pe(L)?(f=I,X(L)):Je(L)?(e.consume(L),I):H(L)}function z(L){return L===45||L===46||L===58||L===95||dn(L)?(e.consume(L),z):q(L)}function q(L){return L===61?(e.consume(L),K):Pe(L)?(f=q,X(L)):Je(L)?(e.consume(L),q):I(L)}function K(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(e.consume(L),l=L,W):Pe(L)?(f=K,X(L)):Je(L)?(e.consume(L),K):(e.consume(L),R)}function W(L){return L===l?(e.consume(L),l=void 0,U):L===null?i(L):Pe(L)?(f=W,X(L)):(e.consume(L),W)}function R(L){return L===null||L===34||L===39||L===60||L===61||L===96?i(L):L===47||L===62||xt(L)?I(L):(e.consume(L),R)}function U(L){return L===47||L===62||xt(L)?I(L):i(L)}function H(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):i(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Z}function Z(L){return Je(L)?it(e,B,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):B(L)}function B(L){return e.enter("htmlTextData"),f(L)}}const Oh={name:"labelEnd",resolveAll:ok,resolveTo:lk,tokenize:ck},ik={tokenize:uk},sk={tokenize:dk},ak={tokenize:hk};function ok(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",r+=l}}return e.length!==i.length&&Mn(e,0,e.length,i),e}function lk(e,r){let i=e.length,s=0,l,u,f,c;for(;i--;)if(l=e[i][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[i][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=i,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(f=i);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[u][1].start},end:{...e[f][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[f-2][1].start}};return c=[["enter",d,r],["enter",p,r]],c=Vn(c,e.slice(u+1,u+s+3)),c=Vn(c,[["enter",g,r]]),c=Vn(c,Ql(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),c=Vn(c,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),c=Vn(c,e.slice(f+1)),c=Vn(c,[["exit",d,r]]),Mn(e,u,e.length,c),e}function ck(e,r,i){const s=this;let l=s.events.length,u,f;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){u=s.events[l][1];break}return c;function c(x){return u?u._inactive?m(x):(f=s.parser.defined.includes(Jn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):i(x)}function d(x){return x===40?e.attempt(ik,g,f?g:m)(x):x===91?e.attempt(sk,g,f?p:m)(x):f?g(x):m(x)}function p(x){return e.attempt(ak,g,m)(x)}function g(x){return r(x)}function m(x){return u._balanced=!0,i(x)}}function uk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),l}function l(m){return xt(m)?$a(e,u)(m):u(m)}function u(m){return m===41?g(m):ay(e,f,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return xt(m)?$a(e,d)(m):g(m)}function c(m){return i(m)}function d(m){return m===34||m===39||m===40?ly(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return xt(m)?$a(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function dk(e,r,i){const s=this;return l;function l(c){return oy.call(s,e,u,f,"reference","referenceMarker","referenceString")(c)}function u(c){return s.parser.defined.includes(Jn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(c):i(c)}function f(c){return i(c)}}function hk(e,r,i){return s;function s(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):i(u)}}const fk={name:"labelStartImage",resolveAll:Oh.resolveAll,tokenize:pk};function pk(e,r,i){const s=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"),f):i(c)}function f(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(c):r(c)}}const mk={name:"labelStartLink",resolveAll:Oh.resolveAll,tokenize:gk};function gk(e,r,i){const s=this;return l;function l(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(f):r(f)}}const Bd={name:"lineEnding",tokenize:xk};function xk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),it(e,r,"linePrefix")}}const Dl={name:"thematicBreak",tokenize:vk};function vk(e,r,i){let s=0,l;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return l=p,c(p)}function c(p){return p===l?(e.enter("thematicBreakSequence"),d(p)):s>=3&&(p===null||Pe(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===l?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),Je(p)?it(e,c,"whitespace")(p):c(p))}}const Sn={continuation:{tokenize:Sk},exit:Ck,name:"list",tokenize:_k},bk={partial:!0,tokenize:kk},yk={partial:!0,tokenize:wk};function _k(e,r,i){const s=this,l=s.events[s.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,f=0;return c;function c(_){const E=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:sh(_)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Dl,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return sh(_)&&++f<10?(e.consume(_),d):(!s.interrupt||f<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):i(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(io,s.interrupt?i:g,e.attempt(bk,x,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,x(_)}function m(_){return Je(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),x):i(_)}function x(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function Sk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(io,l,u);function l(c){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,it(e,r,"listItemIndent",s.containerState.size+1)(c)}function u(c){return s.containerState.furtherBlankLines||!Je(c)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(c)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(yk,r,f)(c))}function f(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,it(e,e.attempt(Sn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function wk(e,r,i){const s=this;return it(e,l,"listItemIndent",s.containerState.size+1);function l(u){const f=s.events[s.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===s.containerState.size?r(u):i(u)}}function Ck(e){e.exit(this.containerState.type)}function kk(e,r,i){const s=this;return it(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const f=s.events[s.events.length-1];return!Je(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const pv={name:"setextUnderline",resolveTo:Ek,tokenize:jk};function Ek(e,r){let i=e.length,s,l,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(l=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const f={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",f,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=f,e.push(["exit",f,r]),e}function jk(e,r,i){const s=this;let l;return u;function u(p){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),l=p,f(p)):i(p)}function f(p){return e.enter("setextHeadingLineSequence"),c(p)}function c(p){return p===l?(e.consume(p),c):(e.exit("setextHeadingLineSequence"),Je(p)?it(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||Pe(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const Nk={tokenize:Tk};function Tk(e){const r=this,i=e.attempt(io,s,e.attempt(this.parser.constructs.flowInitial,l,it(e,e.attempt(this.parser.constructs.flow,l,e.attempt(O2,l)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const Ak={resolveAll:uy()},Dk=cy("string"),Lk=cy("text");function cy(e){return{resolveAll:uy(e==="text"?Rk:void 0),tokenize:r};function r(i){const s=this,l=this.parser.constructs[e],u=i.attempt(l,f,c);return f;function f(g){return p(g)?u(g):c(g)}function c(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return p(g)?(i.exit("data"),u(g)):(i.consume(g),d)}function p(g){if(g===null)return!0;const m=l[g];let x=-1;if(m)for(;++x<m.length;){const _=m[x];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function uy(e){return r;function r(i,s){let l=-1,u;for(;++l<=i.length;)u===void 0?i[l]&&i[l][1].type==="data"&&(u=l,l++):(!i[l]||i[l][1].type!=="data")&&(l!==u+2&&(i[u][1].end=i[l-1][1].end,i.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(i,s):i}}function Rk(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],l=r.sliceStream(s);let u=l.length,f=-1,c=0,d;for(;u--;){const p=l[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)c++,f--;if(f)break;f=-1}else if(p===-2)d=!0,c++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(c=0),c){const p={type:i===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return e}const Ok={42:Sn,43:Sn,45:Sn,48:Sn,49:Sn,50:Sn,51:Sn,52:Sn,53:Sn,54:Sn,55:Sn,56:Sn,57:Sn,62:ny},Mk={91:H2},Ik={[-2]:Id,[-1]:Id,32:Id},Bk={35:W2,42:Dl,45:[pv,Dl],60:Y2,61:pv,95:Dl,96:hv,126:hv},zk={38:iy,92:ry},Hk={[-5]:Bd,[-4]:Bd,[-3]:Bd,33:fk,38:iy,42:ah,60:[m2,nk],91:mk,92:[$2,ry],93:Oh,95:ah,96:N2},Pk={null:[ah,Ak]},Fk={null:[42,95]},Uk={null:[]},$k=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fk,contentInitial:Mk,disable:Uk,document:Ok,flow:Bk,flowInitial:Ik,insideSpan:Pk,string:zk,text:Hk},Symbol.toStringTag,{value:"Module"}));function qk(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const l={},u=[];let f=[],c=[];const d={attempt:D(A),check:D(N),consume:y,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:x,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(q){return f=Vn(f,q),b(),f[f.length-1]!==null?[]:(T(r,0),p.events=Ql(u,p.events,p),p.events)}function x(q,K){return Gk(_(q),K)}function _(q){return Wk(f,q)}function E(){const{_bufferIndex:q,_index:K,line:W,column:R,offset:U}=s;return{_bufferIndex:q,_index:K,line:W,column:R,offset:U}}function C(q){l[q.line]=q.column,z()}function b(){let q;for(;s._index<f.length;){const K=f[s._index];if(typeof K=="string")for(q=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===q&&s._bufferIndex<K.length;)v(K.charCodeAt(s._bufferIndex));else v(K)}}function v(q){g=g(q)}function y(q){Pe(q)?(s.line++,s.column=1,s.offset+=q===-3?2:1,z()):q!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===f[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=q}function S(q,K){const W=K||{};return W.type=q,W.start=E(),p.events.push(["enter",W,p]),c.push(W),W}function j(q){const K=c.pop();return K.end=E(),p.events.push(["exit",K,p]),K}function A(q,K){T(q,K.from)}function N(q,K){K.restore()}function D(q,K){return W;function W(R,U,H){let X,Z,B,L;return Array.isArray(R)?V(R):"tokenize"in R?V([R]):M(R);function M(ee){return Y;function Y($){const ae=$!==null&&ee[$],ne=$!==null&&ee.null,ve=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return V(ve)($)}}function V(ee){return X=ee,Z=0,ee.length===0?H:F(ee[Z])}function F(ee){return Y;function Y($){return L=I(),B=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Q():ee.tokenize.call(K?Object.assign(Object.create(p),K):p,d,re,Q)($)}}function re(ee){return q(B,L),U}function Q(ee){return L.restore(),++Z<X.length?F(X[Z]):H}}}function T(q,K){q.resolveAll&&!u.includes(q)&&u.push(q),q.resolve&&Mn(p.events,K,p.events.length-K,q.resolve(p.events.slice(K),p)),q.resolveTo&&(p.events=q.resolveTo(p.events,p))}function I(){const q=E(),K=p.previous,W=p.currentConstruct,R=p.events.length,U=Array.from(c);return{from:R,restore:H};function H(){s=q,p.previous=K,p.currentConstruct=W,p.events.length=R,c=U,z()}}function z(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Wk(e,r){const i=r.start._index,s=r.start._bufferIndex,l=r.end._index,u=r.end._bufferIndex;let f;if(i===l)f=[e[i].slice(s,u)];else{if(f=e.slice(i,l),s>-1){const c=f[0];typeof c=="string"?f[0]=c.slice(s):f.shift()}u>0&&f.push(e[l].slice(0,u))}return f}function Gk(e,r){let i=-1;const s=[];let l;for(;++i<e.length;){const u=e[i];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
93
- `;break}case-3:{f=`\r
94
- `;break}case-2:{f=r?" ":" ";break}case-1:{if(!r&&l)continue;f=" ";break}default:f=String.fromCharCode(u)}l=u===-2,s.push(f)}return s.join("")}function Vk(e){const s={constructs:ey([$k,...(e||{}).extensions||[]]),content:l(l2),defined:[],document:l(u2),flow:l(Nk),lazy:{},string:l(Dk),text:l(Lk)};return s;function l(u){return f;function f(c){return qk(s,u,c)}}}function Kk(e){for(;!sy(e););return e}const mv=/[\0\t\n\r]/g;function Yk(){let e=1,r="",i=!0,s;return l;function l(u,f,c){const d=[];let p,g,m,x,_;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),m=0,r="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(mv.lastIndex=m,p=mv.exec(u),x=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(x),!p){r=u.slice(m);break}if(_===10&&m===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<x&&(d.push(u.slice(m,x)),e+=x-m),_){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}m=x+1}return c&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const Xk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Zk(e){return e.replace(Xk,Qk)}function Qk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),u=l===120||l===88;return ty(i.slice(u?2:1),u?16:10)}return Za(i)||e}const dy={}.hasOwnProperty;function Jk(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),eE(i)(Kk(Vk(i).document().write(Yk()(e,r,!0))))}function eE(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Ne),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(He),blockQuote:u(ne),characterEscape:I,characterReference:I,codeFenced:u(ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ve,f),codeText:u(ye,f),codeTextData:I,data:I,codeFlowValue:I,definition:u(Ae),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Re),hardBreakEscape:u(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(Ee,f),htmlFlowData:I,htmlText:u(Ee,f),htmlTextData:I,image:u(xe),label:f,link:u(Ne),listItem:u(At),listItemValue:x,listOrdered:u($e,m),listUnordered:u($e),paragraph:u(me),reference:F,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(He),strong:u(je),thematicBreak:u(ct)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:$,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ee,characterReference:Y,codeFenced:d(b),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:E,codeFlowValue:z,codeIndented:d(v),codeText:d(U),codeTextData:z,data:z,definition:d(),definitionDestinationString:j,definitionLabelString:y,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(K),hardBreakTrailing:d(K),htmlFlow:d(W),htmlFlowData:z,htmlText:d(R),htmlTextData:z,image:d(X),label:B,labelText:Z,lineEnding:q,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:re,resourceDestinationString:L,resourceTitleString:M,resource:V,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};hy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let _e={type:"root",children:[]};const Te={stack:[_e],tokenStack:[],config:r,enter:c,exit:p,buffer:f,resume:g,data:i},Ie=[];let Ge=-1;for(;++Ge<ue.length;)if(ue[Ge][1].type==="listOrdered"||ue[Ge][1].type==="listUnordered")if(ue[Ge][0]==="enter")Ie.push(Ge);else{const kt=Ie.pop();Ge=l(ue,kt,Ge)}for(Ge=-1;++Ge<ue.length;){const kt=r[ue[Ge][0]];dy.call(kt,ue[Ge][1].type)&&kt[ue[Ge][1].type].call(Object.assign({sliceSerialize:ue[Ge][2].sliceSerialize},Te),ue[Ge][1])}if(Te.tokenStack.length>0){const kt=Te.tokenStack[Te.tokenStack.length-1];(kt[1]||gv).call(Te,void 0,kt[0])}for(_e.position={start:ri(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ri(ue.length>0?ue[ue.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(ue,_e,Te){let Ie=_e-1,Ge=-1,kt=!1,Xe,Dt,Et,Yt;for(;++Ie<=Te;){const st=ue[Ie];switch(st[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{st[0]==="enter"?Ge++:Ge--,Yt=void 0;break}case"lineEndingBlank":{st[0]==="enter"&&(Xe&&!Yt&&!Ge&&!Et&&(Et=Ie),Yt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Yt=void 0}if(!Ge&&st[0]==="enter"&&st[1].type==="listItemPrefix"||Ge===-1&&st[0]==="exit"&&(st[1].type==="listUnordered"||st[1].type==="listOrdered")){if(Xe){let In=Ie;for(Dt=void 0;In--;){const en=ue[In];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;Dt&&(ue[Dt][1].type="lineEndingBlank",kt=!0),en[1].type="lineEnding",Dt=In}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}Et&&(!Dt||Et<Dt)&&(Xe._spread=!0),Xe.end=Object.assign({},Dt?ue[Dt][1].start:st[1].end),ue.splice(Dt||Ie,0,["exit",Xe,st[2]]),Ie++,Te++}if(st[1].type==="listItemPrefix"){const In={type:"listItem",_spread:!1,start:Object.assign({},st[1].start),end:void 0};Xe=In,ue.splice(Ie,0,["enter",In,st[2]]),Ie++,Te++,Et=void 0,Yt=!0}}}return ue[_e][1]._spread=kt,Te}function u(ue,_e){return Te;function Te(Ie){c.call(this,ue(Ie),Ie),_e&&_e.call(this,Ie)}}function f(){this.stack.push({type:"fragment",children:[]})}function c(ue,_e,Te){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([_e,Te||void 0]),ue.position={start:ri(_e.start),end:void 0}}function d(ue){return _e;function _e(Te){ue&&ue.call(this,Te),p.call(this,Te)}}function p(ue,_e){const Te=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==ue.type&&(_e?_e.call(this,ue,Ie[0]):(Ie[1]||gv).call(this,ue,Ie[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Ua({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=ri(ue.end)}function g(){return Rh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ue}function E(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function y(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Jn(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function j(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function A(ue){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Te=this.sliceSerialize(ue).length;_e.depth=Te}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ue){const Te=this.stack[this.stack.length-1].children;let Ie=Te[Te.length-1];(!Ie||Ie.type!=="text")&&(Ie=Oe(),Ie.position={start:ri(ue.start),end:void 0},Te.push(Ie)),this.stack.push(Ie)}function z(ue){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ue),_e.position.end=ri(ue.end)}function q(ue){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=_e.children[_e.children.length-1];Te.position.end=ri(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(I.call(this,ue),z.call(this,ue))}function K(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function R(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function U(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function H(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function X(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Z(ue){const _e=this.sliceSerialize(ue),Te=this.stack[this.stack.length-2];Te.label=Zk(_e),Te.identifier=Jn(_e).toLowerCase()}function B(){const ue=this.stack[this.stack.length-1],_e=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Ie=ue.children;Te.children=Ie}else Te.alt=_e}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function M(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function V(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function re(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Jn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Q(ue){this.data.characterReferenceType=ue.type}function ee(ue){const _e=this.sliceSerialize(ue),Te=this.data.characterReferenceType;let Ie;Te?(Ie=ty(_e,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=Za(_e);const Ge=this.stack[this.stack.length-1];Ge.value+=Ie}function Y(ue){const _e=this.stack.pop();_e.position.end=ri(ue.end)}function $(ue){z.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ue)}function ae(ue){z.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ue)}function ne(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function Ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Re(){return{type:"emphasis",children:[]}}function He(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Ne(){return{type:"link",title:null,url:"",children:[]}}function $e(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function At(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function me(){return{type:"paragraph",children:[]}}function je(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function ri(e){return{line:e.line,column:e.column,offset:e.offset}}function hy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?hy(e,s):tE(e,s)}}function tE(e,r){let i;for(i in r)if(dy.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function gv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Ua({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Ua({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Ua({start:r.start,end:r.end})+") is still open")}function nE(e){const r=this;r.parser=i;function i(s){return Jk(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function rE(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function iE(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
95
- `}]}function sE(e,r){const i=r.value?r.value+`
96
- `:"",s={},l=r.lang?r.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function aE(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function oE(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function lE(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),l=Is(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let f,c=e.footnoteCounts.get(s);c===void 0?(c=0,e.footnoteOrder.push(s),f=e.footnoteOrder.length):f=u+1,c+=1,e.footnoteCounts.set(s,c);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+l,id:i+"fnref-"+l+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};e.patch(r,d);const p={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,p),e.applyData(r,p)}function cE(e,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function uE(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function fy(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const l=e.all(r),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const f=l[l.length-1];return f&&f.type==="text"?f.value+=s:l.push({type:"text",value:s}),l}function dE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return fy(e,r);const l={src:Is(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,u),e.applyData(r,u)}function hE(e,r){const i={src:Is(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(r,s),e.applyData(r,s)}function fE(e,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(r,s),e.applyData(r,s)}function pE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return fy(e,r);const l={href:Is(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const u={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function mE(e,r){const i={href:Is(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function gE(e,r,i){const s=e.all(r),l=i?xE(i):py(r),u={},f=[];if(typeof r.checked=="boolean"){const g=s[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let c=-1;for(;++c<s.length;){const g=s[c];(l||c!==0||g.type!=="element"||g.tagName!=="p")&&f.push({type:"text",value:`
97
- `}),g.type==="element"&&g.tagName==="p"&&!l?f.push(...g.children):f.push(g)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&f.push({type:"text",value:`
98
- `});const p={type:"element",tagName:"li",properties:u,children:f};return e.patch(r,p),e.applyData(r,p)}function xE(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const i=e.children;let s=-1;for(;!r&&++s<i.length;)r=py(i[s])}return r}function py(e){const r=e.spread;return r??e.children.length>1}function vE(e,r){const i={},s=e.all(r);let l=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++l<s.length;){const f=s[l];if(f.type==="element"&&f.tagName==="li"&&f.properties&&Array.isArray(f.properties.className)&&f.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,u),e.applyData(r,u)}function bE(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function yE(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function _E(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function SE(e,r){const i=e.all(r),s=i.shift(),l=[];if(s){const f={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],f),l.push(f)}if(i.length>0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},c=Th(r.children[1]),d=Vb(r.children[r.children.length-1]);c&&d&&(f.position={start:c,end:d}),l.push(f)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(r,u),e.applyData(r,u)}function wE(e,r,i){const s=i?i.children:void 0,u=(s?s.indexOf(r):1)===0?"th":"td",f=i&&i.type==="table"?i.align:void 0,c=f?f.length:r.children.length;let d=-1;const p=[];for(;++d<c;){const m=r.children[d],x={},_=f?f[d]:void 0;_&&(x.align=_);let E={type:"element",tagName:u,properties:x,children:[]};m&&(E.children=e.all(m),e.patch(m,E),E=e.applyData(m,E)),p.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(r,g),e.applyData(r,g)}function CE(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const xv=9,vv=32;function kE(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),l=0;const u=[];for(;s;)u.push(bv(r.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=i.exec(r);return u.push(bv(r.slice(l),l>0,!1)),u.join("")}function bv(e,r,i){let s=0,l=e.length;if(r){let u=e.codePointAt(s);for(;u===xv||u===vv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(l-1);for(;u===xv||u===vv;)l--,u=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function EE(e,r){const i={type:"text",value:kE(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function jE(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const NE={blockquote:rE,break:iE,code:sE,delete:aE,emphasis:oE,footnoteReference:lE,heading:cE,html:uE,imageReference:dE,image:hE,inlineCode:fE,linkReference:pE,link:mE,listItem:gE,list:vE,paragraph:bE,root:yE,strong:_E,table:SE,tableCell:CE,tableRow:wE,text:EE,thematicBreak:jE,toml:wl,yaml:wl,definition:wl,footnoteDefinition:wl};function wl(){}const my=-1,Jl=0,qa=1,zl=2,Mh=3,Ih=4,Bh=5,zh=6,gy=7,xy=8,yv=typeof self=="object"?self:globalThis,TE=(e,r)=>{const i=(l,u)=>(e.set(u,l),l),s=l=>{if(e.has(l))return e.get(l);const[u,f]=r[l];switch(u){case Jl:case my:return i(f,l);case qa:{const c=i([],l);for(const d of f)c.push(s(d));return c}case zl:{const c=i({},l);for(const[d,p]of f)c[s(d)]=s(p);return c}case Mh:return i(new Date(f),l);case Ih:{const{source:c,flags:d}=f;return i(new RegExp(c,d),l)}case Bh:{const c=i(new Map,l);for(const[d,p]of f)c.set(s(d),s(p));return c}case zh:{const c=i(new Set,l);for(const d of f)c.add(s(d));return c}case gy:{const{name:c,message:d}=f;return i(new yv[c](d),l)}case xy:return i(BigInt(f),l);case"BigInt":return i(Object(BigInt(f)),l);case"ArrayBuffer":return i(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:c}=new Uint8Array(f);return i(new DataView(c),f)}}return i(new yv[u](f),l)};return s},_v=e=>TE(new Map,e)(0),ks="",{toString:AE}={},{keys:DE}=Object,Ia=e=>{const r=typeof e;if(r!=="object"||!e)return[Jl,r];const i=AE.call(e).slice(8,-1);switch(i){case"Array":return[qa,ks];case"Object":return[zl,ks];case"Date":return[Mh,ks];case"RegExp":return[Ih,ks];case"Map":return[Bh,ks];case"Set":return[zh,ks];case"DataView":return[qa,i]}return i.includes("Array")?[qa,i]:i.includes("Error")?[gy,i]:[zl,i]},Cl=([e,r])=>e===Jl&&(r==="function"||r==="symbol"),LE=(e,r,i,s)=>{const l=(f,c)=>{const d=s.push(f)-1;return i.set(c,d),d},u=f=>{if(i.has(f))return i.get(f);let[c,d]=Ia(f);switch(c){case Jl:{let g=f;switch(d){case"bigint":c=xy,g=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([my],f)}return l([c,g],f)}case qa:{if(d){let x=f;return d==="DataView"?x=new Uint8Array(f.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(f)),l([d,[...x]],f)}const g=[],m=l([c,g],f);for(const x of f)g.push(u(x));return m}case zl:{if(d)switch(d){case"BigInt":return l([d,f.toString()],f);case"Boolean":case"Number":case"String":return l([d,f.valueOf()],f)}if(r&&"toJSON"in f)return u(f.toJSON());const g=[],m=l([c,g],f);for(const x of DE(f))(e||!Cl(Ia(f[x])))&&g.push([u(x),u(f[x])]);return m}case Mh:return l([c,f.toISOString()],f);case Ih:{const{source:g,flags:m}=f;return l([c,{source:g,flags:m}],f)}case Bh:{const g=[],m=l([c,g],f);for(const[x,_]of f)(e||!(Cl(Ia(x))||Cl(Ia(_))))&&g.push([u(x),u(_)]);return m}case zh:{const g=[],m=l([c,g],f);for(const x of f)(e||!Cl(Ia(x)))&&g.push(u(x));return m}}const{message:p}=f;return l([c,{name:d,message:p}],f)};return u},Sv=(e,{json:r,lossy:i}={})=>{const s=[];return LE(!(r||i),!!r,new Map,s)(e),s},Hl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?_v(Sv(e,r)):structuredClone(e):(e,r)=>_v(Sv(e,r));function RE(e,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function OE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function ME(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||RE,s=e.options.footnoteBackLabel||OE,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",f=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[d]);if(!p)continue;const g=e.all(p),m=String(p.identifier).toUpperCase(),x=Is(m.toLowerCase());let _=0;const E=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++_<=C;){E.length>0&&E.push({type:"text",value:" "});let y=typeof i=="string"?i:i(d,_);typeof y=="string"&&(y={type:"text",value:y}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+x+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const y=b.children[b.children.length-1];y&&y.type==="text"?y.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...E)}else g.push(...E);const v={type:"element",tagName:"li",properties:{id:r+"fn-"+x},children:e.wrap(g,!0)};e.patch(p,v),c.push(v)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Hl(f),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
99
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
100
- `}]}}const ec=(function(e){if(e==null)return HE;if(typeof e=="function")return tc(e);if(typeof e=="object")return Array.isArray(e)?IE(e):BE(e);if(typeof e=="string")return zE(e);throw new Error("Expected function, string, or object as test")});function IE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=ec(e[i]);return tc(s);function s(...l){let u=-1;for(;++u<r.length;)if(r[u].apply(this,l))return!0;return!1}}function BE(e){const r=e;return tc(i);function i(s){const l=s;let u;for(u in e)if(l[u]!==r[u])return!1;return!0}}function zE(e){return tc(r);function r(i){return i&&i.type===e}}function tc(e){return r;function r(i,s,l){return!!(PE(i)&&e.call(this,i,typeof s=="number"?s:void 0,l||void 0))}}function HE(){return!0}function PE(e){return e!==null&&typeof e=="object"&&"type"in e}const vy=[],FE=!0,oh=!1,UE="skip";function by(e,r,i,s){let l;typeof r=="function"&&typeof i!="function"?(s=i,i=r):l=r;const u=ec(l),f=s?-1:1;c(e,void 0,[])();function c(d,p,g){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const _=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return x;function x(){let _=vy,E,C,b;if((!r||u(d,p,g[g.length-1]||void 0))&&(_=$E(i(d,g)),_[0]===oh))return _;if("children"in d&&d.children){const v=d;if(v.children&&_[0]!==UE)for(C=(s?v.children.length:-1)+f,b=g.concat(v);C>-1&&C<v.children.length;){const y=v.children[C];if(E=c(y,C,b)(),E[0]===oh)return E;C=typeof E[1]=="number"?E[1]:C+f}}return _}}}function $E(e){return Array.isArray(e)?e:typeof e=="number"?[FE,e]:e==null?vy:[e]}function Hh(e,r,i,s){let l,u,f;typeof r=="function"&&typeof i!="function"?(u=void 0,f=r,l=i):(u=r,f=i,l=s),by(e,u,c,l);function c(d,p){const g=p[p.length-1],m=g?g.children.indexOf(d):void 0;return f(d,m,g)}}const lh={}.hasOwnProperty,qE={};function WE(e,r){const i=r||qE,s=new Map,l=new Map,u=new Map,f={...NE,...i.handlers},c={all:p,applyData:VE,definitionById:s,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:f,one:d,options:i,patch:GE,wrap:YE};return Hh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:l,x=String(g.identifier).toUpperCase();m.has(x)||m.set(x,g)}}),c;function d(g,m){const x=g.type,_=c.handlers[x];if(lh.call(c.handlers,x)&&_)return _(c,g,m);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in g){const{children:C,...b}=g,v=Hl(b);return v.children=c.all(g),v}return Hl(g)}return(c.options.unknownHandler||KE)(c,g,m)}function p(g){const m=[];if("children"in g){const x=g.children;let _=-1;for(;++_<x.length;){const E=c.one(x[_],g);if(E){if(_&&x[_-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=wv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=wv(C.value))}Array.isArray(E)?m.push(...E):m.push(E)}}}return m}}function GE(e,r){e.position&&(r.position=OC(e))}function VE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const f="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:f}}i.type==="element"&&u&&Object.assign(i.properties,Hl(u)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function KE(e,r){const i=r.data||{},s="value"in r&&!(lh.call(i,"hProperties")||lh.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function YE(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
101
- `});++s<e.length;)s&&i.push({type:"text",value:`
102
- `}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
103
- `}),i}function wv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Cv(e,r){const i=WE(e,r),s=i.one(e,void 0),l=ME(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
104
- `},l),u}function XE(e,r){return e&&"run"in e?async function(i,s){const l=Cv(i,{file:s,...r});await e.run(l,s)}:function(i,s){return Cv(i,{file:s,...e||r})}}function kv(e){if(e)throw e}var zd,Ev;function ZE(){if(Ev)return zd;Ev=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},u=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var x;for(x in p);return typeof x>"u"||e.call(p,x)},f=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},c=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(s)return s(p,g).value}else return;return p[g]};return zd=function d(){var p,g,m,x,_,E,C=arguments[0],b=1,v=arguments.length,y=!1;for(typeof C=="boolean"&&(y=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});b<v;++b)if(p=arguments[b],p!=null)for(g in p)m=c(C,g),x=c(p,g),C!==x&&(y&&x&&(u(x)||(_=l(x)))?(_?(_=!1,E=m&&l(m)?m:[]):E=m&&u(m)?m:{},f(C,{name:g,newValue:d(y,E,x)})):typeof x<"u"&&f(C,{name:g,newValue:x}));return C},zd}var QE=ZE();const Hd=$l(QE);function ch(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 JE(){const e=[],r={run:i,use:s};return r;function i(...l){let u=-1;const f=l.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);c(null,...l);function c(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<l.length;)(p[m]===null||p[m]===void 0)&&(p[m]=l[m]);l=p,g?ej(g,c)(...p):f(null,...p)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),r}}function ej(e,r){let i;return s;function s(...f){const c=e.length>f.length;let d;c&&f.push(l);try{d=e.apply(this,f)}catch(p){const g=p;if(c&&i)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(f,...c){i||(i=!0,r(f,...c))}function u(f){l(null,f)}}const ar={basename:tj,dirname:nj,extname:rj,join:ij,sep:"/"};function tj(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');so(e);let i=0,s=-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){i=l+1;break}}else s<0&&(u=!0,s=l+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,c=r.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){i=l+1;break}}else f<0&&(u=!0,f=l+1),c>-1&&(e.codePointAt(l)===r.codePointAt(c--)?c<0&&(s=l):(c=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function nj(e){if(so(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function rj(e){so(e);let r=e.length,i=-1,s=0,l=-1,u=0,f;for(;r--;){const c=e.codePointAt(r);if(c===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),c===46?l<0?l=r:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||i<0||u===0||u===1&&l===i-1&&l===s+1?"":e.slice(l,i)}function ij(...e){let r=-1,i;for(;++r<e.length;)so(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":sj(i)}function sj(e){so(e);const r=e.codePointAt(0)===47;let i=aj(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function aj(e,r){let i="",s=0,l=-1,u=0,f=-1,c,d;for(;++f<=e.length;){if(f<e.length)c=e.codePointAt(f);else{if(c===47)break;c=47}if(c===47){if(!(l===f-1||u===1))if(l!==f-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),l=f,u=0;continue}}else if(i.length>0){i="",s=0,l=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(l+1,f):i=e.slice(l+1,f),s=f-l-1;l=f,u=0}else c===46&&u>-1?u++:u=-1}return i}function so(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const oj={cwd:lj};function lj(){return"/"}function uh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cj(e){if(typeof e=="string")e=new URL(e);else if(!uh(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 uj(e)}function uj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(r)}const Pd=["history","path","basename","stem","extname","dirname"];class yy{constructor(r){let i;r?uh(r)?i={path:r}:typeof r=="string"||dj(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":oj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Pd.length;){const u=Pd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let l;for(l in i)Pd.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(r){Ud(r,"basename"),Fd(r,"basename"),this.path=ar.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(r){jv(this.basename,"dirname"),this.path=ar.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(r){if(Fd(r,"extname"),jv(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=ar.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){uh(r)&&(r=cj(r)),Ud(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(r){Ud(r,"stem"),Fd(r,"stem"),this.path=ar.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const l=this.message(r,i,s);throw l.fatal=!0,l}info(r,i,s){const l=this.message(r,i,s);return l.fatal=void 0,l}message(r,i,s){const l=new hn(r,i,s);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 Fd(e,r){if(e&&e.includes(ar.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+ar.sep+"`")}function Ud(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function jv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function dj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hj=(function(e){const s=this.constructor.prototype,l=s[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),fj={}.hasOwnProperty;class Ph extends hj{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=JE()}copy(){const r=new Ph;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Hd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Wd("data",this.frozen),this.namespace[r]=i,this):fj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Wd("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=i.call(r,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=kl(r),s=this.parser||this.Parser;return $d("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),$d("process",this.parser||this.Parser),qd("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(u,f){const c=kl(r),d=s.parse(c);s.run(d,c,function(g,m,x){if(g||!m||!x)return p(g);const _=m,E=s.stringify(_,x);gj(E)?x.value=E:x.result=E,p(g,x)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),$d("processSync",this.parser||this.Parser),qd("processSync",this.compiler||this.Compiler),this.process(r,l),Tv("processSync","process",i),s;function l(u,f){i=!0,kv(u),s=f}}run(r,i,s){Nv(r),this.freeze();const l=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,c){const d=kl(i);l.run(r,d,p);function p(g,m,x){const _=m||r;g?c(g):f?f(_):s(void 0,_,x)}}}runSync(r,i){let s=!1,l;return this.run(r,i,u),Tv("runSync","run",s),l;function u(f,c){kv(f),l=c,s=!0}}stringify(r,i){this.freeze();const s=kl(i),l=this.compiler||this.Compiler;return qd("stringify",l),Nv(r),l(r,s)}use(r,...i){const s=this.attachers,l=this.namespace;if(Wd("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?c(r):f(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;d(g,m)}else f(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function f(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(p.plugins),p.settings&&(l.settings=Hd(!0,l.settings,p.settings))}function c(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,g){let m=-1,x=-1;for(;++m<s.length;)if(s[m][0]===p){x=m;break}if(x===-1)s.push([p,...g]);else if(g.length>0){let[_,...E]=g;const C=s[x][1];ch(C)&&ch(_)&&(_=Hd(!0,C,_)),s[x]=[p,_,...E]}}}}const pj=new Ph().freeze();function $d(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 Wd(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 Nv(e){if(!ch(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function kl(e){return mj(e)?e:new yy(e)}function mj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gj(e){return typeof e=="string"||xj(e)}function xj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Av=[],Dv={allowDangerousHtml:!0},bj=/^(https?|ircs?|mailto|xmpp)$/i,yj=[{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 _j(e){const r=Sj(e),i=wj(e);return Cj(r.runSync(r.parse(i),i),e)}function Sj(e){const r=e.rehypePlugins||Av,i=e.remarkPlugins||Av,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Dv}:Dv;return pj().use(nE).use(i).use(XE,s).use(r)}function wj(e){const r=e.children||"",i=new yy;return typeof r=="string"&&(i.value=r),i}function Cj(e,r){const i=r.allowedElements,s=r.allowElement,l=r.components,u=r.disallowedElements,f=r.skipHtml,c=r.unwrapDisallowed,d=r.urlTransform||kj;for(const g of yj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+vj+g.id,void 0);return Hh(e,p),HC(e,{Fragment:o.Fragment,components:l,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,x){if(g.type==="raw"&&x&&typeof m=="number")return f?x.children.splice(m,1):x.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Md)if(Object.hasOwn(Md,_)&&Object.hasOwn(g.properties,_)){const E=g.properties[_],C=Md[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(E||""),_,g))}}if(g.type==="element"){let _=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(g,m,x)),_&&x&&typeof m=="number")return c&&g.children?x.children.splice(m,1,...g.children):x.children.splice(m,1),m}}}function kj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return r===-1||l!==-1&&r>l||i!==-1&&r>i||s!==-1&&r>s||bj.test(e.slice(0,r))?e:""}function Lv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,l=i.indexOf(r);for(;l!==-1;)s++,l=i.indexOf(r,l+r.length);return s}function Ej(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function jj(e,r,i){const l=ec((i||{}).ignore||[]),u=Nj(r);let f=-1;for(;++f<u.length;)by(e,"text",c);function c(p,g){let m=-1,x;for(;++m<g.length;){const _=g[m],E=x?x.children:void 0;if(l(_,E?E.indexOf(_):void 0,x))return;x=_}if(x)return d(p,g)}function d(p,g){const m=g[g.length-1],x=u[f][0],_=u[f][1];let E=0;const b=m.children.indexOf(p);let v=!1,y=[];x.lastIndex=0;let S=x.exec(p.value);for(;S;){const j=S.index,A={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?x.lastIndex=j+1:(E!==j&&y.push({type:"text",value:p.value.slice(E,j)}),Array.isArray(N)?y.push(...N):N&&y.push(N),E=j+S[0].length,v=!0),!x.global)break;S=x.exec(p.value)}return v?(E<p.value.length&&y.push({type:"text",value:p.value.slice(E)}),m.children.splice(b,1,...y)):y=[p],b+y.length}}function Nj(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const l=i[s];r.push([Tj(l[0]),Aj(l[1])])}return r}function Tj(e){return typeof e=="string"?new RegExp(Ej(e),"g"):e}function Aj(e){return typeof e=="function"?e:function(){return e}}const Gd="phrasing",Vd=["autolink","link","image","label"];function Dj(){return{transforms:[zj],enter:{literalAutolink:Rj,literalAutolinkEmail:Kd,literalAutolinkHttp:Kd,literalAutolinkWww:Kd},exit:{literalAutolink:Bj,literalAutolinkEmail:Ij,literalAutolinkHttp:Oj,literalAutolinkWww:Mj}}}function Lj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gd,notInConstruct:Vd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gd,notInConstruct:Vd},{character:":",before:"[ps]",after:"\\/",inConstruct:Gd,notInConstruct:Vd}]}}function Rj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kd(e){this.config.enter.autolinkProtocol.call(this,e)}function Oj(e){this.config.exit.autolinkProtocol.call(this,e)}function Mj(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 Ij(e){this.config.exit.autolinkEmail.call(this,e)}function Bj(e){this.exit(e)}function zj(e){jj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Pj]],{ignore:["link","linkReference"]})}function Hj(e,r,i,s,l){let u="";if(!_y(l)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Fj(i)))return!1;const f=Uj(i+s);if(!f[0])return!1;const c={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[c,{type:"text",value:f[1]}]:c}function Pj(e,r,i,s){return!_y(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Fj(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 Uj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const l=Lv(e,"(");let u=Lv(e,")");for(;s!==-1&&l>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function _y(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ri(i)||Zl(i))&&(!r||i!==47)}Sy.peek=Zj;function $j(){this.buffer()}function qj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Wj(){this.buffer()}function Gj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Vj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Kj(e){this.exit(e)}function Yj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Jn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Xj(e){this.exit(e)}function Zj(){return"["}function Sy(e,r,i,s){const l=i.createTracker(s);let u=l.move("[^");const f=i.enter("footnoteReference"),c=i.enter("reference");return u+=l.move(i.safe(i.associationId(e),{after:"]",before:u})),c(),f(),u+=l.move("]"),u}function Qj(){return{enter:{gfmFootnoteCallString:$j,gfmFootnoteCall:qj,gfmFootnoteDefinitionLabelString:Wj,gfmFootnoteDefinition:Gj},exit:{gfmFootnoteCallString:Vj,gfmFootnoteCall:Kj,gfmFootnoteDefinitionLabelString:Yj,gfmFootnoteDefinition:Xj}}}function Jj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:Sy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,l,u,f){const c=u.createTracker(f);let d=c.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=c.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=c.move("]:"),s.children&&s.children.length>0&&(c.shift(4),d+=c.move((r?`
105
- `:" ")+u.indentLines(u.containerFlow(s,c.current()),r?wy:eN))),p(),d}}function eN(e,r,i){return r===0?e:wy(e,r,i)}function wy(e,r,i){return(i?"":" ")+e}const tN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Cy.peek=aN;function nN(){return{canContainEols:["delete"],enter:{strikethrough:iN},exit:{strikethrough:sN}}}function rN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:tN}],handlers:{delete:Cy}}}function iN(e){this.enter({type:"delete",children:[]},e)}function sN(e){this.exit(e)}function Cy(e,r,i,s){const l=i.createTracker(s),u=i.enter("strikethrough");let f=l.move("~~");return f+=i.containerPhrasing(e,{...l.current(),before:f,after:"~"}),f+=l.move("~~"),u(),f}function aN(){return"~"}function oN(e){return e.length}function lN(e,r){const i=r||{},s=(i.align||[]).concat(),l=i.stringLength||oN,u=[],f=[],c=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],b=[];let v=-1;for(e[g].length>p&&(p=e[g].length);++v<e[g].length;){const y=cN(e[g][v]);if(i.alignDelimiters!==!1){const S=l(y);b[v]=S,(d[v]===void 0||S>d[v])&&(d[v]=S)}C.push(y)}f[g]=C,c[g]=b}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=Rv(s[m]);else{const C=Rv(s);for(;++m<p;)u[m]=C}m=-1;const x=[],_=[];for(;++m<p;){const C=u[m];let b="",v="";C===99?(b=":",v=":"):C===108?b=":":C===114&&(v=":");let y=i.alignDelimiters===!1?1:Math.max(1,d[m]-b.length-v.length);const S=b+"-".repeat(y)+v;i.alignDelimiters!==!1&&(y=b.length+y+v.length,y>d[m]&&(d[m]=y),_[m]=y),x[m]=S}f.splice(1,0,x),c.splice(1,0,_),g=-1;const E=[];for(;++g<f.length;){const C=f[g],b=c[g];m=-1;const v=[];for(;++m<p;){const y=C[m]||"";let S="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(b[m]||0),N=u[m];N===114?S=" ".repeat(A):N===99?A%2?(S=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(S=" ".repeat(A/2),j=S):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&v.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&y==="")&&(i.delimiterStart!==!1||m)&&v.push(" "),i.alignDelimiters!==!1&&v.push(S),v.push(y),i.alignDelimiters!==!1&&v.push(j),i.padding!==!1&&v.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&v.push("|")}E.push(i.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return E.join(`
106
- `)}function cN(e){return e==null?"":String(e)}function Rv(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 uN(e,r,i,s){const l=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const f=i.indentLines(i.containerFlow(e,u.current()),dN);return l(),f}function dN(e,r,i){return">"+(i?"":" ")+e}function hN(e,r){return Ov(e,r.inConstruct,!0)&&!Ov(e,r.notInConstruct,!1)}function Ov(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Mv(e,r,i,s){let l=-1;for(;++l<i.unsafe.length;)if(i.unsafe[l].character===`
107
- `&&hN(i.stack,i.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
108
- `}function fN(e,r){const i=String(e);let s=i.indexOf(r),l=s,u=0,f=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++u>f&&(f=u):u=1,l=s+r.length,s=i.indexOf(r,l);return f}function pN(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 mN(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 gN(e,r,i,s){const l=mN(i),u=e.value||"",f=l==="`"?"GraveAccent":"Tilde";if(pN(e,i)){const m=i.enter("codeIndented"),x=i.indentLines(u,xN);return m(),x}const c=i.createTracker(s),d=l.repeat(Math.max(fN(u,l)+1,3)),p=i.enter("codeFenced");let g=c.move(d);if(e.lang){const m=i.enter(`codeFencedLang${f}`);g+=c.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...c.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${f}`);g+=c.move(" "),g+=c.move(i.safe(e.meta,{before:g,after:`
109
- `,encode:["`"],...c.current()})),m()}return g+=c.move(`
110
- `),u&&(g+=c.move(u+`
111
- `)),g+=c.move(d),p(),g}function xN(e,r,i){return(i?"":" ")+e}function Fh(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 vN(e,r,i,s){const l=Fh(i),u=l==='"'?"Quote":"Apostrophe",f=i.enter("definition");let c=i.enter("label");const d=i.createTracker(s);let p=d.move("[");return p+=d.move(i.safe(i.associationId(e),{before:p,after:"]",...d.current()})),p+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(c=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":`
112
- `,...d.current()}))),c(),e.title&&(c=i.enter(`title${u}`),p+=d.move(" "+l),p+=d.move(i.safe(e.title,{before:p,after:l,...d.current()})),p+=d.move(l),c()),f(),p}function bN(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 Qa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Pl(e,r,i){const s=Rs(e),l=Rs(r);return s===void 0?l===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}ky.peek=yN;function ky(e,r,i,s){const l=bN(i),u=i.enter("emphasis"),f=i.createTracker(s),c=f.move(l);let d=f.move(i.containerPhrasing(e,{after:l,before:c,...f.current()}));const p=d.charCodeAt(0),g=Pl(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=Qa(p)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Pl(s.after.charCodeAt(0),m,l);x.inside&&(d=d.slice(0,-1)+Qa(m));const _=f.move(l);return u(),i.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},c+d+_}function yN(e,r,i){return i.options.emphasis||"*"}function _N(e,r){let i=!1;return Hh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,oh}),!!((!e.depth||e.depth<3)&&Rh(e)&&(r.options.setext||i))}function SN(e,r,i,s){const l=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(_N(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),x=i.containerPhrasing(e,{...u.current(),before:`
113
- `,after:`
114
- `});return m(),g(),x+`
115
- `+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
116
- `))+1))}const f="#".repeat(l),c=i.enter("headingAtx"),d=i.enter("phrasing");u.move(f+" ");let p=i.containerPhrasing(e,{before:"# ",after:`
117
- `,...u.current()});return/^[\t ]/.test(p)&&(p=Qa(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),c(),p}Ey.peek=wN;function Ey(e){return e.value||""}function wN(){return"<"}jy.peek=CN;function jy(e,r,i,s){const l=Fh(i),u=l==='"'?"Quote":"Apostrophe",f=i.enter("image");let c=i.enter("label");const d=i.createTracker(s);let p=d.move("![");return p+=d.move(i.safe(e.alt,{before:p,after:"]",...d.current()})),p+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(c=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=i.enter(`title${u}`),p+=d.move(" "+l),p+=d.move(i.safe(e.title,{before:p,after:l,...d.current()})),p+=d.move(l),c()),p+=d.move(")"),f(),p}function CN(){return"!"}Ny.peek=kN;function Ny(e,r,i,s){const l=e.referenceType,u=i.enter("imageReference");let f=i.enter("label");const c=i.createTracker(s);let d=c.move("![");const p=i.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...c.current()});return f(),i.stack=g,u(),l==="full"||!p||p!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function kN(){return"!"}Ty.peek=EN;function Ty(e,r,i){let s=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const f=i.unsafe[u],c=i.compilePattern(f);let d;if(f.atBreak)for(;d=c.exec(s);){let p=d.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(d.index+1)}}return l+s+l}function EN(){return"`"}function Ay(e,r){const i=Rh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Dy.peek=jN;function Dy(e,r,i,s){const l=Fh(i),u=l==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let c,d;if(Ay(e,i)){const g=i.stack;i.stack=[],c=i.enter("autolink");let m=f.move("<");return m+=f.move(i.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),c(),i.stack=g,m}c=i.enter("link"),d=i.enter("label");let p=f.move("[");return p+=f.move(i.containerPhrasing(e,{before:p,after:"](",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(i.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=i.enter("destinationRaw"),p+=f.move(i.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=i.enter(`title${u}`),p+=f.move(" "+l),p+=f.move(i.safe(e.title,{before:p,after:l,...f.current()})),p+=f.move(l),d()),p+=f.move(")"),c(),p}function jN(e,r,i){return Ay(e,i)?"<":"["}Ly.peek=NN;function Ly(e,r,i,s){const l=e.referenceType,u=i.enter("linkReference");let f=i.enter("label");const c=i.createTracker(s);let d=c.move("[");const p=i.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...c.current()});return f(),i.stack=g,u(),l==="full"||!p||p!==m?d+=c.move(m+"]"):l==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function NN(){return"["}function Uh(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 TN(e){const r=Uh(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function AN(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 Ry(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 DN(e,r,i,s){const l=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?AN(i):Uh(i);const c=e.ordered?f==="."?")":".":TN(i);let d=r&&i.bulletLastUsed?f===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(d=!0),Ry(i)===f&&g){let m=-1;for(;++m<e.children.length;){const x=e.children[m];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(f=c),i.bulletCurrent=f;const p=i.containerFlow(e,s);return i.bulletLastUsed=f,i.bulletCurrent=u,l(),p}function LN(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 RN(e,r,i,s){const l=LN(i);let u=i.bulletCurrent||Uh(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let f=u.length+1;(l==="tab"||l==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const c=i.createTracker(s);c.move(u+" ".repeat(f-u.length)),c.shift(f);const d=i.enter("listItem"),p=i.indentLines(i.containerFlow(e,c.current()),g);return d(),p;function g(m,x,_){return x?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function ON(e,r,i,s){const l=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),l(),f}const MN=ec(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function IN(e,r,i,s){return(e.children.some(function(f){return MN(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function BN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Oy.peek=zN;function Oy(e,r,i,s){const l=BN(i),u=i.enter("strong"),f=i.createTracker(s),c=f.move(l+l);let d=f.move(i.containerPhrasing(e,{after:l,before:c,...f.current()}));const p=d.charCodeAt(0),g=Pl(s.before.charCodeAt(s.before.length-1),p,l);g.inside&&(d=Qa(p)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Pl(s.after.charCodeAt(0),m,l);x.inside&&(d=d.slice(0,-1)+Qa(m));const _=f.move(l+l);return u(),i.attentionEncodeSurroundingInfo={after:x.outside,before:g.outside},c+d+_}function zN(e,r,i){return i.options.strong||"*"}function HN(e,r,i,s){return i.safe(e.value,s)}function PN(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 FN(e,r,i){const s=(Ry(i)+(i.options.ruleSpaces?" ":"")).repeat(PN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const My={blockquote:uN,break:Mv,code:gN,definition:vN,emphasis:ky,hardBreak:Mv,heading:SN,html:Ey,image:jy,imageReference:Ny,inlineCode:Ty,link:Dy,linkReference:Ly,list:DN,listItem:RN,paragraph:ON,root:IN,strong:Oy,text:HN,thematicBreak:FN};function UN(){return{enter:{table:$N,tableData:Iv,tableHeader:Iv,tableRow:WN},exit:{codeText:GN,table:qN,tableData:Yd,tableHeader:Yd,tableRow:Yd}}}function $N(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function qN(e){this.exit(e),this.data.inTable=void 0}function WN(e){this.enter({type:"tableRow",children:[]},e)}function Yd(e){this.exit(e)}function Iv(e){this.enter({type:"tableCell",children:[]},e)}function GN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,VN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function VN(e,r){return r==="|"?r:e}function KN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,l=r.stringLength,u=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
118
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:f,tableCell:d,tableRow:c}};function f(_,E,C,b){return p(g(_,C,b),_.align)}function c(_,E,C,b){const v=m(_,C,b),y=p([v]);return y.slice(0,y.indexOf(`
119
- `))}function d(_,E,C,b){const v=C.enter("tableCell"),y=C.enter("phrasing"),S=C.containerPhrasing(_,{...b,before:u,after:u});return y(),v(),S}function p(_,E){return lN(_,{align:E,alignDelimiters:s,padding:i,stringLength:l})}function g(_,E,C){const b=_.children;let v=-1;const y=[],S=E.enter("table");for(;++v<b.length;)y[v]=m(b[v],E,C);return S(),y}function m(_,E,C){const b=_.children;let v=-1;const y=[],S=E.enter("tableRow");for(;++v<b.length;)y[v]=d(b[v],_,E,C);return S(),y}function x(_,E,C){let b=My.inlineCode(_,E,C);return C.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function YN(){return{exit:{taskListCheckValueChecked:Bv,taskListCheckValueUnchecked:Bv,paragraph:ZN}}}function XN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:QN}}}function Bv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function ZN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const l=r.children;let u=-1,f;for(;++u<l.length;){const c=l[u];if(c.type==="paragraph"){f=c;break}}f===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function QN(e,r,i,s){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",c=i.createTracker(s);u&&c.move(f);let d=My.listItem(e,r,i,{...s,...c.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function JN(){return[Dj(),Qj(),nN(),UN(),YN()]}function eT(e){return{extensions:[Lj(),Jj(e),rN(),KN(e),XN()]}}const tT={tokenize:oT,partial:!0},Iy={tokenize:lT,partial:!0},By={tokenize:cT,partial:!0},zy={tokenize:uT,partial:!0},nT={tokenize:dT,partial:!0},Hy={name:"wwwAutolink",tokenize:sT,previous:Fy},Py={name:"protocolAutolink",tokenize:aT,previous:Uy},Lr={name:"emailAutolink",tokenize:iT,previous:$y},ur={};function rT(){return{text:ur}}let Ei=48;for(;Ei<123;)ur[Ei]=Lr,Ei++,Ei===58?Ei=65:Ei===91&&(Ei=97);ur[43]=Lr;ur[45]=Lr;ur[46]=Lr;ur[95]=Lr;ur[72]=[Lr,Py];ur[104]=[Lr,Py];ur[87]=[Lr,Hy];ur[119]=[Lr,Hy];function iT(e,r,i){const s=this;let l,u;return f;function f(m){return!dh(m)||!$y.call(s,s.previous)||$h(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return dh(m)?(e.consume(m),c):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(nT,g,p)(m):m===45||m===95||dn(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),l=!0,d}function g(m){return u&&l&&pn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function sT(e,r,i){const s=this;return l;function l(f){return f!==87&&f!==119||!Fy.call(s,s.previous)||$h(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tT,e.attempt(Iy,e.attempt(By,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function aT(e,r,i){const s=this;let l="",u=!1;return f;function f(m){return(m===72||m===104)&&Uy.call(s,s.previous)&&!$h(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(m),e.consume(m),c):i(m)}function c(m){if(pn(m)&&l.length<5)return l+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const x=l.toLowerCase();if(x==="http"||x==="https")return e.consume(m),d}return i(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):i(m)}function p(m){return m===null||Bl(m)||xt(m)||Ri(m)||Zl(m)?i(m):e.attempt(Iy,e.attempt(By,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function oT(e,r,i){let s=0;return l;function l(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),l):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function lT(e,r,i){let s,l,u;return f;function f(p){return p===46||p===95?e.check(zy,d,c)(p):p===null||xt(p)||Ri(p)||p!==45&&Zl(p)?d(p):(u=!0,e.consume(p),f)}function c(p){return p===95?s=!0:(l=s,s=void 0),e.consume(p),f}function d(p){return l||s||!u?i(p):r(p)}}function cT(e,r){let i=0,s=0;return l;function l(f){return f===40?(i++,e.consume(f),l):f===41&&s<i?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?e.check(zy,r,u)(f):f===null||xt(f)||Ri(f)?r(f):(e.consume(f),l)}function u(f){return f===41&&s++,e.consume(f),l}}function uT(e,r,i){return s;function s(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),s):c===38?(e.consume(c),u):c===93?(e.consume(c),l):c===60||c===null||xt(c)||Ri(c)?r(c):i(c)}function l(c){return c===null||c===40||c===91||xt(c)||Ri(c)?r(c):s(c)}function u(c){return pn(c)?f(c):i(c)}function f(c){return c===59?(e.consume(c),s):pn(c)?(e.consume(c),f):i(c)}}function dT(e,r,i){return s;function s(u){return e.consume(u),l}function l(u){return dn(u)?i(u):r(u)}}function Fy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||xt(e)}function Uy(e){return!pn(e)}function $y(e){return!(e===47||dh(e))}function dh(e){return e===43||e===45||e===46||e===95||dn(e)}function $h(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const hT={tokenize:yT,partial:!0};function fT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:xT,continuation:{tokenize:vT},exit:bT}},text:{91:{name:"gfmFootnoteCall",tokenize:gT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pT,resolveTo:mT}}}}function pT(e,r,i){const s=this;let l=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){f=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!f||!f._balanced)return i(d);const p=Jn(s.sliceSerialize({start:f.end,end:s.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function mT(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+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)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},c=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",l,r],["exit",l,r],["enter",u,r],["enter",f,r],["exit",f,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...c),e}function gT(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,f;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?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(u>999||m===93&&!f||m===null||m===91||xt(m))return i(m);if(m===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Jn(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return xt(m)||(f=!0),u++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,p):p(m)}}function xT(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,c;return d;function d(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(E)}function g(E){if(f>999||E===93&&!c||E===null||E===91||xt(E))return i(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Jn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return xt(E)||(c=!0),f++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),f++,g):g(E)}function x(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(u)||l.push(u),it(e,_,"gfmFootnoteDefinitionWhitespace")):i(E)}function _(E){return r(E)}}function vT(e,r,i){return e.check(io,r,e.attempt(hT,r,i))}function bT(e){e.exit("gfmFootnoteDefinition")}function yT(e,r,i){const s=this;return it(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const f=s.events[s.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):i(u)}}function _T(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:l};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(f,c){let d=-1;for(;++d<f.length;)if(f[d][0]==="enter"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._close){let p=d;for(;p--;)if(f[p][0]==="exit"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._open&&f[d][1].end.offset-f[d][1].start.offset===f[p][1].end.offset-f[p][1].start.offset){f[d][1].type="strikethroughSequence",f[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[p][1].start),end:Object.assign({},f[d][1].end)},m={type:"strikethroughText",start:Object.assign({},f[p][1].end),end:Object.assign({},f[d][1].start)},x=[["enter",g,c],["enter",f[p][1],c],["exit",f[p][1],c],["enter",m,c]],_=c.parser.constructs.insideSpan.null;_&&Mn(x,x.length,0,Ql(_,f.slice(p+1,d),c)),Mn(x,x.length,0,[["exit",m,c],["enter",f[d][1],c],["exit",f[d][1],c],["exit",g,c]]),Mn(f,p-1,d-p+3,x),d=p+x.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,c,d){const p=this.previous,g=this.events;let m=0;return x;function x(E){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(E):(f.enter("strikethroughSequenceTemporary"),_(E))}function _(E){const C=Rs(p);if(E===126)return m>1?d(E):(f.consume(E),m++,_);if(m<2&&!i)return d(E);const b=f.exit("strikethroughSequenceTemporary"),v=Rs(E);return b._open=!v||v===2&&!!C,b._close=!C||C===2&&!!v,c(E)}}}class ST{constructor(){this.map=[]}add(r,i,s){wT(this,r,i,s)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let l=s.pop();for(;l;){for(const u of l)r.push(u);l=s.pop()}this.map.length=0}}function wT(e,r,i,s){let l=0;if(!(i===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===r){e.map[l][1]+=i,e.map[l][2].push(...s);return}l+=1}e.map.push([r,i,s])}}function CT(e,r){let i=!1;const s=[];for(;r<e.length;){const l=e[r];if(i){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function kT(){return{flow:{null:{name:"table",tokenize:ET,resolveAll:jT}}}}function ET(e,r,i){const s=this;let l=0,u=0,f;return c;function c(z){let q=s.events.length-1;for(;q>-1;){const R=s.events[q][1].type;if(R==="lineEnding"||R==="linePrefix")q--;else break}const K=q>-1?s.events[q][1].type:null,W=K==="tableHead"||K==="tableRow"?N:d;return W===N&&s.parser.lazy[s.now().line]?i(z):W(z)}function d(z){return e.enter("tableHead"),e.enter("tableRow"),p(z)}function p(z){return z===124||(f=!0,u+=1),g(z)}function g(z){return z===null?i(z):Pe(z)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),_):i(z):Je(z)?it(e,g,"whitespace")(z):(u+=1,f&&(f=!1,l+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(z)))}function m(z){return z===null||z===124||xt(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?x:m)}function x(z){return z===92||z===124?(e.consume(z),m):m(z)}function _(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(z):(e.enter("tableDelimiterRow"),f=!1,Je(z)?it(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):E(z))}function E(z){return z===45||z===58?b(z):z===124?(f=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),C):A(z)}function C(z){return Je(z)?it(e,b,"whitespace")(z):b(z)}function b(z){return z===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),v):z===45?(u+=1,v(z)):z===null||Pe(z)?j(z):A(z)}function v(z){return z===45?(e.enter("tableDelimiterFiller"),y(z)):A(z)}function y(z){return z===45?(e.consume(z),y):z===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(z))}function S(z){return Je(z)?it(e,j,"whitespace")(z):j(z)}function j(z){return z===124?E(z):z===null||Pe(z)?!f||l!==u?A(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(z)):A(z)}function A(z){return i(z)}function N(z){return e.enter("tableRow"),D(z)}function D(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),D):z===null||Pe(z)?(e.exit("tableRow"),r(z)):Je(z)?it(e,D,"whitespace")(z):(e.enter("data"),T(z))}function T(z){return z===null||z===124||xt(z)?(e.exit("data"),D(z)):(e.consume(z),z===92?I:T)}function I(z){return z===92||z===124?(e.consume(z),T):T(z)}}function jT(e,r){let i=-1,s=!0,l=0,u=[0,0,0,0],f=[0,0,0,0],c=!1,d=0,p,g,m;const x=new ST;for(;++i<e.length;){const _=e[i],E=_[1];_[0]==="enter"?E.type==="tableHead"?(c=!1,d!==0&&(zv(x,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(i,0,[["enter",p,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],f=[0,i+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},x.add(i,0,[["enter",g,r]])),l=E.type==="tableDelimiterRow"?2:g?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=El(x,r,u,l,void 0,m),u=[0,0,0,0]),f[2]=i)):E.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=El(x,r,u,l,void 0,m)),u=f,f=[u[1],i,0,0])):E.type==="tableHead"?(c=!0,d=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=El(x,r,u,l,i,m)):f[1]!==0&&(m=El(x,r,f,l,i,m)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&zv(x,r,d,p,g),x.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=CT(r.events,i))}return e}function El(e,r,i,s,l,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";i[0]!==0&&(u.end=Object.assign({},Ts(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Ts(r.events,i[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const p=Ts(r.events,i[2]),g=Ts(r.events,i[3]),m={type:c,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const x=r.events[i[2]],_=r.events[i[3]];if(x[1].end=Object.assign({},_[1].end),x[1].type="chunkText",x[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,C=i[3]-i[2]-1;e.add(E,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return l!==void 0&&(u.end=Object.assign({},Ts(r.events,l)),e.add(l,0,[["exit",u,r]]),u=void 0),u}function zv(e,r,i,s,l){const u=[],f=Ts(r.events,i);l&&(l.end=Object.assign({},f),u.push(["exit",l,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function Ts(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const NT={name:"tasklistCheck",tokenize:AT};function TT(){return{text:{91:NT}}}function AT(e,r,i){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return xt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),f):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),f):i(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):i(d)}function c(d){return Pe(d)?r(d):Je(d)?e.check({tokenize:DT},r,i)(d):i(d)}}function DT(e,r,i){return it(e,s,"whitespace");function s(l){return l===null?i(l):r(l)}}function LT(e){return ey([rT(),fT(),_T(e),kT(),TT()])}const RT={};function OT(e){const r=this,i=e||RT,s=r.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(LT(i)),u.push(JN()),f.push(eT(i))}function MT(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function IT(e,r){if(e==null)return{};var i,s,l=MT(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(l[i]=e[i])}return l}function hh(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function BT(e){if(Array.isArray(e))return hh(e)}function zT(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function HT(e,r){if(e){if(typeof e=="string")return hh(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?hh(e,r):void 0}}function PT(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
120
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fh(e){return BT(e)||zT(e)||HT(e)||PT()}function Ja(e){"@babel/helpers - typeof";return Ja=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},Ja(e)}function FT(e,r){if(Ja(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Ja(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function UT(e){var r=FT(e,"string");return Ja(r)=="symbol"?r:r+""}function qy(e,r,i){return(r=UT(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function ph(){return ph=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},ph.apply(null,arguments)}function Hv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function As(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Hv(Object(i),!0).forEach(function(s){qy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Hv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function $T(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 Xd={};function qT(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Xd[r]||(Xd[r]=$T(e)),Xd[r]}function WT(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),l=qT(s);return l.reduce(function(u,f){return As(As({},u),i[f])},r)}function Pv(e){return e.join(" ")}function GT(e,r){var i=0;return function(s){return i+=1,s.map(function(l,u){return Wy({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Wy(e){var r=e.node,i=e.stylesheet,s=e.style,l=s===void 0?{}:s,u=e.useInlineStyles,f=e.key,c=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=GT(i,u),x;if(!u)x=As(As({},c),{},{className:Pv(c.className)});else{var _=Object.keys(i).reduce(function(v,y){return y.split(".").forEach(function(S){v.includes(S)||v.push(S)}),v},[]),E=c.className&&c.className.includes("token")?["token"]:[],C=c.className&&E.concat(c.className.filter(function(v){return!_.includes(v)}));x=As(As({},c),{},{className:Pv(C)||void 0,style:WT(c.className,Object.assign({},c.style,l),i)})}var b=m(r.children);return un.createElement(p,ph({key:f},x),b)}}const VT=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var KT=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Fv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function si(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Fv(Object(i),!0).forEach(function(s){qy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Fv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var YT=/\n/g;function XT(e){return e.match(YT)}function ZT(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(l,u){var f=u+i;return un.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(f):s},"".concat(f,`
121
- `))})}function QT(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,l=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,c=e.startingLineNumber;return un.createElement("code",{style:Object.assign({},i,l)},ZT({lines:r.replace(/\n$/,"").split(`
122
- `),style:f,startingLineNumber:c}))}function JT(e){return"".concat(e.toString().length,".25em")}function Gy(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 Vy(e,r,i){var s={display:"inline-block",minWidth:JT(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(r):e,u=si(si({},s),l);return u}function Ll(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,l=e.largestLineNumber,u=e.showInlineLineNumbers,f=e.lineProps,c=f===void 0?{}:f,d=e.className,p=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,x=e.wrapLines,_=x===void 0?!1:x,E=_?si({},typeof c=="function"?c(i):c):{};if(E.className=E.className?[].concat(fh(E.className.trim().split(/\s+/)),fh(p)):p,i&&u){var C=Vy(s,i,l);r.unshift(Gy(i,C))}return m&g&&(E.style=si({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function Ky(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var l=e[s];if(l.type==="text")i.push(Ll({children:[l],className:fh(new Set(r))}));else if(l.children){var u,f=r.concat(((u=l.properties)===null||u===void 0?void 0:u.className)||[]);Ky(l.children,f).forEach(function(c){return i.push(c)})}}return i}function e3(e,r,i,s,l,u,f,c,d){var p,g=Ky(e.value),m=[],x=-1,_=0;function E(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Ll({children:A,lineNumber:N,lineNumberStyle:c,largestLineNumber:f,showInlineLineNumbers:l,lineProps:i,className:D,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&l){var D=Vy(c,N,f);A.unshift(Gy(N,D))}return A}function b(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?E(A,N,D):C(A,N)}for(var v=function(){var N=g[_],D=N.children[0].value,T=XT(D);if(T){var I=D.split(`
123
- `);I.forEach(function(z,q){var K=s&&m.length+u,W={type:"text",value:"".concat(z,`
124
- `)};if(q===0){var R=g.slice(x+1,_).concat(Ll({children:[W],className:N.properties.className})),U=b(R,K);m.push(U)}else if(q===I.length-1){var H=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(z)};if(H){var Z=Ll({children:[X],className:N.properties.className});g.splice(_+1,0,Z)}else{var B=[X],L=b(B,K,N.properties.className);m.push(L)}}else{var M=[W],V=b(M,K,N.properties.className);m.push(V)}}),x=_}_++};_<g.length;)v();if(x!==g.length-1){var y=g.slice(x+1,g.length);if(y&&y.length){var S=s&&m.length+u,j=b(y,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function t3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(l,u){return Wy({node:l,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Yy(e){return e&&typeof e.highlightAuto<"u"}function n3(e){var r=e.astGenerator,i=e.language,s=e.code,l=e.defaultCodeValue;if(Yy(r)){var u=VT(r,i);return i==="text"?{value:l,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:l}}catch{return{value:l}}}function r3(e,r){return function(s){var l,u,f=s.language,c=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,x=s.codeTagProps,_=x===void 0?{className:f?"language-".concat(f):void 0,style:si(si({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:x,E=s.useInlineStyles,C=E===void 0?!0:E,b=s.showLineNumbers,v=b===void 0?!1:b,y=s.showInlineLineNumbers,S=y===void 0?!0:y,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,T=D===void 0?{}:D,I=s.wrapLines,z=s.wrapLongLines,q=z===void 0?!1:z,K=s.lineProps,W=K===void 0?{}:K,R=s.renderer,U=s.PreTag,H=U===void 0?"pre":U,X=s.CodeTag,Z=X===void 0?"code":X,B=s.code,L=B===void 0?(Array.isArray(c)?c[0]:c)||"":B,M=s.astGenerator,V=IT(s,KT);M=M||e;var F=v?un.createElement(QT,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,re=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Q=Yy(M)?"hljs":"prismjs",ee=C?Object.assign({},V,{style:Object.assign({},re,m)}):Object.assign({},V,{className:V.className?"".concat(Q," ").concat(V.className):Q,style:Object.assign({},m)});if(q?_.style=si({whiteSpace:"pre-wrap"},_.style):_.style=si({whiteSpace:"pre"},_.style),!M)return un.createElement(H,ee,F,un.createElement(Z,_,L));(I===void 0&&R||q)&&(I=!0),R=R||t3;var Y=[{type:"text",value:L}],$=n3({astGenerator:M,language:f,code:L,defaultCodeValue:Y});$.language===null&&($.value=Y);var ae=(l=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0,ne=A+ae,ve=e3($,I,W,v,S,A,ne,T,q);return un.createElement(H,ee,un.createElement(Z,_,!S&&F,R({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Uv=/[#.]/g;function i3(e,r){const i=e||"",s={};let l=0,u,f;for(;l<i.length;){Uv.lastIndex=l;const c=Uv.exec(i),d=i.slice(l,c?c.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,l+=d.length),c&&(u=c[0],l++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function Xy(e,r,i){const s=i?l3(i):void 0;function l(u,f,...c){let d;if(u==null){d={type:"root",children:[]};const p=f;c.unshift(p)}else{d=i3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,s3(f))c.unshift(f);else for(const[m,x]of Object.entries(f))a3(e,d.properties,m,x)}for(const p of c)mh(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function s3(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const l=r[s];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const u=l;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function a3(e,r,i,s){const l=Wb(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?l.spaceSeparated?u=Jx(s):l.commaSeparated?u=Kx(s):l.commaOrSpaceSeparated?u=Jx(Kx(s).join(" ")):u=$v(l,l.property,s):Array.isArray(s)?u=[...s]:u=l.property==="style"?o3(s):String(s);if(Array.isArray(u)){const f=[];for(const c of u)f.push($v(l,l.property,c));u=f}l.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[l.property]=u}}function mh(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const i of r)mh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?mh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function $v(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Ya(i)===Ya(r)))return!0}return i}function o3(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function l3(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const c3=["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"],u3=Xy(Gb,"div");Xy(Xl,"g",c3);const d3=["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"],qv={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 Zy(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function h3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function f3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Wv(e){return f3(e)||Zy(e)}const p3=["","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 m3(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,l=[];let u=0,f=-1,c="",d,p;i.position&&("start"in i.position||"indent"in i.position?(p=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,x=E(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const v=e.charCodeAt(u+1);if(v===9||v===10||v===12||v===32||v===38||v===60||Number.isNaN(v)||s&&v===s){c+=String.fromCharCode(_),m++;continue}const y=u+1;let S=y,j=y,A;if(v===35){j=++S;const W=e.charCodeAt(j);W===88||W===120?(A="hexadecimal",j=++S):A="decimal"}else A="named";let N="",D="",T="";const I=A==="named"?Wv:A==="decimal"?Zy:h3;for(j--;++j<=e.length;){const W=e.charCodeAt(j);if(!I(W))break;T+=String.fromCharCode(W),A==="named"&&d3.includes(T)&&(N=T,D=Za(T))}let z=e.charCodeAt(j)===59;if(z){j++;const W=A==="named"?Za(T):!1;W&&(N=T,D=W)}let q=1+j-y,K="";if(!(!z&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,q);else if(A==="named"){if(z&&!D)C(5,1);else if(N!==T&&(j=S+N.length,q=1+j-S,z=!1),!z){const W=N?1:3;if(i.attribute){const R=e.charCodeAt(j);R===61?(C(W,q),D=""):Wv(R)?D="":C(W,q)}else C(W,q)}K=D}else{z||C(2,q);let W=Number.parseInt(T,A==="hexadecimal"?16:10);if(g3(W))C(7,q),K="�";else if(W in qv)C(6,q),K=qv[W];else{let R="";x3(W)&&C(6,q),W>65535&&(W-=65536,R+=String.fromCharCode(W>>>10|55296),W=56320|W&1023),K=R+String.fromCharCode(W)}}if(K){b(),x=E(),u=j-1,m+=j-y+1,l.push(K);const W=E();W.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,K,{start:x,end:W},e.slice(y-1,j)),x=W}else T=e.slice(y-1,j),c+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?b():(c+=String.fromCharCode(_),m++);return l.join("");function E(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(v,y){let S;i.warning&&(S=E(),S.column+=y,S.offset+=y,i.warning.call(i.warningContext||void 0,p3[v],S,v))}function b(){c&&(l.push(c),i.text&&i.text.call(i.textContext||void 0,c,{start:x,end:E()}),c="")}}function g3(e){return e>=55296&&e<=57343||e>1114111}function x3(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 v3=0,jl={},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:++v3}),e.__id},clone:function e(r,i){i=i||{};var s,l;switch(Qt.util.type(r)){case"Object":if(l=Qt.util.objId(r),i[l])return i[l];s={},i[l]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return l=Qt.util.objId(r),i[l]?i[l]:(s=[],i[l]=s,r.forEach(function(f,c){s[c]=e(f,i)}),s);default:return r}}},languages:{plain:jl,plaintext:jl,text:jl,txt:jl,extend:function(e,r){var i=Qt.util.clone(Qt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Qt.languages;var l=s[e],u={};for(var f in l)if(l.hasOwnProperty(f)){if(f==r)for(var c in i)i.hasOwnProperty(c)&&(u[c]=i[c]);i.hasOwnProperty(f)||(u[f]=l[f])}var d=s[e];return s[e]=u,Qt.languages.DFS(Qt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,l){l=l||{};var u=Qt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var c=r[f],d=Qt.util.type(c);d==="Object"&&!l[u(c)]?(l[u(c)]=!0,e(c,i,null,l)):d==="Array"&&!l[u(c)]&&(l[u(c)]=!0,e(c,i,f,l))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Qt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Qt.tokenize(s.code,s.grammar),Qt.hooks.run("after-tokenize",s),Wa.stringify(Qt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var l=new b3;return Rl(l,l.head,e),Qy(e,l,r,l.head,0),_3(l)},hooks:{all:{},add:function(e,r){var i=Qt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Qt.hooks.all[e];if(!(!i||!i.length))for(var s=0,l;l=i[s++];)l(r)}},Token:Wa};function Wa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Gv(e,r,i,s){e.lastIndex=r;var l=e.exec(i);if(l&&s&&l[1]){var u=l[1].length;l.index+=u,l[0]=l[0].slice(u)}return l}function Qy(e,r,i,s,l,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var c=i[f];c=Array.isArray(c)?c:[c];for(var d=0;d<c.length;++d){if(u&&u.cause==f+","+d)return;var p=c[d],g=p.inside,m=!!p.lookbehind,x=!!p.greedy,_=p.alias;if(x&&!p.pattern.global){var E=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,E+"g")}for(var C=p.pattern||p,b=s.next,v=l;b!==r.tail&&!(u&&v>=u.reach);v+=b.value.length,b=b.next){var y=b.value;if(r.length>e.length)return;if(!(y instanceof Wa)){var S=1,j;if(x){if(j=Gv(C,v,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=v;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,v=N,b.value instanceof Wa)continue;for(var D=b;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,y=e.slice(v,N),j.index-=v}else if(j=Gv(C,0,y,m),!j)continue;var T=j.index,I=j[0],z=y.slice(0,T),q=y.slice(T+I.length),K=v+y.length;u&&K>u.reach&&(u.reach=K);var W=b.prev;z&&(W=Rl(r,W,z),v+=z.length),y3(r,W,S);var R=new Wa(f,g?Qt.tokenize(I,g):I,_,I);if(b=Rl(r,W,R),q&&Rl(r,b,q),S>1){var U={cause:f+","+d,reach:K};Qy(e,r,i,b.prev,v,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function b3(){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 Rl(e,r,i){var s=r.next,l={value:i,prev:r,next:s};return r.next=l,s.prev=l,e.length++,l}function y3(e,r,i){for(var s=r.next,l=0;l<i&&s!==e.tail;l++)s=s.next;r.next=s,s.prev=r,e.length-=l}function _3(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const Jy=Qt;function e0(){}e0.prototype=Jy;const Kt=new e0;Kt.highlight=S3;Kt.register=w3;Kt.alias=C3;Kt.registered=k3;Kt.listLanguages=E3;Kt.util.encode=j3;Kt.Token.stringify=gh;function S3(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Kt.languages,s))i=Kt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:Jy.highlight.call(Kt,e,i,s)}}function w3(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Kt.languages,e.displayName)||e(Kt)}function C3(e,r){const i=Kt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let l;for(l in s)if(Object.hasOwn(s,l)){const u=s[l],f=typeof u=="string"?[u]:u;let c=-1;for(;++c<f.length;)i[f[c]]=i[l]}}function k3(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Kt.languages,e)}function E3(){const e=Kt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function gh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let l=-1;for(;++l<e.length;)e[l]!==null&&e[l]!==void 0&&e[l]!==""&&s.push(gh(e[l],r));return s}const i={attributes:{},classes:["token",e.type],content:gh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Kt.hooks.run("wrap",i),u3(i.tag+"."+i.classes.join("."),N3(i.attributes),i.content)}function j3(e){return e}function N3(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=m3(e[r]));return e}var ht=r3(Kt,{});ht.registerLanguage=function(e,r){return Kt.register(r)};ht.alias=function(e,r){return Kt.alias(e,r)};Ii.displayName="markup";Ii.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Ii(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(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var l={};l["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},l.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:l}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var f={};f[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:e.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}nc.displayName="css";nc.aliases=[];function nc(e){(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Bi.displayName="clike";Bi.aliases=[];function Bi(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:/[{}[\];(),.:]/}}ao.displayName="javascript";ao.aliases=["js"];function ao(e){e.register(Bi),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}qh.displayName="sql";qh.aliases=[];function qh(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:/[;[\]()`,.]/}}rc.displayName="c";rc.aliases=[];function rc(e){e.register(Bi),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}Wh.displayName="cpp";Wh.aliases=[];function Wh(e){e.register(rc),(function(r){var i=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:i,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}Gh.displayName="bash";Gh.aliases=["sh","shell"];function Gh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},l={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:l},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:l},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:l.entity}}],environment:{pattern:RegExp("\\$?"+i),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}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],f=l.variable[1].inside,c=0;c<u.length;c++)f[u[c]]=r.languages.bash[u[c]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Vh.displayName="yaml";Vh.aliases=["yml"];function Vh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,l="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),f=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return l}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return 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+"|"+f+")"})),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(f),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:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}Kh.displayName="markdown";Kh.aliases=["md"];function Kh(e){e.register(Ii),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(c){return c=c.replace(/<inner>/g,function(){return i}),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}),f=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+f+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+f+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(l),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+f+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(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:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(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(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var x=p[g];if(x.type!=="code"){d(x.content);continue}var _=x.content[1],E=x.content[3];if(_&&E&&_.type==="code-language"&&E.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var b="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,b]:E.alias.push(b):E.alias=[b]}}}d(c.tokens)}),r.hooks.add("wrap",function(c){if(c.type==="code-block"){for(var d="",p=0,g=c.classes.length;p<g;p++){var m=c.classes[p],x=/language-(.+)/.exec(m);if(x){d=x[1];break}}var _=r.languages[d];if(_)c.content=r.highlight(c.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);c.attributes.id=E,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(E);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)}Yh.displayName="ruby";Yh.aliases=["rb"];function Yh(e){e.register(Bi),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",l=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+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+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Xh.displayName="diff";Xh.aliases=[];function Xh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var l=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+l+`].*(?:\r
125
- ?|
126
- |(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}Zh.displayName="docker";Zh.aliases=["dockerfile"];function Zh(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),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}),f={pattern:RegExp(l),greedy:!0},c={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(p,g){return p=p.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return s}),RegExp(p,g)}r.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:d(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[f,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:d(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:c,string:f,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:c},r.languages.dockerfile=r.languages.docker})(e)}Qh.displayName="go";Qh.aliases=[];function Qh(e){e.register(Bi),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"]}Jh.displayName="graphql";Jh.aliases=[];function Jh(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(b){return typeof b!="string"&&b.type!=="comment"&&b.type!=="scalar"}),l=0;function u(b){return s[l+b]}function f(b,v){v=v||0;for(var y=0;y<b.length;y++){var S=u(y+v);if(!S||S.type!==b[y])return!1}return!0}function c(b,v){for(var y=1,S=l;S<s.length;S++){var j=s[S],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(b.test(A))y++;else if(v.test(A)&&(y--,y===0))return S}}return-1}function d(b,v){var y=b.alias;y?Array.isArray(y)||(b.alias=y=[y]):b.alias=y=[],y.push(v)}for(;l<s.length;){var p=s[l++];if(p.type==="keyword"&&p.content==="mutation"){var g=[];if(f(["definition-mutation","punctuation"])&&u(1).content==="("){l+=2;var m=c(/^\($/,/^\)$/);if(m===-1)continue;for(;l<m;l++){var x=u(0);x.type==="variable"&&(d(x,"variable-input"),g.push(x.content))}l=m+1}if(f(["punctuation","property-query"])&&u(0).content==="{"&&(l++,d(u(0),"property-mutation"),g.length>0)){var _=c(/^\{$/,/^\}$/);if(_===-1)continue;for(var E=l;E<_;E++){var C=s[E];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}ef.displayName="scss";ef.aliases=[];function ef(e){e.register(nc),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}tf.displayName="json";tf.aliases=["webmanifest"];function tf(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}nf.displayName="java";nf.aliases=[];function nf(e){e.register(Bi),(function(r){var i=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,l={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[l,{pattern:RegExp(/(^|[^\w.])/.source+s+/[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+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:l.inside}],keyword:i,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":l,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:l.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\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 i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}ic.displayName="typescript";ic.aliases=["ts"];function ic(e){e.register(ao),(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var i=r.languages.extend("typescript",{});delete i["class-name"],r.languages.typescript["class-name"].inside=i,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:i}}}}),r.languages.ts=r.languages.typescript})(e)}rf.displayName="python";rf.aliases=["py"];function rf(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:/![sra](?=[:}]$)/,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}sc.displayName="jsx";sc.aliases=[];function sc(e){e.register(ao),e.register(Ii),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,l=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return l}).replace(/<SPREAD>/g,function(){return u}),RegExp(p,g)}u=f(u).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=f(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),r.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,r.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,r.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,r.languages.jsx.tag.inside.comment=i.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:f(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:f(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var c=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(c).join(""):""},d=function(p){for(var g=[],m=0;m<p.length;m++){var x=p[m],_=!1;if(typeof x!="string"&&(x.type==="tag"&&x.content[0]&&x.content[0].type==="tag"?x.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===c(x.content[0].content[1])&&g.pop():x.content[x.content.length-1].content==="/>"||g.push({tagName:c(x.content[0].content[1]),openedBraces:0}):g.length>0&&x.type==="punctuation"&&x.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&x.type==="punctuation"&&x.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof x=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=c(x);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(E+=c(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(E=c(p[m-1])+E,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",E,null,E)}x.content&&typeof x.content!="string"&&d(x.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}sf.displayName="tsx";sf.aliases=[];function sf(e){e.register(sc),e.register(ic),(function(r){var i=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",i),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var s=r.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}af.displayName="rust";af.aliases=[];function af(e){(function(r){for(var i=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)i=i.replace(/<self>/g,function(){return i});i=i.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+i),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(e)}of.displayName="toml";of.aliases=[];function of(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(l){return l.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const Ol={'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%)"}};ht.registerLanguage("typescript",ic);ht.registerLanguage("javascript",ao);ht.registerLanguage("tsx",sf);ht.registerLanguage("jsx",sc);ht.registerLanguage("python",rf);ht.registerLanguage("bash",Gh);ht.registerLanguage("json",tf);ht.registerLanguage("css",nc);ht.registerLanguage("html",Ii);ht.registerLanguage("markup",Ii);ht.registerLanguage("xml",Ii);ht.registerLanguage("sql",qh);ht.registerLanguage("yaml",Vh);ht.registerLanguage("markdown",Kh);ht.registerLanguage("diff",Xh);ht.registerLanguage("rust",af);ht.registerLanguage("go",Qh);ht.registerLanguage("java",nf);ht.registerLanguage("c",rc);ht.registerLanguage("cpp",Wh);ht.registerLanguage("ruby",Yh);ht.registerLanguage("toml",of);ht.registerLanguage("scss",ef);ht.registerLanguage("graphql",Jh);ht.registerLanguage("docker",Zh);function t0(e=2e3){const[r,i]=P.useState(!1),s=P.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)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const T3={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
127
- `))return o.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...i,children:r});const u=(s==null?void 0:s[1])||"text",f=String(r).replace(/\n$/,""),{copied:c,copy:d}=t0();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),d(f)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:c?o.jsx(Gl,{}):o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(ht,{style:Ol,language:u,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})})]})},p({children:e}){return o.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return o.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return o.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return o.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return o.jsx("h3",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},h4({children:e}){return o.jsx("h4",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},strong({children:e}){return o.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return o.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return o.jsx("blockquote",{className:"border-l-2 border-accent-primary pl-2 my-1.5 text-text-secondary italic text-sm",children:e})},table({children:e}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:e})},td({children:e}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return o.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},zi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let l=A3(r);return l=D3(l),l},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(_j,{remarkPlugins:[OT],components:T3,children:s})})});function A3(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function D3(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const l=e.lastIndexOf("```");return e.slice(l+3).includes(`
128
- `),e+"\n```"}return e}const L3=P.memo(function({content:r,variant:i="default"}){return i==="labeled"?o.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[o.jsx("span",{className:"text-purple-400",children:"thinking:"}),o.jsx("div",{className:"ml-1.5 mt-0.5",children:o.jsx(zi,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-bg-tertiary/50 rounded p-1.5 feed-item whitespace-pre-wrap",children:r})});function n0({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}):e==="run_command"||e==="bash"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}):o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}const R3={...Ol,'pre[class*="language-"]':{...Ol['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Ol['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},O3={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 ac(e){var l;if(!e)return"text";const r=e.split("/").pop()??"",i=r.toLowerCase();if(i==="dockerfile")return"docker";if(i==="makefile")return"makefile";if(i==="cmakelists.txt")return"cmake";const s=(l=r.split(".").pop())==null?void 0:l.toLowerCase();return s?O3[s]??"text":"text"}const r0={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},M3={...r0,display:"inline"},I3={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},eo=P.memo(function({code:r,language:i,variant:s}){const l=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?M3:s==="block-nowrap"?r0:I3;return o.jsx(ht,{style:R3,language:i,PreTag:l,customStyle:u,children:r})});function i0({src:e,alt:r,isOpen:i,onClose:s}){return i?o.jsx(Ct,{isOpen:i,onClose:s,title:"",size:"full",children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const B3=P.memo(function({oldString:r,newString:i,filePath:s}){const l=P.useMemo(()=>ac(s),[s]),u=r.split(`
129
- `),f=i.split(`
130
- `),c=r.length>0,d=i.length>0;return!c&&!d?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-red-400/60"}),o.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:u.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),o.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:o.jsx(eo,{code:r,language:l,variant:"block-nowrap"})})]}),d&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:f.map((p,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),o.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:o.jsx(eo,{code:i,language:l,variant:"block-nowrap"})})]})]})}),z3=P.memo(function({content:r,filePath:i}){const s=P.useMemo(()=>ac(i),[i]);return o.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:o.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
131
- `).map((l,u)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(eo,{code:r,language:s,variant:"block"})})]})})}),H3=P.memo(function({regions:r,filePath:i}){const s=P.useMemo(()=>ac(i),[i]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((l,u)=>o.jsx(P3,{region:l,language:s},u))})}),P3=P.memo(function({region:r,language:i}){const s=F3(r),l=Math.max(...r.beforeContext.map(f=>f.lineNumber),...r.afterContext.map(f=>f.lineNumber),...r.edits.flatMap(f=>[f.startLine,f.endLine])),u=String(l).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((f,c)=>o.jsx(U3,{item:f,language:i,lineNumWidth:u},c))})});function F3(e){const r=[];for(const i of e.beforeContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});for(const i of e.edits){const s=i.oldContent.split(`
132
- `);for(let u=0;u<s.length;u++)r.push({type:"removed",lineNumber:i.startLine+u,content:s[u]});const l=i.newContent.split(`
133
- `);for(let u=0;u<l.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:l[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const U3=P.memo(function({item:r,language:i,lineNumWidth:s}){const l=String(r.lineNumber).padStart(s," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",f=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",c=r.type==="context"?" ":r.type==="removed"?"-":"+",d=r.type==="removed"?"line-through decoration-red-400/30":"",p=r.type==="context"?"bg-transparent":r.type==="removed"?"bg-red-400/60":"bg-green-400/60";return o.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${u}`,children:[o.jsx("div",{className:p}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:l}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${f}`,children:c}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(eo,{code:r.content||" ",language:i,variant:"inline"})})]})}),$3=P.memo(function({result:r,metadata:i,filePath:s,heightExpanded:l=!1}){const[u,f]=P.useState(!1),c=P.useMemo(()=>ac(s),[s]),d=i==null?void 0:i.mimeType,p=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&p){const x=`data:${d};base64,${p}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>f(!0),children:o.jsx("img",{src:x,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(i0,{src:x,alt:s,isOpen:u,onClose:()=>f(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
134
- `),m=g.filter(x=>!x.startsWith(`
135
- [`)&&!x.startsWith("[")).map(x=>x.replace(/^\d+: /,"")).join(`
136
- `);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(x=>!x.startsWith(`
137
- [`)&&!x.startsWith("[")).map((x,_)=>{const E=x.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(eo,{code:m,language:c,variant:"block"})})]})})}),q3={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=P.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),l=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),l.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const c=q3[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${c.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${c.color} text-xs flex-shrink-0 w-4 text-center`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},f)})})]})}),W3=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:l,status:u,result:f,error:c,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[l,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const x=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,E=u==="pending"?(l==null?void 0:l.map(C=>C.content).join(""))??"":f??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",x,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(E||u==="pending")&&o.jsx("pre",{ref:p,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,b)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Ka(C.content)},b)):Ka(E)}),u==="error"&&c&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:c}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function G3(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function V3({confirmation:e}){const r=ke(g=>g.confirmPath),i=ke(g=>g.currentSession),s=ke(g=>g.switchDangerLevel),{title:l,description:u}=G3(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",c=f?"border-red-500/50":"border-amber-500/50",d=f?"bg-red-500/10":"bg-amber-500/10",p=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${c} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${f?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${f?"text-red-400":"text-amber-400"}`,children:l}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${f?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),o.jsx("button",{onClick:()=>r(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-white transition-colors",children:"Allow"}),o.jsx("button",{onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function K3(e,r){if(e==="read_file"){const s=String(r.path??""),l=r.offset,u=r.limit,f=[];return l!==void 0&&l!==1&&f.push(`offset=${l}`),u!==void 0&&f.push(`limit=${u}`),f.length>0?`${s} [${f.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function Kv(e,r,i){return K3(e,r)}function Y3(e){return JSON.stringify(e,null,2)}const X3={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}},Z3=P.memo(function({tool:r,args:i,status:s,variant:l="compact",forceCompact:u,result:f,error:c,durationMs:d,diagnostics:p,editContext:g,startedAt:m,streamingOutput:x,metadata:_,callId:E}){const C=r==="edit_file"||r==="write_file",b=r==="run_command"&&s==="pending",v=r==="read_file",S=u?!1:C||b||r==="return_value",[j,A]=P.useState(S),N=X3[s],D=ke(I=>I.pendingPathConfirmation),T=s==="pending"&&D&&E&&D.callId===E?D:null;return l==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(n0,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Kv(r,i)}),o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>A(!j),children:[o.jsx("span",{className:`${N.color} ${N.animate?"animate-pulse":""}`,children:N.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Kv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:j?"▼":"▶"})]}),T&&o.jsx(V3,{confirmation:T}),(j||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(W3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:m,streamingOutput:x,status:s,result:f,error:c,durationMs:d}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[g&&g.regions.length>0?o.jsx(H3,{regions:g.regions,filePath:String(i.path??"")}):o.jsx(B3,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Vv,{diagnostics:p})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(z3,{content:String(i.content??""),filePath:String(i.path??"")}),p&&p.length>0&&o.jsx(Vv,{diagnostics:p})]}),r==="read_file"&&s==="success"&&o.jsx($3,{result:f,metadata:_,filePath:String(i.path??""),heightExpanded:j}),r==="return_value"&&(()=>{const I=(x==null?void 0:x.map(q=>q.content).join(""))??"",z=s==="pending"&&I?I:String(i.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:z})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:Y3(i)})]}),s==="success"&&f!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",d!==void 0&&` (${d}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:f||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",d,"ms"]}),s==="error"&&c&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:c})]})]})]})}),Q3={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 J3(e){return Q3[e]??`Preparing ${e}`}const e5=P.memo(function({name:r}){const i=J3(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(n0,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),t5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},n5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const l=t5[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(l==null?void 0:l.color)??"text-text-muted"} ${l!=null&&l.animate?"animate-pulse":""} text-sm leading-tight`,children:(l==null?void 0:l.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Yv={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},s0=P.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),l=r.find(u=>{var f,c;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((c=u.result)==null?void 0:c.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:l?(()=>{const u=l.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((c,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(zi,{content:`[${c.id}] ${c.description}`})})]},c.id??d))}catch{return r.map((f,c)=>o.jsx(Xv,{tc:f,index:c,criteriaMap:s},f.id??c))}})():r.map((u,f)=>o.jsx(Xv,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function Xv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,l=s&&Yv[s]?Yv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",c=u.id,d=u.description,p=c?i.get(c):void 0,g=d??(p==null?void 0:p.description)??(f&&c?`[${c}]`:"Criterion updated"),m=u.reason,x=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${l.color} text-sm leading-tight flex-shrink-0`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(zi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${x?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function r5(e){return e==="criterion"}const i5="#6b7280";function Fl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??i5}const Gt=Kn(e=>{const r=async()=>{await wh("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await ai("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const l=await ai("PUT",`/api/agents/${i}`,s);return l.success&&await r(),l},deleteAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async i=>{try{const s=await Ce(`/api/agents/${i}/duplicate`,{method:"POST"}),l=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function s5(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const l of e)l.type==="tool_call"&&r5(l.toolCall.name)?i.push(l.toolCall):(s(),r.push(l));return s(),r}function a5(e,r){if(e.segments&&e.segments.length>0)return o5(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function o5(e,r,i,s,l){const u=[],f=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=f.get(c.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const c of i)u.push({type:"preparing_tool_call",preparing:c});return l&&s&&u.push({type:"stats",stats:s}),u}const lf=P.memo(function({message:r,showStats:i=!0,showThinking:s=!0,showVerboseToolOutput:l=!0}){const u=ke(x=>{var _;return(_=x.currentSession)==null?void 0:_.criteria}),f=Gt(x=>x.defaults),c=Gt(x=>x.userItems),d=[...f,...c],p=a5(r,i),g=s?p:p.filter(x=>x.type!=="thinking"),m=s5(g);return m.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[m.map((x,_)=>{var E,C;switch(x.type){case"thinking":return o.jsx(L3,{content:x.content},_);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(zi,{content:x.content})},_);case"preparing_tool_call":return o.jsx(e5,{name:x.preparing.name},`preparing-${x.preparing.index}`);case"tool_call":{const b=x.toolCall,v=b.result;if(b.name==="todo_write"){const j=b.arguments.todos,A=Array.isArray(j)?j:[];return o.jsx(n5,{todos:A},_)}const y=(E=v==null?void 0:v.output)==null?void 0:E.includes("[interrupted by user]"),S=v?y?"interrupted":v.success?"success":"error":"pending";return o.jsx(Z3,{tool:b.name,args:b.arguments,status:S,variant:"expandable",forceCompact:!l,result:v==null?void 0:v.output,error:v==null?void 0:v.error,durationMs:v==null?void 0:v.durationMs,diagnostics:v==null?void 0:v.diagnostics,editContext:v==null?void 0:v.editContext,startedAt:b.startedAt,streamingOutput:b.streamingOutput,metadata:v==null?void 0:v.metadata,callId:b.id},_)}case"criteria_group":return o.jsx(s0,{toolCalls:x.toolCalls,criteria:u},_);case"stats":{const b=x.stats,v=((C=b.model.split("/").pop())==null?void 0:C.split("-").slice(0,2).join("-"))??b.model,y=Fl(d,b.mode),S=A=>A>=1e3?`${(A/1e3).toFixed(1)}k`:A.toString(),j=A=>A>=1e3?`${(A/1e3).toFixed(1)}k`:A.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:v}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:y},children:b.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[b.totalTime.toFixed(1),"s"]}),b.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[b.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(b.prefillTokens)," @ ",j(b.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[S(b.generationTokens)," @ ",j(b.generationSpeed)," tg"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const A=new CustomEvent("open-turn-stats",{detail:{stats:b}});window.dispatchEvent(A)},children:o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},_)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsx("span",{children:"Aborted"})]})]})})}),It=Kn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Ce("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Ce("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await ai("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const l=await ai("PUT",`/api/workflows/${i}`,s);return l.success&&await r().fetchWorkflows(),l},deleteWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}/duplicate`,{method:"POST"}),l=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Ul(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${l},${r})`}function l5(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function c5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const u5=P.memo(function({data:r}){var f;const i=It(c=>c.defaults),s=It(c=>c.userItems),u=((f=[...i,...s].find(c=>c.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Ul(u,.3),backgroundColor:Ul(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:u,viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ba,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ba,{label:"Total time",value:l5(r.totalTimeSeconds)}),o.jsx(Ba,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ba,{label:"Tokens",value:c5(r.totalTokensGenerated)}),o.jsx(Ba,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ba({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const d5=P.memo(function({data:r}){var f;const i=It(c=>c.defaults),s=It(c=>c.userItems),u=((f=[...i,...s].find(c=>c.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Ul(u,.3),backgroundColor:Ul(u,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:u,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function h5({attachments:e,messageId:r}){const[i,s]=P.useState(null),l=ke(g=>g.visionFallbackByMessage),u=ke(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const x=u[m];if(x&&x.role==="assistant")return x.id}return null},[u,r]),c=g=>{s(g)},d=()=>{s(null)},p=g=>{const m=`${r}-${g}`;if(l[m])return l[m];if(f){const x=`${f}-${g}`;return l[x]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=p(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>c(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),i&&o.jsx(i0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function f5({isOpen:e,onClose:r,promptContext:i}){const[s,l]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{l(c=>({...c,[f]:!c[f]}))};return o.jsx(Ct,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Es,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(Es,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((f,c)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:f.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:f.source}),f.toolCallId&&o.jsx("span",{className:"font-mono",children:f.toolCallId}),f.attachments&&f.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[f.attachments.length," attachment",f.attachments.length===1?"":"s"]})]}),f.attachments&&f.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:f.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:f.content||"(empty)"})]},`${f.role}-${c}`))})}),o.jsx(Es,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((f,c)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:f.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:f.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(f.parameters,null,2)})]},`${f.name}-${c}`))]})}),o.jsx(Es,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(Es,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((f,c)=>o.jsx(p5,{file:f,expanded:s[`file-${c}`]??!1,onToggle:()=>u(`file-${c}`)},c))})}),o.jsx(Es,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function p5({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function Es({title:e,expanded:r,onToggle:i,badge:s,children:l}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:l})]})}function m5({content:e,promptContext:r,align:i="right"}){const[s,l]=P.useState(!1),[u,f]=P.useState(!1),[c,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const x=_=>{p.current&&!p.current.contains(_.target)&&l(!1)};return s&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]);const g=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)}d(!0),l(!1),window.setTimeout(()=>d(!1),1500)}catch(x){console.error("Failed to copy:",x)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[c&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>l(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),l(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Inspect"]})]})]})]}),r&&o.jsx(f5,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function g5({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,l=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",f=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[f]??"injected",p=f==="workflow"||f==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${p?"":"cursor-pointer"}`,style:{backgroundColor:l},onClick:()=>!p&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},onClick:()=>!p&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&i(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),p&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${l}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(Ct,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function x5({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",l=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!l&&o.jsx(m5,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${l?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[l&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${l?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(h5,{attachments:e.attachments,messageId:e.id})]})]})}const a0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const l=r.role==="user",u=r.role==="assistant",f=r.role==="system",c=r.role==="tool";if(u)return o.jsx(lf,{message:r,showStats:i});if(f&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
138
- `,"")})]});if(c)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(d5,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(u5,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(g5,{message:r}):l?o.jsx(x5,{message:r,promptContext:s}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(zi,{content:r.content})})})});function v5({stats:e,onClose:r}){var i;return o.jsx(Ct,{isOpen:!0,onClose:r,title:"Turn Stats",size:"md",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx(Nl,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),o.jsx(Nl,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),o.jsx(Nl,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),o.jsx(Nl,{label:"LLM Calls",value:String(((i=e.llmCalls)==null?void 0:i.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((s,l)=>o.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",l+1]}),o.jsxs("span",{className:"text-xs text-text-muted",children:[s.ttft.toFixed(2),"s TTFT · ",s.completionTime.toFixed(2),"s gen"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",o.jsxs("span",{className:"text-text-primary",children:[s.promptTokens," → ",s.completionTokens]})]}),o.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[s.temperature!==void 0&&o.jsx(Tl,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&o.jsx(Tl,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&o.jsx(Tl,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&o.jsx(Tl,{label:"maxTok",value:String(s.maxTokens)})]})]})]},l))]})]})})}function Nl({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-xs text-text-muted",children:e}),o.jsx("div",{className:"text-lg font-semibold text-text-primary",children:r})]})}function Tl({label:e,value:r}){return o.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[o.jsxs("span",{className:"text-text-muted",children:[e,":"]})," ",r]})}const o0=(e,r)=>{const i=P.useRef(!0),[s,l]=P.useState(!0),u=()=>{const f=e.current;f&&(f.scrollTop=f.scrollHeight)};return P.useEffect(()=>{const f=e.current;if(!f)return;const c=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{f.scrollHeight-f.scrollTop-f.offsetHeight<100&&(i.current=!0,l(!0))}));return}i.current=!1,l(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),p=setInterval(()=>{i.current&&u()},1e3);return f.addEventListener("wheel",c,{passive:!0}),d.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>{f.removeEventListener("wheel",c),d.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,l(!0),u()},isAutoScrollActive:s,setAutoScroll:f=>{i.current=f,l(f),f&&u()}}},b5={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function y5(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function Zv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function _5({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:l}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:Zv(u,l),children:[Ml(r),"/",Ml(i)]}),o.jsxs("span",{className:Zv(u,l),children:["(",u,"%)"]}),o.jsx(Bb,{percent:u,dangerZone:l,size:"sm"}),l&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const S5=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:l}){const u=P.useRef(null),f=P.useRef(null),[c,d]=P.useState(!1),p=Gt(D=>D.defaults),g=Gt(D=>D.userItems),m=[...p,...g],x=ke(D=>D.subAgentContextStates[s]),{showThinking:_,showVerboseToolOutput:E}=xb(),{isAutoScrollActive:C,setAutoScroll:b}=o0(f,null);P.useEffect(()=>{l||b(!0)},[l]);const v=P.useCallback(()=>{const D=!c;d(D),D&&setTimeout(()=>{var T;(T=u.current)==null||T.scrollIntoView({block:"start",behavior:"smooth"})},220)},[c]),y=m.find(D=>D.id===i),S=(y==null?void 0:y.name)??b5[i]??i,j=Fl(m,i),A=y5(j),N=r.filter(D=>D.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:A,children:[o.jsx("span",{className:"text-xs font-medium",children:S}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:x&&o.jsx(_5,{contextState:x})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>b(!C),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${C?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:v,children:[c?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${c?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:N.map(D=>D.role==="assistant"?o.jsx(lf,{message:D,showStats:!0,showThinking:_,showVerboseToolOutput:E},D.id):o.jsx(a0,{message:D,isLastAssistantMessage:!1},D.id))})]})});function w5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function C5({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f}){return o.jsxs(kb,{isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:l,onDuplicate:u,onDelete:f,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(c=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:c},c)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function Qv({title:e,agents:r,subagents:i,isBuiltIn:s,onView:l,onDuplicate:u,onEdit:f,onDelete:c}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(C5,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>l(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?void 0:()=>c==null?void 0:c(p.id)},p.id);return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsxs("div",{className:"space-y-2",children:[r.map(d),i.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:i.map(d)})]})]})]})}function k5({isOpen:e,onClose:r,initialEditId:i}){const s=Gt(me=>me.defaults),l=Gt(me=>me.userItems),u=Gt(me=>me.loading),f=Gt(me=>me.fetchAgents),c=Gt(me=>me.fetchAgent),d=Gt(me=>me.fetchDefaultContent),p=Gt(me=>me.createAgent),g=Gt(me=>me.updateAgent),m=Gt(me=>me.deleteAgent),[x,_]=P.useState("list"),[E,C]=P.useState(null),[b,v]=P.useState(!1),[y,S]=P.useState(""),[j,A]=P.useState(""),[N,D]=P.useState(""),[T,I]=P.useState(!0),[z,q]=P.useState([]),[K,W]=P.useState("#6b7280"),[R,U]=P.useState(""),[H,X]=P.useState(""),[Z,B]=P.useState(!1),[L,M]=P.useState([]);function V(me){const je=new Map;for(const Oe of me){const ct=Oe.indexOf(":");if(ct===-1)je.set(Oe,new Set);else{const ue=Oe.slice(0,ct),Te=Oe.slice(ct+1).split(",").filter(Boolean);je.set(ue,new Set(Te))}}return je}function F(me){const je=[];for(const[Oe,ct]of me)ct.size===0?je.push(Oe):je.push(`${Oe}:${[...ct].join(",")}`);return je}const re=V(z),Q=(me,je)=>{const Oe=new Map(re),ct=Oe.get(me)||new Set,ue=new Set(ct);ue.has(je)?ue.delete(je):ue.add(je),ue.size===0?Oe.set(me,new Set):Oe.set(me,ue),q(F(Oe))},ee=me=>{const je=new Map(re);je.has(me)?je.delete(me):je.set(me,new Set),q(F(je))},Y=me=>{S(me.metadata.name),A(me.metadata.id),D(me.metadata.description),I(me.metadata.subagent),q(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),U(me.prompt),X("")},$=(me,je,Oe)=>{S(me.metadata.name+" (copy)"),A(`${je}-copy-${Date.now()}`),D(me.metadata.description),I(me.metadata.subagent),q(me.metadata.allowedTools),W(me.metadata.color??"#6b7280"),U(me.prompt),X(""),C(null),v(!1),_("edit")},ae=(me,je)=>{Y(me),C(je),v(!0),_("edit")};P.useEffect(()=>{e&&(f(),Ce("/api/tools").then(me=>me.json()).then(me=>M(me.tools||[])).catch(()=>M([])),i?s.some(je=>je.id===i)?d(i).then(je=>{je&&$(je,i)}):c(i).then(je=>{je&&(Y(je),C(i),v(!1),_("edit"))}):(_("list"),C(null),v(!1)))},[e,f,c,d,i]);const ne=async me=>{if(s.some(Oe=>Oe.id===me)){const Oe=await d(me);if(!Oe)return;ae(Oe,me)}else{const Oe=await c(me);if(!Oe)return;ae(Oe,me)}},ve=async me=>{const je=await d(me);je&&$(je,me)},ye=()=>{C(null),S(""),A(""),D(""),I(!0),q(["read_file"]),W("#6b7280"),U(""),X(""),v(!1),_("edit")},Ae=async me=>{const je=await c(me);je&&(Y(je),C(me),v(!1),_("edit"))},Re=async me=>{await m(me)},He=async()=>{const me=E??j;if(!me||!y||!R){X("Name and prompt are required.");return}B(!0),X("");const je={metadata:{id:me,name:y,description:N,subagent:T,allowedTools:z,color:K},prompt:R},Oe=E?await g(E,je):await p(je);if(B(!1),!Oe.success){X(Oe.error??"Failed to save agent.");return}i?r():_("list")},Ue=()=>{i?r():(_("list"),v(!1))},Ee=me=>{S(me),E||A(w5(me))},xe=s.filter(me=>me.subagent),Ne=s.filter(me=>!me.subagent),$e=l.filter(me=>me.subagent),At=l.filter(me=>!me.subagent);return x==="edit"?o.jsx(Ct,{isOpen:e,onClose:Ue,title:b?`${y}`:E?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[H&&o.jsx(jh,{message:H}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Name",value:y,onChange:Ee,placeholder:"My Agent",readOnly:b}),o.jsx(Ai,{label:"ID",value:j,onChange:A,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:b}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!b&&I(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${b?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!b&&I(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${b?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:K,onChange:me=>!b&&W(me.target.value),disabled:b,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(me=>{const je=re.has(me.name),Oe=me.actions.length>0,ct=re.get(me.name)||new Set,ue=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${je?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:me.name}),Oe&&o.jsx("span",{className:`text-[10px] ${je&&ct.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},me.name);return Oe?b?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:me.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},me.name):o.jsx(no,{trigger:ue,minWidth:"160px",items:[...me.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${me.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${me.name}-${_e}`,checked:ct.has(_e),onChange:()=>Q(me.name,_e),disabled:b,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:je?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(je)ee(me.name);else{const _e=new Map(re);_e.set(me.name,new Set(me.actions)),q(F(_e))}}}]},me.name):o.jsx("button",{onClick:()=>!b&&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"} ${b?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:me.name})},me.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:R,onChange:me=>!b&&U(me.target.value),readOnly:b,placeholder:"Instructions for this agent...",className:`flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary ${b?"opacity-60":""}`})]}),o.jsx(VS,{onCancel:Ue,onSave:He,saving:Z,saveDisabled:!y||!R||b}),b&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(et,{variant:"primary",onClick:()=>{S(y+" (copy)"),A(`${E}-copy-${Date.now()}`),C(null),v(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(Ct,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(et,{variant:"primary",size:"sm",onClick:ye,children:"+ New"})})]}),u&&s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsx(Qv,{title:"Built-in",agents:Ne,subagents:xe,isBuiltIn:!0,onView:ne,onDuplicate:ve}),l.length>0&&o.jsx(Qv,{title:"Custom",agents:At,subagents:$e,isBuiltIn:!1,onView:ne,onDuplicate:ve,onEdit:Ae,onDelete:Re})]})]})}function E5(){const e=ke(v=>{var y;return(y=v.currentSession)==null?void 0:y.mode}),r=ke(v=>v.switchMode),i=Gt(v=>v.defaults),s=Gt(v=>v.userItems),l=Gt(v=>v.fetchAgents),u=[...i,...s],[f,c]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),x=P.useRef(null);if(P.useEffect(()=>{l()},[l]),P.useEffect(()=>{function v(y){x.current&&!x.current.contains(y.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]),!e)return null;const _=u.filter(v=>!v.subagent),E=_.find(v=>v.id===e),C=(E==null?void 0:E.name)??e,b=Fl(u,e);return o.jsxs("div",{className:"relative",ref:x,children:[o.jsxs("button",{type:"button",onClick:()=>c(!f),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:b},children:C}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map(v=>{const y=v.id===e,S=Fl(u,v.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${y?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{y||r(v.id),c(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:S},children:v.name}),y&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(Oi,{className:"opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),c(!1),m(v.id),p(!0)}})]},v.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{c(!1),p(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),o.jsx(k5,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function j5(){const e=ke(s=>s.currentSession),r=ke(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function N5({question:e}){const r=ke(f=>f.answerQuestion),[i,s]=P.useState(""),l=()=>{r(e.callId,i)},u=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),l())};return o.jsx(Ct,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:i,onChange:f=>s(f.target.value),onKeyDown:u,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(et,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})})}function T5(){const e=ke(s=>s.connectionStatus),r=ke(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
139
- flex items-center justify-between px-4 py-2
140
- text-sm font-medium
141
- ${i?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
142
- `,children:[o.jsx("div",{className:"flex items-center gap-2",children:i?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),o.jsx("span",{children:"Reconnecting to server..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:i,className:`
143
- px-3 py-1 rounded text-xs font-medium
144
- transition-colors
145
- ${i?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
146
- `,children:i?"Reconnecting...":"Reconnect"})]})}function A5(){const e=PS(),r=e?"bg-amber-400":"bg-accent-primary";return o.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"flex gap-0.5",children:[o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),o.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&o.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function D5({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return o.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[o.jsx(Va,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),o.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),o.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),o.jsx("div",{className:"text-[10px] text-text-muted",children:i(e.size)})]})}function L5({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:l}){const u=P.useRef(null),f=P.useRef(null);P.useEffect(()=>{f.current&&u.current&&f.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const c=p=>{switch(p.key){case"Enter":p.preventDefault(),e[r]&&i(e[r].content);break;case"Escape":p.preventDefault(),s();break;case"ArrowUp":p.preventDefault(),l("up");break;case"ArrowDown":p.preventDefault(),l("down");break}},d=p=>{i(p)};return o.jsx("div",{ref:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:c,children:e.map((p,g)=>o.jsxs("div",{ref:g===r?f:null,role:"listitem",onClick:()=>d(p.content),className:`
147
- p-2 rounded cursor-pointer transition-colors
148
- ${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
149
- `,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[p.formattedTimestamp,p.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:p.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:p.trimmedContent})]},p.id))})}const R5={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function O5(e,r={}){const i={...R5,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const l=await e.arrayBuffer(),u=F5(l),f=`data:${e.type};base64,${u}`,c=await l0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await M5(e,i)}async function M5(e,r){const i=await B5(e),s=await l0(i),{width:l,height:u}=I5(s.width,s.height,r.maxWidth,r.maxHeight),f=z5();f.width=l,f.height=u;const c=f.getContext("2d");if(!c)throw new Error("Failed to get canvas context");c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(s,0,0,l,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Jv(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Jv(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:u}}function I5(e,r,i,s){const l=e/r;return e>r&&e>i?{width:i,height:Math.round(i/l)}:r>e&&r>s?{width:Math.round(s*l),height:s}:{width:e,height:r}}function B5(e){return new Promise((r,i)=>{const s=P5(),l=new s;l.onload=()=>r(l.result),l.onerror=()=>i(new Error("Failed to read file")),l.readAsDataURL(e)})}function l0(e){return new Promise((r,i)=>{const s=H5(),l=new s;l.onload=()=>r(l),l.onerror=()=>i(new Error("Failed to load image")),l.src=e})}function z5(){var r;const e=cf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function H5(){const e=cf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function P5(){const e=cf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function cf(){return globalThis}function F5(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const l=r[s];l!==void 0&&(i+=String.fromCharCode(l))}return btoa(i)}function Jv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function U5(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function $5(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${eb(e.size)}). Maximum size is ${eb(r)}.`}:{valid:!0}}function eb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Zd(e,r,i,s={}){const{maxSizeBytes:l=50*1024*1024,filename:u}=s;if(!U5(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=$5(e,l);if(!f.valid){i(f.error??"Image file is too large");return}try{const c=await O5(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:mb(),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";i(d)}}function q5(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function W5({label:e,children:r}){return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-sm font-medium text-text-secondary border-b border-border/50 pb-1",children:e}),r]})}function za({label:e,value:r,onChange:i,min:s,max:l,step:u=1,helpText:f,defaultValue:c}){const[d,p]=P.useState((r==null?void 0:r.toString())??""),[g,m]=P.useState(r===null);P.useEffect(()=>{p((r==null?void 0:r.toString())??""),m(r===null)},[r]);const x=E=>{if(p(E),E==="")i(null);else{const C=parseFloat(E);isNaN(C)||i(C)}},_=()=>{g?(m(!1),c!==void 0&&(p(c.toString()),i(c))):(m(!0),i(null))};return o.jsxs("div",{children:[o.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[e,o.jsx("button",{type:"button",onClick:_,className:`text-xs px-1.5 py-0.5 rounded border ${g?"border-accent-primary/50 bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-secondary"}`,title:g?"Click to set a custom value":"Click to use default",children:g?"default":"custom"})]}),o.jsx("input",{type:"number",min:s,max:l,step:u,value:d,readOnly:g,onChange:E=>x(E.target.value),onClick:()=>g&&_(),placeholder:g?"Using profile 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 ${g?"opacity-50 cursor-pointer":""}`}),f&&o.jsx("p",{className:"text-xs text-text-muted mt-1",children:f})]})}function G5({isOpen:e,onClose:r,providerId:i,model:s}){const[l,u]=P.useState({contextWindow:s.contextWindow,temperature:s.temperature??null,topP:s.topP??null,topK:s.topK??null,maxTokens:s.maxTokens??null}),[f,c]=P.useState(!1),d=jt(m=>m.updateModelSettings);P.useEffect(()=>{u({contextWindow:s.contextWindow,temperature:s.temperature??null,topP:s.topP??null,topK:s.topK??null,maxTokens:s.maxTokens??null})},[s]);const p=async()=>{if(l.contextWindow<1024||l.contextWindow>1e7)return;c(!0);const m=l.temperature!==(s.temperature??null)||l.topP!==(s.topP??null)||l.topK!==(s.topK??null)||l.maxTokens!==(s.maxTokens??null);await d(i,s.id,{contextWindow:l.contextWindow,...m&&{temperature:l.temperature,topP:l.topP,topK:l.topK,maxTokens:l.maxTokens}}),c(!1),r()},g=()=>{u({contextWindow:s.contextWindow,temperature:s.temperature??null,topP:s.topP??null,topK:s.topK??null,maxTokens:s.maxTokens??null}),r()};return e?o.jsx(Ct,{isOpen:e,onClose:r,title:"Model Properties",size:"sm",footer:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{variant:"secondary",onClick:g,disabled:f,children:"Cancel"}),o.jsx(et,{variant:"primary",onClick:p,disabled:f||l.contextWindow<1024||l.contextWindow>1e7,children:f?"Saving...":"Save"})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded font-mono text-sm break-all",children:s.id})]}),o.jsx(za,{label:"Context Window",value:l.contextWindow,onChange:m=>m!==null&&u(x=>({...x,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),o.jsxs(W5,{label:"Sampling Parameters",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(za,{label:"Temperature",value:l.temperature,onChange:m=>u(x=>({...x,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1}),o.jsx(za,{label:"Top P",value:l.topP,onChange:m=>u(x=>({...x,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1})]}),o.jsx(za,{label:"Top K",value:l.topK,onChange:m=>u(x=>({...x,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)"})]}),o.jsx(za,{label:"Max Tokens",value:l.maxTokens,onChange:m=>u(x=>({...x,maxTokens:m})),min:256,max:32e3,helpText:"Maximum tokens to generate per response"}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded text-sm",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]})}):null}function V5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function K5(){var U;const[,e]=cr(),r=ke(H=>H.currentSession),i=ke(H=>H.setSessionProvider),[s,l]=P.useState(!1),[u,f]=P.useState([]),[c,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),x=P.useRef(new Set),_=jt(H=>H.providers),E=jt(H=>H.activeProviderId),C=jt(H=>H.model);jt(H=>H.backend);const b=jt(H=>H.llmStatus),v=jt(H=>H.activating),y=jt(H=>H.activateProvider),S=jt(H=>H.refreshModel),j=jt(H=>H.refreshProviderModels);P.useEffect(()=>{function H(X){p.current&&!p.current.contains(X.target)&&(l(!1),f([]),x.current=new Set)}return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]),P.useEffect(()=>{if(s){const H=_.map(X=>X.id);f(H),H.forEach(X=>{x.current.has(X)||(x.current.add(X),D(X))})}},[s,_]),_.find(H=>H.id===E);const A=b==="disconnected",N=C?((U=C.split("/").pop())==null?void 0:U.replace(/-/g," "))??C:"detecting...",D=async H=>{d(H);try{await j(H)}catch{}finally{d(null)}},T=H=>{u.includes(H.id)?f(u.filter(X=>X!==H.id)):(f([...u,H.id]),D(H.id))},I=async H=>{if(H.id===E){T(H);return}r?(i(H.id,void 0),jt.getState().syncFromSession(H.id,""),l(!1),f([])):await y(H.id)&&(l(!1),f([]))},z=H=>{T(H)},q=async(H,X)=>{H.stopPropagation(),x.current.delete(X),await j(X),await D(X)},K=(H,X)=>{m({providerId:H,model:X})},W=()=>{m(null)},R=async(H,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",H,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(H,X),jt.getState().syncFromSession(H,X),f([]),l(!1);return}d("activating");try{(await Ce(`/api/providers/${H}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await jt.getState().fetchConfig(),f([]),l(!1))}catch{}finally{d(null)}};return _.length===0?o.jsxs("button",{type:"button",onClick:()=>S(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>l(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[o.jsx("div",{className:"py-1",children:_.map(H=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${H.id===E?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${v?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!v&&I(H),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${H.id===E?"text-accent-primary":"text-text-primary"}`,children:H.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:H.backend!=="auto"&&_S(H.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[H.id===E?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),q(Z,H.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${c===H.id?"animate-spin":""} ${H.id===E?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),o.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),z(H)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(H.id)?"rotate-180":""} ${H.id===E?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(H.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:c===H.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=H.models)!=null&&X.length?H.models.map(Z=>{var B;return o.jsxs("button",{type:"button",onClick:()=>R(H.id,Z.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":""} ${C===Z.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((B=Z.id.split("/").pop())==null?void 0:B.replace(/-/g," "))??Z.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:V5(Z.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),K(H.id,Z)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})})]}),C===Z.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Z.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},H.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(G5,{isOpen:!0,onClose:W,providerId:g.providerId,model:g.model})]})}const Rn=Kn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await wh("/api/commands",e)},fetchCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await ai("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const l=await ai("PUT",`/api/commands/${i}`,s);return l.success&&await r().fetchCommands(),l},deleteCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`,{method:"DELETE"}),l=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:l.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async i=>{try{const s=await Ce(`/api/commands/${i}/duplicate`,{method:"POST"}),l=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:l.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Y5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const X5="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 Z5({onClick:e}){return o.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:X5})})})}function c0({isOpen:e,onClose:r,initialEditId:i}){const s=Rn(xe=>xe.defaults),l=Rn(xe=>xe.userItems),u=Rn(xe=>xe.loading),f=Rn(xe=>xe.fetchCommands),c=Rn(xe=>xe.fetchCommand),d=Rn(xe=>xe.fetchDefaultContent),p=Rn(xe=>xe.createCommand),g=Rn(xe=>xe.updateCommand),m=Rn(xe=>xe.deleteCommand),[x,_]=P.useState(null),[E,C]=P.useState(null),{view:b,editingId:v,formError:y,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:I}=Nb(),{requestDelete:z,clearConfirm:q,isConfirming:K}=Ch(),W=P.useRef(!1),R=Gt(xe=>xe.defaults),U=Gt(xe=>xe.userItems),H=Gt(xe=>xe.fetchAgents),Z=[...R,...U].filter(xe=>!xe.subagent),B=P.useRef(f),L=P.useRef(H),M=P.useRef(c),V=P.useRef(d),F=P.useRef(i),re=P.useRef(A),Q=P.useRef(N),ee=P.useRef(D),Y=P.useRef(q);P.useEffect(()=>{B.current=f,L.current=H,M.current=c,V.current=d,F.current=i,re.current=A,Q.current=N,ee.current=D,Y.current=q}),P.useEffect(()=>{if(e)if(B.current(),L.current(),W.current||(Y.current(),W.current=!0),F.current){const xe=s.some(Ne=>Ne.id===F.current);re.current("edit"),Q.current(F.current),ee.current(""),xe?V.current(F.current).then(Ne=>{Ne&&T({name:Ne.metadata.name+" (copy)",id:`${F.current}-copy-${Date.now()}`,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!0})}):M.current(F.current).then(Ne=>{Ne&&T({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1})})}else re.current("list"),Q.current(null);else W.current=!1},[e]);const $=async xe=>{_(xe);const Ne=await d(xe);C((Ne==null?void 0:Ne.prompt)??null)},ae=async xe=>{if(s.some($e=>$e.id===xe)){const $e=await d(xe);$e&&(N(null),T({name:`${$e.metadata.name} (copy)`,id:`${xe}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!0}),D(""),A("edit"))}else{const $e=await c(xe);$e&&(N(null),T({name:`${$e.metadata.name} (copy)`,id:`${xe}-copy-${Date.now()}`,prompt:$e.prompt,agentMode:$e.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))}},ne=()=>{T({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),A("edit")},ve=async xe=>{const Ne=await c(xe);Ne&&(N(xe),T({name:Ne.metadata.name,id:Ne.metadata.id,prompt:Ne.prompt,agentMode:Ne.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))},ye=async xe=>{await m(xe),q()},Ae=async()=>{const xe=v??j.id;if(!xe||!j.name||!j.prompt){D("Name and message are required.");return}I(!0),D("");const Ne={metadata:{id:xe,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},$e=v?await g(v,Ne):await p(Ne);if(I(!1),!$e.success){D($e.error??"Failed to save command.");return}i?r():A("list")},Re=()=>{i?r():(A("list"),_(null),C(null))},He=xe=>{T(Ne=>({...Ne,name:xe})),(!v||j.isDefault)&&T(Ne=>({...Ne,id:Y5(xe)}))},Ue=()=>{_(null),C(null),A("list")},Ee=()=>{x&&(_(null),A("edit"),N(x),d(x).then(xe=>{xe&&T({name:`${xe.metadata.name} (copy)`,id:`${x}-copy-${Date.now()}`,prompt:xe.prompt,agentMode:xe.metadata.agentMode??"",isDefault:!0})}))};if(x){const xe=s.find(Ne=>Ne.id===x);return o.jsx(Ct,{isOpen:e,onClose:Ue,title:`Default: ${(xe==null?void 0:xe.name)??x}`,size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),o.jsx("span",{className:"font-mono",children:x})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:xe==null?void 0:xe.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(xe==null?void 0:xe.agentMode)||"None"})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:E??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(et,{variant:"secondary",onClick:Ue,children:"Close"}),o.jsx(et,{variant:"primary",onClick:Ee,children:"Duplicate & Customize"})]})]})})}return b==="edit"?o.jsx(Ct,{isOpen:e,onClose:Re,title:v?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[y&&o.jsx(jh,{message:y}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(jb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!v&&!j.isDefault,onNameChange:He,onIdChange:xe=>T(Ne=>({...Ne,id:xe}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:j.agentMode,onChange:xe=>T(Ne=>({...Ne,agentMode:xe.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[o.jsx("option",{value:"",children:"None (keep current mode)"}),Z.map(xe=>o.jsx("option",{value:xe.id,children:xe.name},xe.id))]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:j.prompt,onChange:xe=>T(Ne=>({...Ne,prompt:xe.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(et,{variant:"secondary",onClick:Re,children:"Cancel"}),o.jsx(et,{variant:"primary",onClick:Ae,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(Ct,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(Cb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:ne}),o.jsxs(Eb,{loading:u,hasItems:s.length>0||l.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(xe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:xe.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Z5,{onClick:()=>$(xe.id)}),o.jsx(Ga,{onClick:()=>ae(xe.id)})]})]},xe.id))})]}),l.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:l.map(xe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:xe.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Oi,{onClick:()=>ve(xe.id)}),o.jsx(Ga,{onClick:()=>ae(xe.id)}),K(xe.id,"delete")?o.jsx(kh,{onConfirm:()=>ye(xe.id),onCancel:q}):o.jsx(Eh,{onClick:()=>z(xe.id)})]})]},xe.id))})]})]})]})}function u0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:l}){const[u,f]=P.useState(""),[c,d]=P.useState(0),p=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{r&&(f(""),d(0),requestAnimationFrame(()=>{var b;return(b=g.current)==null?void 0:b.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const b=v=>{p.current&&!p.current.contains(v.target)&&s()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),x=P.useCallback(b=>{f(b),d(0)},[]),_=P.useCallback(b=>{const v=e.filter(y=>l(y,u));switch(b.key){case"ArrowDown":b.preventDefault(),d(y=>Math.min(y+1,v.length-1));break;case"ArrowUp":b.preventDefault(),d(y=>Math.max(y-1,0));break;case"Enter":b.preventDefault();break;case"Escape":b.preventDefault(),s();break}},[e,u,l,s]),E=P.useCallback(()=>{d(0)},[]),C=e.filter(b=>l(b,u));return{isOpen:r,search:u,selectedIndex:c,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:x,handleKeyDown:_,setSelectedIndex:d,resetSelection:E}}function d0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function h0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:l}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:l,className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})})}function f0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function p0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function m0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:e})})}function Q5({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[l,u]=P.useState(!1),[f,c]=P.useState(null),d=Rn(D=>D.defaults),p=Rn(D=>D.userItems),g=Rn(D=>D.fetchCommands),m=[...d,...p],{isOpen:x,search:_,selectedIndex:E,filtered:C,containerRef:b,searchRef:v,handleToggle:y,handleSearchChange:S,handleKeyDown:j}=u0({items:m,isOpen:l,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(D,T)=>!T||D.name.toLowerCase().includes(T.toLowerCase())});P.useEffect(()=>{l&&g()},[l,g]);const A=async D=>{const T=await Rn.getState().fetchCommand(D);T&&e(T.prompt,T.metadata.agentMode,i,s),u(!1)},N=()=>{u(!1),r()};return o.jsxs("div",{ref:b,className:"relative",children:[o.jsx(d0,{label:"Commands",isOpen:x,onClick:y}),x&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:j,children:[o.jsx(h0,{value:_,onChange:S,onKeyDown:j,ref:v,placeholder:"Search commands..."}),o.jsx(f0,{children:C.length===0?o.jsx(p0,{hasItems:m.length>0,message:"No commands yet"}):C.map((D,T)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${T===E?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>A(D.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:D.name})}),o.jsx(Oi,{className:"opacity-0 group-hover:opacity-100",onClick:I=>{I.stopPropagation(),u(!1),c(D.id)}})]},D.id))}),o.jsx(m0,{label:"Manage Commands...",onClick:N})]}),o.jsx(c0,{isOpen:!!f,onClose:()=>c(null),initialEditId:f})]})}function J5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function eA(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const tA=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],g0={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)"}],ji=150,Dr=54,js=80,Dn=30,Ns=70,tb=100,Ni=50,Al=50,nb=4;function uf(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function nA(e,r,i,s){const l=Al+Ni+ji+tb+ji+Ni+Al,u=l/2,f=Al+Ni+ji/2,c=Al+Ni+ji+tb+ji/2,d=[],p=[],g=new Map,m=e.filter(R=>R.type==="agent"||R.type==="shell"),x=e.filter(R=>R.type==="sub_agent"),_=x.length>0,E=_?f:u,C=m.length>0?c:u,b=Ni+Dn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:b,w:js,h:Dn}),g.set("$start",{cx:E,cy:b,w:js,h:Dn}),e.length===0){const R=b+Dn/2+Ns*2+Dn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:R,w:js,h:Dn}),g.set("$done",{cx:E,cy:R,w:js,h:Dn}),{nodes:d,edges:p,width:l,height:R+Dn/2+Ni,posMap:g}}const v=b+Dn/2+Ns,y=(R,U)=>{R.forEach((H,X)=>{const Z=v+X*(Dr+Ns)+Dr/2,{name:B,color:L}=uf(H,s);d.push({id:H.id,type:"step",label:B,color:L,cx:U,cy:Z,w:ji,h:Dr}),g.set(H.id,{cx:U,cy:Z,w:ji,h:Dr})})};y(m,E),y(x,C);const S=m.length>0?v+(m.length-1)*(Dr+Ns)+Dr/2:b,j=_?v+(x.length-1)*(Dr+Ns)+Dr/2:b,A=Math.max(S,j)+Dr/2+Ns+Dn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:js,h:Dn}),g.set("$done",{cx:E,cy:A,w:js,h:Dn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const R of e)R.transitions.forEach((U,H)=>{if(!U.goto||!g.has(U.goto))return;const X=g.get(R.id),Z=g.get(U.goto),B=U.when.type==="step_result"?`${U.when.result}`:g0[U.when.type]??U.when.type,L=R.id===U.goto;let M;L?M="back":Z.cy>X.cy+1?M="down":Z.cy<X.cy-1?M="back":M="same",N.push({from:R.id,to:U.goto,label:B,edgeKey:`${R.id}:${H}`,direction:M,backEdgeIndex:M==="back"?D++:0})});const T=new Map,I=new Map,z=new Map,q=new Map;for(const R of N)R.direction==="down"&&(T.set(R.from,(T.get(R.from)??0)+1),I.set(R.to,(I.get(R.to)??0)+1));const K=new Map,W=new Map;for(const R of N){if(R.direction!=="same")continue;const U=[R.from,R.to].sort().join("|");K.set(U,(K.get(U)??0)+1)}for(const R of N){if(R.direction==="back"||R.direction==="same"){let M=0;if(R.direction==="same"){const V=[R.from,R.to].sort().join("|");M=W.get(V)??0,W.set(V,M+1)}p.push({...R,fromPort:0,toPort:0,sameEdgeIndex:M});continue}const U=T.get(R.from)??1,H=I.get(R.to)??1,X=z.get(R.from)??0,Z=q.get(R.to)??0;z.set(R.from,X+1),q.set(R.to,Z+1);const B=U===1?0:-.6+1.2*X/(U-1),L=H===1?0:-.6+1.2*Z/(H-1);p.push({...R,fromPort:B,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:l,height:A+Dn/2+Ni,posMap:g}}function rA({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:l,agentTypes:u,isReadOnly:f,onSelectNode:c,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:x,onDeleteTransition:_}){const E=P.useRef(null),C=P.useRef(!1),[b,v]=P.useState(null),[y,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:I,posMap:z}=P.useMemo(()=>nA(e,r,l,u),[e,r,l,u]),q=P.useCallback(Q=>{var ne;const ee=E.current;if(!ee)return{x:0,y:0};const Y=ee.createSVGPoint();Y.x=Q.clientX,Y.y=Q.clientY;const $=(ne=ee.getScreenCTM())==null?void 0:ne.inverse();if(!$)return{x:0,y:0};const ae=Y.matrixTransform($);return{x:ae.x,y:ae.y}},[]),K=P.useCallback(Q=>!Q||!y||Q==="$start"?!1:y.type==="reconnect-from"?Q!=="$done":!0,[y]),W=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"new",fromNodeId:ee,mouseX:Y.x,mouseY:Y.y})},[q,f]),R=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:Y.x,mouseY:Y.y})},[q,f]),U=P.useCallback((Q,ee)=>{if(f)return;Q.stopPropagation(),Q.preventDefault();const Y=q(Q);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:Y.x,mouseY:Y.y})},[q,f]),H=P.useCallback(Q=>{if(!y)return;const ee=q(Q);S(Y=>Y?{...Y,mouseX:ee.x,mouseY:ee.y}:null)},[y,q]),X=P.useCallback(()=>{y&&(C.current=!0,j&&K(j)&&(y.type==="new"?g(y.fromNodeId,j):y.type==="reconnect-to"?m(y.edgeKey,j):y.type==="reconnect-from"&&x(y.edgeKey,j)),S(null),A(null))},[y,j,K,g,m,x]),Z=P.useCallback(()=>{if(C.current){C.current=!1;return}c(null),d(null)},[c,d]);P.useEffect(()=>{if(f)return;const Q=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&s&&s!=="start"&&(ee.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[f,s,_,d]);const B=Q=>{const ee=z.get(Q.from),Y=z.get(Q.to);if(!ee||!Y)return null;let $,ae,ne,ve="middle",ye,Ae;if(Q.direction==="down"){const Re=ee.cx+Q.fromPort*(ee.w/2-10),He=ee.cy+ee.h/2,Ue=Y.cx+Q.toPort*(Y.w/2-10),Ee=Y.cy-Y.h/2,xe=Ee-He,Ne=Ue-Re;$=`M ${Re} ${He} C ${Re} ${He+xe*.4}, ${Ue-Ne*.2} ${Ee-xe*.1}, ${Ue} ${Ee}`,ae=Re+(Ue-Re)*.5,ne=He+xe*.6,ye={x:Re,y:He},Ae={x:Ue,y:Ee}}else if(Q.direction==="back"){const Re=Q.from===Q.to,He=ee.cx>=T/2,Ue=Q.backEdgeIndex*16,Ee=He?T-20-Ue:20+Ue;if(Re){const xe=ee.cx>=T/2,Ne=30+Q.backEdgeIndex*14,$e=ee.cy-ee.h/2,At=xe?ee.cx+ee.w/2:ee.cx-ee.w/2,me=xe?At+Ne:At-Ne,je=ee.cx+(xe?ee.w/4:-ee.w/4),Oe=$e-20-Q.backEdgeIndex*10;$=`M ${At} ${ee.cy} C ${me} ${ee.cy}, ${me} ${Oe}, ${je} ${$e}`,ae=me+10,ne=Oe+4,ve="middle",ye={x:At,y:ee.cy},Ae={x:je,y:$e}}else{const xe=He?ee.cx+ee.w/2:ee.cx-ee.w/2,Ne=Y.cx+(He?Y.w/4:-Y.w/4),$e=Math.min(ee.cy,Y.cy)-Y.h/2-18-Q.backEdgeIndex*14;$=`M ${xe} ${ee.cy} L ${Ee} ${ee.cy} L ${Ee} ${$e} L ${Ne} ${$e} L ${Ne} ${Y.cy-Y.h/2}`,ae=Ee,ne=(ee.cy+$e)/2,ve=He?"start":"end",ye={x:xe,y:ee.cy},Ae={x:Ne,y:Y.cy-Y.h/2}}}else{const Re=Y.cx>ee.cx,He=Q.sameEdgeIndex===0?-12:12,Ue=Re?ee.cx+ee.w/2:ee.cx-ee.w/2,Ee=Re?Y.cx-Y.w/2:Y.cx+Y.w/2,xe=ee.cy+He,Ne=Y.cy+He,$e=(Ue+Ee)/2;$=`M ${Ue} ${xe} C ${$e} ${xe}, ${$e} ${Ne}, ${Ee} ${Ne}`,ae=$e,ne=(xe+Ne)/2-6,ye={x:Ue,y:xe},Ae={x:Ee,y:Ne}}return{path:$,labelX:ae,labelY:ne,labelAnchor:ve,fromPt:ye,toPt:Ae}},L=(Q,ee)=>{const Y=B(Q);if(!Y)return null;const{path:$,labelX:ae,labelY:ne,labelAnchor:ve}=Y,ye=s===Q.edgeKey,Ae=Q.label&&!(Q.from==="$start"&&Q.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Re=>{Re.stopPropagation(),d(ye?null:Q.edgeKey)}}),o.jsx("path",{d:$,fill:"none",stroke:ye?"#58a6ff":"#484f58",strokeWidth:ye?2.2:1.2,markerEnd:ye?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Ae&&o.jsx("text",{x:ae+(ve==="start"?5:ve==="end"?-5:0),y:ne+3,textAnchor:ve,className:"text-[8px]",fill:ye?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Q.label})]},ee)},M=()=>{if(!s||y)return null;const Q=D.find(ne=>ne.edgeKey===s);if(!Q)return null;const ee=B(Q);if(!ee)return null;const{fromPt:Y,toPt:$}=ee,ae=6;return o.jsxs(o.Fragment,{children:[Q.edgeKey!=="start"&&o.jsx("circle",{cx:Y.x,cy:Y.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>U(ne,Q)}),o.jsx("circle",{cx:$.x,cy:$.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>R(ne,Q)})]})},V=()=>{if(!y)return null;let Q,ee,Y,$;if(y.type==="reconnect-from"){const ve=z.get(y.fixedTargetId);if(!ve)return null;Q=y.mouseX,ee=y.mouseY,Y=ve.cx,$=ve.cy-ve.h/2}else{const ve=z.get(y.fromNodeId);if(!ve)return null;Q=ve.cx,ee=ve.cy+ve.h/2,Y=y.mouseX,$=y.mouseY}const ae=$-ee,ne=Math.abs(ae)>10?`M ${Q} ${ee} C ${Q} ${ee+ae*.4}, ${Y} ${$-ae*.4}, ${Y} ${$}`:`M ${Q} ${ee} L ${Y} ${$}`;return o.jsx("path",{d:ne,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},F=Q=>{const ee=Q.cy+Q.h/2,Y=(y==null?void 0:y.fromNodeId)===Q.id;return o.jsx("circle",{cx:Q.cx,cy:ee,r:nb,fill:Y?"#58a6ff":"#1c2128",stroke:Y?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5,className:"cursor-crosshair",onMouseDown:$=>W($,Q.id)})},re=Q=>{const ee=Q.cy-Q.h/2,Y=y&&j===Q.id&&K(Q.id);return o.jsx("circle",{cx:Q.cx,cy:ee,r:nb,fill:Y?"#3fb950":"#1c2128",stroke:Y?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Y?1:.5})};return o.jsxs("svg",{ref:E,viewBox:`0 0 ${T} ${I}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:H,onMouseUp:X,onClick:Z,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Q,ee)=>L(Q,ee)),N.map(Q=>{const ee=i===Q.id,Y=Q.cx-Q.w/2,$=Q.cy-Q.h/2,ae=b===Q.id,ne=y&&j===Q.id&&K(Q.id);if(Q.type==="terminal"){const ye=Q.id==="$start",Ae=ye?"#58a6ff":"#3fb950",Re=ye,He=!ye;return o.jsxs("g",{onClick:Ue=>{Ue.stopPropagation(),ye&&!f&&d("start")},className:ye&&!f?"cursor-pointer":void 0,children:[ne&&o.jsx("rect",{x:Y-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ye&&s==="start"&&o.jsx("rect",{x:Y-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:Q.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Y,y:$,width:Q.w,height:Q.h,rx:Q.h/2,fill:Ae,fillOpacity:.08,stroke:Ae,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:Ae,className:"text-[10px] font-medium",pointerEvents:"none",children:Q.label}),Re&&F(Q),He&&re(Q)]},Q.id)}const ve=Q.color??"#6b7280";return o.jsxs("g",{onClick:ye=>{ye.stopPropagation(),f||c(ee?null:Q.id)},onMouseEnter:()=>v(Q.id),onMouseLeave:()=>v(null),className:f?void 0:"cursor-pointer",children:[ne&&o.jsx("rect",{x:Y-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:Y-3,y:$-3,width:Q.w+6,height:Q.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:Y,y:$,width:Q.w,height:Q.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Q.cx,y:Q.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Q.label}),!f&&F(Q),!f&&re(Q),ae&&!y&&!f&&o.jsxs("g",{onClick:ye=>{ye.stopPropagation(),p(Q.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:Y+Q.w-2,cy:$+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:Y+Q.w-5,y1:$-1,x2:Y+Q.w+1,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:Y+Q.w+1,y1:$-1,x2:Y+Q.w-5,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Q.id)}),y&&N.map(Q=>K(Q.id)?o.jsx("rect",{x:Q.cx-Q.w/2-8,y:Q.cy-Q.h/2-8,width:Q.w+16,height:Q.h+16,fill:"transparent",rx:12,onMouseEnter:()=>A(Q.id),onMouseLeave:()=>A(null),onMouseUp:ee=>{ee.stopPropagation(),X()}},`drop-${Q.id}`):null),V(),M()]})}const Qn="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Li="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",on="block text-[11px] text-text-secondary mb-0.5";function iA({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:l,onUpdateCondition:u,onDelete:f}){const c=s&&(s.type==="sub_agent"||s.type==="agent")?l.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(c==null?void 0:c.results)&&c.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Condition"}),o.jsx("select",{value:i.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Li,children:x0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Result"}),d?o.jsx("select",{value:i.result??c.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Li,children:c.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:Qn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Qd({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${i.name}}}`},i.name))})}function sA({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:l,onUpdate:u,onRemove:f,onSetEntry:c}){const{color:d,name:p}=uf(e,i);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:p}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:c,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,x=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(E=>!E.subagent);u({...e,type:m,phase:x,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=i.find(E=>E.subagent);u({...e,type:m,phase:x,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:x,name:"Shell"})},className:Li,children:tA.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(x=>x.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:i.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(x=>x.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:[o.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Qn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Qd,{variables:l,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Qn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Qd,{variables:l,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Qn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Qd,{variables:l,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Qn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Qn} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const rb=[];function v0({isOpen:e,onClose:r,initialEditId:i}){const s=It(se=>se.defaults),l=It(se=>se.userItems),u=It(se=>se.loading),f=It(se=>se.templateVariables),c=It(se=>se.fetchWorkflows),d=It(se=>se.fetchWorkflow),p=It(se=>se.fetchDefaultContent),g=It(se=>se.fetchTemplateVariables),m=It(se=>se.createWorkflow),x=It(se=>se.updateWorkflow),_=It(se=>se.deleteWorkflow),{requestDelete:E,clearConfirm:C,isConfirming:b}=Ch(),[v,y]=P.useState("list"),[S,j]=P.useState(null),[A,N]=P.useState(!1),[D,T]=P.useState(null),[I,z]=P.useState(null),[q,K]=P.useState(""),[W,R]=P.useState(""),[U,H]=P.useState(""),[X,Z]=P.useState("1.0.0"),[B,L]=P.useState("#3b82f6"),[M,V]=P.useState(""),[F,re]=P.useState(50),[Q,ee]=P.useState(rb),[Y,$]=P.useState({type:"always"}),[ae,ne]=P.useState(""),[ve,ye]=P.useState(!1),[Ae,Re]=P.useState([]),[He]=P.useState(null);P.useEffect(()=>{e&&(c(),g(),Ce("/api/agents").then(se=>se.json()).then(se=>Re(se.agents??[])).catch(()=>{}),T(null),z(null),i?s.some(fe=>fe.id===i)?p(i).then(fe=>{fe&&(K(fe.metadata.name+" (copy)"),R(`${i}-copy-${Date.now()}`),H(fe.metadata.description),Z(fe.metadata.version),L(fe.metadata.color??"#3b82f6"),V(fe.entryStep),re(fe.settings.maxIterations),ee(fe.steps),$(fe.startCondition??{type:"always"}),ne(""),j(null),N(!1),y("edit"))}):d(i).then(fe=>{fe&&(K(fe.metadata.name),R(fe.metadata.id),H(fe.metadata.description),Z(fe.metadata.version),L(fe.metadata.color??"#3b82f6"),V(fe.entryStep),re(fe.settings.maxIterations),ee(fe.steps),$(fe.startCondition??{type:"always"}),ne(""),j(i),N(!1),y("edit"))}):(y("list"),j(null),N(!1)))},[e,c,d,p,g,i]);const Ue=async se=>{const fe=await d(se);fe&&(j(se),K(fe.metadata.name),R(fe.metadata.id),H(fe.metadata.description),Z(fe.metadata.version),L(fe.metadata.color??"#3b82f6"),V(fe.entryStep),re(fe.settings.maxIterations),ee(fe.steps),$(fe.startCondition??{type:"always"}),ne(""),T(null),z(null),y("edit"))},Ee=async()=>{var qe;const se=S??W;if(!se||!q)return ne("Name is required."),!1;if(Q.length===0)return ne("Add at least one step."),!1;let fe=M;if(!fe||!Q.some(Be=>Be.id===fe)){if(fe=((qe=Q.find(Be=>Be.id))==null?void 0:qe.id)??"",!fe)return ne("All steps need an ID."),!1;V(fe)}ye(!0),ne("");const Se={metadata:{id:se,name:q,description:U,version:X||"1.0.0",color:B},entryStep:fe,settings:{maxIterations:F},steps:Q,startCondition:Y},Me=S?await x(S,Se):await m(Se);return ye(!1),Me.success?(S||j(se),!0):(ne(Me.error??"Failed to save."),!1)},xe=async()=>{await Ee()},Ne=async()=>{await Ee()&&(i?r():y("list"))},$e=()=>{i?r():y("list")},At=se=>{K(se),S||R(J5(se))},me=async se=>{if(s.some(Se=>Se.id===se)){const Se=await p(se);if(!Se)return;K(Se.metadata.name),R(Se.metadata.id),H(Se.metadata.description),Z(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),re(Se.settings.maxIterations),ee(Se.steps),$(Se.startCondition??{type:"always"}),ne(""),j(se),N(!0)}else{const Se=await d(se);if(!Se)return;K(Se.metadata.name),R(Se.metadata.id),H(Se.metadata.description),Z(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),re(Se.settings.maxIterations),ee(Se.steps),$(Se.startCondition??{type:"always"}),ne(""),j(se),N(!0)}y("edit")},je=async se=>{const Se=s.some(Me=>Me.id===se)?await p(se):await d(se);Se&&(K(Se.metadata.name+" (copy)"),R(`${se}-copy-${Date.now()}`),H(Se.metadata.description),Z(Se.metadata.version),L(Se.metadata.color??"#3b82f6"),V(Se.entryStep),re(Se.settings.maxIterations),ee(Se.steps),$(Se.startCondition??{type:"always"}),ne(""),j(null),N(!1),y("edit"))},Oe=()=>{j(null),K(""),R(""),H(""),Z("1.0.0"),L("#3b82f6"),V(""),re(50),ee(structuredClone(rb)),$({type:"always"}),ne(""),T(null),z(null),N(!1),y("edit")},ct=async se=>{await _(se),C()},ue=P.useCallback(se=>{T(se),z(null)},[]),_e=P.useCallback(se=>{z(se),T(null)},[]),Te=D!==null?Number(D):-1,Ie=Te>=0?Q[Te]??null:null,Ge=P.useCallback(se=>{ee(fe=>fe.map((Se,Me)=>Me===Te?se:Se))},[Te]),kt=Y.type==="step_result"?`${Y.result}`:g0[Y.type]??Y.type,Xe=()=>{const se=Q.length,fe=eA(Q),Se=Ae.find(Me=>!Me.subagent);ee([...Q,{id:fe,name:(Se==null?void 0:Se.name)??"Agent",type:"agent",phase:"build",toolMode:(Se==null?void 0:Se.id)??"builder",transitions:[]}]),M||V(fe),ue(String(se))},Dt=P.useCallback((se,fe)=>{se==="$start"?(V(fe),_e("start")):ee(Se=>{const Me=Se.find(Be=>Be.id===se),qe=Me?Me.transitions.length:0;return _e(`${se}:${qe}`),Se.map(Be=>Be.id===se?{...Be,transitions:[...Be.transitions,{when:{type:"always"},goto:fe}]}:Be)})},[_e]),Et=P.useCallback((se,fe)=>{if(se==="start")V(fe);else{const Se=se.lastIndexOf(":"),Me=se.slice(0,Se),qe=parseInt(se.slice(Se+1));ee(Be=>Be.map(Lt=>Lt.id===Me?{...Lt,transitions:Lt.transitions.map((vt,qt)=>qt===qe?{...vt,goto:fe}:vt)}:Lt))}},[]),Yt=P.useCallback((se,fe)=>{const Se=se.lastIndexOf(":"),Me=se.slice(0,Se),qe=parseInt(se.slice(Se+1));ee(Be=>{const Lt=Be.find(qt=>qt.id===Me);if(!Lt)return Be;const vt=Lt.transitions[qe];return vt?Be.map(qt=>qt.id===Me?{...qt,transitions:qt.transitions.filter((Hi,oc)=>oc!==qe)}:qt.id===fe?{...qt,transitions:[...qt.transitions,vt]}:qt):Be}),z(null)},[]),st=P.useCallback(se=>{if(se==="start")V("");else{const fe=se.lastIndexOf(":"),Se=se.slice(0,fe),Me=parseInt(se.slice(fe+1));ee(qe=>qe.map(Be=>Be.id===Se?{...Be,transitions:Be.transitions.filter((Lt,vt)=>vt!==Me)}:Be))}z(null)},[]),In=P.useCallback((se,fe)=>{if(se==="start")$(fe);else{const Se=se.lastIndexOf(":"),Me=se.slice(0,Se),qe=parseInt(se.slice(Se+1));ee(Be=>Be.map(Lt=>Lt.id===Me?{...Lt,transitions:Lt.transitions.map((vt,qt)=>qt===qe?{...vt,when:fe}:vt)}:Lt))}},[]),en=se=>uf(se,Ae).name,he=()=>{if(!I)return null;if(I==="start"){const vt=Q.find(qt=>qt.id===M);return{type:"start",fromLabel:"Start",toLabel:vt?en(vt):"(none)",condition:Y}}const se=I.lastIndexOf(":"),fe=I.slice(0,se),Se=parseInt(I.slice(se+1)),Me=Q.find(vt=>vt.id===fe);if(!Me)return null;const qe=Me.transitions[Se];if(!qe)return null;const Be=Q.find(vt=>vt.id===qe.goto),Lt=qe.goto==="$done"?"Done":Be?en(Be):qe.goto;return{type:"step",fromLabel:en(Me),toLabel:Lt,condition:qe.when}};if(v==="edit"){const se=he();return o.jsxs(Ct,{isOpen:e,onClose:$e,title:A?q:S?"Edit Workflow":"New Workflow",size:"full",children:[ae&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ae}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:on,children:"Name"}),o.jsx("input",{value:q,onChange:fe=>At(fe.target.value),placeholder:"Workflow name",className:`${Qn} ${A?"opacity-50":""}`,readOnly:A})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:on,children:"ID"}),o.jsx("input",{value:W,readOnly:!0,className:`${Qn} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:on,children:"Description"}),o.jsx("input",{value:U,onChange:fe=>!A&&H(fe.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${Qn} ${A?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:on,children:"Max Iter."}),o.jsx("input",{type:"number",value:F,onChange:fe=>!A&&re(Number(fe.target.value)),readOnly:A,className:`${Qn} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Color"}),o.jsx("input",{type:"color",value:B,onChange:fe=>!A&&L(fe.target.value),disabled:A,className:`w-8 h-8 rounded border border-border bg-transparent ${A?"opacity-50":"cursor-pointer"}`})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!A&&o.jsx("button",{onClick:Xe,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(rA,{steps:Q,entryStep:M,selectedNodeId:(Ie==null?void 0:Ie.id)??null,selectedEdgeKey:I,startConditionLabel:kt,agentTypes:Ae,isReadOnly:A,onSelectNode:fe=>{if(fe===null){ue(null);return}const Se=Q.findIndex(Me=>Me.id===fe);ue(Se>=0?String(Se):null)},onSelectEdge:_e,onRemoveStep:fe=>{var Me;const Se=Q.findIndex(qe=>qe.id===fe);if(ee(qe=>qe.filter(Be=>Be.id!==fe)),Te===Se&&ue(null),M===fe){const qe=Q.filter(Be=>Be.id!==fe);V(((Me=qe[0])==null?void 0:Me.id)??"")}},onCreateTransition:Dt,onReconnectTo:Et,onReconnectFrom:Yt,onDeleteTransition:st}),Q.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:Xe,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:A&&(se||Ie)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):se?se.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),M&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"text-text-primary font-medium",children:se.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Activation Condition"}),o.jsx("select",{value:Y.type,onChange:fe=>$(fe.target.value==="step_result"?{type:"step_result",result:"success"}:{type:fe.target.value}),className:Li,children:x0.map(fe=>o.jsx("option",{value:fe.value,children:fe.label},fe.value))})]}),Y.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:on,children:"Result"}),M&&(()=>{const fe=Q.find(Be=>Be.id===M),Se=fe&&(fe.type==="sub_agent"||fe.type==="agent")?Ae.find(Be=>Be.id===(fe.type==="sub_agent"?fe.subAgentType:fe.toolMode)):void 0,Me=(Se==null?void 0:Se.results)&&Se.results.length>0,qe=(Se==null?void 0:Se.results)??[];return Me?o.jsx("select",{value:Y.result??qe[0],onChange:Be=>$({type:"step_result",result:Be.target.value}),className:Li,children:qe.map(Be=>o.jsx("option",{value:Be,children:Be},Be))}):o.jsx("input",{type:"text",value:Y.result??"success",onChange:Be=>$({type:"step_result",result:Be.target.value}),placeholder:"e.g. success, passed, failed",className:Qn})})()]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):o.jsx(iA,{fromLabel:se.fromLabel,toLabel:se.toLabel,condition:se.condition,fromStep:se.type==="step"?Q.find(fe=>fe.id===se.fromLabel):void 0,agentTypes:Ae,onUpdateCondition:fe=>In(I,fe),onDelete:()=>st(I)}):Ie?o.jsx(sA,{step:Ie,isEntry:Ie.id===M,agentTypes:Ae,transitionCount:Ie.transitions.length,templateVariables:f,onUpdate:Ge,onRemove:()=>{var fe;if(Ie&&(ee(Q.filter((Se,Me)=>Me!==Te)),ue(null),M===Ie.id)){const Se=Q.filter((Me,qe)=>qe!==Te);V(((fe=Se[0])==null?void 0:fe.id)??"")}},onSetEntry:()=>V(Ie.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(et,{variant:"secondary",onClick:$e,children:"Close"}),A?o.jsx(et,{variant:"primary",onClick:()=>{K(q+" (copy)"),R(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(et,{variant:"secondary",onClick:xe,disabled:ve||!q,children:ve?"Saving...":"Save"}),o.jsx(et,{variant:"primary",onClick:Ne,disabled:ve||!q,children:"Save & Close"})]})]})]})}return o.jsxs(Ct,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(et,{variant:"primary",size:"sm",onClick:Oe,children:"+ New"})})]}),u&&s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&l.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(se=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:se.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",se.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:se.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>me(se.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Ga,{onClick:()=>je(se.id)})]})]},se.id))})]}),l.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:l.map(se=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:se.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",se.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:se.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Ga,{onClick:()=>je(se.id)}),o.jsx(Oi,{onClick:()=>Ue(se.id)}),b(se.id,"delete")?o.jsx(kh,{onConfirm:()=>ct(se.id),onCancel:()=>{}}):o.jsx(Eh,{onClick:()=>E(se.id)})]})]},se.id))})]})]})]})}function aA(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(l=>l.status==="failed").length>=4);case"step_result":return null;default:return null}}function oA({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,l]=P.useState(!1),[u,f]=P.useState(null),c=It(N=>N.defaults),d=It(N=>N.userItems),p=It(N=>N.fetchWorkflows),g=[...c,...d],{isOpen:m,search:x,selectedIndex:_,filtered:E,containerRef:C,searchRef:b,handleToggle:v,handleSearchChange:y,handleKeyDown:S}=u0({items:g,isOpen:s,onOpen:()=>l(!0),onClose:()=>l(!1),filterFn:(N,D)=>!D||N.name.toLowerCase().includes(D.toLowerCase())});P.useEffect(()=>{s&&p()},[s,p]);const j=N=>{e(N),l(!1)},A=()=>{l(!1),r()};return o.jsxs("div",{ref:C,className:"relative",children:[o.jsx(d0,{label:"Workflows",isOpen:m,onClick:v}),m&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:S,children:[o.jsx(h0,{value:x,onChange:y,onKeyDown:S,ref:b,placeholder:"Search workflows..."}),o.jsx(f0,{children:E.length===0?o.jsx(p0,{hasItems:g.length>0,message:"No workflows yet"}):E.map((N,D)=>{const T=aA(N,i),I=N.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${D===_?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>j(N.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:I}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:N.name}),T!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:T?"#22c55e":"#6b7280"},title:T?"Entry condition met":"Entry condition not met"})]}),o.jsx(Oi,{className:"opacity-0 group-hover:opacity-100",onClick:z=>{z.stopPropagation(),l(!1),f(N.id)}})]},N.id)})}),o.jsx(m0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(v0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function lA(e){return e==="criterion"}function cA(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>lA(s.name))}function uA(e,r=[]){const i=[];let s=null,l=[],u,f=1;const c=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?c.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(l.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===l.length&&_.toolCalls.every((C,b)=>{var v;return C.id===((v=l[b])==null?void 0:v.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},x=()=>{if(!s)return;const _=s,E=d.get(_.subAgentId);E&&E.type==="subagent"&&E.messages.length===_.messages.length&&E.messages.every((b,v)=>b===_.messages[v])?i.push(E):i.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),x(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,cA(_)){x();for(const E of _.toolCalls)l.push(E);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(x(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{x();const E=c.get(_.id);E&&E.type==="message"&&E.message===_?i.push(E):i.push({type:"message",message:_})}}return m(),x(),i}function dA(e){const{year:r,month:i,day:s}=Lb(e);return`${r}/${i}/${s} ${Vl(e)}`}function hA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const fA=10,pA=150;function mA(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function gA(e){return[...e].sort((s,l)=>new Date(l.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,fA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:dA(s.timestamp),trimmedContent:hA(s.content,pA),sessionId:s.sessionId,sessionName:s.sessionName}))}function xA(e,r,i){const s=[],l=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of l)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...mA(u));return gA(s)}function vA(e,r=[],i=null){const[s,l]=P.useState(0),[u,f]=P.useState(!1),c=P.useMemo(()=>xA(e,r,i),[e,r,i]),d=P.useCallback(()=>{c.length>0&&(l(c.length-1),f(!0))},[c.length]),p=P.useCallback(()=>{f(!1),l(0)},[]),g=P.useCallback(()=>{l(_=>c.length===0?_:_===0?c.length-1:_-1)},[c.length]),m=P.useCallback(()=>{l(_=>c.length===0?_:_===c.length-1?0:_+1)},[c.length]),x=P.useCallback(()=>{if(c.length===0||!u)return null;const _=c[s];return(_==null?void 0:_.content)??null},[c,s,u]);return{history:c,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:x}}function bA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,l]=P.useState(""),[u,f]=P.useState([]),[c,d]=P.useState(!1),[p,g]=P.useState(null),[m,x]=P.useState(!1),[_,E]=P.useState(!1),[C,b]=P.useState(null),v=P.useRef(null),y=P.useRef(null),S=P.useRef(null),j=ke(he=>he.currentSession),A=ke(he=>he.messages),N=ke(he=>he.streamingMessage),D=ke(he=>he.sessions),T=ke(he=>he.error),I=ke(he=>he.pendingQuestion),z=Sb(),q=ke(he=>he.sendMessage),K=ke(he=>he.clearError),W=ke(he=>he.acceptAndBuild),R=ke(he=>he.stopGeneration),U=ke(he=>he.launchRunner),H=ke(he=>he.cancelQueued),X=HS(),{showThinking:Z,showVerboseToolOutput:B,showStats:L,showAgentDefinitions:M,showWorkflowBars:V}=xb(),F=It(he=>he.defaults),re=It(he=>he.userItems),Q=[...F,...re],ee=It(he=>he.fetchWorkflows);P.useEffect(()=>{ee()},[ee]);const{history:Y,selectedIndex:$,showHistory:ae,openHistory:ne,closeHistory:ve,navigateUp:ye,navigateDown:Ae,selectCurrent:Re}=vA(A,D,j==null?void 0:j.id);P.useEffect(()=>{const he=se=>{b(se.detail.stats)};return window.addEventListener("open-turn-stats",he),()=>window.removeEventListener("open-turn-stats",he)},[]);const He=P.useMemo(()=>N?A.map(he=>he.id===N.id?N:he):A,[A,N]),Ue=P.useRef([]),Ee=P.useMemo(()=>{const he=uA(He,Ue.current);return Ue.current=he,he},[He]),xe=P.useMemo(()=>q5(A),[A]),{force_scroll_to_bottom:Ne,isAutoScrollActive:$e,setAutoScroll:At}=o0(v,j),me=P.useCallback(()=>{const he=y.current;if(!he)return;he.style.height="auto";const se=Math.min(200,he.scrollHeight);he.style.height=`${se}px`},[]);P.useEffect(()=>{if(!(j!=null&&j.id))return;const he=`openfox:draft:${j.id}`,se=localStorage.getItem(he);se!==null&&l(se)},[j==null?void 0:j.id]),P.useEffect(()=>{var he;(he=y.current)==null||he.focus(),me()},[j==null?void 0:j.id,me]),P.useEffect(()=>{if(!(j!=null&&j.id))return;const he=`openfox:draft:${j.id}`,se=setTimeout(()=>{s?localStorage.setItem(he,s):localStorage.removeItem(he)},500);return()=>clearTimeout(se)},[j==null?void 0:j.id,s]),P.useEffect(()=>{me()},[s,me]),P.useEffect(()=>{const he=se=>{se.key==="Escape"&&z&&R(),se.key==="ScrollLock"&&At(!$e)};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[z,R,$e]),P.useEffect(()=>{const he=y.current;if(!he)return;const se=async fe=>{var Me;if(document.activeElement!==he)return;const Se=(Me=fe.clipboardData)==null?void 0:Me.items;if(Se){for(const qe of Array.from(Se))if(qe.type.startsWith("image/")){fe.preventDefault();const Be=qe.getAsFile();if(!Be)continue;await Zd(Be,Lt=>f(vt=>[...vt,Lt]),g,{filename:"pasted-image"})}}};return he.addEventListener("paste",se),()=>he.removeEventListener("paste",se)},[]);const je=()=>{l(""),f([]),j!=null&&j.id&&localStorage.removeItem(`openfox:draft:${j.id}`)},Oe=async he=>{he.preventDefault(),!(!s.trim()&&u.length===0)&&(Ne(),q(s,u.length>0?u:void 0),je())},ct=he=>{if(ae)switch(he.key){case"Enter":he.preventDefault();const se=Re();se&&(l(se),ve());return;case"Escape":he.preventDefault(),ve(),z&&R();return;case"ArrowUp":he.preventDefault(),ye();return;case"ArrowDown":he.preventDefault(),Ae();return}if(he.key==="ArrowUp"&&s.trim()===""&&!ae){he.preventDefault(),ne();return}he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),Oe(he))},ue=P.useCallback(async he=>{const se=he.target.files;if(!(!se||se.length===0)){g(null);for(const fe of Array.from(se))await Zd(fe,Se=>f(Me=>[...Me,Se]),g);S.current&&(S.current.value="")}},[]),_e=P.useCallback(he=>{he.preventDefault(),he.stopPropagation(),d(!0)},[]),Te=P.useCallback(he=>{he.preventDefault(),he.stopPropagation(),d(!1)},[]),Ie=P.useCallback(async he=>{he.preventDefault(),he.stopPropagation(),d(!1),g(null);const se=he.dataTransfer.files;if(!(!se||se.length===0))for(const fe of Array.from(se))await Zd(fe,Se=>f(Me=>[...Me,Se]),g)},[]),Ge=P.useCallback(he=>{f(se=>se.filter(fe=>fe.id!==he))},[]),kt=P.useCallback(()=>{var he;(he=S.current)==null||he.click()},[]),Xe=(j==null?void 0:j.mode)==="planner",Dt=(j==null?void 0:j.mode)==="builder",Et=((j==null?void 0:j.criteria.length)??0)>0,Yt=(j==null?void 0:j.phase)==="done",st=Ee.some(he=>he.type==="message"&&he.message.role==="assistant"),In=Xe&&Et&&!z&&st&&!Yt,en=he=>{const se=s.trim()?s:void 0,fe=u.length>0?u:void 0;Xe?W(he,se,fe):Dt&&U(se,fe,he),je()};return o.jsxs(cC,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:He,children:[I&&o.jsx(N5,{question:I}),o.jsx(hC,{}),C&&o.jsx(v5,{stats:C,onClose:()=>b(null)}),o.jsx(T5,{}),o.jsxs("div",{ref:v,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:Ee.map((he,se)=>{if(he.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},se);if(he.type==="subagent"){const qe=he.messages.some(Be=>Be.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(S5,{messages:he.messages,subAgentType:he.subAgentType,subAgentId:he.subAgentId,isStreaming:qe})},se)}if(he.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(s0,{toolCalls:he.toolCalls,criteria:j==null?void 0:j.criteria})},se);const fe=he.message;if(fe.role==="assistant")return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(lf,{message:fe,showStats:L,showThinking:Z,showVerboseToolOutput:B})},se);const Se=!M&&fe.messageKind==="auto-prompt",Me=!V&&(fe.messageKind==="workflow-started"||fe.messageKind==="task-completed");return Se||Me?null:o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(a0,{message:fe,isLastAssistantMessage:!1,promptContext:fe.role==="user"?xe[fe.id]:void 0})},se)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[T&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:T.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:T.message})]}),o.jsx(Va,{onClick:K,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),In&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:Q.map(he=>{const se=he.color??"#3b82f6",fe=parseInt(se.slice(1,3),16),Se=parseInt(se.slice(3,5),16),Me=parseInt(se.slice(5,7),16),qe=`rgba(${fe},${Se},${Me},0.12)`,Be=`rgba(${fe},${Se},${Me},0.22)`,Lt=`rgba(${fe},${Se},${Me},0.25)`;return o.jsxs("button",{onClick:()=>W(he.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:qe,color:se,border:`1px solid ${Lt}`},onMouseEnter:vt=>{vt.currentTarget.style.backgroundColor=Be},onMouseLeave:vt=>{vt.currentTarget.style.backgroundColor=qe},children:["▶ ",he.name]},he.id)})}),z&&o.jsx(A5,{})]})]}),o.jsxs("form",{onSubmit:Oe,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>At(!$e),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${$e?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:S,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:ue,className:"hidden",multiple:!0}),p&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:p}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(he=>o.jsx(D5,{attachment:he,onRemove:Ge},he.id))}),ae&&o.jsx(L5,{history:Y,selectedIndex:$,onSelect:he=>{l(he),ve()},onEscape:ve,onNavigate:he=>{he==="up"?ye():Ae()}}),X.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:X.map(he=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${he.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[o.jsxs("span",{className:"font-medium",children:[he.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:he.content}),o.jsx(Va,{onClick:()=>H(he.queueId),size:"sm"})]},he.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${c?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:_e,onDragLeave:Te,onDrop:Ie,children:[o.jsx("button",{type:"button",onClick:kt,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),o.jsx("textarea",{ref:y,value:s,onChange:he=>{l(he.target.value),ae&&ve()},onKeyDown:ct,placeholder:Xe?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Q5,{onSendCommand:(he,se,fe,Se)=>{var qe;se&&(j==null?void 0:j.mode)!==se&&ke.getState().switchMode(se);const Me=fe&&fe.trim()?`${fe.trim()}
150
-
151
- ${he}`:he;(qe=v.current)==null||qe.scrollTo({top:v.current.scrollHeight,behavior:"smooth"}),q(Me,Se!=null&&Se.length?Se:void 0,{messageKind:"command",isSystemGenerated:!0}),je()},onOpenManager:()=>x(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(oA,{onSelectWorkflow:en,onOpenManager:()=>E(!0),criteria:(j==null?void 0:j.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var he;!s.trim()&&u.length===0||((he=v.current)==null||he.scrollTo({top:v.current.scrollHeight,behavior:"smooth"}),q(s,u),je())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(E5,{}),o.jsx(j5,{})]}),o.jsx(K5,{})]})]}),o.jsx(c0,{isOpen:m,onClose:()=>x(!1)}),o.jsx(v0,{isOpen:_,onClose:()=>E(!1)})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:r.description})})]})]})});function ib({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[l,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const c=d=>{d.preventDefault(),l.trim()&&i(l)};return o.jsx(Ct,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:c,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Kl,{ref:f,type:"password",value:l,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(et,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(et,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}const yA=[8e3,11434,8080],_A=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function sb(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 b0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function SA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function wA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function CA({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(l,u)=>{const f=u+1,c=f<e,d=f===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${c?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:c?"✓":f}),o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${c?"bg-accent-primary":"bg-border"}`})]},u)})})})}function kA({onNext:e}){const[r,i]=P.useState([]),[s,l]=P.useState([]),[u,f]=P.useState(!1),[c,d]=P.useState(""),[p,g]=P.useState(""),[m,x]=P.useState(""),[_,E]=P.useState("auto"),[C,b]=P.useState(!1),[v,y]=P.useState(null),[S,j]=P.useState(null),[A,N]=P.useState(null),[D,T]=P.useState("");P.useEffect(()=>{I()},[]);async function I(){try{const U=await Ce("/api/providers");if(U.ok){const X=(await U.json()).providers.map(Z=>({id:Z.id,name:Z.name,url:Z.url,backend:Z.backend,model:null,apiKey:Z.apiKey}));i(X),l(X)}}catch{}}async function z(U){b(!0),y(null);const H=_!=="auto";try{const Z=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:H})})).json();Z.success?(H||E(Z.backend??"auto"),y({success:!0,model:Z.model??void 0})):y({success:!1,error:Z.error??"Connection failed"})}catch(X){y({success:!1,error:X instanceof Error?X.message:"Connection failed"})}b(!1)}function q(){if(!p)return;const U=c||`Provider ${s.length+1}`,H={id:`temp-${Date.now()}`,name:U,url:p,backend:v!=null&&v.success?_:"auto",model:v!=null&&v.success?v.model??null:null,apiKey:m||void 0};l([...s,H]),d(""),g(""),x(""),y(null)}function K(U){j(U),r.some(X=>X.id===U)?Ce(`/api/providers/${U}`,{method:"DELETE"}).then(()=>{l(s.filter(X=>X.id!==U)),i(r.filter(X=>X.id!==U)),j(null)}).catch(()=>{j(null)}):(l(s.filter(X=>X.id!==U)),j(null))}async function W(){for(const H of s)(H.id.startsWith("temp-")||!r.some(X=>X.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 U=s.filter(H=>!H.id.startsWith("temp-"));e({providers:U})}const R=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(U=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:sb(U.backend)}),A===U.id?o.jsx("input",{type:"text",value:D,onChange:H=>T(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(l(s.map(X=>X.id===U.id?{...X,name:D}:X)),N(null)),H.key==="Escape"&&N(null)},onBlur:()=>{l(s.map(H=>H.id===U.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}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(U.id),T(U.name)},title:"Click to edit",children:U.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:U.url}),U.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",U.model]})]}),o.jsx("button",{onClick:()=>K(U.id),disabled:S===U.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(wA,{})})]},U.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:U=>{U.preventDefault(),p&&q()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:_A.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),E(U.backend),y(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===U.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:U.name},U.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:yA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),E("auto"),y(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${U}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",U]},U))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:p,onChange:U=>{g(U.target.value),y(null)},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),z(p))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:c,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),q())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:U=>x(U.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),v&&o.jsx("div",{className:`p-3 rounded-lg ${v.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:v.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",sb(_),v.model&&` (${v.model})`]}):o.jsx("p",{className:"text-red-500",children:v.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>z(p),disabled:!p||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(b0,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!p,className:"flex-1 px-4 py-2 bg-accent-primary text-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:v!=null&&v.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),y(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[o.jsx(SA,{}),"Add Provider"]}),o.jsx("button",{onClick:W,disabled:!R,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function EA({onNext:e}){const[r,i]=P.useState(""),[s,l]=P.useState(!1);return P.useEffect(()=>{Ce("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&i(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>l(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(Mb,{initialPath:r||void 0,onSelect:u=>{i(u),l(!1)},onClose:()=>l(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function jA({onNext:e}){const[r,i]=P.useState(!1),[s,l]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:c,copy:d}=t0();P.useEffect(()=>{Ce("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),l(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:c?o.jsx(Gl,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>i(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:s,onChange:g=>l(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>f(g.target.value),placeholder:"qwen3-vl:2b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>p(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>p(!1),className:"px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function NA({onComplete:e}){const[r,i]=P.useState(1),[s,l]=P.useState(!1),[u,f]=P.useState({});async function c(m){f(x=>({...x,providers:m.providers})),i(2)}async function d(m){f(x=>({...x,...m})),i(3)}async function p(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(x){console.error("Failed to save onboarding data:",x),l(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(Va,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(CA,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(b0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(kA,{onNext:c}),r===2&&o.jsx(EA,{onNext:d}),r===3&&o.jsx(jA,{onNext:p})]})})]})}function df(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function y0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function TA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=yh("/p/:projectId"),s=i==null?void 0:i.projectId,l=ke(m=>m.connectionStatus),u=ke(m=>m.listSessions),f=ke(m=>m.clearSession),c=Vt(m=>m.currentProject),d=Vt(m=>m.loadProject),p=df(),g=l==="connected"||p;return P.useEffect(()=>{g&&s&&((c==null?void 0:c.id)!==s&&d(s),u(s),f())},[g,s,c==null?void 0:c.id,d,u,f]),!c||c.id!==s?o.jsx(y0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ob,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(Nw,{})})]})}function AA({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,l]=yh("/p/:projectId/s/:sessionId"),u=l==null?void 0:l.projectId,f=l==null?void 0:l.sessionId,[,c]=cr(),d=ke(S=>S.connectionStatus),p=ke(S=>S.currentSession),g=ke(S=>S.loadSession),m=ke(S=>S.listSessions),x=ke(S=>S.pendingSessionCreate),_=ke(S=>S.error),E=ke(S=>S.clearError),C=Vt(S=>S.currentProject),b=Vt(S=>S.loadProject),v=df(),y=d==="connected"||v;return P.useEffect(()=>{y&&u&&(C==null?void 0:C.id)!==u&&b(u)},[y,u,C==null?void 0:C.id,b]),P.useEffect(()=>{y&&f&&(p==null?void 0:p.id)!==f&&!x&&g(f),y&&u&&m(u)},[y,f,p==null?void 0:p.id,g,m,x,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(E(),c(`/p/${u}`))},[_,u,E,c]),!C||C.id!==u?o.jsx(y0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ob,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(bA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function DA(){const e=jt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(NA,{onComplete:r})})}function LA(){const{connectionStatus:e}=FS(),r=jt(R=>R.fetchConfig),i=jt(R=>R.refreshProviderModels),s=Jt(R=>R.getSetting),l=jt(R=>R.providers),u=jt(R=>R.activeProviderId),[,f]=cr(),c=df(),[d,p]=P.useState(!1);P.useEffect(()=>{(e==="connected"||c)&&r().then(()=>{p(!0);for(const R of SS)s(R)})},[e,c,r,s]),P.useEffect(()=>{d&&u&&i(u).then(()=>{r()})},[d,u,i,r]),P.useEffect(()=>{d&&l.length===0&&f("/onboarding")},[d,l.length]);const g=()=>{const R=localStorage.getItem("openfox:leftSidebar");return R!==null?R==="true":!1},m=()=>{const R=localStorage.getItem("openfox:rightSidebar");return R!==null?R==="true":!0},[x,_]=P.useState(g),[E,C]=P.useState(m),[b,v]=P.useState(!1),[y,S]=P.useState(!1),[j,A]=P.useState(!1);P.useEffect(()=>{const R=()=>{A(window.innerWidth<768)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const N=j?b:x,D=j?y:E,T=()=>{j?v(!b):_(!x)},I=()=>{j?S(!y):C(!E)};P.useEffect(()=>{j||localStorage.setItem("openfox:leftSidebar",String(x))},[x,j]),P.useEffect(()=>{j||localStorage.setItem("openfox:rightSidebar",String(E))},[E,j]),P.useEffect(()=>{(e==="connected"||c)&&r()},[e,r,c]);const z=ke(R=>R.showPasswordModal),q=ke(R=>R.passwordModalRetry),K=ke(R=>R.submitPassword),W=ke(R=>R.cancelPassword);return e!=="connected"&&!z&&!c?o.jsxs(o.Fragment,{children:[o.jsx(ib,{isOpen:!0,isRetry:q,onSubmit:K,onCancel:W}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(Cw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(ib,{isOpen:z,isRetry:q,onSubmit:K,onCancel:W}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(bw,{}),o.jsx(pw,{onMenuClick:T,onCriteriaToggle:I}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(fS,{children:[o.jsx(Na,{path:"/onboarding",children:o.jsx(DA,{})}),o.jsx(Na,{path:"/p/:projectId/s/:sessionId",children:o.jsx(AA,{sidebarOpen:N,onSidebarToggle:T,rightSidebarOpen:D,onRightSidebarToggle:I})}),o.jsx(Na,{path:"/p/:projectId/new",children:o.jsx(jw,{})}),o.jsx(Na,{path:"/p/:projectId",children:o.jsx(TA,{sidebarOpen:N,onSidebarToggle:T})}),o.jsx(Na,{path:"/",children:o.jsx(Ew,{})})]})})]})]})}W1.createRoot(document.getElementById("root")).render(o.jsx(un.StrictMode,{children:o.jsx(LA,{})}));