openfox 0.2.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/agent-defaults/builder.agent.md +3 -7
  2. package/dist/agent-defaults/code-reviewer.agent.md +1 -2
  3. package/dist/agent-defaults/debugger.agent.md +1 -2
  4. package/dist/agent-defaults/planner.agent.md +2 -9
  5. package/dist/agent-defaults/test-generator.agent.md +1 -1
  6. package/dist/agent-defaults/verifier.agent.md +4 -5
  7. package/dist/ask-3RK5YJZE.js +19 -0
  8. package/dist/auto-compaction-7LNZ5J3W.js +23 -0
  9. package/dist/{branch.api-WDHKZJS6.js → branch.api-XADFZZAA.js} +2 -2
  10. package/dist/chat-handler-T7SLWZ4E.js +201 -0
  11. package/dist/chunk-22CTURMH.js +128 -0
  12. package/dist/chunk-2KSCZSXQ.js +680 -0
  13. package/dist/{chunk-S5NRIWEU.js → chunk-2TBNG7CS.js} +12 -12
  14. package/dist/{chunk-4Z2OZ6NX.js → chunk-3EHGGBWE.js} +29 -2
  15. package/dist/{chunk-GZ7ZVJIW.js → chunk-3UQACISJ.js} +159 -49
  16. package/dist/{chunk-AF7XS4OI.js → chunk-5YQAXUKO.js} +4 -1
  17. package/dist/{chunk-MTX5Y3V3.js → chunk-7IOZFJBW.js} +2 -2
  18. package/dist/chunk-BU2ZYOEA.js +1067 -0
  19. package/dist/chunk-M2C5GEQR.js +137 -0
  20. package/dist/{chunk-U62ZECSQ.js → chunk-PNBH3RAX.js} +2 -2
  21. package/dist/chunk-QDEKU5RL.js +75 -0
  22. package/dist/chunk-QYP5HQV4.js +438 -0
  23. package/dist/{chunk-O4W4555H.js → chunk-RAZQTQK2.js} +1353 -1134
  24. package/dist/chunk-S4QKTRGJ.js +343 -0
  25. package/dist/{chunk-ARFK3RZW.js → chunk-TPT6HP4H.js} +1 -1
  26. package/dist/chunk-TVQOONDR.js +75 -0
  27. package/dist/{chunk-5ZUU23XF.js → chunk-U6BUT37A.js} +286 -33
  28. package/dist/chunk-VZXXJKSQ.js +314 -0
  29. package/dist/{chunk-26NRL3HX.js → chunk-XFXOSPYH.js} +3 -2
  30. package/dist/{chunk-N2XYX4ZA.js → chunk-XKFPU2FA.js} +13 -2
  31. package/dist/{chunk-FUUYYDVG.js → chunk-YB2574C6.js} +2841 -4507
  32. package/dist/cli/dev.js +4 -3
  33. package/dist/cli/index.js +4 -3
  34. package/dist/{config-GIXXE4VK.js → config-GIFCEJDU.js} +11 -6
  35. package/dist/events-G6CKHDNZ.js +114 -0
  36. package/dist/folding-O52L65VN.js +37 -0
  37. package/dist/{init-2EJ5AC7Z.js → init-MKTUIGZU.js} +46 -13
  38. package/dist/orchestrator-UGXX7JRQ.js +39 -0
  39. package/dist/package.json +9 -2
  40. package/dist/{paths-4BPXWB2W.js → paths-MM76AWYB.js} +2 -2
  41. package/dist/processor-KLHKDILM.js +236 -0
  42. package/dist/{project-creator-CWPKRIKI.js → project-creator-KAQXMZCT.js} +9 -8
  43. package/dist/projects-GSMMEVSO.js +19 -0
  44. package/dist/{protocol-BFFz3WM0.d.ts → protocol-BZ6OIASP.d.ts} +71 -50
  45. package/dist/protocol-WQENDK72.js +88 -0
  46. package/dist/{provider-QEVVNYOX.js → provider-4KTWU6IV.js} +41 -9
  47. package/dist/runtime-config-2XJJIMSC.js +9 -0
  48. package/dist/{serve-RYEBLJVN.js → serve-UK6B6G2O.js} +38 -18
  49. package/dist/server/index.d.ts +81 -27
  50. package/dist/server/index.js +19 -11
  51. package/dist/{settings-D5O3TMLD.js → settings-NCLN4JDZ.js} +4 -4
  52. package/dist/shared/index.d.ts +2 -2
  53. package/dist/shared/index.js +1 -1
  54. package/dist/tools-SGBQE736.js +48 -0
  55. package/dist/vision-fallback-63VPBSEN.js +22 -0
  56. package/dist/web/assets/{index-DHmZmhnR.css → index-BsaaC0X0.css} +32 -1
  57. package/dist/web/assets/index-CvO7QkGh.js +141 -0
  58. package/dist/web/index.html +2 -2
  59. package/dist/web/sounds/typing.mp3 +0 -0
  60. package/dist/workflow-defaults/default.workflow.json +1 -1
  61. package/package.json +9 -2
  62. package/dist/chunk-L4XDA3V7.js +0 -218
  63. package/dist/tools-QMIIDJTV.js +0 -48
  64. package/dist/web/assets/index-CAD7Iv_d.js +0 -122
@@ -0,0 +1,141 @@
1
+ var q_=Object.defineProperty;var W_=(e,i,r)=>i in e?q_(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r;var vi=(e,i,r)=>W_(e,typeof i!="symbol"?i+"":i,r);function G_(e,i){for(var r=0;r<i.length;r++){const s=i[r];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in e)){const f=Object.getOwnPropertyDescriptor(s,l);f&&Object.defineProperty(e,l,f.get?f:{enumerable:!0,get:()=>s[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const f of l)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(l){const f={};return l.integrity&&(f.integrity=l.integrity),l.referrerPolicy&&(f.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?f.credentials="include":l.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function s(l){if(l.ep)return;l.ep=!0;const f=r(l);fetch(l.href,f)}})();function Tl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var td={exports:{}},Sa={};/**
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 Ug;function V_(){if(Ug)return Sa;Ug=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function r(s,l,f){var m=null;if(f!==void 0&&(m=""+f),l.key!==void 0&&(m=""+l.key),"key"in l){f={};for(var o in l)o!=="key"&&(f[o]=l[o])}else f=l;return l=f.ref,{$$typeof:e,type:s,key:m,ref:l!==void 0?l:null,props:f}}return Sa.Fragment=i,Sa.jsx=r,Sa.jsxs=r,Sa}var $g;function Y_(){return $g||($g=1,td.exports=V_()),td.exports}var c=Y_(),nd={exports:{}},He={};/**
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 qg;function K_(){if(qg)return He;qg=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),m=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function S(B){return B===null||typeof B!="object"?null:(B=v&&B[v]||B["@@iterator"],typeof B=="function"?B:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function x(B,U,P){this.props=B,this.context=U,this.refs=b,this.updater=P||E}x.prototype.isReactComponent={},x.prototype.setState=function(B,U){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,U,"setState")},x.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function _(){}_.prototype=x.prototype;function y(B,U,P){this.props=B,this.context=U,this.refs=b,this.updater=P||E}var j=y.prototype=new _;j.constructor=y,C(j,x.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var R={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(B,U,P){var Y=P.ref;return{$$typeof:e,type:B,key:U,ref:Y!==void 0?Y:null,props:P}}function H(B,U){return I(B.type,U,B.props)}function G(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function K(B){var U={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(P){return U[P]})}var q=/\/+/g;function O(B,U){return typeof B=="object"&&B!==null&&B.key!=null?K(""+B.key):U.toString(36)}function W(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(N,N):(B.status="pending",B.then(function(U){B.status==="pending"&&(B.status="fulfilled",B.value=U)},function(U){B.status==="pending"&&(B.status="rejected",B.reason=U)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function V(B,U,P,Y,ne){var Z=typeof B;(Z==="undefined"||Z==="boolean")&&(B=null);var X=!1;if(B===null)X=!0;else switch(Z){case"bigint":case"string":case"number":X=!0;break;case"object":switch(B.$$typeof){case e:case i:X=!0;break;case g:return X=B._init,V(X(B._payload),U,P,Y,ne)}}if(X)return ne=ne(B),X=Y===""?"."+O(B,0):Y,A(ne)?(P="",X!=null&&(P=X.replace(q,"$&/")+"/"),V(ne,U,P,"",function(se){return se})):ne!=null&&(G(ne)&&(ne=H(ne,P+(ne.key==null||B&&B.key===ne.key?"":(""+ne.key).replace(q,"$&/")+"/")+X)),U.push(ne)),1;X=0;var z=Y===""?".":Y+":";if(A(B))for(var ae=0;ae<B.length;ae++)Y=B[ae],Z=z+O(Y,ae),X+=V(Y,U,P,Z,ne);else if(ae=S(B),typeof ae=="function")for(B=ae.call(B),ae=0;!(Y=B.next()).done;)Y=Y.value,Z=z+O(Y,ae++),X+=V(Y,U,P,Z,ne);else if(Z==="object"){if(typeof B.then=="function")return V(W(B),U,P,Y,ne);throw U=String(B),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return X}function Q(B,U,P){if(B==null)return B;var Y=[],ne=0;return V(B,Y,"","",function(Z){return U.call(P,Z,ne++)}),Y}function te(B){if(B._status===-1){var U=B._result;U=U(),U.then(function(P){(B._status===0||B._status===-1)&&(B._status=1,B._result=P)},function(P){(B._status===0||B._status===-1)&&(B._status=2,B._result=P)}),B._status===-1&&(B._status=0,B._result=U)}if(B._status===1)return B._result.default;throw B._result}var L=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},D={map:Q,forEach:function(B,U,P){Q(B,function(){U.apply(this,arguments)},P)},count:function(B){var U=0;return Q(B,function(){U++}),U},toArray:function(B){return Q(B,function(U){return U})||[]},only:function(B){if(!G(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return He.Activity=p,He.Children=D,He.Component=x,He.Fragment=r,He.Profiler=l,He.PureComponent=y,He.StrictMode=s,He.Suspense=d,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,He.__COMPILER_RUNTIME={__proto__:null,c:function(B){return R.H.useMemoCache(B)}},He.cache=function(B){return function(){return B.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(B,U,P){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var Y=C({},B.props),ne=B.key;if(U!=null)for(Z in U.key!==void 0&&(ne=""+U.key),U)!T.call(U,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&U.ref===void 0||(Y[Z]=U[Z]);var Z=arguments.length-2;if(Z===1)Y.children=P;else if(1<Z){for(var X=Array(Z),z=0;z<Z;z++)X[z]=arguments[z+2];Y.children=X}return I(B.type,ne,Y)},He.createContext=function(B){return B={$$typeof:m,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:f,_context:B},B},He.createElement=function(B,U,P){var Y,ne={},Z=null;if(U!=null)for(Y in U.key!==void 0&&(Z=""+U.key),U)T.call(U,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ne[Y]=U[Y]);var X=arguments.length-2;if(X===1)ne.children=P;else if(1<X){for(var z=Array(X),ae=0;ae<X;ae++)z[ae]=arguments[ae+2];ne.children=z}if(B&&B.defaultProps)for(Y in X=B.defaultProps,X)ne[Y]===void 0&&(ne[Y]=X[Y]);return I(B,Z,ne)},He.createRef=function(){return{current:null}},He.forwardRef=function(B){return{$$typeof:o,render:B}},He.isValidElement=G,He.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:te}},He.memo=function(B,U){return{$$typeof:h,type:B,compare:U===void 0?null:U}},He.startTransition=function(B){var U=R.T,P={};R.T=P;try{var Y=B(),ne=R.S;ne!==null&&ne(P,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(N,L)}catch(Z){L(Z)}finally{U!==null&&P.types!==null&&(U.types=P.types),R.T=U}},He.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},He.use=function(B){return R.H.use(B)},He.useActionState=function(B,U,P){return R.H.useActionState(B,U,P)},He.useCallback=function(B,U){return R.H.useCallback(B,U)},He.useContext=function(B){return R.H.useContext(B)},He.useDebugValue=function(){},He.useDeferredValue=function(B,U){return R.H.useDeferredValue(B,U)},He.useEffect=function(B,U){return R.H.useEffect(B,U)},He.useEffectEvent=function(B){return R.H.useEffectEvent(B)},He.useId=function(){return R.H.useId()},He.useImperativeHandle=function(B,U,P){return R.H.useImperativeHandle(B,U,P)},He.useInsertionEffect=function(B,U){return R.H.useInsertionEffect(B,U)},He.useLayoutEffect=function(B,U){return R.H.useLayoutEffect(B,U)},He.useMemo=function(B,U){return R.H.useMemo(B,U)},He.useOptimistic=function(B,U){return R.H.useOptimistic(B,U)},He.useReducer=function(B,U,P){return R.H.useReducer(B,U,P)},He.useRef=function(B){return R.H.useRef(B)},He.useState=function(B){return R.H.useState(B)},He.useSyncExternalStore=function(B,U,P){return R.H.useSyncExternalStore(B,U,P)},He.useTransition=function(){return R.H.useTransition()},He.version="19.2.4",He}var Wg;function Al(){return Wg||(Wg=1,nd.exports=K_()),nd.exports}var F=Al();const an=Tl(F),X_=G_({__proto__:null,default:an},[F]);var rd={exports:{}},wa={},id={exports:{}},sd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Gg;function Z_(){return Gg||(Gg=1,(function(e){function i(V,Q){var te=V.length;V.push(Q);e:for(;0<te;){var L=te-1>>>1,D=V[L];if(0<l(D,Q))V[L]=Q,V[te]=D,te=L;else break e}}function r(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var Q=V[0],te=V.pop();if(te!==Q){V[0]=te;e:for(var L=0,D=V.length,B=D>>>1;L<B;){var U=2*(L+1)-1,P=V[U],Y=U+1,ne=V[Y];if(0>l(P,te))Y<D&&0>l(ne,P)?(V[L]=ne,V[Y]=te,L=Y):(V[L]=P,V[U]=te,L=U);else if(Y<D&&0>l(ne,te))V[L]=ne,V[Y]=te,L=Y;else break e}}return Q}function l(V,Q){var te=V.sortIndex-Q.sortIndex;return te!==0?te:V.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var m=Date,o=m.now();e.unstable_now=function(){return m.now()-o}}var d=[],h=[],g=1,p=null,v=3,S=!1,E=!1,C=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function j(V){for(var Q=r(h);Q!==null;){if(Q.callback===null)s(h);else if(Q.startTime<=V)s(h),Q.sortIndex=Q.expirationTime,i(d,Q);else break;Q=r(h)}}function A(V){if(C=!1,j(V),!E)if(r(d)!==null)E=!0,N||(N=!0,K());else{var Q=r(h);Q!==null&&W(A,Q.startTime-V)}}var N=!1,R=-1,T=5,I=-1;function H(){return b?!0:!(e.unstable_now()-I<T)}function G(){if(b=!1,N){var V=e.unstable_now();I=V;var Q=!0;try{e:{E=!1,C&&(C=!1,_(R),R=-1),S=!0;var te=v;try{t:{for(j(V),p=r(d);p!==null&&!(p.expirationTime>V&&H());){var L=p.callback;if(typeof L=="function"){p.callback=null,v=p.priorityLevel;var D=L(p.expirationTime<=V);if(V=e.unstable_now(),typeof D=="function"){p.callback=D,j(V),Q=!0;break t}p===r(d)&&s(d),j(V)}else s(d);p=r(d)}if(p!==null)Q=!0;else{var B=r(h);B!==null&&W(A,B.startTime-V),Q=!1}}break e}finally{p=null,v=te,S=!1}Q=void 0}}finally{Q?K():N=!1}}}var K;if(typeof y=="function")K=function(){y(G)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,O=q.port2;q.port1.onmessage=G,K=function(){O.postMessage(null)}}else K=function(){x(G,0)};function W(V,Q){R=x(function(){V(e.unstable_now())},Q)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var Q=3;break;default:Q=v}var te=v;v=Q;try{return V()}finally{v=te}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var te=v;v=V;try{return Q()}finally{v=te}},e.unstable_scheduleCallback=function(V,Q,te){var L=e.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?L+te:L):te=L,V){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=te+D,V={id:g++,callback:Q,priorityLevel:V,startTime:te,expirationTime:D,sortIndex:-1},te>L?(V.sortIndex=te,i(h,V),r(d)===null&&V===r(h)&&(C?(_(R),R=-1):C=!0,W(A,te-L))):(V.sortIndex=D,i(d,V),E||S||(E=!0,N||(N=!0,K()))),V},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(V){var Q=v;return function(){var te=v;v=Q;try{return V.apply(this,arguments)}finally{v=te}}}})(sd)),sd}var Vg;function Q_(){return Vg||(Vg=1,id.exports=Z_()),id.exports}var ad={exports:{}},Jt={};/**
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 Yg;function J_(){if(Yg)return Jt;Yg=1;var e=Al();function i(d){var h="https://react.dev/errors/"+d;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(i(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function f(d,h,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:p==null?null:""+p,children:d,containerInfo:h,implementation:g}}var m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(d,h){if(d==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Jt.createPortal=function(d,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(i(299));return f(d,h,null,g)},Jt.flushSync=function(d){var h=m.T,g=s.p;try{if(m.T=null,s.p=2,d)return d()}finally{m.T=h,s.p=g,s.d.f()}},Jt.preconnect=function(d,h){typeof d=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(d,h))},Jt.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Jt.preinit=function(d,h){if(typeof d=="string"&&h&&typeof h.as=="string"){var g=h.as,p=o(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,S=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(d,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:v,fetchPriority:S}):g==="script"&&s.d.X(d,{crossOrigin:p,integrity:v,fetchPriority:S,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Jt.preinitModule=function(d,h){if(typeof d=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=o(h.as,h.crossOrigin);s.d.M(d,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(d)},Jt.preload=function(d,h){if(typeof d=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,p=o(g,h.crossOrigin);s.d.L(d,g,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Jt.preloadModule=function(d,h){if(typeof d=="string")if(h){var g=o(h.as,h.crossOrigin);s.d.m(d,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(d)},Jt.requestFormReset=function(d){s.d.r(d)},Jt.unstable_batchedUpdates=function(d,h){return d(h)},Jt.useFormState=function(d,h,g){return m.H.useFormState(d,h,g)},Jt.useFormStatus=function(){return m.H.useHostTransitionStatus()},Jt.version="19.2.4",Jt}var Kg;function Hv(){if(Kg)return ad.exports;Kg=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(i){console.error(i)}}return e(),ad.exports=J_(),ad.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 Xg;function e1(){if(Xg)return wa;Xg=1;var e=Q_(),i=Al(),r=Hv();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 f(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 m(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 o(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(f(t)!==t)throw Error(s(188))}function h(t){var n=t.alternate;if(!n){if(n=f(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,u=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(u=w.return,u!==null){a=u;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return d(w),t;if(k===u)return d(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==u.return)a=w,u=k;else{for(var M=!1,$=w.child;$;){if($===a){M=!0,a=w,u=k;break}if($===u){M=!0,u=w,a=k;break}$=$.sibling}if(!M){for($=k.child;$;){if($===a){M=!0,a=k,u=w;break}if($===u){M=!0,u=k,a=w;break}$=$.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==u)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 p=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),y=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function K(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function O(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case x: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 y:return t.displayName||"Context";case _: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 R:return n=t.displayName||null,n!==null?n:O(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return O(t(n))}catch{}}return null}var W=Array.isArray,V=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},L=[],D=-1;function B(t){return{current:t}}function U(t){0>D||(t.current=L[D],L[D]=null,D--)}function P(t,n){D++,L[D]=t.current,t.current=n}var Y=B(null),ne=B(null),Z=B(null),X=B(null);function z(t,n){switch(P(Z,n),P(ne,t),P(Y,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?dg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=dg(n),t=hg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(Y),P(Y,t)}function ae(){U(Y),U(ne),U(Z)}function se(t){t.memoizedState!==null&&P(X,t);var n=Y.current,a=hg(n,t.type);n!==a&&(P(ne,t),P(Y,a))}function ge(t){ne.current===t&&(U(Y),U(ne)),X.current===t&&(U(X),va._currentValue=te)}var be,je;function Te(t){if(be===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);be=n&&n[1]||"",je=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+be+t+je}var Le=!1;function Pe(t,n){if(!t||Le)return"";Le=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(n){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var ce=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){ce=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=u.DetermineComponentFrameRoot(),M=k[0],$=k[1];if(M&&$){var J=M.split(`
44
+ `),le=$.split(`
45
+ `);for(w=u=0;u<J.length&&!J[u].includes("DetermineComponentFrameRoot");)u++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(u===J.length||w===le.length)for(u=J.length-1,w=le.length-1;1<=u&&0<=w&&J[u]!==le[w];)w--;for(;1<=u&&0<=w;u--,w--)if(J[u]!==le[w]){if(u!==1||w!==1)do if(u--,w--,0>w||J[u]!==le[w]){var fe=`
46
+ `+J[u].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=u&&0<=w);break}}}finally{Le=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Te(a):""}function we(t,n){switch(t.tag){case 26:case 27:case 5:return Te(t.type);case 16:return Te("Lazy");case 13:return t.child!==n&&n!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return Pe(t.type,!1);case 11:return Pe(t.type.render,!1);case 1:return Pe(t.type,!0);case 31:return Te("Activity");default:return""}}function st(t){try{var n="",a=null;do n+=we(t,a),a=t,t=t.return;while(t);return n}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var lt=Object.prototype.hasOwnProperty,he=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,Ze=e.unstable_shouldYield,Qe=e.unstable_requestPaint,qe=e.unstable_now,at=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,ee=e.unstable_UserBlockingPriority,ve=e.unstable_NormalPriority,Se=e.unstable_LowPriority,Ce=e.unstable_IdlePriority,ze=e.log,Be=e.unstable_setDisableYieldValue,ct=null,ut=null;function yt(t){if(typeof ze=="function"&&Be(t),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(ct,t)}catch{}}var nt=Math.clz32?Math.clz32:_e,An=Math.log,pe=Math.LN2;function _e(t){return t>>>=0,t===0?32:31-(An(t)/pe|0)|0}var Ie=256,We=262144,Je=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 Dt(t,n,a){var u=t.pendingLanes;if(u===0)return 0;var w=0,k=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var $=u&134217727;return $!==0?(u=$&~k,u!==0?w=Me(u):(M&=$,M!==0?w=Me(M):a||(a=$&~t,a!==0&&(w=Me(a))))):($=u&~k,$!==0?w=Me($):M!==0?w=Me(M):a||(a=u&~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 kt(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Wt(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 $l(){var t=Je;return Je<<=1,(Je&62914560)===0&&(Je=4194304),t}function Ds(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Rs(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Rb(t,n,a,u,w,k){var M=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var $=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var fe=31-nt(a),xe=1<<fe;$[fe]=0,J[fe]=-1;var ce=le[fe];if(ce!==null)for(le[fe]=null,fe=0;fe<ce.length;fe++){var ue=ce[fe];ue!==null&&(ue.lane&=-536870913)}a&=~xe}u!==0&&Gh(t,u,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(M&~n))}function Gh(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var u=31-nt(n);t.entangledLanes|=n,t.entanglements[u]=t.entanglements[u]|1073741824|a&261930}function Vh(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var u=31-nt(a),w=1<<u;w&n|t[u]&n&&(t[u]|=n),a&=~w}}function Yh(t,n){var a=n&-n;return a=(a&42)!==0?1:ql(a),(a&(t.suspendedLanes|n))!==0?0:a}function ql(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 Wl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Kh(){var t=Q.p;return t!==0?t:(t=window.event,t===void 0?32:Og(t.type))}function Xh(t,n){var a=Q.p;try{return Q.p=t,n()}finally{Q.p=a}}var kr=Math.random().toString(36).slice(2),Gt="__reactFiber$"+kr,ln="__reactProps$"+kr,Ri="__reactContainer$"+kr,Gl="__reactEvents$"+kr,Lb="__reactListeners$"+kr,Mb="__reactHandles$"+kr,Zh="__reactResources$"+kr,Ls="__reactMarker$"+kr;function Vl(t){delete t[Gt],delete t[ln],delete t[Gl],delete t[Lb],delete t[Mb]}function Li(t){var n=t[Gt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Ri]||a[Gt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=bg(t);t!==null;){if(a=t[Gt])return a;t=bg(t)}return n}t=a,a=t.parentNode}return null}function Mi(t){if(t=t[Gt]||t[Ri]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Ms(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Oi(t){var n=t[Zh];return n||(n=t[Zh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Pt(t){t[Ls]=!0}var Qh=new Set,Jh={};function ti(t,n){Bi(t,n),Bi(t+"Capture",n)}function Bi(t,n){for(Jh[t]=n,t=0;t<n.length;t++)Qh.add(n[t])}var Ob=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]*$"),ef={},tf={};function Bb(t){return lt.call(tf,t)?!0:lt.call(ef,t)?!1:Ob.test(t)?tf[t]=!0:(ef[t]=!0,!1)}function Ka(t,n,a){if(Bb(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var u=n.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function Xa(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 ir(t,n,a,u){if(u===null)t.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+u)}}function Dn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function nf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ib(t,n,a){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,k=u.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,k.call(this,M)}}),Object.defineProperty(t,n,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Yl(t){if(!t._valueTracker){var n=nf(t)?"checked":"value";t._valueTracker=Ib(t,n,""+t[n])}}function rf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),u="";return t&&(u=nf(t)?t.checked?"true":"false":t.value),t=u,t!==a?(n.setValue(t),!0):!1}function Za(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 zb=/[\n"\\]/g;function Rn(t){return t.replace(zb,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Kl(t,n,a,u,w,k,M,$){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),n!=null?M==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Dn(n)):t.value!==""+Dn(n)&&(t.value=""+Dn(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?Xl(t,M,Dn(n)):a!=null?Xl(t,M,Dn(a)):u!=null&&t.removeAttribute("value"),w==null&&k!=null&&(t.defaultChecked=!!k),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?t.name=""+Dn($):t.removeAttribute("name")}function sf(t,n,a,u,w,k,M,$){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)){Yl(t);return}a=a!=null?""+Dn(a):"",n=n!=null?""+Dn(n):a,$||n===t.value||(t.value=n),t.defaultValue=n}u=u??w,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=$?t.checked:!!u,t.defaultChecked=!!u,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Yl(t)}function Xl(t,n,a){n==="number"&&Za(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Ii(t,n,a,u){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&&u&&(t[a].defaultSelected=!0)}else{for(a=""+Dn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,u&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function af(t,n,a){if(n!=null&&(n=""+Dn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Dn(a):""}function of(t,n,a,u){if(n==null){if(u!=null){if(a!=null)throw Error(s(92));if(W(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),n=a}a=Dn(n),t.defaultValue=a,u=t.textContent,u===a&&u!==""&&u!==null&&(t.value=u),Yl(t)}function zi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var Hb=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 lf(t,n,a){var u=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":u?t.setProperty(n,a):typeof a!="number"||a===0||Hb.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function cf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||n!=null&&n.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var w in n)u=n[w],n.hasOwnProperty(w)&&a[w]!==u&&lf(t,w,u)}else for(var k in n)n.hasOwnProperty(k)&&lf(t,k,n[k])}function Zl(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 Pb=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"]]),Fb=/^[\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 Qa(t){return Fb.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function sr(){}var Ql=null;function Jl(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Hi=null,Pi=null;function uf(t){var n=Mi(t);if(n&&(t=n.stateNode)){var a=t[ln]||null;e:switch(t=n.stateNode,n.type){case"input":if(Kl(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="'+Rn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var u=a[n];if(u!==t&&u.form===t.form){var w=u[ln]||null;if(!w)throw Error(s(90));Kl(u,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)u=a[n],u.form===t.form&&rf(u)}break e;case"textarea":af(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ii(t,!!a.multiple,n,!1)}}}var ec=!1;function df(t,n,a){if(ec)return t(n,a);ec=!0;try{var u=t(n);return u}finally{if(ec=!1,(Hi!==null||Pi!==null)&&(Po(),Hi&&(n=Hi,t=Pi,Pi=Hi=null,uf(n),t)))for(n=0;n<t.length;n++)uf(t[n])}}function Os(t,n){var a=t.stateNode;if(a===null)return null;var u=a[ln]||null;if(u===null)return null;a=u[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":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tc=!1;if(ar)try{var Bs={};Object.defineProperty(Bs,"passive",{get:function(){tc=!0}}),window.addEventListener("test",Bs,Bs),window.removeEventListener("test",Bs,Bs)}catch{tc=!1}var Er=null,nc=null,Ja=null;function hf(){if(Ja)return Ja;var t,n=nc,a=n.length,u,w="value"in Er?Er.value:Er.textContent,k=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(u=1;u<=M&&n[a-u]===w[k-u];u++);return Ja=w.slice(t,1<u?1-u:void 0)}function eo(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 to(){return!0}function ff(){return!1}function cn(t){function n(a,u,w,k,M){this._reactName=a,this._targetInst=w,this.type=u,this.nativeEvent=k,this.target=M,this.currentTarget=null;for(var $ in t)t.hasOwnProperty($)&&(a=t[$],this[$]=a?a(k):k[$]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?to:ff,this.isPropagationStopped=ff,this}return p(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=to)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=to)},persist:function(){},isPersistent:to}),n}var ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},no=cn(ni),Is=p({},ni,{view:0,detail:0}),Ub=cn(Is),rc,ic,zs,ro=p({},Is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ac,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!==zs&&(zs&&t.type==="mousemove"?(rc=t.screenX-zs.screenX,ic=t.screenY-zs.screenY):ic=rc=0,zs=t),rc)},movementY:function(t){return"movementY"in t?t.movementY:ic}}),pf=cn(ro),$b=p({},ro,{dataTransfer:0}),qb=cn($b),Wb=p({},Is,{relatedTarget:0}),sc=cn(Wb),Gb=p({},ni,{animationName:0,elapsedTime:0,pseudoElement:0}),Vb=cn(Gb),Yb=p({},ni,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Kb=cn(Yb),Xb=p({},ni,{data:0}),mf=cn(Xb),Zb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qb={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"},Jb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ey(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Jb[t])?!!n[t]:!1}function ac(){return ey}var ty=p({},Is,{key:function(t){if(t.key){var n=Zb[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=eo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Qb[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ac,charCode:function(t){return t.type==="keypress"?eo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?eo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ny=cn(ty),ry=p({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gf=cn(ry),iy=p({},Is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ac}),sy=cn(iy),ay=p({},ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),oy=cn(ay),ly=p({},ro,{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}),cy=cn(ly),uy=p({},ni,{newState:0,oldState:0}),dy=cn(uy),hy=[9,13,27,32],oc=ar&&"CompositionEvent"in window,Hs=null;ar&&"documentMode"in document&&(Hs=document.documentMode);var fy=ar&&"TextEvent"in window&&!Hs,xf=ar&&(!oc||Hs&&8<Hs&&11>=Hs),vf=" ",bf=!1;function yf(t,n){switch(t){case"keyup":return hy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _f(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Fi=!1;function py(t,n){switch(t){case"compositionend":return _f(n);case"keypress":return n.which!==32?null:(bf=!0,vf);case"textInput":return t=n.data,t===vf&&bf?null:t;default:return null}}function my(t,n){if(Fi)return t==="compositionend"||!oc&&yf(t,n)?(t=hf(),Ja=nc=Er=null,Fi=!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 xf&&n.locale!=="ko"?null:n.data;default:return null}}var gy={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 Sf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!gy[t.type]:n==="textarea"}function wf(t,n,a,u){Hi?Pi?Pi.push(u):Pi=[u]:Hi=u,n=Vo(n,"onChange"),0<n.length&&(a=new no("onChange","change",null,a,u),t.push({event:a,listeners:n}))}var Ps=null,Fs=null;function xy(t){sg(t,0)}function io(t){var n=Ms(t);if(rf(n))return t}function Cf(t,n){if(t==="change")return n}var kf=!1;if(ar){var lc;if(ar){var cc="oninput"in document;if(!cc){var Ef=document.createElement("div");Ef.setAttribute("oninput","return;"),cc=typeof Ef.oninput=="function"}lc=cc}else lc=!1;kf=lc&&(!document.documentMode||9<document.documentMode)}function jf(){Ps&&(Ps.detachEvent("onpropertychange",Nf),Fs=Ps=null)}function Nf(t){if(t.propertyName==="value"&&io(Fs)){var n=[];wf(n,Fs,t,Jl(t)),df(xy,n)}}function vy(t,n,a){t==="focusin"?(jf(),Ps=n,Fs=a,Ps.attachEvent("onpropertychange",Nf)):t==="focusout"&&jf()}function by(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return io(Fs)}function yy(t,n){if(t==="click")return io(n)}function _y(t,n){if(t==="input"||t==="change")return io(n)}function Sy(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var bn=typeof Object.is=="function"?Object.is:Sy;function Us(t,n){if(bn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),u=Object.keys(n);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var w=a[u];if(!lt.call(n,w)||!bn(t[w],n[w]))return!1}return!0}function Tf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Af(t,n){var a=Tf(t);t=0;for(var u;a;){if(a.nodeType===3){if(u=t+a.textContent.length,t<=n&&u>=n)return{node:a,offset:n-t};t=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Tf(a)}}function Df(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Df(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Rf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Za(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=Za(t.document)}return n}function uc(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 wy=ar&&"documentMode"in document&&11>=document.documentMode,Ui=null,dc=null,$s=null,hc=!1;function Lf(t,n,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;hc||Ui==null||Ui!==Za(u)||(u=Ui,"selectionStart"in u&&uc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),$s&&Us($s,u)||($s=u,u=Vo(dc,"onSelect"),0<u.length&&(n=new no("onSelect","select",null,n,a),t.push({event:n,listeners:u}),n.target=Ui)))}function ri(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var $i={animationend:ri("Animation","AnimationEnd"),animationiteration:ri("Animation","AnimationIteration"),animationstart:ri("Animation","AnimationStart"),transitionrun:ri("Transition","TransitionRun"),transitionstart:ri("Transition","TransitionStart"),transitioncancel:ri("Transition","TransitionCancel"),transitionend:ri("Transition","TransitionEnd")},fc={},Mf={};ar&&(Mf=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function ii(t){if(fc[t])return fc[t];if(!$i[t])return t;var n=$i[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Mf)return fc[t]=n[a];return t}var Of=ii("animationend"),Bf=ii("animationiteration"),If=ii("animationstart"),Cy=ii("transitionrun"),ky=ii("transitionstart"),Ey=ii("transitioncancel"),zf=ii("transitionend"),Hf=new Map,pc="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(" ");pc.push("scrollEnd");function Un(t,n){Hf.set(t,n),ti(n,[t])}var so=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)},Ln=[],qi=0,mc=0;function ao(){for(var t=qi,n=mc=qi=0;n<t;){var a=Ln[n];Ln[n++]=null;var u=Ln[n];Ln[n++]=null;var w=Ln[n];Ln[n++]=null;var k=Ln[n];if(Ln[n++]=null,u!==null&&w!==null){var M=u.pending;M===null?w.next=w:(w.next=M.next,M.next=w),u.pending=w}k!==0&&Pf(a,w,k)}}function oo(t,n,a,u){Ln[qi++]=t,Ln[qi++]=n,Ln[qi++]=a,Ln[qi++]=u,mc|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function gc(t,n,a,u){return oo(t,n,a,u),lo(t)}function si(t,n){return oo(t,null,null,n),lo(t)}function Pf(t,n,a){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,u=k.alternate,u!==null&&(u.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-nt(a),t=k.hiddenUpdates,u=t[w],u===null?t[w]=[n]:u.push(n),n.lane=a|536870912),k):null}function lo(t){if(50<da)throw da=0,ku=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Wi={};function jy(t,n,a,u){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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yn(t,n,a,u){return new jy(t,n,a,u)}function xc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function or(t,n){var a=t.alternate;return a===null?(a=yn(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 Ff(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 co(t,n,a,u,w,k){var M=0;if(u=t,typeof t=="function")xc(t)&&(M=1);else if(typeof t=="string")M=R_(t,a,Y.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=yn(31,a,n,w),t.elementType=I,t.lanes=k,t;case C:return ai(a.children,w,k,n);case b:M=8,w|=24;break;case x:return t=yn(12,a,n,w|2),t.elementType=x,t.lanes=k,t;case A:return t=yn(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=yn(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case y:M=10;break e;case _:M=9;break e;case j:M=11;break e;case R:M=14;break e;case T:M=16,u=null;break e}M=29,a=Error(s(130,t===null?"null":typeof t,"")),u=null}return n=yn(M,a,n,w),n.elementType=t,n.type=u,n.lanes=k,n}function ai(t,n,a,u){return t=yn(7,t,u,n),t.lanes=a,t}function vc(t,n,a){return t=yn(6,t,null,n),t.lanes=a,t}function Uf(t){var n=yn(18,null,null,0);return n.stateNode=t,n}function bc(t,n,a){return n=yn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var $f=new WeakMap;function Mn(t,n){if(typeof t=="object"&&t!==null){var a=$f.get(t);return a!==void 0?a:(n={value:t,source:n,stack:st(n)},$f.set(t,n),n)}return{value:t,source:n,stack:st(n)}}var Gi=[],Vi=0,uo=null,qs=0,On=[],Bn=0,jr=null,Kn=1,Xn="";function lr(t,n){Gi[Vi++]=qs,Gi[Vi++]=uo,uo=t,qs=n}function qf(t,n,a){On[Bn++]=Kn,On[Bn++]=Xn,On[Bn++]=jr,jr=t;var u=Kn;t=Xn;var w=32-nt(u)-1;u&=~(1<<w),a+=1;var k=32-nt(n)+w;if(30<k){var M=w-w%5;k=(u&(1<<M)-1).toString(32),u>>=M,w-=M,Kn=1<<32-nt(n)+w|a<<w|u,Xn=k+t}else Kn=1<<k|a<<w|u,Xn=t}function yc(t){t.return!==null&&(lr(t,1),qf(t,1,0))}function _c(t){for(;t===uo;)uo=Gi[--Vi],Gi[Vi]=null,qs=Gi[--Vi],Gi[Vi]=null;for(;t===jr;)jr=On[--Bn],On[Bn]=null,Xn=On[--Bn],On[Bn]=null,Kn=On[--Bn],On[Bn]=null}function Wf(t,n){On[Bn++]=Kn,On[Bn++]=Xn,On[Bn++]=jr,Kn=n.id,Xn=n.overflow,jr=t}var Vt=null,St=null,et=!1,Nr=null,In=!1,Sc=Error(s(519));function Tr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ws(Mn(n,t)),Sc}function Gf(t){var n=t.stateNode,a=t.type,u=t.memoizedProps;switch(n[Gt]=t,n[ln]=u,a){case"dialog":Ve("cancel",n),Ve("close",n);break;case"iframe":case"object":case"embed":Ve("load",n);break;case"video":case"audio":for(a=0;a<fa.length;a++)Ve(fa[a],n);break;case"source":Ve("error",n);break;case"img":case"image":case"link":Ve("error",n),Ve("load",n);break;case"details":Ve("toggle",n);break;case"input":Ve("invalid",n),sf(n,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ve("invalid",n);break;case"textarea":Ve("invalid",n),of(n,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||u.suppressHydrationWarning===!0||cg(n.textContent,a)?(u.popover!=null&&(Ve("beforetoggle",n),Ve("toggle",n)),u.onScroll!=null&&Ve("scroll",n),u.onScrollEnd!=null&&Ve("scrollend",n),u.onClick!=null&&(n.onclick=sr),n=!0):n=!1,n||Tr(t,!0)}function Vf(t){for(Vt=t.return;Vt;)switch(Vt.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Vt=Vt.return}}function Yi(t){if(t!==Vt)return!1;if(!et)return Vf(t),et=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Pu(t.type,t.memoizedProps)),a=!a),a&&St&&Tr(t),Vf(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=vg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=vg(t)}else n===27?(n=St,$r(t.type)?(t=Wu,Wu=null,St=t):St=n):St=Vt?Hn(t.stateNode.nextSibling):null;return!0}function oi(){St=Vt=null,et=!1}function wc(){var t=Nr;return t!==null&&(fn===null?fn=t:fn.push.apply(fn,t),Nr=null),t}function Ws(t){Nr===null?Nr=[t]:Nr.push(t)}var Cc=B(null),li=null,cr=null;function Ar(t,n,a){P(Cc,n._currentValue),n._currentValue=a}function ur(t){t._currentValue=Cc.current,U(Cc)}function kc(t,n,a){for(;t!==null;){var u=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),t===a)break;t=t.return}}function Ec(t,n,a,u){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var M=w.child;k=k.firstContext;e:for(;k!==null;){var $=k;k=w;for(var J=0;J<n.length;J++)if($.context===n[J]){k.lanes|=a,$=k.alternate,$!==null&&($.lanes|=a),kc(k.return,a,t),u||(M=null);break e}k=$.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(s(341));M.lanes|=a,k=M.alternate,k!==null&&(k.lanes|=a),kc(M,a,t),M=null}else M=w.child;if(M!==null)M.return=w;else for(M=w;M!==null;){if(M===t){M=null;break}if(w=M.sibling,w!==null){w.return=M.return,M=w;break}M=M.return}w=M}}function Ki(t,n,a,u){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 M=w.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var $=w.type;bn(w.pendingProps.value,M.value)||(t!==null?t.push($):t=[$])}}else if(w===X.current){if(M=w.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(va):t=[va])}w=w.return}t!==null&&Ec(n,t,a,u),n.flags|=262144}function ho(t){for(t=t.firstContext;t!==null;){if(!bn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ci(t){li=t,cr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Yt(t){return Yf(li,t)}function fo(t,n){return li===null&&ci(t),Yf(t,n)}function Yf(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},cr===null){if(t===null)throw Error(s(308));cr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else cr=cr.next=n;return a}var Ny=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,u){t.push(u)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},Ty=e.unstable_scheduleCallback,Ay=e.unstable_NormalPriority,Rt={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function jc(){return{controller:new Ny,data:new Map,refCount:0}}function Gs(t){t.refCount--,t.refCount===0&&Ty(Ay,function(){t.controller.abort()})}var Vs=null,Nc=0,Xi=0,Zi=null;function Dy(t,n){if(Vs===null){var a=Vs=[];Nc=0,Xi=Du(),Zi={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Nc++,n.then(Kf,Kf),n}function Kf(){if(--Nc===0&&Vs!==null){Zi!==null&&(Zi.status="fulfilled");var t=Vs;Vs=null,Xi=0,Zi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Ry(t,n){var a=[],u={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){u.status="fulfilled",u.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(u.status="rejected",u.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),u}var Xf=V.S;V.S=function(t,n){Lm=qe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Dy(t,n),Xf!==null&&Xf(t,n)};var ui=B(null);function Tc(){var t=ui.current;return t!==null?t:vt.pooledCache}function po(t,n){n===null?P(ui,ui.current):P(ui,n.pool)}function Zf(){var t=Tc();return t===null?null:{parent:Rt._currentValue,pool:t}}var Qi=Error(s(460)),Ac=Error(s(474)),mo=Error(s(542)),go={then:function(){}};function Qf(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Jf(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(sr,sr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,tp(t),t;default:if(typeof n.status=="string")n.then(sr,sr);else{if(t=vt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(u){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=u}},function(u){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=u}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,tp(t),t}throw hi=n,Qi}}function di(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(hi=a,Qi):a}}var hi=null;function ep(){if(hi===null)throw Error(s(459));var t=hi;return hi=null,t}function tp(t){if(t===Qi||t===mo)throw Error(s(483))}var Ji=null,Ys=0;function xo(t){var n=Ys;return Ys+=1,Ji===null&&(Ji=[]),Jf(Ji,t,n)}function Ks(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function vo(t,n){throw n.$$typeof===v?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function np(t){function n(ie,re){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[re],ie.flags|=16):oe.push(re)}}function a(ie,re){if(!t)return null;for(;re!==null;)n(ie,re),re=re.sibling;return null}function u(ie){for(var re=new Map;ie!==null;)ie.key!==null?re.set(ie.key,ie):re.set(ie.index,ie),ie=ie.sibling;return re}function w(ie,re){return ie=or(ie,re),ie.index=0,ie.sibling=null,ie}function k(ie,re,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<re?(ie.flags|=67108866,re):oe):(ie.flags|=67108866,re)):(ie.flags|=1048576,re)}function M(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function $(ie,re,oe,me){return re===null||re.tag!==6?(re=vc(oe,ie.mode,me),re.return=ie,re):(re=w(re,oe),re.return=ie,re)}function J(ie,re,oe,me){var Ae=oe.type;return Ae===C?fe(ie,re,oe.props.children,me,oe.key):re!==null&&(re.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===T&&di(Ae)===re.type)?(re=w(re,oe.props),Ks(re,oe),re.return=ie,re):(re=co(oe.type,oe.key,oe.props,null,ie.mode,me),Ks(re,oe),re.return=ie,re)}function le(ie,re,oe,me){return re===null||re.tag!==4||re.stateNode.containerInfo!==oe.containerInfo||re.stateNode.implementation!==oe.implementation?(re=bc(oe,ie.mode,me),re.return=ie,re):(re=w(re,oe.children||[]),re.return=ie,re)}function fe(ie,re,oe,me,Ae){return re===null||re.tag!==7?(re=ai(oe,ie.mode,me,Ae),re.return=ie,re):(re=w(re,oe),re.return=ie,re)}function xe(ie,re,oe){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return re=vc(""+re,ie.mode,oe),re.return=ie,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case S:return oe=co(re.type,re.key,re.props,null,ie.mode,oe),Ks(oe,re),oe.return=ie,oe;case E:return re=bc(re,ie.mode,oe),re.return=ie,re;case T:return re=di(re),xe(ie,re,oe)}if(W(re)||K(re))return re=ai(re,ie.mode,oe,null),re.return=ie,re;if(typeof re.then=="function")return xe(ie,xo(re),oe);if(re.$$typeof===y)return xe(ie,fo(ie,re),oe);vo(ie,re)}return null}function ce(ie,re,oe,me){var Ae=re!==null?re.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Ae!==null?null:$(ie,re,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return oe.key===Ae?J(ie,re,oe,me):null;case E:return oe.key===Ae?le(ie,re,oe,me):null;case T:return oe=di(oe),ce(ie,re,oe,me)}if(W(oe)||K(oe))return Ae!==null?null:fe(ie,re,oe,me,null);if(typeof oe.then=="function")return ce(ie,re,xo(oe),me);if(oe.$$typeof===y)return ce(ie,re,fo(ie,oe),me);vo(ie,oe)}return null}function ue(ie,re,oe,me,Ae){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,$(re,ie,""+me,Ae);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return ie=ie.get(me.key===null?oe:me.key)||null,J(re,ie,me,Ae);case E:return ie=ie.get(me.key===null?oe:me.key)||null,le(re,ie,me,Ae);case T:return me=di(me),ue(ie,re,oe,me,Ae)}if(W(me)||K(me))return ie=ie.get(oe)||null,fe(re,ie,me,Ae,null);if(typeof me.then=="function")return ue(ie,re,oe,xo(me),Ae);if(me.$$typeof===y)return ue(ie,re,oe,fo(re,me),Ae);vo(re,me)}return null}function ke(ie,re,oe,me){for(var Ae=null,rt=null,Ne=re,Ue=re=0,Xe=null;Ne!==null&&Ue<oe.length;Ue++){Ne.index>Ue?(Xe=Ne,Ne=null):Xe=Ne.sibling;var it=ce(ie,Ne,oe[Ue],me);if(it===null){Ne===null&&(Ne=Xe);break}t&&Ne&&it.alternate===null&&n(ie,Ne),re=k(it,re,Ue),rt===null?Ae=it:rt.sibling=it,rt=it,Ne=Xe}if(Ue===oe.length)return a(ie,Ne),et&&lr(ie,Ue),Ae;if(Ne===null){for(;Ue<oe.length;Ue++)Ne=xe(ie,oe[Ue],me),Ne!==null&&(re=k(Ne,re,Ue),rt===null?Ae=Ne:rt.sibling=Ne,rt=Ne);return et&&lr(ie,Ue),Ae}for(Ne=u(Ne);Ue<oe.length;Ue++)Xe=ue(Ne,ie,Ue,oe[Ue],me),Xe!==null&&(t&&Xe.alternate!==null&&Ne.delete(Xe.key===null?Ue:Xe.key),re=k(Xe,re,Ue),rt===null?Ae=Xe:rt.sibling=Xe,rt=Xe);return t&&Ne.forEach(function(Yr){return n(ie,Yr)}),et&&lr(ie,Ue),Ae}function Oe(ie,re,oe,me){if(oe==null)throw Error(s(151));for(var Ae=null,rt=null,Ne=re,Ue=re=0,Xe=null,it=oe.next();Ne!==null&&!it.done;Ue++,it=oe.next()){Ne.index>Ue?(Xe=Ne,Ne=null):Xe=Ne.sibling;var Yr=ce(ie,Ne,it.value,me);if(Yr===null){Ne===null&&(Ne=Xe);break}t&&Ne&&Yr.alternate===null&&n(ie,Ne),re=k(Yr,re,Ue),rt===null?Ae=Yr:rt.sibling=Yr,rt=Yr,Ne=Xe}if(it.done)return a(ie,Ne),et&&lr(ie,Ue),Ae;if(Ne===null){for(;!it.done;Ue++,it=oe.next())it=xe(ie,it.value,me),it!==null&&(re=k(it,re,Ue),rt===null?Ae=it:rt.sibling=it,rt=it);return et&&lr(ie,Ue),Ae}for(Ne=u(Ne);!it.done;Ue++,it=oe.next())it=ue(Ne,ie,Ue,it.value,me),it!==null&&(t&&it.alternate!==null&&Ne.delete(it.key===null?Ue:it.key),re=k(it,re,Ue),rt===null?Ae=it:rt.sibling=it,rt=it);return t&&Ne.forEach(function($_){return n(ie,$_)}),et&&lr(ie,Ue),Ae}function gt(ie,re,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:e:{for(var Ae=oe.key;re!==null;){if(re.key===Ae){if(Ae=oe.type,Ae===C){if(re.tag===7){a(ie,re.sibling),me=w(re,oe.props.children),me.return=ie,ie=me;break e}}else if(re.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===T&&di(Ae)===re.type){a(ie,re.sibling),me=w(re,oe.props),Ks(me,oe),me.return=ie,ie=me;break e}a(ie,re);break}else n(ie,re);re=re.sibling}oe.type===C?(me=ai(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=co(oe.type,oe.key,oe.props,null,ie.mode,me),Ks(me,oe),me.return=ie,ie=me)}return M(ie);case E:e:{for(Ae=oe.key;re!==null;){if(re.key===Ae)if(re.tag===4&&re.stateNode.containerInfo===oe.containerInfo&&re.stateNode.implementation===oe.implementation){a(ie,re.sibling),me=w(re,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,re);break}else n(ie,re);re=re.sibling}me=bc(oe,ie.mode,me),me.return=ie,ie=me}return M(ie);case T:return oe=di(oe),gt(ie,re,oe,me)}if(W(oe))return ke(ie,re,oe,me);if(K(oe)){if(Ae=K(oe),typeof Ae!="function")throw Error(s(150));return oe=Ae.call(oe),Oe(ie,re,oe,me)}if(typeof oe.then=="function")return gt(ie,re,xo(oe),me);if(oe.$$typeof===y)return gt(ie,re,fo(ie,oe),me);vo(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,re!==null&&re.tag===6?(a(ie,re.sibling),me=w(re,oe),me.return=ie,ie=me):(a(ie,re),me=vc(oe,ie.mode,me),me.return=ie,ie=me),M(ie)):a(ie,re)}return function(ie,re,oe,me){try{Ys=0;var Ae=gt(ie,re,oe,me);return Ji=null,Ae}catch(Ne){if(Ne===Qi||Ne===mo)throw Ne;var rt=yn(29,Ne,null,ie.mode);return rt.lanes=me,rt.return=ie,rt}finally{}}}var fi=np(!0),rp=np(!1),Dr=!1;function Dc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rc(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 Rr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Lr(t,n,a){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(ot&2)!==0){var w=u.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),u.pending=n,n=lo(t),Pf(t,null,a),n}return oo(t,u,n,a),lo(t)}function Xs(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Vh(t,a)}}function Lc(t,n){var a=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=M:k=k.next=M,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:u.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:u.shared,callbacks:u.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Mc=!1;function Zs(){if(Mc){var t=Zi;if(t!==null)throw t}}function Qs(t,n,a,u){Mc=!1;var w=t.updateQueue;Dr=!1;var k=w.firstBaseUpdate,M=w.lastBaseUpdate,$=w.shared.pending;if($!==null){w.shared.pending=null;var J=$,le=J.next;J.next=null,M===null?k=le:M.next=le,M=J;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,$=fe.lastBaseUpdate,$!==M&&($===null?fe.firstBaseUpdate=le:$.next=le,fe.lastBaseUpdate=J))}if(k!==null){var xe=w.baseState;M=0,fe=le=J=null,$=k;do{var ce=$.lane&-536870913,ue=ce!==$.lane;if(ue?(Ke&ce)===ce:(u&ce)===ce){ce!==0&&ce===Xi&&(Mc=!0),fe!==null&&(fe=fe.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var ke=t,Oe=$;ce=n;var gt=a;switch(Oe.tag){case 1:if(ke=Oe.payload,typeof ke=="function"){xe=ke.call(gt,xe,ce);break e}xe=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Oe.payload,ce=typeof ke=="function"?ke.call(gt,xe,ce):ke,ce==null)break e;xe=p({},xe,ce);break e;case 2:Dr=!0}}ce=$.callback,ce!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=w.callbacks,ue===null?w.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:$.tag,payload:$.payload,callback:$.callback,next:null},fe===null?(le=fe=ue,J=xe):fe=fe.next=ue,M|=ce;if($=$.next,$===null){if($=w.shared.pending,$===null)break;ue=$,$=ue.next,ue.next=null,w.lastBaseUpdate=ue,w.shared.pending=null}}while(!0);fe===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=fe,k===null&&(w.shared.lanes=0),zr|=M,t.lanes=M,t.memoizedState=xe}}function ip(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function sp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)ip(a[t],n)}var es=B(null),bo=B(0);function ap(t,n){t=br,P(bo,t),P(es,n),br=t|n.baseLanes}function Oc(){P(bo,br),P(es,es.current)}function Bc(){br=bo.current,U(es),U(bo)}var _n=B(null),zn=null;function Mr(t){var n=t.alternate;P(Nt,Nt.current&1),P(_n,t),zn===null&&(n===null||es.current!==null||n.memoizedState!==null)&&(zn=t)}function Ic(t){P(Nt,Nt.current),P(_n,t),zn===null&&(zn=t)}function op(t){t.tag===22?(P(Nt,Nt.current),P(_n,t),zn===null&&(zn=t)):Or()}function Or(){P(Nt,Nt.current),P(_n,_n.current)}function Sn(t){U(_n),zn===t&&(zn=null),U(Nt)}var Nt=B(0);function yo(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||$u(a)||qu(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 dr=0,Fe=null,pt=null,Lt=null,_o=!1,ts=!1,pi=!1,So=0,Js=0,ns=null,Ly=0;function Et(){throw Error(s(321))}function zc(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!bn(t[a],n[a]))return!1;return!0}function Hc(t,n,a,u,w,k){return dr=k,Fe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,V.H=t===null||t.memoizedState===null?qp:eu,pi=!1,k=a(u,w),pi=!1,ts&&(k=cp(n,a,u,w)),lp(t),k}function lp(t){V.H=na;var n=pt!==null&&pt.next!==null;if(dr=0,Lt=pt=Fe=null,_o=!1,Js=0,ns=null,n)throw Error(s(300));t===null||Mt||(t=t.dependencies,t!==null&&ho(t)&&(Mt=!0))}function cp(t,n,a,u){Fe=t;var w=0;do{if(ts&&(ns=null),Js=0,ts=!1,25<=w)throw Error(s(301));if(w+=1,Lt=pt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}V.H=Wp,k=n(a,u)}while(ts);return k}function My(){var t=V.H,n=t.useState()[0];return n=typeof n.then=="function"?ea(n):n,t=t.useState()[0],(pt!==null?pt.memoizedState:null)!==t&&(Fe.flags|=1024),n}function Pc(){var t=So!==0;return So=0,t}function Fc(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function Uc(t){if(_o){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}_o=!1}dr=0,Lt=pt=Fe=null,ts=!1,Js=So=0,ns=null}function sn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?Fe.memoizedState=Lt=t:Lt=Lt.next=t,Lt}function Tt(){if(pt===null){var t=Fe.alternate;t=t!==null?t.memoizedState:null}else t=pt.next;var n=Lt===null?Fe.memoizedState:Lt.next;if(n!==null)Lt=n,pt=t;else{if(t===null)throw Fe.alternate===null?Error(s(467)):Error(s(310));pt=t,t={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Lt===null?Fe.memoizedState=Lt=t:Lt=Lt.next=t}return Lt}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ea(t){var n=Js;return Js+=1,ns===null&&(ns=[]),t=Jf(ns,t,n),n=Fe,(Lt===null?n.memoizedState:Lt.next)===null&&(n=n.alternate,V.H=n===null||n.memoizedState===null?qp:eu),t}function Co(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ea(t);if(t.$$typeof===y)return Yt(t)}throw Error(s(438,String(t)))}function $c(t){var n=null,a=Fe.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var u=Fe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(n={data:u.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=wo(),Fe.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),u=0;u<t;u++)a[u]=H;return n.index++,a}function hr(t,n){return typeof n=="function"?n(t):n}function ko(t){var n=Tt();return qc(n,pt,t)}function qc(t,n,a){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var w=t.baseQueue,k=u.pending;if(k!==null){if(w!==null){var M=w.next;w.next=k.next,k.next=M}n.baseQueue=w=k,u.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var $=M=null,J=null,le=n,fe=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(Ke&xe)===xe:(dr&xe)===xe){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===Xi&&(fe=!0);else if((dr&ce)===ce){le=le.next,ce===Xi&&(fe=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?($=J=xe,M=k):J=J.next=xe,Fe.lanes|=ce,zr|=ce;xe=le.action,pi&&a(k,xe),k=le.hasEagerState?le.eagerState:a(k,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?($=J=ce,M=k):J=J.next=ce,Fe.lanes|=xe,zr|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?M=k:J.next=$,!bn(k,t.memoizedState)&&(Mt=!0,fe&&(a=Zi,a!==null)))throw a;t.memoizedState=k,t.baseState=M,t.baseQueue=J,u.lastRenderedState=k}return w===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Wc(t){var n=Tt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var u=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do k=t(k,M.action),M=M.next;while(M!==w);bn(k,n.memoizedState)||(Mt=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,u]}function up(t,n,a){var u=Fe,w=Tt(),k=et;if(k){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!bn((pt||w).memoizedState,a);if(M&&(w.memoizedState=a,Mt=!0),w=w.queue,Yc(fp.bind(null,u,w,t),[t]),w.getSnapshot!==n||M||Lt!==null&&Lt.memoizedState.tag&1){if(u.flags|=2048,rs(9,{destroy:void 0},hp.bind(null,u,w,a,n),null),vt===null)throw Error(s(349));k||(dr&127)!==0||dp(u,n,a)}return a}function dp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Fe.updateQueue,n===null?(n=wo(),Fe.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function hp(t,n,a,u){n.value=a,n.getSnapshot=u,pp(n)&&mp(t)}function fp(t,n,a){return a(function(){pp(n)&&mp(t)})}function pp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!bn(t,a)}catch{return!0}}function mp(t){var n=si(t,2);n!==null&&pn(n,t,2)}function Gc(t){var n=sn();if(typeof t=="function"){var a=t;if(t=a(),pi){yt(!0);try{a()}finally{yt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:t},n}function gp(t,n,a,u){return t.baseState=a,qc(t,pt,typeof u=="function"?u:hr)}function Oy(t,n,a,u,w){if(No(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(M){k.listeners.push(M)}};V.T!==null?a(!0):k.isTransition=!1,u(k),a=n.pending,a===null?(k.next=n.pending=k,xp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function xp(t,n){var a=n.action,u=n.payload,w=t.state;if(n.isTransition){var k=V.T,M={};V.T=M;try{var $=a(w,u),J=V.S;J!==null&&J(M,$),vp(t,n,$)}catch(le){Vc(t,n,le)}finally{k!==null&&M.types!==null&&(k.types=M.types),V.T=k}}else try{k=a(w,u),vp(t,n,k)}catch(le){Vc(t,n,le)}}function vp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){bp(t,n,u)},function(u){return Vc(t,n,u)}):bp(t,n,a)}function bp(t,n,a){n.status="fulfilled",n.value=a,yp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,xp(t,a)))}function Vc(t,n,a){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do n.status="rejected",n.reason=a,yp(n),n=n.next;while(n!==u)}t.action=null}function yp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function _p(t,n){return n}function Sp(t,n){if(et){var a=vt.formState;if(a!==null){e:{var u=Fe;if(et){if(St){t:{for(var w=St,k=In;w.nodeType!==8;){if(!k){w=null;break t}if(w=Hn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){St=Hn(w.nextSibling),u=w.data==="F!";break e}}Tr(u)}u=!1}u&&(n=a[0])}}return a=sn(),a.memoizedState=a.baseState=n,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_p,lastRenderedState:n},a.queue=u,a=Fp.bind(null,Fe,u),u.dispatch=a,u=Gc(!1),k=Jc.bind(null,Fe,!1,u.queue),u=sn(),w={state:n,dispatch:null,action:t,pending:null},u.queue=w,a=Oy.bind(null,Fe,w,k,a),w.dispatch=a,u.memoizedState=t,[n,a,!1]}function wp(t){var n=Tt();return Cp(n,pt,t)}function Cp(t,n,a){if(n=qc(t,n,_p)[0],t=ko(hr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var u=ea(n)}catch(M){throw M===Qi?mo:M}else u=n;n=Tt();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Fe.flags|=2048,rs(9,{destroy:void 0},By.bind(null,w,a),null)),[u,k,t]}function By(t,n){t.action=n}function kp(t){var n=Tt(),a=pt;if(a!==null)return Cp(n,a,t);Tt(),n=n.memoizedState,a=Tt();var u=a.queue.dispatch;return a.memoizedState=t,[n,u,!1]}function rs(t,n,a,u){return t={tag:t,create:a,deps:u,inst:n,next:null},n=Fe.updateQueue,n===null&&(n=wo(),Fe.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(u=a.next,a.next=t,t.next=u,n.lastEffect=t),t}function Ep(){return Tt().memoizedState}function Eo(t,n,a,u){var w=sn();Fe.flags|=t,w.memoizedState=rs(1|n,{destroy:void 0},a,u===void 0?null:u)}function jo(t,n,a,u){var w=Tt();u=u===void 0?null:u;var k=w.memoizedState.inst;pt!==null&&u!==null&&zc(u,pt.memoizedState.deps)?w.memoizedState=rs(n,k,a,u):(Fe.flags|=t,w.memoizedState=rs(1|n,k,a,u))}function jp(t,n){Eo(8390656,8,t,n)}function Yc(t,n){jo(2048,8,t,n)}function Iy(t){Fe.flags|=4;var n=Fe.updateQueue;if(n===null)n=wo(),Fe.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Np(t){var n=Tt().memoizedState;return Iy({ref:n,nextImpl:t}),function(){if((ot&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Tp(t,n){return jo(4,2,t,n)}function Ap(t,n){return jo(4,4,t,n)}function Dp(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 Rp(t,n,a){a=a!=null?a.concat([t]):null,jo(4,4,Dp.bind(null,n,t),a)}function Kc(){}function Lp(t,n){var a=Tt();n=n===void 0?null:n;var u=a.memoizedState;return n!==null&&zc(n,u[1])?u[0]:(a.memoizedState=[t,n],t)}function Mp(t,n){var a=Tt();n=n===void 0?null:n;var u=a.memoizedState;if(n!==null&&zc(n,u[1]))return u[0];if(u=t(),pi){yt(!0);try{t()}finally{yt(!1)}}return a.memoizedState=[u,n],u}function Xc(t,n,a){return a===void 0||(dr&1073741824)!==0&&(Ke&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Om(),Fe.lanes|=t,zr|=t,a)}function Op(t,n,a,u){return bn(a,n)?a:es.current!==null?(t=Xc(t,a,u),bn(t,n)||(Mt=!0),t):(dr&42)===0||(dr&1073741824)!==0&&(Ke&261930)===0?(Mt=!0,t.memoizedState=a):(t=Om(),Fe.lanes|=t,zr|=t,n)}function Bp(t,n,a,u,w){var k=Q.p;Q.p=k!==0&&8>k?k:8;var M=V.T,$={};V.T=$,Jc(t,!1,n,a);try{var J=w(),le=V.S;if(le!==null&&le($,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var fe=Ry(J,u);ta(t,n,fe,kn(t))}else ta(t,n,u,kn(t))}catch(xe){ta(t,n,{then:function(){},status:"rejected",reason:xe},kn())}finally{Q.p=k,M!==null&&$.types!==null&&(M.types=$.types),V.T=M}}function zy(){}function Zc(t,n,a,u){if(t.tag!==5)throw Error(s(476));var w=Ip(t).queue;Bp(t,w,n,te,a===null?zy:function(){return zp(t),a(u)})}function Ip(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:te},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function zp(t){var n=Ip(t);n.next===null&&(n=t.alternate.memoizedState),ta(t,n.next.queue,{},kn())}function Qc(){return Yt(va)}function Hp(){return Tt().memoizedState}function Pp(){return Tt().memoizedState}function Hy(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=kn();t=Rr(a);var u=Lr(n,t,a);u!==null&&(pn(u,n,a),Xs(u,n,a)),n={cache:jc()},t.payload=n;return}n=n.return}}function Py(t,n,a){var u=kn();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},No(t)?Up(n,a):(a=gc(t,n,a,u),a!==null&&(pn(a,t,u),$p(a,n,u)))}function Fp(t,n,a){var u=kn();ta(t,n,a,u)}function ta(t,n,a,u){var w={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(No(t))Up(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var M=n.lastRenderedState,$=k(M,a);if(w.hasEagerState=!0,w.eagerState=$,bn($,M))return oo(t,n,w,0),vt===null&&ao(),!1}catch{}finally{}if(a=gc(t,n,w,u),a!==null)return pn(a,t,u),$p(a,n,u),!0}return!1}function Jc(t,n,a,u){if(u={lane:2,revertLane:Du(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},No(t)){if(n)throw Error(s(479))}else n=gc(t,a,u,2),n!==null&&pn(n,t,2)}function No(t){var n=t.alternate;return t===Fe||n!==null&&n===Fe}function Up(t,n){ts=_o=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function $p(t,n,a){if((a&4194048)!==0){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Vh(t,a)}}var na={readContext:Yt,use:Co,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};na.useEffectEvent=Et;var qp={readContext:Yt,use:Co,useCallback:function(t,n){return sn().memoizedState=[t,n===void 0?null:n],t},useContext:Yt,useEffect:jp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Eo(4194308,4,Dp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Eo(4194308,4,t,n)},useInsertionEffect:function(t,n){Eo(4,2,t,n)},useMemo:function(t,n){var a=sn();n=n===void 0?null:n;var u=t();if(pi){yt(!0);try{t()}finally{yt(!1)}}return a.memoizedState=[u,n],u},useReducer:function(t,n,a){var u=sn();if(a!==void 0){var w=a(n);if(pi){yt(!0);try{a(n)}finally{yt(!1)}}}else w=n;return u.memoizedState=u.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},u.queue=t,t=t.dispatch=Py.bind(null,Fe,t),[u.memoizedState,t]},useRef:function(t){var n=sn();return t={current:t},n.memoizedState=t},useState:function(t){t=Gc(t);var n=t.queue,a=Fp.bind(null,Fe,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Kc,useDeferredValue:function(t,n){var a=sn();return Xc(a,t,n)},useTransition:function(){var t=Gc(!1);return t=Bp.bind(null,Fe,t.queue,!0,!1),sn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var u=Fe,w=sn();if(et){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(Ke&127)!==0||dp(u,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,jp(fp.bind(null,u,k,t),[t]),u.flags|=2048,rs(9,{destroy:void 0},hp.bind(null,u,k,a,n),null),a},useId:function(){var t=sn(),n=vt.identifierPrefix;if(et){var a=Xn,u=Kn;a=(u&~(1<<32-nt(u)-1)).toString(32)+a,n="_"+n+"R_"+a,a=So++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Ly++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:Qc,useFormState:Sp,useActionState:Sp,useOptimistic:function(t){var n=sn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Jc.bind(null,Fe,!0,a),a.dispatch=n,[t,n]},useMemoCache:$c,useCacheRefresh:function(){return sn().memoizedState=Hy.bind(null,Fe)},useEffectEvent:function(t){var n=sn(),a={impl:t};return n.memoizedState=a,function(){if((ot&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},eu={readContext:Yt,use:Co,useCallback:Lp,useContext:Yt,useEffect:Yc,useImperativeHandle:Rp,useInsertionEffect:Tp,useLayoutEffect:Ap,useMemo:Mp,useReducer:ko,useRef:Ep,useState:function(){return ko(hr)},useDebugValue:Kc,useDeferredValue:function(t,n){var a=Tt();return Op(a,pt.memoizedState,t,n)},useTransition:function(){var t=ko(hr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:ea(t),n]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:Qc,useFormState:wp,useActionState:wp,useOptimistic:function(t,n){var a=Tt();return gp(a,pt,t,n)},useMemoCache:$c,useCacheRefresh:Pp};eu.useEffectEvent=Np;var Wp={readContext:Yt,use:Co,useCallback:Lp,useContext:Yt,useEffect:Yc,useImperativeHandle:Rp,useInsertionEffect:Tp,useLayoutEffect:Ap,useMemo:Mp,useReducer:Wc,useRef:Ep,useState:function(){return Wc(hr)},useDebugValue:Kc,useDeferredValue:function(t,n){var a=Tt();return pt===null?Xc(a,t,n):Op(a,pt.memoizedState,t,n)},useTransition:function(){var t=Wc(hr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:ea(t),n]},useSyncExternalStore:up,useId:Hp,useHostTransitionStatus:Qc,useFormState:kp,useActionState:kp,useOptimistic:function(t,n){var a=Tt();return pt!==null?gp(a,pt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:$c,useCacheRefresh:Pp};Wp.useEffectEvent=Np;function tu(t,n,a,u){n=t.memoizedState,a=a(u,n),a=a==null?n:p({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var nu={enqueueSetState:function(t,n,a){t=t._reactInternals;var u=kn(),w=Rr(u);w.payload=n,a!=null&&(w.callback=a),n=Lr(t,w,u),n!==null&&(pn(n,t,u),Xs(n,t,u))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var u=kn(),w=Rr(u);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Lr(t,w,u),n!==null&&(pn(n,t,u),Xs(n,t,u))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=kn(),u=Rr(a);u.tag=2,n!=null&&(u.callback=n),n=Lr(t,u,a),n!==null&&(pn(n,t,a),Xs(n,t,a))}};function Gp(t,n,a,u,w,k,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,k,M):n.prototype&&n.prototype.isPureReactComponent?!Us(a,u)||!Us(w,k):!0}function Vp(t,n,a,u){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,u),n.state!==t&&nu.enqueueReplaceState(n,n.state,null)}function mi(t,n){var a=n;if("ref"in n){a={};for(var u in n)u!=="ref"&&(a[u]=n[u])}if(t=t.defaultProps){a===n&&(a=p({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function Yp(t){so(t)}function Kp(t){console.error(t)}function Xp(t){so(t)}function To(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(u){setTimeout(function(){throw u})}}function Zp(t,n,a){try{var u=t.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function ru(t,n,a){return a=Rr(a),a.tag=3,a.payload={element:null},a.callback=function(){To(t,n)},a}function Qp(t){return t=Rr(t),t.tag=3,t}function Jp(t,n,a,u){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=u.value;t.payload=function(){return w(k)},t.callback=function(){Zp(n,a,u)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){Zp(n,a,u),typeof w!="function"&&(Hr===null?Hr=new Set([this]):Hr.add(this));var $=u.stack;this.componentDidCatch(u.value,{componentStack:$!==null?$:""})})}function Fy(t,n,a,u,w){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(n=a.alternate,n!==null&&Ki(n,a,w,!0),a=_n.current,a!==null){switch(a.tag){case 31:case 13:return zn===null?Fo():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,u===go?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([u]):n.add(u),Nu(t,u,w)),!1;case 22:return a.flags|=65536,u===go?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([u]):a.add(u)),Nu(t,u,w)),!1}throw Error(s(435,a.tag))}return Nu(t,u,w),Fo(),!1}if(et)return n=_n.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,u!==Sc&&(t=Error(s(422),{cause:u}),Ws(Mn(t,a)))):(u!==Sc&&(n=Error(s(423),{cause:u}),Ws(Mn(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,u=Mn(u,a),w=ru(t.stateNode,u,w),Lc(t,w),jt!==4&&(jt=2)),!1;var k=Error(s(520),{cause:u});if(k=Mn(k,a),ua===null?ua=[k]:ua.push(k),jt!==4&&(jt=2),n===null)return!0;u=Mn(u,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=ru(a.stateNode,u,t),Lc(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"&&(Hr===null||!Hr.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=Qp(w),Jp(w,t,a,u),Lc(a,w),!1}a=a.return}while(a!==null);return!1}var iu=Error(s(461)),Mt=!1;function Kt(t,n,a,u){n.child=t===null?rp(n,null,a,u):fi(n,t.child,a,u)}function em(t,n,a,u,w){a=a.render;var k=n.ref;if("ref"in u){var M={};for(var $ in u)$!=="ref"&&(M[$]=u[$])}else M=u;return ci(n),u=Hc(t,n,a,M,k,w),$=Pc(),t!==null&&!Mt?(Fc(t,n,w),fr(t,n,w)):(et&&$&&yc(n),n.flags|=1,Kt(t,n,u,w),n.child)}function tm(t,n,a,u,w){if(t===null){var k=a.type;return typeof k=="function"&&!xc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,nm(t,n,k,u,w)):(t=co(a.type,null,u,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!hu(t,w)){var M=k.memoizedProps;if(a=a.compare,a=a!==null?a:Us,a(M,u)&&t.ref===n.ref)return fr(t,n,w)}return n.flags|=1,t=or(k,u),t.ref=n.ref,t.return=n,n.child=t}function nm(t,n,a,u,w){if(t!==null){var k=t.memoizedProps;if(Us(k,u)&&t.ref===n.ref)if(Mt=!1,n.pendingProps=u=k,hu(t,w))(t.flags&131072)!==0&&(Mt=!0);else return n.lanes=t.lanes,fr(t,n,w)}return su(t,n,a,u,w)}function rm(t,n,a,u){var w=u.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(u=n.child=t.child,w=0;u!==null;)w=w|u.lanes|u.childLanes,u=u.sibling;u=w&~k}else u=0,n.child=null;return im(t,n,k,a,u)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&po(n,k!==null?k.cachePool:null),k!==null?ap(n,k):Oc(),op(n);else return u=n.lanes=536870912,im(t,n,k!==null?k.baseLanes|a:a,a,u)}else k!==null?(po(n,k.cachePool),ap(n,k),Or(),n.memoizedState=null):(t!==null&&po(n,null),Oc(),Or());return Kt(t,n,w,a),n.child}function ra(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function im(t,n,a,u,w){var k=Tc();return k=k===null?null:{parent:Rt._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&po(n,null),Oc(),op(n),t!==null&&Ki(t,n,u,!0),n.childLanes=w,null}function Ao(t,n){return n=Ro({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function sm(t,n,a){return fi(n,t.child,null,a),t=Ao(n,n.pendingProps),t.flags|=2,Sn(n),n.memoizedState=null,t}function Uy(t,n,a){var u=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(et){if(u.mode==="hidden")return t=Ao(n,u),n.lanes=536870912,ra(null,t);if(Ic(n),(t=St)?(t=xg(t,In),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:jr!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Uf(t),a.return=n,n.child=a,Vt=n,St=null)):t=null,t===null)throw Tr(n);return n.lanes=536870912,null}return Ao(n,u)}var k=t.memoizedState;if(k!==null){var M=k.dehydrated;if(Ic(n),w)if(n.flags&256)n.flags&=-257,n=sm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Mt||Ki(t,n,a,!1),w=(a&t.childLanes)!==0,Mt||w){if(u=vt,u!==null&&(M=Yh(u,a),M!==0&&M!==k.retryLane))throw k.retryLane=M,si(t,M),pn(u,t,M),iu;Fo(),n=sm(t,n,a)}else t=k.treeContext,St=Hn(M.nextSibling),Vt=n,et=!0,Nr=null,In=!1,t!==null&&Wf(n,t),n=Ao(n,u),n.flags|=4096;return n}return t=or(t.child,{mode:u.mode,children:u.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Do(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function su(t,n,a,u,w){return ci(n),a=Hc(t,n,a,u,void 0,w),u=Pc(),t!==null&&!Mt?(Fc(t,n,w),fr(t,n,w)):(et&&u&&yc(n),n.flags|=1,Kt(t,n,a,w),n.child)}function am(t,n,a,u,w,k){return ci(n),n.updateQueue=null,a=cp(n,u,a,w),lp(t),u=Pc(),t!==null&&!Mt?(Fc(t,n,k),fr(t,n,k)):(et&&u&&yc(n),n.flags|=1,Kt(t,n,a,k),n.child)}function om(t,n,a,u,w){if(ci(n),n.stateNode===null){var k=Wi,M=a.contextType;typeof M=="object"&&M!==null&&(k=Yt(M)),k=new a(u,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=nu,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=u,k.state=n.memoizedState,k.refs={},Dc(n),M=a.contextType,k.context=typeof M=="object"&&M!==null?Yt(M):Wi,k.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(tu(n,a,M,u),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(M=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),M!==k.state&&nu.enqueueReplaceState(k,k.state,null),Qs(n,u,k,w),Zs(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!0}else if(t===null){k=n.stateNode;var $=n.memoizedProps,J=mi(a,$);k.props=J;var le=k.context,fe=a.contextType;M=Wi,typeof fe=="object"&&fe!==null&&(M=Yt(fe));var xe=a.getDerivedStateFromProps;fe=typeof xe=="function"||typeof k.getSnapshotBeforeUpdate=="function",$=n.pendingProps!==$,fe||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||($||le!==M)&&Vp(n,k,u,M),Dr=!1;var ce=n.memoizedState;k.state=ce,Qs(n,u,k,w),Zs(),le=n.memoizedState,$||ce!==le||Dr?(typeof xe=="function"&&(tu(n,a,xe,u),le=n.memoizedState),(J=Dr||Gp(n,a,J,u,ce,le,M))?(fe||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=u,n.memoizedState=le),k.props=u,k.state=le,k.context=M,u=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{k=n.stateNode,Rc(t,n),M=n.memoizedProps,fe=mi(a,M),k.props=fe,xe=n.pendingProps,ce=k.context,le=a.contextType,J=Wi,typeof le=="object"&&le!==null&&(J=Yt(le)),$=a.getDerivedStateFromProps,(le=typeof $=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(M!==xe||ce!==J)&&Vp(n,k,u,J),Dr=!1,ce=n.memoizedState,k.state=ce,Qs(n,u,k,w),Zs();var ue=n.memoizedState;M!==xe||ce!==ue||Dr||t!==null&&t.dependencies!==null&&ho(t.dependencies)?(typeof $=="function"&&(tu(n,a,$,u),ue=n.memoizedState),(fe=Dr||Gp(n,a,fe,u,ce,ue,J)||t!==null&&t.dependencies!==null&&ho(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(u,ue,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(u,ue,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=ue),k.props=u,k.state=ue,k.context=J,u=fe):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),u=!1)}return k=u,Do(t,n),u=(n.flags&128)!==0,k||u?(k=n.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&u?(n.child=fi(n,t.child,null,w),n.child=fi(n,null,a,w)):Kt(t,n,a,w),n.memoizedState=k.state,t=n.child):t=fr(t,n,w),t}function lm(t,n,a,u){return oi(),n.flags|=256,Kt(t,n,a,u),n.child}var au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ou(t){return{baseLanes:t,cachePool:Zf()}}function lu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=Cn),t}function cm(t,n,a){var u=n.pendingProps,w=!1,k=(n.flags&128)!==0,M;if((M=k)||(M=t!==null&&t.memoizedState===null?!1:(Nt.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(et){if(w?Mr(n):Or(),(t=St)?(t=xg(t,In),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:jr!==null?{id:Kn,overflow:Xn}:null,retryLane:536870912,hydrationErrors:null},a=Uf(t),a.return=n,n.child=a,Vt=n,St=null)):t=null,t===null)throw Tr(n);return qu(t)?n.lanes=32:n.lanes=536870912,null}var $=u.children;return u=u.fallback,w?(Or(),w=n.mode,$=Ro({mode:"hidden",children:$},w),u=ai(u,w,a,null),$.return=n,u.return=n,$.sibling=u,n.child=$,u=n.child,u.memoizedState=ou(a),u.childLanes=lu(t,M,a),n.memoizedState=au,ra(null,u)):(Mr(n),cu(n,$))}var J=t.memoizedState;if(J!==null&&($=J.dehydrated,$!==null)){if(k)n.flags&256?(Mr(n),n.flags&=-257,n=uu(t,n,a)):n.memoizedState!==null?(Or(),n.child=t.child,n.flags|=128,n=null):(Or(),$=u.fallback,w=n.mode,u=Ro({mode:"visible",children:u.children},w),$=ai($,w,a,null),$.flags|=2,u.return=n,$.return=n,u.sibling=$,n.child=u,fi(n,t.child,null,a),u=n.child,u.memoizedState=ou(a),u.childLanes=lu(t,M,a),n.memoizedState=au,n=ra(null,u));else if(Mr(n),qu($)){if(M=$.nextSibling&&$.nextSibling.dataset,M)var le=M.dgst;M=le,u=Error(s(419)),u.stack="",u.digest=M,Ws({value:u,source:null,stack:null}),n=uu(t,n,a)}else if(Mt||Ki(t,n,a,!1),M=(a&t.childLanes)!==0,Mt||M){if(M=vt,M!==null&&(u=Yh(M,a),u!==0&&u!==J.retryLane))throw J.retryLane=u,si(t,u),pn(M,t,u),iu;$u($)||Fo(),n=uu(t,n,a)}else $u($)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,St=Hn($.nextSibling),Vt=n,et=!0,Nr=null,In=!1,t!==null&&Wf(n,t),n=cu(n,u.children),n.flags|=4096);return n}return w?(Or(),$=u.fallback,w=n.mode,J=t.child,le=J.sibling,u=or(J,{mode:"hidden",children:u.children}),u.subtreeFlags=J.subtreeFlags&65011712,le!==null?$=or(le,$):($=ai($,w,a,null),$.flags|=2),$.return=n,u.return=n,u.sibling=$,n.child=u,ra(null,u),u=n.child,$=t.child.memoizedState,$===null?$=ou(a):(w=$.cachePool,w!==null?(J=Rt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=Zf(),$={baseLanes:$.baseLanes|a,cachePool:w}),u.memoizedState=$,u.childLanes=lu(t,M,a),n.memoizedState=au,ra(t.child,u)):(Mr(n),a=t.child,t=a.sibling,a=or(a,{mode:"visible",children:u.children}),a.return=n,a.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=a,n.memoizedState=null,a)}function cu(t,n){return n=Ro({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Ro(t,n){return t=yn(22,t,null,n),t.lanes=0,t}function uu(t,n,a){return fi(n,t.child,null,a),t=cu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function um(t,n,a){t.lanes|=n;var u=t.alternate;u!==null&&(u.lanes|=n),kc(t.return,n,a)}function du(t,n,a,u,w,k){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:w,treeForkCount:k}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=u,M.tail=a,M.tailMode=w,M.treeForkCount=k)}function dm(t,n,a){var u=n.pendingProps,w=u.revealOrder,k=u.tail;u=u.children;var M=Nt.current,$=(M&2)!==0;if($?(M=M&1|2,n.flags|=128):M&=1,P(Nt,M),Kt(t,n,u,a),u=et?qs:0,!$&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&um(t,a,n);else if(t.tag===19)um(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&&yo(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),du(n,!1,w,a,k,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&yo(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}du(n,!0,a,null,k,u);break;case"together":du(n,!1,null,null,void 0,u);break;default:n.memoizedState=null}return n.child}function fr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),zr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Ki(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=or(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=or(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function hu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&ho(t)))}function $y(t,n,a){switch(n.tag){case 3:z(n,n.stateNode.containerInfo),Ar(n,Rt,t.memoizedState.cache),oi();break;case 27:case 5:se(n);break;case 4:z(n,n.stateNode.containerInfo);break;case 10:Ar(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Ic(n),null;break;case 13:var u=n.memoizedState;if(u!==null)return u.dehydrated!==null?(Mr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?cm(t,n,a):(Mr(n),t=fr(t,n,a),t!==null?t.sibling:null);Mr(n);break;case 19:var w=(t.flags&128)!==0;if(u=(a&n.childLanes)!==0,u||(Ki(t,n,a,!1),u=(a&n.childLanes)!==0),w){if(u)return dm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),P(Nt,Nt.current),u)break;return null;case 22:return n.lanes=0,rm(t,n,a,n.pendingProps);case 24:Ar(n,Rt,t.memoizedState.cache)}return fr(t,n,a)}function hm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Mt=!0;else{if(!hu(t,a)&&(n.flags&128)===0)return Mt=!1,$y(t,n,a);Mt=(t.flags&131072)!==0}else Mt=!1,et&&(n.flags&1048576)!==0&&qf(n,qs,n.index);switch(n.lanes=0,n.tag){case 16:e:{var u=n.pendingProps;if(t=di(n.elementType),n.type=t,typeof t=="function")xc(t)?(u=mi(t,u),n.tag=1,n=om(null,n,t,u,a)):(n.tag=0,n=su(null,n,t,u,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=em(null,n,t,u,a);break e}else if(w===R){n.tag=14,n=tm(null,n,t,u,a);break e}}throw n=O(t)||t,Error(s(306,n,""))}}return n;case 0:return su(t,n,n.type,n.pendingProps,a);case 1:return u=n.type,w=mi(u,n.pendingProps),om(t,n,u,w,a);case 3:e:{if(z(n,n.stateNode.containerInfo),t===null)throw Error(s(387));u=n.pendingProps;var k=n.memoizedState;w=k.element,Rc(t,n),Qs(n,u,null,a);var M=n.memoizedState;if(u=M.cache,Ar(n,Rt,u),u!==k.cache&&Ec(n,[Rt],a,!0),Zs(),u=M.element,k.isDehydrated)if(k={element:u,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=lm(t,n,u,a);break e}else if(u!==w){w=Mn(Error(s(424)),n),Ws(w),n=lm(t,n,u,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(St=Hn(t.firstChild),Vt=n,et=!0,Nr=null,In=!0,a=rp(n,null,u,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(oi(),u===w){n=fr(t,n,a);break e}Kt(t,n,u,a)}n=n.child}return n;case 26:return Do(t,n),t===null?(a=wg(n.type,null,n.pendingProps,null))?n.memoizedState=a:et||(a=n.type,t=n.pendingProps,u=Yo(Z.current).createElement(a),u[Gt]=n,u[ln]=t,Xt(u,a,t),Pt(u),n.stateNode=u):n.memoizedState=wg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return se(n),t===null&&et&&(u=n.stateNode=yg(n.type,n.pendingProps,Z.current),Vt=n,In=!0,w=St,$r(n.type)?(Wu=w,St=Hn(u.firstChild)):St=w),Kt(t,n,n.pendingProps.children,a),Do(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&et&&((w=u=St)&&(u=b_(u,n.type,n.pendingProps,In),u!==null?(n.stateNode=u,Vt=n,St=Hn(u.firstChild),In=!1,w=!0):w=!1),w||Tr(n)),se(n),w=n.type,k=n.pendingProps,M=t!==null?t.memoizedProps:null,u=k.children,Pu(w,k)?u=null:M!==null&&Pu(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=Hc(t,n,My,null,null,a),va._currentValue=w),Do(t,n),Kt(t,n,u,a),n.child;case 6:return t===null&&et&&((t=a=St)&&(a=y_(a,n.pendingProps,In),a!==null?(n.stateNode=a,Vt=n,St=null,t=!0):t=!1),t||Tr(n)),null;case 13:return cm(t,n,a);case 4:return z(n,n.stateNode.containerInfo),u=n.pendingProps,t===null?n.child=fi(n,null,u,a):Kt(t,n,u,a),n.child;case 11:return em(t,n,n.type,n.pendingProps,a);case 7:return Kt(t,n,n.pendingProps,a),n.child;case 8:return Kt(t,n,n.pendingProps.children,a),n.child;case 12:return Kt(t,n,n.pendingProps.children,a),n.child;case 10:return u=n.pendingProps,Ar(n,n.type,u.value),Kt(t,n,u.children,a),n.child;case 9:return w=n.type._context,u=n.pendingProps.children,ci(n),w=Yt(w),u=u(w),n.flags|=1,Kt(t,n,u,a),n.child;case 14:return tm(t,n,n.type,n.pendingProps,a);case 15:return nm(t,n,n.type,n.pendingProps,a);case 19:return dm(t,n,a);case 31:return Uy(t,n,a);case 22:return rm(t,n,a,n.pendingProps);case 24:return ci(n),u=Yt(Rt),t===null?(w=Tc(),w===null&&(w=vt,k=jc(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:u,cache:w},Dc(n),Ar(n,Rt,w)):((t.lanes&a)!==0&&(Rc(t,n),Qs(n,null,null,a),Zs()),w=t.memoizedState,k=n.memoizedState,w.parent!==u?(w={parent:u,cache:u},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Ar(n,Rt,u)):(u=k.cache,Ar(n,Rt,u),u!==w.cache&&Ec(n,[Rt],a,!0))),Kt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function pr(t){t.flags|=4}function fu(t,n,a,u,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(Hm())t.flags|=8192;else throw hi=go,Ac}else t.flags&=-16777217}function fm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ng(n))if(Hm())t.flags|=8192;else throw hi=go,Ac}function Lo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?$l():536870912,t.lanes|=n,os|=n)}function ia(t,n){if(!et)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 u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function wt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,u=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags&65011712,u|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags,u|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=u,t.childLanes=a,n}function qy(t,n,a){var u=n.pendingProps;switch(_c(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(n),null;case 1:return wt(n),null;case 3:return a=n.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),n.memoizedState.cache!==u&&(n.flags|=2048),ur(Rt),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Yi(n)?pr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,wc())),wt(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(pr(n),k!==null?(wt(n),fm(n,k)):(wt(n),fu(n,w,null,u,a))):k?k!==t.memoizedState?(pr(n),wt(n),fm(n,k)):(wt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==u&&pr(n),wt(n),fu(n,w,t,u,a)),null;case 27:if(ge(n),a=Z.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&pr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}t=Y.current,Yi(n)?Gf(n):(t=yg(w,u,a),n.stateNode=t,pr(n))}return wt(n),null;case 5:if(ge(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&pr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}if(k=Y.current,Yi(n))Gf(n);else{var M=Yo(Z.current);switch(k){case 1:k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=M.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof u.is=="string"?M.createElement("select",{is:u.is}):M.createElement("select"),u.multiple?k.multiple=!0:u.size&&(k.size=u.size);break;default:k=typeof u.is=="string"?M.createElement(w,{is:u.is}):M.createElement(w)}}k[Gt]=n,k[ln]=u;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)k.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===n)break e;for(;M.sibling===null;){if(M.return===null||M.return===n)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}n.stateNode=k;e:switch(Xt(k,w,u),w){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&pr(n)}}return wt(n),fu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==u&&pr(n);else{if(typeof u!="string"&&n.stateNode===null)throw Error(s(166));if(t=Z.current,Yi(n)){if(t=n.stateNode,a=n.memoizedProps,u=null,w=Vt,w!==null)switch(w.tag){case 27:case 5:u=w.memoizedProps}t[Gt]=n,t=!!(t.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||cg(t.nodeValue,a)),t||Tr(n,!0)}else t=Yo(t).createTextNode(u),t[Gt]=n,n.stateNode=t}return wt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(u=Yi(n),a!==null){if(t===null){if(!u)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Gt]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),t=!1}else a=wc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Sn(n),n):(Sn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return wt(n),null;case 13:if(u=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=Yi(n),u!==null&&u.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[Gt]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),w=!1}else w=wc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(Sn(n),n):(Sn(n),null)}return Sn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=u!==null,t=t!==null&&t.memoizedState!==null,a&&(u=n.child,w=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(w=u.alternate.memoizedState.cachePool.pool),k=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(k=u.memoizedState.cachePool.pool),k!==w&&(u.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Lo(n,n.updateQueue),wt(n),null);case 4:return ae(),t===null&&Ou(n.stateNode.containerInfo),wt(n),null;case 10:return ur(n.type),wt(n),null;case 19:if(U(Nt),u=n.memoizedState,u===null)return wt(n),null;if(w=(n.flags&128)!==0,k=u.rendering,k===null)if(w)ia(u,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=yo(t),k!==null){for(n.flags|=128,ia(u,!1),t=k.updateQueue,n.updateQueue=t,Lo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)Ff(a,t),a=a.sibling;return P(Nt,Nt.current&1|2),et&&lr(n,u.treeForkCount),n.child}t=t.sibling}u.tail!==null&&qe()>zo&&(n.flags|=128,w=!0,ia(u,!1),n.lanes=4194304)}else{if(!w)if(t=yo(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Lo(n,t),ia(u,!0),u.tail===null&&u.tailMode==="hidden"&&!k.alternate&&!et)return wt(n),null}else 2*qe()-u.renderingStartTime>zo&&a!==536870912&&(n.flags|=128,w=!0,ia(u,!1),n.lanes=4194304);u.isBackwards?(k.sibling=n.child,n.child=k):(t=u.last,t!==null?t.sibling=k:n.child=k,u.last=k)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=qe(),t.sibling=null,a=Nt.current,P(Nt,w?a&1|2:a&1),et&&lr(n,u.treeForkCount),t):(wt(n),null);case 22:case 23:return Sn(n),Bc(),u=n.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(n.flags|=8192):u&&(n.flags|=8192),u?(a&536870912)!==0&&(n.flags&128)===0&&(wt(n),n.subtreeFlags&6&&(n.flags|=8192)):wt(n),a=n.updateQueue,a!==null&&Lo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048),t!==null&&U(ui),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),ur(Rt),wt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Wy(t,n){switch(_c(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ur(Rt),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ge(n),null;case 31:if(n.memoizedState!==null){if(Sn(n),n.alternate===null)throw Error(s(340));oi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Sn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));oi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return U(Nt),null;case 4:return ae(),null;case 10:return ur(n.type),null;case 22:case 23:return Sn(n),Bc(),t!==null&&U(ui),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return ur(Rt),null;case 25:return null;default:return null}}function pm(t,n){switch(_c(n),n.tag){case 3:ur(Rt),ae();break;case 26:case 27:case 5:ge(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&Sn(n);break;case 13:Sn(n);break;case 19:U(Nt);break;case 10:ur(n.type);break;case 22:case 23:Sn(n),Bc(),t!==null&&U(ui);break;case 24:ur(Rt)}}function sa(t,n){try{var a=n.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var w=u.next;a=w;do{if((a.tag&t)===t){u=void 0;var k=a.create,M=a.inst;u=k(),M.destroy=u}a=a.next}while(a!==w)}}catch($){ht(n,n.return,$)}}function Br(t,n,a){try{var u=n.updateQueue,w=u!==null?u.lastEffect:null;if(w!==null){var k=w.next;u=k;do{if((u.tag&t)===t){var M=u.inst,$=M.destroy;if($!==void 0){M.destroy=void 0,w=n;var J=a,le=$;try{le()}catch(fe){ht(w,J,fe)}}}u=u.next}while(u!==k)}}catch(fe){ht(n,n.return,fe)}}function mm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{sp(n,a)}catch(u){ht(t,t.return,u)}}}function gm(t,n,a){a.props=mi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(u){ht(t,n,u)}}function aa(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof a=="function"?t.refCleanup=a(u):a.current=u}}catch(w){ht(t,n,w)}}function Zn(t,n){var a=t.ref,u=t.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(w){ht(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){ht(t,n,w)}else a.current=null}function xm(t){var n=t.type,a=t.memoizedProps,u=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(w){ht(t,t.return,w)}}function pu(t,n,a){try{var u=t.stateNode;f_(u,t.type,a,n),u[ln]=n}catch(w){ht(t,t.return,w)}}function vm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&$r(t.type)||t.tag===4}function mu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||vm(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&&$r(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 gu(t,n,a){var u=t.tag;if(u===5||u===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=sr));else if(u!==4&&(u===27&&$r(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(gu(t,n,a),t=t.sibling;t!==null;)gu(t,n,a),t=t.sibling}function Mo(t,n,a){var u=t.tag;if(u===5||u===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(u!==4&&(u===27&&$r(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Mo(t,n,a),t=t.sibling;t!==null;)Mo(t,n,a),t=t.sibling}function bm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var u=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);Xt(n,u,a),n[Gt]=t,n[ln]=a}catch(k){ht(t,t.return,k)}}var mr=!1,Ot=!1,xu=!1,ym=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Gy(t,n){if(t=t.containerInfo,zu=tl,t=Rf(t),uc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var w=u.anchorOffset,k=u.focusNode;u=u.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var M=0,$=-1,J=-1,le=0,fe=0,xe=t,ce=null;t:for(;;){for(var ue;xe!==a||w!==0&&xe.nodeType!==3||($=M+w),xe!==k||u!==0&&xe.nodeType!==3||(J=M+u),xe.nodeType===3&&(M+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)ce=xe,xe=ue;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&($=M),ce===k&&++fe===u&&(J=M),(ue=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=ue}a=$===-1||J===-1?null:{start:$,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(Hu={focusedElem:t,selectionRange:a},tl=!1,Ft=n;Ft!==null;)if(n=Ft,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Ft=t;else for(;Ft!==null;){switch(n=Ft,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,u=a.stateNode;try{var ke=mi(a.type,w);t=u.getSnapshotBeforeUpdate(ke,k),u.__reactInternalSnapshotBeforeUpdate=t}catch(Oe){ht(a,a.return,Oe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)Uu(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Uu(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,Ft=t;break}Ft=n.return}}function _m(t,n,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:xr(t,a),u&4&&sa(5,a);break;case 1:if(xr(t,a),u&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){ht(a,a.return,M)}else{var w=mi(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){ht(a,a.return,M)}}u&64&&mm(a),u&512&&aa(a,a.return);break;case 3:if(xr(t,a),u&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{sp(t,n)}catch(M){ht(a,a.return,M)}}break;case 27:n===null&&u&4&&bm(a);case 26:case 5:xr(t,a),n===null&&u&4&&xm(a),u&512&&aa(a,a.return);break;case 12:xr(t,a);break;case 31:xr(t,a),u&4&&Cm(t,a);break;case 13:xr(t,a),u&4&&km(t,a),u&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=t_.bind(null,a),__(t,a))));break;case 22:if(u=a.memoizedState!==null||mr,!u){n=n!==null&&n.memoizedState!==null||Ot,w=mr;var k=Ot;mr=u,(Ot=n)&&!k?vr(t,a,(a.subtreeFlags&8772)!==0):xr(t,a),mr=w,Ot=k}break;case 30:break;default:xr(t,a)}}function Sm(t){var n=t.alternate;n!==null&&(t.alternate=null,Sm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Vl(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 Ct=null,un=!1;function gr(t,n,a){for(a=a.child;a!==null;)wm(t,n,a),a=a.sibling}function wm(t,n,a){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(ct,a)}catch{}switch(a.tag){case 26:Ot||Zn(a,n),gr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ot||Zn(a,n);var u=Ct,w=un;$r(a.type)&&(Ct=a.stateNode,un=!1),gr(t,n,a),ma(a.stateNode),Ct=u,un=w;break;case 5:Ot||Zn(a,n);case 6:if(u=Ct,w=un,Ct=null,gr(t,n,a),Ct=u,un=w,Ct!==null)if(un)try{(Ct.nodeType===9?Ct.body:Ct.nodeName==="HTML"?Ct.ownerDocument.body:Ct).removeChild(a.stateNode)}catch(k){ht(a,n,k)}else try{Ct.removeChild(a.stateNode)}catch(k){ht(a,n,k)}break;case 18:Ct!==null&&(un?(t=Ct,mg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ms(t)):mg(Ct,a.stateNode));break;case 4:u=Ct,w=un,Ct=a.stateNode.containerInfo,un=!0,gr(t,n,a),Ct=u,un=w;break;case 0:case 11:case 14:case 15:Br(2,a,n),Ot||Br(4,a,n),gr(t,n,a);break;case 1:Ot||(Zn(a,n),u=a.stateNode,typeof u.componentWillUnmount=="function"&&gm(a,n,u)),gr(t,n,a);break;case 21:gr(t,n,a);break;case 22:Ot=(u=Ot)||a.memoizedState!==null,gr(t,n,a),Ot=u;break;default:gr(t,n,a)}}function Cm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ms(t)}catch(a){ht(n,n.return,a)}}}function km(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ms(t)}catch(a){ht(n,n.return,a)}}function Vy(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new ym),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new ym),n;default:throw Error(s(435,t.tag))}}function Oo(t,n){var a=Vy(t);n.forEach(function(u){if(!a.has(u)){a.add(u);var w=n_.bind(null,t,u);u.then(w,w)}})}function dn(t,n){var a=n.deletions;if(a!==null)for(var u=0;u<a.length;u++){var w=a[u],k=t,M=n,$=M;e:for(;$!==null;){switch($.tag){case 27:if($r($.type)){Ct=$.stateNode,un=!1;break e}break;case 5:Ct=$.stateNode,un=!1;break e;case 3:case 4:Ct=$.stateNode.containerInfo,un=!0;break e}$=$.return}if(Ct===null)throw Error(s(160));wm(k,M,w),Ct=null,un=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Em(n,t),n=n.sibling}var $n=null;function Em(t,n){var a=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:dn(n,t),hn(t),u&4&&(Br(3,t,t.return),sa(3,t),Br(5,t,t.return));break;case 1:dn(n,t),hn(t),u&512&&(Ot||a===null||Zn(a,a.return)),u&64&&mr&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var w=$n;if(dn(n,t),hn(t),u&512&&(Ot||a===null||Zn(a,a.return)),u&4){var k=a!==null?a.memoizedState:null;if(u=t.memoizedState,a===null)if(u===null)if(t.stateNode===null){e:{u=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(u){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Ls]||k[Gt]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(u),w.head.insertBefore(k,w.querySelector("head > title"))),Xt(k,u,a),k[Gt]=t,Pt(k),u=k;break e;case"link":var M=Eg("link","href",w).get(u+(a.href||""));if(M){for(var $=0;$<M.length;$++)if(k=M[$],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)){M.splice($,1);break t}}k=w.createElement(u),Xt(k,u,a),w.head.appendChild(k);break;case"meta":if(M=Eg("meta","content",w).get(u+(a.content||""))){for($=0;$<M.length;$++)if(k=M[$],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)){M.splice($,1);break t}}k=w.createElement(u),Xt(k,u,a),w.head.appendChild(k);break;default:throw Error(s(468,u))}k[Gt]=t,Pt(k),u=k}t.stateNode=u}else jg(w,t.type,t.stateNode);else t.stateNode=kg(w,u,t.memoizedProps);else k!==u?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,u===null?jg(w,t.type,t.stateNode):kg(w,u,t.memoizedProps)):u===null&&t.stateNode!==null&&pu(t,t.memoizedProps,a.memoizedProps)}break;case 27:dn(n,t),hn(t),u&512&&(Ot||a===null||Zn(a,a.return)),a!==null&&u&4&&pu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(dn(n,t),hn(t),u&512&&(Ot||a===null||Zn(a,a.return)),t.flags&32){w=t.stateNode;try{zi(w,"")}catch(ke){ht(t,t.return,ke)}}u&4&&t.stateNode!=null&&(w=t.memoizedProps,pu(t,w,a!==null?a.memoizedProps:w)),u&1024&&(xu=!0);break;case 6:if(dn(n,t),hn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,a=t.stateNode;try{a.nodeValue=u}catch(ke){ht(t,t.return,ke)}}break;case 3:if(Zo=null,w=$n,$n=Ko(n.containerInfo),dn(n,t),$n=w,hn(t),u&4&&a!==null&&a.memoizedState.isDehydrated)try{ms(n.containerInfo)}catch(ke){ht(t,t.return,ke)}xu&&(xu=!1,jm(t));break;case 4:u=$n,$n=Ko(t.stateNode.containerInfo),dn(n,t),hn(t),$n=u;break;case 12:dn(n,t),hn(t);break;case 31:dn(n,t),hn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Oo(t,u)));break;case 13:dn(n,t),hn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Io=qe()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Oo(t,u)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=mr,fe=Ot;if(mr=le||w,Ot=fe||J,dn(n,t),Ot=fe,mr=le,hn(t),u&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||mr||Ot||gi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)M=k.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{$=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;$.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(ke){ht(J,J.return,ke)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(ke){ht(J,J.return,ke)}}}else if(n.tag===18){if(a===null){J=n;try{var ue=J.stateNode;w?gg(ue,!0):gg(J.stateNode,!1)}catch(ke){ht(J,J.return,ke)}}}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}u&4&&(u=t.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Oo(t,a))));break;case 19:dn(n,t),hn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Oo(t,u)));break;case 30:break;case 21:break;default:dn(n,t),hn(t)}}function hn(t){var n=t.flags;if(n&2){try{for(var a,u=t.return;u!==null;){if(vm(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=mu(t);Mo(t,k,w);break;case 5:var M=a.stateNode;a.flags&32&&(zi(M,""),a.flags&=-33);var $=mu(t);Mo(t,$,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=mu(t);gu(t,le,J);break;default:throw Error(s(161))}}catch(fe){ht(t,t.return,fe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function jm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;jm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function xr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)_m(t,n.alternate,n),n=n.sibling}function gi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Br(4,n,n.return),gi(n);break;case 1:Zn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&gm(n,n.return,a),gi(n);break;case 27:ma(n.stateNode);case 26:case 5:Zn(n,n.return),gi(n);break;case 22:n.memoizedState===null&&gi(n);break;case 30:gi(n);break;default:gi(n)}t=t.sibling}}function vr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var u=n.alternate,w=t,k=n,M=k.flags;switch(k.tag){case 0:case 11:case 15:vr(w,k,a),sa(4,k);break;case 1:if(vr(w,k,a),u=k,w=u.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ht(u,u.return,le)}if(u=k,w=u.updateQueue,w!==null){var $=u.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)ip(J[w],$)}catch(le){ht(u,u.return,le)}}a&&M&64&&mm(k),aa(k,k.return);break;case 27:bm(k);case 26:case 5:vr(w,k,a),a&&u===null&&M&4&&xm(k),aa(k,k.return);break;case 12:vr(w,k,a);break;case 31:vr(w,k,a),a&&M&4&&Cm(w,k);break;case 13:vr(w,k,a),a&&M&4&&km(w,k);break;case 22:k.memoizedState===null&&vr(w,k,a),aa(k,k.return);break;case 30:break;default:vr(w,k,a)}n=n.sibling}}function vu(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&&Gs(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&&Gs(t))}function qn(t,n,a,u){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Nm(t,n,a,u),n=n.sibling}function Nm(t,n,a,u){var w=n.flags;switch(n.tag){case 0:case 11:case 15:qn(t,n,a,u),w&2048&&sa(9,n);break;case 1:qn(t,n,a,u);break;case 3:qn(t,n,a,u),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Gs(t)));break;case 12:if(w&2048){qn(t,n,a,u),t=n.stateNode;try{var k=n.memoizedProps,M=k.id,$=k.onPostCommit;typeof $=="function"&&$(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ht(n,n.return,J)}}else qn(t,n,a,u);break;case 31:qn(t,n,a,u);break;case 13:qn(t,n,a,u);break;case 23:break;case 22:k=n.stateNode,M=n.alternate,n.memoizedState!==null?k._visibility&2?qn(t,n,a,u):oa(t,n):k._visibility&2?qn(t,n,a,u):(k._visibility|=2,is(t,n,a,u,(n.subtreeFlags&10256)!==0||!1)),w&2048&&vu(M,n);break;case 24:qn(t,n,a,u),w&2048&&bu(n.alternate,n);break;default:qn(t,n,a,u)}}function is(t,n,a,u,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,M=n,$=a,J=u,le=M.flags;switch(M.tag){case 0:case 11:case 15:is(k,M,$,J,w),sa(8,M);break;case 23:break;case 22:var fe=M.stateNode;M.memoizedState!==null?fe._visibility&2?is(k,M,$,J,w):oa(k,M):(fe._visibility|=2,is(k,M,$,J,w)),w&&le&2048&&vu(M.alternate,M);break;case 24:is(k,M,$,J,w),w&&le&2048&&bu(M.alternate,M);break;default:is(k,M,$,J,w)}n=n.sibling}}function oa(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,u=n,w=u.flags;switch(u.tag){case 22:oa(a,u),w&2048&&vu(u.alternate,u);break;case 24:oa(a,u),w&2048&&bu(u.alternate,u);break;default:oa(a,u)}n=n.sibling}}var la=8192;function ss(t,n,a){if(t.subtreeFlags&la)for(t=t.child;t!==null;)Tm(t,n,a),t=t.sibling}function Tm(t,n,a){switch(t.tag){case 26:ss(t,n,a),t.flags&la&&t.memoizedState!==null&&L_(a,$n,t.memoizedState,t.memoizedProps);break;case 5:ss(t,n,a);break;case 3:case 4:var u=$n;$n=Ko(t.stateNode.containerInfo),ss(t,n,a),$n=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=la,la=16777216,ss(t,n,a),la=u):ss(t,n,a));break;default:ss(t,n,a)}}function Am(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 ca(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Ft=u,Rm(u,t)}Am(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dm(t),t=t.sibling}function Dm(t){switch(t.tag){case 0:case 11:case 15:ca(t),t.flags&2048&&Br(9,t,t.return);break;case 3:ca(t);break;case 12:ca(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Bo(t)):ca(t);break;default:ca(t)}}function Bo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Ft=u,Rm(u,t)}Am(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Br(8,n,n.return),Bo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Bo(n));break;default:Bo(n)}t=t.sibling}}function Rm(t,n){for(;Ft!==null;){var a=Ft;switch(a.tag){case 0:case 11:case 15:Br(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Gs(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,Ft=u;else e:for(a=t;Ft!==null;){u=Ft;var w=u.sibling,k=u.return;if(Sm(u),u===a){Ft=null;break e}if(w!==null){w.return=k,Ft=w;break e}Ft=k}}}var Yy={getCacheForType:function(t){var n=Yt(Rt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Yt(Rt).controller.signal}},Ky=typeof WeakMap=="function"?WeakMap:Map,ot=0,vt=null,Ge=null,Ke=0,dt=0,wn=null,Ir=!1,as=!1,yu=!1,br=0,jt=0,zr=0,xi=0,_u=0,Cn=0,os=0,ua=null,fn=null,Su=!1,Io=0,Lm=0,zo=1/0,Ho=null,Hr=null,zt=0,Pr=null,ls=null,yr=0,wu=0,Cu=null,Mm=null,da=0,ku=null;function kn(){return(ot&2)!==0&&Ke!==0?Ke&-Ke:V.T!==null?Du():Kh()}function Om(){if(Cn===0)if((Ke&536870912)===0||et){var t=We;We<<=1,(We&3932160)===0&&(We=262144),Cn=t}else Cn=536870912;return t=_n.current,t!==null&&(t.flags|=32),Cn}function pn(t,n,a){(t===vt&&(dt===2||dt===9)||t.cancelPendingCommit!==null)&&(cs(t,0),Fr(t,Ke,Cn,!1)),Rs(t,a),((ot&2)===0||t!==vt)&&(t===vt&&((ot&2)===0&&(xi|=a),jt===4&&Fr(t,Ke,Cn,!1)),Qn(t))}function Bm(t,n,a){if((ot&6)!==0)throw Error(s(327));var u=!a&&(n&127)===0&&(n&t.expiredLanes)===0||kt(t,n),w=u?Qy(t,n):ju(t,n,!0),k=u;do{if(w===0){as&&!u&&Fr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!Xy(a)){w=ju(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var $=t;w=ua;var J=$.current.memoizedState.isDehydrated;if(J&&(cs($,M).flags|=256),M=ju($,M,!1),M!==2){if(yu&&!J){$.errorRecoveryDisabledLanes|=k,xi|=k,w=4;break e}k=fn,fn=w,k!==null&&(fn===null?fn=k:fn.push.apply(fn,k))}w=M}if(k=!1,w!==2)continue}}if(w===1){cs(t,0),Fr(t,n,0,!0);break}e:{switch(u=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Fr(u,n,Cn,!Ir);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Io+300-qe(),10<w)){if(Fr(u,n,Cn,!Ir),Dt(u,0,!0)!==0)break e;yr=n,u.timeoutHandle=fg(Im.bind(null,u,a,fn,Ho,Su,n,Cn,xi,os,Ir,k,"Throttled",-0,0),w);break e}Im(u,a,fn,Ho,Su,n,Cn,xi,os,Ir,k,null,-0,0)}}break}while(!0);Qn(t)}function Im(t,n,a,u,w,k,M,$,J,le,fe,xe,ce,ue){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sr},Tm(n,k,xe);var ke=(k&62914560)===k?Io-qe():(k&4194048)===k?Lm-qe():0;if(ke=M_(xe,ke),ke!==null){yr=k,t.cancelPendingCommit=ke(Wm.bind(null,t,n,k,a,u,w,M,$,J,fe,xe,null,ce,ue)),Fr(t,k,M,!le);return}}Wm(t,n,k,a,u,w,M,$,J)}function Xy(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 u=0;u<a.length;u++){var w=a[u],k=w.getSnapshot;w=w.value;try{if(!bn(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 Fr(t,n,a,u){n&=~_u,n&=~xi,t.suspendedLanes|=n,t.pingedLanes&=~n,u&&(t.warmLanes|=n),u=t.expirationTimes;for(var w=n;0<w;){var k=31-nt(w),M=1<<k;u[k]=-1,w&=~M}a!==0&&Gh(t,a,n)}function Po(){return(ot&6)===0?(ha(0),!1):!0}function Eu(){if(Ge!==null){if(dt===0)var t=Ge.return;else t=Ge,cr=li=null,Uc(t),Ji=null,Ys=0,t=Ge;for(;t!==null;)pm(t.alternate,t),t=t.return;Ge=null}}function cs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,g_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),yr=0,Eu(),vt=t,Ge=a=or(t.current,null),Ke=n,dt=0,wn=null,Ir=!1,as=kt(t,n),yu=!1,os=Cn=_u=xi=zr=jt=0,fn=ua=null,Su=!1,(n&8)!==0&&(n|=n&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=n;0<u;){var w=31-nt(u),k=1<<w;n|=t[w],u&=~k}return br=n,ao(),a}function zm(t,n){Fe=null,V.H=na,n===Qi||n===mo?(n=ep(),dt=3):n===Ac?(n=ep(),dt=4):dt=n===iu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,wn=n,Ge===null&&(jt=1,To(t,Mn(n,t.current)))}function Hm(){var t=_n.current;return t===null?!0:(Ke&4194048)===Ke?zn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?t===zn:!1}function Pm(){var t=V.H;return V.H=na,t===null?na:t}function Fm(){var t=V.A;return V.A=Yy,t}function Fo(){jt=4,Ir||(Ke&4194048)!==Ke&&_n.current!==null||(as=!0),(zr&134217727)===0&&(xi&134217727)===0||vt===null||Fr(vt,Ke,Cn,!1)}function ju(t,n,a){var u=ot;ot|=2;var w=Pm(),k=Fm();(vt!==t||Ke!==n)&&(Ho=null,cs(t,n)),n=!1;var M=jt;e:do try{if(dt!==0&&Ge!==null){var $=Ge,J=wn;switch(dt){case 8:Eu(),M=6;break e;case 3:case 2:case 9:case 6:_n.current===null&&(n=!0);var le=dt;if(dt=0,wn=null,us(t,$,J,le),a&&as){M=0;break e}break;default:le=dt,dt=0,wn=null,us(t,$,J,le)}}Zy(),M=jt;break}catch(fe){zm(t,fe)}while(!0);return n&&t.shellSuspendCounter++,cr=li=null,ot=u,V.H=w,V.A=k,Ge===null&&(vt=null,Ke=0,ao()),M}function Zy(){for(;Ge!==null;)Um(Ge)}function Qy(t,n){var a=ot;ot|=2;var u=Pm(),w=Fm();vt!==t||Ke!==n?(Ho=null,zo=qe()+500,cs(t,n)):as=kt(t,n);e:do try{if(dt!==0&&Ge!==null){n=Ge;var k=wn;t:switch(dt){case 1:dt=0,wn=null,us(t,n,k,1);break;case 2:case 9:if(Qf(k)){dt=0,wn=null,$m(n);break}n=function(){dt!==2&&dt!==9||vt!==t||(dt=7),Qn(t)},k.then(n,n);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:Qf(k)?(dt=0,wn=null,$m(n)):(dt=0,wn=null,us(t,n,k,7));break;case 5:var M=null;switch(Ge.tag){case 26:M=Ge.memoizedState;case 5:case 27:var $=Ge;if(M?Ng(M):$.stateNode.complete){dt=0,wn=null;var J=$.sibling;if(J!==null)Ge=J;else{var le=$.return;le!==null?(Ge=le,Uo(le)):Ge=null}break t}}dt=0,wn=null,us(t,n,k,5);break;case 6:dt=0,wn=null,us(t,n,k,6);break;case 8:Eu(),jt=6;break e;default:throw Error(s(462))}}Jy();break}catch(fe){zm(t,fe)}while(!0);return cr=li=null,V.H=u,V.A=w,ot=a,Ge!==null?0:(vt=null,Ke=0,ao(),jt)}function Jy(){for(;Ge!==null&&!Ze();)Um(Ge)}function Um(t){var n=hm(t.alternate,t,br);t.memoizedProps=t.pendingProps,n===null?Uo(t):Ge=n}function $m(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=am(a,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=am(a,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Uc(n);default:pm(a,n),n=Ge=Ff(n,br),n=hm(a,n,br)}t.memoizedProps=t.pendingProps,n===null?Uo(t):Ge=n}function us(t,n,a,u){cr=li=null,Uc(n),Ji=null,Ys=0;var w=n.return;try{if(Fy(t,w,n,a,Ke)){jt=1,To(t,Mn(a,t.current)),Ge=null;return}}catch(k){if(w!==null)throw Ge=w,k;jt=1,To(t,Mn(a,t.current)),Ge=null;return}n.flags&32768?(et||u===1?t=!0:as||(Ke&536870912)!==0?t=!1:(Ir=t=!0,(u===2||u===9||u===3||u===6)&&(u=_n.current,u!==null&&u.tag===13&&(u.flags|=16384))),qm(n,t)):Uo(n)}function Uo(t){var n=t;do{if((n.flags&32768)!==0){qm(n,Ir);return}t=n.return;var a=qy(n.alternate,n,br);if(a!==null){Ge=a;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=t}while(n!==null);jt===0&&(jt=5)}function qm(t,n){do{var a=Wy(t.alternate,t);if(a!==null){a.flags&=32767,Ge=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Ge=t;return}Ge=t=a}while(t!==null);jt=6,Ge=null}function Wm(t,n,a,u,w,k,M,$,J){t.cancelPendingCommit=null;do $o();while(zt!==0);if((ot&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(k=n.lanes|n.childLanes,k|=mc,Rb(t,a,k,M,$,J),t===vt&&(Ge=vt=null,Ke=0),ls=n,Pr=t,yr=a,wu=k,Cu=w,Mm=u,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,r_(ve,function(){return Xm(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,w=Q.p,Q.p=2,M=ot,ot|=4;try{Gy(t,n,a)}finally{ot=M,Q.p=w,V.T=u}}zt=1,Gm(),Vm(),Ym()}}function Gm(){if(zt===1){zt=0;var t=Pr,n=ls,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var w=ot;ot|=4;try{Em(n,t);var k=Hu,M=Rf(t.containerInfo),$=k.focusedElem,J=k.selectionRange;if(M!==$&&$&&$.ownerDocument&&Df($.ownerDocument.documentElement,$)){if(J!==null&&uc($)){var le=J.start,fe=J.end;if(fe===void 0&&(fe=le),"selectionStart"in $)$.selectionStart=le,$.selectionEnd=Math.min(fe,$.value.length);else{var xe=$.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),ke=$.textContent.length,Oe=Math.min(J.start,ke),gt=J.end===void 0?Oe:Math.min(J.end,ke);!ue.extend&&Oe>gt&&(M=gt,gt=Oe,Oe=M);var ie=Af($,Oe),re=Af($,gt);if(ie&&re&&(ue.rangeCount!==1||ue.anchorNode!==ie.node||ue.anchorOffset!==ie.offset||ue.focusNode!==re.node||ue.focusOffset!==re.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),ue.removeAllRanges(),Oe>gt?(ue.addRange(oe),ue.extend(re.node,re.offset)):(oe.setEnd(re.node,re.offset),ue.addRange(oe))}}}}for(xe=[],ue=$;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<xe.length;$++){var me=xe[$];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}tl=!!zu,Hu=zu=null}finally{ot=w,Q.p=u,V.T=a}}t.current=n,zt=2}}function Vm(){if(zt===2){zt=0;var t=Pr,n=ls,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var w=ot;ot|=4;try{_m(t,n.alternate,n)}finally{ot=w,Q.p=u,V.T=a}}zt=3}}function Ym(){if(zt===4||zt===3){zt=0,Qe();var t=Pr,n=ls,a=yr,u=Mm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?zt=5:(zt=0,ls=Pr=null,Km(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Hr=null),Wl(a),n=n.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(ct,n,void 0,(n.current.flags&128)===128)}catch{}if(u!==null){n=V.T,w=Q.p,Q.p=2,V.T=null;try{for(var k=t.onRecoverableError,M=0;M<u.length;M++){var $=u[M];k($.value,{componentStack:$.stack})}}finally{V.T=n,Q.p=w}}(yr&3)!==0&&$o(),Qn(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===ku?da++:(da=0,ku=t):da=0,ha(0)}}function Km(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Gs(n)))}function $o(){return Gm(),Vm(),Ym(),Xm()}function Xm(){if(zt!==5)return!1;var t=Pr,n=wu;wu=0;var a=Wl(yr),u=V.T,w=Q.p;try{Q.p=32>a?32:a,V.T=null,a=Cu,Cu=null;var k=Pr,M=yr;if(zt=0,ls=Pr=null,yr=0,(ot&6)!==0)throw Error(s(331));var $=ot;if(ot|=4,Dm(k.current),Nm(k,k.current,M,a),ot=$,ha(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(ct,k)}catch{}return!0}finally{Q.p=w,V.T=u,Km(t,n)}}function Zm(t,n,a){n=Mn(a,n),n=ru(t.stateNode,n,2),t=Lr(t,n,2),t!==null&&(Rs(t,2),Qn(t))}function ht(t,n,a){if(t.tag===3)Zm(t,t,a);else for(;n!==null;){if(n.tag===3){Zm(n,t,a);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Hr===null||!Hr.has(u))){t=Mn(a,t),a=Qp(2),u=Lr(n,a,2),u!==null&&(Jp(a,u,n,t),Rs(u,2),Qn(u));break}}n=n.return}}function Nu(t,n,a){var u=t.pingCache;if(u===null){u=t.pingCache=new Ky;var w=new Set;u.set(n,w)}else w=u.get(n),w===void 0&&(w=new Set,u.set(n,w));w.has(a)||(yu=!0,w.add(a),t=e_.bind(null,t,n,a),n.then(t,t))}function e_(t,n,a){var u=t.pingCache;u!==null&&u.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(Ke&a)===a&&(jt===4||jt===3&&(Ke&62914560)===Ke&&300>qe()-Io?(ot&2)===0&&cs(t,0):_u|=a,os===Ke&&(os=0)),Qn(t)}function Qm(t,n){n===0&&(n=$l()),t=si(t,n),t!==null&&(Rs(t,n),Qn(t))}function t_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),Qm(t,a)}function n_(t,n){var a=0;switch(t.tag){case 31:case 13:var u=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(n),Qm(t,a)}function r_(t,n){return he(t,n)}var qo=null,ds=null,Tu=!1,Wo=!1,Au=!1,Ur=0;function Qn(t){t!==ds&&t.next===null&&(ds===null?qo=ds=t:ds=ds.next=t),Wo=!0,Tu||(Tu=!0,s_())}function ha(t,n){if(!Au&&Wo){Au=!0;do for(var a=!1,u=qo;u!==null;){if(t!==0){var w=u.pendingLanes;if(w===0)var k=0;else{var M=u.suspendedLanes,$=u.pingedLanes;k=(1<<31-nt(42|t)+1)-1,k&=w&~(M&~$),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,ng(u,k))}else k=Ke,k=Dt(u,u===vt?k:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(k&3)===0||kt(u,k)||(a=!0,ng(u,k));u=u.next}while(a);Au=!1}}function i_(){Jm()}function Jm(){Wo=Tu=!1;var t=0;Ur!==0&&m_()&&(t=Ur);for(var n=qe(),a=null,u=qo;u!==null;){var w=u.next,k=eg(u,n);k===0?(u.next=null,a===null?qo=w:a.next=w,w===null&&(ds=a)):(a=u,(t!==0||(k&3)!==0)&&(Wo=!0)),u=w}zt!==0&&zt!==5||ha(t),Ur!==0&&(Ur=0)}function eg(t,n){for(var a=t.suspendedLanes,u=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var M=31-nt(k),$=1<<M,J=w[M];J===-1?(($&a)===0||($&u)!==0)&&(w[M]=Wt($,n)):J<=n&&(t.expiredLanes|=$),k&=~$}if(n=vt,a=Ke,a=Dt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,a===0||t===n&&(dt===2||dt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&De(u),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||kt(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(u!==null&&De(u),Wl(a)){case 2:case 8:a=ee;break;case 32:a=ve;break;case 268435456:a=Ce;break;default:a=ve}return u=tg.bind(null,t),a=he(a,u),t.callbackPriority=n,t.callbackNode=a,n}return u!==null&&u!==null&&De(u),t.callbackPriority=2,t.callbackNode=null,2}function tg(t,n){if(zt!==0&&zt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if($o()&&t.callbackNode!==a)return null;var u=Ke;return u=Dt(t,t===vt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Bm(t,u,n),eg(t,qe()),t.callbackNode!=null&&t.callbackNode===a?tg.bind(null,t):null)}function ng(t,n){if($o())return null;Bm(t,n,!0)}function s_(){x_(function(){(ot&6)!==0?he(de,i_):Jm()})}function Du(){if(Ur===0){var t=Xi;t===0&&(t=Ie,Ie<<=1,(Ie&261888)===0&&(Ie=256)),Ur=t}return Ur}function rg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Qa(""+t)}function ig(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 a_(t,n,a,u,w){if(n==="submit"&&a&&a.stateNode===w){var k=rg((w[ln]||null).action),M=u.submitter;M&&(n=(n=M[ln]||null)?rg(n.formAction):M.getAttribute("formAction"),n!==null&&(k=n,M=null));var $=new no("action","action",null,u,w);t.push({event:$,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Ur!==0){var J=M?ig(w,M):new FormData(w);Zc(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&($.preventDefault(),J=M?ig(w,M):new FormData(w),Zc(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var Ru=0;Ru<pc.length;Ru++){var Lu=pc[Ru],o_=Lu.toLowerCase(),l_=Lu[0].toUpperCase()+Lu.slice(1);Un(o_,"on"+l_)}Un(Of,"onAnimationEnd"),Un(Bf,"onAnimationIteration"),Un(If,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(Cy,"onTransitionRun"),Un(ky,"onTransitionStart"),Un(Ey,"onTransitionCancel"),Un(zf,"onTransitionEnd"),Bi("onMouseEnter",["mouseout","mouseover"]),Bi("onMouseLeave",["mouseout","mouseover"]),Bi("onPointerEnter",["pointerout","pointerover"]),Bi("onPointerLeave",["pointerout","pointerover"]),ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fa="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(" "),c_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fa));function sg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var u=t[a],w=u.event;u=u.listeners;e:{var k=void 0;if(n)for(var M=u.length-1;0<=M;M--){var $=u[M],J=$.instance,le=$.currentTarget;if($=$.listener,J!==k&&w.isPropagationStopped())break e;k=$,w.currentTarget=le;try{k(w)}catch(fe){so(fe)}w.currentTarget=null,k=J}else for(M=0;M<u.length;M++){if($=u[M],J=$.instance,le=$.currentTarget,$=$.listener,J!==k&&w.isPropagationStopped())break e;k=$,w.currentTarget=le;try{k(w)}catch(fe){so(fe)}w.currentTarget=null,k=J}}}}function Ve(t,n){var a=n[Gl];a===void 0&&(a=n[Gl]=new Set);var u=t+"__bubble";a.has(u)||(ag(n,t,2,!1),a.add(u))}function Mu(t,n,a){var u=0;n&&(u|=4),ag(a,t,u,n)}var Go="_reactListening"+Math.random().toString(36).slice(2);function Ou(t){if(!t[Go]){t[Go]=!0,Qh.forEach(function(a){a!=="selectionchange"&&(c_.has(a)||Mu(a,!1,t),Mu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Go]||(n[Go]=!0,Mu("selectionchange",!1,n))}}function ag(t,n,a,u){switch(Og(n)){case 2:var w=I_;break;case 8:w=z_;break;default:w=Xu}a=w.bind(null,n,a,t),w=void 0,!tc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),u?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 Bu(t,n,a,u,w){var k=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var M=u.tag;if(M===3||M===4){var $=u.stateNode.containerInfo;if($===w)break;if(M===4)for(M=u.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;$!==null;){if(M=Li($),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){u=k=M;continue e}$=$.parentNode}}u=u.return}df(function(){var le=k,fe=Jl(a),xe=[];e:{var ce=Hf.get(t);if(ce!==void 0){var ue=no,ke=t;switch(t){case"keypress":if(eo(a)===0)break e;case"keydown":case"keyup":ue=ny;break;case"focusin":ke="focus",ue=sc;break;case"focusout":ke="blur",ue=sc;break;case"beforeblur":case"afterblur":ue=sc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=pf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=qb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=sy;break;case Of:case Bf:case If:ue=Vb;break;case zf:ue=oy;break;case"scroll":case"scrollend":ue=Ub;break;case"wheel":ue=cy;break;case"copy":case"cut":case"paste":ue=Kb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=gf;break;case"toggle":case"beforetoggle":ue=dy}var Oe=(n&4)!==0,gt=!Oe&&(t==="scroll"||t==="scrollend"),ie=Oe?ce!==null?ce+"Capture":null:ce;Oe=[];for(var re=le,oe;re!==null;){var me=re;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Os(re,ie),me!=null&&Oe.push(pa(re,me,oe))),gt)break;re=re.return}0<Oe.length&&(ce=new ue(ce,ke,null,a,fe),xe.push({event:ce,listeners:Oe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",ce&&a!==Ql&&(ke=a.relatedTarget||a.fromElement)&&(Li(ke)||ke[Ri]))break e;if((ue||ce)&&(ce=fe.window===fe?fe:(ce=fe.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(ke=a.relatedTarget||a.toElement,ue=le,ke=ke?Li(ke):null,ke!==null&&(gt=f(ke),Oe=ke.tag,ke!==gt||Oe!==5&&Oe!==27&&Oe!==6)&&(ke=null)):(ue=null,ke=le),ue!==ke)){if(Oe=pf,me="onMouseLeave",ie="onMouseEnter",re="mouse",(t==="pointerout"||t==="pointerover")&&(Oe=gf,me="onPointerLeave",ie="onPointerEnter",re="pointer"),gt=ue==null?ce:Ms(ue),oe=ke==null?ce:Ms(ke),ce=new Oe(me,re+"leave",ue,a,fe),ce.target=gt,ce.relatedTarget=oe,me=null,Li(fe)===le&&(Oe=new Oe(ie,re+"enter",ke,a,fe),Oe.target=oe,Oe.relatedTarget=gt,me=Oe),gt=me,ue&&ke)t:{for(Oe=u_,ie=ue,re=ke,oe=0,me=ie;me;me=Oe(me))oe++;me=0;for(var Ae=re;Ae;Ae=Oe(Ae))me++;for(;0<oe-me;)ie=Oe(ie),oe--;for(;0<me-oe;)re=Oe(re),me--;for(;oe--;){if(ie===re||re!==null&&ie===re.alternate){Oe=ie;break t}ie=Oe(ie),re=Oe(re)}Oe=null}else Oe=null;ue!==null&&og(xe,ce,ue,Oe,!1),ke!==null&&gt!==null&&og(xe,gt,ke,Oe,!0)}}e:{if(ce=le?Ms(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var rt=Cf;else if(Sf(ce))if(kf)rt=_y;else{rt=by;var Ne=vy}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Zl(le.elementType)&&(rt=Cf):rt=yy;if(rt&&(rt=rt(t,le))){wf(xe,rt,a,fe);break e}Ne&&Ne(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&Xl(ce,"number",ce.value)}switch(Ne=le?Ms(le):window,t){case"focusin":(Sf(Ne)||Ne.contentEditable==="true")&&(Ui=Ne,dc=le,$s=null);break;case"focusout":$s=dc=Ui=null;break;case"mousedown":hc=!0;break;case"contextmenu":case"mouseup":case"dragend":hc=!1,Lf(xe,a,fe);break;case"selectionchange":if(wy)break;case"keydown":case"keyup":Lf(xe,a,fe)}var Ue;if(oc)e:{switch(t){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Fi?yf(t,a)&&(Xe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Xe="onCompositionStart");Xe&&(xf&&a.locale!=="ko"&&(Fi||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Fi&&(Ue=hf()):(Er=fe,nc="value"in Er?Er.value:Er.textContent,Fi=!0)),Ne=Vo(le,Xe),0<Ne.length&&(Xe=new mf(Xe,t,null,a,fe),xe.push({event:Xe,listeners:Ne}),Ue?Xe.data=Ue:(Ue=_f(a),Ue!==null&&(Xe.data=Ue)))),(Ue=fy?py(t,a):my(t,a))&&(Xe=Vo(le,"onBeforeInput"),0<Xe.length&&(Ne=new mf("onBeforeInput","beforeinput",null,a,fe),xe.push({event:Ne,listeners:Xe}),Ne.data=Ue)),a_(xe,t,le,a,fe)}sg(xe,n)})}function pa(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Vo(t,n){for(var a=n+"Capture",u=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=Os(t,a),w!=null&&u.unshift(pa(t,w,k)),w=Os(t,n),w!=null&&u.push(pa(t,w,k))),t.tag===3)return u;t=t.return}return[]}function u_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function og(t,n,a,u,w){for(var k=n._reactName,M=[];a!==null&&a!==u;){var $=a,J=$.alternate,le=$.stateNode;if($=$.tag,J!==null&&J===u)break;$!==5&&$!==26&&$!==27||le===null||(J=le,w?(le=Os(a,k),le!=null&&M.unshift(pa(a,le,J))):w||(le=Os(a,k),le!=null&&M.push(pa(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var d_=/\r\n?/g,h_=/\u0000|\uFFFD/g;function lg(t){return(typeof t=="string"?t:""+t).replace(d_,`
49
+ `).replace(h_,"")}function cg(t,n){return n=lg(n),lg(t)===n}function mt(t,n,a,u,w,k){switch(a){case"children":typeof u=="string"?n==="body"||n==="textarea"&&u===""||zi(t,u):(typeof u=="number"||typeof u=="bigint")&&n!=="body"&&zi(t,""+u);break;case"className":Xa(t,"class",u);break;case"tabIndex":Xa(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Xa(t,a,u);break;case"style":cf(t,u,k);break;case"data":if(n!=="object"){Xa(t,"data",u);break}case"src":case"href":if(u===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=Qa(""+u),t.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="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"&&mt(t,n,"name",w.name,w,null),mt(t,n,"formEncType",w.formEncType,w,null),mt(t,n,"formMethod",w.formMethod,w,null),mt(t,n,"formTarget",w.formTarget,w,null)):(mt(t,n,"encType",w.encType,w,null),mt(t,n,"method",w.method,w,null),mt(t,n,"target",w.target,w,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=Qa(""+u),t.setAttribute(a,u);break;case"onClick":u!=null&&(t.onclick=sr);break;case"onScroll":u!=null&&Ve("scroll",t);break;case"onScrollEnd":u!=null&&Ve("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}a=Qa(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":u===!0?t.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,u):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(a,u):t.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(a):t.setAttribute(a,u);break;case"popover":Ve("beforetoggle",t),Ve("toggle",t),Ka(t,"popover",u);break;case"xlinkActuate":ir(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ir(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ir(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ir(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ir(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ir(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ir(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ir(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ir(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ka(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Pb.get(a)||a,Ka(t,a,u))}}function Iu(t,n,a,u,w,k){switch(a){case"style":cf(t,u,k);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof u=="string"?zi(t,u):(typeof u=="number"||typeof u=="bigint")&&zi(t,""+u);break;case"onScroll":u!=null&&Ve("scroll",t);break;case"onScrollEnd":u!=null&&Ve("scrollend",t);break;case"onClick":u!=null&&(t.onclick=sr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jh.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[ln]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof u=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,u,w);break e}a in t?t[a]=u:u===!0?t.setAttribute(a,""):Ka(t,a,u)}}}function Xt(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",t),Ve("load",t);var u=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var M=a[k];if(M!=null)switch(k){case"src":u=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:mt(t,n,k,M,a,null)}}w&&mt(t,n,"srcSet",a.srcSet,a,null),u&&mt(t,n,"src",a.src,a,null);return;case"input":Ve("invalid",t);var $=k=M=w=null,J=null,le=null;for(u in a)if(a.hasOwnProperty(u)){var fe=a[u];if(fe!=null)switch(u){case"name":w=fe;break;case"type":M=fe;break;case"checked":J=fe;break;case"defaultChecked":le=fe;break;case"value":k=fe;break;case"defaultValue":$=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,n));break;default:mt(t,n,u,fe,a,null)}}sf(t,k,$,J,le,M,w,!1);return;case"select":Ve("invalid",t),u=M=k=null;for(w in a)if(a.hasOwnProperty(w)&&($=a[w],$!=null))switch(w){case"value":k=$;break;case"defaultValue":M=$;break;case"multiple":u=$;default:mt(t,n,w,$,a,null)}n=k,a=M,t.multiple=!!u,n!=null?Ii(t,!!u,n,!1):a!=null&&Ii(t,!!u,a,!0);return;case"textarea":Ve("invalid",t),k=w=u=null;for(M in a)if(a.hasOwnProperty(M)&&($=a[M],$!=null))switch(M){case"value":u=$;break;case"defaultValue":w=$;break;case"children":k=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(s(91));break;default:mt(t,n,M,$,a,null)}of(t,u,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(u=a[J],u!=null))switch(J){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:mt(t,n,J,u,a,null)}return;case"dialog":Ve("beforetoggle",t),Ve("toggle",t),Ve("cancel",t),Ve("close",t);break;case"iframe":case"object":Ve("load",t);break;case"video":case"audio":for(u=0;u<fa.length;u++)Ve(fa[u],t);break;case"image":Ve("error",t),Ve("load",t);break;case"details":Ve("toggle",t);break;case"embed":case"source":case"link":Ve("error",t),Ve("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)&&(u=a[le],u!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:mt(t,n,le,u,a,null)}return;default:if(Zl(n)){for(fe in a)a.hasOwnProperty(fe)&&(u=a[fe],u!==void 0&&Iu(t,n,fe,u,a,void 0));return}}for($ in a)a.hasOwnProperty($)&&(u=a[$],u!=null&&mt(t,n,$,u,a,null))}function f_(t,n,a,u){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,M=null,$=null,J=null,le=null,fe=null;for(ue in a){var xe=a[ue];if(a.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":J=xe;default:u.hasOwnProperty(ue)||mt(t,n,ue,null,u,xe)}}for(var ce in u){var ue=u[ce];if(xe=a[ce],u.hasOwnProperty(ce)&&(ue!=null||xe!=null))switch(ce){case"type":k=ue;break;case"name":w=ue;break;case"checked":le=ue;break;case"defaultChecked":fe=ue;break;case"value":M=ue;break;case"defaultValue":$=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,n));break;default:ue!==xe&&mt(t,n,ce,ue,u,xe)}}Kl(t,M,$,J,le,fe,k,w);return;case"select":ue=M=$=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":ue=J;default:u.hasOwnProperty(k)||mt(t,n,k,null,u,J)}for(w in u)if(k=u[w],J=a[w],u.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":$=k;break;case"multiple":M=k;default:k!==J&&mt(t,n,w,k,u,J)}n=$,a=M,u=ue,ce!=null?Ii(t,!!a,ce,!1):!!u!=!!a&&(n!=null?Ii(t,!!a,n,!0):Ii(t,!!a,a?[]:"",!1));return;case"textarea":ue=ce=null;for($ in a)if(w=a[$],a.hasOwnProperty($)&&w!=null&&!u.hasOwnProperty($))switch($){case"value":break;case"children":break;default:mt(t,n,$,null,u,w)}for(M in u)if(w=u[M],k=a[M],u.hasOwnProperty(M)&&(w!=null||k!=null))switch(M){case"value":ce=w;break;case"defaultValue":ue=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==k&&mt(t,n,M,w,u,k)}af(t,ce,ue);return;case"option":for(var ke in a)if(ce=a[ke],a.hasOwnProperty(ke)&&ce!=null&&!u.hasOwnProperty(ke))switch(ke){case"selected":t.selected=!1;break;default:mt(t,n,ke,null,u,ce)}for(J in u)if(ce=u[J],ue=a[J],u.hasOwnProperty(J)&&ce!==ue&&(ce!=null||ue!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:mt(t,n,J,ce,u,ue)}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 Oe in a)ce=a[Oe],a.hasOwnProperty(Oe)&&ce!=null&&!u.hasOwnProperty(Oe)&&mt(t,n,Oe,null,u,ce);for(le in u)if(ce=u[le],ue=a[le],u.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:mt(t,n,le,ce,u,ue)}return;default:if(Zl(n)){for(var gt in a)ce=a[gt],a.hasOwnProperty(gt)&&ce!==void 0&&!u.hasOwnProperty(gt)&&Iu(t,n,gt,void 0,u,ce);for(fe in u)ce=u[fe],ue=a[fe],!u.hasOwnProperty(fe)||ce===ue||ce===void 0&&ue===void 0||Iu(t,n,fe,ce,u,ue);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!u.hasOwnProperty(ie)&&mt(t,n,ie,null,u,ce);for(xe in u)ce=u[xe],ue=a[xe],!u.hasOwnProperty(xe)||ce===ue||ce==null&&ue==null||mt(t,n,xe,ce,u,ue)}function ug(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function p_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var w=a[u],k=w.transferSize,M=w.initiatorType,$=w.duration;if(k&&$&&ug(M)){for(M=0,$=w.responseEnd,u+=1;u<a.length;u++){var J=a[u],le=J.startTime;if(le>$)break;var fe=J.transferSize,xe=J.initiatorType;fe&&ug(xe)&&(J=J.responseEnd,M+=fe*(J<$?1:($-le)/(J-le)))}if(--u,n+=8*(k+M)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var zu=null,Hu=null;function Yo(t){return t.nodeType===9?t:t.ownerDocument}function dg(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 hg(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 Pu(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 Fu=null;function m_(){var t=window.event;return t&&t.type==="popstate"?t===Fu?!1:(Fu=t,!0):(Fu=null,!1)}var fg=typeof setTimeout=="function"?setTimeout:void 0,g_=typeof clearTimeout=="function"?clearTimeout:void 0,pg=typeof Promise=="function"?Promise:void 0,x_=typeof queueMicrotask=="function"?queueMicrotask:typeof pg<"u"?function(t){return pg.resolve(null).then(t).catch(v_)}:fg;function v_(t){setTimeout(function(){throw t})}function $r(t){return t==="head"}function mg(t,n){var a=n,u=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(u===0){t.removeChild(w),ms(n);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")ma(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ma(a);for(var k=a.firstChild;k;){var M=k.nextSibling,$=k.nodeName;k[Ls]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=M}}else a==="body"&&ma(t.ownerDocument.body);a=w}while(a);ms(n)}function gg(t,n){var a=t;t=0;do{var u=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||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=u}while(a)}function Uu(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":Uu(a),Vl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function b_(t,n,a,u){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Ls])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=Hn(t.nextSibling),t===null)break}return null}function y_(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Hn(t.nextSibling),t===null))return null;return t}function xg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Hn(t.nextSibling),t===null))return null;return t}function $u(t){return t.data==="$?"||t.data==="$~"}function qu(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function __(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var u=function(){n(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Hn(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 Wu=null;function vg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Hn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function bg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function yg(t,n,a){switch(n=Yo(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 ma(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Vl(t)}var Pn=new Map,_g=new Set;function Ko(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _r=Q.d;Q.d={f:S_,r:w_,D:C_,C:k_,L:E_,m:j_,X:T_,S:N_,M:A_};function S_(){var t=_r.f(),n=Po();return t||n}function w_(t){var n=Mi(t);n!==null&&n.tag===5&&n.type==="form"?zp(n):_r.r(t)}var hs=typeof document>"u"?null:document;function Sg(t,n,a){var u=hs;if(u&&typeof n=="string"&&n){var w=Rn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),_g.has(w)||(_g.add(w),t={rel:t,crossOrigin:a,href:n},u.querySelector(w)===null&&(n=u.createElement("link"),Xt(n,"link",t),Pt(n),u.head.appendChild(n)))}}function C_(t){_r.D(t),Sg("dns-prefetch",t,null)}function k_(t,n){_r.C(t,n),Sg("preconnect",t,n)}function E_(t,n,a){_r.L(t,n,a);var u=hs;if(u&&t&&n){var w='link[rel="preload"][as="'+Rn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Rn(a.imageSizes)+'"]')):w+='[href="'+Rn(t)+'"]';var k=w;switch(n){case"style":k=fs(t);break;case"script":k=ps(t)}Pn.has(k)||(t=p({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Pn.set(k,t),u.querySelector(w)!==null||n==="style"&&u.querySelector(ga(k))||n==="script"&&u.querySelector(xa(k))||(n=u.createElement("link"),Xt(n,"link",t),Pt(n),u.head.appendChild(n)))}}function j_(t,n){_r.m(t,n);var a=hs;if(a&&t){var u=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Rn(u)+'"][href="'+Rn(t)+'"]',k=w;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=ps(t)}if(!Pn.has(k)&&(t=p({rel:"modulepreload",href:t},n),Pn.set(k,t),a.querySelector(w)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(xa(k)))return}u=a.createElement("link"),Xt(u,"link",t),Pt(u),a.head.appendChild(u)}}}function N_(t,n,a){_r.S(t,n,a);var u=hs;if(u&&t){var w=Oi(u).hoistableStyles,k=fs(t);n=n||"default";var M=w.get(k);if(!M){var $={loading:0,preload:null};if(M=u.querySelector(ga(k)))$.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Pn.get(k))&&Gu(t,a);var J=M=u.createElement("link");Pt(J),Xt(J,"link",t),J._p=new Promise(function(le,fe){J.onload=le,J.onerror=fe}),J.addEventListener("load",function(){$.loading|=1}),J.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Xo(M,n,u)}M={type:"stylesheet",instance:M,count:1,state:$},w.set(k,M)}}}function T_(t,n){_r.X(t,n);var a=hs;if(a&&t){var u=Oi(a).hoistableScripts,w=ps(t),k=u.get(w);k||(k=a.querySelector(xa(w)),k||(t=p({src:t,async:!0},n),(n=Pn.get(w))&&Vu(t,n),k=a.createElement("script"),Pt(k),Xt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function A_(t,n){_r.M(t,n);var a=hs;if(a&&t){var u=Oi(a).hoistableScripts,w=ps(t),k=u.get(w);k||(k=a.querySelector(xa(w)),k||(t=p({src:t,async:!0,type:"module"},n),(n=Pn.get(w))&&Vu(t,n),k=a.createElement("script"),Pt(k),Xt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function wg(t,n,a,u){var w=(w=Z.current)?Ko(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=fs(a.href),a=Oi(w).hoistableStyles,u=a.get(n),u||(u={type:"style",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=fs(a.href);var k=Oi(w).hoistableStyles,M=k.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,M),(k=w.querySelector(ga(t)))&&!k._p&&(M.instance=k,M.state.loading=5),Pn.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},Pn.set(t,a),k||D_(w,t,a,M.state))),n&&u===null)throw Error(s(528,""));return M}if(n&&u!==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=ps(a),a=Oi(w).hoistableScripts,u=a.get(n),u||(u={type:"script",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function fs(t){return'href="'+Rn(t)+'"'}function ga(t){return'link[rel="stylesheet"]['+t+"]"}function Cg(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function D_(t,n,a,u){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?u.loading=1:(n=t.createElement("link"),u.preload=n,n.addEventListener("load",function(){return u.loading|=1}),n.addEventListener("error",function(){return u.loading|=2}),Xt(n,"link",a),Pt(n),t.head.appendChild(n))}function ps(t){return'[src="'+Rn(t)+'"]'}function xa(t){return"script[async]"+t}function kg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var u=t.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(u)return n.instance=u,Pt(u),u;var w=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Pt(u),Xt(u,"style",w),Xo(u,a.precedence,t),n.instance=u;case"stylesheet":w=fs(a.href);var k=t.querySelector(ga(w));if(k)return n.state.loading|=4,n.instance=k,Pt(k),k;u=Cg(a),(w=Pn.get(w))&&Gu(u,w),k=(t.ownerDocument||t).createElement("link"),Pt(k);var M=k;return M._p=new Promise(function($,J){M.onload=$,M.onerror=J}),Xt(k,"link",u),n.state.loading|=4,Xo(k,a.precedence,t),n.instance=k;case"script":return k=ps(a.src),(w=t.querySelector(xa(k)))?(n.instance=w,Pt(w),w):(u=a,(w=Pn.get(k))&&(u=p({},a),Vu(u,w)),t=t.ownerDocument||t,w=t.createElement("script"),Pt(w),Xt(w,"link",u),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&&(u=n.instance,n.state.loading|=4,Xo(u,a.precedence,t));return n.instance}function Xo(t,n,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=u.length?u[u.length-1]:null,k=w,M=0;M<u.length;M++){var $=u[M];if($.dataset.precedence===n)k=$;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 Gu(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Vu(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Zo=null;function Eg(t,n,a){if(Zo===null){var u=new Map,w=Zo=new Map;w.set(a,u)}else w=Zo,u=w.get(a),u||(u=new Map,w.set(a,u));if(u.has(t))return u;for(u.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Ls]||k[Gt]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var M=k.getAttribute(n)||"";M=t+M;var $=u.get(M);$?$.push(k):u.set(M,[k])}}return u}function jg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function R_(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 Ng(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function L_(t,n,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=fs(u.href),k=n.querySelector(ga(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Qo.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,Pt(k);return}k=n.ownerDocument||n,u=Cg(u),(w=Pn.get(w))&&Gu(u,w),k=k.createElement("link"),Pt(k);var M=k;M._p=new Promise(function($,J){M.onload=$,M.onerror=J}),Xt(k,"link",u),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=Qo.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var Yu=0;function M_(t,n){return t.stylesheets&&t.count===0&&el(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var u=setTimeout(function(){if(t.stylesheets&&el(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&Yu===0&&(Yu=62500*p_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&el(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>Yu?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(w)}}:null}function Qo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)el(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Jo=null;function el(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Jo=new Map,n.forEach(O_,t),Jo=null,Qo.call(t))}function O_(t,n){if(!(n.state.loading&4)){var a=Jo.get(t);if(a)var u=a.get(null);else{a=new Map,Jo.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var M=w[k];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),u=M)}u&&a.set(null,u)}w=n.instance,M=w.getAttribute("data-precedence"),k=a.get(M)||u,k===u&&a.set(null,w),a.set(M,w),this.count++,u=Qo.bind(this),w.addEventListener("load",u),w.addEventListener("error",u),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var va={$$typeof:y,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function B_(t,n,a,u,w,k,M,$,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=Ds(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ds(0),this.hiddenUpdates=Ds(null),this.identifierPrefix=u,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Tg(t,n,a,u,w,k,M,$,J,le,fe,xe){return t=new B_(t,n,a,M,J,le,fe,xe,$),n=1,k===!0&&(n|=24),k=yn(3,null,null,n),t.current=k,k.stateNode=t,n=jc(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:u,isDehydrated:a,cache:n},Dc(k),t}function Ag(t){return t?(t=Wi,t):Wi}function Dg(t,n,a,u,w,k){w=Ag(w),u.context===null?u.context=w:u.pendingContext=w,u=Rr(n),u.payload={element:a},k=k===void 0?null:k,k!==null&&(u.callback=k),a=Lr(t,u,n),a!==null&&(pn(a,t,n),Xs(a,t,n))}function Rg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Ku(t,n){Rg(t,n),(t=t.alternate)&&Rg(t,n)}function Lg(t){if(t.tag===13||t.tag===31){var n=si(t,67108864);n!==null&&pn(n,t,67108864),Ku(t,67108864)}}function Mg(t){if(t.tag===13||t.tag===31){var n=kn();n=ql(n);var a=si(t,n);a!==null&&pn(a,t,n),Ku(t,n)}}var tl=!0;function I_(t,n,a,u){var w=V.T;V.T=null;var k=Q.p;try{Q.p=2,Xu(t,n,a,u)}finally{Q.p=k,V.T=w}}function z_(t,n,a,u){var w=V.T;V.T=null;var k=Q.p;try{Q.p=8,Xu(t,n,a,u)}finally{Q.p=k,V.T=w}}function Xu(t,n,a,u){if(tl){var w=Zu(u);if(w===null)Bu(t,n,u,nl,a),Bg(t,u);else if(P_(w,t,n,a,u))u.stopPropagation();else if(Bg(t,u),n&4&&-1<H_.indexOf(t)){for(;w!==null;){var k=Mi(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var M=Me(k.pendingLanes);if(M!==0){var $=k;for($.pendingLanes|=2,$.entangledLanes|=2;M;){var J=1<<31-nt(M);$.entanglements[1]|=J,M&=~J}Qn(k),(ot&6)===0&&(zo=qe()+500,ha(0))}}break;case 31:case 13:$=si(k,2),$!==null&&pn($,k,2),Po(),Ku(k,2)}if(k=Zu(u),k===null&&Bu(t,n,u,nl,a),k===w)break;w=k}w!==null&&u.stopPropagation()}else Bu(t,n,u,null,a)}}function Zu(t){return t=Jl(t),Qu(t)}var nl=null;function Qu(t){if(nl=null,t=Li(t),t!==null){var n=f(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=m(n),t!==null)return t;t=null}else if(a===31){if(t=o(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 nl=t,null}function Og(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(at()){case de:return 2;case ee:return 8;case ve:case Se:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var Ju=!1,qr=null,Wr=null,Gr=null,ba=new Map,ya=new Map,Vr=[],H_="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 Bg(t,n){switch(t){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":Wr=null;break;case"mouseover":case"mouseout":Gr=null;break;case"pointerover":case"pointerout":ba.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ya.delete(n.pointerId)}}function _a(t,n,a,u,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:u,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Mi(n),n!==null&&Lg(n)),t):(t.eventSystemFlags|=u,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function P_(t,n,a,u,w){switch(n){case"focusin":return qr=_a(qr,t,n,a,u,w),!0;case"dragenter":return Wr=_a(Wr,t,n,a,u,w),!0;case"mouseover":return Gr=_a(Gr,t,n,a,u,w),!0;case"pointerover":var k=w.pointerId;return ba.set(k,_a(ba.get(k)||null,t,n,a,u,w)),!0;case"gotpointercapture":return k=w.pointerId,ya.set(k,_a(ya.get(k)||null,t,n,a,u,w)),!0}return!1}function Ig(t){var n=Li(t.target);if(n!==null){var a=f(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){t.blockedOn=n,Xh(t.priority,function(){Mg(a)});return}}else if(n===31){if(n=o(a),n!==null){t.blockedOn=n,Xh(t.priority,function(){Mg(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 rl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Zu(t.nativeEvent);if(a===null){a=t.nativeEvent;var u=new a.constructor(a.type,a);Ql=u,a.target.dispatchEvent(u),Ql=null}else return n=Mi(a),n!==null&&Lg(n),t.blockedOn=a,!1;n.shift()}return!0}function zg(t,n,a){rl(t)&&a.delete(n)}function F_(){Ju=!1,qr!==null&&rl(qr)&&(qr=null),Wr!==null&&rl(Wr)&&(Wr=null),Gr!==null&&rl(Gr)&&(Gr=null),ba.forEach(zg),ya.forEach(zg)}function il(t,n){t.blockedOn===n&&(t.blockedOn=null,Ju||(Ju=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,F_)))}var sl=null;function Hg(t){sl!==t&&(sl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){sl===t&&(sl=null);for(var n=0;n<t.length;n+=3){var a=t[n],u=t[n+1],w=t[n+2];if(typeof u!="function"){if(Qu(u||a)===null)continue;break}var k=Mi(a);k!==null&&(t.splice(n,3),n-=3,Zc(k,{pending:!0,data:w,method:a.method,action:u},u,w))}}))}function ms(t){function n(J){return il(J,t)}qr!==null&&il(qr,t),Wr!==null&&il(Wr,t),Gr!==null&&il(Gr,t),ba.forEach(n),ya.forEach(n);for(var a=0;a<Vr.length;a++){var u=Vr[a];u.blockedOn===t&&(u.blockedOn=null)}for(;0<Vr.length&&(a=Vr[0],a.blockedOn===null);)Ig(a),a.blockedOn===null&&Vr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var w=a[u],k=a[u+1],M=w[ln]||null;if(typeof k=="function")M||Hg(a);else if(M){var $=null;if(k&&k.hasAttribute("formAction")){if(w=k,M=k[ln]||null)$=M.formAction;else if(Qu(w)!==null)continue}else $=M.action;typeof $=="function"?a[u+1]=$:(a.splice(u,3),u-=3),Hg(a)}}}function Pg(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),u||setTimeout(a,20)}function a(){if(!u&&!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 u=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function ed(t){this._internalRoot=t}al.prototype.render=ed.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,u=kn();Dg(a,u,t,n,null,null)},al.prototype.unmount=ed.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Dg(t.current,2,null,t,null,null),Po(),n[Ri]=null}};function al(t){this._internalRoot=t}al.prototype.unstable_scheduleHydration=function(t){if(t){var n=Kh();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Vr.length&&n!==0&&n<Vr[a].priority;a++);Vr.splice(a,0,t),a===0&&Ig(t)}};var Fg=i.version;if(Fg!=="19.2.4")throw Error(s(527,Fg,"19.2.4"));Q.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=h(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var U_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ol=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ol.isDisabled&&ol.supportsFiber)try{ct=ol.inject(U_),ut=ol}catch{}}return wa.createRoot=function(t,n){if(!l(t))throw Error(s(299));var a=!1,u="",w=Yp,k=Kp,M=Xp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=Tg(t,1,!1,null,null,a,u,null,w,k,M,Pg),t[Ri]=n.current,Ou(t),new ed(n)},wa.hydrateRoot=function(t,n,a){if(!l(t))throw Error(s(299));var u=!1,w="",k=Yp,M=Kp,$=Xp,J=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&($=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Tg(t,1,!0,n,a??null,u,w,J,k,M,$,Pg),n.context=Ag(null),a=n.current,u=kn(),u=ql(u),w=Rr(u),w.callback=null,Lr(a,w,u),a=u,n.current.lanes=a,Rs(n,a),Qn(n),t[Ri]=n.current,Ou(t),new al(n)},wa.version="19.2.4",wa}var Zg;function t1(){if(Zg)return rd.exports;Zg=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(i){console.error(i)}}return e(),rd.exports=e1(),rd.exports}var n1=t1();const r1=Tl(n1);function i1(e,i){if(e instanceof RegExp)return{keys:!1,pattern:e};var r,s,l,f,m=[],o="",d=e.split("/");for(d[0]||d.shift();l=d.shift();)r=l[0],r==="*"?(m.push(r),o+=l[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(s=l.indexOf("?",1),f=l.indexOf(".",1),m.push(l.substring(1,~s?s:~f?f:l.length)),o+=~s&&!~f?"(?:/([^/]+?))?":"/([^/]+?)",~f&&(o+=(~s?"?":"")+"\\"+l.substring(f))):o+="/"+l;return{keys:m,pattern:new RegExp("^"+o+(i?"(?=$|/)":"/?$"),"i")}}var od={exports:{}},ld={};/**
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 Qg;function s1(){if(Qg)return ld;Qg=1;var e=Al();function i(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var r=typeof Object.is=="function"?Object.is:i,s=e.useState,l=e.useEffect,f=e.useLayoutEffect,m=e.useDebugValue;function o(p,v){var S=v(),E=s({inst:{value:S,getSnapshot:v}}),C=E[0].inst,b=E[1];return f(function(){C.value=S,C.getSnapshot=v,d(C)&&b({inst:C})},[p,S,v]),l(function(){return d(C)&&b({inst:C}),p(function(){d(C)&&b({inst:C})})},[p]),m(S),S}function d(p){var v=p.getSnapshot;p=p.value;try{var S=v();return!r(p,S)}catch{return!0}}function h(p,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:o;return ld.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,ld}var Jg;function a1(){return Jg||(Jg=1,od.exports=s1()),od.exports}var o1=a1();const l1=X_.useInsertionEffect,c1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",u1=c1?F.useLayoutEffect:F.useEffect,d1=l1||u1,Pv=e=>{const i=F.useRef([e,(...r)=>i[0](...r)]).current;return d1(()=>{i[0]=e}),i[1]},h1="popstate",th="pushState",nh="replaceState",f1="hashchange",ex=[h1,th,nh,f1],p1=e=>{for(const i of ex)addEventListener(i,e);return()=>{for(const i of ex)removeEventListener(i,e)}},Fv=(e,i)=>o1.useSyncExternalStore(p1,e,i),tx=()=>location.search,m1=({ssrSearch:e}={})=>Fv(tx,e!=null?()=>e:tx),nx=()=>location.pathname,g1=({ssrPath:e}={})=>Fv(nx,e!=null?()=>e:nx),x1=(e,{replace:i=!1,state:r=null}={})=>history[i?nh:th](r,"",e),v1=(e={})=>[g1(e),x1],rx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[rx]>"u"){for(const e of[th,nh]){const i=history[e];history[e]=function(){const r=i.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),r}}Object.defineProperty(window,rx,{value:!0})}const b1=(e,i)=>i.toLowerCase().indexOf(e.toLowerCase())?"~"+i:i.slice(e.length)||"/",Uv=(e="")=>e==="/"?"":e,y1=(e,i)=>e[0]==="~"?e.slice(1):Uv(i)+e,_1=(e="",i)=>b1(ix(Uv(e)),ix(i)),ix=e=>{try{return decodeURI(e)}catch{return e}},$v={hook:v1,searchHook:m1,parser:i1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,i,r)=>e(i,r)},qv=F.createContext($v),js=()=>F.useContext(qv),Wv={},Gv=F.createContext(Wv),S1=()=>F.useContext(Gv),Dl=e=>{const[i,r]=e.hook(e);return[_1(e.base,i),Pv((s,l)=>e.aroundNav(r,y1(s,e.base),l))]},Ni=()=>Dl(js()),rh=(e,i,r,s)=>{const{pattern:l,keys:f}=i instanceof RegExp?{keys:!1,pattern:i}:e(i||"*",s),m=l.exec(r)||[],[o,...d]=m;return o!==void 0?[!0,(()=>{const h=f!==!1?Object.fromEntries(f.map((p,v)=>[p,d[v]])):m.groups;let g={...d};return h&&Object.assign(g,h),g})(),...s?[o]:[]]:[!1,null]},ih=e=>rh(js().parser,e,Ni()[0]),w1=({children:e,...i})=>{var g,p,v;const r=js(),s=i.hook?$v:r;let l=s;const[f,m=i.ssrSearch??""]=((g=i.ssrPath)==null?void 0:g.split("?"))??[];f&&(i.ssrSearch=m,i.ssrPath=f),i.hrefs=i.hrefs??((p=i.hook)==null?void 0:p.hrefs),i.searchHook=i.searchHook??((v=i.hook)==null?void 0:v.searchHook);let o=F.useRef({}),d=o.current,h=d;for(let S in s){const E=S==="base"?s[S]+(i[S]??""):i[S]??s[S];d===h&&E!==h[S]&&(o.current=h={...h}),h[S]=E,(E!==s[S]||E!==l[S])&&(l=h)}return F.createElement(qv.Provider,{value:l,children:e})},sx=({children:e,component:i},r)=>i?F.createElement(i,{params:r}):typeof e=="function"?e(r):e,C1=e=>{let i=F.useRef(Wv);const r=i.current;return i.current=Object.keys(e).length!==Object.keys(r).length||Object.entries(e).some(([s,l])=>l!==r[s])?e:r},ll=({path:e,nest:i,match:r,...s})=>{const l=js(),[f]=Dl(l),[m,o,d]=r??rh(l.parser,e,f,i),h=C1({...S1(),...o});if(!m)return null;const g=d?F.createElement(w1,{base:d},sx(s,h)):sx(s,h);return F.createElement(Gv.Provider,{value:h,children:g})},Ci=F.forwardRef((e,i)=>{const r=js(),[s,l]=Dl(r),{to:f="",href:m=f,onClick:o,asChild:d,children:h,className:g,replace:p,state:v,transition:S,...E}=e,C=Pv(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(o==null||o(x),x.defaultPrevented||(x.preventDefault(),l(m,e)))}),b=r.hrefs(m[0]==="~"?m.slice(1):r.base+m,r);return d&&F.isValidElement(h)?F.cloneElement(h,{onClick:C,href:b}):F.createElement("a",{...E,onClick:C,href:b,className:g!=null&&g.call?g(s===m):g,children:h,ref:i})}),Vv=e=>Array.isArray(e)?e.flatMap(i=>Vv(i&&i.type===F.Fragment?i.props.children:i)):[e],k1=({children:e,location:i})=>{const r=js(),[s]=Dl(r);for(const l of Vv(e)){let f=0;if(F.isValidElement(l)&&(f=rh(r.parser,l.props.path,i||s,l.props.nest))[0])return F.cloneElement(l,{match:f})}return null},ax=e=>{let i;const r=new Set,s=(h,g)=>{const p=typeof h=="function"?h(i):h;if(!Object.is(p,i)){const v=i;i=g??(typeof p!="object"||p===null)?p:Object.assign({},i,p),r.forEach(S=>S(i,v))}},l=()=>i,o={setState:s,getState:l,getInitialState:()=>d,subscribe:h=>(r.add(h),()=>r.delete(h))},d=i=e(s,l,o);return o},E1=(e=>e?ax(e):ax),j1=e=>e;function N1(e,i=j1){const r=an.useSyncExternalStore(e.subscribe,an.useCallback(()=>i(e.getState()),[e,i]),an.useCallback(()=>i(e.getInitialState()),[e,i]));return an.useDebugValue(r),r}const ox=e=>{const i=E1(e),r=s=>N1(i,s);return Object.assign(r,i),r},Yn=(e=>e?ox(e):ox);function T1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function gl(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const i=Math.random()*16|0;return(e==="x"?i:i&3|8).toString(16)})}class A1{constructor(i){vi(this,"ws",null);vi(this,"handlers",new Set);vi(this,"statusHandler",null);vi(this,"url");vi(this,"isReconnecting",!1);vi(this,"connectingPromise",null);this.url=i}onStatusChange(i){this.statusHandler=i}connect(){var i;return((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?Promise.resolve():this.connectingPromise?this.connectingPromise:(this.connectingPromise=new Promise((r,s)=>{try{this.ws=new WebSocket(this.url),this.ws.onopen=()=>{var l;this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),r()},this.ws.onclose=()=>{var l;this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"disconnected"),this.attemptReconnect()},this.ws.onerror=l=>{console.error("WebSocket error:",l),this.connectingPromise=null,s(l)},this.ws.onmessage=l=>{try{const f=JSON.parse(l.data);T1(f)&&this.handlers.forEach(m=>m(f))}catch(f){console.error("Failed to parse WebSocket message:",f)}}}catch(l){this.connectingPromise=null,s(l)}}),this.connectingPromise)}attemptReconnect(){var i;this.isReconnecting||(this.isReconnecting=!0,(i=this.statusHandler)==null||i.call(this,"reconnecting"),setTimeout(()=>{this.isReconnecting=!1,this.connect().catch(()=>{})},5e3))}disconnect(){this.isReconnecting=!1,this.ws&&(this.ws.close(),this.ws=null)}send(i,r){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=gl(),l={id:s,type:i,payload:r};return this.ws.send(JSON.stringify(l)),s}subscribe(i){return this.handlers.add(i),()=>this.handlers.delete(i)}get isConnected(){var i;return((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN}}const D1=`ws://${window.location.hostname}:${window.location.port||"10369"}/ws`,gn=new A1(D1);let cl=[],cd=null,xl=null;function R1(){cd===null&&(cd=requestAnimationFrame(()=>{cd=null,xl==null||xl()}))}const er=Yn()((e,i)=>(xl=()=>{if(cl.length===0)return;const r=cl;cl=[],e(s=>({logs:[...s.logs,...r]}))},{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:r=>{i().workdir!==r&&(e({workdir:r,status:null,logs:[],config:null,loading:!0}),r&&(i().fetchStatus(),i().fetchConfig()))},fetchStatus:async()=>{const r=i().workdir;if(r)try{const l=await(await fetch(`/api/dev-server?workdir=${encodeURIComponent(r)}`)).json();e({status:l,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const r=i().workdir;if(r)try{const l=await(await fetch(`/api/dev-server/config?workdir=${encodeURIComponent(r)}`)).json();e({config:l.config??null})}catch{}},fetchLogs:async()=>{const r=i().workdir;if(r)try{const f=(await(await fetch(`/api/dev-server/logs?workdir=${encodeURIComponent(r)}`)).json()).logs.map(m=>({stream:m.stream,content:m.content}));e({logs:f})}catch{}},start:async()=>{const r=i().workdir;if(r)try{const l=await(await fetch(`/api/dev-server/start?workdir=${encodeURIComponent(r)}`,{method:"POST"})).json();e({status:l,logs:[]})}catch{}},stop:async()=>{const r=i().workdir;if(r)try{const l=await(await fetch(`/api/dev-server/stop?workdir=${encodeURIComponent(r)}`,{method:"POST"})).json();e({status:l})}catch{}},restart:async()=>{const r=i().workdir;if(r)try{const l=await(await fetch(`/api/dev-server/restart?workdir=${encodeURIComponent(r)}`,{method:"POST"})).json();e({status:l,logs:[]})}catch{}},saveConfig:async r=>{const s=i().workdir;if(s)try{const f=await(await fetch(`/api/dev-server/config?workdir=${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json();e({config:f.config??r}),i().fetchStatus()}catch{}},handleMessage:r=>{const s=i().workdir;if(s)switch(r.type){case"devServer.output":{const l=r.payload;if(l.workdir!==s)return;cl.push({stream:l.stream,content:l.content}),R1();break}case"devServer.state":{const l=r.payload;if(l.workdir!==s)return;e(f=>({status:f.status?{...f.status,state:l.state,errorMessage:l.errorMessage}:f.status}));break}}}})),L1=3e4;function M1(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"auto":return"Auto";case"unknown":return""}}const Zt=Yn((e,i)=>({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 r=await fetch("/api/config");if(!r.ok)throw new Error("Failed to fetch config");const s=await r.json();e({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(r){e({error:r instanceof Error?r.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const r=await fetch("/api/model/refresh",{method:"POST"});if(!r.ok)throw new Error("Failed to refresh model");const s=await r.json(),f=Ee.getState().currentSession;if(f!=null&&f.providerId&&f.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(r){console.error("Failed to refresh model:",r)}},activateProvider:async r=>{const{activeProviderId:s,providers:l}=i();if(r===s)return!0;e({activating:!0,error:null});try{const f=await fetch(`/api/providers/${r}/activate`,{method:"POST"});if(!f.ok){const o=await f.json();throw new Error(o.error??"Failed to activate provider")}const m=await f.json();return e({activeProviderId:m.activeProviderId,model:m.model,backend:m.backend,providers:l.map(o=>({...o,isActive:o.id===m.activeProviderId})),activating:!1}),!0}catch(f){return e({error:f instanceof Error?f.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(r,s)=>{const{providers:l}=i();e({activeProviderId:r,model:s,defaultModelSelection:`${r}/${s}`,providers:l.map(f=>({...f,isActive:f.id===r}))})},updateModelContext:async(r,s,l)=>{e({activating:!0,error:null});try{const f=await fetch(`/api/providers/${r}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:l})});if(!f.ok){const d=await f.json();throw new Error(d.error??"Failed to update model context")}const m=await f.json(),{providers:o}=i();return e({providers:o.map(d=>d.id===r?{...d,models:d.models.map(h=>h.id===s?{...h,contextWindow:l,source:"user"}:h)}:d),activating:!1}),m.contextState&&Ee.getState().updateContextState(m.contextState),!0}catch(f){return e({error:f instanceof Error?f.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async r=>{e({activating:!0,error:null});try{const s=await fetch(`/api/providers/${r}/refresh`,{method:"POST"});if(!s.ok){const m=await s.json();throw new Error(m.error??"Failed to refresh models")}const l=await s.json(),{providers:f}=i();return e({providers:f.map(m=>m.id===r?{...m,models:l.models}:m),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:r,refreshModel:s}=i();if(r)return;const l=setInterval(()=>{s()},L1);e({autoRefreshInterval:l})},stopAutoRefresh:()=>{const{autoRefreshInterval:r}=i();r&&(clearInterval(r),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:r,activeProviderId:s}=i();return r.find(l=>l.id===s)},getModelContext:r=>{const{providers:s,activeProviderId:l}=i(),f=s.find(o=>o.id===l);if(!f)return 2e5;const m=f.models.find(o=>o.id===r);return(m==null?void 0:m.contextWindow)??2e5}})),Xr={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"},Zr=Yn(e=>({settings:{},loading:{},getSetting:async i=>{e(r=>({loading:{...r.loading,[i]:!0}}));try{const s=await(await fetch(`/api/settings/${i}`)).json();return e(l=>({settings:{...l.settings,[i]:s.value??""},loading:{...l.loading,[i]:!1}})),s.value}catch{return e(r=>({loading:{...r.loading,[i]:!1}})),null}},setSetting:async(i,r)=>{e(s=>({loading:{...s.loading,[i]:!0}}));try{const l=await(await fetch(`/api/settings/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:r})})).json();e(f=>({settings:{...f.settings,[i]:l.value??""},loading:{...f.loading,[i]:!1}}))}catch{e(s=>({loading:{...s.loading,[i]:!1}}))}}})),lx=[{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"}],O1=[{key:"planner",label:"Planner"},{key:"build",label:"Builder"},{key:"sub-agent",label:"Sub-agent"}],B1=[{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"}],sh={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"},tr={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Id={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...tr},waiting_for_user:{...tr},phase_done:{...tr},phase_blocked:{...tr},new_message:{...tr}},agentOverrides:{}};function Yv(e,i,r){var f;const s=e.events[i];if(!r)return s;const l=(f=e.agentOverrides[r])==null?void 0:f[i];return l?{soundEnabled:l.soundEnabled??s.soundEnabled,browserNotification:l.browserNotification??s.browserNotification,customSoundUrl:l.customSoundUrl!==void 0?l.customSoundUrl:s.customSoundUrl}:s}const wi=Yn((e,i)=>({settings:Id,loaded:!1,load:()=>{Zr.getState().getSetting(Xr.NOTIFICATION_SETTINGS);const s=Zr.subscribe(f=>{const m=f.settings[Xr.NOTIFICATION_SETTINGS];if(m!==void 0)try{const o=JSON.parse(m);e({settings:cx(o),loaded:!0})}catch{e({loaded:!0})}}),l=Zr.getState().settings[Xr.NOTIFICATION_SETTINGS];if(l)try{const f=JSON.parse(l);e({settings:cx(f),loaded:!0})}catch{e({loaded:!0})}return s},update:r=>{e({settings:r}),ud(r)},updateEvent:(r,s)=>{const l=i().settings,f={...l,events:{...l.events,[r]:{...l.events[r],...s}}};e({settings:f}),ud(f)},updateAgentOverride:(r,s,l)=>{var d;const f=i().settings,m={...f.agentOverrides};if(l===null){if(m[r]){const h={...m[r]};delete h[s],Object.keys(h).length===0?delete m[r]:m[r]=h}}else m[r]={...m[r],[s]:{...((d=m[r])==null?void 0:d[s])??{},...l}};const o={...f,agentOverrides:m};e({settings:o}),ud(o)}}));function ud(e){Zr.getState().setSetting(Xr.NOTIFICATION_SETTINGS,JSON.stringify(e))}function cx(e){var i,r,s,l,f;return{soundEnabled:e.soundEnabled??Id.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Id.browserNotificationEnabled,events:{complete:{...tr,...(i=e.events)==null?void 0:i.complete},waiting_for_user:{...tr,...(r=e.events)==null?void 0:r.waiting_for_user},phase_done:{...tr,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...tr,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...tr,...(f=e.events)==null?void 0:f.new_message}},agentOverrides:e.agentOverrides??{}}}const ux=new Map;function I1(e){let i=ux.get(e);return i||(i=new Audio(e),i.volume=.5,ux.set(e,i)),i}let Kv=typeof Notification<"u"?Notification.permission:"denied";function z1(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Kv=e,e))}const H1={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},P1={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 F1(e){typeof Notification>"u"||Kv==="granted"&&(document.hasFocus()||new Notification(H1[e],{body:P1[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function $a(e,i){const{settings:r}=wi.getState(),s=Yv(r,e,i);if(r.soundEnabled&&s.soundEnabled){const l=s.customSoundUrl??sh[e],f=I1(l);f.currentTime=0,f.play().catch(()=>{})}r.browserNotificationEnabled&&s.browserNotification&&F1(e)}const U1=e=>$a("complete",e),$1=e=>$a("phase_done",e),q1=e=>$a("phase_blocked",e),dx=e=>$a("waiting_for_user",e),hx=e=>$a("new_message",e);let fx=!1;const Ca=new Set,Bt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Cs=null,en=null;function dd(){Cs===null&&(Cs=requestAnimationFrame(()=>{Cs=null,en==null||en()}))}function bi(){Cs!==null&&(cancelAnimationFrame(Cs),Cs=null)}function At(e,i){return i!==null&&e.sessionId===i}function W1(e,i,r){return e.id!==void 0||At(e,i)||r===!0&&e.sessionId!==void 0}function G1(e,i){return e.includes(i)?e:[...e,i]}function ka(e,i){return e.filter(r=>r!==i)}function V1(e,i){const r=e.find(l=>l.id===i.id),s=r?{...r,projectId:i.projectId,workdir:i.workdir,mode:i.mode,phase:i.phase,isRunning:i.isRunning,messageCount:i.messages.length,criteriaCount:i.criteria.length,criteriaCompleted:i.criteria.filter(l=>l.status.type==="passed").length}:{id:i.id,projectId:i.projectId,workdir:i.workdir,mode:i.mode,phase:i.phase,isRunning:i.isRunning,createdAt:"",updatedAt:"",criteriaCount:i.criteria.length,criteriaCompleted:i.criteria.filter(l=>l.status.type==="passed").length,messageCount:i.messages.length};return r?e.map(l=>l.id===i.id?s:l):[s,...e]}function Y1(e,i,r){return e.map(s=>{const l=(r==null?void 0:r.id)===s.id?r:null,f=i.find(m=>m.id===s.id);return{...s,title:s.title??(f==null?void 0:f.title),mode:(l==null?void 0:l.mode)??(f==null?void 0:f.mode)??s.mode,phase:(l==null?void 0:l.phase)??(f==null?void 0:f.phase)??s.phase,isRunning:(l==null?void 0:l.isRunning)??(f==null?void 0:f.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const px=new Map;function Ss(e,i){var f;const r=i===((f=e.currentSession)==null?void 0:f.id)?e.currentSession:null,s=e.sessions.find(m=>m.id===i),l=(r==null?void 0:r.mode)??(s==null?void 0:s.mode);return l==="planner"?"planner":l==="builder"?"build":"planner"}function K1(e,i){if(e.type==="chat.done"){const r=e.payload,s=Ss(i,e.sessionId);r.reason==="complete"&&U1(s),r.reason==="waiting_for_user"&&dx(s);return}if(e.type==="chat.path_confirmation"){const r=Ss(i,e.sessionId);dx(r);return}if(e.type==="task.completed"){const r=Ss(i,e.sessionId);$1(r);return}if(e.type==="phase.changed"&&e.sessionId){const r=e.payload,s=px.get(e.sessionId)??null;if(px.set(e.sessionId,r.phase),s===r.phase)return;const l=Ss(i,e.sessionId);r.phase==="blocked"&&q1(l)}}const Ee=Yn((e,i)=>(en=()=>{const r=Bt;if(!r.messageId)return;const s=r.deltaContent.length>0,l=r.thinkingContent.length>0,f=r.toolOutput.length>0;if(!s&&!l&&!f)return;const m=r.deltaContent,o=r.thinkingContent,d=r.toolOutput;r.deltaContent="",r.thinkingContent="",r.toolOutput=[],e(h=>{var p;const g=h.streamingMessage;if(g&&g.id===r.messageId){let v={...g};if(s&&(v.content=v.content+m),l&&(v.thinkingContent=(v.thinkingContent??"")+o),f){const S=new Set;v.toolCalls=(p=v.toolCalls)==null?void 0:p.map(C=>{const b=d.filter(x=>x.callId===C.id);return b.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...b.map(x=>({stream:x.stream,content:x.content}))]})});const E=d.filter(C=>!S.has(C.callId));E.length>0&&Bt.toolOutput.push(...E)}return{streamingMessage:v}}if(f){const v=new Set,S=h.messages.map(C=>{var x;if(C.id!==r.messageId)return C;const b=(x=C.toolCalls)==null?void 0:x.map(_=>{const y=d.filter(j=>j.callId===_.id);return y.length===0?_:(v.add(_.id),{..._,streamingOutput:[..._.streamingOutput??[],...y.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:b}}),E=d.filter(C=>!v.has(C.callId));return E.length>0&&Bt.toolOutput.push(...E),{messages:S}}return h})},{connectionStatus:"disconnected",sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const r=i().connectionStatus;if(!(r==="connected"||r==="reconnecting")){e({connectionStatus:"reconnecting"}),gn.onStatusChange(s=>{e({connectionStatus:s}),s==="connected"&&i().listSessions(void 0)});try{if(await gn.connect(),!fx){fx=!0;const s=i().handleServerMessage;gn.subscribe(s)}}catch(s){console.error("Failed to connect:",s),e({connectionStatus:"disconnected"})}}},disconnect:()=>{gn.disconnect(),e({connectionStatus:"disconnected"})},createSession:async(r,s)=>{try{e({pendingSessionCreate:!0});const l=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:r,title:s})});if(!l.ok)return e({pendingSessionCreate:!1}),null;const f=await l.json();return gn.send("session.load",{sessionId:f.session.id}),f.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async r=>{try{const s=i().currentSession;!s||s.id!==r?(bi(),e({currentSession:null,unreadSessionIds:ka(i().unreadSessionIds,r),messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:ka(i().unreadSessionIds,r)});const l=await fetch(`/api/sessions/${r}`);if(!l.ok)return;const f=await l.json();e({currentSession:f.session,messages:f.messages??[],contextState:f.contextState,queuedMessages:f.queueState??[]}),gn.send("session.load",{sessionId:r})}catch{}},listSessions:async(r,s=20)=>{try{const l=new URLSearchParams;l.set("limit",String(s)),r&&l.set("projectId",r);const m=await(await fetch(`/api/sessions?${l.toString()}`)).json();e({sessions:m.sessions??[],sessionsHasMore:r?m.hasMore??!1:!0})}catch{}},loadMoreSessions:async r=>{const s=i();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",r);const m=await(await fetch(`/api/sessions?${l.toString()}`)).json();e(o=>({sessions:[...o.sessions,...m.sessions??[]],sessionsHasMore:m.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async r=>{var s;try{return(await fetch(`/api/sessions/${r}`,{method:"DELETE"})).ok?(await i().listSessions(),((s=i().currentSession)==null?void 0:s.id)===r&&i().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async r=>{try{return(await fetch(`/api/projects/${r}/sessions`,{method:"DELETE"})).ok?(await i().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{bi(),e(r=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:r.currentSession?ka(r.unreadSessionIds,r.currentSession.id):r.unreadSessionIds}))},sendMessage:async(r,s,l)=>{var m;const f=(m=i().currentSession)==null?void 0:m.id;if(f){e({streamingMessageId:null});try{const d=await(await fetch(`/api/sessions/${f}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r,attachments:s,messageKind:l==null?void 0:l.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error sending message:",o)}}},stopGeneration:async()=>{var s;const r=(s=i().currentSession)==null?void 0:s.id;if(r&&!i().abortInProgress){bi(),en==null||en(),e({abortInProgress:!0});try{await fetch(`/api/sessions/${r}/stop`,{method:"POST"})}catch(l){console.error("Error stopping generation:",l)}}},continueGeneration:async()=>{var s;const r=(s=i().currentSession)==null?void 0:s.id;if(r){e({streamingMessageId:null});try{await fetch(`/api/sessions/${r}/continue`,{method:"POST"})}catch(l){console.error("Error continuing generation:",l)}}},launchRunner:(r,s,l)=>{e({streamingMessageId:null});const f={};r!=null&&r.trim()&&(f.content=r),s&&s.length>0&&(f.attachments=s),l&&(f.workflowId=l),gn.send("runner.launch",f)},switchMode:async r=>{var l;const s=(l=i().currentSession)==null?void 0:l.id;if(s)try{const f=await fetch(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r})});if(!f.ok){console.error("Failed to switch mode:",await f.json());return}const m=await f.json();m.session&&e({currentSession:m.session})}catch(f){console.error("Error switching mode:",f)}},switchDangerLevel:async r=>{var l;const s=(l=i().currentSession)==null?void 0:l.id;if(s)try{const f=await fetch(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:r})});if(!f.ok){console.error("Failed to switch danger level:",await f.json());return}const m=await f.json();m.session&&e({currentSession:m.session})}catch(f){console.error("Error switching danger level:",f)}},acceptAndBuild:(r,s,l)=>{e({streamingMessageId:null});const f={};r&&(f.workflowId=r),s!=null&&s.trim()&&(f.content=s),l&&l.length>0&&(f.attachments=l),gn.send("mode.accept",f)},editCriteria:async r=>{var l;const s=(l=i().currentSession)==null?void 0:l.id;if(s)try{const f=await fetch(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:r})});f.ok||console.error("Failed to update criteria:",await f.json())}catch(f){console.error("Error updating criteria:",f)}},compactContext:()=>{gn.send("context.compact",{})},setSessionProvider:async(r,s)=>{var l;try{const f=(l=i().currentSession)==null?void 0:l.id;if(!f)return null;const m=await fetch(`/api/sessions/${f}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:r,...s?{model:s}:{}})});if(!m.ok)return null;const o=await m.json();return e({currentSession:o.session,messages:o.messages??[],contextState:o.contextState}),o.session}catch{return null}},updateContextState:r=>{e({contextState:r})},confirmPath:async(r,s,l=!1)=>{var m;const f=(m=i().currentSession)==null?void 0:m.id;if(f)try{await fetch(`/api/sessions/${f}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:r,approved:s,alwaysAllow:l})})}catch(o){console.error("Error confirming path:",o)}},answerQuestion:async(r,s)=>{var f;const l=(f=i().currentSession)==null?void 0:f.id;if(l){try{await fetch(`/api/sessions/${l}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:r,answer:s})})}catch(m){console.error("Error answering question:",m)}e({pendingQuestion:null})}},queueAsap:async(r,s,l)=>{var m;const f=(m=i().currentSession)==null?void 0:m.id;if(f)try{const d=await(await fetch(`/api/sessions/${f}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error queueing ASAP message:",o)}},queueCompletion:async(r,s,l)=>{var m;const f=(m=i().currentSession)==null?void 0:m.id;if(f)try{const d=await(await fetch(`/api/sessions/${f}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error queueing completion message:",o)}},cancelQueued:async r=>{var l;const s=(l=i().currentSession)==null?void 0:l.id;if(s)try{const m=await(await fetch(`/api/sessions/${s}/queue/${r}`,{method:"DELETE"})).json();m.queueState&&e({queuedMessages:m.queueState})}catch(f){console.error("Error canceling queued message:",f)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:r=>{var m,o,d,h,g,p,v,S,E,C,b,x,_,y,j,A,N,R,T,I,H,G,K,q;const s=i();K1(r,s);const l=((m=s.currentSession)==null?void 0:m.id)??null,f=()=>{const O=r.sessionId;!O||O===l||e(W=>({unreadSessionIds:G1(W.unreadSessionIds,O)}))};switch(r.type){case"session.state":{const O=r.payload;if(!W1(r,l,s.pendingSessionCreate))break;bi();const W=O.messages.find(D=>D.isStreaming)??null,V=i().pendingSessionCreate===!0,Q=O.pendingConfirmations??[],L=s.pendingPathConfirmation??(Q.length>0?Q[0]??null:null);if(e({currentSession:O.session,sessions:V1(i().sessions,O.session),unreadSessionIds:ka(i().unreadSessionIds,O.session.id),messages:O.messages,streamingMessageId:(W==null?void 0:W.id)??null,streamingMessage:W,currentTodos:[],pendingPathConfirmation:L,error:null,...V?{pendingSessionCreate:O.session.id}:{}}),O.session.providerId&&O.session.providerModel){const D=Zt.getState();D.providers.find(U=>U.id===O.session.providerId)&&D.syncFromSession(O.session.providerId,O.session.providerModel)}break}case"session.list":{const O=r.payload;e(W=>({sessions:Y1(O.sessions,W.sessions,W.currentSession)}));break}case"session.deleted":{const O=r.payload;e(W=>({unreadSessionIds:ka(W.unreadSessionIds,O.sessionId)})),i().listSessions();break}case"session.deletedAll":{i().listSessions();break}case"session.running":{const O=r.payload,W=r.sessionId,V=(o=i().currentSession)==null?void 0:o.id,Q=W&&W!==V;e(te=>({sessions:te.sessions.map(L=>L.id===W?{...L,isRunning:O.isRunning}:L)})),Q||e(te=>({currentSession:te.currentSession?{...te.currentSession,isRunning:O.isRunning}:null,...O.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!At(r,((d=i().currentSession)==null?void 0:d.id)??null)){f();break}const O=r.payload;e(W=>W.messages.some(V=>V.id===O.message.id)?W:{messages:[...W.messages,O.message],streamingMessageId:O.message.isStreaming?O.message.id:W.streamingMessageId,streamingMessage:O.message.isStreaming?O.message:W.streamingMessage});break}case"chat.message_updated":{if(!At(r,((h=i().currentSession)==null?void 0:h.id)??null)){f();break}const O=r.payload,W=O.updates.isStreaming===!1&&i().streamingMessageId===O.messageId;W&&(bi(),en==null||en()),e(V=>{const Q=V.streamingMessage,te=W;if(Q&&Q.id===O.messageId){const L={...Q,...O.updates};return{messages:V.messages.map(D=>D.id===O.messageId?L:D),streamingMessageId:te?null:V.streamingMessageId,streamingMessage:te?null:{...Q,...O.updates}}}return{messages:V.messages.map(L=>L.id===O.messageId?{...L,...O.updates}:L),streamingMessageId:te?null:V.streamingMessageId}});break}case"chat.delta":{if(!At(r,((g=i().currentSession)==null?void 0:g.id)??null)){f();break}const O=r.payload;if(!Ca.has(O.messageId)){Ca.add(O.messageId);const W=Ss(i(),r.sessionId);hx(W)}Bt.messageId=O.messageId,Bt.deltaContent+=O.content,dd();break}case"chat.thinking":{if(!At(r,((p=i().currentSession)==null?void 0:p.id)??null)){f();break}const O=r.payload;if(!Ca.has(O.messageId)){Ca.add(O.messageId);const W=Ss(i(),r.sessionId);hx(W)}Bt.messageId=O.messageId,Bt.thinkingContent+=O.content,dd();break}case"chat.tool_preparing":{if(!At(r,((v=i().currentSession)==null?void 0:v.id)??null)){f();break}const O=r.payload;e(W=>{const V=W.streamingMessage;return V&&V.id===O.messageId?{streamingMessage:{...V,preparingToolCalls:[...V.preparingToolCalls??[],{index:O.index,name:O.name}]}}:{messages:W.messages.map(Q=>Q.id===O.messageId?{...Q,preparingToolCalls:[...Q.preparingToolCalls??[],{index:O.index,name:O.name}]}:Q)}});break}case"chat.tool_call":{if(!At(r,((S=i().currentSession)==null?void 0:S.id)??null)){f();break}const O=r.payload,W=V=>{var L;const Q=(L=V.preparingToolCalls)==null?void 0:L.filter((D,B)=>{var U;return D.name===O.tool?(U=V.preparingToolCalls)==null?void 0:U.slice(0,B).some(Y=>Y.name===O.tool):!0}),te=Bt.toolOutput.filter(D=>D.callId===O.callId);return te.length>0&&(Bt.toolOutput=Bt.toolOutput.filter(D=>D.callId!==O.callId)),{...V,toolCalls:[...V.toolCalls??[],{id:O.callId,name:O.tool,arguments:O.args,startedAt:Date.now(),...te.length>0?{streamingOutput:te.map(D=>({stream:D.stream,content:D.content}))}:{}}],...Q&&Q.length>0?{preparingToolCalls:Q}:{preparingToolCalls:void 0}}};e(V=>{const Q=V.streamingMessage;return Q&&Q.id===O.messageId?{streamingMessage:W(Q)}:{messages:V.messages.map(te=>te.id===O.messageId?W(te):te)}});break}case"chat.tool_output":{if(!At(r,((E=i().currentSession)==null?void 0:E.id)??null)){f();break}const O=r.payload;Bt.messageId=O.messageId,Bt.toolOutput.push({messageId:O.messageId,callId:O.callId,stream:O.stream,content:O.output}),dd();break}case"chat.tool_result":{if(!At(r,((C=i().currentSession)==null?void 0:C.id)??null)){f();break}const O=r.payload,W=V=>{var te;const Q=(te=V.toolCalls)==null?void 0:te.map(L=>L.id===O.callId?{...L,result:O.result}:L);return{...V,toolCalls:Q}};e(V=>{const Q=V.streamingMessage;return Q&&Q.id===O.messageId?{streamingMessage:W(Q)}:{messages:V.messages.map(te=>te.id===O.messageId?W(te):te)}});break}case"chat.vision_fallback":{if(!At(r,((b=i().currentSession)==null?void 0:b.id)??null)){f();break}const O=r.payload;e(W=>{const V=`${O.messageId}-${O.attachmentId}`,Q={...W.visionFallbackByMessage};return Q[V]={type:O.type,attachmentId:O.attachmentId,filename:O.filename,description:O.description},{visionFallbackByMessage:Q}});break}case"chat.todo":{if(!At(r,((x=i().currentSession)==null?void 0:x.id)??null)){f();break}const O=r.payload;e({currentTodos:O.todos});break}case"chat.summary":{if(!At(r,((_=i().currentSession)==null?void 0:_.id)??null)){f();break}const O=r.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,summary:O.summary}:null}));break}case"chat.progress":{if(!At(r,((y=i().currentSession)==null?void 0:y.id)??null)){f();break}const O=r.payload;console.log("Progress:",O.message,O.phase);break}case"chat.format_retry":{if(!At(r,((j=i().currentSession)==null?void 0:j.id)??null)){f();break}const O=r.payload;console.log("Format retry:",O.attempt,"/",O.maxAttempts);break}case"chat.done":{if(!At(r,((A=i().currentSession)==null?void 0:A.id)??null)){f();break}bi(),en==null||en();const O=r.payload,W=O.stats;Bt.messageId=null,Bt.deltaContent="",Bt.thinkingContent="",Bt.toolOutput=[],Ca.delete(O.messageId),e(V=>{const Q=V.streamingMessage,te=Q&&Q.id===O.messageId?{...Q,isStreaming:!1,stats:W??Q.stats}:null;return{messages:V.messages.map(L=>L.id===O.messageId?te??{...L,isStreaming:!1,stats:W??L.stats}:L),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!At(r,((N=i().currentSession)==null?void 0:N.id)??null)){f();break}bi(),en==null||en();const O=r.payload;console.error("Chat error:",O.error,"recoverable:",O.recoverable),O.recoverable||(Bt.messageId=null,Bt.deltaContent="",Bt.thinkingContent="",Bt.toolOutput=[]),e(W=>({error:{code:"CHAT_ERROR",message:O.error},streamingMessageId:O.recoverable?W.streamingMessageId:null,...O.recoverable?{}:{messages:W.streamingMessage?W.messages.map(V=>V.id===W.streamingMessage.id?W.streamingMessage:V):W.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!At(r,((R=i().currentSession)==null?void 0:R.id)??null)){f();break}const O=r.payload;e({pendingPathConfirmation:{callId:O.callId,tool:O.tool,paths:O.paths,workdir:O.workdir,reason:O.reason}});break}case"chat.ask_user":{if(!At(r,((T=i().currentSession)==null?void 0:T.id)??null)){f();return}const O=r.payload;e({pendingQuestion:{callId:O.callId,question:O.question}});break}case"mode.changed":{if(!At(r,((I=i().currentSession)==null?void 0:I.id)??null)){f();break}const O=r.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,mode:O.mode}:null}));break}case"phase.changed":{const O=r.payload,W=r.sessionId,V=(H=i().currentSession)==null?void 0:H.id,Q=W&&W!==V;e(te=>({sessions:te.sessions.map(L=>L.id===W?{...L,phase:O.phase}:L)})),Q||e(te=>({currentSession:te.currentSession?{...te.currentSession,phase:O.phase}:null}));break}case"criteria.updated":{if(!At(r,((G=i().currentSession)==null?void 0:G.id)??null)){f();break}const O=r.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,criteria:O.criteria}:null}));break}case"context.state":{if(!At(r,((K=i().currentSession)==null?void 0:K.id)??null)){f();break}const O=r.payload;console.log("[session.handleServerMessage.context.state] Received context state:",O.context),e({contextState:O.context});break}case"session.name_generated":{const O=r.payload,W=r.sessionId,V=(q=i().currentSession)==null?void 0:q.id;e(Q=>{const te=Q.sessions.map(D=>D.id===W?{...D,title:O.name,updatedAt:new Date().toISOString()}:D),L=V===W?Q.currentSession?{...Q.currentSession,title:O.name,updatedAt:new Date().toISOString()}:null:Q.currentSession;return{sessions:te,currentSession:L}});break}case"queue.state":{const O=r.payload;e({queuedMessages:O.messages});break}case"devServer.output":case"devServer.state":{er.getState().handleMessage(r);break}case"error":{const O=r.payload;console.error("Server error:",O),e({error:{code:O.code,message:O.message},streamingMessageId:null});break}}}}));function Xv(){return Ee(e=>{var i;return((i=e.currentSession)==null?void 0:i.isRunning)??!1})}function X1(){return Ee(e=>e.queuedMessages)}function Z1(){return Ee(e=>e.abortInProgress)}function Q1(){const e=Ee(s=>s.connect),i=Ee(s=>s.connectionStatus),r=wi(s=>s.load);return F.useEffect(()=>{e()},[e]),F.useEffect(()=>{i==="connected"&&r()},[i,r]),{connectionStatus:i}}const qt=Yn((e,i)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await fetch("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(r,s)=>{try{const l=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,workdir:s})});if(!l.ok)return null;const f=await l.json();return await i().listProjects(),f.project}catch{return null}},loadProject:async r=>{try{const s=await fetch(`/api/projects/${r}`);if(!s.ok)return null;const l=await s.json();return e({currentProject:l.project}),i().projects.length===0&&await i().listProjects(),l.project}catch{return null}},updateProject:async(r,s)=>{var l;try{const f=await fetch(`/api/projects/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!f.ok)return null;const m=await f.json();return((l=i().currentProject)==null?void 0:l.id)===r&&e({currentProject:m.project}),await i().listProjects(),m.project}catch{return null}},deleteProject:async r=>{var s;try{return(await fetch(`/api/projects/${r}`,{method:"DELETE"})).ok?(await i().listProjects(),((s=i().currentProject)==null?void 0:s.id)===r&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));function zd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const i=Math.random()*16|0;return(e==="x"?i:i&3|8).toString(16)})}function mx(e,i){const r=gn.ws;!r||r.readyState!==WebSocket.OPEN||r.send(JSON.stringify({id:zd(),type:e,payload:i}))}const nr=Yn((e,i)=>({isOpen:!1,sessions:[],workdir:null,setOpen:r=>e({isOpen:r}),toggleOpen:()=>e(r=>({isOpen:!r.isOpen})),setWorkdir:r=>e({workdir:r}),fetchSessions:async()=>{try{const r=await fetch("/api/terminals");if(r.ok){const s=await r.json();e({sessions:s});const l=gn.ws;if(l&&l.readyState===WebSocket.OPEN)for(const f of s)l.send(JSON.stringify({id:zd(),type:"terminal.subscribe",payload:{sessionId:f.id}}))}}catch(r){console.error("Failed to fetch terminals:",r)}},createSession:async r=>{try{const s=await fetch("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:r??i().workdir??void 0})});if(s.ok){const l=await s.json();e(m=>({sessions:[...m.sessions,l]}));const f=gn.ws;f&&f.readyState===WebSocket.OPEN&&f.send(JSON.stringify({id:zd(),type:"terminal.subscribe",payload:{sessionId:l.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(r,s)=>{mx("terminal.write",{sessionId:r,data:s})},resizeSession:(r,s,l)=>{mx("terminal.resize",{sessionId:r,cols:s,rows:l})},killSession:async r=>{try{(await fetch(`/api/terminals/${r}`,{method:"DELETE"})).ok&&e(l=>({sessions:l.sessions.filter(f=>f.id!==r)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:r=>{r.type}}));gn.subscribe(e=>{var i;(i=e.type)!=null&&i.startsWith("terminal.")&&nr.getState().handleMessage(e)});var ah=Hv();function xn({isOpen:e,onClose:i,title:r,children:s,size:l="md"}){const f=F.useRef(null),m=F.useRef(null),o=F.useCallback(h=>{h.key==="Escape"&&i()},[i]);if(F.useEffect(()=>{var h,g;return e?(m.current=document.activeElement,(h=f.current)==null||h.focus(),document.body.style.overflow="hidden"):((g=m.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),F.useEffect(()=>{if(e)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,o]),!e)return null;const d={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return ah.createPortal(c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[c.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:i}),c.jsxs("div",{ref:f,tabIndex:-1,className:`relative w-full ${d[l]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[c.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:r}),c.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const xt=F.forwardRef(({variant:e="secondary",size:i="md",className:r="",children:s,...l},f)=>{const m="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",o={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 c.jsx("button",{ref:f,className:`${m} ${o[e]} ${d[i]} ${r}`,...l,children:s})});xt.displayName="Button";function J1(e){const i=new Audio(e);i.volume=.5,i.play().catch(()=>{})}function Zv({value:e,defaultUrl:i,disabled:r,onChange:s}){const l=e??i;return c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("select",{value:l,disabled:r,onChange:f=>{const m=f.target.value;s(m===i?null:m)},className:"px-2 py-1 text-xs bg-bg-tertiary border border-border rounded focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40",children:B1.map(({url:f,label:m})=>c.jsxs("option",{value:f,children:[m,f===i?" (default)":""]},f))}),c.jsx("button",{onClick:()=>J1(l),disabled:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:"Preview sound",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072M17.95 6.05a8 8 0 010 11.9M6.5 8.8h-2a1 1 0 00-1 1v4.4a1 1 0 001 1h2l4.5 3.5V5.3L6.5 8.8z"})})})]})}function eS(){const e=wi(d=>d.settings),i=wi(d=>d.update),r=wi(d=>d.updateEvent),s=wi(d=>d.updateAgentOverride),l=wi(d=>d.load),[f,m]=F.useState(null);F.useEffect(()=>{l()},[l]);const o=async()=>{await z1()==="granted"&&i({...e,browserNotificationEnabled:!0})};return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),c.jsx(gx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>i({...e,soundEnabled:d})}),c.jsx(gx,{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"?o():i({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&c.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Event Configuration"}),lx.map(({key:d,label:h,description:g})=>c.jsx(tS,{event:d,label:h,description:g,config:e.events[d],onUpdate:p=>r(d,p),soundMasterEnabled:e.soundEnabled,browserMasterEnabled:e.browserNotificationEnabled},d))]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Per-Agent Overrides"}),c.jsx("p",{className:"text-xs text-text-muted",children:"Override notification settings for specific agent types. Unconfigured events use the global defaults above."}),O1.map(({key:d,label:h})=>c.jsxs("div",{className:"border border-border rounded",children:[c.jsxs("button",{className:"w-full flex items-center justify-between px-3 py-2 text-sm text-text-secondary hover:bg-bg-tertiary transition-colors rounded",onClick:()=>m(f===d?null:d),children:[c.jsx("span",{className:"font-medium",children:h}),c.jsx("svg",{className:`w-4 h-4 transition-transform ${f===d?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f===d&&c.jsx("div",{className:"px-3 pb-3 space-y-3 border-t border-border pt-2",children:lx.map(({key:g,label:p})=>{var b;const v=(b=e.agentOverrides[d])==null?void 0:b[g],S=v!==void 0,E=Yv(e,g,d),C=sh[g];return c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("input",{type:"checkbox",checked:S,onChange:x=>{x.target.checked?s(d,g,{soundEnabled:E.soundEnabled,browserNotification:E.browserNotification}):s(d,g,null)},className:"rounded border-border"}),c.jsx("span",{className:`flex-1 ${S?"text-text-primary":"text-text-muted"}`,children:p}),S&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:E.soundEnabled,onChange:x=>s(d,g,{soundEnabled:x.target.checked}),className:"rounded border-border"}),"Sound"]}),c.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:E.browserNotification,onChange:x=>s(d,g,{browserNotification:x.target.checked}),className:"rounded border-border"}),"Browser"]})]})]}),S&&E.soundEnabled&&c.jsx("div",{className:"ml-6",children:c.jsx(Zv,{value:(v==null?void 0:v.customSoundUrl)??null,defaultUrl:C,onChange:x=>s(d,g,{customSoundUrl:x})})})]},g)})})]},d))]})]})}function gx({label:e,description:i,checked:r,onChange:s}){return c.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[c.jsx("div",{className:"pt-0.5",children:c.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${r?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:l=>{l.preventDefault(),s(!r)},children:c.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${r?"translate-x-4":"translate-x-0.5"}`})})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),c.jsx("div",{className:"text-xs text-text-muted",children:i})]})]})}function tS({event:e,label:i,description:r,config:s,onUpdate:l,soundMasterEnabled:f,browserMasterEnabled:m}){return c.jsxs("div",{className:"border border-border rounded px-3 py-2 space-y-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm text-text-primary",children:i}),c.jsx("div",{className:"text-xs text-text-muted",children:r})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:s.soundEnabled,onChange:o=>l({soundEnabled:o.target.checked}),disabled:!f,className:"rounded border-border"}),"Sound ",!f&&c.jsx("span",{className:"text-text-muted",children:"(master off)"})]}),c.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:s.browserNotification,onChange:o=>l({browserNotification:o.target.checked}),disabled:!m,className:"rounded border-border"}),"Browser notification ",!m&&c.jsx("span",{className:"text-text-muted",children:"(master off)"})]})]}),s.soundEnabled&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-text-muted",children:"Sound:"}),c.jsx(Zv,{value:s.customSoundUrl,defaultUrl:sh[e],disabled:!f,onChange:o=>l({customSoundUrl:o})})]})]})}const Qv=F.forwardRef(({icon:e,iconSize:i="w-3.5 h-3.5",className:r="",...s},l)=>c.jsx("button",{ref:l,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${r}`,...s,children:c.jsx("svg",{className:i,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));Qv.displayName="IconButton";const nS="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",Jr=F.forwardRef((e,i)=>c.jsx(Qv,{ref:i,icon:nS,title:"Edit",...e}));Jr.displayName="EditButton";const Wn=Yn((e,i)=>({skills:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await fetch("/api/skills/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchSkills:async()=>{e({loading:!0});try{const s=await(await fetch("/api/skills")).json();e({skills:s.skills??[],defaultIds:s.defaultIds??i().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},toggleSkill:async r=>{try{const l=await(await fetch(`/api/skills/${r}/toggle`,{method:"POST"})).json();e({skills:i().skills.map(f=>f.id===r?{...f,enabled:l.enabled}:f)})}catch{}},fetchSkill:async r=>{try{const s=await fetch(`/api/skills/${r}`);return s.ok?await s.json():null}catch{return null}},createSkill:async r=>{try{const s=await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return s.ok?(await i().fetchSkills(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateSkill:async(r,s)=>{try{const l=await fetch(`/api/skills/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await i().fetchSkills(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteSkill:async r=>{try{return(await fetch(`/api/skills/${r}`,{method:"DELETE"})).ok?(e({skills:i().skills.filter(l=>l.id!==r)}),!0):!1}catch{return!1}},restoreDefault:async r=>{try{return(await fetch(`/api/skills/${r}/restore-default`,{method:"POST"})).ok?(await i().fetchSkills(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await fetch("/api/skills/restore-all-defaults",{method:"POST"})).ok?(await i().fetchSkills(),!0):!1}catch{return!1}}}));function rS(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function iS({isOpen:e}){const i=Wn(Z=>Z.skills),r=Wn(Z=>Z.modifiedIds),s=Wn(Z=>Z.loading),l=Wn(Z=>Z.fetchSkills),f=Wn(Z=>Z.toggleSkill),m=Wn(Z=>Z.fetchSkill),o=Wn(Z=>Z.createSkill),d=Wn(Z=>Z.updateSkill),h=Wn(Z=>Z.deleteSkill),g=Wn(Z=>Z.restoreDefault),p=Wn(Z=>Z.restoreAllDefaults),[v,S]=F.useState("list"),[E,C]=F.useState(null),[b,x]=F.useState(null),[_,y]=F.useState(""),[j,A]=F.useState(""),[N,R]=F.useState(""),[T,I]=F.useState("1.0.0"),[H,G]=F.useState(""),[K,q]=F.useState(""),[O,W]=F.useState(!1),[V,Q]=F.useState(null),[te,L]=F.useState(!1);F.useEffect(()=>{e&&(l(),S("list"),C(null),x(null),Q(null),L(!1))},[e,l]);const D=()=>{C(null),y(""),A(""),R(""),I("1.0.0"),G(""),q(""),S("edit")},B=async Z=>{const X=await m(Z);X&&(C(Z),y(X.metadata.name),A(X.metadata.id),R(X.metadata.description),I(X.metadata.version),G(X.prompt),q(""),S("edit"))},U=async Z=>{await h(Z),x(null)},P=async()=>{const Z=E??j;if(!Z||!_||!H){q("Name and prompt are required.");return}W(!0),q("");const X={metadata:{id:Z,name:_,description:N,version:T||"1.0.0"},prompt:H},z=E?await d(E,X):await o(X);if(W(!1),!z.success){q(z.error??"Failed to save skill.");return}S("list")},Y=()=>{S("list")},ne=Z=>{y(Z),E||A(rS(Z))};return v==="edit"?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("button",{onClick:Y,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Back to list",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsx("span",{className:"text-sm font-medium text-text-primary",children:E?"Edit Skill":"New Skill"})]}),K&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:K}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:_,onChange:Z=>ne(Z.target.value),placeholder:"My Skill",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",E&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:j,onChange:Z=>!E&&A(Z.target.value),readOnly:!!E,placeholder:"my-skill",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${E?"opacity-60":""}`})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),c.jsx("input",{value:N,onChange:Z=>R(Z.target.value),placeholder:"Short description of what this skill provides",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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Version"}),c.jsx("input",{value:T,onChange:Z=>I(Z.target.value),placeholder:"1.0.0",className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]})]}),c.jsxs("div",{className:"flex-1 min-h-[150px] mt-3 overflow-hidden",children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),c.jsx("textarea",{value:H,onChange:Z=>G(Z.target.value),placeholder:"Instructions the agent receives when this skill is loaded...",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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[c.jsx(xt,{variant:"secondary",onClick:Y,children:"Cancel"}),c.jsx(xt,{variant:"primary",onClick:P,disabled:O||!_||!H,children:O?"Saving...":"Save"})]})]}):c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Skills provide domain-specific knowledge that agents can load on demand."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[r.length>0&&(te?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await p(),L(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),c.jsx("button",{onClick:()=>L(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>L(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all skills to defaults",children:"Restore Defaults"})),c.jsx(xt,{variant:"primary",size:"sm",onClick:D,children:"+ New"})]})]}),s&&i.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading skills..."}):i.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No skills installed."}):c.jsx("div",{className:"space-y-2",children:i.map(Z=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:Z.name}),c.jsxs("span",{className:"text-text-muted text-xs",children:["v",Z.version]}),r.includes(Z.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:Z.description})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r.includes(Z.id)&&(V===Z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await g(Z.id),Q(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),c.jsx("button",{onClick:()=>Q(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Q(Z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(Jr,{onClick:()=>B(Z.id)}),b===Z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>U(Z.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:()=>x(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>x(Z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete skill",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("button",{onClick:()=>f(Z.id),className:`relative w-9 h-5 rounded-full transition-colors flex-shrink-0 ml-1 ${Z.enabled?"bg-accent-primary":"bg-bg-primary"}`,title:Z.enabled?"Disable skill":"Enable skill",children:c.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Z.enabled?"translate-x-4":"translate-x-0"}`})})]})]},Z.id))})]})}function sS({isOpen:e,onClose:i}){const[r,s]=F.useState("instructions");return c.jsx(xn,{isOpen:e,onClose:i,title:"Settings",size:"lg",children:c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[c.jsx(hd,{label:"Instructions",active:r==="instructions",onClick:()=>s("instructions")}),c.jsx(hd,{label:"Skills",active:r==="skills",onClick:()=>s("skills")}),c.jsx(hd,{label:"Notifications",active:r==="notifications",onClick:()=>s("notifications")})]}),r==="instructions"&&c.jsx(aS,{isOpen:e}),r==="skills"&&c.jsx(iS,{isOpen:e}),r==="notifications"&&c.jsx(eS,{})]})})}function hd({label:e,active:i,onClick:r}){return c.jsx("button",{onClick:r,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${i?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function aS({isOpen:e}){const i=Zr(b=>b.settings),r=Zr(b=>b.loading),s=Zr(b=>b.getSetting),l=Zr(b=>b.setSetting),f=i[Xr.GLOBAL_INSTRUCTIONS]??"",m=r[Xr.GLOBAL_INSTRUCTIONS]??!1,[o,d]=F.useState(f),[h,g]=F.useState(!1),[p,v]=F.useState(!1);F.useEffect(()=>{e&&s(Xr.GLOBAL_INSTRUCTIONS)},[e,s]),F.useEffect(()=>{d(f),g(!1)},[f]);const S=async()=>{v(!0),l(Xr.GLOBAL_INSTRUCTIONS,o),v(!1),g(!1)},E=()=>{d(f),g(!1)},C=m||p;return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),c.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),c.jsx("textarea",{value:o,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})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(xt,{variant:"secondary",onClick:E,disabled:!h,children:"Discard"}),c.jsx(xt,{variant:"primary",onClick:S,disabled:!h||C,children:p?"Saving...":"Save"})]})]})}var fd={exports:{}},xx;function oS(){return xx||(xx=1,(function(e,i){(function(r,s){e.exports=s()})(globalThis,(()=>(()=>{var r={4567:function(m,o,d){var h=this&&this.__decorate||function(_,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,y,j,A);else for(var I=_.length-1;I>=0;I--)(N=_[I])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(_,y){return function(j,A){y(j,A,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const p=d(9042),v=d(9924),S=d(844),E=d(4725),C=d(2585),b=d(3656);let x=o.AccessibilityManager=class extends S.Disposable{constructor(_,y,j,A){super(),this._terminal=_,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 v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
58
+ `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(_){for(let y=0;y<_;y++)this._handleChar(" ")}_handleChar(_){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==_&&(this._charsToAnnounce+=_):this._charsToAnnounce+=_,_===`
59
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=p.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(_){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(_)||this._charsToConsume.push(_)}_refreshRows(_,y){this._liveRegionDebouncer.refresh(_,y,this._terminal.rows)}_renderRows(_,y){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=_;N<=y;N++){const R=j.lines.get(j.ydisp+N),T=[],I=(R==null?void 0:R.translateToString(!0,void 0,void 0,T))||"",H=(j.ydisp+N+1).toString(),G=this._rowElements[N];G&&(I.length===0?(G.innerText=" ",this._rowColumns.set(G,[0,1])):(G.textContent=I,this._rowColumns.set(G,T)),G.setAttribute("aria-posinset",H),G.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(_,y){const j=_.target,A=this._rowElements[y===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||_.relatedTarget!==A)return;let N,R;if(y===0?(N=j,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(N=this._rowElements.shift(),R=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),y===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(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),_.preventDefault(),_.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const _=document.getSelection();if(!_)return;if(_.isCollapsed)return void(this._rowContainer.contains(_.anchorNode)&&this._terminal.clearSelection());if(!_.anchorNode||!_.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:_.anchorNode,offset:_.anchorOffset},j={node:_.focusNode,offset:_.focusOffset};if((y.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===j.node&&y.offset>j.offset)&&([y,j]=[j,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:H,offset:G})=>{const K=H instanceof Text?H.parentNode:H;let q=parseInt(K==null?void 0:K.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(K);if(!O)return console.warn("columns is null. Race condition?"),null;let W=G<O.length?O[G]:O.slice(-1)[0]+1;return W>=this._terminal.cols&&(++q,W=0),{row:q,column:W}},R=N(y),T=N(j);if(R&&T){if(R.row>T.row||R.row===T.row&&R.column>=T.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(T.row-R.row)*this._terminal.cols-R.column+T.column)}}_handleResize(_){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);for(;this._rowElements.length>_;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const _=this._coreBrowserService.mainDocument.createElement("div");return _.setAttribute("role","listitem"),_.tabIndex=-1,this._refreshRowDimensions(_),_}_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 _=0;_<this._terminal.rows;_++)this._refreshRowDimensions(this._rowElements[_])}}_refreshRowDimensions(_){_.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=x=h([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],x)},3614:(m,o)=>{function d(v){return v.replace(/\r?\n/g,"\r")}function h(v,S){return S?"\x1B[200~"+v+"\x1B[201~":v}function g(v,S,E,C){v=h(v=d(v),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(v,!0),S.value=""}function p(v,S,E){const C=E.getBoundingClientRect(),b=v.clientX-C.left-10,x=v.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${b}px`,S.style.top=`${x}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=d,o.bracketTextForPaste=h,o.copyHandler=function(v,S){v.clipboardData&&v.clipboardData.setData("text/plain",S.selectionText),v.preventDefault()},o.handlePasteEvent=function(v,S,E,C){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),S,E,C)},o.paste=g,o.moveTextAreaUnderMouseCursor=p,o.rightClickHandler=function(v,S,E,C,b){p(v,S,E),b&&C.rightClickSelect(v),S.value=C.selectionText,S.select()}},7239:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const h=d(1505);o.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(g,p,v){this._css.set(g,p,v)}getCss(g,p){return this._css.get(g,p)}setColor(g,p,v){this._color.set(g,p,v)}getColor(g,p){return this._color.get(g,p)}clear(){this._color.clear(),this._css.clear()}}},3656:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(d,h,g,p){d.addEventListener(h,g,p);let v=!1;return{dispose:()=>{v||(v=!0,d.removeEventListener(h,g,p))}}}},3551:function(m,o,d){var h=this&&this.__decorate||function(x,_,y,j){var A,N=arguments.length,R=N<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(x,_,y,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(R=(N<3?A(R):N>3?A(_,y,R):A(_,y))||R);return N>3&&R&&Object.defineProperty(_,y,R),R},g=this&&this.__param||function(x,_){return function(y,j){_(y,j,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const p=d(3656),v=d(8460),S=d(844),E=d(2585),C=d(4725);let b=o.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(x,_,y,j,A){super(),this._element=x,this._mouseService=_,this._renderService=y,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(x){this._lastMouseEvent=x;const _=this._positionFromMouseEvent(x,this._element,this._mouseService);if(!_)return;this._isMouseOut=!1;const y=x.composedPath();for(let j=0;j<y.length;j++){const A=y[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&_.x===this._lastBufferCell.x&&_.y===this._lastBufferCell.y||(this._handleHover(_),this._lastBufferCell=_)}_handleHover(x){if(this._activeLine!==x.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(x,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,x)||(this._clearCurrentLink(),this._askForLink(x,!0))}_askForLink(x,_){var j,A;this._activeProviderReplies&&_||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=x.y);let y=!1;for(const[N,R]of this._linkProviderService.linkProviders.entries())_?(A=this._activeProviderReplies)!=null&&A.get(N)&&(y=this._checkLinkProviderResult(N,x,y)):R.provideLinks(x.y,(T=>{var H,G;if(this._isMouseOut)return;const I=T==null?void 0:T.map((K=>({link:K})));(H=this._activeProviderReplies)==null||H.set(N,I),y=this._checkLinkProviderResult(N,x,y),((G=this._activeProviderReplies)==null?void 0:G.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(x.y,this._activeProviderReplies)}))}_removeIntersectingLinks(x,_){const y=new Set;for(let j=0;j<_.size;j++){const A=_.get(j);if(A)for(let N=0;N<A.length;N++){const R=A[N],T=R.link.range.start.y<x?0:R.link.range.start.x,I=R.link.range.end.y>x?this._bufferService.cols:R.link.range.end.x;for(let H=T;H<=I;H++){if(y.has(H)){A.splice(N--,1);break}y.add(H)}}}}_checkLinkProviderResult(x,_,y){var N;if(!this._activeProviderReplies)return y;const j=this._activeProviderReplies.get(x);let A=!1;for(let R=0;R<x;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(A=!0);if(!A&&j){const R=j.find((T=>this._linkAtPosition(T.link,_)));R&&(y=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let R=0;R<this._activeProviderReplies.size;R++){const T=(N=this._activeProviderReplies.get(R))==null?void 0:N.find((I=>this._linkAtPosition(I.link,_)));if(T){y=!0,this._handleNewLink(T);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(x){if(!this._currentLink)return;const _=this._positionFromMouseEvent(x,this._element,this._mouseService);_&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,_)&&this._currentLink.link.activate(x,this._currentLink.link.text)}_clearCurrentLink(x,_){this._currentLink&&this._lastMouseEvent&&(!x||!_||this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=_)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(x){if(!this._lastMouseEvent)return;const _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._linkAtPosition(x.link,_)&&(this._currentLink=x,this._currentLink.state={decorations:{underline:x.link.decorations===void 0||x.link.decorations.underline,pointerCursor:x.link.decorations===void 0||x.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,x.link,this._lastMouseEvent),x.link.decorations={},Object.defineProperties(x.link.decorations,{pointerCursor:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.pointerCursor},set:y=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.underline},set:y=>{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)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(x.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const j=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+y.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(x,_,y){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!0),this._currentLink.state.decorations.pointerCursor&&x.classList.add("xterm-cursor-pointer")),_.hover&&_.hover(y,_.text)}_fireUnderlineEvent(x,_){const y=x.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-j-1,y.end.x,y.end.y-j-1,void 0);(_?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(x,_,y){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!1),this._currentLink.state.decorations.pointerCursor&&x.classList.remove("xterm-cursor-pointer")),_.leave&&_.leave(y,_.text)}_linkAtPosition(x,_){const y=x.range.start.y*this._bufferService.cols+x.range.start.x,j=x.range.end.y*this._bufferService.cols+x.range.end.x,A=_.y*this._bufferService.cols+_.x;return y<=A&&A<=j}_positionFromMouseEvent(x,_,y){const j=y.getCoords(x,_,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(x,_,y,j,A){return{x1:x,y1:_,x2:y,y2:j,cols:this._bufferService.cols,fg:A}}};o.Linkifier=b=h([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],b)},9042:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(m,o,d){var h=this&&this.__decorate||function(C,b,x,_){var y,j=arguments.length,A=j<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,x,_);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,x,A):y(b,x))||A);return j>3&&A&&Object.defineProperty(b,x,A),A},g=this&&this.__param||function(C,b){return function(x,_){b(x,_,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const p=d(511),v=d(2585);let S=o.OscLinkProvider=class{constructor(C,b,x){this._bufferService=C,this._optionsService=b,this._oscLinkService=x}provideLinks(C,b){var I;const x=this._bufferService.buffer.lines.get(C-1);if(!x)return void b(void 0);const _=[],y=this._optionsService.rawOptions.linkHandler,j=new p.CellData,A=x.getTrimmedLength();let N=-1,R=-1,T=!1;for(let H=0;H<A;H++)if(R!==-1||x.hasContent(H)){if(x.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(R===-1){R=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else R!==-1&&(T=!0);if(T||R!==-1&&H===A-1){const G=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(G){const K={start:{x:R+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let q=!1;if(!(y!=null&&y.allowNonHttpProtocols))try{const O=new URL(G);["http:","https:"].includes(O.protocol)||(q=!0)}catch{q=!0}q||_.push({text:G,range:K,activate:(O,W)=>y?y.activate(O,W,K):E(0,W),hover:(O,W)=>{var V;return(V=y==null?void 0:y.hover)==null?void 0:V.call(y,O,W,K)},leave:(O,W)=>{var V;return(V=y==null?void 0:y.leave)==null?void 0:V.call(y,O,W,K)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(R=H,N=j.extended.urlId):(R=-1,N=-1)}}b(_)}};function E(C,b){if(confirm(`Do you want to navigate to ${b}?
60
+
61
+ WARNING: This link could potentially be dangerous`)){const x=window.open();if(x){try{x.opener=null}catch{}x.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=S=h([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.IOscLinkService)],S)},6193:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(d,h){this._renderCallback=d,this._coreBrowserService=h,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,h,g){this._rowCount=g,d=d!==void 0?d:0,h=h!==void 0?h: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,h):h,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),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const h=d(3614),g=d(3656),p=d(3551),v=d(9042),S=d(3730),E=d(1680),C=d(3107),b=d(5744),x=d(2950),_=d(1296),y=d(428),j=d(4269),A=d(5114),N=d(8934),R=d(3230),T=d(9312),I=d(4725),H=d(6731),G=d(8055),K=d(8969),q=d(8460),O=d(844),W=d(6114),V=d(8437),Q=d(2584),te=d(7399),L=d(5941),D=d(9074),B=d(2585),U=d(5435),P=d(4567),Y=d(779);class ne 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(X={}){super(X),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new q.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new q.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new q.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new q.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new q.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new q.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new q.EventEmitter),this._onBlur=this.register(new q.EventEmitter),this._onA11yCharEmitter=this.register(new q.EventEmitter),this._onA11yTabEmitter=this.register(new q.EventEmitter),this._onWillOpen=this.register(new q.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Y.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((z,ae)=>this.refresh(z,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),this.register((0,q.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,q.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((z=>this._afterResize(z.cols,z.rows)))),this.register((0,O.toDisposable)((()=>{var z,ae;this._customKeyEventHandler=void 0,(ae=(z=this.element)==null?void 0:z.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const z of X){let ae,se="";switch(z.index){case 256:ae="foreground",se="10";break;case 257:ae="background",se="11";break;case 258:ae="cursor",se="12";break;default:ae="ansi",se="4;"+z.index}switch(z.type){case 0:const ge=G.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${se};${(0,L.toRgbString)(ge)}${Q.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((be=>be.ansi[z.index]=G.channels.toColor(...z.color)));else{const be=ae;this._themeService.modifyColors((je=>je[be]=G.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,z=this.buffer.lines.get(X);if(!z)return;const ae=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ge=z.getWidth(ae),be=this._renderService.dimensions.css.cell.width*ge,je=this.buffer.y*this._renderService.dimensions.css.cell.height,Te=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Te+"px",this.textarea.style.top=je+"px",this.textarea.style.width=be+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(z=>{this.hasSelection()&&(0,h.copyHandler)(z,this._selectionService)})));const X=z=>(0,h.handlePasteEvent)(z,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),W.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(z=>{z.button===2&&(0,h.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,h.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,h.moveTextAreaUnderMouseCursor)(z,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ae;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((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=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.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",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),W.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,X.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",(se=>this._handleTextAreaFocus(se)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(H.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(x.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(p.Linkifier,this.screenElement)),this.element.appendChild(z);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((se=>this.scrollLines(se.amount,se.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((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{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",(se=>this._selectionService.handleMouseDown(se)))),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(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&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(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,z=this.element;function ae(be){const je=X._mouseService.getMouseReportCoords(be,X.screenElement);if(!je)return!1;let Te,Le;switch(be.overrideType||be.type){case"mousemove":Le=32,be.buttons===void 0?(Te=3,be.button!==void 0&&(Te=be.button<3?be.button:3)):Te=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":Le=0,Te=be.button<3?be.button:3;break;case"mousedown":Le=1,Te=be.button<3?be.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(be)===!1||X.viewport.getLinesScrolled(be)===0)return!1;Le=be.deltaY<0?0:1,Te=4;break;default:return!1}return!(Le===void 0||Te===void 0||Te>4)&&X.coreMouseService.triggerMouseEvent({col:je.col,row:je.row,x:je.x,y:je.y,button:Te,action:Le,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:be=>(ae(be),be.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(be)),wheel:be=>(ae(be),this.cancel(be,!0)),mousedrag:be=>{be.buttons&&ae(be)},mousemove:be=>{be.buttons||ae(be)}};this.register(this.coreMouseService.onProtocolChange((be=>{be?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(be)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&be?se.mousemove||(z.addEventListener("mousemove",ge.mousemove),se.mousemove=ge.mousemove):(z.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&be?se.wheel||(z.addEventListener("wheel",ge.wheel,{passive:!1}),se.wheel=ge.wheel):(z.removeEventListener("wheel",se.wheel),se.wheel=null),2&be?se.mouseup||(se.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&be?se.mousedrag||(se.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(z,"mousedown",(be=>{if(be.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(be))return ae(be),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(be)}))),this.register((0,g.addDisposableDomListener)(z,"wheel",(be=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(be)===!1)return!1;if(!this.buffer.hasScrollback){const je=this.viewport.getLinesScrolled(be);if(je===0)return;const Te=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let Le="";for(let Pe=0;Pe<Math.abs(je);Pe++)Le+=Te;return this.coreService.triggerDataEvent(Le,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(z,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(z,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(X,z){var ae;(ae=this._renderService)==null||ae.refreshRows(X,z)}updateCursorStyle(X){var z;(z=this._selectionService)!=null&&z.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,z,ae=0){var se;ae===1?(super.scrollLines(X,z,ae),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(X)}paste(X){(0,h.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const z=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),z}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,z,ae){this._selectionService.setSelection(X,z,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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,z){var ae;(ae=this._selectionService)==null||ae.selectLines(X,z)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!z&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,te.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ae.type===3||ae.type===2){const se=this.rows-1;return this.scrollLines(ae.type===2?-se:se),this.cancel(X,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ae.cancel&&this.cancel(X,!0),!ae.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==Q.C0.ETX&&ae.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,z){const ae=X.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||X.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||X.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?ae:ae&&(!z.keyCode||z.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)z=X.charCode;else if(X.which===null||X.which===void 0)z=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;z=X.which}return!(!z||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const z=X.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(X),!0}return!1}resize(X,z){X!==this.cols||z!==this.rows?super.resize(X,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,z){var ae,se;(ae=this._charSizeService)==null||ae.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let z=1;z<this.rows;z++)this.buffer.lines.push(this.buffer.getBlankLine(V.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var z,ae;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Q.C0.ESC+"[I"):this.coreService.triggerDataEvent(Q.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[4;${ae};${z}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[6;${ge};${se}t`)}}cancel(X,z){if(this.options.cancelEvents||z)return X.preventDefault(),X.stopPropagation(),!1}}o.Terminal=ne},9924:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(d,h=1e3){this._renderCallback=d,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,h,g){this._rowCount=g,d=d!==void 0?d:0,h=h!==void 0?h: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,h):h;const p=Date.now();if(p-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=p,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=p-this._lastRefreshMs,S=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,h)}}},1680:function(m,o,d){var h=this&&this.__decorate||function(x,_,y,j){var A,N=arguments.length,R=N<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(x,_,y,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(R=(N<3?A(R):N>3?A(_,y,R):A(_,y))||R);return N>3&&R&&Object.defineProperty(_,y,R),R},g=this&&this.__param||function(x,_){return function(y,j){_(y,j,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const p=d(3656),v=d(4725),S=d(8460),E=d(844),C=d(2585);let b=o.Viewport=class extends E.Disposable{constructor(x,_,y,j,A,N,R,T){super(),this._viewportElement=x,this._scrollArea=_,this._bufferService=y,this._optionsService=j,this._charSizeService=A,this._renderService=N,this._coreBrowserService=R,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,p.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(x){this._viewportElement.style.backgroundColor=x.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(x){if(x)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 _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const x=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==x&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=x),this._refreshAnimationFrame=null}syncScrollArea(x=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(x);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(x)}_handleScroll(x){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 _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const x=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(x*(this._smoothScrollState.target-this._smoothScrollState.origin)),x<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(x,_){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&y<this._lastRecordedBufferHeight)||(x.cancelable&&x.preventDefault(),!1)}handleWheel(x){const _=this._getPixelsScrolled(x);return _!==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+_:this._smoothScrollState.target+=_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=_,this._bubbleScroll(x,_))}scrollLines(x){if(x!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const _=x*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!1})}_getPixelsScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let _=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_LINE?_*=this._currentRowHeight:x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._currentRowHeight*this._bufferService.rows),_}getBufferElements(x,_){var T;let y,j="";const A=[],N=_??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let I=x;I<N;I++){const H=R.get(I);if(!H)continue;const G=(T=R.get(I+1))==null?void 0:T.isWrapped;if(j+=H.translateToString(!G),!G||I===R.length-1){const K=document.createElement("div");K.textContent=j,A.push(K),j.length>0&&(y=K),j=""}}return{bufferElements:A,cursorElement:y}}getLinesScrolled(x){if(x.deltaY===0||x.shiftKey)return 0;let _=this._applyScrollModifier(x.deltaY,x);return x.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):x.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(x,_){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&_.altKey||y==="ctrl"&&_.ctrlKey||y==="shift"&&_.shiftKey?x*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:x*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(x){this._lastTouchY=x.touches[0].pageY}handleTouchMove(x){const _=this._lastTouchY-x.touches[0].pageY;return this._lastTouchY=x.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(x,_))}};o.Viewport=b=h([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],b)},3107:function(m,o,d){var h=this&&this.__decorate||function(C,b,x,_){var y,j=arguments.length,A=j<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,x,_);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,x,A):y(b,x))||A);return j>3&&A&&Object.defineProperty(b,x,A),A},g=this&&this.__param||function(C,b){return function(x,_){b(x,_,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const p=d(4725),v=d(844),S=d(2585);let E=o.BufferDecorationRenderer=class extends v.Disposable{constructor(C,b,x,_,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=x,this._decorationService=_,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((j=>this._removeDecoration(j)))),this.register((0,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var _;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((_=C==null?void 0:C.options)==null?void 0:_.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 x=C.options.x??0;return x&&x>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 x=this._decorationElements.get(C);x||(x=this._createElement(C),C.element=x,this._decorationElements.set(C,x),this._container.appendChild(x),C.onDispose((()=>{this._decorationElements.delete(C),x.remove()}))),x.style.top=b*this._renderService.dimensions.css.cell.height+"px",x.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(x)}}_refreshXPosition(C,b=C.element){if(!b)return;const x=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=x?x*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=x?x*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()}};o.BufferDecorationRenderer=E=h([g(1,S.IBufferService),g(2,p.ICoreBrowserService),g(3,S.IDecorationService),g(4,p.IRenderService)],E)},5871:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const h of this._zones)if(h.color===d.options.overviewRulerOptions.color&&h.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,d.marker.line))return;if(this._lineAdjacentToZone(h,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(h,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,h){return h>=d.startBufferLine&&h<=d.endBufferLine}_lineAdjacentToZone(d,h,g){return h>=d.startBufferLine-this._linePadding[g||"full"]&&h<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,h){d.startBufferLine=Math.min(d.startBufferLine,h),d.endBufferLine=Math.max(d.endBufferLine,h)}}},5744:function(m,o,d){var h=this&&this.__decorate||function(y,j,A,N){var R,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(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(R=y[H])&&(I=(T<3?R(I):T>3?R(j,A,I):R(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const p=d(5871),v=d(4725),S=d(844),E=d(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},x={full:0,left:0,center:0,right:0};let _=o.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,j,A,N,R,T,I){var G;super(),this._viewportElement=y,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=R,this._optionsService=T,this._coreBrowserService=I,this._colorZoneStore=new p.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(),(G=this._viewportElement.parentElement)==null||G.insertBefore(this._canvas,this._viewportElement);const H=this._canvas.getContext("2d");if(!H)throw new Error("Ctx cannot be null");this._ctx=H,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.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 y=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=j,b.right=y,this._refreshDrawHeightConstants(),x.full=0,x.left=0,x.center=b.left,x.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(y,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 y=this._colorZoneStore.zones;for(const j of y)j.position!=="full"&&this._renderColorZone(j);for(const j of y)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(x[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,j){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=_=h([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,v.IRenderService),g(5,E.IOptionsService),g(6,v.ICoreBrowserService)],_)},2950:function(m,o,d){var h=this&&this.__decorate||function(C,b,x,_){var y,j=arguments.length,A=j<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,x,_);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,x,A):y(b,x))||A);return j>3&&A&&Object.defineProperty(b,x,A),A},g=this&&this.__param||function(C,b){return function(x,_){b(x,_,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const p=d(4725),v=d(2585),S=d(2584);let E=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,x,_,y,j){this._textarea=C,this._compositionView=b,this._bufferService=x,this._optionsService=_,this._coreService=y,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 x;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,x=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),x.length>0&&this._coreService.triggerDataEvent(x,!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,x=b.replace(C,"");this._dataAlreadySent=x,b.length>C.length?this._coreService.triggerDataEvent(x,!0):b.length<C.length?this._coreService.triggerDataEvent(`${S.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),x=this._renderService.dimensions.css.cell.height,_=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=_+"px",this._compositionView.style.height=x+"px",this._compositionView.style.lineHeight=x+"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=y+"px",this._textarea.style.top=_+"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)}}};o.CompositionHelper=E=h([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,p.IRenderService)],E)},9806:(m,o)=>{function d(h,g,p){const v=p.getBoundingClientRect(),S=h.getComputedStyle(p),E=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-v.left-E,g.clientY-v.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=d,o.getCoords=function(h,g,p,v,S,E,C,b,x){if(!E)return;const _=d(h,g,p);return _?(_[0]=Math.ceil((_[0]+(x?C/2:0))/C),_[1]=Math.ceil(_[1]/b),_[0]=Math.min(Math.max(_[0],1),v+(x?1:0)),_[1]=Math.min(Math.max(_[1],1),S),_):void 0}},9504:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const h=d(2584);function g(b,x,_,y){const j=b-p(b,_),A=x-p(x,_),N=Math.abs(j-A)-(function(R,T,I){let H=0;const G=R-p(R,I),K=T-p(T,I);for(let q=0;q<Math.abs(G-K);q++){const O=v(R,T)==="A"?-1:1,W=I.buffer.lines.get(G+O*q);W!=null&&W.isWrapped&&H++}return H})(b,x,_);return C(N,E(v(b,x),y))}function p(b,x){let _=0,y=x.buffer.lines.get(b),j=y==null?void 0:y.isWrapped;for(;j&&b>=0&&b<x.rows;)_++,y=x.buffer.lines.get(--b),j=y==null?void 0:y.isWrapped;return _}function v(b,x){return b>x?"A":"B"}function S(b,x,_,y,j,A){let N=b,R=x,T="";for(;N!==_||R!==y;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(R,!1,b,N),N=0,b=0,R++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(R,!1,0,b+1),N=A.cols-1,b=N,R--);return T+A.buffer.translateBufferLineToString(R,!1,b,N)}function E(b,x){const _=x?"O":"[";return h.C0.ESC+_+b}function C(b,x){b=Math.floor(b);let _="";for(let y=0;y<b;y++)_+=x;return _}o.moveToCellSequence=function(b,x,_,y){const j=_.buffer.x,A=_.buffer.y;if(!_.buffer.hasScrollback)return(function(T,I,H,G,K,q){return g(I,G,K,q).length===0?"":C(S(T,I,T,I-p(I,K),!1,K).length,E("D",q))})(j,A,0,x,_,y)+g(A,x,_,y)+(function(T,I,H,G,K,q){let O;O=g(I,G,K,q).length>0?G-p(G,K):I;const W=G,V=(function(Q,te,L,D,B,U){let P;return P=g(L,D,B,U).length>0?D-p(D,B):te,Q<L&&P<=D||Q>=L&&P<D?"C":"D"})(T,I,H,G,K,q);return C(S(T,O,H,W,V==="C",K).length,E(V,q))})(j,A,b,x,_,y);let N;if(A===x)return N=j>b?"D":"C",C(Math.abs(j-b),E(N,y));N=A>x?"D":"C";const R=Math.abs(A-x);return C((function(T,I){return I.cols-T})(A>x?b:j,_)+(R-1)*_.cols+1+((A>x?j:b)-1),E(N,y))}},1296:function(m,o,d){var h=this&&this.__decorate||function(q,O,W,V){var Q,te=arguments.length,L=te<3?O:V===null?V=Object.getOwnPropertyDescriptor(O,W):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(q,O,W,V);else for(var D=q.length-1;D>=0;D--)(Q=q[D])&&(L=(te<3?Q(L):te>3?Q(O,W,L):Q(O,W))||L);return te>3&&L&&Object.defineProperty(O,W,L),L},g=this&&this.__param||function(q,O){return function(W,V){O(W,V,q)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const p=d(3787),v=d(2550),S=d(2223),E=d(6171),C=d(6052),b=d(4725),x=d(8055),_=d(8460),y=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",R="xterm-fg-",T="xterm-bg-",I="xterm-focus",H="xterm-selection";let G=1,K=o.DomRenderer=class extends y.Disposable{constructor(q,O,W,V,Q,te,L,D,B,U,P,Y,ne){super(),this._terminal=q,this._document=O,this._element=W,this._screenElement=V,this._viewportElement=Q,this._helperContainer=te,this._linkifier2=L,this._charSizeService=B,this._optionsService=U,this._bufferService=P,this._coreBrowserService=Y,this._themeService=ne,this._terminalClass=G++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(H),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=D.createInstance(p.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,y.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 v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const q=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*q,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*q),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/q),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/q),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(q){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${N} { color: ${q.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${N} .xterm-dim { color: ${x.color.multiplyOpacity(q.foreground,.5).css};}`,O+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const W=`blink_underline_${this._terminalClass}`,V=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;O+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,O+=`@keyframes ${V} { 50% { box-shadow: none; }}`,O+=`@keyframes ${Q} { 0% { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css}; } 50% { background-color: inherit; color: ${q.cursor.css}; }}`,O+=`${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${q.cursor.css} !important; color: ${q.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${q.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${q.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${q.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${q.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${q.selectionInactiveBackgroundOpaque.css};}`;for(const[te,L]of q.ansi.entries())O+=`${this._terminalSelector} .${R}${te} { color: ${L.css}; }${this._terminalSelector} .${R}${te}.xterm-dim { color: ${x.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${T}${te} { background-color: ${L.css}; }`;O+=`${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR} { color: ${x.color.opaque(q.background).css}; }${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${x.color.multiplyOpacity(x.color.opaque(q.background),.5).css}; }${this._terminalSelector} .${T}${S.INVERTED_DEFAULT_COLOR} { background-color: ${q.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const q=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${q}px`,this._rowFactory.defaultSpacing=q}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(q,O){for(let W=this._rowElements.length;W<=O;W++){const V=this._document.createElement("div");this._rowContainer.appendChild(V),this._rowElements.push(V)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(q,O){this._refreshRowElements(q,O),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(q,O,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(q,O,W),this.renderRows(0,this._bufferService.rows-1),!q||!O)return;this._selectionRenderModel.update(this._terminal,q,O,W);const V=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,te=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(te>=this._bufferService.rows||L<0)return;const D=this._document.createDocumentFragment();if(W){const B=q[0]>O[0];D.appendChild(this._createSelectionElement(te,B?O[0]:q[0],B?q[0]:O[0],L-te+1))}else{const B=V===te?q[0]:0,U=te===Q?O[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(te,B,U));const P=L-te-1;if(D.appendChild(this._createSelectionElement(te+1,0,this._bufferService.cols,P)),te!==L){const Y=Q===L?O[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(L,0,Y))}}this._selectionContainer.appendChild(D)}_createSelectionElement(q,O,W,V=1){const Q=this._document.createElement("div"),te=O*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(W-O);return te+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-te),Q.style.height=V*this.dimensions.css.cell.height+"px",Q.style.top=q*this.dimensions.css.cell.height+"px",Q.style.left=`${te}px`,Q.style.width=`${L}px`,Q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const q of this._rowElements)q.replaceChildren()}renderRows(q,O){const W=this._bufferService.buffer,V=W.ybase+W.y,Q=Math.min(W.x,this._bufferService.cols-1),te=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=q;B<=O;B++){const U=B+W.ydisp,P=this._rowElements[B],Y=W.lines.get(U);if(!P||!Y)break;P.replaceChildren(...this._rowFactory.createRow(Y,U,U===V,L,D,Q,te,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!0)}_handleLinkLeave(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!1)}_setCellUnderline(q,O,W,V,Q,te){W<0&&(q=0),V<0&&(O=0);const L=this._bufferService.rows-1;W=Math.max(Math.min(W,L),0),V=Math.max(Math.min(V,L),0),Q=Math.min(Q,this._bufferService.cols);const D=this._bufferService.buffer,B=D.ybase+D.y,U=Math.min(D.x,Q-1),P=this._optionsService.rawOptions.cursorBlink,Y=this._optionsService.rawOptions.cursorStyle,ne=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=W;Z<=V;++Z){const X=Z+D.ydisp,z=this._rowElements[Z],ae=D.lines.get(X);if(!z||!ae)break;z.replaceChildren(...this._rowFactory.createRow(ae,X,X===B,Y,ne,U,P,this.dimensions.css.cell.width,this._widthCache,te?Z===W?q:0:-1,te?(Z===V?O:Q)-1:-1))}}};o.DomRenderer=K=h([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(m,o,d){var h=this&&this.__decorate||function(N,R,T,I){var H,G=arguments.length,K=G<3?R:I===null?I=Object.getOwnPropertyDescriptor(R,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(N,R,T,I);else for(var q=N.length-1;q>=0;q--)(H=N[q])&&(K=(G<3?H(K):G>3?H(R,T,K):H(R,T))||K);return G>3&&K&&Object.defineProperty(R,T,K),K},g=this&&this.__param||function(N,R){return function(T,I){R(T,I,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const p=d(2223),v=d(643),S=d(511),E=d(2585),C=d(8055),b=d(4725),x=d(4269),_=d(6171),y=d(3734);let j=o.DomRendererRowFactory=class{constructor(N,R,T,I,H,G,K){this._document=N,this._characterJoinerService=R,this._optionsService=T,this._coreBrowserService=I,this._coreService=H,this._decorationService=G,this._themeService=K,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,R,T){this._selectionStart=N,this._selectionEnd=R,this._columnSelectMode=T}createRow(N,R,T,I,H,G,K,q,O,W,V){const Q=[],te=this._characterJoinerService.getJoinedCharacters(R),L=this._themeService.colors;let D,B=N.getNoBgTrimmedLength();T&&B<G+1&&(B=G+1);let U=0,P="",Y=0,ne=0,Z=0,X=!1,z=0,ae=!1,se=0;const ge=[],be=W!==-1&&V!==-1;for(let je=0;je<B;je++){N.loadCell(je,this._workCell);let Te=this._workCell.getWidth();if(Te===0)continue;let Le=!1,Pe=je,we=this._workCell;if(te.length>0&&je===te[0][0]){Le=!0;const Be=te.shift();we=new x.JoinedCellData(this._workCell,N.translateToString(!0,Be[0],Be[1]),Be[1]-Be[0]),Pe=Be[1]-1,Te=we.getWidth()}const st=this._isCellInSelection(je,R),lt=T&&je===G,he=be&&je>=W&&je<=V;let De=!1;this._decorationService.forEachDecorationAtCell(je,R,void 0,(Be=>{De=!0}));let Ze=we.getChars()||v.WHITESPACE_CELL_CHAR;if(Ze===" "&&(we.isUnderline()||we.isOverline())&&(Ze=" "),se=Te*q-O.get(Ze,we.isBold(),we.isItalic()),D){if(U&&(st&&ae||!st&&!ae&&we.bg===Y)&&(st&&ae&&L.selectionForeground||we.fg===ne)&&we.extended.ext===Z&&he===X&&se===z&&!lt&&!Le&&!De){we.isInvisible()?P+=v.WHITESPACE_CELL_CHAR:P+=Ze,U++;continue}U&&(D.textContent=P),D=this._document.createElement("span"),U=0,P=""}else D=this._document.createElement("span");if(Y=we.bg,ne=we.fg,Z=we.extended.ext,X=he,z=se,ae=st,Le&&G>=je&&G<=Pe&&(G=je),!this._coreService.isCursorHidden&&lt&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)K&&ge.push("xterm-cursor-blink"),ge.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(we.isBold()&&ge.push("xterm-bold"),we.isItalic()&&ge.push("xterm-italic"),we.isDim()&&ge.push("xterm-dim"),P=we.isInvisible()?v.WHITESPACE_CELL_CHAR:we.getChars()||v.WHITESPACE_CELL_CHAR,we.isUnderline()&&(ge.push(`xterm-underline-${we.extended.underlineStyle}`),P===" "&&(P=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let Be=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&Be<8&&(Be+=8),D.style.textDecorationColor=L.ansi[Be].css}we.isOverline()&&(ge.push("xterm-overline"),P===" "&&(P=" ")),we.isStrikethrough()&&ge.push("xterm-strikethrough"),he&&(D.style.textDecoration="underline");let Qe=we.getFgColor(),qe=we.getFgColorMode(),at=we.getBgColor(),de=we.getBgColorMode();const ee=!!we.isInverse();if(ee){const Be=Qe;Qe=at,at=Be;const ct=qe;qe=de,de=ct}let ve,Se,Ce,ze=!1;switch(this._decorationService.forEachDecorationAtCell(je,R,void 0,(Be=>{Be.options.layer!=="top"&&ze||(Be.backgroundColorRGB&&(de=50331648,at=Be.backgroundColorRGB.rgba>>8&16777215,ve=Be.backgroundColorRGB),Be.foregroundColorRGB&&(qe=50331648,Qe=Be.foregroundColorRGB.rgba>>8&16777215,Se=Be.foregroundColorRGB),ze=Be.options.layer==="top")})),!ze&&st&&(ve=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,at=ve.rgba>>8&16777215,de=50331648,ze=!0,L.selectionForeground&&(qe=50331648,Qe=L.selectionForeground.rgba>>8&16777215,Se=L.selectionForeground)),ze&&ge.push("xterm-decoration-top"),de){case 16777216:case 33554432:Ce=L.ansi[at],ge.push(`xterm-bg-${at}`);break;case 50331648:Ce=C.channels.toColor(at>>16,at>>8&255,255&at),this._addStyle(D,`background-color:#${A((at>>>0).toString(16),"0",6)}`);break;default:ee?(Ce=L.foreground,ge.push(`xterm-bg-${p.INVERTED_DEFAULT_COLOR}`)):Ce=L.background}switch(ve||we.isDim()&&(ve=C.color.multiplyOpacity(Ce,.5)),qe){case 16777216:case 33554432:we.isBold()&&Qe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Qe+=8),this._applyMinimumContrast(D,Ce,L.ansi[Qe],we,ve,void 0)||ge.push(`xterm-fg-${Qe}`);break;case 50331648:const Be=C.channels.toColor(Qe>>16&255,Qe>>8&255,255&Qe);this._applyMinimumContrast(D,Ce,Be,we,ve,Se)||this._addStyle(D,`color:#${A(Qe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,Ce,L.foreground,we,ve,Se)||ee&&ge.push(`xterm-fg-${p.INVERTED_DEFAULT_COLOR}`)}ge.length&&(D.className=ge.join(" "),ge.length=0),lt||Le||De?D.textContent=P:U++,se!==this.defaultSpacing&&(D.style.letterSpacing=`${se}px`),Q.push(D),je=Pe}return D&&U&&(D.textContent=P),Q}_applyMinimumContrast(N,R,T,I,H,G){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const K=this._getContrastCache(I);let q;if(H||G||(q=K.getColor(R.rgba,T.rgba)),q===void 0){const O=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);q=C.color.ensureContrastRatio(H||R,G||T,O),K.setColor((H||R).rgba,(G||T).rgba,q??null)}return!!q&&(this._addStyle(N,`color:${q.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,R){N.setAttribute("style",`${N.getAttribute("style")||""}${R};`)}_isCellInSelection(N,R){const T=this._selectionStart,I=this._selectionEnd;return!(!T||!I)&&(this._columnSelectMode?T[0]<=I[0]?N>=T[0]&&R>=T[1]&&N<I[0]&&R<=I[1]:N<T[0]&&R>=T[1]&&N>=I[0]&&R<=I[1]:R>T[1]&&R<I[1]||T[1]===I[1]&&R===T[1]&&N>=T[0]&&N<I[0]||T[1]<I[1]&&R===I[1]&&N<I[0]||T[1]<I[1]&&R===T[1]&&N>=T[0])}};function A(N,R,T){for(;N.length<T;)N=R+N;return N}o.DomRendererRowFactory=j=h([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:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(d,h){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 p=d.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold";const v=d.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const S=d.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[g,p,v,S],this._container.appendChild(g),this._container.appendChild(p),this._container.appendChild(v),this._container.appendChild(S),h.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,h,g,p){d===this._font&&h===this._fontSize&&g===this._weight&&p===this._weightBold||(this._font=d,this._fontSize=h,this._weight=g,this._weightBold=p,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${p}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${p}`,this.clear())}get(d,h,g){let p=0;if(!h&&!g&&d.length===1&&(p=d.charCodeAt(0))<256){if(this._flat[p]!==-9999)return this._flat[p];const E=this._measure(d,0);return E>0&&(this._flat[p]=E),E}let v=d;h&&(v+="B"),g&&(v+="I");let S=this._holey.get(v);if(S===void 0){let E=0;h&&(E|=1),g&&(E|=2),S=this._measure(d,E),S>0&&this._holey.set(v,S)}return S}_measure(d,h){const g=this._measureElements[h];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const h=d(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(m,o)=>{function d(g){return 57508<=g&&g<=57558}function h(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(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},o.isPowerlineGlyph=d,o.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},o.isEmoji=h,o.allowRescaling=function(g,p,v,S){return p===1&&v>Math.ceil(1.5*S)&&g!==void 0&&g>255&&!h(g)&&!d(g)&&!(function(E){return 57344<=E&&E<=63743})(g)},o.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(p){return 9472<=p&&p<=9631})(g)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(g,p,v=0){return(g-(2*Math.round(p)-v))%(2*Math.round(p))}},6052:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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,p,v,S=!1){if(this.selectionStart=p,this.selectionEnd=v,!p||!v||p[0]===v[0]&&p[1]===v[1])return void this.clear();const E=g.buffers.active.ydisp,C=p[1]-E,b=v[1]-E,x=Math.max(C,0),_=Math.min(b,g.rows-1);x>=g.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=x,this.viewportCappedEndRow=_,this.startCol=p[0],this.endCol=v[0])}isCellSelected(g,p,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?p>=this.startCol&&v>=this.viewportCappedStartRow&&p<this.endCol&&v<=this.viewportCappedEndRow:p<this.startCol&&v>=this.viewportCappedStartRow&&p>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&p>=this.startCol&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&p>=this.startCol)}}o.createSelectionRenderModel=function(){return new d}},456:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.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,h=this.selectionEnd;return!(!d||!h)&&(d[1]>h[1]||d[1]===h[1]&&d[0]>h[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(m,o,d){var h=this&&this.__decorate||function(_,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,y,j,A);else for(var I=_.length-1;I>=0;I--)(N=_[I])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(_,y){return function(j,A){y(j,A,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const p=d(2585),v=d(8460),S=d(844);let E=o.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(_,y,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new x(this._optionsService))}catch{this._measureStrategy=this.register(new b(_,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const _=this._measureStrategy.measure();_.width===this.width&&_.height===this.height||(this.width=_.width,this.height=_.height,this._onCharSizeChange.fire())}};o.CharSizeService=E=h([g(2,p.IOptionsService)],E);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,j){y!==void 0&&y>0&&j!==void 0&&j>0&&(this._result.width=y,this._result.height=j)}}class b extends C{constructor(y,j,A){super(),this._document=y,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 x extends C{constructor(y){super(),this._optionsService=y,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 y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(m,o,d){var h=this&&this.__decorate||function(x,_,y,j){var A,N=arguments.length,R=N<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(x,_,y,j);else for(var T=x.length-1;T>=0;T--)(A=x[T])&&(R=(N<3?A(R):N>3?A(_,y,R):A(_,y))||R);return N>3&&R&&Object.defineProperty(_,y,R),R},g=this&&this.__param||function(x,_){return function(y,j){_(y,j,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const p=d(3734),v=d(643),S=d(511),E=d(2585);class C extends p.AttributeData{constructor(_,y,j){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=y,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class Jv{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(_){const y={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(y),y.id}deregister(_){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===_)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(_);if(!y||y.length===0)return[];const j=[],A=y.translateToString(!0);let N=0,R=0,T=0,I=y.getFg(0),H=y.getBg(0);for(let G=0;G<y.getTrimmedLength();G++)if(y.loadCell(G,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==H){if(G-N>1){const K=this._getJoinedRanges(A,T,R,y,N);for(let q=0;q<K.length;q++)j.push(K[q])}N=G,T=R,I=this._workCell.fg,H=this._workCell.bg}R+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const G=this._getJoinedRanges(A,T,R,y,N);for(let K=0;K<G.length;K++)j.push(G[K])}return j}_getJoinedRanges(_,y,j,A,N){const R=_.substring(y,j);let T=[];try{T=this._characterJoiners[0].handler(R)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const H=this._characterJoiners[I].handler(R);for(let G=0;G<H.length;G++)Jv._mergeRanges(T,H[G])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(_,y,j){let A=0,N=!1,R=0,T=_[A];if(T){for(let I=j;I<this._bufferService.cols;I++){const H=y.getWidth(I),G=y.getString(I).length||v.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!N&&T[0]<=R&&(T[0]=I,N=!0),T[1]<=R){if(T[1]=I,T=_[++A],!T)break;T[0]<=R?(T[0]=I,N=!0):N=!1}R+=G}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(_,y){let j=!1;for(let A=0;A<_.length;A++){const N=_[A];if(j){if(y[1]<=N[0])return _[A-1][1]=y[1],_;if(y[1]<=N[1])return _[A-1][1]=Math.max(y[1],N[1]),_.splice(A,1),_;_.splice(A,1),A--}else{if(y[1]<=N[0])return _.splice(A,0,y),_;if(y[1]<=N[1])return N[0]=Math.min(y[0],N[0]),_;y[0]<N[1]&&(N[0]=Math.min(y[0],N[0]),j=!0)}}return j?_[_.length-1][1]=y[1]:_.push(y),_}};o.CharacterJoinerService=b=h([g(0,E.IBufferService)],b)},5114:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const h=d(844),g=d(8460),p=d(3656);class v extends h.Disposable{constructor(C,b,x){super(),this._textarea=C,this._window=b,this.mainDocument=x,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((_=>this._screenDprMonitor.setWindow(_)))),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}}o.CoreBrowserService=v;class S extends h.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new h.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,h.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,p.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:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const h=d(844);class g extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const S=this.linkProviders.indexOf(v);S!==-1&&this.linkProviders.splice(S,1)}}}}o.LinkProviderService=g},8934:function(m,o,d){var h=this&&this.__decorate||function(E,C,b,x){var _,y=arguments.length,j=y<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,b,x);else for(var A=E.length-1;A>=0;A--)(_=E[A])&&(j=(y<3?_(j):y>3?_(C,b,j):_(C,b))||j);return y>3&&j&&Object.defineProperty(C,b,j),j},g=this&&this.__param||function(E,C){return function(b,x){C(b,x,E)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const p=d(4725),v=d(9806);let S=o.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,b,x,_){return(0,v.getCoords)(window,E,C,b,x,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(E,C){const b=(0,v.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])}}};o.MouseService=S=h([g(0,p.IRenderService),g(1,p.ICharSizeService)],S)},3230:function(m,o,d){var h=this&&this.__decorate||function(_,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,y,j,A);else for(var I=_.length-1;I>=0;I--)(N=_[I])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(_,y){return function(j,A){y(j,A,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const p=d(6193),v=d(4725),S=d(8460),E=d(844),C=d(7226),b=d(2585);let x=o.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(_,y,j,A,N,R,T,I){super(),this._rowCount=_,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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(((H,G)=>this._renderRows(H,G)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var H;return(H=this._renderer.value)==null?void 0:H.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,y),this.register(T.onWindowChange((H=>this._registerIntersectionObserver(H,y))))}_registerIntersectionObserver(_,y){if("IntersectionObserver"in _){const j=new _.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(y),this._observerDisposable.value=(0,E.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.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,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,y,this._rowCount))}_renderRows(_,y){this._renderer.value&&(_=Math.min(_,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(_,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:y}),this._onRender.fire({start:_,end:y}),this._isNextRenderRedrawOnly=!0)}resize(_,y){this._rowCount=y,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(_){this._renderer.value=_,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var _,y;this._renderer.value&&((y=(_=this._renderer.value).clearTextureAtlas)==null||y.call(_),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(_,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(_,y)})):this._renderer.value.handleResize(_,y),this._fullRefresh())}handleCharSizeChanged(){var _;(_=this._renderer.value)==null||_.handleCharSizeChanged()}handleBlur(){var _;(_=this._renderer.value)==null||_.handleBlur()}handleFocus(){var _;(_=this._renderer.value)==null||_.handleFocus()}handleSelectionChanged(_,y,j){var A;this._selectionState.start=_,this._selectionState.end=y,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(_,y,j)}handleCursorMove(){var _;(_=this._renderer.value)==null||_.handleCursorMove()}clear(){var _;(_=this._renderer.value)==null||_.clear()}};o.RenderService=x=h([g(2,b.IOptionsService),g(3,v.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],x)},9312:function(m,o,d){var h=this&&this.__decorate||function(T,I,H,G){var K,q=arguments.length,O=q<3?I:G===null?G=Object.getOwnPropertyDescriptor(I,H):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(T,I,H,G);else for(var W=T.length-1;W>=0;W--)(K=T[W])&&(O=(q<3?K(O):q>3?K(I,H,O):K(I,H))||O);return q>3&&O&&Object.defineProperty(I,H,O),O},g=this&&this.__param||function(T,I){return function(H,G){I(H,G,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const p=d(9806),v=d(9504),S=d(456),E=d(4725),C=d(8460),b=d(844),x=d(6114),_=d(4841),y=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let R=o.SelectionService=class extends b.Disposable{constructor(T,I,H,G,K,q,O,W,V){super(),this._element=T,this._screenElement=I,this._linkifier=H,this._bufferService=G,this._coreService=K,this._mouseService=q,this._optionsService=O,this._renderService=W,this._coreBrowserService=V,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.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=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new S.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 H=this._bufferService.buffer,G=[];if(this._activeSelectionMode===3){if(T[0]===I[0])return"";const K=T[0]<I[0]?T[0]:I[0],q=T[0]<I[0]?I[0]:T[0];for(let O=T[1];O<=I[1];O++){const W=H.translateBufferLineToString(O,!0,K,q);G.push(W)}}else{const K=T[1]===I[1]?I[0]:void 0;G.push(H.translateBufferLineToString(T[1],!0,T[0],K));for(let q=T[1]+1;q<=I[1]-1;q++){const O=H.lines.get(q),W=H.translateBufferLineToString(q,!0);O!=null&&O.isWrapped?G[G.length-1]+=W:G.push(W)}if(T[1]!==I[1]){const q=H.lines.get(I[1]),O=H.translateBufferLineToString(I[1],!0,0,I[0]);q&&q.isWrapped?G[G.length-1]+=O:G.push(O)}}return G.map((K=>K.replace(N," "))).join(x.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()))),x.isLinux&&T&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(T){const I=this._getMouseBufferCoords(T),H=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!!(H&&G&&I)&&this._areCoordsInSelection(I,H,G)}isCellInSelection(T,I){const H=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!(!H||!G)&&this._areCoordsInSelection([T,I],H,G)}_areCoordsInSelection(T,I,H){return T[1]>I[1]&&T[1]<H[1]||I[1]===H[1]&&T[1]===I[1]&&T[0]>=I[0]&&T[0]<H[0]||I[1]<H[1]&&T[1]===H[1]&&T[0]<H[0]||I[1]<H[1]&&T[1]===I[1]&&T[0]>=I[0]}_selectWordAtCursor(T,I){var K,q;const H=(q=(K=this._linkifier.currentLink)==null?void 0:K.link)==null?void 0:q.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(H,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const G=this._getMouseBufferCoords(T);return!!G&&(this._selectWordAt(G,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,p.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const H=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=H?0:(I>H&&(I-=H),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(T){return x.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&&!(x.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(T),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const H=this._bufferService.buffer;if(this._model.selectionEnd[1]<H.lines.length){const G=H.lines.get(this._model.selectionEnd[1]);G&&G.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const I=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const H=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(H&&H[0]!==void 0&&H[1]!==void 0){const G=(0,v.moveToCellSequence)(H[0]-1,H[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(G,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,H=!(!T||!I||T[0]===I[0]&&T[1]===I[1]);H?T&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,I,H)):this._oldHasSelection&&this._fireOnSelectionChange(T,I,H)}_fireOnSelectionChange(T,I,H){this._oldSelectionStart=T,this._oldSelectionEnd=I,this._oldHasSelection=H,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(T,I){let H=I;for(let G=0;I>=G;G++){const K=T.loadCell(G,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:K>1&&I!==G&&(H+=K-1)}return H}setSelection(T,I,H){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,I],this._model.selectionStartLength=H,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,I,H=!0,G=!0){if(T[0]>=this._bufferService.cols)return;const K=this._bufferService.buffer,q=K.lines.get(T[1]);if(!q)return;const O=K.translateBufferLineToString(T[1],!1);let W=this._convertViewportColToCharacterIndex(q,T[0]),V=W;const Q=T[0]-W;let te=0,L=0,D=0,B=0;if(O.charAt(W)===" "){for(;W>0&&O.charAt(W-1)===" ";)W--;for(;V<O.length&&O.charAt(V+1)===" ";)V++}else{let Y=T[0],ne=T[0];q.getWidth(Y)===0&&(te++,Y--),q.getWidth(ne)===2&&(L++,ne++);const Z=q.getString(ne).length;for(Z>1&&(B+=Z-1,V+=Z-1);Y>0&&W>0&&!this._isCharWordSeparator(q.loadCell(Y-1,this._workCell));){q.loadCell(Y-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(te++,Y--):X>1&&(D+=X-1,W-=X-1),W--,Y--}for(;ne<q.length&&V+1<O.length&&!this._isCharWordSeparator(q.loadCell(ne+1,this._workCell));){q.loadCell(ne+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,ne++):X>1&&(B+=X-1,V+=X-1),V++,ne++}}V++;let U=W+Q-te+D,P=Math.min(this._bufferService.cols,V-W+te+L-D-B);if(I||O.slice(W,V).trim()!==""){if(H&&U===0&&q.getCodePoint(0)!==32){const Y=K.lines.get(T[1]-1);if(Y&&q.isWrapped&&Y.getCodePoint(this._bufferService.cols-1)!==32){const ne=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(ne){const Z=this._bufferService.cols-ne.start;U-=Z,P+=Z}}}if(G&&U+P===this._bufferService.cols&&q.getCodePoint(this._bufferService.cols-1)!==32){const Y=K.lines.get(T[1]+1);if(Y!=null&&Y.isWrapped&&Y.getCodePoint(0)!==32){const ne=this._getWordAt([0,T[1]+1],!1,!1,!0);ne&&(P+=ne.length)}}return{start:U,length:P}}}_selectWordAt(T,I){const H=this._getWordAt(T,I);if(H){for(;H.start<0;)H.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[H.start,T[1]],this._model.selectionStartLength=H.length}}_selectToWordAt(T){const I=this._getWordAt(T,!0);if(I){let H=T[1];for(;I.start<0;)I.start+=this._bufferService.cols,H--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,H++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,H]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const I=this._bufferService.buffer.getWrappedRangeForLine(T),H={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(H,this._bufferService.cols)}};o.SelectionService=R=h([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],R)},4725:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const h=d(8343);o.ICharSizeService=(0,h.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),o.IMouseService=(0,h.createDecorator)("MouseService"),o.IRenderService=(0,h.createDecorator)("RenderService"),o.ISelectionService=(0,h.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,h.createDecorator)("ThemeService"),o.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(m,o,d){var h=this&&this.__decorate||function(R,T,I,H){var G,K=arguments.length,q=K<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,I):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(R,T,I,H);else for(var O=R.length-1;O>=0;O--)(G=R[O])&&(q=(K<3?G(q):K>3?G(T,I,q):G(T,I))||q);return K>3&&q&&Object.defineProperty(T,I,q),q},g=this&&this.__param||function(R,T){return function(I,H){T(I,H,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const p=d(7239),v=d(8055),S=d(8460),E=d(844),C=d(2585),b=v.css.toColor("#ffffff"),x=v.css.toColor("#000000"),_=v.css.toColor("#ffffff"),y=v.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let I=0;I<216;I++){const H=T[I/36%6|0],G=T[I/6%6|0],K=T[I%6];R.push({css:v.channels.toCss(H,G,K),rgba:v.channels.toRgba(H,G,K)})}for(let I=0;I<24;I++){const H=8+10*I;R.push({css:v.channels.toCss(H,H,H),rgba:v.channels.toRgba(H,H,H)})}return R})());let A=o.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new p.ColorContrastCache,this._halfContrastCache=new p.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:x,cursor:_,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:v.color.blend(x,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:v.color.blend(x,j),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(R={}){const T=this._colors;if(T.foreground=N(R.foreground,b),T.background=N(R.background,x),T.cursor=N(R.cursor,_),T.cursorAccent=N(R.cursorAccent,y),T.selectionBackgroundTransparent=N(R.selectionBackground,j),T.selectionBackgroundOpaque=v.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(R.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=v.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=R.selectionForeground?N(R.selectionForeground,v.NULL_COLOR):void 0,T.selectionForeground===v.NULL_COLOR&&(T.selectionForeground=void 0),v.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=v.color.opacity(T.selectionBackgroundTransparent,.3)),v.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=v.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=o.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(R.black,o.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(R.red,o.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(R.green,o.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(R.yellow,o.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(R.blue,o.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(R.magenta,o.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(R.cyan,o.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(R.white,o.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const I=Math.min(T.ansi.length-16,R.extendedAnsi.length);for(let H=0;H<I;H++)T.ansi[H+16]=N(R.extendedAnsi[H],o.DEFAULT_ANSI_COLORS[H+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}modifyColors(R){R(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(R,T){if(R!==void 0)try{return v.css.toColor(R)}catch{}return T}o.ThemeService=A=h([g(0,C.IOptionsService)],A)},6349:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const h=d(8460),g=d(844);class p extends g.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(S){if(this._maxLength===S)return;const E=new Array(S);for(let C=0;C<Math.min(S,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let E=this._length;E<S;E++)this._array[E]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,E){this._array[this._getCyclicIndex(S)]=E}push(S){this._array[this._getCyclicIndex(this._length)]=S,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(S,E,...C){if(E){for(let b=S;b<this._length-E;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+E)];this._length-=E,this.onDeleteEmitter.fire({index:S,amount:E})}for(let b=this._length-1;b>=S;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(S+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:S,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(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,E,C){if(!(E<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let x=E-1;x>=0;x--)this.set(S+x+C,this.get(S+x));const b=S+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(S+b+C,this.get(S+b))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}o.CircularList=p},1439:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function d(h,g=5){if(typeof h!="object")return h;const p=Array.isArray(h)?[]:{};for(const v in h)p[v]=g<=1?h[v]:h[v]&&d(h[v],g-1);return p}},8055:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let d=0,h=0,g=0,p=0;var v,S,E,C,b;function x(y){const j=y.toString(16);return j.length<2?"0"+j:j}function _(y,j){return y<j?(j+.05)/(y+.05):(y+.05)/(j+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(j,A,N,R){return R!==void 0?`#${x(j)}${x(A)}${x(N)}${x(R)}`:`#${x(j)}${x(A)}${x(N)}`},y.toRgba=function(j,A,N,R=255){return(j<<24|A<<16|N<<8|R)>>>0},y.toColor=function(j,A,N,R){return{css:y.toCss(j,A,N,R),rgba:y.toRgba(j,A,N,R)}}})(v||(o.channels=v={})),(function(y){function j(A,N){return p=Math.round(255*N),[d,h,g]=b.toChannels(A.rgba),{css:v.toCss(d,h,g,p),rgba:v.toRgba(d,h,g,p)}}y.blend=function(A,N){if(p=(255&N.rgba)/255,p===1)return{css:N.css,rgba:N.rgba};const R=N.rgba>>24&255,T=N.rgba>>16&255,I=N.rgba>>8&255,H=A.rgba>>24&255,G=A.rgba>>16&255,K=A.rgba>>8&255;return d=H+Math.round((R-H)*p),h=G+Math.round((T-G)*p),g=K+Math.round((I-K)*p),{css:v.toCss(d,h,g),rgba:v.toRgba(d,h,g)}},y.isOpaque=function(A){return(255&A.rgba)==255},y.ensureContrastRatio=function(A,N,R){const T=b.ensureContrastRatio(A.rgba,N.rgba,R);if(T)return v.toColor(T>>24&255,T>>16&255,T>>8&255)},y.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,h,g]=b.toChannels(N),{css:v.toCss(d,h,g),rgba:N}},y.opacity=j,y.multiplyOpacity=function(A,N){return p=255&A.rgba,j(A,p*N/255)},y.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(S||(o.color=S={})),(function(y){let j,A;try{const N=document.createElement("canvas");N.width=1,N.height=1;const R=N.getContext("2d",{willReadFrequently:!0});R&&(j=R,j.globalCompositeOperation="copy",A=j.createLinearGradient(0,0,1,1))}catch{}y.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),h=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),v.toColor(d,h,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),h=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),p=parseInt(N.slice(4,5).repeat(2),16),v.toColor(d,h,g,p);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 R=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(R)return d=parseInt(R[1]),h=parseInt(R[2]),g=parseInt(R[3]),p=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),v.toColor(d,h,g,p);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,h,g,p]=j.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(d,h,g,p),css:N}}})(E||(o.css=E={})),(function(y){function j(A,N,R){const T=A/255,I=N/255,H=R/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(H<=.03928?H/12.92:Math.pow((H+.055)/1.055,2.4))}y.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},y.relativeLuminance2=j})(C||(o.rgb=C={})),(function(y){function j(N,R,T){const I=N>>24&255,H=N>>16&255,G=N>>8&255;let K=R>>24&255,q=R>>16&255,O=R>>8&255,W=_(C.relativeLuminance2(K,q,O),C.relativeLuminance2(I,H,G));for(;W<T&&(K>0||q>0||O>0);)K-=Math.max(0,Math.ceil(.1*K)),q-=Math.max(0,Math.ceil(.1*q)),O-=Math.max(0,Math.ceil(.1*O)),W=_(C.relativeLuminance2(K,q,O),C.relativeLuminance2(I,H,G));return(K<<24|q<<16|O<<8|255)>>>0}function A(N,R,T){const I=N>>24&255,H=N>>16&255,G=N>>8&255;let K=R>>24&255,q=R>>16&255,O=R>>8&255,W=_(C.relativeLuminance2(K,q,O),C.relativeLuminance2(I,H,G));for(;W<T&&(K<255||q<255||O<255);)K=Math.min(255,K+Math.ceil(.1*(255-K))),q=Math.min(255,q+Math.ceil(.1*(255-q))),O=Math.min(255,O+Math.ceil(.1*(255-O))),W=_(C.relativeLuminance2(K,q,O),C.relativeLuminance2(I,H,G));return(K<<24|q<<16|O<<8|255)>>>0}y.blend=function(N,R){if(p=(255&R)/255,p===1)return R;const T=R>>24&255,I=R>>16&255,H=R>>8&255,G=N>>24&255,K=N>>16&255,q=N>>8&255;return d=G+Math.round((T-G)*p),h=K+Math.round((I-K)*p),g=q+Math.round((H-q)*p),v.toRgba(d,h,g)},y.ensureContrastRatio=function(N,R,T){const I=C.relativeLuminance(N>>8),H=C.relativeLuminance(R>>8);if(_(I,H)<T){if(H<I){const q=j(N,R,T),O=_(I,C.relativeLuminance(q>>8));if(O<T){const W=A(N,R,T);return O>_(I,C.relativeLuminance(W>>8))?q:W}return q}const G=A(N,R,T),K=_(I,C.relativeLuminance(G>>8));if(K<T){const q=j(N,R,T);return K>_(I,C.relativeLuminance(q>>8))?G:q}return G}},y.reduceLuminance=j,y.increaseLuminance=A,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(o.rgba=b={})),o.toPaddedHex=x,o.contrastRatio=_},8969:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const h=d(844),g=d(2585),p=d(4348),v=d(7866),S=d(744),E=d(7302),C=d(6975),b=d(8460),x=d(1753),_=d(1480),y=d(7994),j=d(9282),A=d(5435),N=d(5981),R=d(2660);let T=!1;class I extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((G=>{var K;(K=this._onScrollApi)==null||K.fire(G.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(G){for(const K in G)this.optionsService.options[K]=G[K]}constructor(G){super(),this._windowsWrappingHeuristics=this.register(new h.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 p.InstantiationService,this.optionsService=this.register(new E.OptionsService(G)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(x.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.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,q)=>this._inputHandler.parse(K,q)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(G,K){this._writeBuffer.write(G,K)}writeSync(G,K){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(G,K)}input(G,K=!0){this.coreService.triggerDataEvent(G,K)}resize(G,K){isNaN(G)||isNaN(K)||(G=Math.max(G,S.MINIMUM_COLS),K=Math.max(K,S.MINIMUM_ROWS),this._bufferService.resize(G,K))}scroll(G,K=!1){this._bufferService.scroll(G,K)}scrollLines(G,K,q){this._bufferService.scrollLines(G,K,q)}scrollPages(G){this.scrollLines(G*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(G){const K=G-this._bufferService.buffer.ydisp;K!==0&&this.scrollLines(K)}registerEscHandler(G,K){return this._inputHandler.registerEscHandler(G,K)}registerDcsHandler(G,K){return this._inputHandler.registerDcsHandler(G,K)}registerCsiHandler(G,K){return this._inputHandler.registerCsiHandler(G,K)}registerOscHandler(G,K){return this._inputHandler.registerOscHandler(G,K)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let G=!1;const K=this.optionsService.rawOptions.windowsPty;K&&K.buildNumber!==void 0&&K.buildNumber!==void 0?G=K.backend==="conpty"&&K.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(G=!0),G?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const G=[];G.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),G.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const K of G)K.dispose()}))}}}o.CoreTerminal=I},8460:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===d)return void this._listeners.splice(h,1)}}})),this._event}fire(d,h){const g=[];for(let p=0;p<this._listeners.length;p++)g.push(this._listeners[p]);for(let p=0;p<g.length;p++)g[p].call(void 0,d,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(d,h){return d((g=>h.fire(g)))},o.runAndSubscribe=function(d,h){return h(void 0),d((g=>h(g)))}},5435:function(m,o,d){var h=this&&this.__decorate||function(te,L,D,B){var U,P=arguments.length,Y=P<3?L:B===null?B=Object.getOwnPropertyDescriptor(L,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(te,L,D,B);else for(var ne=te.length-1;ne>=0;ne--)(U=te[ne])&&(Y=(P<3?U(Y):P>3?U(L,D,Y):U(L,D))||Y);return P>3&&Y&&Object.defineProperty(L,D,Y),Y},g=this&&this.__param||function(te,L){return function(D,B){L(D,B,te)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const p=d(2584),v=d(7116),S=d(2015),E=d(844),C=d(482),b=d(8437),x=d(8460),_=d(643),y=d(511),j=d(3734),A=d(2585),N=d(1480),R=d(6242),T=d(6351),I=d(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},G=131072;function K(te,L){if(te>24)return L.setWinLines||!1;switch(te){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var q;(function(te){te[te.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",te[te.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(q||(o.WindowsOptionsReportType=q={}));let O=0;class W extends E.Disposable{getAttrData(){return this._curAttrData}constructor(L,D,B,U,P,Y,ne,Z,X=new S.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=D,this._coreService=B,this._logService=U,this._optionsService=P,this._oscLinkService=Y,this._coreMouseService=ne,this._unicodeService=Z,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.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 x.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new x.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new x.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new x.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new x.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new x.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new x.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new x.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new x.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new x.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new x.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new x.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new x.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 V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:ae.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,ae,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:ae,data:se})})),this._parser.setDcsHandlerFallback(((z,ae,se)=>{ae==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:ae,payload:se})})),this._parser.setPrintHandler(((z,ae,se)=>this.print(z,ae,se))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!1))),this._parser.setExecuteHandler(p.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(p.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(p.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(p.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(p.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(p.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(p.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(p.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(p.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new R.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new R.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new R.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new R.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new R.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new R.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new R.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new R.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new R.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new R.OscHandler((z=>this.restoreCursorColor(z)))),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 z in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((z,ae)=>this.requestStatusString(z,ae))))}_preserveStack(L,D,B,U){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=B,this._parseStack.position=U}_logSlowResolvingAsync(L){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([L,new Promise(((D,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((D=>{if(D!=="#SLOW_TIMEOUT")throw D;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,D){let B,U=this._activeBuffer.x,P=this._activeBuffer.y,Y=0;const ne=this._parseStack.paused;if(ne){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(B),B;U=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>G&&(Y=this._parseStack.position+G)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(z=>String.fromCharCode(z))).join("")}"`),typeof L=="string"?L.split("").map((z=>z.charCodeAt(0))):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<G&&(this._parseBuffer=new Uint32Array(Math.min(L.length,G))),ne||this._dirtyRowTracker.clearRange(),L.length>G)for(let z=Y;z<L.length;z+=G){const ae=z+G<L.length?z+G:L.length,se=typeof L=="string"?this._stringDecoder.decode(L.substring(z,ae),this._parseBuffer):this._utf8Decoder.decode(L.subarray(z,ae),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,se))return this._preserveStack(U,P,se,z),this._logSlowResolvingAsync(B),B}else if(!ne){const z=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,z))return this._preserveStack(U,P,z,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===U&&this._activeBuffer.y===P||this._onCursorMove.fire();const Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(L,D,B){let U,P;const Y=this._charsetService.charset,ne=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,ae=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-D>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ge=this._parser.precedingJoinState;for(let be=D;be<B;++be){if(U=L[be],U<127&&Y){const Pe=Y[String.fromCharCode(U)];Pe&&(U=Pe.charCodeAt(0))}const je=this._unicodeService.charProperties(U,ge);P=N.UnicodeService.extractWidth(je);const Te=N.UnicodeService.extractShouldJoin(je),Le=Te?N.UnicodeService.extractWidth(ge):0;if(ge=je,ne&&this._onA11yChar.fire((0,C.stringFromCodePoint)(U)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+P-Le>Z){if(X){const Pe=se;let we=this._activeBuffer.x-Le;for(this._activeBuffer.x=Le,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Le>0&&se instanceof b.BufferLine&&se.copyCellsFrom(Pe,we,0,Le,!1);we<Z;)Pe.setCellFromCodepoint(we++,0,1,ae)}else if(this._activeBuffer.x=Z-1,P===2)continue}if(Te&&this._activeBuffer.x){const Pe=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-Pe,U,P);for(let we=P-Le;--we>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(z&&(se.insertCells(this._activeBuffer.x,P-Le,this._activeBuffer.getNullCell(ae)),se.getWidth(Z-1)===2&&se.setCellFromCodepoint(Z-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,ae)),se.setCellFromCodepoint(this._activeBuffer.x++,U,P,ae),P>0)for(;--P;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ge,this._activeBuffer.x<Z&&B-D>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,D){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,D):this._parser.registerCsiHandler(L,(B=>!K(B.params[0],this._optionsService.rawOptions.windowOptions)||D(B)))}registerDcsHandler(L,D){return this._parser.registerDcsHandler(L,new T.DcsHandler(D))}registerEscHandler(L,D){return this._parser.registerEscHandler(L,D)}registerOscHandler(L,D){return this._parser.registerOscHandler(L,new R.OscHandler(D))}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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);D.hasWidth(this._activeBuffer.x)&&!D.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=L,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+D)}cursorUp(L){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const D=L.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=L.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=L.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const D=L.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,D,B,U=!1,P=!1){const Y=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);Y.replaceCells(D,B,this._activeBuffer.getNullCell(this._eraseAttrData()),P),U&&(Y.isWrapped=!1)}_resetBufferLine(L,D=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),B.isWrapped=!1)}eraseInDisplay(L,D=!1){let B;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);B<this._bufferService.rows;B++)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,D);this._dirtyRowTracker.markDirty(0);break;case 3:const U=this._activeBuffer.lines.length-this._bufferService.rows;U>0&&(this._activeBuffer.lines.trimStart(U),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-U,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-U,0),this._onScroll.fire(0))}return!0}eraseInLine(L,D=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,D);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,D)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let D=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-U+1;for(;D--;)this._activeBuffer.lines.splice(P-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let D=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let U;for(U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-U;D--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let D=L.params[0]||1;for(;D--;)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(L){let D=L.params[0]||1;for(;D--;)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(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const D=this._parser.precedingJoinState;if(!D)return!0;const B=L.params[0]||1,U=N.UnicodeService.extractWidth(D),P=this._activeBuffer.x-U,Y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(P),ne=new Uint32Array(Y.length*B);let Z=0;for(let z=0;z<Y.length;){const ae=Y.codePointAt(z)||0;ne[Z++]=ae,z+=ae>65535?2:1}let X=Z;for(let z=1;z<B;++z)ne.copyWithin(X,0,Z),X+=Z;return this.print(ne,0,X),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(p.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(p.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(p.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(p.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(p.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let D=0;D<L.length;D++)switch(L.params[D]){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(),L.params[D]===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(L,D){const B=this._coreService.decPrivateModes,{activeProtocol:U,activeEncoding:P}=this._coreMouseService,Y=this._coreService,{buffers:ne,cols:Z}=this._bufferService,{active:X,alt:z}=ne,ae=this._optionsService.rawOptions,se=Te=>Te?1:2,ge=L.params[0];return be=ge,je=D?ge===2?4:ge===4?se(Y.modes.insertMode):ge===12?3:ge===20?se(ae.convertEol):0:ge===1?se(B.applicationCursorKeys):ge===3?ae.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:ge===6?se(B.origin):ge===7?se(B.wraparound):ge===8?3:ge===9?se(U==="X10"):ge===12?se(ae.cursorBlink):ge===25?se(!Y.isCursorHidden):ge===45?se(B.reverseWraparound):ge===66?se(B.applicationKeypad):ge===67?4:ge===1e3?se(U==="VT200"):ge===1002?se(U==="DRAG"):ge===1003?se(U==="ANY"):ge===1004?se(B.sendFocus):ge===1005?4:ge===1006?se(P==="SGR"):ge===1015?4:ge===1016?se(P==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?se(X===z):ge===2004?se(B.bracketedPasteMode):0,Y.triggerDataEvent(`${p.C0.ESC}[${D?"":"?"}${be};${je}$y`),!0;var be,je}_updateAttrColor(L,D,B,U,P){return D===2?(L|=50331648,L&=-16777216,L|=j.AttributeData.fromColorRGB([B,U,P])):D===5&&(L&=-50331904,L|=33554432|255&B),L}_extractColor(L,D,B){const U=[0,0,-1,0,0,0];let P=0,Y=0;do{if(U[Y+P]=L.params[D+Y],L.hasSubParams(D+Y)){const ne=L.getSubParams(D+Y);let Z=0;do U[1]===5&&(P=1),U[Y+Z+1+P]=ne[Z];while(++Z<ne.length&&Z+Y+1+P<U.length);break}if(U[1]===5&&Y+P>=2||U[1]===2&&Y+P>=5)break;U[1]&&(P=1)}while(++Y+D<L.length&&Y+P<U.length);for(let ne=2;ne<U.length;++ne)U[ne]===-1&&(U[ne]=0);switch(U[0]){case 38:B.fg=this._updateAttrColor(B.fg,U[1],U[3],U[4],U[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,U[1],U[3],U[4],U[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,U[1],U[3],U[4],U[5])}return Y}_processUnderline(L,D){D.extended=D.extended.clone(),(!~L||L>5)&&(L=1),D.extended.underlineStyle=L,D.fg|=268435456,L===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(L){L.fg=b.DEFAULT_ATTR_DATA.fg,L.bg=b.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=L.length;let B;const U=this._curAttrData;for(let P=0;P<D;P++)B=L.params[P],B>=30&&B<=37?(U.fg&=-50331904,U.fg|=16777216|B-30):B>=40&&B<=47?(U.bg&=-50331904,U.bg|=16777216|B-40):B>=90&&B<=97?(U.fg&=-50331904,U.fg|=16777224|B-90):B>=100&&B<=107?(U.bg&=-50331904,U.bg|=16777224|B-100):B===0?this._processSGR0(U):B===1?U.fg|=134217728:B===3?U.bg|=67108864:B===4?(U.fg|=268435456,this._processUnderline(L.hasSubParams(P)?L.getSubParams(P)[0]:1,U)):B===5?U.fg|=536870912:B===7?U.fg|=67108864:B===8?U.fg|=1073741824:B===9?U.fg|=2147483648:B===2?U.bg|=134217728:B===21?this._processUnderline(2,U):B===22?(U.fg&=-134217729,U.bg&=-134217729):B===23?U.bg&=-67108865:B===24?(U.fg&=-268435457,this._processUnderline(0,U)):B===25?U.fg&=-536870913:B===27?U.fg&=-67108865:B===28?U.fg&=-1073741825:B===29?U.fg&=2147483647:B===39?(U.fg&=-67108864,U.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):B===49?(U.bg&=-67108864,U.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?P+=this._extractColor(L,P,U):B===53?U.bg|=1073741824:B===55?U.bg&=-1073741825:B===59?(U.extended=U.extended.clone(),U.extended.underlineColor=-1,U.updateExtended()):B===100?(U.fg&=-67108864,U.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,U.bg&=-67108864,U.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${p.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[${D};${B}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const D=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[?${D};${B}R`)}return!0}softReset(L){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(L){const D=L.params[0]||1;switch(D){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const B=D%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(L){const D=L.params[0]||1;let B;return(L.length<2||(B=L.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(L){if(!K(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire(q.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(q.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${p.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const D=[],B=L.split(";");for(;B.length>1;){const U=B.shift(),P=B.shift();if(/^\d+$/.exec(U)){const Y=parseInt(U);if(Q(Y))if(P==="?")D.push({type:0,index:Y});else{const ne=(0,I.parseColor)(P);ne&&D.push({type:1,index:Y,color:ne})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(L){const D=L.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(L,D){this._getCurrentLinkId()&&this._finishHyperlink();const B=L.split(":");let U;const P=B.findIndex((Y=>Y.startsWith("id=")));return P!==-1&&(U=B[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:U,uri:D}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,D){const B=L.split(";");for(let U=0;U<B.length&&!(D>=this._specialColors.length);++U,++D)if(B[U]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const P=(0,I.parseColor)(B[U]);P&&this._onColor.fire([{type:1,index:this._specialColors[D],color:P}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const D=[],B=L.split(";");for(let U=0;U<B.length;++U)if(/^\d+$/.exec(B[U])){const P=parseInt(B[U]);Q(P)&&D.push({type:2,index:P})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(H[L[0]],v.CHARSETS[L[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new y.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const B=this._activeBuffer.ybase+this._activeBuffer.y+D,U=this._activeBuffer.lines.get(B);U&&(U.fill(L),U.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,D){const B=this._bufferService.buffer,U=this._optionsService.rawOptions;return(P=>(this._coreService.triggerDataEvent(`${p.C0.ESC}${P}${p.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[U.cursorStyle]-(U.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,D){this._dirtyRowTracker.markRangeDirty(L,D)}}o.InputHandler=W;let V=class{constructor(te){this._bufferService=te,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(te){te<this.start?this.start=te:te>this.end&&(this.end=te)}markRangeDirty(te,L){te>L&&(O=te,te=L,L=O),te<this.start&&(this.start=te),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(te){return 0<=te&&te<256}V=h([g(0,A.IBufferService)],V)},844:(m,o)=>{function d(h){for(const g of h)g.dispose();h.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const g=this._disposables.indexOf(h);g!==-1&&this._disposables.splice(g,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var g;this._isDisposed||h===this._value||((g=this._value)==null||g.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},o.toDisposable=function(h){return{dispose:h}},o.disposeArray=d,o.getDisposeArrayDisposable=function(h){return{dispose:()=>d(h)}}},1505:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,p,v){this._data[g]||(this._data[g]={}),this._data[g][p]=v}get(g,p){return this._data[g]?this._data[g][p]:void 0}clear(){this._data={}}}o.TwoKeyMap=d,o.FourKeyMap=class{constructor(){this._data=new d}set(h,g,p,v,S){this._data.get(h,g)||this._data.set(h,g,new d),this._data.get(h,g).set(p,v,S)}get(h,g,p,v){var S;return(S=this._data.get(h,g))==null?void 0:S.get(p,v)}clear(){this._data.clear()}}},6114:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const d=o.isNode?"node":navigator.userAgent,h=o.isNode?"node":navigator.platform;o.isFirefox=d.includes("Firefox"),o.isLegacyEdge=d.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(d),o.getSafariVersion=function(){if(!o.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),o.isIpad=h==="iPad",o.isIphone=h==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),o.isLinux=h.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(d)},6106:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let d=0;o.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(d=this._search(this._getKey(h)),this._array.splice(d,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const g=this._getKey(h);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)return!1;do if(this._array[d]===h)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===g);return!1}*getKeyIterator(h){if(this._array.length!==0&&(d=this._search(h),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===h))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===h)}forEachByKey(h,g){if(this._array.length!==0&&(d=this._search(h),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===h))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===h)}values(){return[...this._array].values()}_search(h){let g=0,p=this._array.length-1;for(;p>=g;){let v=g+p>>1;const S=this._getKey(this._array[v]);if(S>h)p=v-1;else{if(!(S<h)){for(;v>0&&this._getKey(this._array[v-1])===h;)v--;return v}g=v+1}}return g}}},7226:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const h=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(S){this._idleCallback=void 0;let E=0,C=0,b=S.timeRemaining(),x=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),x=S.timeRemaining(),1.5*C>x)return b-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-E))}ms`),void this._start();b=x}this.clear()}}class p extends g{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const E=Date.now()+S;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}o.PriorityTaskQueue=p,o.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:p,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const h=d(643);o.updateWindowsModeWrappedState=function(g){const p=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),v=p==null?void 0:p.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&v&&(S.isWrapped=v[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&v[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){const p=new d;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=d;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){const p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,v=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=v}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=h},9092:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const h=d(6349),g=d(7226),p=d(3734),v=d(8437),S=d(4634),E=d(511),C=d(643),b=d(4863),x=d(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(_,y,j){this._hasScrollback=_,this._optionsService=y,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=x.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 h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new p.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new p.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,y){return new v.BufferLine(this._bufferService.cols,this.getNullCell(_),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows}_getCorrectBufferLength(_){if(!this._hasScrollback)return _;const y=_+this._optionsService.rawOptions.scrollback;return y>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=v.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(_))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(_,y){const j=this.getNullCell(v.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<_)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(_,j);let R=0;if(this._rows<y)for(let T=this._rows;T<y;T++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(_,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new v.BufferLine(_,j)));else for(let T=this._rows;T>y;T--)this.lines.length>y+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,_-1),this.y=Math.min(this.y,y-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(_,y),this._cols>_))for(let R=0;R<this.lines.length;R++)A+=+this.lines.get(R).resize(_,j);this._cols=_,this._rows=y,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,y){this._cols!==_&&(_>this._cols?this._reflowLarger(_,y):this._reflowSmaller(_,y))}_reflowLarger(_,y){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,S.reflowLargerCreateNewLayout)(this.lines,j);(0,S.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(_,y,A.countRemoved)}}_reflowLargerAdjustViewport(_,y,j){const A=this.getNullCell(v.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new v.BufferLine(_,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(_,y){const j=this.getNullCell(v.DEFAULT_ATTR_DATA),A=[];let N=0;for(let R=this.lines.length-1;R>=0;R--){let T=this.lines.get(R);if(!T||!T.isWrapped&&T.getTrimmedLength()<=_)continue;const I=[T];for(;T.isWrapped&&R>0;)T=this.lines.get(--R),I.unshift(T);const H=this.ybase+this.y;if(H>=R&&H<R+I.length)continue;const G=I[I.length-1].getTrimmedLength(),K=(0,S.reflowSmallerGetNewLineLengths)(I,this._cols,_),q=K.length-I.length;let O;O=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+q):Math.max(0,this.lines.length-this.lines.maxLength+q);const W=[];for(let B=0;B<q;B++){const U=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);W.push(U)}W.length>0&&(A.push({start:R+I.length+N,newLines:W}),N+=W.length),I.push(...W);let V=K.length-1,Q=K[V];Q===0&&(V--,Q=K[V]);let te=I.length-q-1,L=G;for(;te>=0;){const B=Math.min(L,Q);if(I[V]===void 0)break;if(I[V].copyCellsFrom(I[te],L-B,Q-B,B,!0),Q-=B,Q===0&&(V--,Q=K[V]),L-=B,L===0){te--;const U=Math.max(te,0);L=(0,S.getWrappedLineTrimmedLength)(I,U,this._cols)}}for(let B=0;B<I.length;B++)K[B]<_&&I[B].setCell(K[B],j);let D=q-O;for(;D-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+q,this.ybase+y-1)}if(A.length>0){const R=[],T=[];for(let V=0;V<this.lines.length;V++)T.push(this.lines.get(V));const I=this.lines.length;let H=I-1,G=0,K=A[G];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let q=0;for(let V=Math.min(this.lines.maxLength-1,I+N-1);V>=0;V--)if(K&&K.start>H+q){for(let Q=K.newLines.length-1;Q>=0;Q--)this.lines.set(V--,K.newLines[Q]);V++,R.push({index:H+1,amount:K.newLines.length}),q+=K.newLines.length,K=A[++G]}else this.lines.set(V,T[H--]);let O=0;for(let V=R.length-1;V>=0;V--)R[V].index+=O,this.lines.onInsertEmitter.fire(R[V]),O+=R[V].amount;const W=Math.max(0,I+N-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(_,y,j=0,A){const N=this.lines.get(_);return N?N.translateToString(y,j,A):""}getWrappedRangeForLine(_){let y=_,j=_;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:y,last:j}}setupTabStops(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.rawOptions.tabStopWidth)this.tabs[_]=!0}prevStop(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].line===_&&(this.markers[y].dispose(),this.markers.splice(y--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].dispose(),this.markers.splice(_--,1);this._isClearing=!1}addMarker(_){const y=new b.Marker(_);return this.markers.push(y),y.register(this.lines.onTrim((j=>{y.line-=j,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((j=>{y.line>=j.index&&(y.line+=j.amount)}))),y.register(this.lines.onDelete((j=>{y.line>=j.index&&y.line<j.index+j.amount&&y.dispose(),y.line>j.index&&(y.line-=j.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const h=d(3734),g=d(511),p=d(643),v=d(482);o.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let S=0;class E{constructor(b,x,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=x||g.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]);for(let j=0;j<b;++j)this.setCell(j,y);this.length=b}get(b){const x=this._data[3*b+0],_=2097151&x;return[this._data[3*b+1],2097152&x?this._combined[b]:_?(0,v.stringFromCodePoint)(_):"",x>>22,2097152&x?this._combined[b].charCodeAt(this._combined[b].length-1):_]}set(b,x){this._data[3*b+1]=x[p.CHAR_DATA_ATTR_INDEX],x[p.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=x[1],this._data[3*b+0]=2097152|b|x[p.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[p.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 x=this._data[3*b+0];return 2097152&x?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&x}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const x=this._data[3*b+0];return 2097152&x?this._combined[b]:2097151&x?(0,v.stringFromCodePoint)(2097151&x):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,x){return S=3*b,x.content=this._data[S+0],x.fg=this._data[S+1],x.bg=this._data[S+2],2097152&x.content&&(x.combinedData=this._combined[b]),268435456&x.bg&&(x.extended=this._extendedAttrs[b]),x}setCell(b,x){2097152&x.content&&(this._combined[b]=x.combinedData),268435456&x.bg&&(this._extendedAttrs[b]=x.extended),this._data[3*b+0]=x.content,this._data[3*b+1]=x.fg,this._data[3*b+2]=x.bg}setCellFromCodepoint(b,x,_,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=x|_<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,x,_){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,v.stringFromCodePoint)(x):2097151&y?(this._combined[b]=(0,v.stringFromCodePoint)(2097151&y)+(0,v.stringFromCodePoint)(x),y&=-2097152,y|=2097152):y=x|4194304,_&&(y&=-12582913,y|=_<<22),this._data[3*b+0]=y}insertCells(b,x,_){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),x<this.length-b){const y=new g.CellData;for(let j=this.length-b-x-1;j>=0;--j)this.setCell(b+x+j,this.loadCell(b+j,y));for(let j=0;j<x;++j)this.setCell(b+j,_)}else for(let y=b;y<this.length;++y)this.setCell(y,_);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,_)}deleteCells(b,x,_){if(b%=this.length,x<this.length-b){const y=new g.CellData;for(let j=0;j<this.length-b-x;++j)this.setCell(b+j,this.loadCell(b+x+j,y));for(let j=this.length-x;j<this.length;++j)this.setCell(j,_)}else for(let y=b;y<this.length;++y)this.setCell(y,_);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,_)}replaceCells(b,x,_,y=!1){if(y)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,_),x<this.length&&this.getWidth(x-1)===2&&!this.isProtected(x)&&this.setCellFromCodepoint(x,0,1,_);b<x&&b<this.length;)this.isProtected(b)||this.setCell(b,_),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,_),x<this.length&&this.getWidth(x-1)===2&&this.setCellFromCodepoint(x,0,1,_);b<x&&b<this.length;)this.setCell(b++,_)}resize(b,x){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const _=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const y=new Uint32Array(_);y.set(this._data),this._data=y}for(let y=this.length;y<b;++y)this.setCell(y,x)}else{this._data=this._data.subarray(0,_);const y=Object.keys(this._combined);for(let A=0;A<y.length;A++){const N=parseInt(y[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*_*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,x=!1){if(x)for(let _=0;_<this.length;++_)this.isProtected(_)||this.setCell(_,b);else{this._combined={},this._extendedAttrs={};for(let _=0;_<this.length;++_)this.setCell(_,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 x in b._combined)this._combined[x]=b._combined[x];this._extendedAttrs={};for(const x in b._extendedAttrs)this._extendedAttrs[x]=b._extendedAttrs[x];this.isWrapped=b.isWrapped}clone(){const b=new E(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const x in this._combined)b._combined[x]=this._combined[x];for(const x in this._extendedAttrs)b._extendedAttrs[x]=this._extendedAttrs[x];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,x,_,y,j){const A=b._data;if(j)for(let R=y-1;R>=0;R--){for(let T=0;T<3;T++)this._data[3*(_+R)+T]=A[3*(x+R)+T];268435456&A[3*(x+R)+2]&&(this._extendedAttrs[_+R]=b._extendedAttrs[x+R])}else for(let R=0;R<y;R++){for(let T=0;T<3;T++)this._data[3*(_+R)+T]=A[3*(x+R)+T];268435456&A[3*(x+R)+2]&&(this._extendedAttrs[_+R]=b._extendedAttrs[x+R])}const N=Object.keys(b._combined);for(let R=0;R<N.length;R++){const T=parseInt(N[R],10);T>=x&&(this._combined[T-x+_]=b._combined[T])}}translateToString(b,x,_,y){x=x??0,_=_??this.length,b&&(_=Math.min(_,this.getTrimmedLength())),y&&(y.length=0);let j="";for(;x<_;){const A=this._data[3*x+0],N=2097151&A,R=2097152&A?this._combined[x]:N?(0,v.stringFromCodePoint)(N):p.WHITESPACE_CELL_CHAR;if(j+=R,y)for(let T=0;T<R.length;++T)y.push(x);x+=A>>22||1}return y&&y.push(x),j}}o.BufferLine=E},4841:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(d,h){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 h*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(m,o)=>{function d(h,g,p){if(g===h.length-1)return h[g].getTrimmedLength();const v=!h[g].hasContent(p-1)&&h[g].getWidth(p-1)===1,S=h[g+1].getWidth(0)===2;return v&&S?p-1:p}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(h,g,p,v,S){const E=[];for(let C=0;C<h.length-1;C++){let b=C,x=h.get(++b);if(!x.isWrapped)continue;const _=[h.get(C)];for(;b<h.length&&x.isWrapped;)_.push(x),x=h.get(++b);if(v>=C&&v<b){C+=_.length-1;continue}let y=0,j=d(_,y,g),A=1,N=0;for(;A<_.length;){const T=d(_,A,g),I=T-N,H=p-j,G=Math.min(I,H);_[y].copyCellsFrom(_[A],N,j,G,!1),j+=G,j===p&&(y++,j=0),N+=G,N===T&&(A++,N=0),j===0&&y!==0&&_[y-1].getWidth(p-1)===2&&(_[y].copyCellsFrom(_[y-1],p-1,j++,1,!1),_[y-1].setCell(p-1,S))}_[y].replaceCells(j,p,S);let R=0;for(let T=_.length-1;T>0&&(T>y||_[T].getTrimmedLength()===0);T--)R++;R>0&&(E.push(C+_.length-R),E.push(R)),C+=_.length-1}return E},o.reflowLargerCreateNewLayout=function(h,g){const p=[];let v=0,S=g[v],E=0;for(let C=0;C<h.length;C++)if(S===C){const b=g[++v];h.onDeleteEmitter.fire({index:C-E,amount:b}),C+=b-1,E+=b,S=g[++v]}else p.push(C);return{layout:p,countRemoved:E}},o.reflowLargerApplyNewLayout=function(h,g){const p=[];for(let v=0;v<g.length;v++)p.push(h.get(g[v]));for(let v=0;v<p.length;v++)h.set(v,p[v]);h.length=g.length},o.reflowSmallerGetNewLineLengths=function(h,g,p){const v=[],S=h.map(((x,_)=>d(h,_,g))).reduce(((x,_)=>x+_));let E=0,C=0,b=0;for(;b<S;){if(S-b<p){v.push(S-b);break}E+=p;const x=d(h,C,g);E>x&&(E-=x,C++);const _=h[C].getWidth(E-1)===2;_&&E--;const y=_?p-1:p;v.push(y),b+=y}return v},o.getWrappedLineTrimmedLength=d},5295:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const h=d(8460),g=d(844),p=d(9092);class v extends g.Disposable{constructor(E,C){super(),this._optionsService=E,this._bufferService=C,this._onBufferActivate=this.register(new h.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 p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.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)}}o.BufferSet=v},511:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const h=d(482),g=d(643),p=d(3734);class v extends p.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new v;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,h.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 x=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=x&&x<=57343?this.content=1024*(b-55296)+x-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()]}}o.CellData=v},643:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const h=d(8460),g=d(844);class p{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=p._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(S){return this._disposables.push(S),S}}o.Marker=p,p._nextId=1},7116:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(m,o)=>{var d,h,g;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(p){p.NUL="\0",p.SOH="",p.STX="",p.ETX="",p.EOT="",p.ENQ="",p.ACK="",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
64
+ `,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="",p.SI="",p.DLE="",p.DC1="",p.DC2="",p.DC3="",p.DC4="",p.NAK="",p.SYN="",p.ETB="",p.CAN="",p.EM="",p.SUB="",p.ESC="\x1B",p.FS="",p.GS="",p.RS="",p.US="",p.SP=" ",p.DEL=""})(d||(o.C0=d={})),(function(p){p.PAD="€",p.HOP="",p.BPH="‚",p.NBH="ƒ",p.IND="„",p.NEL="…",p.SSA="†",p.ESA="‡",p.HTS="ˆ",p.HTJ="‰",p.VTS="Š",p.PLD="‹",p.PLU="Œ",p.RI="",p.SS2="Ž",p.SS3="",p.DCS="",p.PU1="‘",p.PU2="’",p.STS="“",p.CCH="”",p.MW="•",p.SPA="–",p.EPA="—",p.SOS="˜",p.SGCI="™",p.SCI="š",p.CSI="›",p.ST="œ",p.OSC="",p.PM="ž",p.APC="Ÿ"})(h||(o.C1=h={})),(function(p){p.ST=`${d.ESC}\\`})(g||(o.C1_ESCAPED=g={}))},7399:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const h=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:["'",'"']};o.evaluateKeyboardEvent=function(p,v,S,E){const C={type:0,cancel:!1,key:void 0},b=(p.shiftKey?1:0)|(p.altKey?2:0)|(p.ctrlKey?4:0)|(p.metaKey?8:0);switch(p.keyCode){case 0:p.key==="UIKeyInputUpArrow"?C.key=v?h.C0.ESC+"OA":h.C0.ESC+"[A":p.key==="UIKeyInputLeftArrow"?C.key=v?h.C0.ESC+"OD":h.C0.ESC+"[D":p.key==="UIKeyInputRightArrow"?C.key=v?h.C0.ESC+"OC":h.C0.ESC+"[C":p.key==="UIKeyInputDownArrow"&&(C.key=v?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:C.key=p.ctrlKey?"\b":h.C0.DEL,p.altKey&&(C.key=h.C0.ESC+C.key);break;case 9:if(p.shiftKey){C.key=h.C0.ESC+"[Z";break}C.key=h.C0.HT,C.cancel=!0;break;case 13:C.key=p.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,C.cancel=!0;break;case 27:C.key=h.C0.ESC,p.altKey&&(C.key=h.C0.ESC+h.C0.ESC),C.cancel=!0;break;case 37:if(p.metaKey)break;b?(C.key=h.C0.ESC+"[1;"+(b+1)+"D",C.key===h.C0.ESC+"[1;3D"&&(C.key=h.C0.ESC+(S?"b":"[1;5D"))):C.key=v?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(p.metaKey)break;b?(C.key=h.C0.ESC+"[1;"+(b+1)+"C",C.key===h.C0.ESC+"[1;3C"&&(C.key=h.C0.ESC+(S?"f":"[1;5C"))):C.key=v?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(p.metaKey)break;b?(C.key=h.C0.ESC+"[1;"+(b+1)+"A",S||C.key!==h.C0.ESC+"[1;3A"||(C.key=h.C0.ESC+"[1;5A")):C.key=v?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(p.metaKey)break;b?(C.key=h.C0.ESC+"[1;"+(b+1)+"B",S||C.key!==h.C0.ESC+"[1;3B"||(C.key=h.C0.ESC+"[1;5B")):C.key=v?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:p.shiftKey||p.ctrlKey||(C.key=h.C0.ESC+"[2~");break;case 46:C.key=b?h.C0.ESC+"[3;"+(b+1)+"~":h.C0.ESC+"[3~";break;case 36:C.key=b?h.C0.ESC+"[1;"+(b+1)+"H":v?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:C.key=b?h.C0.ESC+"[1;"+(b+1)+"F":v?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:p.shiftKey?C.type=2:p.ctrlKey?C.key=h.C0.ESC+"[5;"+(b+1)+"~":C.key=h.C0.ESC+"[5~";break;case 34:p.shiftKey?C.type=3:p.ctrlKey?C.key=h.C0.ESC+"[6;"+(b+1)+"~":C.key=h.C0.ESC+"[6~";break;case 112:C.key=b?h.C0.ESC+"[1;"+(b+1)+"P":h.C0.ESC+"OP";break;case 113:C.key=b?h.C0.ESC+"[1;"+(b+1)+"Q":h.C0.ESC+"OQ";break;case 114:C.key=b?h.C0.ESC+"[1;"+(b+1)+"R":h.C0.ESC+"OR";break;case 115:C.key=b?h.C0.ESC+"[1;"+(b+1)+"S":h.C0.ESC+"OS";break;case 116:C.key=b?h.C0.ESC+"[15;"+(b+1)+"~":h.C0.ESC+"[15~";break;case 117:C.key=b?h.C0.ESC+"[17;"+(b+1)+"~":h.C0.ESC+"[17~";break;case 118:C.key=b?h.C0.ESC+"[18;"+(b+1)+"~":h.C0.ESC+"[18~";break;case 119:C.key=b?h.C0.ESC+"[19;"+(b+1)+"~":h.C0.ESC+"[19~";break;case 120:C.key=b?h.C0.ESC+"[20;"+(b+1)+"~":h.C0.ESC+"[20~";break;case 121:C.key=b?h.C0.ESC+"[21;"+(b+1)+"~":h.C0.ESC+"[21~";break;case 122:C.key=b?h.C0.ESC+"[23;"+(b+1)+"~":h.C0.ESC+"[23~";break;case 123:C.key=b?h.C0.ESC+"[24;"+(b+1)+"~":h.C0.ESC+"[24~";break;default:if(!p.ctrlKey||p.shiftKey||p.altKey||p.metaKey)if(S&&!E||!p.altKey||p.metaKey)!S||p.altKey||p.ctrlKey||p.shiftKey||!p.metaKey?p.key&&!p.ctrlKey&&!p.altKey&&!p.metaKey&&p.keyCode>=48&&p.key.length===1?C.key=p.key:p.key&&p.ctrlKey&&(p.key==="_"&&(C.key=h.C0.US),p.key==="@"&&(C.key=h.C0.NUL)):p.keyCode===65&&(C.type=1);else{const x=g[p.keyCode],_=x==null?void 0:x[p.shiftKey?1:0];if(_)C.key=h.C0.ESC+_;else if(p.keyCode>=65&&p.keyCode<=90){const y=p.ctrlKey?p.keyCode-64:p.keyCode+32;let j=String.fromCharCode(y);p.shiftKey&&(j=j.toUpperCase()),C.key=h.C0.ESC+j}else if(p.keyCode===32)C.key=h.C0.ESC+(p.ctrlKey?h.C0.NUL:" ");else if(p.key==="Dead"&&p.code.startsWith("Key")){let y=p.code.slice(3,4);p.shiftKey||(y=y.toLowerCase()),C.key=h.C0.ESC+y,C.cancel=!0}}else p.keyCode>=65&&p.keyCode<=90?C.key=String.fromCharCode(p.keyCode-64):p.keyCode===32?C.key=h.C0.NUL:p.keyCode>=51&&p.keyCode<=55?C.key=String.fromCharCode(p.keyCode-51+27):p.keyCode===56?C.key=h.C0.DEL:p.keyCode===219?C.key=h.C0.ESC:p.keyCode===220?C.key=h.C0.FS:p.keyCode===221&&(C.key=h.C0.GS)}return C}},482:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},o.utf32ToString=function(d,h=0,g=d.length){let p="";for(let v=h;v<g;++v){let S=d[v];S>65535?(S-=65536,p+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):p+=String.fromCharCode(S)}return p},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,h){const g=d.length;if(!g)return 0;let p=0,v=0;if(this._interim){const S=d.charCodeAt(v++);56320<=S&&S<=57343?h[p++]=1024*(this._interim-55296)+S-56320+65536:(h[p++]=this._interim,h[p++]=S),this._interim=0}for(let S=v;S<g;++S){const E=d.charCodeAt(S);if(55296<=E&&E<=56319){if(++S>=g)return this._interim=E,p;const C=d.charCodeAt(S);56320<=C&&C<=57343?h[p++]=1024*(E-55296)+C-56320+65536:(h[p++]=E,h[p++]=C)}else E!==65279&&(h[p++]=E)}return p}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,h){const g=d.length;if(!g)return 0;let p,v,S,E,C=0,b=0,x=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,R=0;for(;(N=63&this.interim[++R])&&R<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=T-R;for(;x<I;){if(x>=g)return 0;if(N=d[x++],(192&N)!=128){x--,j=!0;break}this.interim[R++]=N,A<<=6,A|=63&N}j||(T===2?A<128?x--:h[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(h[C++]=A):A<65536||A>1114111||(h[C++]=A)),this.interim.fill(0)}const _=g-4;let y=x;for(;y<g;){for(;!(!(y<_)||128&(p=d[y])||128&(v=d[y+1])||128&(S=d[y+2])||128&(E=d[y+3]));)h[C++]=p,h[C++]=v,h[C++]=S,h[C++]=E,y+=4;if(p=d[y++],p<128)h[C++]=p;else if((224&p)==192){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(b=(31&p)<<6|63&v,b<128){y--;continue}h[C++]=b}else if((240&p)==224){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,C;if(S=d[y++],(192&S)!=128){y--;continue}if(b=(15&p)<<12|(63&v)<<6|63&S,b<2048||b>=55296&&b<=57343||b===65279)continue;h[C++]=b}else if((248&p)==240){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,C;if(S=d[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,this.interim[2]=S,C;if(E=d[y++],(192&E)!=128){y--;continue}if(b=(7&p)<<18|(63&v)<<12|(63&S)<<6|63&E,b<65536||b>1114111)continue;h[C++]=b}}return C}}},225:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const h=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]],p=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let v;o.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let S=0;S<g.length;++S)v.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?v[S]:(function(E,C){let b,x=0,_=C.length-1;if(E<C[0][0]||E>C[_][1])return!1;for(;_>=x;)if(b=x+_>>1,E>C[b][1])x=b+1;else{if(!(E<C[b][0]))return!0;_=b-1}return!1})(S,p)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,E){let C=this.wcwidth(S),b=C===0&&E!==0;if(b){const x=h.UnicodeService.extractWidth(E);x===0?b=!1:x>C&&(C=x)}return h.UnicodeService.createPropertyValue(0,C,b)}}},5981:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const h=d(8460),g=d(844);class p extends g.Disposable{constructor(S){super(),this._action=S,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,E){if(E!==void 0&&this._syncCalls>E)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,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+=S.length,this._writeBuffer.push(S),this._callbacks.push(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(E)}_innerWrite(S=0,E=!0){const C=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],x=this._action(b,E);if(x){const y=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void x.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(y)}const _=this._callbacks[this._bufferOffset];if(_&&_(),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()}}o.WriteBuffer=p},5941:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.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})$/,h=/^[\da-f]+$/;function g(p,v){const S=p.toString(16),E=S.length<2?"0"+S:S;switch(v){case 4:return S[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}o.parseColor=function(p){if(!p)return;let v=p.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const S=d.exec(v);if(S){const E=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/E*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/E*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/E*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),h.exec(v)&&[3,6,9,12].includes(v.length))){const S=v.length/3,E=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(v.slice(S*C,S*C+S),16);E[C]=S===1?b<<4:S===2?b:S===3?b>>4:b>>8}return E}},o.toRgbString=function(p,v=16){const[S,E,C]=p;return`rgb:${g(S,v)}/${g(E,v)}/${g(C,v)}`}},5770:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const h=d(482),g=d(8742),p=d(5770),v=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const b=this._handlers[E];return b.push(C),{dispose:()=>{const x=b.indexOf(C);x!==-1&&b.splice(x,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=v,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||v,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 x=this._active.length-1;x>=0;x--)this._active[x].put(E,C,b);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(E,C,b))}unhook(E,C=!0){if(this._active.length){let b=!1,x=this._active.length-1,_=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,b=C,_=this._stack.fallThrough,this._stack.paused=!1),!_&&b===!1){for(;x>=0&&(b=this._active[x].unhook(E),b!==!0);x--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,b;x--}for(;x>=0;x--)if(b=this._active[x].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",E);this._active=v,this._ident=0}};const S=new g.Params;S.addParam(0),o.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=S,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():S,this._data="",this._hitLimit=!1}put(E,C,b){this._hitLimit||(this._data+=(0,h.utf32ToString)(E,C,b),this._data.length>p.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=S,this._data="",this._hitLimit=!1,b)));return this._params=S,this._data="",this._hitLimit=!1,C}}},2015:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const h=d(844),g=d(8742),p=d(6242),v=d(6351);class S{constructor(x){this.table=new Uint8Array(x)}setDefault(x,_){this.table.fill(x<<4|_)}add(x,_,y,j){this.table[_<<8|x]=y<<4|j}addMany(x,_,y,j){for(let A=0;A<x.length;A++)this.table[_<<8|x[A]]=y<<4|j}}o.TransitionTable=S;const E=160;o.VT500_TRANSITION_TABLE=(function(){const b=new S(4095),x=Array.apply(null,Array(256)).map(((R,T)=>T)),_=(R,T)=>x.slice(R,T),y=_(32,127),j=_(0,24);j.push(25),j.push.apply(j,_(28,32));const A=_(0,14);let N;for(N in b.setDefault(1,0),b.addMany(y,0,2,0),A)b.addMany([24,26,153,154],N,3,0),b.addMany(_(128,144),N,3,0),b.addMany(_(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(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(_(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,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(_(64,127),3,7,0),b.addMany(_(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(_(48,60),4,8,4),b.addMany(_(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(_(32,64),6,0,6),b.add(127,6,0,6),b.addMany(_(64,127),6,0,0),b.addMany(_(32,48),3,9,5),b.addMany(_(32,48),5,9,5),b.addMany(_(48,64),5,0,6),b.addMany(_(64,127),5,7,0),b.addMany(_(32,48),4,9,5),b.addMany(_(32,48),1,9,2),b.addMany(_(32,48),2,9,2),b.addMany(_(48,127),2,10,0),b.addMany(_(48,80),1,10,0),b.addMany(_(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(_(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(_(28,32),9,0,9),b.addMany(_(32,48),9,9,12),b.addMany(_(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(j,11,0,11),b.addMany(_(32,128),11,0,11),b.addMany(_(28,32),11,0,11),b.addMany(j,10,0,10),b.add(127,10,0,10),b.addMany(_(28,32),10,0,10),b.addMany(_(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(_(32,48),10,9,12),b.addMany(j,12,0,12),b.add(127,12,0,12),b.addMany(_(28,32),12,0,12),b.addMany(_(32,48),12,9,12),b.addMany(_(48,64),12,0,11),b.addMany(_(64,127),12,12,13),b.addMany(_(64,127),10,12,13),b.addMany(_(64,127),9,12,13),b.addMany(j,13,13,13),b.addMany(y,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 h.Disposable{constructor(x=o.VT500_TRANSITION_TABLE){super(),this._transitions=x,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,j)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,y)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new p.OscParser),this._dcsParser=this.register(new v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(x,_=[64,126]){let y=0;if(x.prefix){if(x.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=x.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(x.intermediates){if(x.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<x.intermediates.length;++A){const N=x.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(x.final.length!==1)throw new Error("final must be a single byte");const j=x.final.charCodeAt(0);if(_[0]>j||j>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return y<<=8,y|=j,y}identToString(x){const _=[];for(;x;)_.push(String.fromCharCode(255&x)),x>>=8;return _.reverse().join("")}setPrintHandler(x){this._printHandler=x}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(x,_){const y=this._identifier(x,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const j=this._escHandlers[y];return j.push(_),{dispose:()=>{const A=j.indexOf(_);A!==-1&&j.splice(A,1)}}}clearEscHandler(x){this._escHandlers[this._identifier(x,[48,126])]&&delete this._escHandlers[this._identifier(x,[48,126])]}setEscHandlerFallback(x){this._escHandlerFb=x}setExecuteHandler(x,_){this._executeHandlers[x.charCodeAt(0)]=_}clearExecuteHandler(x){this._executeHandlers[x.charCodeAt(0)]&&delete this._executeHandlers[x.charCodeAt(0)]}setExecuteHandlerFallback(x){this._executeHandlerFb=x}registerCsiHandler(x,_){const y=this._identifier(x);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const j=this._csiHandlers[y];return j.push(_),{dispose:()=>{const A=j.indexOf(_);A!==-1&&j.splice(A,1)}}}clearCsiHandler(x){this._csiHandlers[this._identifier(x)]&&delete this._csiHandlers[this._identifier(x)]}setCsiHandlerFallback(x){this._csiHandlerFb=x}registerDcsHandler(x,_){return this._dcsParser.registerHandler(this._identifier(x),_)}clearDcsHandler(x){this._dcsParser.clearHandler(this._identifier(x))}setDcsHandlerFallback(x){this._dcsParser.setHandlerFallback(x)}registerOscHandler(x,_){return this._oscParser.registerHandler(x,_)}clearOscHandler(x){this._oscParser.clearHandler(x)}setOscHandlerFallback(x){this._oscParser.setHandlerFallback(x)}setErrorHandler(x){this._errorHandler=x}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(x,_,y,j,A){this._parseStack.state=x,this._parseStack.handlers=_,this._parseStack.handlerPos=y,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(x,_,y){let j,A=0,N=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(y===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(y===!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(y===!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=x[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,y),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=x[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,y),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=R;T<_;++T){switch(A=x[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let q=T+1;;++q){if(q>=_||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=_||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=_||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}if(++q>=_||(A=x[q])<32||A>126&&A<E){this._printHandler(x,T,q),T=q-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|A];let H=I?I.length-1:-1;for(;H>=0&&(j=I[H](this._params),j!==!0);H--)if(j instanceof Promise)return this._preserveStack(3,I,H,N,T),j;H<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++T<_&&(A=x[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const G=this._escHandlers[this._collect<<8|A];let K=G?G.length-1:-1;for(;K>=0&&(j=G[K](),j!==!0);K--)if(j instanceof Promise)return this._preserveStack(4,G,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 q=T+1;;++q)if(q>=_||(A=x[q])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(x,T,q),T=q-1;break}break;case 14:if(j=this._dcsParser.unhook(A!==24&&A!==26),j)return this._preserveStack(6,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let q=T+1;;q++)if(q>=_||(A=x[q])<32||A>127&&A<E){this._oscParser.put(x,T,q),T=q-1;break}break;case 6:if(j=this._oscParser.end(A!==24&&A!==26),j)return this._preserveStack(5,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}o.EscapeSequenceParser=C},6242:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const h=d(5770),g=d(482),p=[];o.OscParser=class{constructor(){this._state=0,this._active=p,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,S){this._handlers[v]===void 0&&(this._handlers[v]=[]);const E=this._handlers[v];return E.push(S),{dispose:()=>{const C=E.indexOf(S);C!==-1&&E.splice(C,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=p,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||p,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,S,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(v,S,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,S,E))}start(){this.reset(),this._state=1}put(v,S,E){if(this._state!==3){if(this._state===1)for(;S<E;){const C=v[S++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&E-S>0&&this._put(v,S,E)}}end(v,S=!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=S,b=this._stack.fallThrough,this._stack.paused=!1),!b&&E===!1){for(;C>=0&&(E=this._active[C].end(v),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",v);this._active=p,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,S,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,S,E),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let S=!1;if(this._hitLimit)S=!1;else if(v&&(S=this._handler(this._data),S instanceof Promise))return S.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,S}}},8742:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const d=2147483647;class h{static fromArray(p){const v=new h;if(!p.length)return v;for(let S=Array.isArray(p[0])?1:0;S<p.length;++S){const E=p[S];if(Array.isArray(E))for(let C=0;C<E.length;++C)v.addSubParam(E[C]);else v.addParam(E)}return v}constructor(p=32,v=32){if(this.maxLength=p,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const p=new h(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){const p=[];for(let v=0;v<this.length;++v){p.push(this.params[v]);const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-S>0&&p.push(Array.prototype.slice.call(this._subParams,S,E))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>d?d:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>d?d:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){const v=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];return S-v>0?this._subParams.subarray(v,S):null}getSubParamsAll(){const p={};for(let v=0;v<this.length;++v){const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-S>0&&(p[v]=this._subParams.slice(S,E))}return p}addDigit(p){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,E=S[v-1];S[v-1]=~E?Math.min(10*E+p,d):p}}o.Params=h},5741:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,h){const g={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(g),h.dispose=()=>this._wrappedAddonDispose(g),h.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let h=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){h=g;break}if(h===-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(h,1)}}},8771:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const h=d(3785),g=d(511);o.BufferApiView=class{constructor(p,v){this._buffer=p,this.type=v}init(p){return this._buffer=p,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(p){const v=this._buffer.lines.get(p);if(v)return new h.BufferLineApiView(v)}getNullCell(){return new g.CellData}}},3785:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const h=d(511);o.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,p){if(!(g<0||g>=this._line.length))return p?(this._line.loadCell(g,p),p):this._line.loadCell(g,new h.CellData)}translateToString(g,p,v){return this._line.translateToString(g,p,v)}}},8285:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const h=d(8771),g=d(8460),p=d(844);class v extends p.Disposable{constructor(E){super(),this._core=E,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=v},7975:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,h){return this._core.registerCsiHandler(d,(g=>h(g.toArray())))}addCsiHandler(d,h){return this.registerCsiHandler(d,h)}registerDcsHandler(d,h){return this._core.registerDcsHandler(d,((g,p)=>h(g,p.toArray())))}addDcsHandler(d,h){return this.registerDcsHandler(d,h)}registerEscHandler(d,h){return this._core.registerEscHandler(d,h)}addEscHandler(d,h){return this.registerEscHandler(d,h)}registerOscHandler(d,h){return this._core.registerOscHandler(d,h)}addOscHandler(d,h){return this.registerOscHandler(d,h)}}},7090:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.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(m,o,d){var h=this&&this.__decorate||function(b,x,_,y){var j,A=arguments.length,N=A<3?x:y===null?y=Object.getOwnPropertyDescriptor(x,_):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,x,_,y);else for(var R=b.length-1;R>=0;R--)(j=b[R])&&(N=(A<3?j(N):A>3?j(x,_,N):j(x,_))||N);return A>3&&N&&Object.defineProperty(x,_,N),N},g=this&&this.__param||function(b,x){return function(_,y){x(_,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const p=d(8460),v=d(844),S=d(5295),E=d(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new p.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(b,this))}resize(b,x){this.cols=b,this.rows=x,this.buffers.resize(b,x),this._onResize.fire({cols:b,rows:x})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,x=!1){const _=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=_.getBlankLine(b,x),this._cachedBlankLine=y),y.isWrapped=x;const j=_.ybase+_.scrollTop,A=_.ybase+_.scrollBottom;if(_.scrollTop===0){const N=_.lines.isFull;A===_.lines.length-1?N?_.lines.recycle().copyFrom(y):_.lines.push(y.clone()):_.lines.splice(A+1,0,y.clone()),N?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const N=A-j+1;_.lines.shiftElements(j+1,N-1,-1),_.lines.set(A,y.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(b,x,_){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const j=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),j!==y.ydisp&&(x||this._onScroll.fire(y.ydisp))}};o.BufferService=C=h([g(0,E.IOptionsService)],C)},7994:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,h){this._charsets[d]=h,this.glevel===d&&(this.charset=h)}}},1753:function(m,o,d){var h=this&&this.__decorate||function(y,j,A,N){var R,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(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(R=y[H])&&(I=(T<3?R(I):T>3?R(j,A,I):R(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const p=d(2585),v=d(8460),S=d(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,j){let A=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(A|=64,A|=y.action):(A|=3&y.button,4&y.button&&(A|=64),8&y.button&&(A|=128),y.action===32?A|=32:y.action!==0||j||(A|=3)),A}const b=String.fromCharCode,x={DEFAULT:y=>{const j=[C(y,!1)+32,y.col+32,y.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${b(j[0])}${b(j[1])}${b(j[2])}`},SGR:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${j}`},SGR_PIXELS:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${j}`}};let _=o.CoreMouseService=class extends S.Disposable{constructor(y,j){super(),this._bufferService=y,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(x))this.addEncoding(A,x[A]);this.reset()}addProtocol(y,j){this._protocols[y]=j}addEncoding(y,j){this._encodings[y]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const j=this._encodings[this._activeEncoding](y);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,j,A){if(A){if(y.x!==j.x||y.y!==j.y)return!1}else if(y.col!==j.col||y.row!==j.row)return!1;return y.button===j.button&&y.action===j.action&&y.ctrl===j.ctrl&&y.alt===j.alt&&y.shift===j.shift}};o.CoreMouseService=_=h([g(0,p.IBufferService),g(1,p.ICoreService)],_)},6975:function(m,o,d){var h=this&&this.__decorate||function(_,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(_,y,j,A);else for(var I=_.length-1;I>=0;I--)(N=_[I])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(_,y){return function(j,A){y(j,A,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const p=d(1439),v=d(8460),S=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 x=o.CoreService=class extends S.Disposable{constructor(_,y,j){super(),this._bufferService=_,this._logService=y,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,p.clone)(C),this.decPrivateModes=(0,p.clone)(b)}reset(){this.modes=(0,p.clone)(C),this.decPrivateModes=(0,p.clone)(b)}triggerDataEvent(_,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(_))}};o.CoreService=x=h([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],x)},9074:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const h=d(8055),g=d(8460),p=d(844),v=d(6106);let S=0,E=0;class C extends p.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((_=>_==null?void 0:_.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,p.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const y=new b(_);if(y){const j=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),j.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,y,j){let A=0,N=0;for(const R of this._decorations.getKeyIterator(y))A=R.options.x??0,N=A+(R.options.width??1),_>=A&&_<N&&(!j||(R.options.layer??"bottom")===j)&&(yield R)}forEachDecorationAtCell(_,y,j,A){this._decorations.forEachByKey(y,(N=>{S=N.options.x??0,E=S+(N.options.width??1),_>=S&&_<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}o.DecorationService=C;class b extends p.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(_){super(),this.options=_,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=_.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const h=d(2585),g=d(8343);class p{constructor(...S){this._entries=new Map;for(const[E,C]of S)this.set(E,C)}set(S,E){const C=this._entries.get(S);return this._entries.set(S,E),C}forEach(S){for(const[E,C]of this._entries.entries())S(E,C)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}o.ServiceCollection=p,o.InstantiationService=class{constructor(){this._services=new p,this._services.set(h.IInstantiationService,this)}setService(v,S){this._services.set(v,S)}getService(v){return this._services.get(v)}createInstance(v,...S){const E=(0,g.getServiceDependencies)(v).sort(((x,_)=>x.index-_.index)),C=[];for(const x of E){const _=this._services.get(x.id);if(!_)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${x.id}.`);C.push(_)}const b=E.length>0?E[0].index:S.length;if(S.length!==b)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${b+1} conflicts with ${S.length} static arguments`);return new v(...S,...C)}}},7866:function(m,o,d){var h=this&&this.__decorate||function(b,x,_,y){var j,A=arguments.length,N=A<3?x:y===null?y=Object.getOwnPropertyDescriptor(x,_):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,x,_,y);else for(var R=b.length-1;R>=0;R--)(j=b[R])&&(N=(A<3?j(N):A>3?j(x,_,N):j(x,_))||N);return A>3&&N&&Object.defineProperty(x,_,N),N},g=this&&this.__param||function(b,x){return function(_,y){x(_,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const p=d(844),v=d(2585),S={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let E,C=o.LogService=class extends p.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let x=0;x<b.length;x++)typeof b[x]=="function"&&(b[x]=b[x]())}_log(b,x,_){this._evalLazyOptionalParams(_),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+x,..._)}trace(b,...x){var _;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.trace.bind(this._optionsService.options.logger))??console.log,b,x)}debug(b,...x){var _;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.debug.bind(this._optionsService.options.logger))??console.log,b,x)}info(b,...x){var _;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.info.bind(this._optionsService.options.logger))??console.info,b,x)}warn(b,...x){var _;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.warn.bind(this._optionsService.options.logger))??console.warn,b,x)}error(b,...x){var _;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((_=this._optionsService.options.logger)==null?void 0:_.error.bind(this._optionsService.options.logger))??console.error,b,x)}};o.LogService=C=h([g(0,v.IOptionsService)],C),o.setTraceLogger=function(b){E=b},o.traceCall=function(b,x,_){if(typeof _.value!="function")throw new Error("not supported");const y=_.value;_.value=function(...j){if(E.logLevel!==v.LogLevelEnum.TRACE)return y.apply(this,j);E.trace(`GlyphRenderer#${y.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=y.apply(this,j);return E.trace(`GlyphRenderer#${y.name} return`,A),A}}},7302:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const h=d(8460),g=d(844),p=d(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const x in C)if(x in b)try{const _=C[x];b[x]=this._sanitizeAndValidateOption(x,_)}catch(_){console.error(_)}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((x=>{x===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((x=>{C.indexOf(x)!==-1&&b()}))}_setupOptions(){const C=x=>{if(!(x in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);return this.rawOptions[x]},b=(x,_)=>{if(!(x in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${x}"`);_=this._sanitizeAndValidateOption(x,_),this.rawOptions[x]!==_&&(this.rawOptions[x]=_,this._onOptionChange.fire(x))};for(const x in this.rawOptions){const _={get:C.bind(this,x),set:b.bind(this,x)};Object.defineProperty(this.options,x,_)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(x){return x==="block"||x==="underline"||x==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=v.includes(b)?b:o.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}}o.OptionsService=S},2660:function(m,o,d){var h=this&&this.__decorate||function(S,E,C,b){var x,_=arguments.length,y=_<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(S,E,C,b);else for(var j=S.length-1;j>=0;j--)(x=S[j])&&(y=(_<3?x(y):_>3?x(E,C,y):x(E,C))||y);return _>3&&y&&Object.defineProperty(E,C,y),y},g=this&&this.__param||function(S,E){return function(C,b){E(C,b,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const p=d(2585);let v=o.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const E=this._bufferService.buffer;if(S.id===void 0){const j=E.addMarker(E.ybase+E.y),A={data:S,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=S,b=this._getEntryIdKey(C),x=this._entriesWithId.get(b);if(x)return this.addLineToLink(x.id,E.ybase+E.y),x.id;const _=E.addMarker(E.ybase+E.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(y,_))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(S,E){const C=this._dataByLinkId.get(S);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(S){var E;return(E=this._dataByLinkId.get(S))==null?void 0:E.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,E){const C=S.lines.indexOf(E);C!==-1&&(S.lines.splice(C,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};o.OscLinkService=v=h([g(0,p.IBufferService)],v)},8343:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const d="di$target",h="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(g){return g[h]||[]},o.createDecorator=function(g){if(o.serviceRegistry.has(g))return o.serviceRegistry.get(g);const p=function(v,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,x){b[d]===b?b[h].push({id:C,index:x}):(b[h]=[{id:C,index:x}],b[d]=b)})(p,v,E)};return p.toString=()=>g,o.serviceRegistry.set(g,p),p}},2585:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const h=d(8343);var g;o.IBufferService=(0,h.createDecorator)("BufferService"),o.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),o.ICoreService=(0,h.createDecorator)("CoreService"),o.ICharsetService=(0,h.createDecorator)("CharsetService"),o.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(p){p[p.TRACE=0]="TRACE",p[p.DEBUG=1]="DEBUG",p[p.INFO=2]="INFO",p[p.WARN=3]="WARN",p[p.ERROR=4]="ERROR",p[p.OFF=5]="OFF"})(g||(o.LogLevelEnum=g={})),o.ILogService=(0,h.createDecorator)("LogService"),o.IOptionsService=(0,h.createDecorator)("OptionsService"),o.IOscLinkService=(0,h.createDecorator)("OscLinkService"),o.IUnicodeService=(0,h.createDecorator)("UnicodeService"),o.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const h=d(8460),g=d(225);class p{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,E,C=!1){return(16777215&S)<<3|(3&E)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const S=new g.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let E=0,C=0;const b=S.length;for(let x=0;x<b;++x){let _=S.charCodeAt(x);if(55296<=_&&_<=56319){if(++x>=b)return E+this.wcwidth(_);const A=S.charCodeAt(x);56320<=A&&A<=57343?_=1024*(_-55296)+A-56320+65536:E+=this.wcwidth(A)}const y=this.charProperties(_,C);let j=p.extractWidth(y);p.extractShouldJoin(y)&&(j-=p.extractWidth(C)),E+=j,C=y}return E}charProperties(S,E){return this._activeProvider.charProperties(S,E)}}o.UnicodeService=p}},s={};function l(m){var o=s[m];if(o!==void 0)return o.exports;var d=s[m]={exports:{}};return r[m].call(d.exports,d,d.exports,l),d.exports}var f={};return(()=>{var m=f;Object.defineProperty(m,"__esModule",{value:!0}),m.Terminal=void 0;const o=l(9042),d=l(3236),h=l(844),g=l(5741),p=l(8285),v=l(7975),S=l(7090),E=["cols","rows"];class C extends h.Disposable{constructor(x){super(),this._core=this.register(new d.Terminal(x)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const _=j=>this._core.options[j],y=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:_.bind(this,j),set:y.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(x){if(E.includes(x))throw new Error(`Option "${x}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new p.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const x=this._core.coreService.decPrivateModes;let _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:x.applicationCursorKeys,applicationKeypadMode:x.applicationKeypad,bracketedPasteMode:x.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:x.origin,reverseWraparoundMode:x.reverseWraparound,sendFocusMode:x.sendFocus,wraparoundMode:x.wraparound}}get options(){return this._publicOptions}set options(x){for(const _ in x)this._publicOptions[_]=x[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(x,_=!0){this._core.input(x,_)}resize(x,_){this._verifyIntegers(x,_),this._core.resize(x,_)}open(x){this._core.open(x)}attachCustomKeyEventHandler(x){this._core.attachCustomKeyEventHandler(x)}attachCustomWheelEventHandler(x){this._core.attachCustomWheelEventHandler(x)}registerLinkProvider(x){return this._core.registerLinkProvider(x)}registerCharacterJoiner(x){return this._checkProposedApi(),this._core.registerCharacterJoiner(x)}deregisterCharacterJoiner(x){this._checkProposedApi(),this._core.deregisterCharacterJoiner(x)}registerMarker(x=0){return this._verifyIntegers(x),this._core.registerMarker(x)}registerDecoration(x){return this._checkProposedApi(),this._verifyPositiveIntegers(x.x??0,x.width??0,x.height??0),this._core.registerDecoration(x)}hasSelection(){return this._core.hasSelection()}select(x,_,y){this._verifyIntegers(x,_,y),this._core.select(x,_,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(x,_){this._verifyIntegers(x,_),this._core.selectLines(x,_)}dispose(){super.dispose()}scrollLines(x){this._verifyIntegers(x),this._core.scrollLines(x)}scrollPages(x){this._verifyIntegers(x),this._core.scrollPages(x)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(x){this._verifyIntegers(x),this._core.scrollToLine(x)}clear(){this._core.clear()}write(x,_){this._core.write(x,_)}writeln(x,_){this._core.write(x),this._core.write(`\r
65
+ `,_)}paste(x){this._core.paste(x)}refresh(x,_){this._verifyIntegers(x,_),this._core.refresh(x,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(x){this._addonManager.loadAddon(this,x)}static get strings(){return o}_verifyIntegers(...x){for(const _ of x)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...x){for(const _ of x)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}m.Terminal=C})(),f})()))})(fd)),fd.exports}var lS=oS();/**
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 cS=2,uS=1,dS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var p;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 i=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),l=Math.max(0,parseInt(r.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),m={top:parseInt(f.getPropertyValue("padding-top")),bottom:parseInt(f.getPropertyValue("padding-bottom")),right:parseInt(f.getPropertyValue("padding-right")),left:parseInt(f.getPropertyValue("padding-left"))},o=m.top+m.bottom,d=m.right+m.left,h=s-o,g=l-d-i;return{cols:Math.max(cS,Math.floor(g/e.css.cell.width)),rows:Math.max(uS,Math.floor(h/e.css.cell.height))}}};function hS({sessionId:e,onClose:i}){const r=F.useRef(null),s=F.useRef(e),l=F.useRef(null),f=F.useRef(null),m=nr(d=>d.writeSession),o=nr(d=>d.resizeSession);return F.useEffect(()=>{s.current=e},[e]),F.useEffect(()=>{if(!r.current)return;const d=new lS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),h=new dS;d.loadAddon(h),l.current={term:d,fitAddon:h},d.open(r.current);const g=r.current.querySelector(".xterm");g&&(g.style.padding="8px"),h.fit();const p=new ResizeObserver(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{requestAnimationFrame(()=>{var E;h.fit();const S=(E=l.current)==null?void 0:E.term;S&&S.cols>0&&S.rows>0&&o(s.current,S.cols,S.rows)})},100)});p.observe(r.current),d.onData(S=>{m(s.current,S)});const v=gn.subscribe(S=>{var E,C;if(S.type==="terminal.output"&&((E=S.payload)==null?void 0:E.sessionId)===s.current){const b=(C=S.payload)==null?void 0:C.data;b&&d.write(b)}});return()=>{v(),p.disconnect(),f.current&&clearTimeout(f.current),d.dispose(),l.current=null}},[e,m,o]),c.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[c.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[c.jsx("div",{}),c.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.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"})})})]}),c.jsx("div",{ref:r,className:"flex-1 relative overflow-hidden"})]})}function fS(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 pS({isOpen:e,onClose:i}){const r=nr(g=>g.createSession),s=nr(g=>g.killSession),l=nr(g=>g.sessions),f=nr(g=>g.setWorkdir),m=nr(g=>g.fetchSessions),o=qt(g=>g.currentProject),[d,h]=F.useState(!0);return F.useEffect(()=>{o!=null&&o.workdir&&f(o.workdir)},[o==null?void 0:o.workdir,f]),F.useEffect(()=>{e&&(h(!0),m().finally(()=>h(!1)))},[e,m]),F.useEffect(()=>{const g=p=>{p.key==="Escape"&&i()};if(e)return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[e,i]),e?c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g=>{g.target===g.currentTarget&&i()},children:c.jsxs("div",{className:"relative w-[90vw] h-[85vh] bg-bg-primary rounded-lg border border-border flex flex-col overflow-hidden",onClick:g=>g.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminals"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:()=>r(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})}),c.jsx("button",{onClick:i,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close",children:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})})]})]}),c.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:d?c.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):l.length===0?c.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:"mb-4",children:"No terminal sessions"}),c.jsx("button",{onClick:()=>r(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):c.jsx("div",{className:`grid ${fS(l.length)} gap-2 h-full auto-rows-fr`,children:l.map(g=>c.jsx(hS,{sessionId:g.id,onClose:()=>s(g.id)},g.id))})})]})}):null}function qa({items:e,trigger:i,minWidth:r="120px"}){const[s,l]=F.useState(!1),[f,m]=F.useState(null),o=F.useRef(null),d=F.useRef(null);F.useEffect(()=>{function v(S){d.current&&!d.current.contains(S.target)&&l(!1)}return s&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[s]);const h=F.useCallback(()=>{if(!o.current)return;const v=o.current.getBoundingClientRect(),S=200,C=window.innerHeight-v.bottom<S;m({top:C?v.top-S-4:v.bottom+4,left:v.left,alignToTop:C})},[]),g=v=>{v.stopPropagation(),s||h(),l(!s)},p=f&&c.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${f.alignToTop?"mb-1":"mt-1"}`,style:{top:f.top,left:f.left,minWidth:r},children:e.map((v,S)=>{const E=c.jsxs(c.Fragment,{children:[v.icon&&c.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:v.icon}),v.label]});return v.href?c.jsx("a",{href:v.href,onClick:C=>{var b;(b=v.onClick)==null||b.call(v,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 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S):c.jsx("button",{onClick:C=>{var b;(b=v.onClick)==null||b.call(v,C),v.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 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S)})});return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"relative",children:c.jsx("div",{ref:o,onClick:g,children:i})}),s&&ah.createPortal(p,document.body)]})}function e0(e){const i=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][i.getDay()],l=i.getFullYear(),f=String(i.getMonth()+1).padStart(2,"0"),m=String(i.getDate()).padStart(2,"0");return`${s} ${l}/${f}/${m}`}function oh(e){const i=new Date(e),r=String(i.getHours()).padStart(2,"0"),s=String(i.getMinutes()).padStart(2,"0");return`${r}:${s}`}function mS(e){const i=new Date(e),r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate()),l=new Date(i.getFullYear(),i.getMonth(),i.getDate()),f=Math.floor((s.getTime()-l.getTime())/(1e3*60*60*24)),m=oh(e);if(f===0)return`today ${m}`;if(f===1)return`yesterday ${m}`;if(f<7)return`${f} days ago ${m}`;{const o=i.getFullYear(),d=String(i.getMonth()+1).padStart(2,"0"),h=String(i.getDate()).padStart(2,"0");return`${o}/${d}/${h} ${m}`}}function gS(e){const i=new Date(e),r=i.getFullYear(),s=String(i.getMonth()+1).padStart(2,"0"),l=String(i.getDate()).padStart(2,"0");return`${r}-${s}-${l}`}function t0(e){const i=new Map;for(const l of e){const f=gS(l.updatedAt);i.has(f)||i.set(f,[]),i.get(f).push(l)}for(const[l,f]of i)f.sort((m,o)=>{const d=new Date(m.updatedAt).getTime();return new Date(o.updatedAt).getTime()-d});const r=Array.from(i.keys()).sort((l,f)=>f.localeCompare(l)),s=new Map;for(const l of r)s.set(l,i.get(l));return s}function xS({projects:e,currentProject:i}){const r=qt(f=>f.loadProject),l=[...e].sort((f,m)=>f.name.localeCompare(m.name)).map(f=>({label:f.name,icon:f.id===i.id?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0,href:`/p/${f.id}`,onClick:()=>{r(f.id)}}));return c.jsx(qa,{items:l,trigger:c.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:i.name,children:[i.name,c.jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),minWidth:"250px"})}function vS({sessions:e,currentProject:i,currentSession:r}){var d;const s=Ee(h=>h.loadSession),l=e.filter(h=>h.projectId===i.id).slice(0,15),f=t0(l),m=[];m.push({label:c.jsxs(Ci,{href:`/p/${i.id}/new`,className:"flex items-center gap-2 px-3 py-2 min-w-[160px]","data-testid":"session-dropdown-new-session",children:[c.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),c.jsx("span",{className:"text-sm",children:"New session"})]}),onClick:()=>{}});for(const[h,g]of f){const p=g[0];if(p){m.push({label:c.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:e0(p.updatedAt)}),onClick:()=>{}});for(const v of g)m.push({label:c.jsxs("div",{className:"min-w-[160px]",children:[c.jsx("div",{className:"truncate text-sm",children:v.title??v.id.slice(0,8)}),c.jsx("div",{className:"text-text-muted text-xs",children:oh(v.updatedAt)})]}),icon:v.id===(r==null?void 0:r.id)?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0,href:`/p/${i.id}/s/${v.id}`,onClick:()=>{s(v.id)}})}}const o=r?((d=r.metadata)==null?void 0:d.title)??r.id.slice(0,8):"No session selected";return c.jsx(qa,{items:m,trigger:c.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:o,"data-testid":"header-session-dropdown",children:[o,c.jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),minWidth:"280px"})}function bS({onMenuClick:e,onCriteriaToggle:i,hasCriteria:r}){const[s,l]=F.useState(!1),[f]=Ni(),m=f.startsWith("/p/"),o=Ee(b=>b.connectionStatus),d=Ee(b=>b.currentSession),h=Ee(b=>b.sessions),g=qt(b=>b.currentProject),p=qt(b=>b.projects),v=Zt(b=>b.startAutoRefresh),S=Zt(b=>b.stopAutoRefresh),E=nr(b=>b.toggleOpen),C=nr(b=>b.isOpen);return F.useEffect(()=>(v(),()=>S()),[v,S]),c.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&c.jsx("button",{onClick:e,className:"xl:hidden flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle sidebar",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),c.jsx(Ci,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0",children:"OpenFox"}),g&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-text-muted flex-shrink-0",children:"/"}),c.jsx(xS,{projects:p,currentProject:g})]}),g&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-text-muted flex-shrink-0",children:"/"}),c.jsx(vS,{sessions:h,currentProject:g,currentSession:d})]})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i&&r&&c.jsx("button",{onClick:i,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle criteria sidebar",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),m&&c.jsx("button",{onClick:E,className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${C?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})}),c.jsx("button",{onClick:()=>l(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:c.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.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"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("div",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${o==="connected"?"bg-accent-success":o==="reconnecting"?"bg-accent-warning animate-pulse":"bg-accent-error"}`}),c.jsx("span",{className:"text-sm text-text-secondary hidden sm:inline",children:o==="connected"?"Connected":o==="reconnecting"?"Reconnecting...":"Disconnected"})]})]}),c.jsx(sS,{isOpen:s,onClose:()=>l(!1)}),c.jsx(pS,{isOpen:C,onClose:()=>E()})]})}function yS({isOpen:e,onClose:i,title:r,label:s,description:l,placeholder:f,value:m,isLoading:o=!1,onSave:d}){const[h,g]=F.useState(m),[p,v]=F.useState(!1),[S,E]=F.useState(!1);F.useEffect(()=>{g(m),v(!1)},[m]);const C=y=>{g(y.target.value),v(!0)},b=async()=>{E(!0),await d(h),E(!1),v(!1),i()},x=()=>{g(m),v(!1),i()},_=o||S;return c.jsx(xn,{isOpen:e,onClose:x,title:r,size:"lg",children:c.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[c.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),c.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:l}),c.jsx("div",{className:"flex-1 min-h-[150px]",children:c.jsx("textarea",{value:h,onChange:C,placeholder:f,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:_})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[c.jsx(xt,{variant:"secondary",onClick:x,children:"Cancel"}),c.jsx(xt,{variant:"primary",onClick:b,disabled:!p||_,children:S?"Saving...":"Save"})]})]})})}function _S({isOpen:e,onClose:i,project:r}){const s=qt(f=>f.updateProject),l=async f=>{s(r.id,{customInstructions:f||null}),await new Promise(m=>setTimeout(m,100))};return c.jsx(yS,{isOpen:e,onClose:i,title:`${r.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:r.customInstructions??"",onSave:l})}function n0({projectId:e,isOpen:i=!0,onClose:r}){const[,s]=Ni(),[l,f]=F.useState(!1),m=Ee(A=>A.sessions),o=Ee(A=>A.currentSession),d=Ee(A=>A.unreadSessionIds),h=Ee(A=>A.deleteSession),g=Ee(A=>A.deleteAllSessions),p=Ee(A=>A.loadMoreSessions),v=Ee(A=>A.sessionsHasMore),S=Ee(A=>A.sessionsPaginationLoading),E=qt(A=>A.currentProject),C=F.useRef(null),b=F.useCallback(()=>{v&&!S&&E&&p(E.id)},[v,S,E,p]);F.useEffect(()=>{if(!C.current||!v)return;const A=new IntersectionObserver(N=>{const R=N[0];R&&R.isIntersecting&&b()},{threshold:.1});return A.observe(C.current),()=>A.disconnect()},[v,b]);const x=m.filter(A=>A.projectId===(E==null?void 0:E.id)),_=A=>{s(`/p/${e}/s/${A}`),r&&r()},y=(A,N)=>{N==null||N.stopPropagation(),confirm("Delete this session?")&&(h(A),(o==null?void 0:o.id)===A&&s(`/p/${e}`))},j=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return c.jsxs(c.Fragment,{children:[i&&r&&c.jsx("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:r}),c.jsxs("aside",{className:`
77
+
78
+ xl:relative xl:z-auto xl:translate-x-0 xl:h-auto
79
+
80
+ fixed z-50 -translate-x-full h-[calc(100vh-32px)]
81
+
82
+ w-[300px] bg-bg-secondary border-r border-border flex flex-col
83
+ transition-transform duration-300 ease-in-out
84
+ ${i?"translate-x-0":""}
85
+ `,children:[c.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[c.jsx(Ci,{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"}),c.jsx(qa,{items:[{label:"Edit project settings",onClick:()=>f(!0)},{label:"Delete all sessions",onClick:j,danger:!0}],trigger:c.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:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),r&&c.jsx("button",{onClick:r,className:"md:hidden flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close sidebar",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),E&&c.jsx(_S,{isOpen:l,onClose:()=>f(!1),project:E}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:x.length===0?c.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"divide-y divide-border",children:SS(x,o,d,_,y)}),S&&c.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),c.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function SS(e,i,r,s,l){const f=t0(e);return Array.from(f).map(([m,o])=>{const d=o[0];return d?c.jsxs("div",{children:[c.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:e0(d.updatedAt)}),o.map(h=>{const g=(i==null?void 0:i.id)===h.id,p=r.includes(h.id),v=h.isRunning;return c.jsxs("div",{onClick:()=>s(h.id),className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group cursor-pointer ${g?"bg-bg-tertiary":""}`,children:[c.jsxs("div",{className:"flex justify-between items-center mb-1",children:[c.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:h.title??h.id.slice(0,6)}),c.jsx(qa,{items:[{label:"Delete session",onClick:S=>l(h.id,S),danger:!0}],trigger:c.jsx("button",{className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v?c.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:[c.jsx("title",{children:"Running"}),c.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),c.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):p&&!g?c.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,c.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:oh(h.updatedAt)}),c.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[h.messageCount," messages"]})]})]},h.id)})]},m):null})}const vx=["⠋","⠙","⠹","⠸","⠼","⠴"];function wS(){var o;const e=qt(d=>d.currentProject),i=Ee(d=>d.currentSession),r=Xv(),s=!1,l=F.useRef(0),f=F.useRef(null);F.useEffect(()=>(r?(f.current=window.setInterval(()=>{l.current=(l.current+1)%vx.length,m()},150),m()):(f.current&&(clearInterval(f.current),f.current=null),m()),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[r,e,i,s]);const m=()=>{var p;const h=(p=i==null?void 0:i.metadata)==null?void 0:p.title,g=r?`${vx[l.current]} `:"";e&&h?document.title=`${g}${e.name} - ${h} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((o=i==null?void 0:i.metadata)!=null&&o.title)&&window.document.documentElement.setAttribute("data-session-title",i.metadata.title),null}const lh=F.forwardRef(({className:e="",...i},r)=>c.jsx("input",{ref:r,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}`,...i}));lh.displayName="Input";function CS({isOpen:e,onClose:i,projectName:r,onConfirm:s}){const l=()=>{s(),i()};return c.jsx(xn,{isOpen:e,onClose:i,title:"Delete Project",size:"sm",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",c.jsx("span",{className:"font-semibold text-text-primary",children:r})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(xt,{variant:"secondary",onClick:i,children:"Cancel"}),c.jsx(xt,{variant:"danger",onClick:l,children:"Delete"})]})]})})}function kS(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 ES({isOpen:e,onClose:i}){const[,r]=Ni(),[s,l]=F.useState(""),[f,m]=F.useState(null),[o,d]=F.useState(!1),[h,g]=F.useState(""),p=F.useRef(null);F.useEffect(()=>{e&&(fetch("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),l(""),m(null),d(!1),setTimeout(()=>{var C;(C=p.current)==null||C.focus()},100))},[e]);const v=F.useCallback(async C=>{C.preventDefault();const b=kS(s);if(!b.valid){m(b.error);return}d(!0),m(null);const x=`${h}/${s}`;try{const _=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:x})});if(!_.ok){const A=await _.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await _.json()).project;i(),r(`/p/${j.id}`)}catch(_){m(_ instanceof Error?_.message:"Failed to create project"),d(!1)}},[s,r,i,h]),S=F.useCallback(()=>{l(""),m(null),i()},[i]),E=s?`${h}/${s}`:"";return c.jsx(xn,{isOpen:e,onClose:S,title:"Create New Project",size:"sm",children:c.jsxs("form",{onSubmit:v,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),c.jsx(lh,{ref:p,id:"project-name",value:s,onChange:C=>{l(C.target.value),m(null)},placeholder:"my-project",disabled:o,className:"w-full"}),s&&c.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",c.jsx("span",{className:"font-mono",children:E})]}),f&&c.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:f})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(xt,{type:"button",variant:"secondary",onClick:S,disabled:o,children:"Cancel"}),c.jsx(xt,{type:"submit",variant:"primary",disabled:o||!s.trim(),className:"min-w-[100px]",children:o?c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[c.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),c.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"})]})]})})}function jS({isOpen:e,onClose:i}){const[,r]=Ni(),[s,l]=F.useState(!1),[f,m]=F.useState(""),[o,d]=F.useState(null),[h,g]=F.useState(!1),[p,v]=F.useState(null),S=qt(L=>L.projects),E=qt(L=>L.createProject),C=qt(L=>L.listProjects),b=qt(L=>L.deleteProject),[x,_]=F.useState(null),[y,j]=F.useState(-1),[A,N]=F.useState(null),R=F.useRef([]);F.useEffect(()=>{fetch("/api/config").then(L=>L.json()).then(L=>{L.workdir&&v(L.workdir)})},[]);const T=F.useCallback(async L=>{g(!0);try{const D=L?`/api/directories?path=${encodeURIComponent(L)}`:p?`/api/directories?path=${encodeURIComponent(p)}`:"/api/directories",U=await(await fetch(D)).json();d(U)}catch(D){console.error("Failed to load directories:",D)}finally{g(!1)}},[p]);F.useEffect(()=>{e&&p&&(T(p),C())},[e,p,T,C]);const I=(o==null?void 0:o.directories.filter(L=>f===""||L.name.toLowerCase().includes(f.toLowerCase())))??[],H=[...o!=null&&o.parent&&!f?[{type:"parent",path:o.parent,name:".."}]:[],...I.map(L=>({type:"directory",path:L.path,name:L.name}))],G=L=>{r(`/p/${L}`),i()},K=(L,D)=>{D.stopPropagation(),N(L)},q=()=>{A&&(b(A.id),N(null))},O=L=>{const D=L.split("/").filter(Boolean).pop()??"";E(D,L),C(),_(L)};F.useEffect(()=>{if(x){const L=S.find(D=>D.workdir===x);L&&(r(`/p/${L.id}`),i(),_(null))}},[S,x,r,i]),F.useEffect(()=>{j(H.length>0?0:-1)},[f,H.length]);const W=L=>{m(""),T(L)},V=F.useCallback(L=>{if(!e)return;if(L.key==="Escape"){i();return}if(!["ArrowDown","ArrowUp","Enter"].includes(L.key))return;const D=document.activeElement;if(!(!D||D.tagName!=="INPUT")){if(L.preventDefault(),L.key==="ArrowDown")j(B=>{const U=B+1;return U>=H.length?0:U});else if(L.key==="ArrowUp")j(B=>{const U=B-1;return U<0?H.length-1:U});else if(L.key==="Enter"&&y>=0&&y<H.length){const B=H[y];(B==null?void 0:B.type)==="parent"?W(B.path):B&&O(B.path)}}},[e,H.length,y,W,O,i]);F.useEffect(()=>{if(e)return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[e,V]),F.useEffect(()=>{y>=0&&R.current[y]&&R.current[y].scrollIntoView({behavior:"smooth",block:"nearest"})},[y]);const te=(()=>{if(!o)return[];const L=o.current.split("/").filter(Boolean),D=[];let B="";for(const U of L)B+="/"+U,D.push({name:U,path:B});return D})();return e?c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[c.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[c.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[c.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),c.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[c.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[c.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:c.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:S.length===0?c.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):c.jsx("div",{className:"divide-y divide-border",children:S.map(L=>c.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[c.jsxs("button",{onClick:()=>G(L.id),className:"flex-1 flex items-center gap-3 text-left",children:[c.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:L.name}),c.jsx("div",{className:"text-xs text-text-muted truncate",children:L.workdir})]})]}),c.jsx("button",{onClick:D=>K(L,D),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},L.id))})})]}),c.jsxs("div",{className:"w-1/2 flex flex-col",children:[c.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:c.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"})}),c.jsx("div",{className:"p-3 border-b border-border",children:c.jsxs("div",{className:"relative",children:[c.jsx(lh,{value:f,onChange:L=>m(L.target.value),placeholder:"Type to filter directories...",className:"w-full pl-9"}),c.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]})}),c.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:c.jsx("div",{className:"flex items-center text-xs overflow-x-auto",children:te.map((L,D)=>c.jsxs("span",{className:"flex items-center flex-shrink-0",children:[c.jsx("span",{className:"text-text-muted",children:"/"}),D===te.length-1?c.jsx("span",{className:"text-accent-primary font-medium px-1",children:L.name}):c.jsx("button",{onClick:()=>W(L.path),className:"text-text-secondary hover:text-accent-primary px-1",children:L.name})]},L.path))})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:h?c.jsx("div",{className:"p-8 text-center text-text-muted",children:c.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):H.length===0?c.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:f?"No matching directories":"No subdirectories"}):c.jsx("div",{className:"divide-y divide-border",children:H.map((L,D)=>c.jsxs("button",{ref:B=>{R.current[D]=B},onClick:()=>L.type==="parent"?W(L.path):O(L.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${D===y?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[c.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"flex-1",children:L.name})]},L.path))})})]})]}),c.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[c.jsx(xt,{variant:"secondary",onClick:()=>l(!0),children:"Create Project"}),c.jsx(xt,{variant:"secondary",onClick:i,children:"Cancel"})]})]}),s&&c.jsx(ES,{isOpen:s,onClose:()=>l(!1)}),A&&c.jsx(CS,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:q})]}):null}function NS(){const[e,i]=F.useState(!1),r=Ee(h=>h.sessions),s=qt(h=>h.projects),l=qt(h=>h.listProjects),f=Ee(h=>h.listSessions);F.useEffect(()=>{l(),f()},[l,f]);const m=[...s].sort((h,g)=>{const p=r.filter(C=>C.workdir.startsWith(h.workdir)),v=r.filter(C=>C.workdir.startsWith(g.workdir)),S=p.length>0?new Date(p.reduce((C,b)=>new Date(b.updatedAt)>new Date(C.updatedAt)?b:C).updatedAt).getTime():new Date(h.updatedAt).getTime();return(v.length>0?new Date(v.reduce((C,b)=>new Date(b.updatedAt)>new Date(C.updatedAt)?b:C).updatedAt).getTime():new Date(g.updatedAt).getTime())-S}),o=h=>{const g=s.find(p=>p.id===h);return g?r.filter(p=>p.workdir.startsWith(g.workdir)).sort((p,v)=>new Date(v.updatedAt).getTime()-new Date(p.updatedAt).getTime()).slice(0,5):[]},d=()=>{i(!0)};return c.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[c.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[c.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),c.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),c.jsx(xt,{variant:"primary",onClick:d,children:"Open Project"})]}),m.map(h=>{const g=o(h.id);return c.jsx("div",{className:"mb-6 md:mb-8",children:c.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[c.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[c.jsxs(Ci,{href:`/p/${h.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[c.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"text-text-primary font-semibold",children:h.name})]}),c.jsx(Ci,{href:`/p/${h.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"})]}),c.jsx("div",{className:"divide-y divide-border",children:g.length>0?g.map(p=>{const v=s.find(E=>p.workdir.startsWith(E.workdir)),S=v?`/p/${v.id}/s/${p.id}`:"#";return c.jsx(Ci,{href:S,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:c.jsx("div",{className:"flex-1 min-w-0",children:c.jsx("div",{className:"text-sm text-text-muted truncate",children:p.title??p.id.slice(0,8)})})}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsx("span",{className:"text-text-muted text-xs",children:mS(p.updatedAt)}),c.jsxs("span",{className:"text-text-muted text-xs",children:[p.messageCount," msgs"]})]})]})},p.id)}):c.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},h.id)}),m.length===0&&c.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&c.jsx(jS,{isOpen:e,onClose:()=>i(!1)})]})}const TS={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function ch({size:e="md",className:i=""}){return c.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${TS[e]} ${i}`})}function AS({text:e,...i}){return c.jsxs("div",{className:"text-center",children:[c.jsx(ch,{...i,className:"mx-auto mb-4"}),e&&c.jsx("div",{className:"text-text-secondary",children:e})]})}function DS(){const[,e]=ih("/p/:projectId/new"),[,i]=Ni(),r=e==null?void 0:e.projectId,s=Ee(l=>l.createSession);return F.useEffect(()=>{r&&(async()=>{const f=await s(r);i(f?`/p/${r}/s/${f.id}`:`/p/${r}`)})()},[r,s,i]),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(ch,{})})}function RS(){const e=qt(i=>i.currentProject);return c.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:c.jsxs("div",{className:"max-w-md",children:[c.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),c.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),c.jsxs("div",{className:"flex flex-col gap-3",children:[e&&c.jsx(Ci,{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"}),c.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const Ea=e=>Math.round(e*10)/10;function Hd(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function LS(e){return`${e.providerId}::${e.model}`}function MS(e){return`${e.providerName} > ${e.model}`}function bx(e){let i=0,r=0,s=0,l=0,f=0,m=0;const o=[],d=[];let h=0;for(const[v,S]of e.entries()){const E=S.stats,C=Hd(E);i+=E.totalTime,r+=E.toolTime,s+=E.prefillTokens,l+=E.generationTokens;const b=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,x=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;f+=b,m+=x,o.push({messageId:S.id,timestamp:S.timestamp,...C,mode:E.mode,responseIndex:v+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 _=E.llmCalls??[];for(const y of _)h+=1,d.push({messageId:S.id,timestamp:y.timestamp??S.timestamp,providerId:y.providerId,providerName:y.providerName,backend:y.backend,model:y.model,mode:E.mode,responseIndex:v+1,sessionCallIndex:h,callIndex:y.callIndex,promptTokens:y.promptTokens,completionTokens:y.completionTokens,ttft:y.ttft,completionTime:y.completionTime,prefillSpeed:y.prefillSpeed,generationSpeed:y.generationSpeed,totalTime:y.totalTime})}const g=f>0?Ea(s/f):0,p=m>0?Ea(l/m):0;return{totalTime:Ea(i),aiTime:Ea(i-r),toolTime:Ea(r),prefillTokens:s,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:p,responseCount:e.length,llmCallCount:d.length,dataPoints:o,callDataPoints:d}}function OS(e){const i=e.filter(l=>l.stats!==void 0&&l.stats!==null).sort((l,f)=>new Date(l.timestamp).getTime()-new Date(f.timestamp).getTime());if(i.length===0)return null;const r=new Map;for(const l of i){const f=LS(Hd(l.stats)),m=r.get(f)??[];r.set(f,[...m,l])}const s=Array.from(r.entries()).map(([l,f])=>{const m=Hd(f[0].stats),o=bx(f);return{...m,key:l,label:MS(m),...o}});return{...bx(i),modelGroups:s}}function BS(e){return F.useMemo(()=>OS(e),[e])}function IS(e){const[i,r]=F.useState(null),[s,l]=F.useState(!0),[f,m]=F.useState(null),o=e||"";return F.useEffect(()=>{if(!o){l(!1);return}let d=!0,h=null;const g=async()=>{try{const v=await(await fetch(`/api/branch?workdir=${encodeURIComponent(o)}`)).json();d&&(r(v.branch),m(v.error||null),l(!1))}catch(p){d&&(m(p instanceof Error?p.message:"Failed to fetch branch"),l(!1))}};return g(),h=setInterval(g,3e3),()=>{d=!1,h&&clearInterval(h)}},[o]),{branch:i,loading:s,error:f}}function yx(e){return e.toLocaleString("en-US").replace(/,/g," ")}function _x(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function zS(e){if(e<60)return`${e.toFixed(1)}s`;const i=Math.floor(e/60),r=Math.round(e%60);return`${i}m${r}s`}const HS="modulepreload",PS=function(e){return"/"+e},Sx={},FS=function(i,r,s){let l=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),d=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));l=m(r.map(h=>{if(h=PS(h),h in Sx)return;Sx[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":HS,g||(v.as="script"),v.crossOrigin="",v.href=h,d&&v.setAttribute("nonce",d),document.head.appendChild(v),g)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${h}`)))})}))}function f(m){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=m,window.dispatchEvent(o),!o.defaultPrevented)throw m}return l.then(m=>{for(const o of m||[])o.status==="rejected"&&f(o.reason);return i().catch(f)})},wx=["▁","▂","▃","▄","▅","▆","▇","█"];function US(e,i,r){if(r===i)return 4;const s=(e-i)/(r-i);return Math.min(7,Math.max(0,Math.round(s*7)))}function $S(e,i){if(e===i){const l=Math.max(Math.abs(e)*.05,1);return{minY:e-l,maxY:i+l}}const r=i-e,s=Math.max(r*.1,.1);return{minY:e-s,maxY:i+s}}function qS(e,i){if(e.length===0||i<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const r=[...e].sort((p,v)=>p.x-v.x),s=r[0].x,l=r[r.length-1].x,f=Math.min(...r.map(p=>p.y)),m=Math.max(...r.map(p=>p.y)),{minY:o,maxY:d}=$S(f,m),h=Array.from({length:i},()=>" "),g=new Map;for(const p of r){const v=l===s?0:Math.round((p.x-s)/(l-s)*(i-1)),S=g.get(v)??[];g.set(v,[...S,p.y])}for(const[p,v]of g){const S=Math.max(...v);h[p]=wx[US(S,o,d)]??wx[0]}return{blocks:h.join(""),minX:s,maxX:l,minY:o,maxY:d}}function Cx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function kx({data:e,width:i=60,height:r=78,label:s,xLabel:l,yLabel:f,showAxes:m=!0,formatY:o=Cx,formatX:d=Cx}){const h=F.useMemo(()=>{const g=qS(e,i),p=Math.max(i*6,240),v=10,S=8,C=[...e].sort((y,j)=>y.x-j.x).map(y=>{const j=g.maxX===g.minX?p/2:v+(y.x-g.minX)/(g.maxX-g.minX)*(p-v*2),A=g.maxY===g.minY?r/2:S+(g.maxY-y.y)/(g.maxY-g.minY)*(r-S*2);return{...y,cx:j,cy:A,leftPercent:j/p*100,topPercent:A/r*100}}),b=C.map((y,j)=>`${j===0?"M":"L"} ${y.cx.toFixed(1)} ${y.cy.toFixed(1)}`).join(" "),_=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(y=>({value:y,y:g.maxY===g.minY?r/2:S+(g.maxY-y)/(g.maxY-g.minY)*(r-S*2)}));return{...g,chartWidth:p,points:C,path:b,gridLines:_}},[e,r,i]);return e.length===0?c.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&c.jsx("div",{className:"mb-1",children:s}),c.jsx("div",{children:"No data"})]}):c.jsxs("div",{className:"font-mono text-xs",children:[s&&c.jsx("div",{className:"text-text-secondary mb-2",children:s}),c.jsxs("div",{className:"flex gap-3",children:[m&&c.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:h.gridLines.map(g=>c.jsx("span",{children:o(g.value)},`${g.value}-${g.y}`))}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"relative h-[78px]",children:[c.jsxs("svg",{viewBox:`0 0 ${h.chartWidth} ${r}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[h.gridLines.map(g=>c.jsx("line",{x1:"0",x2:h.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),h.points.map(g=>c.jsx("line",{x1:g.cx,x2:g.cx,y1:r-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),h.points.length>1&&c.jsx("path",{d:h.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),h.points.map(g=>c.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${o(g.y)}`,children:c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),m&&c.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[c.jsx("span",{className:"w-12"}),c.jsxs("span",{className:"flex-1 flex justify-between",children:[c.jsx("span",{children:d(h.minX)}),c.jsx("span",{children:l}),c.jsx("span",{children:d(h.maxX)})]})]}),f&&m&&c.jsx("div",{className:"text-text-muted mt-1 text-center",children:f})]})}function WS({data:e,prefillLabel:i="Prefill Speed (tok/s) by Response",generationLabel:r="Generation Speed (tok/s) by Response",xLabel:s="response",width:l=60}){const f=e.map(o=>({x:o.x,y:o.ppSpeed})),m=e.map(o=>({x:o.x,y:o.tgSpeed}));return c.jsxs("div",{className:"space-y-5",children:[c.jsx(kx,{data:f,width:l,label:i,xLabel:s}),c.jsx(kx,{data:m,width:l,label:r,xLabel:s})]})}function GS(e){const i=new Map;for(const r of e.callDataPoints){const s=i.get(r.messageId)??[];i.set(r.messageId,[...s,r])}return e.dataPoints.map(r=>{const s=[...i.get(r.messageId)??[]].sort((l,f)=>l.callIndex-f.callIndex);return{...r,callCount:s.length,calls:s,isExpandable:s.length>1}})}function VS(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(i=>({x:i.responseIndex,ppSpeed:i.prefillSpeed,tgSpeed:i.generationSpeed}))}}function YS(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(i=>({x:i.promptTokens,ppSpeed:i.prefillSpeed,tgSpeed:i.generationSpeed}))}}function KS(e){return e.callDataPoints.length>0?YS(e):VS(e)}function pd(e){if(e<60)return`${e.toFixed(1)}s`;const i=Math.floor(e/60),r=e%60;return`${i}m ${r.toFixed(0)}s`}function ki(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ra(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function XS(e){if(e.length===0)return"0 ctx";const i=Math.min(...e),r=Math.max(...e);return i===r?`${ki(i)} ctx`:`${ki(i)}-${ki(r)} ctx`}function Sl(e){return`${Ra(e)} t/s`}function r0(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function ZS(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(i=>({responseIndex:i.responseIndex,timestamp:i.timestamp,mode:i.mode,prefillTokens:i.prefillTokens,generationTokens:i.generationTokens,prefillSpeed:i.prefillSpeed,generationSpeed:i.generationSpeed,totalTime:i.totalTime,aiTime:i.aiTime,toolTime:i.toolTime})),llmCalls:e.callDataPoints.map(i=>({sessionCallIndex:i.sessionCallIndex,responseIndex:i.responseIndex,callIndex:i.callIndex,timestamp:i.timestamp,mode:i.mode,promptTokens:i.promptTokens,completionTokens:i.completionTokens,ttft:i.ttft,completionTime:i.completionTime,prefillSpeed:i.prefillSpeed,generationSpeed:i.generationSpeed,totalTime:i.totalTime}))}}function QS({isOpen:e,onClose:i,stats:r}){const s=F.useRef(null),[l,f]=F.useState({}),[m,o]=F.useState(()=>{var E;return((E=r.modelGroups[0])==null?void 0:E.key)??""});F.useEffect(()=>{var E;r.modelGroups.some(C=>C.key===m)||o(((E=r.modelGroups[0])==null?void 0:E.key)??"")},[m,r.modelGroups]);const d=F.useMemo(()=>r.modelGroups.find(E=>E.key===m)??r.modelGroups[0],[m,r.modelGroups]),h=F.useMemo(()=>d?GS(d):[],[d]),g=F.useMemo(()=>d?KS(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),p=F.useCallback(E=>{f(C=>({...C,[E]:!C[E]}))},[]),v=F.useCallback(()=>{if(!d)return;const E=ZS(d);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),S=F.useCallback(async()=>{if(s.current)try{const E=(await FS(async()=>{const{default:x}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:x}},[])).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),v()}},[v]);return c.jsx(xn,{isOpen:e,onClose:i,title:"Session Stats",size:"lg",children:c.jsxs("div",{ref:s,className:"space-y-6",children:[c.jsx("section",{children:c.jsx("div",{className:"flex flex-wrap gap-2",children:r.modelGroups.map(E=>c.jsx("button",{onClick:()=>o(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&&c.jsxs("section",{children:[c.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[c.jsx(Sr,{label:"AI Time",value:pd(d.aiTime)}),c.jsx(Sr,{label:"Total Time",value:pd(d.totalTime)}),c.jsx(Sr,{label:"Tool Time",value:pd(d.toolTime)}),c.jsx(Sr,{label:"Responses",value:d.responseCount.toString()}),c.jsx(Sr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[c.jsx(Sr,{label:"Prefill Tokens",value:ki(d.prefillTokens),subValue:`@ ${Ra(d.avgPrefillSpeed)} tok/s`}),c.jsx(Sr,{label:"Gen Tokens",value:ki(d.generationTokens),subValue:`@ ${Ra(d.avgGenerationSpeed)} tok/s`}),c.jsx(Sr,{label:"Avg PP Speed",value:`${Ra(d.avgPrefillSpeed)}`,subValue:"tok/s"}),c.jsx(Sr,{label:"Avg TG Speed",value:`${Ra(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:v,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),c.jsx("button",{onClick:S,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),c.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:c.jsx(WS,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&c.jsxs("section",{children:[c.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),c.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:c.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[c.jsxs("colgroup",{children:[c.jsx("col",{className:"w-[7%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[10%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[11%]"}),c.jsx("col",{className:"w-[2%]"})]}),c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[c.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),c.jsx("th",{className:"px-2 py-2"})]})}),c.jsx("tbody",{children:h.map((E,C)=>c.jsxs(F.Fragment,{children:[c.jsx(JS,{row:E,index:C,isExpanded:l[E.messageId]??!1,onToggle:E.isExpandable?()=>p(E.messageId):void 0}),(l[E.messageId]??!1)&&E.calls.map((b,x)=>c.jsx(ew,{dataPoint:b,index:x},`${b.messageId}-${b.callIndex}`))]},E.messageId))})]})})]})]})})}function Sr({label:e,value:i,subValue:r}){return c.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[c.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),c.jsx("div",{className:"text-text-primary text-lg font-semibold",children:i}),r&&c.jsx("div",{className:"text-text-muted text-xs",children:r})]})}function JS({row:e,index:i,isExpanded:r,onToggle:s}){const l=e.calls.length>0?XS(e.calls.map(f=>f.promptTokens)):`${ki(e.prefillTokens)} ctx`;return c.jsxs("tr",{onClick:s,className:`${i%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[c.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:r0(e.timestamp)}),c.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:l.replace(/ ctx$/,"")}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Sl(e.prefillSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Sl(e.generationSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?r?"v":">":""})]})}function ew({dataPoint:e,index:i}){return c.jsxs("tr",{className:`${i%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[c.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]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:r0(e.timestamp)}),c.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:ki(e.promptTokens)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Sl(e.prefillSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Sl(e.generationSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),c.jsx("td",{className:"px-2 py-2"})]})}const tw={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"}},nw=F.memo(function({criteria:i}){if(i.length===0)return c.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const r={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const l of i){const f=l.status.type;f in r&&r[f]++}const s=Object.keys(r).filter(l=>r[l]>0);return c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),c.jsx("span",{className:"text-text-secondary",children:i.length})]}),c.jsx("div",{className:"space-y-1",children:s.map(l=>{const f=tw[l];return c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:`${f.color} ${f.animate?"animate-pulse":""} text-sm leading-tight`,children:f.icon}),c.jsxs("span",{className:"text-text-muted",children:[f.label,":"]}),c.jsx("span",{className:"text-text-primary font-medium",children:r[l]})]},l)})})]})});function rw({isOpen:e,onClose:i}){const r=er(S=>S.config),s=er(S=>S.saveConfig),[l,f]=F.useState(""),[m,o]=F.useState(""),[d,h]=F.useState(!1),[g,p]=F.useState(!1);F.useEffect(()=>{e&&(f((r==null?void 0:r.command)??""),o((r==null?void 0:r.url)??""),h((r==null?void 0:r.hotReload)??!1))},[e,r]);const v=async()=>{!l.trim()||!m.trim()||(p(!0),await s({command:l.trim(),url:m.trim(),hotReload:d}),p(!1),i())};return c.jsx(xn,{isOpen:e,onClose:i,title:"Dev Server Config",size:"sm",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),c.jsx("input",{className:"input w-full",type:"text",value:l,onChange:S=>f(S.target.value),placeholder:"npm run dev"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),c.jsx("input",{className:"input w-full",type:"text",value:m,onChange:S=>o(S.target.value),placeholder:"http://localhost:3000"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:S=>h(S.target.checked),className:"rounded border-border bg-bg-tertiary"}),c.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{className:"btn btn-secondary",onClick:i,children:"Cancel"}),c.jsx("button",{className:"btn btn-primary",onClick:v,disabled:g||!l.trim()||!m.trim(),children:g?"Saving...":"Save"})]})]})})}const Ex={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"},iw={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"},jx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},sw="text-text-primary";function aw(e){const i=[],r=/\x1b\[([0-9;]+)m/g;let s=0,l="text-text-primary",f;try{for(;(f=r.exec(e))!==null;){if(f.index>s){const h=e.slice(s,f.index);h&&i.push({text:h,className:l})}const m=f[1];if(!m)continue;const o=m.split(";").map(Number);if(o.length===0||o[0]===0){l="text-text-primary";continue}const d=[];for(const h of o)if(h>=30&&h<=37){const g=Ex[h];g&&d.push(g)}else if(h>=40&&h<=47){const g=iw[h];g&&d.push(g)}else if(h>=90&&h<=97){const g=Ex[h];g&&d.push(g)}else if(h in jx){const g=jx[h];g&&d.push(g)}else h===39?d.push(sw):h===49&&(l=l.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(l=d.join(" ")),s=r.lastIndex}if(s<e.length){const m=e.slice(s);m&&i.push({text:m,className:l})}return i}catch(m){return console.warn("ANSI parsing failed, stripping codes:",m),[{text:ow(e),className:"text-text-primary"}]}}function ow(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function wl(e){var r,s;const i=aw(e);return i.length===1&&((r=i[0])==null?void 0:r.className)==="text-text-primary"?(s=i[0])==null?void 0:s.text:i.map((l,f)=>an.createElement("span",{key:f,className:l.className},l.text))}const lw=F.memo(function({logs:i,onClose:r}){const s=F.useRef(null);return F.useEffect(()=>{const l=f=>{f.key==="Escape"&&r()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),F.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[i]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:r,children:c.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:l=>l.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server Logs"}),c.jsx("button",{onClick:r,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})})]}),c.jsx("pre",{ref:s,className:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary",children:i.length===0?c.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((l,f)=>c.jsx("span",{className:l.stream==="stderr"?"text-accent-warning":"",children:wl(l.content)},f))})]})})}),cw=F.memo(function({workdir:i}){const r=er(y=>y.setWorkdir),s=er(y=>y.status),l=er(y=>y.config),f=er(y=>y.logs),m=er(y=>y.start),o=er(y=>y.stop),d=er(y=>y.fetchLogs),[h,g]=F.useState(!1),[p,v]=F.useState(!1),S=F.useRef(null),E=(s==null?void 0:s.state)??"off",C=l!==null,b=E==="running"||E==="warning";F.useEffect(()=>{r(i??null)},[i,r]),F.useEffect(()=>{b&&d()},[b,d]),F.useEffect(()=>{S.current&&b&&(S.current.scrollTop=S.current.scrollHeight)},[f,b]);const x=()=>{b?o():m()},_=c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.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 c.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${E==="running"?"bg-accent-success":E==="warning"?"bg-accent-warning":E==="error"?"bg-accent-error":"bg-text-muted"}`}),c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),c.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:_})]}),C?c.jsxs(c.Fragment,{children:[E==="running"||E==="warning"?c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{onClick:x,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:[c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&c.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:[c.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M9.5 2h4.5v4.5"}),c.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):c.jsx("button",{onClick:x,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"}),b&&c.jsxs("div",{className:"relative",children:[c.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:f.length===0?c.jsx("span",{className:"text-text-muted",children:"No output yet"}):f.map((y,j)=>c.jsx("span",{className:y.stream==="stderr"?"text-accent-warning":"",children:wl(y.content)},j))}),c.jsx("button",{onClick:()=>v(!0),className:"absolute bottom-2 right-2 p-1 rounded bg-bg-tertiary/80 hover:bg-bg-tertiary text-text-muted transition-colors",title:"Expand logs",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h4a1 1 0 010 2H5v3a1 1 0 01-2 0V4zm12-1a1 1 0 00-1 1v3a1 1 0 102 0V5h3a1 1 0 100-2h-4zm-9 12a1 1 0 011 1v3h3a1 1 0 110 2H4a1 1 0 01-1-1v-4a1 1 0 011-1zm12 0a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 110-2h3v-3a1 1 0 011-1z",clipRule:"evenodd"})})})]})]}):c.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"}),c.jsx(rw,{isOpen:h,onClose:()=>g(!1)}),p&&c.jsx(lw,{logs:f,onClose:()=>v(!1)})]})});function uw({summary:e,messages:i,workdir:r}){const[s,l]=F.useState(!1),f=BS(i),{branch:m}=IS(r),o=Ee(d=>d.currentSession);return c.jsxs("div",{className:"flex flex-col h-full",children:[f&&c.jsxs("div",{className:"mb-4",children:[c.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:c.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[c.jsx("span",{className:"text-text-secondary",children:zS(f.aiTime)}),c.jsx("span",{className:"w-px h-3 bg-border"}),c.jsx("span",{className:"text-text-secondary",children:_x(f.avgPrefillSpeed)}),c.jsx("span",{children:"pp"}),c.jsx("span",{className:"w-px h-3 bg-border"}),c.jsx("span",{className:"text-text-secondary",children:_x(f.avgGenerationSpeed)}),c.jsx("span",{children:"tg"})]})}),c.jsx(QS,{isOpen:s,onClose:()=>l(!1),stats:f})]}),c.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[c.jsx("div",{className:"flex items-center justify-between mb-2",children:c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?c.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):c.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),c.jsx(nw,{criteria:(o==null?void 0:o.criteria)??[]})]})]}),m&&c.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[c.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:c.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"})}),c.jsx("span",{className:"truncate text-text-secondary",title:m,children:m})]}),c.jsx(cw,{workdir:r})]})}const dw="w-[320px] min-w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto";function hw({children:e,criteriaSidebarOpen:i=!0,messages:r}){const s=Ee(l=>l.currentSession);return c.jsxs("div",{className:"flex h-full overflow-hidden",children:[c.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),c.jsx("aside",{className:`
86
+ ${dw}
87
+ hidden md:block
88
+ ${i?"md:block":"md:hidden"}
89
+ `,children:c.jsx(uw,{summary:(s==null?void 0:s.summary)??null,messages:r,workdir:s==null?void 0:s.workdir})})]})}function fw(e,i){return i||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Nx(e,i){return i||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function pw({criteriaSidebarOpen:e=!0,onCriteriaSidebarToggle:i}){const r=Ee(p=>p.contextState),s=Ee(p=>p.currentSession),l=Ee(p=>p.compactContext);if(!r||!s)return null;const{currentTokens:f,maxTokens:m,compactionCount:o,dangerZone:d}=r,h=Math.round(f/m*100),g=s.isRunning;return c.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[c.jsx("span",{className:"text-text-muted",children:"Context:"}),c.jsxs("span",{className:Nx(h,d),children:[yx(f)," / ",yx(m)]}),c.jsxs("span",{className:Nx(h,d),children:["(",h,"%)"]})]}),c.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden w-20",children:c.jsx("div",{className:`h-full transition-all duration-300 ${fw(h,d)}`,style:{width:`${Math.min(h,100)}%`}})}),d&&c.jsx("span",{className:"text-[10px] text-accent-error font-medium animate-pulse",children:"Low!"}),o>0&&c.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[o,"x"]}),c.jsx(xt,{variant:"secondary",size:"md",onClick:l,disabled:g,title:g?"Cannot compact while running":"Compact context",className:d?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]}),i&&c.jsx("button",{onClick:i,className:"flex md:hidden items-center justify-center p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:e?"Hide criteria sidebar":"Show criteria sidebar",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})})]})})}function Tx(e){const i=[],r=String(e||"");let s=r.indexOf(","),l=0,f=!1;for(;!f;){s===-1&&(s=r.length,f=!0);const m=r.slice(l,s).trim();(m||!f)&&i.push(m),l=s+1,s=r.indexOf(",",l)}return i}function mw(e,i){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const gw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vw={};function Ax(e,i){return(vw.jsx?xw:gw).test(e)}const bw=/[ \t\n\f\r]/g;function yw(e){return typeof e=="object"?e.type==="text"?Dx(e.value):!1:Dx(e)}function Dx(e){return e.replace(bw,"")===""}class Wa{constructor(i,r,s){this.normal=r,this.property=i,s&&(this.space=s)}}Wa.prototype.normal={};Wa.prototype.property={};Wa.prototype.space=void 0;function i0(e,i){const r={},s={};for(const l of e)Object.assign(r,l.property),Object.assign(s,l.normal);return new Wa(r,s,i)}function Ia(e){return e.toLowerCase()}class vn{constructor(i,r){this.attribute=r,this.property=i}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let _w=0;const $e=Ti(),It=Ti(),Pd=Ti(),ye=Ti(),_t=Ti(),ks=Ti(),jn=Ti();function Ti(){return 2**++_w}const Fd=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:It,commaOrSpaceSeparated:jn,commaSeparated:ks,number:ye,overloadedBoolean:Pd,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),md=Object.keys(Fd);class uh extends vn{constructor(i,r,s,l){let f=-1;if(super(i,r),Rx(this,"space",l),typeof s=="number")for(;++f<md.length;){const m=md[f];Rx(this,md[f],(s&Fd[m])===Fd[m])}}}uh.prototype.defined=!0;function Rx(e,i,r){r&&(e[i]=r)}function Ns(e){const i={},r={};for(const[s,l]of Object.entries(e.properties)){const f=new uh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(f.mustUseProperty=!0),i[s]=f,r[Ia(s)]=s,r[Ia(f.attribute)]=s}return new Wa(i,r,e.space)}const s0=Ns({properties:{ariaActiveDescendant:null,ariaAtomic:It,ariaAutoComplete:null,ariaBusy:It,ariaChecked:It,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:It,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:It,ariaFlowTo:_t,ariaGrabbed:It,ariaHasPopup:null,ariaHidden:It,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:ye,ariaLive:null,ariaModal:It,ariaMultiLine:It,ariaMultiSelectable:It,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:It,ariaReadOnly:It,ariaRelevant:null,ariaRequired:It,ariaRoleDescription:_t,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:It,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function a0(e,i){return i in e?e[i]:i}function o0(e,i){return a0(e,i.toLowerCase())}const Sw=Ns({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ks,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:_t,autoFocus:$e,autoPlay:$e,blocking:_t,capture:null,charSet:null,checked:$e,cite:null,className:_t,cols:ye,colSpan:null,content:null,contentEditable:It,controls:$e,controlsList:_t,coords:ye|ks,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:Pd,draggable:It,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:_t,height:ye,hidden:Pd,high:ye,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:_t,itemRef:_t,itemScope:$e,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,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:$e,optimum:ye,pattern:null,ping:_t,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:_t,required:$e,reversed:$e,rows:ye,rowSpan:ye,sandbox:_t,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:It,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:$e,useMap:null,value:It,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:It,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$e,disableRemotePlayback:$e,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:o0}),ww=Ns({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:jn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:$e,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,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:ks,g2:ks,glyphName:ks,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:jn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,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:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jn,rev:jn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jn,requiredFeatures:jn,requiredFonts:jn,requiredFormats:jn,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:jn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:a0}),l0=Ns({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,i){return"xlink:"+i.slice(5).toLowerCase()}}),c0=Ns({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:o0}),u0=Ns({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,i){return"xml:"+i.slice(3).toLowerCase()}}),Cw={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"},kw=/[A-Z]/g,Lx=/-[a-z]/g,Ew=/^data[-\w.:]+$/i;function d0(e,i){const r=Ia(i);let s=i,l=vn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Ew.test(i)){if(i.charAt(4)==="-"){const f=i.slice(5).replace(Lx,Nw);s="data"+f.charAt(0).toUpperCase()+f.slice(1)}else{const f=i.slice(4);if(!Lx.test(f)){let m=f.replace(kw,jw);m.charAt(0)!=="-"&&(m="-"+m),i="data"+m}}l=uh}return new l(s,i)}function jw(e){return"-"+e.toLowerCase()}function Nw(e){return e.charAt(1).toUpperCase()}const h0=i0([s0,Sw,l0,c0,u0],"html"),Rl=i0([s0,ww,l0,c0,u0],"svg");function Mx(e){const i=String(e||"").trim();return i?i.split(/[ \t\n\r\f]+/g):[]}function Tw(e){return e.join(" ").trim()}var gs={},gd,Ox;function Aw(){if(Ox)return gd;Ox=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,f=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,m=/^[;\s]*/,o=/^\s+|\s+$/g,d=`
90
+ `,h="/",g="*",p="",v="comment",S="declaration";function E(b,x){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];x=x||{};var _=1,y=1;function j(O){var W=O.match(i);W&&(_+=W.length);var V=O.lastIndexOf(d);y=~V?O.length-V:y+O.length}function A(){var O={line:_,column:y};return function(W){return W.position=new N(O),I(),W}}function N(O){this.start=O,this.end={line:_,column:y},this.source=x.source}N.prototype.content=b;function R(O){var W=new Error(x.source+":"+_+":"+y+": "+O);if(W.reason=O,W.filename=x.source,W.line=_,W.column=y,W.source=b,!x.silent)throw W}function T(O){var W=O.exec(b);if(W){var V=W[0];return j(V),b=b.slice(V.length),W}}function I(){T(r)}function H(O){var W;for(O=O||[];W=G();)W!==!1&&O.push(W);return O}function G(){var O=A();if(!(h!=b.charAt(0)||g!=b.charAt(1))){for(var W=2;p!=b.charAt(W)&&(g!=b.charAt(W)||h!=b.charAt(W+1));)++W;if(W+=2,p===b.charAt(W-1))return R("End of comment missing");var V=b.slice(2,W-2);return y+=2,j(V),b=b.slice(W),y+=2,O({type:v,comment:V})}}function K(){var O=A(),W=T(s);if(W){if(G(),!T(l))return R("property missing ':'");var V=T(f),Q=O({type:S,property:C(W[0].replace(e,p)),value:V?C(V[0].replace(e,p)):p});return T(m),Q}}function q(){var O=[];H(O);for(var W;W=K();)W!==!1&&(O.push(W),H(O));return O}return I(),q()}function C(b){return b?b.replace(o,p):p}return gd=E,gd}var Bx;function Dw(){if(Bx)return gs;Bx=1;var e=gs&&gs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(gs,"__esModule",{value:!0}),gs.default=r;const i=e(Aw());function r(s,l){let f=null;if(!s||typeof s!="string")return f;const m=(0,i.default)(s),o=typeof l=="function";return m.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:g}=d;o?l(h,g,d):g&&(f=f||{},f[h]=g)}),f}return gs}var ja={},Ix;function Rw(){if(Ix)return ja;Ix=1,Object.defineProperty(ja,"__esModule",{value:!0}),ja.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,f=function(h){return!h||r.test(h)||e.test(h)},m=function(h,g){return g.toUpperCase()},o=function(h,g){return"".concat(g,"-")},d=function(h,g){return g===void 0&&(g={}),f(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(l,o):h=h.replace(s,o),h.replace(i,m))};return ja.camelCase=d,ja}var Na,zx;function Lw(){if(zx)return Na;zx=1;var e=Na&&Na.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},i=e(Dw()),r=Rw();function s(l,f){var m={};return!l||typeof l!="string"||(0,i.default)(l,function(o,d){o&&d&&(m[(0,r.camelCase)(o,f)]=d)}),m}return s.default=s,Na=s,Na}var Mw=Lw();const Ow=Tl(Mw),f0=p0("end"),dh=p0("start");function p0(e){return i;function i(r){const s=r&&r.position&&r.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 Bw(e){const i=dh(e),r=f0(e);if(i&&r)return{start:i,end:r}}function La(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Hx(e.position):"start"in e||"end"in e?Hx(e):"line"in e||"column"in e?Ud(e):""}function Ud(e){return Px(e&&e.line)+":"+Px(e&&e.column)}function Hx(e){return Ud(e&&e.start)+"-"+Ud(e&&e.end)}function Px(e){return e&&typeof e=="number"?e:1}class rn extends Error{constructor(i,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let l="",f={},m=!1;if(r&&("line"in r&&"column"in r?f={place:r}:"start"in r&&"end"in r?f={place:r}:"type"in r?f={ancestors:[r],place:r.position}:f={...r}),typeof i=="string"?l=i:!f.cause&&i&&(m=!0,l=i.message,f.cause=i),!f.ruleId&&!f.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?f.ruleId=s:(f.source=s.slice(0,d),f.ruleId=s.slice(d+1))}if(!f.place&&f.ancestors&&f.ancestors){const d=f.ancestors[f.ancestors.length-1];d&&(f.place=d.position)}const o=f.place&&"start"in f.place?f.place.start:f.place;this.ancestors=f.ancestors||void 0,this.cause=f.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=o?o.line:void 0,this.name=La(f.place)||"1:1",this.place=f.place||void 0,this.reason=this.message,this.ruleId=f.ruleId||void 0,this.source=f.source||void 0,this.stack=m&&f.cause&&typeof f.cause.stack=="string"?f.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rn.prototype.file="";rn.prototype.name="";rn.prototype.reason="";rn.prototype.message="";rn.prototype.stack="";rn.prototype.column=void 0;rn.prototype.line=void 0;rn.prototype.ancestors=void 0;rn.prototype.cause=void 0;rn.prototype.fatal=void 0;rn.prototype.place=void 0;rn.prototype.ruleId=void 0;rn.prototype.source=void 0;const hh={}.hasOwnProperty,Iw=new Map,zw=/[A-Z]/g,Hw=new Set(["table","tbody","thead","tfoot","tr"]),Pw=new Set(["td","th"]),m0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Fw(e,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=i.filePath||void 0;let s;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Kw(r,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=Yw(r,i.jsx,i.jsxs)}const l={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:s,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Rl:h0,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},f=g0(l,e,void 0);return f&&typeof f!="string"?f:l.create(e,l.Fragment,{children:f||void 0},void 0)}function g0(e,i,r){if(i.type==="element")return Uw(e,i,r);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return $w(e,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return Ww(e,i,r);if(i.type==="mdxjsEsm")return qw(e,i);if(i.type==="root")return Gw(e,i,r);if(i.type==="text")return Vw(e,i)}function Uw(e,i,r){const s=e.schema;let l=s;i.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Rl,e.schema=l),e.ancestors.push(i);const f=v0(e,i.tagName,!1),m=Xw(e,i);let o=ph(e,i);return Hw.has(i.tagName)&&(o=o.filter(function(d){return typeof d=="string"?!yw(d):!0})),x0(e,m,f,i),fh(m,o),e.ancestors.pop(),e.schema=s,e.create(i,f,m,r)}function $w(e,i){if(i.data&&i.data.estree&&e.evaluater){const s=i.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}za(e,i.position)}function qw(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);za(e,i.position)}function Ww(e,i,r){const s=e.schema;let l=s;i.name==="svg"&&s.space==="html"&&(l=Rl,e.schema=l),e.ancestors.push(i);const f=i.name===null?e.Fragment:v0(e,i.name,!0),m=Zw(e,i),o=ph(e,i);return x0(e,m,f,i),fh(m,o),e.ancestors.pop(),e.schema=s,e.create(i,f,m,r)}function Gw(e,i,r){const s={};return fh(s,ph(e,i)),e.create(i,e.Fragment,s,r)}function Vw(e,i){return i.value}function x0(e,i,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(i.node=s)}function fh(e,i){if(i.length>0){const r=i.length>1?i:i[0];r&&(e.children=r)}}function Yw(e,i,r){return s;function s(l,f,m,o){const h=Array.isArray(m.children)?r:i;return o?h(f,m,o):h(f,m)}}function Kw(e,i){return r;function r(s,l,f,m){const o=Array.isArray(f.children),d=dh(s);return i(l,f,m,o,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function Xw(e,i){const r={};let s,l;for(l in i.properties)if(l!=="children"&&hh.call(i.properties,l)){const f=Qw(e,l,i.properties[l]);if(f){const[m,o]=f;e.tableCellAlignToStyle&&m==="align"&&typeof o=="string"&&Pw.has(i.tagName)?s=o:r[m]=o}}if(s){const f=r.style||(r.style={});f[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function Zw(e,i){const r={};for(const s of i.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const f=s.data.estree.body[0];f.type;const m=f.expression;m.type;const o=m.properties[0];o.type,Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else za(e,i.position);else{const l=s.name;let f;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const o=s.value.data.estree.body[0];o.type,f=e.evaluater.evaluateExpression(o.expression)}else za(e,i.position);else f=s.value===null?!0:s.value;r[l]=f}return r}function ph(e,i){const r=[];let s=-1;const l=e.passKeys?new Map:Iw;for(;++s<i.children.length;){const f=i.children[s];let m;if(e.passKeys){const d=f.type==="element"?f.tagName:f.type==="mdxJsxFlowElement"||f.type==="mdxJsxTextElement"?f.name:void 0;if(d){const h=l.get(d)||0;m=d+"-"+h,l.set(d,h+1)}}const o=g0(e,f,m);o!==void 0&&r.push(o)}return r}function Qw(e,i,r){const s=d0(e.schema,i);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?mw(r):Tw(r)),s.property==="style"){let l=typeof r=="object"?r:Jw(e,String(r));return e.stylePropertyNameCase==="css"&&(l=e2(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?Cw[s.property]||s.property:s.attribute,r]}}function Jw(e,i){try{return Ow(i,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new rn("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=m0+"#cannot-parse-style-attribute",l}}function v0(e,i,r){let s;if(!r)s={type:"Literal",value:i};else if(i.includes(".")){const l=i.split(".");let f=-1,m;for(;++f<l.length;){const o=Ax(l[f])?{type:"Identifier",name:l[f]}:{type:"Literal",value:l[f]};m=m?{type:"MemberExpression",object:m,property:o,computed:!!(f&&o.type==="Literal"),optional:!1}:o}s=m}else s=Ax(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(s.type==="Literal"){const l=s.value;return hh.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);za(e)}function za(e,i){const r=new rn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=m0+"#cannot-handle-mdx-estrees-without-createevaluater",r}function e2(e){const i={};let r;for(r in e)hh.call(e,r)&&(i[t2(r)]=e[r]);return i}function t2(e){let i=e.replace(zw,n2);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function n2(e){return"-"+e.toLowerCase()}const xd={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"]},r2={};function mh(e,i){const r=r2,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return b0(e,s,l)}function b0(e,i,r){if(i2(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Fx(e.children,i,r)}return Array.isArray(e)?Fx(e,i,r):""}function Fx(e,i,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=b0(e[l],i,r);return s.join("")}function i2(e){return!!(e&&typeof e=="object")}const Ux=document.createElement("i");function Ha(e){const i="&"+e+";";Ux.innerHTML=i;const r=Ux.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===i?!1:r}function Tn(e,i,r,s){const l=e.length;let f=0,m;if(i<0?i=-i>l?0:l+i:i=i>l?l:i,r=r>0?r:0,s.length<1e4)m=Array.from(s),m.unshift(i,r),e.splice(...m);else for(r&&e.splice(i,r);f<s.length;)m=s.slice(f,f+1e4),m.unshift(i,0),e.splice(...m),f+=1e4,i+=1e4}function Fn(e,i){return e.length>0?(Tn(e,e.length,0,i),e):i}const $x={}.hasOwnProperty;function y0(e){const i={};let r=-1;for(;++r<e.length;)s2(i,e[r]);return i}function s2(e,i){let r;for(r in i){const l=($x.call(e,r)?e[r]:void 0)||(e[r]={}),f=i[r];let m;if(f)for(m in f){$x.call(l,m)||(l[m]=[]);const o=f[m];a2(l[m],Array.isArray(o)?o:o?[o]:[])}}}function a2(e,i){let r=-1;const s=[];for(;++r<i.length;)(i[r].add==="after"?e:s).push(i[r]);Tn(e,0,0,s)}function _0(e,i){const r=Number.parseInt(e,i);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const on=ei(/[A-Za-z]/),nn=ei(/[\dA-Za-z]/),o2=ei(/[#-'*+\--9=?A-Z^-~]/);function Cl(e){return e!==null&&(e<32||e===127)}const $d=ei(/\d/),l2=ei(/[\dA-Fa-f]/),c2=ei(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const Ll=ei(new RegExp("\\p{P}|\\p{S}","u")),ji=ei(/\s/);function ei(e){return i;function i(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ts(e){const i=[];let r=-1,s=0,l=0;for(;++r<e.length;){const f=e.charCodeAt(r);let m="";if(f===37&&nn(e.charCodeAt(r+1))&&nn(e.charCodeAt(r+2)))l=2;else if(f<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(f))||(m=String.fromCharCode(f));else if(f>55295&&f<57344){const o=e.charCodeAt(r+1);f<56320&&o>56319&&o<57344?(m=String.fromCharCode(f,o),l=1):m="�"}else m=String.fromCharCode(f);m&&(i.push(e.slice(s,r),encodeURIComponent(m)),s=r+l+1,m=""),l&&(r+=l,l=0)}return i.join("")+e.slice(s)}function tt(e,i,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let f=0;return m;function m(d){return Ye(d)?(e.enter(r),o(d)):i(d)}function o(d){return Ye(d)&&f++<l?(e.consume(d),o):(e.exit(r),i(d))}}const u2={tokenize:d2};function d2(e){const i=e.attempt(this.parser.constructs.contentInitial,s,l);let r;return i;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),tt(e,i,"linePrefix")}function l(o){return e.enter("paragraph"),f(o)}function f(o){const d=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,m(o)}function m(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Re(o)?(e.consume(o),e.exit("chunkText"),f):(e.consume(o),m)}}const h2={tokenize:f2},qx={tokenize:p2};function f2(e){const i=this,r=[];let s=0,l,f,m;return o;function o(y){if(s<r.length){const j=r[s];return i.containerState=j[1],e.attempt(j[0].continuation,d,h)(y)}return h(y)}function d(y){if(s++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,l&&_();const j=i.events.length;let A=j,N;for(;A--;)if(i.events[A][0]==="exit"&&i.events[A][1].type==="chunkFlow"){N=i.events[A][1].end;break}x(s);let R=j;for(;R<i.events.length;)i.events[R][1].end={...N},R++;return Tn(i.events,A+1,0,i.events.slice(j)),i.events.length=R,h(y)}return o(y)}function h(y){if(s===r.length){if(!l)return v(y);if(l.currentConstruct&&l.currentConstruct.concrete)return E(y);i.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(qx,g,p)(y)}function g(y){return l&&_(),x(s),v(y)}function p(y){return i.parser.lazy[i.now().line]=s!==r.length,m=i.now().offset,E(y)}function v(y){return i.containerState={},e.attempt(qx,S,E)(y)}function S(y){return s++,r.push([i.currentConstruct,i.containerState]),v(y)}function E(y){if(y===null){l&&_(),x(0),e.consume(y);return}return l=l||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:f}),C(y)}function C(y){if(y===null){b(e.exit("chunkFlow"),!0),x(0),e.consume(y);return}return Re(y)?(e.consume(y),b(e.exit("chunkFlow")),s=0,i.interrupt=void 0,o):(e.consume(y),C)}function b(y,j){const A=i.sliceStream(y);if(j&&A.push(null),y.previous=f,f&&(f.next=y),f=y,l.defineSkip(y.start),l.write(A),i.parser.lazy[y.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<m&&(!l.events[N][1].end||l.events[N][1].end.offset>m))return;const R=i.events.length;let T=R,I,H;for(;T--;)if(i.events[T][0]==="exit"&&i.events[T][1].type==="chunkFlow"){if(I){H=i.events[T][1].end;break}I=!0}for(x(s),N=R;N<i.events.length;)i.events[N][1].end={...H},N++;Tn(i.events,T+1,0,i.events.slice(R)),i.events.length=N}}function x(y){let j=r.length;for(;j-- >y;){const A=r[j];i.containerState=A[1],A[0].exit.call(i,e)}r.length=y}function _(){l.write([null]),f=void 0,l=void 0,i.containerState._closeFlow=void 0}}function p2(e,i,r){return tt(e,e.attempt(this.parser.constructs.document,i,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Es(e){if(e===null||bt(e)||ji(e))return 1;if(Ll(e))return 2}function Ml(e,i,r){const s=[];let l=-1;for(;++l<e.length;){const f=e[l].resolveAll;f&&!s.includes(f)&&(i=f(i,r),s.push(f))}return i}const qd={name:"attention",resolveAll:m2,tokenize:g2};function m2(e,i){let r=-1,s,l,f,m,o,d,h,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&i.sliceSerialize(e[s][1]).charCodeAt(0)===i.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const p={...e[s][1].end},v={...e[r][1].start};Wx(p,-d),Wx(v,d),m={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[s][1].end}},o={type:d>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:v},f={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},l={type:d>1?"strong":"emphasis",start:{...m.start},end:{...o.end}},e[s][1].end={...m.start},e[r][1].start={...o.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Fn(h,[["enter",e[s][1],i],["exit",e[s][1],i]])),h=Fn(h,[["enter",l,i],["enter",m,i],["exit",m,i],["enter",f,i]]),h=Fn(h,Ml(i.parser.constructs.insideSpan.null,e.slice(s+1,r),i)),h=Fn(h,[["exit",f,i],["enter",o,i],["exit",o,i],["exit",l,i]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,h=Fn(h,[["enter",e[r][1],i],["exit",e[r][1],i]])):g=0,Tn(e,s-1,r-s+3,h),r=s+h.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function g2(e,i){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=Es(s);let f;return m;function m(d){return f=d,e.enter("attentionSequence"),o(d)}function o(d){if(d===f)return e.consume(d),o;const h=e.exit("attentionSequence"),g=Es(d),p=!g||g===2&&l||r.includes(d),v=!l||l===2&&g||r.includes(s);return h._open=!!(f===42?p:p&&(l||!v)),h._close=!!(f===42?v:v&&(g||!p)),i(d)}}function Wx(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}const x2={name:"autolink",tokenize:v2};function v2(e,i,r){let s=0;return l;function l(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),f}function f(S){return on(S)?(e.consume(S),m):S===64?r(S):h(S)}function m(S){return S===43||S===45||S===46||nn(S)?(s=1,o(S)):h(S)}function o(S){return S===58?(e.consume(S),s=0,d):(S===43||S===45||S===46||nn(S))&&s++<32?(e.consume(S),o):(s=0,h(S))}function d(S){return S===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),i):S===null||S===32||S===60||Cl(S)?r(S):(e.consume(S),d)}function h(S){return S===64?(e.consume(S),g):o2(S)?(e.consume(S),h):r(S)}function g(S){return nn(S)?p(S):r(S)}function p(S){return S===46?(e.consume(S),s=0,g):S===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),i):v(S)}function v(S){if((S===45||nn(S))&&s++<63){const E=S===45?v:p;return e.consume(S),E}return r(S)}}const Ga={partial:!0,tokenize:b2};function b2(e,i,r){return s;function s(f){return Ye(f)?tt(e,l,"linePrefix")(f):l(f)}function l(f){return f===null||Re(f)?i(f):r(f)}}const S0={continuation:{tokenize:_2},exit:S2,name:"blockQuote",tokenize:y2};function y2(e,i,r){const s=this;return l;function l(m){if(m===62){const o=s.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(m),e.exit("blockQuoteMarker"),f}return r(m)}function f(m){return Ye(m)?(e.enter("blockQuotePrefixWhitespace"),e.consume(m),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(m))}}function _2(e,i,r){const s=this;return l;function l(m){return Ye(m)?tt(e,f,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):f(m)}function f(m){return e.attempt(S0,i,r)(m)}}function S2(e){e.exit("blockQuote")}const w0={name:"characterEscape",tokenize:w2};function w2(e,i,r){return s;function s(f){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(f),e.exit("escapeMarker"),l}function l(f){return c2(f)?(e.enter("characterEscapeValue"),e.consume(f),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):r(f)}}const C0={name:"characterReference",tokenize:C2};function C2(e,i,r){const s=this;let l=0,f,m;return o;function o(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),d}function d(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),f=31,m=nn,g(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),f=6,m=l2,g):(e.enter("characterReferenceValue"),f=7,m=$d,g(p))}function g(p){if(p===59&&l){const v=e.exit("characterReferenceValue");return m===nn&&!Ha(s.sliceSerialize(v))?r(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),i)}return m(p)&&l++<f?(e.consume(p),g):r(p)}}const Gx={partial:!0,tokenize:E2},Vx={concrete:!0,name:"codeFenced",tokenize:k2};function k2(e,i,r){const s=this,l={partial:!0,tokenize:A};let f=0,m=0,o;return d;function d(N){return h(N)}function h(N){const R=s.events[s.events.length-1];return f=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,o=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===o?(m++,e.consume(N),g):m<3?r(N):(e.exit("codeFencedFenceSequence"),Ye(N)?tt(e,p,"whitespace")(N):p(N))}function p(N){return N===null||Re(N)?(e.exit("codeFencedFence"),s.interrupt?i(N):e.check(Gx,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===null||Re(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(N)):Ye(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,S,"whitespace")(N)):N===96&&N===o?r(N):(e.consume(N),v)}function S(N){return N===null||Re(N)?p(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Re(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(N)):N===96&&N===o?r(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"),x}function x(N){return f>0&&Ye(N)?tt(e,_,"linePrefix",f+1)(N):_(N)}function _(N){return N===null||Re(N)?e.check(Gx,C,j)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Re(N)?(e.exit("codeFlowValue"),_(N)):(e.consume(N),y)}function j(N){return e.exit("codeFenced"),i(N)}function A(N,R,T){let I=0;return H;function H(W){return N.enter("lineEnding"),N.consume(W),N.exit("lineEnding"),G}function G(W){return N.enter("codeFencedFence"),Ye(W)?tt(N,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):K(W)}function K(W){return W===o?(N.enter("codeFencedFenceSequence"),q(W)):T(W)}function q(W){return W===o?(I++,N.consume(W),q):I>=m?(N.exit("codeFencedFenceSequence"),Ye(W)?tt(N,O,"whitespace")(W):O(W)):T(W)}function O(W){return W===null||Re(W)?(N.exit("codeFencedFence"),R(W)):T(W)}}}function E2(e,i,r){const s=this;return l;function l(m){return m===null?r(m):(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f)}function f(m){return s.parser.lazy[s.now().line]?r(m):i(m)}}const vd={name:"codeIndented",tokenize:N2},j2={partial:!0,tokenize:T2};function N2(e,i,r){const s=this;return l;function l(h){return e.enter("codeIndented"),tt(e,f,"linePrefix",5)(h)}function f(h){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?m(h):r(h)}function m(h){return h===null?d(h):Re(h)?e.attempt(j2,m,d)(h):(e.enter("codeFlowValue"),o(h))}function o(h){return h===null||Re(h)?(e.exit("codeFlowValue"),m(h)):(e.consume(h),o)}function d(h){return e.exit("codeIndented"),i(h)}}function T2(e,i,r){const s=this;return l;function l(m){return s.parser.lazy[s.now().line]?r(m):Re(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):tt(e,f,"linePrefix",5)(m)}function f(m){const o=s.events[s.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?i(m):Re(m)?l(m):r(m)}}const A2={name:"codeText",previous:R2,resolve:D2,tokenize:L2};function D2(e){let i=e.length-4,r=3,s,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[i][1].type==="lineEnding"||e[i][1].type==="space")){for(s=r;++s<i;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[i][1].type="codeTextPadding",r+=2,i-=2;break}}for(s=r-1,i++;++s<=i;)l===void 0?s!==i&&e[s][1].type!=="lineEnding"&&(l=s):(s===i||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),i-=s-l-2,s=l+2),l=void 0);return e}function R2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function L2(e,i,r){let s=0,l,f;return m;function m(p){return e.enter("codeText"),e.enter("codeTextSequence"),o(p)}function o(p){return p===96?(e.consume(p),s++,o):(e.exit("codeTextSequence"),d(p))}function d(p){return p===null?r(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),d):p===96?(f=e.enter("codeTextSequence"),l=0,g(p)):Re(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||Re(p)?(e.exit("codeTextData"),d(p)):(e.consume(p),h)}function g(p){return p===96?(e.consume(p),l++,g):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),i(p)):(f.type="codeTextData",h(p))}}class M2{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(i,s):i>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(i,r,s){const l=r||0;this.setCursor(Math.trunc(i));const f=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Ta(this.left,s),f.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),Ta(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),Ta(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const r=this.left.splice(i,Number.POSITIVE_INFINITY);Ta(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);Ta(this.left,r.reverse())}}}function Ta(e,i){let r=0;if(i.length<1e4)e.push(...i);else for(;r<i.length;)e.push(...i.slice(r,r+1e4)),r+=1e4}function k0(e){const i={};let r=-1,s,l,f,m,o,d,h;const g=new M2(e);for(;++r<g.length;){for(;r in i;)r=i[r];if(s=g.get(r),r&&s[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,f=0,f<d.length&&d[f][1].type==="lineEndingBlank"&&(f+=2),f<d.length&&d[f][1].type==="content"))for(;++f<d.length&&d[f][1].type!=="content";)d[f][1].type==="chunkText"&&(d[f][1]._isInFirstContentOfListItem=!0,f++);if(s[0]==="enter")s[1].contentType&&(Object.assign(i,O2(g,r)),r=i[r],h=!0);else if(s[1]._container){for(f=r,l=void 0;f--;)if(m=g.get(f),m[1].type==="lineEnding"||m[1].type==="lineEndingBlank")m[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),m[1].type="lineEnding",l=f);else if(!(m[1].type==="linePrefix"||m[1].type==="listItemIndent"))break;l&&(s[1].end={...g.get(l)[1].start},o=g.slice(l,r),o.unshift(s),g.splice(l,r-l+1,o))}}return Tn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function O2(e,i){const r=e.get(i)[1],s=e.get(i)[2];let l=i-1;const f=[];let m=r._tokenizer;m||(m=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(m._contentTypeTextTrailing=!0));const o=m.events,d=[],h={};let g,p,v=-1,S=r,E=0,C=0;const b=[C];for(;S;){for(;e.get(++l)[1]!==S;);f.push(l),S._tokenizer||(g=s.sliceStream(S),S.next||g.push(null),p&&m.defineSkip(S.start),S._isInFirstContentOfListItem&&(m._gfmTasklistFirstContentOfListItem=!0),m.write(g),S._isInFirstContentOfListItem&&(m._gfmTasklistFirstContentOfListItem=void 0)),p=S,S=S.next}for(S=r;++v<o.length;)o[v][0]==="exit"&&o[v-1][0]==="enter"&&o[v][1].type===o[v-1][1].type&&o[v][1].start.line!==o[v][1].end.line&&(C=v+1,b.push(C),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(m.events=[],S?(S._tokenizer=void 0,S.previous=void 0):b.pop(),v=b.length;v--;){const x=o.slice(b[v],b[v+1]),_=f.pop();d.push([_,_+x.length-1]),e.splice(_,2,x)}for(d.reverse(),v=-1;++v<d.length;)h[E+d[v][0]]=E+d[v][1],E+=d[v][1]-d[v][0]-1;return h}const B2={resolve:z2,tokenize:H2},I2={partial:!0,tokenize:P2};function z2(e){return k0(e),e}function H2(e,i){let r;return s;function s(o){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(o)}function l(o){return o===null?f(o):Re(o)?e.check(I2,m,f)(o):(e.consume(o),l)}function f(o){return e.exit("chunkContent"),e.exit("content"),i(o)}function m(o){return e.consume(o),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function P2(e,i,r){const s=this;return l;function l(m){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),tt(e,f,"linePrefix")}function f(m){if(m===null||Re(m))return r(m);const o=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?i(m):e.interrupt(s.parser.constructs.flow,r,i)(m)}}function E0(e,i,r,s,l,f,m,o,d){const h=d||Number.POSITIVE_INFINITY;let g=0;return p;function p(x){return x===60?(e.enter(s),e.enter(l),e.enter(f),e.consume(x),e.exit(f),v):x===null||x===32||x===41||Cl(x)?r(x):(e.enter(s),e.enter(m),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(x))}function v(x){return x===62?(e.enter(f),e.consume(x),e.exit(f),e.exit(l),e.exit(s),i):(e.enter(o),e.enter("chunkString",{contentType:"string"}),S(x))}function S(x){return x===62?(e.exit("chunkString"),e.exit(o),v(x)):x===null||x===60||Re(x)?r(x):(e.consume(x),x===92?E:S)}function E(x){return x===60||x===62||x===92?(e.consume(x),S):S(x)}function C(x){return!g&&(x===null||x===41||bt(x))?(e.exit("chunkString"),e.exit(o),e.exit(m),e.exit(s),i(x)):g<h&&x===40?(e.consume(x),g++,C):x===41?(e.consume(x),g--,C):x===null||x===32||x===40||Cl(x)?r(x):(e.consume(x),x===92?b:C)}function b(x){return x===40||x===41||x===92?(e.consume(x),C):C(x)}}function j0(e,i,r,s,l,f){const m=this;let o=0,d;return h;function h(S){return e.enter(s),e.enter(l),e.consume(S),e.exit(l),e.enter(f),g}function g(S){return o>999||S===null||S===91||S===93&&!d||S===94&&!o&&"_hiddenFootnoteSupport"in m.parser.constructs?r(S):S===93?(e.exit(f),e.enter(l),e.consume(S),e.exit(l),e.exit(s),i):Re(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||S===91||S===93||Re(S)||o++>999?(e.exit("chunkString"),g(S)):(e.consume(S),d||(d=!Ye(S)),S===92?v:p)}function v(S){return S===91||S===92||S===93?(e.consume(S),o++,p):p(S)}}function N0(e,i,r,s,l,f){let m;return o;function o(v){return v===34||v===39||v===40?(e.enter(s),e.enter(l),e.consume(v),e.exit(l),m=v===40?41:v,d):r(v)}function d(v){return v===m?(e.enter(l),e.consume(v),e.exit(l),e.exit(s),i):(e.enter(f),h(v))}function h(v){return v===m?(e.exit(f),d(m)):v===null?r(v):Re(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),tt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===m||v===null||Re(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?p:g)}function p(v){return v===m||v===92?(e.consume(v),g):g(v)}}function Ma(e,i){let r;return s;function s(l){return Re(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):Ye(l)?tt(e,s,r?"linePrefix":"lineSuffix")(l):i(l)}}const F2={name:"definition",tokenize:$2},U2={partial:!0,tokenize:q2};function $2(e,i,r){const s=this;let l;return f;function f(S){return e.enter("definition"),m(S)}function m(S){return j0.call(s,e,o,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function o(S){return l=Vn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),d):r(S)}function d(S){return bt(S)?Ma(e,h)(S):h(S)}function h(S){return E0(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(U2,p,p)(S)}function p(S){return Ye(S)?tt(e,v,"whitespace")(S):v(S)}function v(S){return S===null||Re(S)?(e.exit("definition"),s.parser.defined.push(l),i(S)):r(S)}}function q2(e,i,r){return s;function s(o){return bt(o)?Ma(e,l)(o):r(o)}function l(o){return N0(e,f,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function f(o){return Ye(o)?tt(e,m,"whitespace")(o):m(o)}function m(o){return o===null||Re(o)?i(o):r(o)}}const W2={name:"hardBreakEscape",tokenize:G2};function G2(e,i,r){return s;function s(f){return e.enter("hardBreakEscape"),e.consume(f),l}function l(f){return Re(f)?(e.exit("hardBreakEscape"),i(f)):r(f)}}const V2={name:"headingAtx",resolve:Y2,tokenize:K2};function Y2(e,i){let r=e.length-2,s=3,l,f;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},f={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},Tn(e,s,r-s+1,[["enter",l,i],["enter",f,i],["exit",f,i],["exit",l,i]])),e}function K2(e,i,r){let s=0;return l;function l(g){return e.enter("atxHeading"),f(g)}function f(g){return e.enter("atxHeadingSequence"),m(g)}function m(g){return g===35&&s++<6?(e.consume(g),m):g===null||bt(g)?(e.exit("atxHeadingSequence"),o(g)):r(g)}function o(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Re(g)?(e.exit("atxHeading"),i(g)):Ye(g)?tt(e,o,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),o(g))}function h(g){return g===null||g===35||bt(g)?(e.exit("atxHeadingText"),o(g)):(e.consume(g),h)}}const X2=["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"],Yx=["pre","script","style","textarea"],Z2={concrete:!0,name:"htmlFlow",resolveTo:eC,tokenize:tC},Q2={partial:!0,tokenize:rC},J2={partial:!0,tokenize:nC};function eC(e){let i=e.length;for(;i--&&!(e[i][0]==="enter"&&e[i][1].type==="htmlFlow"););return i>1&&e[i-2][1].type==="linePrefix"&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e}function tC(e,i,r){const s=this;let l,f,m,o,d;return h;function h(P){return g(P)}function g(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),p}function p(P){return P===33?(e.consume(P),v):P===47?(e.consume(P),f=!0,C):P===63?(e.consume(P),l=3,s.interrupt?i:D):on(P)?(e.consume(P),m=String.fromCharCode(P),b):r(P)}function v(P){return P===45?(e.consume(P),l=2,S):P===91?(e.consume(P),l=5,o=0,E):on(P)?(e.consume(P),l=4,s.interrupt?i:D):r(P)}function S(P){return P===45?(e.consume(P),s.interrupt?i:D):r(P)}function E(P){const Y="CDATA[";return P===Y.charCodeAt(o++)?(e.consume(P),o===Y.length?s.interrupt?i:K:E):r(P)}function C(P){return on(P)?(e.consume(P),m=String.fromCharCode(P),b):r(P)}function b(P){if(P===null||P===47||P===62||bt(P)){const Y=P===47,ne=m.toLowerCase();return!Y&&!f&&Yx.includes(ne)?(l=1,s.interrupt?i(P):K(P)):X2.includes(m.toLowerCase())?(l=6,Y?(e.consume(P),x):s.interrupt?i(P):K(P)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(P):f?_(P):y(P))}return P===45||nn(P)?(e.consume(P),m+=String.fromCharCode(P),b):r(P)}function x(P){return P===62?(e.consume(P),s.interrupt?i:K):r(P)}function _(P){return Ye(P)?(e.consume(P),_):H(P)}function y(P){return P===47?(e.consume(P),H):P===58||P===95||on(P)?(e.consume(P),j):Ye(P)?(e.consume(P),y):H(P)}function j(P){return P===45||P===46||P===58||P===95||nn(P)?(e.consume(P),j):A(P)}function A(P){return P===61?(e.consume(P),N):Ye(P)?(e.consume(P),A):y(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(e.consume(P),d=P,R):Ye(P)?(e.consume(P),N):T(P)}function R(P){return P===d?(e.consume(P),d=null,I):P===null||Re(P)?r(P):(e.consume(P),R)}function T(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||bt(P)?A(P):(e.consume(P),T)}function I(P){return P===47||P===62||Ye(P)?y(P):r(P)}function H(P){return P===62?(e.consume(P),G):r(P)}function G(P){return P===null||Re(P)?K(P):Ye(P)?(e.consume(P),G):r(P)}function K(P){return P===45&&l===2?(e.consume(P),V):P===60&&l===1?(e.consume(P),Q):P===62&&l===4?(e.consume(P),B):P===63&&l===3?(e.consume(P),D):P===93&&l===5?(e.consume(P),L):Re(P)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(Q2,U,q)(P)):P===null||Re(P)?(e.exit("htmlFlowData"),q(P)):(e.consume(P),K)}function q(P){return e.check(J2,O,U)(P)}function O(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),W}function W(P){return P===null||Re(P)?q(P):(e.enter("htmlFlowData"),K(P))}function V(P){return P===45?(e.consume(P),D):K(P)}function Q(P){return P===47?(e.consume(P),m="",te):K(P)}function te(P){if(P===62){const Y=m.toLowerCase();return Yx.includes(Y)?(e.consume(P),B):K(P)}return on(P)&&m.length<8?(e.consume(P),m+=String.fromCharCode(P),te):K(P)}function L(P){return P===93?(e.consume(P),D):K(P)}function D(P){return P===62?(e.consume(P),B):P===45&&l===2?(e.consume(P),D):K(P)}function B(P){return P===null||Re(P)?(e.exit("htmlFlowData"),U(P)):(e.consume(P),B)}function U(P){return e.exit("htmlFlow"),i(P)}}function nC(e,i,r){const s=this;return l;function l(m){return Re(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):r(m)}function f(m){return s.parser.lazy[s.now().line]?r(m):i(m)}}function rC(e,i,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Ga,i,r)}}const iC={name:"htmlText",tokenize:sC};function sC(e,i,r){const s=this;let l,f,m;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),A):D===63?(e.consume(D),y):on(D)?(e.consume(D),T):r(D)}function h(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),f=0,E):on(D)?(e.consume(D),_):r(D)}function g(D){return D===45?(e.consume(D),S):r(D)}function p(D){return D===null?r(D):D===45?(e.consume(D),v):Re(D)?(m=p,Q(D)):(e.consume(D),p)}function v(D){return D===45?(e.consume(D),S):p(D)}function S(D){return D===62?V(D):D===45?v(D):p(D)}function E(D){const B="CDATA[";return D===B.charCodeAt(f++)?(e.consume(D),f===B.length?C:E):r(D)}function C(D){return D===null?r(D):D===93?(e.consume(D),b):Re(D)?(m=C,Q(D)):(e.consume(D),C)}function b(D){return D===93?(e.consume(D),x):C(D)}function x(D){return D===62?V(D):D===93?(e.consume(D),x):C(D)}function _(D){return D===null||D===62?V(D):Re(D)?(m=_,Q(D)):(e.consume(D),_)}function y(D){return D===null?r(D):D===63?(e.consume(D),j):Re(D)?(m=y,Q(D)):(e.consume(D),y)}function j(D){return D===62?V(D):y(D)}function A(D){return on(D)?(e.consume(D),N):r(D)}function N(D){return D===45||nn(D)?(e.consume(D),N):R(D)}function R(D){return Re(D)?(m=R,Q(D)):Ye(D)?(e.consume(D),R):V(D)}function T(D){return D===45||nn(D)?(e.consume(D),T):D===47||D===62||bt(D)?I(D):r(D)}function I(D){return D===47?(e.consume(D),V):D===58||D===95||on(D)?(e.consume(D),H):Re(D)?(m=I,Q(D)):Ye(D)?(e.consume(D),I):V(D)}function H(D){return D===45||D===46||D===58||D===95||nn(D)?(e.consume(D),H):G(D)}function G(D){return D===61?(e.consume(D),K):Re(D)?(m=G,Q(D)):Ye(D)?(e.consume(D),G):I(D)}function K(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),l=D,q):Re(D)?(m=K,Q(D)):Ye(D)?(e.consume(D),K):(e.consume(D),O)}function q(D){return D===l?(e.consume(D),l=void 0,W):D===null?r(D):Re(D)?(m=q,Q(D)):(e.consume(D),q)}function O(D){return D===null||D===34||D===39||D===60||D===61||D===96?r(D):D===47||D===62||bt(D)?I(D):(e.consume(D),O)}function W(D){return D===47||D===62||bt(D)?I(D):r(D)}function V(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),i):r(D)}function Q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),te}function te(D){return Ye(D)?tt(e,L,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):L(D)}function L(D){return e.enter("htmlTextData"),m(D)}}const gh={name:"labelEnd",resolveAll:cC,resolveTo:uC,tokenize:dC},aC={tokenize:hC},oC={tokenize:fC},lC={tokenize:pC};function cC(e){let i=-1;const r=[];for(;++i<e.length;){const s=e[i][1];if(r.push(e[i]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const l=s.type==="labelImage"?4:2;s.type="data",i+=l}}return e.length!==r.length&&Tn(e,0,e.length,r),e}function uC(e,i){let r=e.length,s=0,l,f,m,o;for(;r--;)if(l=e[r][1],f){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(m){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(f=r,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(m=r);const d={type:e[f][1].type==="labelLink"?"link":"image",start:{...e[f][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[f][1].start},end:{...e[m][1].end}},g={type:"labelText",start:{...e[f+s+2][1].end},end:{...e[m-2][1].start}};return o=[["enter",d,i],["enter",h,i]],o=Fn(o,e.slice(f+1,f+s+3)),o=Fn(o,[["enter",g,i]]),o=Fn(o,Ml(i.parser.constructs.insideSpan.null,e.slice(f+s+4,m-3),i)),o=Fn(o,[["exit",g,i],e[m-2],e[m-1],["exit",h,i]]),o=Fn(o,e.slice(m+1)),o=Fn(o,[["exit",d,i]]),Tn(e,f,e.length,o),e}function dC(e,i,r){const s=this;let l=s.events.length,f,m;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){f=s.events[l][1];break}return o;function o(v){return f?f._inactive?p(v):(m=s.parser.defined.includes(Vn(s.sliceSerialize({start:f.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):r(v)}function d(v){return v===40?e.attempt(aC,g,m?g:p)(v):v===91?e.attempt(oC,g,m?h:p)(v):m?g(v):p(v)}function h(v){return e.attempt(lC,g,p)(v)}function g(v){return i(v)}function p(v){return f._balanced=!0,r(v)}}function hC(e,i,r){return s;function s(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),l}function l(p){return bt(p)?Ma(e,f)(p):f(p)}function f(p){return p===41?g(p):E0(e,m,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function m(p){return bt(p)?Ma(e,d)(p):g(p)}function o(p){return r(p)}function d(p){return p===34||p===39||p===40?N0(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function h(p){return bt(p)?Ma(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),i):r(p)}}function fC(e,i,r){const s=this;return l;function l(o){return j0.call(s,e,f,m,"reference","referenceMarker","referenceString")(o)}function f(o){return s.parser.defined.includes(Vn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?i(o):r(o)}function m(o){return r(o)}}function pC(e,i,r){return s;function s(f){return e.enter("reference"),e.enter("referenceMarker"),e.consume(f),e.exit("referenceMarker"),l}function l(f){return f===93?(e.enter("referenceMarker"),e.consume(f),e.exit("referenceMarker"),e.exit("reference"),i):r(f)}}const mC={name:"labelStartImage",resolveAll:gh.resolveAll,tokenize:gC};function gC(e,i,r){const s=this;return l;function l(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),f}function f(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),m):r(o)}function m(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(o):i(o)}}const xC={name:"labelStartLink",resolveAll:gh.resolveAll,tokenize:vC};function vC(e,i,r){const s=this;return l;function l(m){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelLink"),f}function f(m){return m===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(m):i(m)}}const bd={name:"lineEnding",tokenize:bC};function bC(e,i){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),tt(e,i,"linePrefix")}}const vl={name:"thematicBreak",tokenize:yC};function yC(e,i,r){let s=0,l;return f;function f(h){return e.enter("thematicBreak"),m(h)}function m(h){return l=h,o(h)}function o(h){return h===l?(e.enter("thematicBreakSequence"),d(h)):s>=3&&(h===null||Re(h))?(e.exit("thematicBreak"),i(h)):r(h)}function d(h){return h===l?(e.consume(h),s++,d):(e.exit("thematicBreakSequence"),Ye(h)?tt(e,o,"whitespace")(h):o(h))}}const mn={continuation:{tokenize:CC},exit:EC,name:"list",tokenize:wC},_C={partial:!0,tokenize:jC},SC={partial:!0,tokenize:kC};function wC(e,i,r){const s=this,l=s.events[s.events.length-1];let f=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,m=0;return o;function o(S){const E=s.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||S===s.containerState.marker:$d(S)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(vl,r,h)(S):h(S);if(!s.interrupt||S===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(S)}return r(S)}function d(S){return $d(S)&&++m<10?(e.consume(S),d):(!s.interrupt||m<2)&&(s.containerState.marker?S===s.containerState.marker:S===41||S===46)?(e.exit("listItemValue"),h(S)):r(S)}function h(S){return e.enter("listItemMarker"),e.consume(S),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||S,e.check(Ga,s.interrupt?r:g,e.attempt(_C,v,p))}function g(S){return s.containerState.initialBlankLine=!0,f++,v(S)}function p(S){return Ye(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),v):r(S)}function v(S){return s.containerState.size=f+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(S)}}function CC(e,i,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ga,l,f);function l(o){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,tt(e,i,"listItemIndent",s.containerState.size+1)(o)}function f(o){return s.containerState.furtherBlankLines||!Ye(o)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,m(o)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(SC,i,m)(o))}function m(o){return s.containerState._closeFlow=!0,s.interrupt=void 0,tt(e,e.attempt(mn,i,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function kC(e,i,r){const s=this;return tt(e,l,"listItemIndent",s.containerState.size+1);function l(f){const m=s.events[s.events.length-1];return m&&m[1].type==="listItemIndent"&&m[2].sliceSerialize(m[1],!0).length===s.containerState.size?i(f):r(f)}}function EC(e){e.exit(this.containerState.type)}function jC(e,i,r){const s=this;return tt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(f){const m=s.events[s.events.length-1];return!Ye(f)&&m&&m[1].type==="listItemPrefixWhitespace"?i(f):r(f)}}const Kx={name:"setextUnderline",resolveTo:NC,tokenize:TC};function NC(e,i){let r=e.length,s,l,f;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!f&&e[r][1].type==="definition"&&(f=r);const m={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",f?(e.splice(l,0,["enter",m,i]),e.splice(f+1,0,["exit",e[s][1],i]),e[s][1].end={...e[f][1].end}):e[s][1]=m,e.push(["exit",m,i]),e}function TC(e,i,r){const s=this;let l;return f;function f(h){let g=s.events.length,p;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){p=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||p)?(e.enter("setextHeadingLine"),l=h,m(h)):r(h)}function m(h){return e.enter("setextHeadingLineSequence"),o(h)}function o(h){return h===l?(e.consume(h),o):(e.exit("setextHeadingLineSequence"),Ye(h)?tt(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Re(h)?(e.exit("setextHeadingLine"),i(h)):r(h)}}const AC={tokenize:DC};function DC(e){const i=this,r=e.attempt(Ga,s,e.attempt(this.parser.constructs.flowInitial,l,tt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(B2,l)),"linePrefix")));return r;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEndingBlank"),e.consume(f),e.exit("lineEndingBlank"),i.currentConstruct=void 0,r}function l(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),i.currentConstruct=void 0,r}}const RC={resolveAll:A0()},LC=T0("string"),MC=T0("text");function T0(e){return{resolveAll:A0(e==="text"?OC:void 0),tokenize:i};function i(r){const s=this,l=this.parser.constructs[e],f=r.attempt(l,m,o);return m;function m(g){return h(g)?f(g):o(g)}function o(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),d}function d(g){return h(g)?(r.exit("data"),f(g)):(r.consume(g),d)}function h(g){if(g===null)return!0;const p=l[g];let v=-1;if(p)for(;++v<p.length;){const S=p[v];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function A0(e){return i;function i(r,s){let l=-1,f;for(;++l<=r.length;)f===void 0?r[l]&&r[l][1].type==="data"&&(f=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==f+2&&(r[f][1].end=r[l-1][1].end,r.splice(f+2,l-f-2),l=f+2),f=void 0);return e?e(r,s):r}}function OC(e,i){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],l=i.sliceStream(s);let f=l.length,m=-1,o=0,d;for(;f--;){const h=l[f];if(typeof h=="string"){for(m=h.length;h.charCodeAt(m-1)===32;)o++,m--;if(m)break;m=-1}else if(h===-2)d=!0,o++;else if(h!==-1){f++;break}}if(i._contentTypeTextTrailing&&r===e.length&&(o=0),o){const h={type:r===e.length||d||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:f?m:s.start._bufferIndex+m,_index:s.start._index+f,line:s.end.line,column:s.end.column-o,offset:s.end.offset-o},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(r,0,["enter",h,i],["exit",h,i]),r+=2)}r++}return e}const BC={42:mn,43:mn,45:mn,48:mn,49:mn,50:mn,51:mn,52:mn,53:mn,54:mn,55:mn,56:mn,57:mn,62:S0},IC={91:F2},zC={[-2]:vd,[-1]:vd,32:vd},HC={35:V2,42:vl,45:[Kx,vl],60:Z2,61:Kx,95:vl,96:Vx,126:Vx},PC={38:C0,92:w0},FC={[-5]:bd,[-4]:bd,[-3]:bd,33:mC,38:C0,42:qd,60:[x2,iC],91:xC,92:[W2,w0],93:gh,95:qd,96:A2},UC={null:[qd,RC]},$C={null:[42,95]},qC={null:[]},WC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$C,contentInitial:IC,disable:qC,document:BC,flow:HC,flowInitial:zC,insideSpan:UC,string:PC,text:FC},Symbol.toStringTag,{value:"Module"}));function GC(e,i,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},f=[];let m=[],o=[];const d={attempt:R(A),check:R(N),consume:_,enter:y,exit:j,interrupt:R(N,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:v,sliceStream:S,write:p};let g=i.tokenize.call(h,d);return i.resolveAll&&f.push(i),h;function p(G){return m=Fn(m,G),b(),m[m.length-1]!==null?[]:(T(i,0),h.events=Ml(f,h.events,h),h.events)}function v(G,K){return YC(S(G),K)}function S(G){return VC(m,G)}function E(){const{_bufferIndex:G,_index:K,line:q,column:O,offset:W}=s;return{_bufferIndex:G,_index:K,line:q,column:O,offset:W}}function C(G){l[G.line]=G.column,H()}function b(){let G;for(;s._index<m.length;){const K=m[s._index];if(typeof K=="string")for(G=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===G&&s._bufferIndex<K.length;)x(K.charCodeAt(s._bufferIndex));else x(K)}}function x(G){g=g(G)}function _(G){Re(G)?(s.line++,s.column=1,s.offset+=G===-3?2:1,H()):G!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===m[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=G}function y(G,K){const q=K||{};return q.type=G,q.start=E(),h.events.push(["enter",q,h]),o.push(q),q}function j(G){const K=o.pop();return K.end=E(),h.events.push(["exit",K,h]),K}function A(G,K){T(G,K.from)}function N(G,K){K.restore()}function R(G,K){return q;function q(O,W,V){let Q,te,L,D;return Array.isArray(O)?U(O):"tokenize"in O?U([O]):B(O);function B(Z){return X;function X(z){const ae=z!==null&&Z[z],se=z!==null&&Z.null,ge=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(se)?se:se?[se]:[]];return U(ge)(z)}}function U(Z){return Q=Z,te=0,Z.length===0?V:P(Z[te])}function P(Z){return X;function X(z){return D=I(),L=Z,Z.partial||(h.currentConstruct=Z),Z.name&&h.parser.constructs.disable.null.includes(Z.name)?ne():Z.tokenize.call(K?Object.assign(Object.create(h),K):h,d,Y,ne)(z)}}function Y(Z){return G(L,D),W}function ne(Z){return D.restore(),++te<Q.length?P(Q[te]):V}}}function T(G,K){G.resolveAll&&!f.includes(G)&&f.push(G),G.resolve&&Tn(h.events,K,h.events.length-K,G.resolve(h.events.slice(K),h)),G.resolveTo&&(h.events=G.resolveTo(h.events,h))}function I(){const G=E(),K=h.previous,q=h.currentConstruct,O=h.events.length,W=Array.from(o);return{from:O,restore:V};function V(){s=G,h.previous=K,h.currentConstruct=q,h.events.length=O,o=W,H()}}function H(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function VC(e,i){const r=i.start._index,s=i.start._bufferIndex,l=i.end._index,f=i.end._bufferIndex;let m;if(r===l)m=[e[r].slice(s,f)];else{if(m=e.slice(r,l),s>-1){const o=m[0];typeof o=="string"?m[0]=o.slice(s):m.shift()}f>0&&m.push(e[l].slice(0,f))}return m}function YC(e,i){let r=-1;const s=[];let l;for(;++r<e.length;){const f=e[r];let m;if(typeof f=="string")m=f;else switch(f){case-5:{m="\r";break}case-4:{m=`
91
+ `;break}case-3:{m=`\r
92
+ `;break}case-2:{m=i?" ":" ";break}case-1:{if(!i&&l)continue;m=" ";break}default:m=String.fromCharCode(f)}l=f===-2,s.push(m)}return s.join("")}function KC(e){const s={constructs:y0([WC,...(e||{}).extensions||[]]),content:l(u2),defined:[],document:l(h2),flow:l(AC),lazy:{},string:l(LC),text:l(MC)};return s;function l(f){return m;function m(o){return GC(s,f,o)}}}function XC(e){for(;!k0(e););return e}const Xx=/[\0\t\n\r]/g;function ZC(){let e=1,i="",r=!0,s;return l;function l(f,m,o){const d=[];let h,g,p,v,S;for(f=i+(typeof f=="string"?f.toString():new TextDecoder(m||void 0).decode(f)),p=0,i="",r&&(f.charCodeAt(0)===65279&&p++,r=void 0);p<f.length;){if(Xx.lastIndex=p,h=Xx.exec(f),v=h&&h.index!==void 0?h.index:f.length,S=f.charCodeAt(v),!h){i=f.slice(p);break}if(S===10&&p===v&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),p<v&&(d.push(f.slice(p,v)),e+=v-p),S){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}p=v+1}return o&&(s&&d.push(-5),i&&d.push(i),d.push(null)),d}}const QC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JC(e){return e.replace(QC,ek)}function ek(e,i,r){if(i)return i;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),f=l===120||l===88;return _0(r.slice(f?2:1),f?16:10)}return Ha(r)||e}const D0={}.hasOwnProperty;function tk(e,i,r){return i&&typeof i=="object"&&(r=i,i=void 0),nk(r)(XC(KC(r).document().write(ZC()(e,i,!0))))}function nk(e){const i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:f(lt),autolinkProtocol:I,autolinkEmail:I,atxHeading:f(Le),blockQuote:f(se),characterEscape:I,characterReference:I,codeFenced:f(ge),codeFencedFenceInfo:m,codeFencedFenceMeta:m,codeIndented:f(ge,m),codeText:f(be,m),codeTextData:I,data:I,codeFlowValue:I,definition:f(je),definitionDestinationString:m,definitionLabelString:m,definitionTitleString:m,emphasis:f(Te),hardBreakEscape:f(Pe),hardBreakTrailing:f(Pe),htmlFlow:f(we,m),htmlFlowData:I,htmlText:f(we,m),htmlTextData:I,image:f(st),label:m,link:f(lt),listItem:f(De),listItemValue:v,listOrdered:f(he,p),listUnordered:f(he),paragraph:f(Ze),reference:P,referenceString:m,resourceDestinationString:m,resourceTitleString:m,setextHeading:f(Le),strong:f(Qe),thematicBreak:f(at)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:z,blockQuote:d(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:Z,characterReference:X,codeFenced:d(b),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:E,codeFlowValue:H,codeIndented:d(x),codeText:d(W),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:_,definitionTitleString:y,emphasis:d(),hardBreakEscape:d(K),hardBreakTrailing:d(K),htmlFlow:d(q),htmlFlowData:H,htmlText:d(O),htmlTextData:H,image:d(Q),label:L,labelText:te,lineEnding:G,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:Y,resourceDestinationString:D,resourceTitleString:B,resource:U,setextHeading:d(T),setextHeadingLineSequence:R,setextHeadingText:N,strong:d(),thematicBreak:d()}};R0(i,(e||{}).mdastExtensions||[]);const r={};return s;function s(de){let ee={type:"root",children:[]};const ve={stack:[ee],tokenStack:[],config:i,enter:o,exit:h,buffer:m,resume:g,data:r},Se=[];let Ce=-1;for(;++Ce<de.length;)if(de[Ce][1].type==="listOrdered"||de[Ce][1].type==="listUnordered")if(de[Ce][0]==="enter")Se.push(Ce);else{const ze=Se.pop();Ce=l(de,ze,Ce)}for(Ce=-1;++Ce<de.length;){const ze=i[de[Ce][0]];D0.call(ze,de[Ce][1].type)&&ze[de[Ce][1].type].call(Object.assign({sliceSerialize:de[Ce][2].sliceSerialize},ve),de[Ce][1])}if(ve.tokenStack.length>0){const ze=ve.tokenStack[ve.tokenStack.length-1];(ze[1]||Zx).call(ve,void 0,ze[0])}for(ee.position={start:Kr(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Kr(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<i.transforms.length;)ee=i.transforms[Ce](ee)||ee;return ee}function l(de,ee,ve){let Se=ee-1,Ce=-1,ze=!1,Be,ct,ut,yt;for(;++Se<=ve;){const nt=de[Se];switch(nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{nt[0]==="enter"?Ce++:Ce--,yt=void 0;break}case"lineEndingBlank":{nt[0]==="enter"&&(Be&&!yt&&!Ce&&!ut&&(ut=Se),yt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yt=void 0}if(!Ce&&nt[0]==="enter"&&nt[1].type==="listItemPrefix"||Ce===-1&&nt[0]==="exit"&&(nt[1].type==="listUnordered"||nt[1].type==="listOrdered")){if(Be){let An=Se;for(ct=void 0;An--;){const pe=de[An];if(pe[1].type==="lineEnding"||pe[1].type==="lineEndingBlank"){if(pe[0]==="exit")continue;ct&&(de[ct][1].type="lineEndingBlank",ze=!0),pe[1].type="lineEnding",ct=An}else if(!(pe[1].type==="linePrefix"||pe[1].type==="blockQuotePrefix"||pe[1].type==="blockQuotePrefixWhitespace"||pe[1].type==="blockQuoteMarker"||pe[1].type==="listItemIndent"))break}ut&&(!ct||ut<ct)&&(Be._spread=!0),Be.end=Object.assign({},ct?de[ct][1].start:nt[1].end),de.splice(ct||Se,0,["exit",Be,nt[2]]),Se++,ve++}if(nt[1].type==="listItemPrefix"){const An={type:"listItem",_spread:!1,start:Object.assign({},nt[1].start),end:void 0};Be=An,de.splice(Se,0,["enter",An,nt[2]]),Se++,ve++,ut=void 0,yt=!0}}}return de[ee][1]._spread=ze,ve}function f(de,ee){return ve;function ve(Se){o.call(this,de(Se),Se),ee&&ee.call(this,Se)}}function m(){this.stack.push({type:"fragment",children:[]})}function o(de,ee,ve){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([ee,ve||void 0]),de.position={start:Kr(ee.start),end:void 0}}function d(de){return ee;function ee(ve){de&&de.call(this,ve),h.call(this,ve)}}function h(de,ee){const ve=this.stack.pop(),Se=this.tokenStack.pop();if(Se)Se[0].type!==de.type&&(ee?ee.call(this,de,Se[0]):(Se[1]||Zx).call(this,de,Se[0]));else throw new Error("Cannot close `"+de.type+"` ("+La({start:de.start,end:de.end})+"): it’s not open");ve.position.end=Kr(de.end)}function g(){return mh(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(de){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function S(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=de}function E(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=de}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.value=de.replace(/(\r?\n|\r)$/g,"")}function _(de){const ee=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ee,ve.identifier=Vn(this.sliceSerialize(de)).toLowerCase()}function y(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.title=de}function j(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.url=de}function A(de){const ee=this.stack[this.stack.length-1];if(!ee.depth){const ve=this.sliceSerialize(de).length;ee.depth=ve}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function R(de){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function I(de){const ve=this.stack[this.stack.length-1].children;let Se=ve[ve.length-1];(!Se||Se.type!=="text")&&(Se=qe(),Se.position={start:Kr(de.start),end:void 0},ve.push(Se)),this.stack.push(Se)}function H(de){const ee=this.stack.pop();ee.value+=this.sliceSerialize(de),ee.position.end=Kr(de.end)}function G(de){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ve=ee.children[ee.children.length-1];ve.position.end=Kr(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(ee.type)&&(I.call(this,de),H.call(this,de))}function K(){this.data.atHardBreak=!0}function q(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.value=de}function O(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.value=de}function W(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.value=de}function V(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ee,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Q(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ee,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function te(de){const ee=this.sliceSerialize(de),ve=this.stack[this.stack.length-2];ve.label=JC(ee),ve.identifier=Vn(ee).toLowerCase()}function L(){const de=this.stack[this.stack.length-1],ee=this.resume(),ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,ve.type==="link"){const Se=de.children;ve.children=Se}else ve.alt=ee}function D(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.url=de}function B(){const de=this.resume(),ee=this.stack[this.stack.length-1];ee.title=de}function U(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function Y(de){const ee=this.resume(),ve=this.stack[this.stack.length-1];ve.label=ee,ve.identifier=Vn(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function ne(de){this.data.characterReferenceType=de.type}function Z(de){const ee=this.sliceSerialize(de),ve=this.data.characterReferenceType;let Se;ve?(Se=_0(ee,ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Se=Ha(ee);const Ce=this.stack[this.stack.length-1];Ce.value+=Se}function X(de){const ee=this.stack.pop();ee.position.end=Kr(de.end)}function z(de){H.call(this,de);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(de)}function ae(de){H.call(this,de);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(de)}function se(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Te(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function Pe(){return{type:"break"}}function we(){return{type:"html",value:""}}function st(){return{type:"image",title:null,url:"",alt:null}}function lt(){return{type:"link",title:null,url:"",children:[]}}function he(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function De(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Ze(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function at(){return{type:"thematicBreak"}}}function Kr(e){return{line:e.line,column:e.column,offset:e.offset}}function R0(e,i){let r=-1;for(;++r<i.length;){const s=i[r];Array.isArray(s)?R0(e,s):rk(e,s)}}function rk(e,i){let r;for(r in i)if(D0.call(i,r))switch(r){case"canContainEols":{const s=i[r];s&&e[r].push(...s);break}case"transforms":{const s=i[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=i[r];s&&Object.assign(e[r],s);break}}}function Zx(e,i){throw e?new Error("Cannot close `"+e.type+"` ("+La({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+La({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+La({start:i.start,end:i.end})+") is still open")}function ik(e){const i=this;i.parser=r;function r(s){return tk(s,{...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function sk(e,i){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,r),e.applyData(i,r)}function ak(e,i){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,r),[e.applyData(i,r),{type:"text",value:`
93
+ `}]}function ok(e,i){const r=i.value?i.value+`
94
+ `:"",s={},l=i.lang?i.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let f={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return i.meta&&(f.data={meta:i.meta}),e.patch(i,f),f=e.applyData(i,f),f={type:"element",tagName:"pre",properties:{},children:[f]},e.patch(i,f),f}function lk(e,i){const r={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function ck(e,i){const r={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function uk(e,i){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(i.identifier).toUpperCase(),l=Ts(s.toLowerCase()),f=e.footnoteOrder.indexOf(s);let m,o=e.footnoteCounts.get(s);o===void 0?(o=0,e.footnoteOrder.push(s),m=e.footnoteOrder.length):m=f+1,o+=1,e.footnoteCounts.set(s,o);const d={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(m)}]};e.patch(i,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(i,h),e.applyData(i,h)}function dk(e,i){const r={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function hk(e,i){if(e.options.allowDangerousHtml){const r={type:"raw",value:i.value};return e.patch(i,r),e.applyData(i,r)}}function L0(e,i){const r=i.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+s}];const l=e.all(i),f=l[0];f&&f.type==="text"?f.value="["+f.value:l.unshift({type:"text",value:"["});const m=l[l.length-1];return m&&m.type==="text"?m.value+=s:l.push({type:"text",value:s}),l}function fk(e,i){const r=String(i.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return L0(e,i);const l={src:Ts(s.url||""),alt:i.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const f={type:"element",tagName:"img",properties:l,children:[]};return e.patch(i,f),e.applyData(i,f)}function pk(e,i){const r={src:Ts(i.url)};i.alt!==null&&i.alt!==void 0&&(r.alt=i.alt),i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(i,s),e.applyData(i,s)}function mk(e,i){const r={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(i,s),e.applyData(i,s)}function gk(e,i){const r=String(i.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return L0(e,i);const l={href:Ts(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const f={type:"element",tagName:"a",properties:l,children:e.all(i)};return e.patch(i,f),e.applyData(i,f)}function xk(e,i){const r={href:Ts(i.url)};i.title!==null&&i.title!==void 0&&(r.title=i.title);const s={type:"element",tagName:"a",properties:r,children:e.all(i)};return e.patch(i,s),e.applyData(i,s)}function vk(e,i,r){const s=e.all(i),l=r?bk(r):M0(i),f={},m=[];if(typeof i.checked=="boolean"){const g=s[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},s.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),f.className=["task-list-item"]}let o=-1;for(;++o<s.length;){const g=s[o];(l||o!==0||g.type!=="element"||g.tagName!=="p")&&m.push({type:"text",value:`
95
+ `}),g.type==="element"&&g.tagName==="p"&&!l?m.push(...g.children):m.push(g)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&m.push({type:"text",value:`
96
+ `});const h={type:"element",tagName:"li",properties:f,children:m};return e.patch(i,h),e.applyData(i,h)}function bk(e){let i=!1;if(e.type==="list"){i=e.spread||!1;const r=e.children;let s=-1;for(;!i&&++s<r.length;)i=M0(r[s])}return i}function M0(e){const i=e.spread;return i??e.children.length>1}function yk(e,i){const r={},s=e.all(i);let l=-1;for(typeof i.start=="number"&&i.start!==1&&(r.start=i.start);++l<s.length;){const m=s[l];if(m.type==="element"&&m.tagName==="li"&&m.properties&&Array.isArray(m.properties.className)&&m.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const f={type:"element",tagName:i.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(i,f),e.applyData(i,f)}function _k(e,i){const r={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function Sk(e,i){const r={type:"root",children:e.wrap(e.all(i))};return e.patch(i,r),e.applyData(i,r)}function wk(e,i){const r={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function Ck(e,i){const r=e.all(i),s=r.shift(),l=[];if(s){const m={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(i.children[0],m),l.push(m)}if(r.length>0){const m={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},o=dh(i.children[1]),d=f0(i.children[i.children.length-1]);o&&d&&(m.position={start:o,end:d}),l.push(m)}const f={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(i,f),e.applyData(i,f)}function kk(e,i,r){const s=r?r.children:void 0,f=(s?s.indexOf(i):1)===0?"th":"td",m=r&&r.type==="table"?r.align:void 0,o=m?m.length:i.children.length;let d=-1;const h=[];for(;++d<o;){const p=i.children[d],v={},S=m?m[d]:void 0;S&&(v.align=S);let E={type:"element",tagName:f,properties:v,children:[]};p&&(E.children=e.all(p),e.patch(p,E),E=e.applyData(p,E)),h.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(i,g),e.applyData(i,g)}function Ek(e,i){const r={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}const Qx=9,Jx=32;function jk(e){const i=String(e),r=/\r?\n|\r/g;let s=r.exec(i),l=0;const f=[];for(;s;)f.push(ev(i.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=r.exec(i);return f.push(ev(i.slice(l),l>0,!1)),f.join("")}function ev(e,i,r){let s=0,l=e.length;if(i){let f=e.codePointAt(s);for(;f===Qx||f===Jx;)s++,f=e.codePointAt(s)}if(r){let f=e.codePointAt(l-1);for(;f===Qx||f===Jx;)l--,f=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function Nk(e,i){const r={type:"text",value:jk(String(i.value))};return e.patch(i,r),e.applyData(i,r)}function Tk(e,i){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,r),e.applyData(i,r)}const Ak={blockquote:sk,break:ak,code:ok,delete:lk,emphasis:ck,footnoteReference:uk,heading:dk,html:hk,imageReference:fk,image:pk,inlineCode:mk,linkReference:gk,link:xk,listItem:vk,list:yk,paragraph:_k,root:Sk,strong:wk,table:Ck,tableCell:Ek,tableRow:kk,text:Nk,thematicBreak:Tk,toml:ul,yaml:ul,definition:ul,footnoteDefinition:ul};function ul(){}const O0=-1,Ol=0,Oa=1,kl=2,xh=3,vh=4,bh=5,yh=6,B0=7,I0=8,tv=typeof self=="object"?self:globalThis,Dk=(e,i)=>{const r=(l,f)=>(e.set(f,l),l),s=l=>{if(e.has(l))return e.get(l);const[f,m]=i[l];switch(f){case Ol:case O0:return r(m,l);case Oa:{const o=r([],l);for(const d of m)o.push(s(d));return o}case kl:{const o=r({},l);for(const[d,h]of m)o[s(d)]=s(h);return o}case xh:return r(new Date(m),l);case vh:{const{source:o,flags:d}=m;return r(new RegExp(o,d),l)}case bh:{const o=r(new Map,l);for(const[d,h]of m)o.set(s(d),s(h));return o}case yh:{const o=r(new Set,l);for(const d of m)o.add(s(d));return o}case B0:{const{name:o,message:d}=m;return r(new tv[o](d),l)}case I0:return r(BigInt(m),l);case"BigInt":return r(Object(BigInt(m)),l);case"ArrayBuffer":return r(new Uint8Array(m).buffer,m);case"DataView":{const{buffer:o}=new Uint8Array(m);return r(new DataView(o),m)}}return r(new tv[f](m),l)};return s},nv=e=>Dk(new Map,e)(0),xs="",{toString:Rk}={},{keys:Lk}=Object,Aa=e=>{const i=typeof e;if(i!=="object"||!e)return[Ol,i];const r=Rk.call(e).slice(8,-1);switch(r){case"Array":return[Oa,xs];case"Object":return[kl,xs];case"Date":return[xh,xs];case"RegExp":return[vh,xs];case"Map":return[bh,xs];case"Set":return[yh,xs];case"DataView":return[Oa,r]}return r.includes("Array")?[Oa,r]:r.includes("Error")?[B0,r]:[kl,r]},dl=([e,i])=>e===Ol&&(i==="function"||i==="symbol"),Mk=(e,i,r,s)=>{const l=(m,o)=>{const d=s.push(m)-1;return r.set(o,d),d},f=m=>{if(r.has(m))return r.get(m);let[o,d]=Aa(m);switch(o){case Ol:{let g=m;switch(d){case"bigint":o=I0,g=m.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([O0],m)}return l([o,g],m)}case Oa:{if(d){let v=m;return d==="DataView"?v=new Uint8Array(m.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(m)),l([d,[...v]],m)}const g=[],p=l([o,g],m);for(const v of m)g.push(f(v));return p}case kl:{if(d)switch(d){case"BigInt":return l([d,m.toString()],m);case"Boolean":case"Number":case"String":return l([d,m.valueOf()],m)}if(i&&"toJSON"in m)return f(m.toJSON());const g=[],p=l([o,g],m);for(const v of Lk(m))(e||!dl(Aa(m[v])))&&g.push([f(v),f(m[v])]);return p}case xh:return l([o,m.toISOString()],m);case vh:{const{source:g,flags:p}=m;return l([o,{source:g,flags:p}],m)}case bh:{const g=[],p=l([o,g],m);for(const[v,S]of m)(e||!(dl(Aa(v))||dl(Aa(S))))&&g.push([f(v),f(S)]);return p}case yh:{const g=[],p=l([o,g],m);for(const v of m)(e||!dl(Aa(v)))&&g.push(f(v));return p}}const{message:h}=m;return l([o,{name:d,message:h}],m)};return f},rv=(e,{json:i,lossy:r}={})=>{const s=[];return Mk(!(i||r),!!i,new Map,s)(e),s},El=typeof structuredClone=="function"?(e,i)=>i&&("json"in i||"lossy"in i)?nv(rv(e,i)):structuredClone(e):(e,i)=>nv(rv(e,i));function Ok(e,i){const r=[{type:"text",value:"↩"}];return i>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),r}function Bk(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}function Ik(e){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Ok,s=e.options.footnoteBackLabel||Bk,l=e.options.footnoteLabel||"Footnotes",f=e.options.footnoteLabelTagName||"h2",m=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let d=-1;for(;++d<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[d]);if(!h)continue;const g=e.all(h),p=String(h.identifier).toUpperCase(),v=Ts(p.toLowerCase());let S=0;const E=[],C=e.footnoteCounts.get(p);for(;C!==void 0&&++S<=C;){E.length>0&&E.push({type:"text",value:" "});let _=typeof r=="string"?r:r(d,S);typeof _=="string"&&(_={type:"text",value:_}),E.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+v+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,S),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const _=b.children[b.children.length-1];_&&_.type==="text"?_.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...E)}else g.push(...E);const x={type:"element",tagName:"li",properties:{id:i+"fn-"+v},children:e.wrap(g,!0)};e.patch(h,x),o.push(x)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:f,properties:{...El(m),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
97
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
98
+ `}]}}const Bl=(function(e){if(e==null)return Fk;if(typeof e=="function")return Il(e);if(typeof e=="object")return Array.isArray(e)?zk(e):Hk(e);if(typeof e=="string")return Pk(e);throw new Error("Expected function, string, or object as test")});function zk(e){const i=[];let r=-1;for(;++r<e.length;)i[r]=Bl(e[r]);return Il(s);function s(...l){let f=-1;for(;++f<i.length;)if(i[f].apply(this,l))return!0;return!1}}function Hk(e){const i=e;return Il(r);function r(s){const l=s;let f;for(f in e)if(l[f]!==i[f])return!1;return!0}}function Pk(e){return Il(i);function i(r){return r&&r.type===e}}function Il(e){return i;function i(r,s,l){return!!(Uk(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function Fk(){return!0}function Uk(e){return e!==null&&typeof e=="object"&&"type"in e}const z0=[],$k=!0,Wd=!1,qk="skip";function H0(e,i,r,s){let l;typeof i=="function"&&typeof r!="function"?(s=r,r=i):l=i;const f=Bl(l),m=s?-1:1;o(e,void 0,[])();function o(d,h,g){const p=d&&typeof d=="object"?d:{};if(typeof p.type=="string"){const S=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(S?"<"+S+">":""))+")"})}return v;function v(){let S=z0,E,C,b;if((!i||f(d,h,g[g.length-1]||void 0))&&(S=Wk(r(d,g)),S[0]===Wd))return S;if("children"in d&&d.children){const x=d;if(x.children&&S[0]!==qk)for(C=(s?x.children.length:-1)+m,b=g.concat(x);C>-1&&C<x.children.length;){const _=x.children[C];if(E=o(_,C,b)(),E[0]===Wd)return E;C=typeof E[1]=="number"?E[1]:C+m}}return S}}}function Wk(e){return Array.isArray(e)?e:typeof e=="number"?[$k,e]:e==null?z0:[e]}function _h(e,i,r,s){let l,f,m;typeof i=="function"&&typeof r!="function"?(f=void 0,m=i,l=r):(f=i,m=r,l=s),H0(e,f,o,l);function o(d,h){const g=h[h.length-1],p=g?g.children.indexOf(d):void 0;return m(d,p,g)}}const Gd={}.hasOwnProperty,Gk={};function Vk(e,i){const r=i||Gk,s=new Map,l=new Map,f=new Map,m={...Ak,...r.handlers},o={all:h,applyData:Kk,definitionById:s,footnoteById:l,footnoteCounts:f,footnoteOrder:[],handlers:m,one:d,options:r,patch:Yk,wrap:Zk};return _h(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?s:l,v=String(g.identifier).toUpperCase();p.has(v)||p.set(v,g)}}),o;function d(g,p){const v=g.type,S=o.handlers[v];if(Gd.call(o.handlers,v)&&S)return S(o,g,p);if(o.options.passThrough&&o.options.passThrough.includes(v)){if("children"in g){const{children:C,...b}=g,x=El(b);return x.children=o.all(g),x}return El(g)}return(o.options.unknownHandler||Xk)(o,g,p)}function h(g){const p=[];if("children"in g){const v=g.children;let S=-1;for(;++S<v.length;){const E=o.one(v[S],g);if(E){if(S&&v[S-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=iv(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=iv(C.value))}Array.isArray(E)?p.push(...E):p.push(E)}}}return p}}function Yk(e,i){e.position&&(i.position=Bw(e))}function Kk(e,i){let r=i;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,f=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const m="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:m}}r.type==="element"&&f&&Object.assign(r.properties,El(f)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function Xk(e,i){const r=i.data||{},s="value"in i&&!(Gd.call(r,"hProperties")||Gd.call(r,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,s),e.applyData(i,s)}function Zk(e,i){const r=[];let s=-1;for(i&&r.push({type:"text",value:`
99
+ `});++s<e.length;)s&&r.push({type:"text",value:`
100
+ `}),r.push(e[s]);return i&&e.length>0&&r.push({type:"text",value:`
101
+ `}),r}function iv(e){let i=0,r=e.charCodeAt(i);for(;r===9||r===32;)i++,r=e.charCodeAt(i);return e.slice(i)}function sv(e,i){const r=Vk(e,i),s=r.one(e,void 0),l=Ik(r),f=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&f.children.push({type:"text",value:`
102
+ `},l),f}function Qk(e,i){return e&&"run"in e?async function(r,s){const l=sv(r,{file:s,...i});await e.run(l,s)}:function(r,s){return sv(r,{file:s,...e||i})}}function av(e){if(e)throw e}var yd,ov;function Jk(){if(ov)return yd;ov=1;var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(h){return typeof Array.isArray=="function"?Array.isArray(h):i.call(h)==="[object Array]"},f=function(h){if(!h||i.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!p)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},m=function(h,g){r&&g.name==="__proto__"?r(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},o=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(s)return s(h,g).value}else return;return h[g]};return yd=function d(){var h,g,p,v,S,E,C=arguments[0],b=1,x=arguments.length,_=!1;for(typeof C=="boolean"&&(_=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});b<x;++b)if(h=arguments[b],h!=null)for(g in h)p=o(C,g),v=o(h,g),C!==v&&(_&&v&&(f(v)||(S=l(v)))?(S?(S=!1,E=p&&l(p)?p:[]):E=p&&f(p)?p:{},m(C,{name:g,newValue:d(_,E,v)})):typeof v<"u"&&m(C,{name:g,newValue:v}));return C},yd}var eE=Jk();const _d=Tl(eE);function Vd(e){if(typeof e!="object"||e===null)return!1;const i=Object.getPrototypeOf(e);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function tE(){const e=[],i={run:r,use:s};return i;function r(...l){let f=-1;const m=l.pop();if(typeof m!="function")throw new TypeError("Expected function as last argument, not "+m);o(null,...l);function o(d,...h){const g=e[++f];let p=-1;if(d){m(d);return}for(;++p<l.length;)(h[p]===null||h[p]===void 0)&&(h[p]=l[p]);l=h,g?nE(g,o)(...h):m(null,...h)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),i}}function nE(e,i){let r;return s;function s(...m){const o=e.length>m.length;let d;o&&m.push(l);try{d=e.apply(this,m)}catch(h){const g=h;if(o&&r)throw g;return l(g)}o||(d&&d.then&&typeof d.then=="function"?d.then(f,l):d instanceof Error?l(d):f(d))}function l(m,...o){r||(r=!0,i(m,...o))}function f(m){l(null,m)}}const Jn={basename:rE,dirname:iE,extname:sE,join:aE,sep:"/"};function rE(e,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');Va(e);let r=0,s=-1,l=e.length,f;if(i===void 0||i.length===0||i.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(f){r=l+1;break}}else s<0&&(f=!0,s=l+1);return s<0?"":e.slice(r,s)}if(i===e)return"";let m=-1,o=i.length-1;for(;l--;)if(e.codePointAt(l)===47){if(f){r=l+1;break}}else m<0&&(f=!0,m=l+1),o>-1&&(e.codePointAt(l)===i.codePointAt(o--)?o<0&&(s=l):(o=-1,s=m));return r===s?s=m:s<0&&(s=e.length),e.slice(r,s)}function iE(e){if(Va(e),e.length===0)return".";let i=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){i=r;break}}else s||(s=!0);return i<0?e.codePointAt(0)===47?"/":".":i===1&&e.codePointAt(0)===47?"//":e.slice(0,i)}function sE(e){Va(e);let i=e.length,r=-1,s=0,l=-1,f=0,m;for(;i--;){const o=e.codePointAt(i);if(o===47){if(m){s=i+1;break}continue}r<0&&(m=!0,r=i+1),o===46?l<0?l=i:f!==1&&(f=1):l>-1&&(f=-1)}return l<0||r<0||f===0||f===1&&l===r-1&&l===s+1?"":e.slice(l,r)}function aE(...e){let i=-1,r;for(;++i<e.length;)Va(e[i]),e[i]&&(r=r===void 0?e[i]:r+"/"+e[i]);return r===void 0?".":oE(r)}function oE(e){Va(e);const i=e.codePointAt(0)===47;let r=lE(e,!i);return r.length===0&&!i&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),i?"/"+r:r}function lE(e,i){let r="",s=0,l=-1,f=0,m=-1,o,d;for(;++m<=e.length;){if(m<e.length)o=e.codePointAt(m);else{if(o===47)break;o=47}if(o===47){if(!(l===m-1||f===1))if(l!==m-1&&f===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(d=r.lastIndexOf("/"),d!==r.length-1){d<0?(r="",s=0):(r=r.slice(0,d),s=r.length-1-r.lastIndexOf("/")),l=m,f=0;continue}}else if(r.length>0){r="",s=0,l=m,f=0;continue}}i&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(l+1,m):r=e.slice(l+1,m),s=m-l-1;l=m,f=0}else o===46&&f>-1?f++:f=-1}return r}function Va(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const cE={cwd:uE};function uE(){return"/"}function Yd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function dE(e){if(typeof e=="string")e=new URL(e);else if(!Yd(e)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(e.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return hE(e)}function hE(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 i=e.pathname;let r=-1;for(;++r<i.length;)if(i.codePointAt(r)===37&&i.codePointAt(r+1)===50){const s=i.codePointAt(r+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(i)}const Sd=["history","path","basename","stem","extname","dirname"];class P0{constructor(i){let r;i?Yd(i)?r={path:i}:typeof i=="string"||fE(i)?r={value:i}:r=i:r={},this.cwd="cwd"in r?"":cE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Sd.length;){const f=Sd[s];f in r&&r[f]!==void 0&&r[f]!==null&&(this[f]=f==="history"?[...r[f]]:r[f])}let l;for(l in r)Sd.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Jn.basename(this.path):void 0}set basename(i){Cd(i,"basename"),wd(i,"basename"),this.path=Jn.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?Jn.dirname(this.path):void 0}set dirname(i){lv(this.basename,"dirname"),this.path=Jn.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?Jn.extname(this.path):void 0}set extname(i){if(wd(i,"extname"),lv(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Jn.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){Yd(i)&&(i=dE(i)),Cd(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?Jn.basename(this.path,this.extname):void 0}set stem(i){Cd(i,"stem"),wd(i,"stem"),this.path=Jn.join(this.dirname||"",i+(this.extname||""))}fail(i,r,s){const l=this.message(i,r,s);throw l.fatal=!0,l}info(i,r,s){const l=this.message(i,r,s);return l.fatal=void 0,l}message(i,r,s){const l=new rn(i,r,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function wd(e,i){if(e&&e.includes(Jn.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+Jn.sep+"`")}function Cd(e,i){if(!e)throw new Error("`"+i+"` cannot be empty")}function lv(e,i){if(!e)throw new Error("Setting `"+i+"` requires `path` to be set too")}function fE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pE=(function(e){const s=this.constructor.prototype,l=s[e],f=function(){return l.apply(f,arguments)};return Object.setPrototypeOf(f,s),f}),mE={}.hasOwnProperty;class Sh extends pE{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=tE()}copy(){const i=new Sh;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];i.use(...s)}return i.data(_d(!0,{},this.namespace)),i}data(i,r){return typeof i=="string"?arguments.length===2?(jd("data",this.frozen),this.namespace[i]=r,this):mE.call(this.namespace,i)&&this.namespace[i]||void 0:i?(jd("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const l=r.call(i,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const r=hl(i),s=this.parser||this.Parser;return kd("parse",s),s(String(r),r)}process(i,r){const s=this;return this.freeze(),kd("process",this.parser||this.Parser),Ed("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(f,m){const o=hl(i),d=s.parse(o);s.run(d,o,function(g,p,v){if(g||!p||!v)return h(g);const S=p,E=s.stringify(S,v);vE(E)?v.value=E:v.result=E,h(g,v)});function h(g,p){g||!p?m(g):f?f(p):r(void 0,p)}}}processSync(i){let r=!1,s;return this.freeze(),kd("processSync",this.parser||this.Parser),Ed("processSync",this.compiler||this.Compiler),this.process(i,l),uv("processSync","process",r),s;function l(f,m){r=!0,av(f),s=m}}run(i,r,s){cv(i),this.freeze();const l=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?f(void 0,s):new Promise(f);function f(m,o){const d=hl(r);l.run(i,d,h);function h(g,p,v){const S=p||i;g?o(g):m?m(S):s(void 0,S,v)}}}runSync(i,r){let s=!1,l;return this.run(i,r,f),uv("runSync","run",s),l;function f(m,o){av(m),l=o,s=!0}}stringify(i,r){this.freeze();const s=hl(r),l=this.compiler||this.Compiler;return Ed("stringify",l),cv(i),l(i,s)}use(i,...r){const s=this.attachers,l=this.namespace;if(jd("use",this.frozen),i!=null)if(typeof i=="function")d(i,r);else if(typeof i=="object")Array.isArray(i)?o(i):m(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function f(h){if(typeof h=="function")d(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...p]=h;d(g,p)}else m(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function m(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(h.plugins),h.settings&&(l.settings=_d(!0,l.settings,h.settings))}function o(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const p=h[g];f(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function d(h,g){let p=-1,v=-1;for(;++p<s.length;)if(s[p][0]===h){v=p;break}if(v===-1)s.push([h,...g]);else if(g.length>0){let[S,...E]=g;const C=s[v][1];Vd(C)&&Vd(S)&&(S=_d(!0,C,S)),s[v]=[h,S,...E]}}}}const gE=new Sh().freeze();function kd(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ed(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jd(e,i){if(i)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cv(e){if(!Vd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function uv(e,i,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+i+"` instead")}function hl(e){return xE(e)?e:new P0(e)}function xE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function vE(e){return typeof e=="string"||bE(e)}function bE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dv=[],hv={allowDangerousHtml:!0},_E=/^(https?|ircs?|mailto|xmpp)$/i,SE=[{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 wE(e){const i=CE(e),r=kE(e);return EE(i.runSync(i.parse(r),r),e)}function CE(e){const i=e.rehypePlugins||dv,r=e.remarkPlugins||dv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...hv}:hv;return gE().use(ik).use(r).use(Qk,s).use(i)}function kE(e){const i=e.children||"",r=new P0;return typeof i=="string"&&(r.value=i),r}function EE(e,i){const r=i.allowedElements,s=i.allowElement,l=i.components,f=i.disallowedElements,m=i.skipHtml,o=i.unwrapDisallowed,d=i.urlTransform||jE;for(const g of SE)Object.hasOwn(i,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+yE+g.id,void 0);return _h(e,h),Fw(e,{Fragment:c.Fragment,components:l,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function h(g,p,v){if(g.type==="raw"&&v&&typeof p=="number")return m?v.children.splice(p,1):v.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let S;for(S in xd)if(Object.hasOwn(xd,S)&&Object.hasOwn(g.properties,S)){const E=g.properties[S],C=xd[S];(C===null||C.includes(g.tagName))&&(g.properties[S]=d(String(E||""),S,g))}}if(g.type==="element"){let S=r?!r.includes(g.tagName):f?f.includes(g.tagName):!1;if(!S&&s&&typeof p=="number"&&(S=!s(g,p,v)),S&&v&&typeof p=="number")return o&&g.children?v.children.splice(p,1,...g.children):v.children.splice(p,1),p}}}function jE(e){const i=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return i===-1||l!==-1&&i>l||r!==-1&&i>r||s!==-1&&i>s||_E.test(e.slice(0,i))?e:""}function fv(e,i){const r=String(e);if(typeof i!="string")throw new TypeError("Expected character");let s=0,l=r.indexOf(i);for(;l!==-1;)s++,l=r.indexOf(i,l+i.length);return s}function NE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function TE(e,i,r){const l=Bl((r||{}).ignore||[]),f=AE(i);let m=-1;for(;++m<f.length;)H0(e,"text",o);function o(h,g){let p=-1,v;for(;++p<g.length;){const S=g[p],E=v?v.children:void 0;if(l(S,E?E.indexOf(S):void 0,v))return;v=S}if(v)return d(h,g)}function d(h,g){const p=g[g.length-1],v=f[m][0],S=f[m][1];let E=0;const b=p.children.indexOf(h);let x=!1,_=[];v.lastIndex=0;let y=v.exec(h.value);for(;y;){const j=y.index,A={index:y.index,input:y.input,stack:[...g,h]};let N=S(...y,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?v.lastIndex=j+1:(E!==j&&_.push({type:"text",value:h.value.slice(E,j)}),Array.isArray(N)?_.push(...N):N&&_.push(N),E=j+y[0].length,x=!0),!v.global)break;y=v.exec(h.value)}return x?(E<h.value.length&&_.push({type:"text",value:h.value.slice(E)}),p.children.splice(b,1,..._)):_=[h],b+_.length}}function AE(e){const i=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const l=r[s];i.push([DE(l[0]),RE(l[1])])}return i}function DE(e){return typeof e=="string"?new RegExp(NE(e),"g"):e}function RE(e){return typeof e=="function"?e:function(){return e}}const Nd="phrasing",Td=["autolink","link","image","label"];function LE(){return{transforms:[PE],enter:{literalAutolink:OE,literalAutolinkEmail:Ad,literalAutolinkHttp:Ad,literalAutolinkWww:Ad},exit:{literalAutolink:HE,literalAutolinkEmail:zE,literalAutolinkHttp:BE,literalAutolinkWww:IE}}}function ME(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Nd,notInConstruct:Td},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Nd,notInConstruct:Td},{character:":",before:"[ps]",after:"\\/",inConstruct:Nd,notInConstruct:Td}]}}function OE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ad(e){this.config.enter.autolinkProtocol.call(this,e)}function BE(e){this.config.exit.autolinkProtocol.call(this,e)}function IE(e){this.config.exit.data.call(this,e);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(e)}function zE(e){this.config.exit.autolinkEmail.call(this,e)}function HE(e){this.exit(e)}function PE(e){TE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),UE]],{ignore:["link","linkReference"]})}function FE(e,i,r,s,l){let f="";if(!F0(l)||(/^w/i.test(i)&&(r=i+r,i="",f="http://"),!$E(r)))return!1;const m=qE(r+s);if(!m[0])return!1;const o={type:"link",title:null,url:f+i+m[0],children:[{type:"text",value:i+m[0]}]};return m[1]?[o,{type:"text",value:m[1]}]:o}function UE(e,i,r,s){return!F0(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+r,children:[{type:"text",value:i+"@"+r}]}}function $E(e){const i=e.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function qE(e){const i=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let r=i[0],s=r.indexOf(")");const l=fv(e,"(");let f=fv(e,")");for(;s!==-1&&l>f;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),f++;return[e,r]}function F0(e,i){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ji(r)||Ll(r))&&(!i||r!==47)}U0.peek=JE;function WE(){this.buffer()}function GE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function VE(){this.buffer()}function YE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function KE(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Vn(this.sliceSerialize(e)).toLowerCase(),r.label=i}function XE(e){this.exit(e)}function ZE(e){const i=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Vn(this.sliceSerialize(e)).toLowerCase(),r.label=i}function QE(e){this.exit(e)}function JE(){return"["}function U0(e,i,r,s){const l=r.createTracker(s);let f=l.move("[^");const m=r.enter("footnoteReference"),o=r.enter("reference");return f+=l.move(r.safe(r.associationId(e),{after:"]",before:f})),o(),m(),f+=l.move("]"),f}function ej(){return{enter:{gfmFootnoteCallString:WE,gfmFootnoteCall:GE,gfmFootnoteDefinitionLabelString:VE,gfmFootnoteDefinition:YE},exit:{gfmFootnoteCallString:KE,gfmFootnoteCall:XE,gfmFootnoteDefinitionLabelString:ZE,gfmFootnoteDefinition:QE}}}function tj(e){let i=!1;return e&&e.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:r,footnoteReference:U0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,l,f,m){const o=f.createTracker(m);let d=o.move("[^");const h=f.enter("footnoteDefinition"),g=f.enter("label");return d+=o.move(f.safe(f.associationId(s),{before:d,after:"]"})),g(),d+=o.move("]:"),s.children&&s.children.length>0&&(o.shift(4),d+=o.move((i?`
103
+ `:" ")+f.indentLines(f.containerFlow(s,o.current()),i?$0:nj))),h(),d}}function nj(e,i,r){return i===0?e:$0(e,i,r)}function $0(e,i,r){return(r?"":" ")+e}const rj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];q0.peek=lj;function ij(){return{canContainEols:["delete"],enter:{strikethrough:aj},exit:{strikethrough:oj}}}function sj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rj}],handlers:{delete:q0}}}function aj(e){this.enter({type:"delete",children:[]},e)}function oj(e){this.exit(e)}function q0(e,i,r,s){const l=r.createTracker(s),f=r.enter("strikethrough");let m=l.move("~~");return m+=r.containerPhrasing(e,{...l.current(),before:m,after:"~"}),m+=l.move("~~"),f(),m}function lj(){return"~"}function cj(e){return e.length}function uj(e,i){const r=i||{},s=(r.align||[]).concat(),l=r.stringLength||cj,f=[],m=[],o=[],d=[];let h=0,g=-1;for(;++g<e.length;){const C=[],b=[];let x=-1;for(e[g].length>h&&(h=e[g].length);++x<e[g].length;){const _=dj(e[g][x]);if(r.alignDelimiters!==!1){const y=l(_);b[x]=y,(d[x]===void 0||y>d[x])&&(d[x]=y)}C.push(_)}m[g]=C,o[g]=b}let p=-1;if(typeof s=="object"&&"length"in s)for(;++p<h;)f[p]=pv(s[p]);else{const C=pv(s);for(;++p<h;)f[p]=C}p=-1;const v=[],S=[];for(;++p<h;){const C=f[p];let b="",x="";C===99?(b=":",x=":"):C===108?b=":":C===114&&(x=":");let _=r.alignDelimiters===!1?1:Math.max(1,d[p]-b.length-x.length);const y=b+"-".repeat(_)+x;r.alignDelimiters!==!1&&(_=b.length+_+x.length,_>d[p]&&(d[p]=_),S[p]=_),v[p]=y}m.splice(1,0,v),o.splice(1,0,S),g=-1;const E=[];for(;++g<m.length;){const C=m[g],b=o[g];p=-1;const x=[];for(;++p<h;){const _=C[p]||"";let y="",j="";if(r.alignDelimiters!==!1){const A=d[p]-(b[p]||0),N=f[p];N===114?y=" ".repeat(A):N===99?A%2?(y=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(y=" ".repeat(A/2),j=y):j=" ".repeat(A)}r.delimiterStart!==!1&&!p&&x.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&_==="")&&(r.delimiterStart!==!1||p)&&x.push(" "),r.alignDelimiters!==!1&&x.push(y),x.push(_),r.alignDelimiters!==!1&&x.push(j),r.padding!==!1&&x.push(" "),(r.delimiterEnd!==!1||p!==h-1)&&x.push("|")}E.push(r.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return E.join(`
104
+ `)}function dj(e){return e==null?"":String(e)}function pv(e){const i=typeof e=="string"?e.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}function hj(e,i,r,s){const l=r.enter("blockquote"),f=r.createTracker(s);f.move("> "),f.shift(2);const m=r.indentLines(r.containerFlow(e,f.current()),fj);return l(),m}function fj(e,i,r){return">"+(r?"":" ")+e}function pj(e,i){return mv(e,i.inConstruct,!0)&&!mv(e,i.notInConstruct,!1)}function mv(e,i,r){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return r;let s=-1;for(;++s<i.length;)if(e.includes(i[s]))return!0;return!1}function gv(e,i,r,s){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
105
+ `&&pj(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
106
+ `}function mj(e,i){const r=String(e);let s=r.indexOf(i),l=s,f=0,m=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++f>m&&(m=f):f=1,l=s+i.length,s=r.indexOf(i,l);return m}function gj(e,i){return!!(i.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function xj(e){const i=e.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function vj(e,i,r,s){const l=xj(r),f=e.value||"",m=l==="`"?"GraveAccent":"Tilde";if(gj(e,r)){const p=r.enter("codeIndented"),v=r.indentLines(f,bj);return p(),v}const o=r.createTracker(s),d=l.repeat(Math.max(mj(f,l)+1,3)),h=r.enter("codeFenced");let g=o.move(d);if(e.lang){const p=r.enter(`codeFencedLang${m}`);g+=o.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...o.current()})),p()}if(e.lang&&e.meta){const p=r.enter(`codeFencedMeta${m}`);g+=o.move(" "),g+=o.move(r.safe(e.meta,{before:g,after:`
107
+ `,encode:["`"],...o.current()})),p()}return g+=o.move(`
108
+ `),f&&(g+=o.move(f+`
109
+ `)),g+=o.move(d),h(),g}function bj(e,i,r){return(r?"":" ")+e}function wh(e){const i=e.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function yj(e,i,r,s){const l=wh(r),f=l==='"'?"Quote":"Apostrophe",m=r.enter("definition");let o=r.enter("label");const d=r.createTracker(s);let h=d.move("[");return h+=d.move(r.safe(r.associationId(e),{before:h,after:"]",...d.current()})),h+=d.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(o=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":`
110
+ `,...d.current()}))),o(),e.title&&(o=r.enter(`title${f}`),h+=d.move(" "+l),h+=d.move(r.safe(e.title,{before:h,after:l,...d.current()})),h+=d.move(l),o()),m(),h}function _j(e){const i=e.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function Pa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jl(e,i,r){const s=Es(e),l=Es(i);return s===void 0?l===void 0?r==="_"?{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}}W0.peek=Sj;function W0(e,i,r,s){const l=_j(r),f=r.enter("emphasis"),m=r.createTracker(s),o=m.move(l);let d=m.move(r.containerPhrasing(e,{after:l,before:o,...m.current()}));const h=d.charCodeAt(0),g=jl(s.before.charCodeAt(s.before.length-1),h,l);g.inside&&(d=Pa(h)+d.slice(1));const p=d.charCodeAt(d.length-1),v=jl(s.after.charCodeAt(0),p,l);v.inside&&(d=d.slice(0,-1)+Pa(p));const S=m.move(l);return f(),r.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},o+d+S}function Sj(e,i,r){return r.options.emphasis||"*"}function wj(e,i){let r=!1;return _h(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,Wd}),!!((!e.depth||e.depth<3)&&mh(e)&&(i.options.setext||r))}function Cj(e,i,r,s){const l=Math.max(Math.min(6,e.depth||1),1),f=r.createTracker(s);if(wj(e,r)){const g=r.enter("headingSetext"),p=r.enter("phrasing"),v=r.containerPhrasing(e,{...f.current(),before:`
111
+ `,after:`
112
+ `});return p(),g(),v+`
113
+ `+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
114
+ `))+1))}const m="#".repeat(l),o=r.enter("headingAtx"),d=r.enter("phrasing");f.move(m+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
115
+ `,...f.current()});return/^[\t ]/.test(h)&&(h=Pa(h.charCodeAt(0))+h.slice(1)),h=h?m+" "+h:m,r.options.closeAtx&&(h+=" "+m),d(),o(),h}G0.peek=kj;function G0(e){return e.value||""}function kj(){return"<"}V0.peek=Ej;function V0(e,i,r,s){const l=wh(r),f=l==='"'?"Quote":"Apostrophe",m=r.enter("image");let o=r.enter("label");const d=r.createTracker(s);let h=d.move("![");return h+=d.move(r.safe(e.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(o=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),o(),e.title&&(o=r.enter(`title${f}`),h+=d.move(" "+l),h+=d.move(r.safe(e.title,{before:h,after:l,...d.current()})),h+=d.move(l),o()),h+=d.move(")"),m(),h}function Ej(){return"!"}Y0.peek=jj;function Y0(e,i,r,s){const l=e.referenceType,f=r.enter("imageReference");let m=r.enter("label");const o=r.createTracker(s);let d=o.move("![");const h=r.safe(e.alt,{before:d,after:"]",...o.current()});d+=o.move(h+"]["),m();const g=r.stack;r.stack=[],m=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...o.current()});return m(),r.stack=g,f(),l==="full"||!h||h!==p?d+=o.move(p+"]"):l==="shortcut"?d=d.slice(0,-1):d+=o.move("]"),d}function jj(){return"!"}K0.peek=Nj;function K0(e,i,r){let s=e.value||"",l="`",f=-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+" ");++f<r.unsafe.length;){const m=r.unsafe[f],o=r.compilePattern(m);let d;if(m.atBreak)for(;d=o.exec(s);){let h=d.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(d.index+1)}}return l+s+l}function Nj(){return"`"}function X0(e,i){const r=mh(e);return!!(!i.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Z0.peek=Tj;function Z0(e,i,r,s){const l=wh(r),f=l==='"'?"Quote":"Apostrophe",m=r.createTracker(s);let o,d;if(X0(e,r)){const g=r.stack;r.stack=[],o=r.enter("autolink");let p=m.move("<");return p+=m.move(r.containerPhrasing(e,{before:p,after:">",...m.current()})),p+=m.move(">"),o(),r.stack=g,p}o=r.enter("link"),d=r.enter("label");let h=m.move("[");return h+=m.move(r.containerPhrasing(e,{before:h,after:"](",...m.current()})),h+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(d=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=r.enter(`title${f}`),h+=m.move(" "+l),h+=m.move(r.safe(e.title,{before:h,after:l,...m.current()})),h+=m.move(l),d()),h+=m.move(")"),o(),h}function Tj(e,i,r){return X0(e,r)?"<":"["}Q0.peek=Aj;function Q0(e,i,r,s){const l=e.referenceType,f=r.enter("linkReference");let m=r.enter("label");const o=r.createTracker(s);let d=o.move("[");const h=r.containerPhrasing(e,{before:d,after:"]",...o.current()});d+=o.move(h+"]["),m();const g=r.stack;r.stack=[],m=r.enter("reference");const p=r.safe(r.associationId(e),{before:d,after:"]",...o.current()});return m(),r.stack=g,f(),l==="full"||!h||h!==p?d+=o.move(p+"]"):l==="shortcut"?d=d.slice(0,-1):d+=o.move("]"),d}function Aj(){return"["}function Ch(e){const i=e.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function Dj(e){const i=Ch(e),r=e.options.bulletOther;if(!r)return i==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+r+"`) to be different");return r}function Rj(e){const i=e.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function J0(e){const i=e.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function Lj(e,i,r,s){const l=r.enter("list"),f=r.bulletCurrent;let m=e.ordered?Rj(r):Ch(r);const o=e.ordered?m==="."?")":".":Dj(r);let d=i&&r.bulletLastUsed?m===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((m==="*"||m==="-")&&g&&(!g.children||!g.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(d=!0),J0(r)===m&&g){let p=-1;for(;++p<e.children.length;){const v=e.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(m=o),r.bulletCurrent=m;const h=r.containerFlow(e,s);return r.bulletLastUsed=m,r.bulletCurrent=f,l(),h}function Mj(e){const i=e.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function Oj(e,i,r,s){const l=Mj(r);let f=r.bulletCurrent||Ch(r);i&&i.type==="list"&&i.ordered&&(f=(typeof i.start=="number"&&i.start>-1?i.start:1)+(r.options.incrementListMarker===!1?0:i.children.indexOf(e))+f);let m=f.length+1;(l==="tab"||l==="mixed"&&(i&&i.type==="list"&&i.spread||e.spread))&&(m=Math.ceil(m/4)*4);const o=r.createTracker(s);o.move(f+" ".repeat(m-f.length)),o.shift(m);const d=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,o.current()),g);return d(),h;function g(p,v,S){return v?(S?"":" ".repeat(m))+p:(S?f:f+" ".repeat(m-f.length))+p}}function Bj(e,i,r,s){const l=r.enter("paragraph"),f=r.enter("phrasing"),m=r.containerPhrasing(e,s);return f(),l(),m}const Ij=Bl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function zj(e,i,r,s){return(e.children.some(function(m){return Ij(m)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function Hj(e){const i=e.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}eb.peek=Pj;function eb(e,i,r,s){const l=Hj(r),f=r.enter("strong"),m=r.createTracker(s),o=m.move(l+l);let d=m.move(r.containerPhrasing(e,{after:l,before:o,...m.current()}));const h=d.charCodeAt(0),g=jl(s.before.charCodeAt(s.before.length-1),h,l);g.inside&&(d=Pa(h)+d.slice(1));const p=d.charCodeAt(d.length-1),v=jl(s.after.charCodeAt(0),p,l);v.inside&&(d=d.slice(0,-1)+Pa(p));const S=m.move(l+l);return f(),r.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},o+d+S}function Pj(e,i,r){return r.options.strong||"*"}function Fj(e,i,r,s){return r.safe(e.value,s)}function Uj(e){const i=e.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function $j(e,i,r){const s=(J0(r)+(r.options.ruleSpaces?" ":"")).repeat(Uj(r));return r.options.ruleSpaces?s.slice(0,-1):s}const tb={blockquote:hj,break:gv,code:vj,definition:yj,emphasis:W0,hardBreak:gv,heading:Cj,html:G0,image:V0,imageReference:Y0,inlineCode:K0,link:Z0,linkReference:Q0,list:Lj,listItem:Oj,paragraph:Bj,root:zj,strong:eb,text:Fj,thematicBreak:$j};function qj(){return{enter:{table:Wj,tableData:xv,tableHeader:xv,tableRow:Vj},exit:{codeText:Yj,table:Gj,tableData:Dd,tableHeader:Dd,tableRow:Dd}}}function Wj(e){const i=e._align;this.enter({type:"table",align:i.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function Gj(e){this.exit(e),this.data.inTable=void 0}function Vj(e){this.enter({type:"tableRow",children:[]},e)}function Dd(e){this.exit(e)}function xv(e){this.enter({type:"tableCell",children:[]},e)}function Yj(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,Kj));const r=this.stack[this.stack.length-1];r.type,r.value=i,this.exit(e)}function Kj(e,i){return i==="|"?i:e}function Xj(e){const i=e||{},r=i.tableCellPadding,s=i.tablePipeAlign,l=i.stringLength,f=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
116
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:m,tableCell:d,tableRow:o}};function m(S,E,C,b){return h(g(S,C,b),S.align)}function o(S,E,C,b){const x=p(S,C,b),_=h([x]);return _.slice(0,_.indexOf(`
117
+ `))}function d(S,E,C,b){const x=C.enter("tableCell"),_=C.enter("phrasing"),y=C.containerPhrasing(S,{...b,before:f,after:f});return _(),x(),y}function h(S,E){return uj(S,{align:E,alignDelimiters:s,padding:r,stringLength:l})}function g(S,E,C){const b=S.children;let x=-1;const _=[],y=E.enter("table");for(;++x<b.length;)_[x]=p(b[x],E,C);return y(),_}function p(S,E,C){const b=S.children;let x=-1;const _=[],y=E.enter("tableRow");for(;++x<b.length;)_[x]=d(b[x],S,E,C);return y(),_}function v(S,E,C){let b=tb.inlineCode(S,E,C);return C.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function Zj(){return{exit:{taskListCheckValueChecked:vv,taskListCheckValueUnchecked:vv,paragraph:Jj}}}function Qj(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:e5}}}function vv(e){const i=this.stack[this.stack.length-2];i.type,i.checked=e.type==="taskListCheckValueChecked"}function Jj(e){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const l=i.children;let f=-1,m;for(;++f<l.length;){const o=l[f];if(o.type==="paragraph"){m=o;break}}m===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function e5(e,i,r,s){const l=e.children[0],f=typeof e.checked=="boolean"&&l&&l.type==="paragraph",m="["+(e.checked?"x":" ")+"] ",o=r.createTracker(s);f&&o.move(m);let d=tb.listItem(e,i,r,{...s,...o.current()});return f&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),d;function h(g){return g+m}}function t5(){return[LE(),ej(),ij(),qj(),Zj()]}function n5(e){return{extensions:[ME(),tj(e),sj(),Xj(e),Qj()]}}const r5={tokenize:c5,partial:!0},nb={tokenize:u5,partial:!0},rb={tokenize:d5,partial:!0},ib={tokenize:h5,partial:!0},i5={tokenize:f5,partial:!0},sb={name:"wwwAutolink",tokenize:o5,previous:ob},ab={name:"protocolAutolink",tokenize:l5,previous:lb},Cr={name:"emailAutolink",tokenize:a5,previous:cb},rr={};function s5(){return{text:rr}}let yi=48;for(;yi<123;)rr[yi]=Cr,yi++,yi===58?yi=65:yi===91&&(yi=97);rr[43]=Cr;rr[45]=Cr;rr[46]=Cr;rr[95]=Cr;rr[72]=[Cr,ab];rr[104]=[Cr,ab];rr[87]=[Cr,sb];rr[119]=[Cr,sb];function a5(e,i,r){const s=this;let l,f;return m;function m(p){return!Kd(p)||!cb.call(s,s.previous)||kh(s.events)?r(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(p))}function o(p){return Kd(p)?(e.consume(p),o):p===64?(e.consume(p),d):r(p)}function d(p){return p===46?e.check(i5,g,h)(p):p===45||p===95||nn(p)?(f=!0,e.consume(p),d):g(p)}function h(p){return e.consume(p),l=!0,d}function g(p){return f&&l&&on(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),i(p)):r(p)}}function o5(e,i,r){const s=this;return l;function l(m){return m!==87&&m!==119||!ob.call(s,s.previous)||kh(s.events)?r(m):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(r5,e.attempt(nb,e.attempt(rb,f),r),r)(m))}function f(m){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),i(m)}}function l5(e,i,r){const s=this;let l="",f=!1;return m;function m(p){return(p===72||p===104)&&lb.call(s,s.previous)&&!kh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(p),e.consume(p),o):r(p)}function o(p){if(on(p)&&l.length<5)return l+=String.fromCodePoint(p),e.consume(p),o;if(p===58){const v=l.toLowerCase();if(v==="http"||v==="https")return e.consume(p),d}return r(p)}function d(p){return p===47?(e.consume(p),f?h:(f=!0,d)):r(p)}function h(p){return p===null||Cl(p)||bt(p)||ji(p)||Ll(p)?r(p):e.attempt(nb,e.attempt(rb,g),r)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),i(p)}}function c5(e,i,r){let s=0;return l;function l(m){return(m===87||m===119)&&s<3?(s++,e.consume(m),l):m===46&&s===3?(e.consume(m),f):r(m)}function f(m){return m===null?r(m):i(m)}}function u5(e,i,r){let s,l,f;return m;function m(h){return h===46||h===95?e.check(ib,d,o)(h):h===null||bt(h)||ji(h)||h!==45&&Ll(h)?d(h):(f=!0,e.consume(h),m)}function o(h){return h===95?s=!0:(l=s,s=void 0),e.consume(h),m}function d(h){return l||s||!f?r(h):i(h)}}function d5(e,i){let r=0,s=0;return l;function l(m){return m===40?(r++,e.consume(m),l):m===41&&s<r?f(m):m===33||m===34||m===38||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===60||m===63||m===93||m===95||m===126?e.check(ib,i,f)(m):m===null||bt(m)||ji(m)?i(m):(e.consume(m),l)}function f(m){return m===41&&s++,e.consume(m),l}}function h5(e,i,r){return s;function s(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),s):o===38?(e.consume(o),f):o===93?(e.consume(o),l):o===60||o===null||bt(o)||ji(o)?i(o):r(o)}function l(o){return o===null||o===40||o===91||bt(o)||ji(o)?i(o):s(o)}function f(o){return on(o)?m(o):r(o)}function m(o){return o===59?(e.consume(o),s):on(o)?(e.consume(o),m):r(o)}}function f5(e,i,r){return s;function s(f){return e.consume(f),l}function l(f){return nn(f)?r(f):i(f)}}function ob(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function lb(e){return!on(e)}function cb(e){return!(e===47||Kd(e))}function Kd(e){return e===43||e===45||e===46||e===95||nn(e)}function kh(e){let i=e.length,r=!1;for(;i--;){const s=e[i][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const p5={tokenize:S5,partial:!0};function m5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:b5,continuation:{tokenize:y5},exit:_5}},text:{91:{name:"gfmFootnoteCall",tokenize:v5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:g5,resolveTo:x5}}}}function g5(e,i,r){const s=this;let l=s.events.length;const f=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let m;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){m=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return o;function o(d){if(!m||!m._balanced)return r(d);const h=Vn(s.sliceSerialize({start:m.end,end:s.now()}));return h.codePointAt(0)!==94||!f.includes(h.slice(1))?r(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),i(d))}}function x5(e,i){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const f={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},m={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},o=[e[r+1],e[r+2],["enter",s,i],e[r+3],e[r+4],["enter",l,i],["exit",l,i],["enter",f,i],["enter",m,i],["exit",m,i],["exit",f,i],e[e.length-2],e[e.length-1],["exit",s,i]];return e.splice(r,e.length-r+1,...o),e}function v5(e,i,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f=0,m;return o;function o(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?r(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(f>999||p===93&&!m||p===null||p===91||bt(p))return r(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return l.includes(Vn(s.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):r(p)}return bt(p)||(m=!0),f++,e.consume(p),p===92?g:h}function g(p){return p===91||p===92||p===93?(e.consume(p),f++,h):h(p)}}function b5(e,i,r){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f,m=0,o;return d;function d(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(E)}function g(E){if(m>999||E===93&&!o||E===null||E===91||bt(E))return r(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return f=Vn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return bt(E)||(o=!0),m++,e.consume(E),E===92?p:g}function p(E){return E===91||E===92||E===93?(e.consume(E),m++,g):g(E)}function v(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(f)||l.push(f),tt(e,S,"gfmFootnoteDefinitionWhitespace")):r(E)}function S(E){return i(E)}}function y5(e,i,r){return e.check(Ga,i,e.attempt(p5,i,r))}function _5(e){e.exit("gfmFootnoteDefinition")}function S5(e,i,r){const s=this;return tt(e,l,"gfmFootnoteDefinitionIndent",5);function l(f){const m=s.events[s.events.length-1];return m&&m[1].type==="gfmFootnoteDefinitionIndent"&&m[2].sliceSerialize(m[1],!0).length===4?i(f):r(f)}}function w5(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:f,resolveAll:l};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(m,o){let d=-1;for(;++d<m.length;)if(m[d][0]==="enter"&&m[d][1].type==="strikethroughSequenceTemporary"&&m[d][1]._close){let h=d;for(;h--;)if(m[h][0]==="exit"&&m[h][1].type==="strikethroughSequenceTemporary"&&m[h][1]._open&&m[d][1].end.offset-m[d][1].start.offset===m[h][1].end.offset-m[h][1].start.offset){m[d][1].type="strikethroughSequence",m[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},m[h][1].start),end:Object.assign({},m[d][1].end)},p={type:"strikethroughText",start:Object.assign({},m[h][1].end),end:Object.assign({},m[d][1].start)},v=[["enter",g,o],["enter",m[h][1],o],["exit",m[h][1],o],["enter",p,o]],S=o.parser.constructs.insideSpan.null;S&&Tn(v,v.length,0,Ml(S,m.slice(h+1,d),o)),Tn(v,v.length,0,[["exit",p,o],["enter",m[d][1],o],["exit",m[d][1],o],["exit",g,o]]),Tn(m,h-1,d-h+3,v),d=h+v.length-2;break}}for(d=-1;++d<m.length;)m[d][1].type==="strikethroughSequenceTemporary"&&(m[d][1].type="data");return m}function f(m,o,d){const h=this.previous,g=this.events;let p=0;return v;function v(E){return h===126&&g[g.length-1][1].type!=="characterEscape"?d(E):(m.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const C=Es(h);if(E===126)return p>1?d(E):(m.consume(E),p++,S);if(p<2&&!r)return d(E);const b=m.exit("strikethroughSequenceTemporary"),x=Es(E);return b._open=!x||x===2&&!!C,b._close=!C||C===2&&!!x,o(E)}}}class C5{constructor(){this.map=[]}add(i,r,s){k5(this,i,r,s)}consume(i){if(this.map.sort(function(f,m){return f[0]-m[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(i.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),i.length=this.map[r][0];s.push(i.slice()),i.length=0;let l=s.pop();for(;l;){for(const f of l)i.push(f);l=s.pop()}this.map.length=0}}function k5(e,i,r,s){let l=0;if(!(r===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===i){e.map[l][1]+=r,e.map[l][2].push(...s);return}l+=1}e.map.push([i,r,s])}}function E5(e,i){let r=!1;const s=[];for(;i<e.length;){const l=e[i];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[i-1][1].type==="tableDelimiterMarker"){const f=s.length-1;s[f]=s[f]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);i+=1}return s}function j5(){return{flow:{null:{name:"table",tokenize:N5,resolveAll:T5}}}}function N5(e,i,r){const s=this;let l=0,f=0,m;return o;function o(H){let G=s.events.length-1;for(;G>-1;){const O=s.events[G][1].type;if(O==="lineEnding"||O==="linePrefix")G--;else break}const K=G>-1?s.events[G][1].type:null,q=K==="tableHead"||K==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?r(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),h(H)}function h(H){return H===124||(m=!0,f+=1),g(H)}function g(H){return H===null?r(H):Re(H)?f>1?(f=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),S):r(H):Ye(H)?tt(e,g,"whitespace")(H):(f+=1,m&&(m=!1,l+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),m=!0,g):(e.enter("data"),p(H)))}function p(H){return H===null||H===124||bt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?v:p)}function v(H){return H===92||H===124?(e.consume(H),p):p(H)}function S(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(H):(e.enter("tableDelimiterRow"),m=!1,Ye(H)?tt(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?b(H):H===124?(m=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return Ye(H)?tt(e,b,"whitespace")(H):b(H)}function b(H){return H===58?(f+=1,m=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),x):H===45?(f+=1,x(H)):H===null||Re(H)?j(H):A(H)}function x(H){return H===45?(e.enter("tableDelimiterFiller"),_(H)):A(H)}function _(H){return H===45?(e.consume(H),_):H===58?(m=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(H))}function y(H){return Ye(H)?tt(e,j,"whitespace")(H):j(H)}function j(H){return H===124?E(H):H===null||Re(H)?!m||l!==f?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(H)):A(H)}function A(H){return r(H)}function N(H){return e.enter("tableRow"),R(H)}function R(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),R):H===null||Re(H)?(e.exit("tableRow"),i(H)):Ye(H)?tt(e,R,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||bt(H)?(e.exit("data"),R(H)):(e.consume(H),H===92?I:T)}function I(H){return H===92||H===124?(e.consume(H),T):T(H)}}function T5(e,i){let r=-1,s=!0,l=0,f=[0,0,0,0],m=[0,0,0,0],o=!1,d=0,h,g,p;const v=new C5;for(;++r<e.length;){const S=e[r],E=S[1];S[0]==="enter"?E.type==="tableHead"?(o=!1,d!==0&&(bv(v,i,d,h,g),g=void 0,d=0),h={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(r,0,[["enter",h,i]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,p=void 0,f=[0,0,0,0],m=[0,r+1,0,0],o&&(o=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(r,0,[["enter",g,i]])),l=E.type==="tableDelimiterRow"?2:g?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,m[2]===0&&(f[1]!==0&&(m[0]=m[1],p=fl(v,i,f,l,void 0,p),f=[0,0,0,0]),m[2]=r)):E.type==="tableCellDivider"&&(s?s=!1:(f[1]!==0&&(m[0]=m[1],p=fl(v,i,f,l,void 0,p)),f=m,m=[f[1],r,0,0])):E.type==="tableHead"?(o=!0,d=r):E.type==="tableRow"||E.type==="tableDelimiterRow"?(d=r,f[1]!==0?(m[0]=m[1],p=fl(v,i,f,l,r,p)):m[1]!==0&&(p=fl(v,i,m,l,r,p)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(m[3]=r)}for(d!==0&&bv(v,i,d,h,g),v.consume(i.events),r=-1;++r<i.events.length;){const S=i.events[r];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=E5(i.events,r))}return e}function fl(e,i,r,s,l,f){const m=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",o="tableContent";r[0]!==0&&(f.end=Object.assign({},_s(i.events,r[0])),e.add(r[0],0,[["exit",f,i]]));const d=_s(i.events,r[1]);if(f={type:m,start:Object.assign({},d),end:Object.assign({},d)},e.add(r[1],0,[["enter",f,i]]),r[2]!==0){const h=_s(i.events,r[2]),g=_s(i.events,r[3]),p={type:o,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",p,i]]),s!==2){const v=i.events[r[2]],S=i.events[r[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",r[3]>r[2]+1){const E=r[2]+1,C=r[3]-r[2]-1;e.add(E,C,[])}}e.add(r[3]+1,0,[["exit",p,i]])}return l!==void 0&&(f.end=Object.assign({},_s(i.events,l)),e.add(l,0,[["exit",f,i]]),f=void 0),f}function bv(e,i,r,s,l){const f=[],m=_s(i.events,r);l&&(l.end=Object.assign({},m),f.push(["exit",l,i])),s.end=Object.assign({},m),f.push(["exit",s,i]),e.add(r+1,0,f)}function _s(e,i){const r=e[i],s=r[0]==="enter"?"start":"end";return r[1][s]}const A5={name:"tasklistCheck",tokenize:R5};function D5(){return{text:{91:A5}}}function R5(e,i,r){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),f)}function f(d){return bt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),m):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),m):r(d)}function m(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):r(d)}function o(d){return Re(d)?i(d):Ye(d)?e.check({tokenize:L5},i,r)(d):r(d)}}function L5(e,i,r){return tt(e,s,"whitespace");function s(l){return l===null?r(l):i(l)}}function M5(e){return y0([s5(),m5(),w5(e),j5(),D5()])}const O5={};function B5(e){const i=this,r=e||O5,s=i.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),f=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),m=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(M5(r)),f.push(t5()),m.push(n5(r))}function I5(e,i){if(e==null)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(i.indexOf(s)!==-1)continue;r[s]=e[s]}return r}function z5(e,i){if(e==null)return{};var r,s,l=I5(e,i);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(e);for(s=0;s<f.length;s++)r=f[s],i.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}function Xd(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function H5(e){if(Array.isArray(e))return Xd(e)}function P5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function F5(e,i){if(e){if(typeof e=="string")return Xd(e,i);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xd(e,i):void 0}}function U5(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
118
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zd(e){return H5(e)||P5(e)||F5(e)||U5()}function Fa(e){"@babel/helpers - typeof";return Fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Fa(e)}function $5(e,i){if(Fa(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,i);if(Fa(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(e)}function q5(e){var i=$5(e,"string");return Fa(i)=="symbol"?i:i+""}function ub(e,i,r){return(i=q5(i))in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}function Qd(){return Qd=Object.assign?Object.assign.bind():function(e){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Qd.apply(null,arguments)}function yv(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,s)}return r}function ws(e){for(var i=1;i<arguments.length;i++){var r=arguments[i]!=null?arguments[i]:{};i%2?yv(Object(r),!0).forEach(function(s){ub(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yv(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}function W5(e){var i=e.length;if(i===0||i===1)return e;if(i===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(i===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(i>=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 Rd={};function G5(e){if(e.length===0||e.length===1)return e;var i=e.join(".");return Rd[i]||(Rd[i]=W5(e)),Rd[i]}function V5(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,s=e.filter(function(f){return f!=="token"}),l=G5(s);return l.reduce(function(f,m){return ws(ws({},f),r[m])},i)}function _v(e){return e.join(" ")}function Y5(e,i){var r=0;return function(s){return r+=1,s.map(function(l,f){return db({node:l,stylesheet:e,useInlineStyles:i,key:"code-segment-".concat(r,"-").concat(f)})})}}function db(e){var i=e.node,r=e.stylesheet,s=e.style,l=s===void 0?{}:s,f=e.useInlineStyles,m=e.key,o=i.properties,d=i.type,h=i.tagName,g=i.value;if(d==="text")return g;if(h){var p=Y5(r,f),v;if(!f)v=ws(ws({},o),{},{className:_v(o.className)});else{var S=Object.keys(r).reduce(function(x,_){return _.split(".").forEach(function(y){x.includes(y)||x.push(y)}),x},[]),E=o.className&&o.className.includes("token")?["token"]:[],C=o.className&&E.concat(o.className.filter(function(x){return!S.includes(x)}));v=ws(ws({},o),{},{className:_v(C)||void 0,style:V5(o.className,Object.assign({},o.style,l),r)})}var b=p(i.children);return an.createElement(h,Qd({key:m},v),b)}}const K5=(function(e,i){var r=e.listLanguages();return r.indexOf(i)!==-1});var X5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Sv(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),r.push.apply(r,s)}return r}function Qr(e){for(var i=1;i<arguments.length;i++){var r=arguments[i]!=null?arguments[i]:{};i%2?Sv(Object(r),!0).forEach(function(s){ub(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sv(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var Z5=/\n/g;function Q5(e){return e.match(Z5)}function J5(e){var i=e.lines,r=e.startingLineNumber,s=e.style;return i.map(function(l,f){var m=f+r;return an.createElement("span",{key:"line-".concat(f),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(m):s},"".concat(m,`
119
+ `))})}function eN(e){var i=e.codeString,r=e.codeStyle,s=e.containerStyle,l=s===void 0?{float:"left",paddingRight:"10px"}:s,f=e.numberStyle,m=f===void 0?{}:f,o=e.startingLineNumber;return an.createElement("code",{style:Object.assign({},r,l)},J5({lines:i.replace(/\n$/,"").split(`
120
+ `),style:m,startingLineNumber:o}))}function tN(e){return"".concat(e.toString().length,".25em")}function hb(e,i){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:i},children:[{type:"text",value:e}]}}function fb(e,i,r){var s={display:"inline-block",minWidth:tN(r),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(i):e,f=Qr(Qr({},s),l);return f}function bl(e){var i=e.children,r=e.lineNumber,s=e.lineNumberStyle,l=e.largestLineNumber,f=e.showInlineLineNumbers,m=e.lineProps,o=m===void 0?{}:m,d=e.className,h=d===void 0?[]:d,g=e.showLineNumbers,p=e.wrapLongLines,v=e.wrapLines,S=v===void 0?!1:v,E=S?Qr({},typeof o=="function"?o(r):o):{};if(E.className=E.className?[].concat(Zd(E.className.trim().split(/\s+/)),Zd(h)):h,r&&f){var C=fb(s,r,l);i.unshift(hb(r,C))}return p&g&&(E.style=Qr({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:i}}function pb(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=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")r.push(bl({children:[l],className:Zd(new Set(i))}));else if(l.children){var f,m=i.concat(((f=l.properties)===null||f===void 0?void 0:f.className)||[]);pb(l.children,m).forEach(function(o){return r.push(o)})}}return r}function nN(e,i,r,s,l,f,m,o,d){var h,g=pb(e.value),p=[],v=-1,S=0;function E(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return bl({children:A,lineNumber:N,lineNumberStyle:o,largestLineNumber:m,showInlineLineNumbers:l,lineProps:r,className:R,showLineNumbers:s,wrapLongLines:d,wrapLines:i})}function C(A,N){if(s&&N&&l){var R=fb(o,N,m);A.unshift(hb(N,R))}return A}function b(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return i||R.length>0?E(A,N,R):C(A,N)}for(var x=function(){var N=g[S],R=N.children[0].value,T=Q5(R);if(T){var I=R.split(`
121
+ `);I.forEach(function(H,G){var K=s&&p.length+f,q={type:"text",value:"".concat(H,`
122
+ `)};if(G===0){var O=g.slice(v+1,S).concat(bl({children:[q],className:N.properties.className})),W=b(O,K);p.push(W)}else if(G===I.length-1){var V=g[S+1]&&g[S+1].children&&g[S+1].children[0],Q={type:"text",value:"".concat(H)};if(V){var te=bl({children:[Q],className:N.properties.className});g.splice(S+1,0,te)}else{var L=[Q],D=b(L,K,N.properties.className);p.push(D)}}else{var B=[q],U=b(B,K,N.properties.className);p.push(U)}}),v=S}S++};S<g.length;)x();if(v!==g.length-1){var _=g.slice(v+1,g.length);if(_&&_.length){var y=s&&p.length+f,j=b(_,y);p.push(j)}}return i?p:(h=[]).concat.apply(h,p)}function rN(e){var i=e.rows,r=e.stylesheet,s=e.useInlineStyles;return i.map(function(l,f){return db({node:l,stylesheet:r,useInlineStyles:s,key:"code-segment-".concat(f)})})}function mb(e){return e&&typeof e.highlightAuto<"u"}function iN(e){var i=e.astGenerator,r=e.language,s=e.code,l=e.defaultCodeValue;if(mb(i)){var f=K5(i,r);return r==="text"?{value:l,language:"text"}:f?i.highlight(r,s):i.highlightAuto(s)}try{return r&&r!=="text"?{value:i.highlight(s,r)}:{value:l}}catch{return{value:l}}}function sN(e,i){return function(s){var l,f,m=s.language,o=s.children,d=s.style,h=d===void 0?i:d,g=s.customStyle,p=g===void 0?{}:g,v=s.codeTagProps,S=v===void 0?{className:m?"language-".concat(m):void 0,style:Qr(Qr({},h['code[class*="language-"]']),h['code[class*="language-'.concat(m,'"]')])}:v,E=s.useInlineStyles,C=E===void 0?!0:E,b=s.showLineNumbers,x=b===void 0?!1:b,_=s.showInlineLineNumbers,y=_===void 0?!0:_,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,R=s.lineNumberStyle,T=R===void 0?{}:R,I=s.wrapLines,H=s.wrapLongLines,G=H===void 0?!1:H,K=s.lineProps,q=K===void 0?{}:K,O=s.renderer,W=s.PreTag,V=W===void 0?"pre":W,Q=s.CodeTag,te=Q===void 0?"code":Q,L=s.code,D=L===void 0?(Array.isArray(o)?o[0]:o)||"":L,B=s.astGenerator,U=z5(s,X5);B=B||e;var P=x?an.createElement(eN,{containerStyle:N,codeStyle:S.style||{},numberStyle:T,startingLineNumber:A,codeString:D}):null,Y=h.hljs||h['pre[class*="language-"]']||{backgroundColor:"#fff"},ne=mb(B)?"hljs":"prismjs",Z=C?Object.assign({},U,{style:Object.assign({},Y,p)}):Object.assign({},U,{className:U.className?"".concat(ne," ").concat(U.className):ne,style:Object.assign({},p)});if(G?S.style=Qr({whiteSpace:"pre-wrap"},S.style):S.style=Qr({whiteSpace:"pre"},S.style),!B)return an.createElement(V,Z,P,an.createElement(te,S,D));(I===void 0&&O||G)&&(I=!0),O=O||rN;var X=[{type:"text",value:D}],z=iN({astGenerator:B,language:m,code:D,defaultCodeValue:X});z.language===null&&(z.value=X);var ae=(l=(f=D.match(/\n/g))===null||f===void 0?void 0:f.length)!==null&&l!==void 0?l:0,se=A+ae,ge=nN(z,I,q,x,y,A,se,T,G);return an.createElement(V,Z,an.createElement(te,S,!y&&P,O({rows:ge,stylesheet:h,useInlineStyles:C})))}}const wv=/[#.]/g;function aN(e,i){const r=e||"",s={};let l=0,f,m;for(;l<r.length;){wv.lastIndex=l;const o=wv.exec(r),d=r.slice(l,o?o.index:r.length);d&&(f?f==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:m=d,l+=d.length),o&&(f=o[0],l++)}return{type:"element",tagName:m||i||"div",properties:s,children:[]}}function gb(e,i,r){const s=r?uN(r):void 0;function l(f,m,...o){let d;if(f==null){d={type:"root",children:[]};const h=m;o.unshift(h)}else{d=aN(f,i);const h=d.tagName.toLowerCase(),g=s?s.get(h):void 0;if(d.tagName=g||h,oN(m))o.unshift(m);else for(const[p,v]of Object.entries(m))lN(e,d.properties,p,v)}for(const h of o)Jd(d.children,h);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function oN(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const i=e,r=Object.keys(e);for(const s of r){const l=i[s];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const f=l;for(const m of f)if(typeof m!="number"&&typeof m!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function lN(e,i,r,s){const l=d0(e,r);let f;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;f=s}else typeof s=="boolean"?f=s:typeof s=="string"?l.spaceSeparated?f=Mx(s):l.commaSeparated?f=Tx(s):l.commaOrSpaceSeparated?f=Mx(Tx(s).join(" ")):f=Cv(l,l.property,s):Array.isArray(s)?f=[...s]:f=l.property==="style"?cN(s):String(s);if(Array.isArray(f)){const m=[];for(const o of f)m.push(Cv(l,l.property,o));f=m}l.property==="className"&&Array.isArray(i.className)&&(f=i.className.concat(f)),i[l.property]=f}}function Jd(e,i){if(i!=null)if(typeof i=="number"||typeof i=="string")e.push({type:"text",value:String(i)});else if(Array.isArray(i))for(const r of i)Jd(e,r);else if(typeof i=="object"&&"type"in i)i.type==="root"?Jd(e,i.children):e.push(i);else throw new Error("Expected node, nodes, or string, got `"+i+"`")}function Cv(e,i,r){if(typeof r=="string"){if(e.number&&r&&!Number.isNaN(Number(r)))return Number(r);if((e.boolean||e.overloadedBoolean)&&(r===""||Ia(r)===Ia(i)))return!0}return r}function cN(e){const i=[];for(const[r,s]of Object.entries(e))i.push([r,s].join(": "));return i.join("; ")}function uN(e){const i=new Map;for(const r of e)i.set(r.toLowerCase(),r);return i}const dN=["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"],hN=gb(h0,"div");gb(Rl,"g",dN);const fN=["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"],kv={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 xb(e){const i=typeof e=="string"?e.charCodeAt(0):e;return i>=48&&i<=57}function pN(e){const i=typeof e=="string"?e.charCodeAt(0):e;return i>=97&&i<=102||i>=65&&i<=70||i>=48&&i<=57}function mN(e){const i=typeof e=="string"?e.charCodeAt(0):e;return i>=97&&i<=122||i>=65&&i<=90}function Ev(e){return mN(e)||xb(e)}const gN=["","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 xN(e,i){const r={},s=typeof r.additional=="string"?r.additional.charCodeAt(0):r.additional,l=[];let f=0,m=-1,o="",d,h;r.position&&("start"in r.position||"indent"in r.position?(h=r.position.indent,d=r.position.start):d=r.position);let g=(d?d.line:0)||1,p=(d?d.column:0)||1,v=E(),S;for(f--;++f<=e.length;)if(S===10&&(p=(h?h[m]:0)||1),S=e.charCodeAt(f),S===38){const x=e.charCodeAt(f+1);if(x===9||x===10||x===12||x===32||x===38||x===60||Number.isNaN(x)||s&&x===s){o+=String.fromCharCode(S),p++;continue}const _=f+1;let y=_,j=_,A;if(x===35){j=++y;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++y):A="decimal"}else A="named";let N="",R="",T="";const I=A==="named"?Ev:A==="decimal"?xb:pN;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!I(q))break;T+=String.fromCharCode(q),A==="named"&&fN.includes(T)&&(N=T,R=Ha(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?Ha(T):!1;q&&(N=T,R=q)}let G=1+j-_,K="";if(!(!H&&r.nonTerminated===!1))if(!T)A!=="named"&&C(4,G);else if(A==="named"){if(H&&!R)C(5,1);else if(N!==T&&(j=y+N.length,G=1+j-y,H=!1),!H){const q=N?1:3;if(r.attribute){const O=e.charCodeAt(j);O===61?(C(q,G),R=""):Ev(O)?R="":C(q,G)}else C(q,G)}K=R}else{H||C(2,G);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(vN(q))C(7,G),K="�";else if(q in kv)C(6,G),K=kv[q];else{let O="";bN(q)&&C(6,G),q>65535&&(q-=65536,O+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),K=O+String.fromCharCode(q)}}if(K){b(),v=E(),f=j-1,p+=j-_+1,l.push(K);const q=E();q.offset++,r.reference&&r.reference.call(r.referenceContext||void 0,K,{start:v,end:q},e.slice(_-1,j)),v=q}else T=e.slice(_-1,j),o+=T,p+=T.length,f=j-1}else S===10&&(g++,m++,p=0),Number.isNaN(S)?b():(o+=String.fromCharCode(S),p++);return l.join("");function E(){return{line:g,column:p,offset:f+((d?d.offset:0)||0)}}function C(x,_){let y;r.warning&&(y=E(),y.column+=_,y.offset+=_,r.warning.call(r.warningContext||void 0,gN[x],y,x))}function b(){o&&(l.push(o),r.text&&r.text.call(r.textContext||void 0,o,{start:v,end:E()}),o="")}}function vN(e){return e>=55296&&e<=57343||e>1114111}function bN(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 yN=0,pl={},Ut={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++yN}),e.__id},clone:function e(i,r){r=r||{};var s,l;switch(Ut.util.type(i)){case"Object":if(l=Ut.util.objId(i),r[l])return r[l];s={},r[l]=s;for(var f in i)i.hasOwnProperty(f)&&(s[f]=e(i[f],r));return s;case"Array":return l=Ut.util.objId(i),r[l]?r[l]:(s=[],r[l]=s,i.forEach(function(m,o){s[o]=e(m,r)}),s);default:return i}}},languages:{plain:pl,plaintext:pl,text:pl,txt:pl,extend:function(e,i){var r=Ut.util.clone(Ut.languages[e]);for(var s in i)r[s]=i[s];return r},insertBefore:function(e,i,r,s){s=s||Ut.languages;var l=s[e],f={};for(var m in l)if(l.hasOwnProperty(m)){if(m==i)for(var o in r)r.hasOwnProperty(o)&&(f[o]=r[o]);r.hasOwnProperty(m)||(f[m]=l[m])}var d=s[e];return s[e]=f,Ut.languages.DFS(Ut.languages,function(h,g){g===d&&h!=e&&(this[h]=f)}),f},DFS:function e(i,r,s,l){l=l||{};var f=Ut.util.objId;for(var m in i)if(i.hasOwnProperty(m)){r.call(i,m,i[m],s||m);var o=i[m],d=Ut.util.type(o);d==="Object"&&!l[f(o)]?(l[f(o)]=!0,e(o,r,null,l)):d==="Array"&&!l[f(o)]&&(l[f(o)]=!0,e(o,r,m,l))}}},plugins:{},highlight:function(e,i,r){var s={code:e,grammar:i,language:r};if(Ut.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Ut.tokenize(s.code,s.grammar),Ut.hooks.run("after-tokenize",s),Ba.stringify(Ut.util.encode(s.tokens),s.language)},tokenize:function(e,i){var r=i.rest;if(r){for(var s in r)i[s]=r[s];delete i.rest}var l=new _N;return yl(l,l.head,e),vb(e,l,i,l.head,0),wN(l)},hooks:{all:{},add:function(e,i){var r=Ut.hooks.all;r[e]=r[e]||[],r[e].push(i)},run:function(e,i){var r=Ut.hooks.all[e];if(!(!r||!r.length))for(var s=0,l;l=r[s++];)l(i)}},Token:Ba};function Ba(e,i,r,s){this.type=e,this.content=i,this.alias=r,this.length=(s||"").length|0}function jv(e,i,r,s){e.lastIndex=i;var l=e.exec(r);if(l&&s&&l[1]){var f=l[1].length;l.index+=f,l[0]=l[0].slice(f)}return l}function vb(e,i,r,s,l,f){for(var m in r)if(!(!r.hasOwnProperty(m)||!r[m])){var o=r[m];o=Array.isArray(o)?o:[o];for(var d=0;d<o.length;++d){if(f&&f.cause==m+","+d)return;var h=o[d],g=h.inside,p=!!h.lookbehind,v=!!h.greedy,S=h.alias;if(v&&!h.pattern.global){var E=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,E+"g")}for(var C=h.pattern||h,b=s.next,x=l;b!==i.tail&&!(f&&x>=f.reach);x+=b.value.length,b=b.next){var _=b.value;if(i.length>e.length)return;if(!(_ instanceof Ba)){var y=1,j;if(v){if(j=jv(C,x,e,p),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=x;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,x=N,b.value instanceof Ba)continue;for(var R=b;R!==i.tail&&(N<A||typeof R.value=="string");R=R.next)y++,N+=R.value.length;y--,_=e.slice(x,N),j.index-=x}else if(j=jv(C,0,_,p),!j)continue;var T=j.index,I=j[0],H=_.slice(0,T),G=_.slice(T+I.length),K=x+_.length;f&&K>f.reach&&(f.reach=K);var q=b.prev;H&&(q=yl(i,q,H),x+=H.length),SN(i,q,y);var O=new Ba(m,g?Ut.tokenize(I,g):I,S,I);if(b=yl(i,q,O),G&&yl(i,b,G),y>1){var W={cause:m+","+d,reach:K};vb(e,i,r,b.prev,x,W),f&&W.reach>f.reach&&(f.reach=W.reach)}}}}}}function _N(){var e={value:null,prev:null,next:null},i={value:null,prev:e,next:null};e.next=i,this.head=e,this.tail=i,this.length=0}function yl(e,i,r){var s=i.next,l={value:r,prev:i,next:s};return i.next=l,s.prev=l,e.length++,l}function SN(e,i,r){for(var s=i.next,l=0;l<r&&s!==e.tail;l++)s=s.next;i.next=s,s.prev=i,e.length-=l}function wN(e){for(var i=[],r=e.head.next;r!==e.tail;)i.push(r.value),r=r.next;return i}const bb=Ut;function yb(){}yb.prototype=bb;const Ht=new yb;Ht.highlight=CN;Ht.register=kN;Ht.alias=EN;Ht.registered=jN;Ht.listLanguages=NN;Ht.util.encode=TN;Ht.Token.stringify=eh;function CN(e,i){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let r,s;if(i&&typeof i=="object")r=i;else{if(s=i,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Ht.languages,s))r=Ht.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:bb.highlight.call(Ht,e,r,s)}}function kN(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Ht.languages,e.displayName)||e(Ht)}function EN(e,i){const r=Ht.languages;let s={};typeof e=="string"?i&&(s[e]=i):s=e;let l;for(l in s)if(Object.hasOwn(s,l)){const f=s[l],m=typeof f=="string"?[f]:f;let o=-1;for(;++o<m.length;)r[m[o]]=r[l]}}function jN(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Ht.languages,e)}function NN(){const e=Ht.languages,i=[];let r;for(r in e)Object.hasOwn(e,r)&&typeof e[r]=="object"&&i.push(r);return i}function eh(e,i){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(eh(e[l],i));return s}const r={attributes:{},classes:["token",e.type],content:eh(e.content,i),language:i,tag:"span",type:e.type};return e.alias&&r.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Ht.hooks.run("wrap",r),hN(r.tag+"."+r.classes.join("."),AN(r.attributes),r.content)}function TN(e){return e}function AN(e){let i;for(i in e)Object.hasOwn(e,i)&&(e[i]=xN(e[i]));return e}var ft=sN(Ht,{});ft.registerLanguage=function(e,i){return Ht.register(i)};ft.alias=function(e,i){return Ht.alias(e,i)};Ai.displayName="markup";Ai.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Ai(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(i){i.type==="entity"&&(i.attributes.title=i.content.value.replace(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(r,s){var l={};l["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},l.cdata=/^<!\[CDATA\[|\]\]>$/i;var f={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:l}};f["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var m={};m[r]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return r}),"i"),lookbehind:!0,greedy:!0,inside:f},e.languages.insertBefore("markup","cdata",m)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(i,r){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+i+")"+/\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:[r,"language-"+r],inside:e.languages[r]},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}zl.displayName="css";zl.aliases=[];function zl(e){(function(i){var r=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;i.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+r.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\\((?:"+r.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+r.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+r.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:r,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:/[(){};:,]/},i.languages.css.atrule.inside.rest=i.languages.css;var s=i.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Di.displayName="clike";Di.aliases=[];function Di(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:/[{}[\];(),.:]/}}Ya.displayName="javascript";Ya.aliases=["js"];function Ya(e){e.register(Di),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}Eh.displayName="sql";Eh.aliases=[];function Eh(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:/[;[\]()`,.]/}}Hl.displayName="c";Hl.aliases=[];function Hl(e){e.register(Di),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}jh.displayName="cpp";jh.aliases=[];function jh(e){e.register(Hl),(function(i){var r=/\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 r.source});i.languages.cpp=i.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return r.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:r,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/}),i.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}}),i.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:i.languages.cpp}}}}),i.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),i.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:i.languages.extend("cpp",{})}}),i.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},i.languages.cpp["base-clause"])})(e)}Nh.displayName="bash";Nh.aliases=["sh","shell"];function Nh(e){(function(i){var r="\\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("\\$"+r),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("(\\{)"+r),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})/};i.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;|&]|[<>]\\()"+r),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("\\$?"+r),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=i.languages.bash;for(var f=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],m=l.variable[1].inside,o=0;o<f.length;o++)m[f[o]]=i.languages.bash[f[o]];i.languages.sh=i.languages.bash,i.languages.shell=i.languages.bash})(e)}Th.displayName="yaml";Th.aliases=["yml"];function Th(e){(function(i){var r=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,l="(?:"+s.source+"(?:[ ]+"+r.source+")?|"+r.source+"(?:[ ]+"+s.source+")?)",f=/(?:[^\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}),m=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(d,h){h=(h||"").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,h)}i.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"(?:"+f+"|"+m+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\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:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(m),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:r,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},i.languages.yml=i.languages.yaml})(e)}Ah.displayName="markdown";Ah.aliases=["md"];function Ah(e){e.register(Ai),(function(i){var r=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(o){return o=o.replace(/<inner>/g,function(){return r}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var l=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,f=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return l}),m=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;i.languages.markdown=i.languages.extend("markup",{}),i.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:i.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+f+m+"(?:"+f+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+f+m+")(?:"+f+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(l),inside:i.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+f+")"+m+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+f+"$"),inside:{"table-header":{pattern:RegExp(l),alias:"important",inside:i.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(o){["url","bold","italic","strike","code-snippet"].forEach(function(d){o!==d&&(i.languages.markdown[o].inside.content.inside[d]=i.languages.markdown[d])})}),i.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function d(h){if(!(!h||typeof h=="string"))for(var g=0,p=h.length;g<p;g++){var v=h[g];if(v.type!=="code"){d(v.content);continue}var S=v.content[1],E=v.content[3];if(S&&E&&S.type==="code-language"&&E.type==="code-block"&&typeof S.content=="string"){var C=S.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var b="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,b]:E.alias.push(b):E.alias=[b]}}}d(o.tokens)}),i.hooks.add("wrap",function(o){if(o.type==="code-block"){for(var d="",h=0,g=o.classes.length;h<g;h++){var p=o.classes[h],v=/language-(.+)/.exec(p);if(v){d=v[1];break}}var S=i.languages[d];if(S)o.content=i.highlight(o.content.value,S,d);else if(d&&d!=="none"&&i.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);o.attributes.id=E,i.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(E);C&&(C.innerHTML=i.highlight(C.textContent,i.languages[d],d))})}}}),RegExp(i.languages.markup.tag.pattern.source,"gi"),i.languages.md=i.languages.markdown})(e)}Dh.displayName="ruby";Dh.aliases=["rb"];function Dh(e){e.register(Di),(function(i){i.languages.ruby=i.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:/[(){}[\].,;]/}),i.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var r={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:i.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete i.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;i.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:r,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:r,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:/\./}}}),i.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:r,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:r,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:r,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:r,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:r,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete i.languages.ruby.string,i.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)/}),i.languages.rb=i.languages.ruby})(e)}Rh.displayName="diff";Rh.aliases=[];function Rh(e){(function(i){i.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var r={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(r).forEach(function(s){var l=r[s],f=[];/^\w+$/.test(s)||f.push(/\w+/.exec(s)[0]),s==="diff"&&f.push("bold"),i.languages.diff[s]={pattern:RegExp("^(?:["+l+`].*(?:\r
123
+ ?|
124
+ |(?![\\s\\S])))+`,"m"),alias:f,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(i.languages.diff,"PREFIXES",{value:r})})(e)}Lh.displayName="docker";Lh.aliases=["dockerfile"];function Lh(e){(function(i){var r=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return r}),l=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,f=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return l}),m={pattern:RegExp(l),greedy:!0},o={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(h,g){return h=h.replace(/<OPT>/g,function(){return f}).replace(/<SP>/g,function(){return s}),RegExp(h,g)}i.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:[m,{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:o,string:m,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:o},i.languages.dockerfile=i.languages.docker})(e)}Mh.displayName="go";Mh.aliases=[];function Mh(e){e.register(Di),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"]}Oh.displayName="graphql";Oh.aliases=[];function Oh(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(r){if(r.language!=="graphql")return;var s=r.tokens.filter(function(b){return typeof b!="string"&&b.type!=="comment"&&b.type!=="scalar"}),l=0;function f(b){return s[l+b]}function m(b,x){x=x||0;for(var _=0;_<b.length;_++){var y=f(_+x);if(!y||y.type!==b[_])return!1}return!0}function o(b,x){for(var _=1,y=l;y<s.length;y++){var j=s[y],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(b.test(A))_++;else if(x.test(A)&&(_--,_===0))return y}}return-1}function d(b,x){var _=b.alias;_?Array.isArray(_)||(b.alias=_=[_]):b.alias=_=[],_.push(x)}for(;l<s.length;){var h=s[l++];if(h.type==="keyword"&&h.content==="mutation"){var g=[];if(m(["definition-mutation","punctuation"])&&f(1).content==="("){l+=2;var p=o(/^\($/,/^\)$/);if(p===-1)continue;for(;l<p;l++){var v=f(0);v.type==="variable"&&(d(v,"variable-input"),g.push(v.content))}l=p+1}if(m(["punctuation","property-query"])&&f(0).content==="{"&&(l++,d(f(0),"property-mutation"),g.length>0)){var S=o(/^\{$/,/^\}$/);if(S===-1)continue;for(var E=l;E<S;E++){var C=s[E];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}Bh.displayName="scss";Bh.aliases=[];function Bh(e){e.register(zl),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}Ih.displayName="json";Ih.aliases=["webmanifest"];function Ih(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}zh.displayName="java";zh.aliases=[];function zh(e){e.register(Di),(function(i){var r=/\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:/\./}};i.languages.java=i.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:r,function:[i.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/}),i.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),i.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:r,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 r.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Pl.displayName="typescript";Pl.aliases=["ts"];function Pl(e){e.register(Ya),(function(i){i.languages.typescript=i.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/}),i.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 i.languages.typescript.parameter,delete i.languages.typescript["literal-property"];var r=i.languages.extend("typescript",{});delete r["class-name"],i.languages.typescript["class-name"].inside=r,i.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:r}}}}),i.languages.ts=i.languages.typescript})(e)}Hh.displayName="python";Hh.aliases=["py"];function Hh(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}Fl.displayName="jsx";Fl.aliases=[];function Fl(e){e.register(Ya),e.register(Ai),(function(i){var r=i.util.clone(i.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,l=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,f=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function m(h,g){return h=h.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return l}).replace(/<SPREAD>/g,function(){return f}),RegExp(h,g)}f=m(f).source,i.languages.jsx=i.languages.extend("markup",r),i.languages.jsx.tag.pattern=m(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),i.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,i.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,i.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,i.languages.jsx.tag.inside.comment=r.comment,i.languages.insertBefore("inside","attr-name",{spread:{pattern:m(/<SPREAD>/.source),inside:i.languages.jsx}},i.languages.jsx.tag),i.languages.insertBefore("inside","special-attr",{script:{pattern:m(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:i.languages.jsx}}},i.languages.jsx.tag);var o=function(h){return h?typeof h=="string"?h:typeof h.content=="string"?h.content:h.content.map(o).join(""):""},d=function(h){for(var g=[],p=0;p<h.length;p++){var v=h[p],S=!1;if(typeof v!="string"&&(v.type==="tag"&&v.content[0]&&v.content[0].type==="tag"?v.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===o(v.content[0].content[1])&&g.pop():v.content[v.content.length-1].content==="/>"||g.push({tagName:o(v.content[0].content[1]),openedBraces:0}):g.length>0&&v.type==="punctuation"&&v.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&v.type==="punctuation"&&v.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof v=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=o(v);p<h.length-1&&(typeof h[p+1]=="string"||h[p+1].type==="plain-text")&&(E+=o(h[p+1]),h.splice(p+1,1)),p>0&&(typeof h[p-1]=="string"||h[p-1].type==="plain-text")&&(E=o(h[p-1])+E,h.splice(p-1,1),p--),h[p]=new i.Token("plain-text",E,null,E)}v.content&&typeof v.content!="string"&&d(v.content)}};i.hooks.add("after-tokenize",function(h){h.language!=="jsx"&&h.language!=="tsx"||d(h.tokens)})})(e)}Ph.displayName="tsx";Ph.aliases=[];function Ph(e){e.register(Fl),e.register(Pl),(function(i){var r=i.util.clone(i.languages.typescript);i.languages.tsx=i.languages.extend("jsx",r),delete i.languages.tsx.parameter,delete i.languages.tsx["literal-property"];var s=i.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}Fh.displayName="rust";Fh.aliases=[];function Fh(e){(function(i){for(var r=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)r=r.replace(/<self>/g,function(){return r});r=r.replace(/<self>/g,function(){return/[^\s\S]/.source}),i.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+r),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:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},i.languages.rust["closure-params"].inside.rest=i.languages.rust,i.languages.rust.attribute.inside.string=i.languages.rust.string})(e)}Uh.displayName="toml";Uh.aliases=[];function Uh(e){(function(i){var r=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(l){return l.replace(/__/g,function(){return r})}i.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 _l={'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%)"}};ft.registerLanguage("typescript",Pl);ft.registerLanguage("javascript",Ya);ft.registerLanguage("tsx",Ph);ft.registerLanguage("jsx",Fl);ft.registerLanguage("python",Hh);ft.registerLanguage("bash",Nh);ft.registerLanguage("json",Ih);ft.registerLanguage("css",zl);ft.registerLanguage("html",Ai);ft.registerLanguage("markup",Ai);ft.registerLanguage("xml",Ai);ft.registerLanguage("sql",Eh);ft.registerLanguage("yaml",Th);ft.registerLanguage("markdown",Ah);ft.registerLanguage("diff",Rh);ft.registerLanguage("rust",Fh);ft.registerLanguage("go",Mh);ft.registerLanguage("java",zh);ft.registerLanguage("c",Hl);ft.registerLanguage("cpp",jh);ft.registerLanguage("ruby",Dh);ft.registerLanguage("toml",Uh);ft.registerLanguage("scss",Bh);ft.registerLanguage("graphql",Oh);ft.registerLanguage("docker",Lh);const DN={code({className:e,children:i,...r}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(i).includes(`
125
+ `))return c.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...r,children:i});const f=(s==null?void 0:s[1])||"text",m=String(i).replace(/\n$/,""),[o,d]=F.useState(!1),h=async()=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(m);else{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.left="-9999px",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}d(!0),setTimeout(()=>d(!1),2e3)}catch(g){console.error("Failed to copy:",g)}};return c.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[c.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:[c.jsx("span",{children:f}),c.jsx("button",{type:"button",onClick:g=>{g.preventDefault(),g.stopPropagation(),h()},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:o?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsx(ft,{style:_l,language:f,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:m})})]})},p({children:e}){return c.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return c.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return c.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return c.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return c.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return c.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return c.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 c.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 c.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:i}){return c.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:i})},blockquote({children:e}){return c.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 c.jsx("div",{className:"overflow-x-auto my-1.5",children:c.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return c.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 c.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return c.jsx("hr",{className:"border-border my-2"})},input({checked:e,...i}){return c.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...i})}},As=F.memo(function({content:i,className:r=""}){const s=F.useMemo(()=>{let l=RN(i);return l=LN(l),l},[i]);return c.jsx("div",{className:`markdown-content [&_li>p]:inline ${r}`,children:c.jsx(wE,{remarkPlugins:[B5],components:DN,children:s})})});function RN(e){let i=e.replace(/^(\s*)•\s/gm,"$1- ");return i=i.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),i}function LN(e){const i=/```/g,r=e.match(i);if(((r==null?void 0:r.length)??0)%2===1){const l=e.lastIndexOf("```");return e.slice(l+3).includes(`
126
+ `),e+"\n```"}return e}const MN=F.memo(function({content:i,variant:r="default"}){return r==="labeled"?c.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[c.jsx("span",{className:"text-purple-400",children:"thinking:"}),c.jsx("div",{className:"ml-1.5 mt-0.5",children:c.jsx(As,{content:i})})]}):c.jsx("div",{className:"text-text-muted text-sm italic bg-bg-tertiary/50 rounded p-1.5 feed-item whitespace-pre-wrap",children:i})});function _b({tool:e,className:i="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?c.jsx("svg",{className:i,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"?c.jsx("svg",{className:i,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}):c.jsx("svg",{className:i,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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 ON={..._l,'pre[class*="language-"]':{..._l['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{..._l['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},BN={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 Ul(e){var l;if(!e)return"text";const i=e.split("/").pop()??"",r=i.toLowerCase();if(r==="dockerfile")return"docker";if(r==="makefile")return"makefile";if(r==="cmakelists.txt")return"cmake";const s=(l=i.split(".").pop())==null?void 0:l.toLowerCase();return s?BN[s]??"text":"text"}const Sb={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},IN={...Sb,display:"inline"},zN={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},Ua=F.memo(function({code:i,language:r,variant:s}){const l=s==="inline"?"span":s==="block-nowrap"?"div":"pre",f=s==="inline"?IN:s==="block-nowrap"?Sb:zN;return c.jsx(ft,{style:ON,language:r,PreTag:l,customStyle:f,children:i})});function wb({src:e,alt:i,isOpen:r,onClose:s}){const l=F.useRef(null);F.useEffect(()=>{if(!r)return;const m=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r,s]);const f=m=>{m.target===m.currentTarget&&s()};return r?c.jsx("div",{ref:l,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:f,role:"dialog","aria-modal":"true","aria-label":"Image viewer",children:c.jsxs("div",{className:"relative max-w-[95vw] max-h-[95vh] flex items-center justify-center",children:[c.jsx("button",{onClick:s,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors p-2","aria-label":"Close image viewer",children:c.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),c.jsx("img",{src:e,alt:i,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"})]})}):null}const HN=F.memo(function({oldString:i,newString:r,filePath:s}){const l=F.useMemo(()=>Ul(s),[s]),f=i.split(`
127
+ `),m=r.split(`
128
+ `),o=i.length>0,d=r.length>0;return!o&&!d?c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):c.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"bg-red-400/60"}),c.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:f.map((h,g)=>c.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),c.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:c.jsx(Ua,{code:i,language:l,variant:"block-nowrap"})})]}),d&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"bg-green-400/60"}),c.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:m.map((h,g)=>c.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),c.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:c.jsx(Ua,{code:r,language:l,variant:"block-nowrap"})})]})]})}),PN=F.memo(function({content:i,filePath:r}){const s=F.useMemo(()=>Ul(r),[r]);return c.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:c.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[c.jsx("div",{className:"bg-green-400/60"}),c.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:i.split(`
129
+ `).map((l,f)=>c.jsx("div",{className:"leading-[1.5rem]",children:"+"},f))}),c.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:c.jsx(Ua,{code:i,language:s,variant:"block"})})]})})}),FN=F.memo(function({regions:i,filePath:r}){const s=F.useMemo(()=>Ul(r),[r]);return i.length===0?c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):c.jsx("div",{className:"space-y-2",children:i.map((l,f)=>c.jsx(UN,{region:l,language:s},f))})}),UN=F.memo(function({region:i,language:r}){const s=$N(i),l=Math.max(...i.beforeContext.map(m=>m.lineNumber),...i.afterContext.map(m=>m.lineNumber),...i.edits.flatMap(m=>[m.startLine,m.endLine])),f=String(l).length;return c.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((m,o)=>c.jsx(qN,{item:m,language:r,lineNumWidth:f},o))})});function $N(e){const i=[];for(const r of e.beforeContext)i.push({type:"context",lineNumber:r.lineNumber,content:r.content});for(const r of e.edits){const s=r.oldContent.split(`
130
+ `);for(let f=0;f<s.length;f++)i.push({type:"removed",lineNumber:r.startLine+f,content:s[f]});const l=r.newContent.split(`
131
+ `);for(let f=0;f<l.length;f++)i.push({type:"added",lineNumber:r.startLine+f,content:l[f]})}for(const r of e.afterContext)i.push({type:"context",lineNumber:r.lineNumber,content:r.content});return i}const qN=F.memo(function({item:i,language:r,lineNumWidth:s}){const l=String(i.lineNumber).padStart(s," "),f=i.type==="context"?"bg-bg-secondary":i.type==="removed"?"bg-red-950/30":"bg-green-950/30",m=i.type==="context"?"text-text-muted":i.type==="removed"?"text-red-400/70":"text-green-400/70",o=i.type==="context"?" ":i.type==="removed"?"-":"+",d=i.type==="removed"?"line-through decoration-red-400/30":"",h=i.type==="context"?"bg-transparent":i.type==="removed"?"bg-red-400/60":"bg-green-400/60";return c.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${f}`,children:[c.jsx("div",{className:h}),c.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:l}),c.jsx("div",{className:`text-center select-none leading-[1.5rem] ${m}`,children:o}),c.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:c.jsx(Ua,{code:i.content||" ",language:r,variant:"inline"})})]})}),WN=F.memo(function({result:i,metadata:r,filePath:s,heightExpanded:l=!1}){const[f,m]=F.useState(!1),o=F.useMemo(()=>Ul(s),[s]),d=r==null?void 0:r.mimeType,h=r==null?void 0:r.base64Data;if(d!=null&&d.startsWith("image/")&&h){const v=`data:${d};base64,${h}`;return c.jsxs(c.Fragment,{children:[c.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:()=>m(!0),children:c.jsx("img",{src:v,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),c.jsx(wb,{src:v,alt:s,isOpen:f,onClose:()=>m(!1)})]})}if(!i)return c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=i.split(`
132
+ `),p=g.filter(v=>!v.startsWith(`
133
+ [`)&&!v.startsWith("[")).map(v=>v.replace(/^\d+: /,"")).join(`
134
+ `);return c.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto`,children:c.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[c.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(v=>!v.startsWith(`
135
+ [`)&&!v.startsWith("[")).map((v,S)=>{const E=v.match(/^(\d+): /);return c.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:S+1},S)})}),c.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:c.jsx(Ua,{code:p,language:o,variant:"block"})})]})})}),GN={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"}},Nv=F.memo(function({diagnostics:i}){if(i.length===0)return null;const r=i.filter(f=>f.severity==="error"),s=i.filter(f=>f.severity==="warning"),l=i.filter(f=>f.severity==="info"||f.severity==="hint");return c.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[c.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[c.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),r.length>0&&c.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[r.length," error",r.length!==1?"s":""]}),s.length>0&&c.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),l.length>0&&c.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),c.jsx("div",{className:"max-h-48 overflow-y-auto",children:i.map((f,m)=>{const o=GN[f.severity];return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${o.bg} border-b border-border last:border-b-0`,children:[c.jsx("span",{className:`${o.color} text-xs flex-shrink-0 w-4 text-center`,children:o.icon}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",f.range.start.line+1,":",f.range.start.character+1]}),f.code&&c.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",f.code,"]"]})]}),c.jsx("div",{className:"text-xs text-text-primary break-words",children:f.message})]})]},m)})})]})}),VN=F.memo(function({command:i,timeout:r,startedAt:s,streamingOutput:l,status:f,result:m,error:o,durationMs:d}){const h=F.useRef(null),[g,p]=F.useState(0);F.useEffect(()=>{h.current&&f==="pending"&&(h.current.scrollTop=h.current.scrollHeight)},[l,f]),F.useEffect(()=>{if(f!=="pending"||!s)return;const C=setInterval(()=>{p(Date.now()-s)},100);return()=>clearInterval(C)},[f,s]);const v=r/1e3,S=f==="pending"?g/1e3:(d??0)/1e3,E=f==="pending"?(l==null?void 0:l.map(C=>C.content).join(""))??"":m??"";return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[c.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),c.jsx("code",{className:"text-text-primary break-all",children:i})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[f==="pending"&&c.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),f==="interrupted"&&c.jsx("span",{className:"text-red-400",children:"interrupted"}),c.jsxs("span",{className:f==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",v,"s"]})]})]}),f==="pending"&&c.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:c.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/r*100)}%`}})}),(E||f==="pending")&&c.jsx("pre",{ref:h,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${f==="pending"?"border border-accent-warning/30":""}`,children:f==="pending"&&l?l.map((C,b)=>c.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:wl(C.content)},b)):wl(E)}),f==="error"&&o&&c.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:o}),f!=="pending"&&d!==void 0&&c.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function YN(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 KN({confirmation:e}){const i=Ee(g=>g.confirmPath),r=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:l,description:f}=YN(e.reason),m=e.reason==="sensitive_file"||e.reason==="both",o=m?"border-red-500/50":"border-amber-500/50",d=m?"bg-red-500/10":"bg-amber-500/10",h=()=>{r!=null&&r.id&&s("dangerous"),i(e.callId,!0,!1)};return c.jsxs("div",{className:`border ${o} ${d} rounded p-3 my-2`,children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("svg",{className:`w-4 h-4 ${m?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:`text-sm font-medium ${m?"text-red-400":"text-amber-400"}`,children:l}),c.jsx("div",{className:"text-xs text-text-muted",children:f})]})]}),c.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[c.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),c.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:c.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,p)=>c.jsx("li",{className:`text-xs font-mono ${m?"text-red-300":"text-amber-300"} break-all`,children:g},p))})}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:()=>i(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"}),c.jsx("button",{onClick:()=>i(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"}),c.jsx("button",{onClick:h,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 XN(e,i){if(e==="read_file"){const s=String(i.path??""),l=i.offset,f=i.limit,m=[];return l!==void 0&&l!==1&&m.push(`offset=${l}`),f!==void 0&&m.push(`limit=${f}`),m.length>0?`${s} [${m.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(i.path??"");if(e==="run_command"||e==="bash")return String(i.command??"");if(e==="return_value"){const s=String(i.content??"");return s.length>60?s.slice(0,60)+"...":s}const r=JSON.stringify(i);return r.length>50?r.slice(0,50)+"...":r}function Tv(e,i,r){return XN(e,i)}function ZN(e){return JSON.stringify(e,null,2)}const QN={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}},JN=F.memo(function({tool:i,args:r,status:s,variant:l="compact",result:f,error:m,durationMs:o,diagnostics:d,editContext:h,startedAt:g,streamingOutput:p,metadata:v,callId:S}){const E=i==="edit_file"||i==="write_file",C=i==="run_command"&&s==="pending",b=i==="read_file",x=i==="return_value",[_,y]=F.useState(E||C||x),j=QN[s],A=Ee(R=>R.pendingPathConfirmation),N=s==="pending"&&A&&S&&A.callId===S?A:null;return l==="compact"?c.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[c.jsx(_b,{tool:i}),c.jsx("span",{className:"text-accent-primary font-medium",children:i}),c.jsx("span",{className:"text-text-muted truncate flex-1",children:Tv(i,r)}),c.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):c.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[c.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>y(!_),children:[c.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),c.jsx("span",{className:"font-mono text-accent-primary text-sm",children:i}),c.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Tv(i,r)}),c.jsx("span",{className:"text-text-muted text-xs",children:_?"▼":"▶"})]}),N&&c.jsx(KN,{confirmation:N}),(_||b)&&c.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[i==="run_command"&&c.jsx(VN,{command:String(r.command??""),timeout:r.timeout??12e4,startedAt:g,streamingOutput:p,status:s,result:f,error:m,durationMs:o}),i==="edit_file"&&s==="success"&&c.jsxs(c.Fragment,{children:[h&&h.regions.length>0?c.jsx(FN,{regions:h.regions,filePath:String(r.path??"")}):c.jsx(HN,{oldString:String(r.old_string??""),newString:String(r.new_string??""),filePath:String(r.path??"")}),d&&d.length>0&&c.jsx(Nv,{diagnostics:d})]}),i==="write_file"&&s==="success"&&c.jsxs(c.Fragment,{children:[c.jsx(PN,{content:String(r.content??""),filePath:String(r.path??"")}),d&&d.length>0&&c.jsx(Nv,{diagnostics:d})]}),i==="read_file"&&s==="success"&&c.jsx(WN,{result:f,metadata:v,filePath:String(r.path??""),heightExpanded:_}),i==="return_value"&&(()=>{const R=(p==null?void 0:p.map(I=>I.content).join(""))??"",T=s==="pending"&&R?R:String(r.content??"");return c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),c.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:c.jsx(As,{content:T})})]})})(),i!=="edit_file"&&i!=="write_file"&&i!=="run_command"&&i!=="read_file"&&i!=="return_value"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:ZN(r)})]}),s==="success"&&f!==void 0&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",o!==void 0&&` (${o}ms)`,":"]}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:f||"No output"})]})]}),s==="success"&&(i==="edit_file"||i==="write_file"||i==="read_file")&&o!==void 0&&c.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",o,"ms"]}),s==="error"&&m&&i!=="run_command"&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:m})]})]})]})}),e3={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 t3(e){return e3[e]??`Preparing ${e}`}const n3=F.memo(function({name:i}){const r=t3(i);return c.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:c.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[c.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),c.jsx(_b,{tool:i}),c.jsx("span",{className:"font-mono text-accent-primary text-sm",children:i}),c.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[r,"..."]})]})})}),r3={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},i3=F.memo(function({todos:i}){return Array.isArray(i)?i.length===0?c.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):c.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[c.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:c.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),c.jsx("div",{children:i.map((r,s)=>{const l=r3[r.status];return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[c.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)??"○"}),c.jsx("span",{className:`text-sm leading-tight ${r.status==="completed"?"text-text-muted":"text-text-primary"}`,children:r.content})]},s)})})]}):c.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Av={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"}},Cb=F.memo(function({toolCalls:i,criteria:r}){if(i.length===0)return null;const s=new Map((r==null?void 0:r.map(l=>[l.id,l]))??[]);return c.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[c.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:c.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),c.jsx("div",{children:i.map((l,f)=>{const m=l.arguments.action,o=m&&Av[m]?Av[m]:{icon:"○",color:"text-text-muted"},d=l.arguments,h=d.id,g=d.description,p=h?s.get(h):void 0,v=g??(p==null?void 0:p.description)??"Criterion updated",S=d.reason,E=m==="remove",C=m==="fail";return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${f>0?"border-t border-border":""}`,children:[c.jsx("span",{className:`${o.color} text-sm leading-tight flex-shrink-0`,children:o.icon}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:E?"line-through text-text-muted":"",children:c.jsx(As,{content:v})}),S&&c.jsxs("div",{className:`mt-1 text-sm ${C?"text-accent-error":"text-text-muted"}`,children:[c.jsx("span",{className:"text-text-muted",children:"└ "}),'"',S,'"']})]})]},l.id??f)})})]})});function s3(e){return e==="criterion"}const a3="#6b7280";function Nl(e,i){var r;return((r=e.find(s=>s.id===i))==null?void 0:r.color)??a3}const tn=Yn((e,i)=>({agents:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await fetch("/api/agents/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchAgents:async()=>{e({loading:!0});try{const s=await(await fetch("/api/agents")).json();e({agents:s.agents??[],defaultIds:s.defaultIds??i().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchAgent:async r=>{try{const s=await fetch(`/api/agents/${r}`);return s.ok?await s.json():null}catch{return null}},createAgent:async r=>{try{const s=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return s.ok?(await i().fetchAgents(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateAgent:async(r,s)=>{try{const l=await fetch(`/api/agents/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await i().fetchAgents(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteAgent:async r=>{try{return(await fetch(`/api/agents/${r}`,{method:"DELETE"})).ok?(e({agents:i().agents.filter(l=>l.id!==r)}),!0):!1}catch{return!1}},restoreDefault:async r=>{try{return(await fetch(`/api/agents/${r}/restore-default`,{method:"POST"})).ok?(await i().fetchAgents(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await fetch("/api/agents/restore-all-defaults",{method:"POST"})).ok?(await i().fetchAgents(),!0):!1}catch{return!1}}}));function o3(e){const i=[];let r=[];const s=()=>{r.length>0&&(i.push({type:"criteria_group",toolCalls:r}),r=[])};for(const l of e)l.type==="tool_call"&&s3(l.toolCall.name)?r.push(l.toolCall):(s(),i.push(l));return s(),i}function l3(e,i){if(e.segments&&e.segments.length>0)return c3(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,i);const r=[];if(e.thinkingContent&&r.push({type:"thinking",content:e.thinkingContent}),e.content&&r.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)r.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)r.push({type:"preparing_tool_call",preparing:s});return i&&e.stats&&r.push({type:"stats",stats:e.stats}),r}function c3(e,i,r,s,l){const f=[],m=new Map(i.map(o=>[o.id,o]));for(const o of e)switch(o.type){case"text":f.push({type:"text",content:o.content});break;case"thinking":o.content&&o.content.trim().length>0&&f.push({type:"thinking",content:o.content});break;case"tool_call":{const d=m.get(o.toolCallId);d&&f.push({type:"tool_call",toolCall:d});break}}for(const o of r)f.push({type:"preparing_tool_call",preparing:o});return l&&s&&f.push({type:"stats",stats:s}),f}const $h=F.memo(function({message:i,showStats:r=!0}){const s=Ee(o=>{var d;return(d=o.currentSession)==null?void 0:d.criteria}),l=tn(o=>o.agents),f=l3(i,r),m=o3(f);return m.length===0?null:c.jsx("div",{className:"feed-item",children:c.jsxs("div",{className:"min-w-0",children:[m.map((o,d)=>{var h,g;switch(o.type){case"thinking":return c.jsx(MN,{content:o.content},d);case"text":return c.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:c.jsx(As,{content:o.content})},d);case"preparing_tool_call":return c.jsx(n3,{name:o.preparing.name},`preparing-${o.preparing.index}`);case"tool_call":{const p=o.toolCall,v=p.result;if(p.name==="todo_write"){const C=p.arguments.todos,b=Array.isArray(C)?C:[];return c.jsx(i3,{todos:b},d)}const S=(h=v==null?void 0:v.output)==null?void 0:h.includes("[interrupted by user]"),E=v?S?"interrupted":v.success?"success":"error":"pending";return c.jsx(JN,{tool:p.name,args:p.arguments,status:E,variant:"expandable",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:p.startedAt,streamingOutput:p.streamingOutput,metadata:v==null?void 0:v.metadata,callId:p.id},d)}case"criteria_group":return c.jsx(Cb,{toolCalls:o.toolCalls,criteria:s},d);case"stats":{const p=o.stats,v=((g=p.model.split("/").pop())==null?void 0:g.split("-").slice(0,2).join("-"))??p.model,S=Nl(l,p.mode),E=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toString(),C=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toFixed(1);return c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[c.jsx("span",{className:"flex-1 h-px bg-border"}),c.jsx("span",{className:"text-text-secondary",children:v}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsx("span",{style:{color:S},children:p.mode}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[p.totalTime.toFixed(1),"s"]}),p.toolTime>0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[p.toolTime.toFixed(1),"s tools"]})]}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[E(p.prefillTokens)," @ ",C(p.prefillSpeed)," pp"]}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[E(p.generationTokens)," @ ",C(p.generationSpeed)," tg"]}),c.jsx("span",{className:"flex-1 h-px bg-border"})]},d)}}}),i.partial&&c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[c.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{children:"Aborted"})]})]})})}),$t=Yn((e,i)=>({workflows:[],defaultIds:[],modifiedIds:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await fetch("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchDefaultIds:async()=>{try{const s=await(await fetch("/api/workflows/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await fetch("/api/workflows")).json();e({workflows:s.workflows??[],activeWorkflowId:s.activeWorkflowId??"default",defaultIds:s.defaultIds??i().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async r=>{try{const s=await fetch(`/api/workflows/${r}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async r=>{try{const s=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return s.ok?(await i().fetchWorkflows(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateWorkflow:async(r,s)=>{try{const l=await fetch(`/api/workflows/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await i().fetchWorkflows(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteWorkflow:async r=>{try{return(await fetch(`/api/workflows/${r}`,{method:"DELETE"})).ok?(e({workflows:i().workflows.filter(l=>l.id!==r)}),!0):!1}catch{return!1}},restoreDefault:async r=>{try{return(await fetch(`/api/workflows/${r}/restore-default`,{method:"POST"})).ok?(await i().fetchWorkflows(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await fetch("/api/workflows/restore-all-defaults",{method:"POST"})).ok?(await i().fetchWorkflows(),!0):!1}catch{return!1}}}));function u3(e){if(e<60)return`${e}s`;const i=Math.floor(e/60),r=Math.round(e%60);return r>0?`${i}m ${r}s`:`${i}m`}function d3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Dv(e,i){const r=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${r},${s},${l},${i})`}const h3=F.memo(function({data:i}){var l;const s=((l=$t(f=>f.workflows).find(f=>f.id===i.workflowId))==null?void 0:l.color)??i.workflowColor??"#8b949e";return c.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Dv(s,.3),backgroundColor:Dv(s,.08)},children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:s,viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"text-sm font-medium",style:{color:s},children:i.workflowName??"Task Completed"})]}),c.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[c.jsx(Da,{label:"Iterations",value:String(i.iterations)}),c.jsx(Da,{label:"Total time",value:u3(i.totalTimeSeconds)}),c.jsx(Da,{label:"Tool calls",value:String(i.totalToolCalls)}),c.jsx(Da,{label:"Tokens",value:d3(i.totalTokensGenerated)}),c.jsx(Da,{label:"Speed",value:i.avgGenerationSpeed>0?`${i.avgGenerationSpeed} tok/s`:"-"})]})]})});function Da({label:e,value:i}){return c.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[c.jsx("div",{className:"text-sm text-text-muted",children:e}),c.jsx("div",{className:"text-sm text-text-primary font-medium",children:i})]})}function Rv(e,i){const r=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${r},${s},${l},${i})`}const f3=F.memo(function({data:i}){var l;const s=((l=$t(f=>f.workflows).find(f=>f.id===i.workflowId))==null?void 0:l.color)??i.workflowColor??"#6b7280";return c.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Rv(s,.3),backgroundColor:Rv(s,.08)},children:[c.jsx("svg",{className:"w-3 h-3 shrink-0",fill:s,viewBox:"0 0 24 24",children:c.jsx("path",{d:"M8 5v14l11-7z"})}),c.jsx("span",{className:"text-sm font-medium",style:{color:s},children:i.workflowName}),c.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function p3({attachments:e,messageId:i}){const[r,s]=F.useState(null),l=Ee(g=>g.visionFallbackByMessage),f=Ee(g=>g.messages),m=F.useMemo(()=>{const g=f.findIndex(p=>p.id===i);if(g===-1)return null;for(let p=g+1;p<f.length;p++){const v=f[p];if(v&&v.role==="assistant")return v.id}return null},[f,i]),o=g=>{s(g)},d=()=>{s(null)},h=g=>{const p=`${i}-${g}`;if(l[p])return l[p];if(m){const v=`${m}-${g}`;return l[v]}return null};return e.length===0?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const p=h(g.id);return c.jsxs("div",{className:"relative inline-block",children:[c.jsxs("button",{onClick:()=>o(g.data),className:"group relative inline-block",title:g.filename,disabled:(p==null?void 0:p.type)==="start",children:[c.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"}),(p==null?void 0:p.type)==="start"&&c.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:c.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(p==null?void 0:p.type)==="done"&&p.description&&c.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[p.description.slice(0,200),p.description.length>200?"...":""]})]},g.id)})}),r&&c.jsx(wb,{src:r,alt:"Attached image",isOpen:!0,onClose:d})]})}function m3({isOpen:e,onClose:i,promptContext:r}){const[s,l]=F.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),f=m=>{l(o=>({...o,[m]:!o[m]}))};return c.jsx(xn,{isOpen:e,onClose:i,title:"Prompt Inspector",size:"lg",children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(vs,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>f("userMessage"),children:c.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:r.userMessage||"(empty)"})}),r.messages.length>0&&c.jsx(vs,{title:`Prompt Messages (${r.messages.length})`,expanded:s.messages??!0,onToggle:()=>f("messages"),children:c.jsx("div",{className:"space-y-2",children:r.messages.map((m,o)=>c.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[c.jsx("span",{className:"font-mono text-text-primary",children:m.role}),c.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:m.source}),m.toolCallId&&c.jsx("span",{className:"font-mono",children:m.toolCallId}),m.attachments&&m.attachments.length>0&&c.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[m.attachments.length," attachment",m.attachments.length===1?"":"s"]})]}),m.attachments&&m.attachments.length>0&&c.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:m.attachments.map(d=>d.filename).join(", ")}),c.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:m.content||"(empty)"})]},`${m.role}-${o}`))})}),c.jsx(vs,{title:`Tools (${r.tools.length})`,expanded:s.tools??!0,onToggle:()=>f("tools"),children:c.jsxs("div",{className:"space-y-2",children:[r.tools.length===0&&c.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),r.tools.map((m,o)=>c.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"font-mono text-sm text-text-primary",children:m.name}),c.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),c.jsx("div",{className:"text-sm text-text-secondary",children:m.description}),c.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(m.parameters,null,2)})]},`${m.name}-${o}`))]})}),c.jsx(vs,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>f("requestOptions"),children:c.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(r.requestOptions,null,2)})}),r.injectedFiles.length>0&&c.jsx(vs,{title:`Injected Files (${r.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>f("injectedFiles"),children:c.jsx("div",{className:"space-y-2",children:r.injectedFiles.map((m,o)=>c.jsx(g3,{file:m,expanded:s[`file-${o}`]??!1,onToggle:()=>f(`file-${o}`)},o))})}),c.jsx(vs,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>f("systemPrompt"),badge:`${Math.round(r.systemPrompt.length/1e3)}K chars`,children:c.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:r.systemPrompt})})]})})}function g3({file:e,expanded:i,onToggle:r}){return c.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[c.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[c.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${i?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),c.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}),c.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&c.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),i&&e.content&&c.jsx("div",{className:"border-t border-border/50 p-2",children:c.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function vs({title:e,expanded:i,onToggle:r,badge:s,children:l}){return c.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[c.jsx("button",{onClick:r,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${i?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),c.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&c.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),i&&c.jsx("div",{className:"p-3 border-t border-border",children:l})]})}function x3({content:e,promptContext:i,align:r="right"}){const[s,l]=F.useState(!1),[f,m]=F.useState(!1),[o,d]=F.useState(!1),h=F.useRef(null);F.useEffect(()=>{const v=S=>{h.current&&!h.current.contains(S.target)&&l(!1)};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const v=document.createElement("textarea");v.value=e,v.style.position="fixed",v.style.left="-999999px",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)}d(!0),l(!1),window.setTimeout(()=>d(!1),1500)}catch(v){console.error("Failed to copy:",v)}},p=r==="right";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`flex items-start gap-1.5 ${p?"":"order-first"}`,children:[o&&c.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),c.jsxs("div",{ref:h,className:"relative",children:[c.jsx("button",{onClick:()=>l(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&c.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${p?"right-0":"left-0"}`,children:[c.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:[c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"]}),i&&c.jsxs("button",{onClick:()=>{m(!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:[c.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),c.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"]})]})]})]}),i&&c.jsx(m3,{isOpen:f,onClose:()=>m(!1),promptContext:i})]})}function v3({message:e}){const[i,r]=F.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,l=(s==null?void 0:s.color)??"#6b7280",f=(s==null?void 0:s.name)??"Agent",m=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[m]??"injected",h=m==="workflow"||m==="subagent";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[c.jsx("span",{className:"flex-1 h-px bg-border"}),c.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${h?"":"cursor-pointer"}`,style:{backgroundColor:l},onClick:()=>!h&&r(!0)}),c.jsx("span",{className:h?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},onClick:()=>!h&&r(!0),children:f}),c.jsx("span",{children:"·"}),c.jsx("span",{className:h?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!h&&r(!0),children:d}),c.jsx("span",{className:"flex-1 h-px bg-border"})]}),h&&c.jsx("div",{className:"flex justify-center feed-item mb-4",children:c.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${l}`},children:c.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),c.jsx(xn,{isOpen:i,onClose:()=>r(!1),title:`${f} Prompt`,size:"lg",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l}}),c.jsx("span",{className:"text-sm text-text-primary font-medium",children:f}),c.jsxs("span",{className:"text-xs text-text-muted",children:["(",m,")"]})]}),c.jsx("div",{className:"h-full min-h-96",children:c.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 b3({message:e,promptContext:i}){const r=e.messageKind==="auto-prompt",s=e.messageKind==="command",l=e.isSystemGenerated;return c.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!l&&c.jsx(x3,{content:e.content,promptContext:i,align:"right"}),c.jsxs("div",{className:`max-w-[75%] rounded p-2 ${l?s?"bg-teal-500/10 border border-teal-500/30":r?"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&&c.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":r?"text-slate-400":"text-amber-400"}`,children:s?"Command":r?"Auto":"System"}),c.jsx("div",{className:`whitespace-pre-wrap text-sm ${l?`${s?"text-teal-200":r?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&c.jsx(p3,{attachments:e.attachments,messageId:e.id})]})]})}const kb=F.memo(function({message:i,isLastAssistantMessage:r=!1,promptContext:s}){const l=i.role==="user",f=i.role==="assistant",m=i.role==="system",o=i.role==="tool";if(f)return c.jsx($h,{message:i,showStats:r});if(m&&i.isCompacted)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[c.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),c.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:i.content.replace(`[COMPACTED HISTORY]
136
+ `,"")})]});if(o)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[c.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",i.toolName]}),c.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[i.content.slice(0,500),i.content.length>500&&"..."]})]});if(o)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[c.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",i.toolName]}),c.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[i.content.slice(0,500),i.content.length>500&&"..."]})]});if(i.messageKind==="workflow-started")try{const d=JSON.parse(i.content);return c.jsx(f3,{data:d})}catch{}if(i.messageKind==="task-completed")try{const d=JSON.parse(i.content);return c.jsx(h3,{data:d})}catch{}return i.messageKind==="context-reset"?c.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[c.jsx("div",{className:"flex-1 border-t border-border"}),c.jsx("span",{children:i.content}),c.jsx("div",{className:"flex-1 border-t border-border"})]}):i.messageKind==="auto-prompt"&&i.isSystemGenerated?c.jsx(v3,{message:i}):l?c.jsx(b3,{message:i,promptContext:s}):c.jsx("div",{className:"flex justify-start feed-item",children:c.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:c.jsx(As,{content:i.content})})})}),y3={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function _3(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}const S3=F.memo(function({messages:i,subAgentType:r,isStreaming:s}){const l=F.useRef(null),f=F.useRef(null),[m,o]=F.useState(!1),[d,h]=F.useState(!1),g=tn(y=>y.agents),p=F.useCallback(()=>{const y=!d;h(y),y&&setTimeout(()=>{var j;(j=l.current)==null||j.scrollIntoView({block:"start",behavior:"smooth"})},220)},[d]),v=F.useCallback(()=>{const y=f.current;y&&(y.scrollTop=y.scrollHeight)},[]),S=F.useCallback(y=>{const j=f.current;j&&(y.deltaY<0?o(!0):y.deltaY>0&&m&&requestAnimationFrame(()=>{j.scrollHeight-j.scrollTop-j.clientHeight<50&&o(!1)}))},[m]);F.useEffect(()=>{m||v()},[i,m,v]),F.useEffect(()=>{s||o(!1)},[s]);const E=g.find(y=>y.id===r),C=(E==null?void 0:E.name)??y3[r]??r,b=Nl(g,r),x=_3(b),_=i.filter(y=>y.role!=="tool");return c.jsxs("div",{ref:l,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[c.jsxs("button",{className:"w-full flex items-center justify-between px-2 py-1 text-xs font-medium border-b hover:opacity-80 transition-opacity",style:x,onClick:p,children:[c.jsx("span",{children:C}),c.jsx("span",{className:"text-[10px]",children:d?"▼":"▶"})]}),c.jsx("div",{ref:f,onWheel:S,className:`${d?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:_.map(y=>y.role==="assistant"?c.jsx($h,{message:y,showStats:!0},y.id):c.jsx(kb,{message:y,isLastAssistantMessage:!1},y.id))})]})});function w3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function C3({isOpen:e,onClose:i,initialEditId:r}){const s=tn(he=>he.agents),l=tn(he=>he.modifiedIds),f=tn(he=>he.loading),m=tn(he=>he.fetchAgents),o=tn(he=>he.fetchAgent),d=tn(he=>he.createAgent),h=tn(he=>he.updateAgent),g=tn(he=>he.deleteAgent),p=tn(he=>he.restoreDefault),v=tn(he=>he.restoreAllDefaults),[S,E]=F.useState("list"),[C,b]=F.useState(null),[x,_]=F.useState(null),[y,j]=F.useState(""),[A,N]=F.useState(""),[R,T]=F.useState(""),[I,H]=F.useState(!0),[G,K]=F.useState([]),[q,O]=F.useState("#6b7280"),[W,V]=F.useState(""),[Q,te]=F.useState(""),[L,D]=F.useState(!1),[B,U]=F.useState(null),[P,Y]=F.useState(!1),[ne,Z]=F.useState([]);function X(he){const De=new Map;for(const Ze of he){const Qe=Ze.indexOf(":");if(Qe===-1)De.set(Ze,new Set);else{const qe=Ze.slice(0,Qe),de=Ze.slice(Qe+1).split(",").filter(Boolean);De.set(qe,new Set(de))}}return De}function z(he){const De=[];for(const[Ze,Qe]of he)Qe.size===0?De.push(Ze):De.push(`${Ze}:${[...Qe].join(",")}`);return De}const ae=X(G),se=(he,De)=>{const Ze=new Map(ae),Qe=Ze.get(he)||new Set,qe=new Set(Qe);qe.has(De)?qe.delete(De):qe.add(De),qe.size===0?Ze.set(he,new Set):Ze.set(he,qe),K(z(Ze))};F.useEffect(()=>{e&&(m(),fetch("/api/tools").then(he=>he.json()).then(he=>Z(he.tools||[])).catch(()=>Z([])),_(null),U(null),Y(!1),r?(E("edit"),b(r),te(""),o(r).then(he=>{he&&(j(he.metadata.name),N(he.metadata.id),T(he.metadata.description),H(he.metadata.subagent),K(he.metadata.allowedTools),O(he.metadata.color??"#6b7280"),V(he.prompt))})):(E("list"),b(null)))},[e,m,o,r]);const ge=()=>{b(null),j(""),N(""),T(""),H(!0),K(["read_file"]),O("#6b7280"),V(""),te(""),E("edit")},be=async he=>{const De=await o(he);De&&(b(he),j(De.metadata.name),N(De.metadata.id),T(De.metadata.description),H(De.metadata.subagent),K(De.metadata.allowedTools),O(De.metadata.color??"#6b7280"),V(De.prompt),te(""),E("edit"))},je=async he=>{await g(he),_(null)},Te=async()=>{const he=C??A;if(!he||!y||!W){te("Name and prompt are required.");return}D(!0),te("");const De={metadata:{id:he,name:y,description:R,subagent:I,allowedTools:G,color:q},prompt:W},Ze=C?await h(C,De):await d(De);if(D(!1),!Ze.success){te(Ze.error??"Failed to save agent.");return}r?i():E("list")},Le=()=>{r?i():E("list")},Pe=he=>{j(he),C||N(w3(he))},we=he=>{const De=new Map(ae);De.has(he)?De.delete(he):De.set(he,new Set),K(z(De))};if(S==="edit")return c.jsx(xn,{isOpen:e,onClose:Le,title:C?"Edit Agent":"New Agent",size:"xl",children:c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"space-y-3",children:[Q&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:Q}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:y,onChange:he=>Pe(he.target.value),placeholder:"My Agent",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:A,onChange:he=>!C&&N(he.target.value),readOnly:!!C,placeholder:"my_agent",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),c.jsx("input",{value:R,onChange:he=>T(he.target.value),placeholder:"What this agent does",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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),c.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[c.jsx("button",{onClick:()=>H(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${I?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:"Sub-agent"}),c.jsx("button",{onClick:()=>H(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${I?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"}`,children:"Top-level"}),c.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[c.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),c.jsx("input",{type:"color",value:q,onChange:he=>O(he.target.value),className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),c.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:ne.map(he=>{const De=ae.has(he.name),Ze=he.actions.length>0,Qe=ae.get(he.name)||new Set,qe=c.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${De?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:[c.jsx("span",{children:he.name}),Ze&&c.jsx("span",{className:`text-[10px] ${De&&Qe.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},he.name);return Ze?c.jsx(qa,{trigger:qe,minWidth:"160px",items:[...he.actions.map(at=>({label:c.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${he.name}-${at}`,children:[c.jsx("input",{type:"checkbox",id:`${he.name}-${at}`,checked:Qe.has(at),onChange:()=>se(he.name,at),className:"w-3 h-3 rounded accent-accent-primary"}),c.jsx("span",{children:at})]}),closeOnClick:!1})),{label:De?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(De)we(he.name);else{const at=new Map(ae);at.set(he.name,new Set(he.actions)),K(z(at))}}}]},he.name):c.jsx("button",{onClick:()=>we(he.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${De?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:c.jsx("span",{children:he.name})},he.name)})})]})]}),c.jsxs("div",{className:"flex-1 min-h-[150px] mt-5 overflow-hidden",children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),c.jsx("textarea",{value:W,onChange:he=>V(he.target.value),placeholder:"Instructions for this agent...",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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[c.jsx(xt,{variant:"secondary",onClick:Le,children:"Cancel"}),c.jsx(xt,{variant:"primary",onClick:Te,disabled:L||!y||!W,children:L?"Saving...":"Save"})]})]})});const st=s.filter(he=>he.subagent),lt=s.filter(he=>!he.subagent);return c.jsxs(xn,{isOpen:e,onClose:i,title:"Agents",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(P?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await v(),Y(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),c.jsx("button",{onClick:()=>Y(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Y(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all agents to defaults",children:"Restore Defaults"})),c.jsx(xt,{variant:"primary",size:"sm",onClick:ge,children:"+ New"})]})]}),f&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):c.jsxs("div",{className:"space-y-4",children:[lt.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Top-level"}),c.jsx("div",{className:"space-y-2",children:lt.map(he=>c.jsx(Lv,{agent:he,confirmDeleteId:x,isModified:l.includes(he.id),confirmRestoreId:B,onRestore:async()=>{await p(he.id),U(null)},onConfirmRestore:()=>U(he.id),onCancelRestore:()=>U(null),onEdit:()=>be(he.id),onDelete:()=>je(he.id),onConfirmDelete:()=>_(he.id),onCancelDelete:()=>_(null)},he.id))})]}),st.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),c.jsx("div",{className:"space-y-2",children:st.map(he=>c.jsx(Lv,{agent:he,confirmDeleteId:x,isModified:l.includes(he.id),confirmRestoreId:B,onRestore:async()=>{await p(he.id),U(null)},onConfirmRestore:()=>U(he.id),onCancelRestore:()=>U(null),onEdit:()=>be(he.id),onDelete:()=>je(he.id),onConfirmDelete:()=>_(he.id),onCancelDelete:()=>_(null)},he.id))})]})]})]})}function Lv({agent:e,confirmDeleteId:i,isModified:r,confirmRestoreId:s,onRestore:l,onConfirmRestore:f,onCancelRestore:m,onEdit:o,onDelete:d,onConfirmDelete:h,onCancelDelete:g}){return c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),c.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),c.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),e.description&&c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),c.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(p=>c.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:p},p)),e.allowedTools.length>5&&c.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[r&&(s===e.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:l,className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),c.jsx("button",{onClick:m,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:f,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(Jr,{onClick:o}),i===e.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:d,className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:g,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:h,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete agent",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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 k3(){const e=Ee(C=>{var b;return(b=C.currentSession)==null?void 0:b.mode}),i=Ee(C=>C.switchMode),r=tn(C=>C.agents),s=tn(C=>C.fetchAgents),[l,f]=F.useState(!1),[m,o]=F.useState(!1),[d,h]=F.useState(null),g=F.useRef(null);if(F.useEffect(()=>{s()},[s]),F.useEffect(()=>{function C(b){g.current&&!g.current.contains(b.target)&&f(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),!e)return null;const p=r.filter(C=>!C.subagent),v=p.find(C=>C.id===e),S=(v==null?void 0:v.name)??e,E=Nl(r,e);return c.jsxs("div",{className:"relative",ref:g,children:[c.jsxs("button",{type:"button",onClick:()=>f(!l),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[c.jsx("span",{className:"text-sm font-medium",style:{color:E},children:S}),c.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&p.length>0&&c.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:[p.map(C=>{const b=C.id===e,x=Nl(r,C.id);return c.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${b?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[c.jsxs("button",{type:"button",onClick:()=>{b||i(C.id),f(!1)},className:"flex-1 text-left flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",style:{color:x},children:C.name}),b&&c.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:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),c.jsx(Jr,{className:"opacity-0 group-hover:opacity-100",onClick:_=>{_.stopPropagation(),f(!1),h(C.id),o(!0)}})]},C.id)}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:()=>{f(!1),o(!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..."})})]}),c.jsx(C3,{isOpen:m,onClose:()=>{o(!1),h(null)},initialEditId:d})]})}function E3(){const e=Ee(s=>s.currentSession),i=Ee(s=>s.switchDangerLevel);if(!e)return null;const r=e.dangerLevel??"normal";return c.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[c.jsx("button",{type:"button",onClick:()=>i("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${r==="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"}),c.jsx("button",{type:"button",onClick:()=>i("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${r==="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 j3({question:e}){const i=Ee(h=>h.answerQuestion),r=F.useRef(null),s=F.useRef(null),[l,f]=F.useState(""),m=F.useCallback(h=>{h.key},[]);F.useEffect(()=>{var h;return s.current=document.activeElement,(h=r.current)==null||h.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),F.useEffect(()=>(document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)),[m]);const o=()=>{i(e.callId,l)},d=h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),o())};return ah.createPortal(c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[c.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),c.jsxs("div",{ref:r,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[c.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),c.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),c.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[c.jsx("p",{className:"text-sm text-text-primary",children:e.question}),c.jsx("textarea",{value:l,onChange:h=>f(h.target.value),onKeyDown:d,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0})]}),c.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[c.jsx(xt,{variant:"secondary",size:"sm",onClick:()=>i(e.callId,""),children:"Skip"}),c.jsx(xt,{variant:"primary",size:"sm",onClick:o,children:"Send Answer"})]})]})]}),document.body)}function N3(){const e=Z1(),i=e?"bg-amber-400":"bg-accent-primary";return c.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsxs("span",{className:"flex gap-0.5",children:[c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${i}`,style:{animationDelay:"0ms"}}),c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${i}`,style:{animationDelay:"150ms"}}),c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${i}`,style:{animationDelay:"300ms"}})]}),c.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&c.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function T3({attachment:e,onRemove:i}){const r=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return c.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[c.jsx("button",{onClick:()=>i(e.id),className:"absolute -top-2 -right-2 w-5 h-5 bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors","aria-label":`Remove ${e.filename}`,children:c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),c.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),c.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),c.jsx("div",{className:"text-[10px] text-text-muted",children:r(e.size)})]})}function A3({history:e,selectedIndex:i,onSelect:r,onEscape:s,onNavigate:l}){const f=F.useRef(null),m=F.useRef(null);F.useEffect(()=>{m.current&&f.current&&m.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[i]);const o=h=>{switch(h.key){case"Enter":h.preventDefault(),e[i]&&r(e[i].content);break;case"Escape":h.preventDefault(),s();break;case"ArrowUp":h.preventDefault(),l("up");break;case"ArrowDown":h.preventDefault(),l("down");break}},d=h=>{r(h)};return c.jsx("div",{ref:f,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:o,children:e.map((h,g)=>c.jsxs("div",{ref:g===i?m:null,role:"listitem",onClick:()=>d(h.content),className:`
137
+ p-2 rounded cursor-pointer transition-colors
138
+ ${g===i?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
139
+ `,children:[c.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[h.formattedTimestamp,h.sessionName&&c.jsxs(c.Fragment,{children:[" | ",c.jsx("span",{className:"text-accent-primary font-medium",children:h.sessionName})]})]}),c.jsx("div",{className:"text-sm text-text-primary mt-1",children:h.trimmedContent})]},h.id))})}const D3={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function Ld(e,i={}){const r={...D3,...i};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<=r.maxSizeBytes){const l=await e.arrayBuffer(),f=z3(l),m=`data:${e.type};base64,${f}`,o=await Eb(m);return{dataUrl:m,mimeType:e.type,size:e.size,width:o.width,height:o.height}}return await R3(e,r)}async function R3(e,i){const r=await M3(e),s=await Eb(r),{width:l,height:f}=L3(s.width,s.height,i.maxWidth,i.maxHeight),m=O3();m.width=l,m.height=f;const o=m.getContext("2d");if(!o)throw new Error("Failed to get canvas context");o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high",o.drawImage(s,0,0,l,f);let d=i.quality,h;do{if(h=m.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Mv(h)<=i.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Mv(h);return{dataUrl:h,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:f}}function L3(e,i,r,s){const l=e/i;return e>i&&e>r?{width:r,height:Math.round(r/l)}:i>e&&i>s?{width:Math.round(s*l),height:s}:{width:e,height:i}}function M3(e){return new Promise((i,r)=>{const s=I3(),l=new s;l.onload=()=>i(l.result),l.onerror=()=>r(new Error("Failed to read file")),l.readAsDataURL(e)})}function Eb(e){return new Promise((i,r)=>{const s=B3(),l=new s;l.onload=()=>i(l),l.onerror=()=>r(new Error("Failed to load image")),l.src=e})}function O3(){var i;const e=qh();if(!((i=e.document)!=null&&i.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function B3(){const e=qh();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function I3(){const e=qh();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function qh(){return globalThis}function z3(e){const i=new Uint8Array(e);let r="";for(let s=0;s<i.byteLength;s++){const l=i[s];l!==void 0&&(r+=String.fromCharCode(l))}return btoa(r)}function Mv(e){const r=e.split(",")[1];return r?Math.round(r.length*3/4):0}function Md(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function Od(e,i=50*1024*1024){return e.size>i?{valid:!1,error:`Image file is too large (${Ov(e.size)}). Maximum size is ${Ov(i)}.`}:{valid:!0}}function Ov(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function H3(e){const i={};let r=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){r=s.id;continue}s.role==="assistant"&&s.promptContext&&r&&i[r]===void 0&&(i[r]=s.promptContext)}return i}function P3({isOpen:e,onClose:i,providerId:r,model:s}){const[l,f]=F.useState(s.contextWindow),[m,o]=F.useState(!1),d=Zt(p=>p.updateModelContext);if(F.useEffect(()=>{f(s.contextWindow)},[s]),!e)return null;const h=async()=>{l<1024||l>1e7||(o(!0),await d(r,s.id,l),o(!1),i())},g=()=>{f(s.contextWindow),i()};return c.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[c.jsx("div",{className:"px-6 py-4 border-b border-border",children:c.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),c.jsxs("div",{className:"px-6 py-4 space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),c.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),c.jsx("input",{type:"number",min:1024,max:1e7,value:l,onChange:p=>f(parseInt(p.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),c.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),c.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[c.jsx("button",{type:"button",onClick:g,disabled:m,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),c.jsx("button",{type:"button",onClick:h,disabled:m||l<1024||l>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:m?"Saving...":"Save"})]})]})})}function F3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function U3(){var q;const e=Ee(O=>O.currentSession),i=Ee(O=>O.setSessionProvider),[r,s]=F.useState(!1),[l,f]=F.useState([]),[m,o]=F.useState(null),d=F.useRef(null),[h,g]=F.useState(null),p=F.useRef(new Set),v=Zt(O=>O.providers),S=Zt(O=>O.activeProviderId),E=Zt(O=>O.model);Zt(O=>O.backend);const C=Zt(O=>O.llmStatus),b=Zt(O=>O.activating),x=Zt(O=>O.activateProvider),_=Zt(O=>O.refreshModel),y=Zt(O=>O.refreshProviderModels);F.useEffect(()=>{function O(W){d.current&&!d.current.contains(W.target)&&(s(!1),f([]),p.current=new Set)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]),F.useEffect(()=>{if(r){const O=v.map(W=>W.id);f(O),O.forEach(W=>{p.current.has(W)||(p.current.add(W),N(W))})}},[r,v]),v.find(O=>O.id===S);const j=C==="disconnected",A=E?((q=E.split("/").pop())==null?void 0:q.replace(/-/g," "))??E:"detecting...",N=async O=>{o(O);try{await y(O)}catch{}finally{o(null)}},R=async O=>{if(O.id===S){l.includes(O.id)?f(l.filter(W=>W!==O.id)):(f([...l,O.id]),N(O.id));return}e?(i(O.id,void 0),Zt.getState().syncFromSession(O.id,""),s(!1),f([])):await x(O.id)&&(s(!1),f([]))},T=O=>{l.includes(O.id)?f(l.filter(W=>W!==O.id)):(f([...l,O.id]),N(O.id))},I=async(O,W)=>{O.stopPropagation(),p.current.delete(W),await y(W),await N(W)},H=(O,W)=>{g({providerId:O,model:W})},G=()=>{g(null)},K=async(O,W)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",O,"model:",W),e){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(O,W),Zt.getState().syncFromSession(O,W),f([]),s(!1);return}o("activating");try{(await fetch(`/api/providers/${O}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:W})})).ok&&(await Zt.getState().fetchConfig(),f([]),s(!1))}catch{}finally{o(null)}};return v.length===0?c.jsxs("button",{type:"button",onClick:()=>_(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:j?"LLM server is offline. Click to retry.":E??"Click to refresh model",children:[j?c.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):c.jsx("span",{className:"text-sm text-accent-primary",children:A}),c.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):c.jsxs("div",{className:"relative",ref:d,children:[c.jsxs("button",{type:"button",onClick:()=>s(!r),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:[j?c.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):c.jsx("span",{className:"text-sm text-accent-primary",children:A}),c.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&c.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:[c.jsx("div",{className:"py-1",children:v.map(O=>{var W;return c.jsxs("div",{children:[c.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${O.id===S?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${b?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[c.jsxs("div",{onClick:()=>!b&&R(O),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[c.jsx("span",{className:`text-sm font-medium truncate ${O.id===S?"text-accent-primary":"text-text-primary"}`,children:O.name}),c.jsx("span",{className:"text-xs text-text-muted truncate",children:O.backend!=="auto"&&M1(O.backend)})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[O.id===S?c.jsx("span",{className:"text-accent-success",title:"Active",children:c.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:c.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"})})}):c.jsx("span",{className:"w-4"}),c.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),I(V,O.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:c.jsx("svg",{className:`w-4 h-4 ${m===O.id?"animate-spin":""} ${O.id===S?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),T(O)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:c.jsx("svg",{className:`w-4 h-4 transition-transform ${l.includes(O.id)?"rotate-180":""} ${O.id===S?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),l.includes(O.id)&&c.jsx("div",{className:"bg-bg-primary border-t border-border",children:m===O.id?c.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(W=O.models)!=null&&W.length?O.models.map(V=>{var Q;return c.jsxs("button",{type:"button",onClick:()=>K(O.id,V.id),disabled:m==="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 ${m==="activating"?"opacity-50 cursor-wait":""} ${E===V.id?"text-accent-primary":"text-text-secondary"}`,children:[c.jsx("span",{className:"truncate flex-1",children:((Q=V.id.split("/").pop())==null?void 0:Q.replace(/-/g," "))??V.id}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsx("span",{className:"text-xs text-text-muted",children:F3(V.contextWindow)}),c.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),H(O.id,V)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:c.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]}),E===V.id&&c.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:c.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"})})})]},V.id)}):c.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},O.id)})}),c.jsx("div",{className:"border-t border-border px-3 py-2",children:c.jsxs("p",{className:"text-xs text-text-muted",children:["Use ",c.jsx("code",{className:"bg-bg-tertiary px-1 rounded",children:"openfox provider add"})," to add more providers"]})})]}),h&&c.jsx(P3,{isOpen:!0,onClose:G,providerId:h.providerId,model:h.model})]})}const Nn=Yn((e,i)=>({commands:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await fetch("/api/commands/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchCommands:async()=>{e({loading:!0});try{const s=await(await fetch("/api/commands")).json();e({commands:s.commands??[],defaultIds:s.defaultIds??i().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchCommand:async r=>{try{const s=await fetch(`/api/commands/${r}`);return s.ok?await s.json():null}catch{return null}},createCommand:async r=>{try{const s=await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});return s.ok?(await i().fetchCommands(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateCommand:async(r,s)=>{try{const l=await fetch(`/api/commands/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await i().fetchCommands(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteCommand:async r=>{try{return(await fetch(`/api/commands/${r}`,{method:"DELETE"})).ok?(e({commands:i().commands.filter(l=>l.id!==r)}),!0):!1}catch{return!1}},restoreDefault:async r=>{try{return(await fetch(`/api/commands/${r}/restore-default`,{method:"POST"})).ok?(await i().fetchCommands(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await fetch("/api/commands/restore-all-defaults",{method:"POST"})).ok?(await i().fetchCommands(),!0):!1}catch{return!1}}}));function $3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function jb({isOpen:e,onClose:i,initialEditId:r}){const s=Nn(z=>z.commands),l=Nn(z=>z.modifiedIds),f=Nn(z=>z.loading),m=Nn(z=>z.fetchCommands),o=Nn(z=>z.fetchCommand),d=Nn(z=>z.createCommand),h=Nn(z=>z.updateCommand),g=Nn(z=>z.deleteCommand),p=Nn(z=>z.restoreDefault),v=Nn(z=>z.restoreAllDefaults),[S,E]=F.useState("list"),[C,b]=F.useState(null),[x,_]=F.useState(null),y=tn(z=>z.agents),j=tn(z=>z.fetchAgents),A=y.filter(z=>!z.subagent),[N,R]=F.useState(""),[T,I]=F.useState(""),[H,G]=F.useState(""),[K,q]=F.useState(""),[O,W]=F.useState(""),[V,Q]=F.useState(!1),[te,L]=F.useState(null),[D,B]=F.useState(!1);F.useEffect(()=>{e&&(m(),j(),_(null),L(null),B(!1),r?(E("edit"),b(r),W(""),o(r).then(z=>{z&&(R(z.metadata.name),I(z.metadata.id),G(z.prompt),q(z.metadata.agentMode??""))})):(E("list"),b(null)))},[e,m,j,o,r]);const U=()=>{b(null),R(""),I(""),G(""),q(""),W(""),E("edit")},P=async z=>{const ae=await o(z);ae&&(b(z),R(ae.metadata.name),I(ae.metadata.id),G(ae.prompt),q(ae.metadata.agentMode??""),W(""),E("edit"))},Y=async z=>{await g(z),_(null)},ne=async()=>{const z=C??T;if(!z||!N||!H){W("Name and message are required.");return}Q(!0),W("");const ae={metadata:{id:z,name:N,...K?{agentMode:K}:{}},prompt:H},se=C?await h(C,ae):await d(ae);if(Q(!1),!se.success){W(se.error??"Failed to save command.");return}r?i():E("list")},Z=()=>{r?i():E("list")},X=z=>{R(z),C||I($3(z))};return S==="edit"?c.jsx(xn,{isOpen:e,onClose:Z,title:C?"Edit Command":"New Command",size:"xl",children:c.jsxs("div",{className:"space-y-3",children:[O&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:O}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:N,onChange:z=>X(z.target.value),placeholder:"My Command",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:T,onChange:z=>!C&&I(z.target.value),readOnly:!!C,placeholder:"my-command",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",c.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),c.jsxs("select",{value:K,onChange:z=>q(z.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:[c.jsx("option",{value:"",children:"None (keep current mode)"}),A.map(z=>c.jsx("option",{value:z.id,children:z.name},z.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),c.jsx("textarea",{value:H,onChange:z=>G(z.target.value),placeholder:"The message that will be sent when this command is triggered...",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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[c.jsx(xt,{variant:"secondary",onClick:Z,children:"Cancel"}),c.jsx(xt,{variant:"primary",onClick:ne,disabled:V||!N||!H,children:V?"Saving...":"Save"})]})]})}):c.jsxs(xn,{isOpen:e,onClose:i,title:"Commands",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Commands are pre-defined messages you can send with a single click."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(D?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await v(),B(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),c.jsx("button",{onClick:()=>B(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>B(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all commands to defaults",children:"Restore Defaults"})),c.jsx(xt,{variant:"primary",size:"sm",onClick:U,children:"+ New"})]})]}),f&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading commands..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No commands created yet."}):c.jsx("div",{className:"space-y-2",children:s.map(z=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsx("div",{className:"min-w-0 flex-1 mr-3",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:z.name}),l.includes(z.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]})}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.includes(z.id)&&(te===z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await p(z.id),L(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),c.jsx("button",{onClick:()=>L(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>L(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(Jr,{onClick:()=>P(z.id)}),x===z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>Y(z.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:()=>_(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>_(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete command",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]})]},z.id))})]})}function q3({onSendCommand:e,onOpenManager:i,textareaContent:r,attachments:s}){const[l,f]=F.useState(!1),[m,o]=F.useState(""),[d,h]=F.useState(0),[g,p]=F.useState(null),v=F.useRef(null),S=F.useRef(null),E=Nn(j=>j.commands),C=Nn(j=>j.fetchCommands);F.useEffect(()=>{l&&(C(),o(""),h(0),requestAnimationFrame(()=>{var j;return(j=S.current)==null?void 0:j.focus()}))},[l,C]),F.useEffect(()=>{if(!l)return;const j=A=>{v.current&&!v.current.contains(A.target)&&f(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[l]);const b=E.filter(j=>{if(!m)return!0;const A=m.toLowerCase();return j.name.toLowerCase().includes(A)}),x=j=>{switch(j.key){case"ArrowDown":j.preventDefault(),h(A=>Math.min(A+1,b.length-1));break;case"ArrowUp":j.preventDefault(),h(A=>Math.max(A-1,0));break;case"Enter":j.preventDefault(),b[d]&&_(b[d].id);break;case"Escape":j.preventDefault(),f(!1);break}},_=async j=>{const A=await Nn.getState().fetchCommand(j);A&&e(A.prompt,A.metadata.agentMode,r,s),f(!1)},y=()=>{f(!1),i()};return c.jsxs("div",{ref:v,className:"relative",children:[c.jsxs("button",{type:"button",onClick:()=>f(j=>!j),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Commands",c.jsx("svg",{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&c.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:x,children:[c.jsx("div",{className:"p-2 border-b border-border",children:c.jsx("input",{ref:S,value:m,onChange:j=>{o(j.target.value),h(0)},placeholder:"Search commands...",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"})}),c.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:b.length===0?c.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:E.length===0?"No commands yet":"No matches"}):b.map((j,A)=>c.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${A===d?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[c.jsx("button",{type:"button",onClick:()=>_(j.id),className:"flex-1 text-left",children:c.jsx("div",{className:"text-sm text-text-primary font-medium",children:j.name})}),c.jsx(Jr,{className:"opacity-0 group-hover:opacity-100",onClick:N=>{N.stopPropagation(),f(!1),p(j.id)}})]},j.id))}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:y,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 Commands..."})})]}),c.jsx(jb,{isOpen:!!g,onClose:()=>p(null),initialEditId:g})]})}function W3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function G3(e){let i=1;for(;e.some(r=>r.id===`s${i}`);)i++;return`s${i}`}const V3=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],Nb={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"},Tb=[{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)"}],_i=150,wr=54,bs=80,En=30,ys=70,Bv=100,Si=50,ml=50,Iv=4;function Wh(e,i){if(e.type==="agent"){const r=i.find(s=>s.id===e.toolMode);return{name:(r==null?void 0:r.name)??(e.toolMode||"Agent"),color:(r==null?void 0:r.color)||"#3b82f6"}}if(e.type==="sub_agent"){const r=i.find(s=>s.id===e.subAgentType);return{name:(r==null?void 0:r.name)??(e.subAgentType||"Sub-Agent"),color:(r==null?void 0:r.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function Y3(e,i,r,s){const l=ml+Si+_i+Bv+_i+Si+ml,f=l/2,m=ml+Si+_i/2,o=ml+Si+_i+Bv+_i/2,d=[],h=[],g=new Map,p=e.filter(O=>O.type==="agent"||O.type==="shell"),v=e.filter(O=>O.type==="sub_agent"),S=v.length>0,E=S?m:f,C=p.length>0?o:f,b=Si+En/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:b,w:bs,h:En}),g.set("$start",{cx:E,cy:b,w:bs,h:En}),e.length===0){const O=b+En/2+ys*2+En/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:O,w:bs,h:En}),g.set("$done",{cx:E,cy:O,w:bs,h:En}),{nodes:d,edges:h,width:l,height:O+En/2+Si,posMap:g}}const x=b+En/2+ys,_=(O,W)=>{O.forEach((V,Q)=>{const te=x+Q*(wr+ys)+wr/2,{name:L,color:D}=Wh(V,s);d.push({id:V.id,type:"step",label:L,color:D,cx:W,cy:te,w:_i,h:wr}),g.set(V.id,{cx:W,cy:te,w:_i,h:wr})})};_(p,E),_(v,C);const y=p.length>0?x+(p.length-1)*(wr+ys)+wr/2:b,j=S?x+(v.length-1)*(wr+ys)+wr/2:b,A=Math.max(y,j)+wr/2+ys+En/2;d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:bs,h:En}),g.set("$done",{cx:E,cy:A,w:bs,h:En});const N=[];i&&g.has(i)&&N.push({from:"$start",to:i,label:r,edgeKey:"start",direction:"down",backEdgeIndex:0});let R=0;for(const O of e)O.transitions.forEach((W,V)=>{if(!W.goto||!g.has(W.goto))return;const Q=g.get(O.id),te=g.get(W.goto),L=W.when.type==="step_result"?`${W.when.result}`:Nb[W.when.type]??W.when.type,D=O.id===W.goto;let B;D?B="back":te.cy>Q.cy+1?B="down":te.cy<Q.cy-1?B="back":B="same",N.push({from:O.id,to:W.goto,label:L,edgeKey:`${O.id}:${V}`,direction:B,backEdgeIndex:B==="back"?R++:0})});const T=new Map,I=new Map,H=new Map,G=new Map;for(const O of N)O.direction==="down"&&(T.set(O.from,(T.get(O.from)??0)+1),I.set(O.to,(I.get(O.to)??0)+1));const K=new Map,q=new Map;for(const O of N){if(O.direction!=="same")continue;const W=[O.from,O.to].sort().join("|");K.set(W,(K.get(W)??0)+1)}for(const O of N){if(O.direction==="back"||O.direction==="same"){let B=0;if(O.direction==="same"){const U=[O.from,O.to].sort().join("|");B=q.get(U)??0,q.set(U,B+1)}h.push({...O,fromPort:0,toPort:0,sameEdgeIndex:B});continue}const W=T.get(O.from)??1,V=I.get(O.to)??1,Q=H.get(O.from)??0,te=G.get(O.to)??0;H.set(O.from,Q+1),G.set(O.to,te+1);const L=W===1?0:-.6+1.2*Q/(W-1),D=V===1?0:-.6+1.2*te/(V-1);h.push({...O,fromPort:L,toPort:D,sameEdgeIndex:0})}return{nodes:d,edges:h,width:l,height:A+En/2+Si,posMap:g}}function K3({steps:e,entryStep:i,selectedNodeId:r,selectedEdgeKey:s,startConditionLabel:l,agentTypes:f,onSelectNode:m,onSelectEdge:o,onRemoveStep:d,onCreateTransition:h,onReconnectTo:g,onReconnectFrom:p,onDeleteTransition:v}){const S=F.useRef(null),E=F.useRef(!1),[C,b]=F.useState(null),[x,_]=F.useState(null),[y,j]=F.useState(null),{nodes:A,edges:N,width:R,height:T,posMap:I}=F.useMemo(()=>Y3(e,i,l,f),[e,i,l,f]),H=F.useCallback(Y=>{var ae;const ne=S.current;if(!ne)return{x:0,y:0};const Z=ne.createSVGPoint();Z.x=Y.clientX,Z.y=Y.clientY;const X=(ae=ne.getScreenCTM())==null?void 0:ae.inverse();if(!X)return{x:0,y:0};const z=Z.matrixTransform(X);return{x:z.x,y:z.y}},[]),G=F.useCallback(Y=>!Y||!x||Y==="$start"?!1:x.type==="reconnect-from"?Y!=="$done":!0,[x]),K=F.useCallback((Y,ne)=>{Y.stopPropagation(),Y.preventDefault();const Z=H(Y);_({type:"new",fromNodeId:ne,mouseX:Z.x,mouseY:Z.y})},[H]),q=F.useCallback((Y,ne)=>{Y.stopPropagation(),Y.preventDefault();const Z=H(Y);_({type:"reconnect-to",fromNodeId:ne.from,edgeKey:ne.edgeKey,mouseX:Z.x,mouseY:Z.y})},[H]),O=F.useCallback((Y,ne)=>{Y.stopPropagation(),Y.preventDefault();const Z=H(Y);_({type:"reconnect-from",fromNodeId:ne.from,fixedTargetId:ne.to,edgeKey:ne.edgeKey,mouseX:Z.x,mouseY:Z.y})},[H]),W=F.useCallback(Y=>{if(!x)return;const ne=H(Y);_(Z=>Z?{...Z,mouseX:ne.x,mouseY:ne.y}:null)},[x,H]),V=F.useCallback(()=>{x&&(E.current=!0,y&&G(y)&&(x.type==="new"?h(x.fromNodeId,y):x.type==="reconnect-to"?g(x.edgeKey,y):x.type==="reconnect-from"&&p(x.edgeKey,y)),_(null),j(null))},[x,y,G,h,g,p]),Q=F.useCallback(()=>{if(E.current){E.current=!1;return}m(null),o(null)},[m,o]);F.useEffect(()=>{const Y=ne=>{ne.target instanceof HTMLInputElement||ne.target instanceof HTMLTextAreaElement||ne.target instanceof HTMLSelectElement||(ne.key==="Delete"||ne.key==="Backspace")&&s&&s!=="start"&&(ne.preventDefault(),v(s),o(null))};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[s,v,o]);const te=Y=>{const ne=I.get(Y.from),Z=I.get(Y.to);if(!ne||!Z)return null;let X,z,ae,se="middle",ge,be;if(Y.direction==="down"){const je=ne.cx+Y.fromPort*(ne.w/2-10),Te=ne.cy+ne.h/2,Le=Z.cx+Y.toPort*(Z.w/2-10),Pe=Z.cy-Z.h/2,we=Pe-Te,st=Le-je;X=`M ${je} ${Te} C ${je} ${Te+we*.4}, ${Le-st*.2} ${Pe-we*.1}, ${Le} ${Pe}`,z=je+(Le-je)*.5,ae=Te+we*.6,ge={x:je,y:Te},be={x:Le,y:Pe}}else if(Y.direction==="back"){const je=Y.from===Y.to,Te=ne.cx>=R/2,Le=Y.backEdgeIndex*16,Pe=Te?R-20-Le:20+Le;if(je){const we=ne.cx>=R/2,st=30+Y.backEdgeIndex*14,lt=ne.cy-ne.h/2,he=we?ne.cx+ne.w/2:ne.cx-ne.w/2,De=we?he+st:he-st,Ze=ne.cx+(we?ne.w/4:-ne.w/4),Qe=lt-20-Y.backEdgeIndex*10;X=`M ${he} ${ne.cy} C ${De} ${ne.cy}, ${De} ${Qe}, ${Ze} ${lt}`,z=De+10,ae=Qe+4,se="middle",ge={x:he,y:ne.cy},be={x:Ze,y:lt}}else{const we=Te?ne.cx+ne.w/2:ne.cx-ne.w/2,st=Z.cx+(Te?Z.w/4:-Z.w/4),lt=Math.min(ne.cy,Z.cy)-Z.h/2-18-Y.backEdgeIndex*14;X=`M ${we} ${ne.cy} L ${Pe} ${ne.cy} L ${Pe} ${lt} L ${st} ${lt} L ${st} ${Z.cy-Z.h/2}`,z=Pe,ae=(ne.cy+lt)/2,se=Te?"start":"end",ge={x:we,y:ne.cy},be={x:st,y:Z.cy-Z.h/2}}}else{const je=Z.cx>ne.cx,Te=Y.sameEdgeIndex===0?-12:12,Le=je?ne.cx+ne.w/2:ne.cx-ne.w/2,Pe=je?Z.cx-Z.w/2:Z.cx+Z.w/2,we=ne.cy+Te,st=Z.cy+Te,lt=(Le+Pe)/2;X=`M ${Le} ${we} C ${lt} ${we}, ${lt} ${st}, ${Pe} ${st}`,z=lt,ae=(we+st)/2-6,ge={x:Le,y:we},be={x:Pe,y:st}}return{path:X,labelX:z,labelY:ae,labelAnchor:se,fromPt:ge,toPt:be}},L=(Y,ne)=>{const Z=te(Y);if(!Z)return null;const{path:X,labelX:z,labelY:ae,labelAnchor:se}=Z,ge=s===Y.edgeKey,be=Y.label&&!(Y.from==="$start"&&Y.label==="Always");return c.jsxs("g",{children:[c.jsx("path",{d:X,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:je=>{je.stopPropagation(),o(ge?null:Y.edgeKey)}}),c.jsx("path",{d:X,fill:"none",stroke:ge?"#58a6ff":"#484f58",strokeWidth:ge?2.2:1.2,markerEnd:ge?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),be&&c.jsx("text",{x:z+(se==="start"?5:se==="end"?-5:0),y:ae+3,textAnchor:se,className:"text-[8px]",fill:ge?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Y.label})]},ne)},D=()=>{if(!s||x)return null;const Y=N.find(ae=>ae.edgeKey===s);if(!Y)return null;const ne=te(Y);if(!ne)return null;const{fromPt:Z,toPt:X}=ne,z=6;return c.jsxs(c.Fragment,{children:[Y.edgeKey!=="start"&&c.jsx("circle",{cx:Z.x,cy:Z.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>O(ae,Y)}),c.jsx("circle",{cx:X.x,cy:X.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>q(ae,Y)})]})},B=()=>{if(!x)return null;let Y,ne,Z,X;if(x.type==="reconnect-from"){const se=I.get(x.fixedTargetId);if(!se)return null;Y=x.mouseX,ne=x.mouseY,Z=se.cx,X=se.cy-se.h/2}else{const se=I.get(x.fromNodeId);if(!se)return null;Y=se.cx,ne=se.cy+se.h/2,Z=x.mouseX,X=x.mouseY}const z=X-ne,ae=Math.abs(z)>10?`M ${Y} ${ne} C ${Y} ${ne+z*.4}, ${Z} ${X-z*.4}, ${Z} ${X}`:`M ${Y} ${ne} L ${Z} ${X}`;return c.jsx("path",{d:ae,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},U=Y=>{const ne=Y.cy+Y.h/2,Z=(x==null?void 0:x.fromNodeId)===Y.id;return c.jsx("circle",{cx:Y.cx,cy:ne,r:Iv,fill:Z?"#58a6ff":"#1c2128",stroke:Z?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Z?1:.5,className:"cursor-crosshair",onMouseDown:X=>K(X,Y.id)})},P=Y=>{const ne=Y.cy-Y.h/2,Z=x&&y===Y.id&&G(Y.id);return c.jsx("circle",{cx:Y.cx,cy:ne,r:Iv,fill:Z?"#3fb950":"#1c2128",stroke:Z?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Z?1:.5})};return c.jsxs("svg",{ref:S,viewBox:`0 0 ${R} ${T}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:W,onMouseUp:V,onClick:Q,children:[c.jsxs("defs",{children:[c.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:c.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),c.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:c.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),N.map((Y,ne)=>L(Y,ne)),A.map(Y=>{const ne=r===Y.id,Z=Y.cx-Y.w/2,X=Y.cy-Y.h/2,z=C===Y.id,ae=x&&y===Y.id&&G(Y.id);if(Y.type==="terminal"){const ge=Y.id==="$start",be=ge?"#58a6ff":"#3fb950",je=ge,Te=!ge;return c.jsxs("g",{onClick:Le=>{Le.stopPropagation(),ge&&o("start")},className:ge?"cursor-pointer":void 0,children:[ae&&c.jsx("rect",{x:Z-3,y:X-3,width:Y.w+6,height:Y.h+6,rx:Y.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ge&&s==="start"&&c.jsx("rect",{x:Z-3,y:X-3,width:Y.w+6,height:Y.h+6,rx:Y.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),c.jsx("rect",{x:Z,y:X,width:Y.w,height:Y.h,rx:Y.h/2,fill:be,fillOpacity:.08,stroke:be,strokeOpacity:.4,strokeWidth:1.5}),c.jsx("text",{x:Y.cx,y:Y.cy+4,textAnchor:"middle",fill:be,className:"text-[10px] font-medium",pointerEvents:"none",children:Y.label}),je&&U(Y),Te&&P(Y)]},Y.id)}const se=Y.color??"#6b7280";return c.jsxs("g",{onClick:ge=>{ge.stopPropagation(),m(ne?null:Y.id)},onMouseEnter:()=>b(Y.id),onMouseLeave:()=>b(null),className:"cursor-pointer",children:[ae&&c.jsx("rect",{x:Z-3,y:X-3,width:Y.w+6,height:Y.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ne&&c.jsx("rect",{x:Z-3,y:X-3,width:Y.w+6,height:Y.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),c.jsx("rect",{x:Z,y:X,width:Y.w,height:Y.h,rx:10,fill:se,fillOpacity:.08,stroke:se,strokeOpacity:.6,strokeWidth:ne?2:1.5}),c.jsx("text",{x:Y.cx,y:Y.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Y.label}),U(Y),P(Y),z&&!x&&c.jsxs("g",{onClick:ge=>{ge.stopPropagation(),d(Y.id)},className:"cursor-pointer",children:[c.jsx("circle",{cx:Z+Y.w-2,cy:X+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),c.jsx("line",{x1:Z+Y.w-5,y1:X-1,x2:Z+Y.w+1,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),c.jsx("line",{x1:Z+Y.w+1,y1:X-1,x2:Z+Y.w-5,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Y.id)}),x&&A.map(Y=>G(Y.id)?c.jsx("rect",{x:Y.cx-Y.w/2-8,y:Y.cy-Y.h/2-8,width:Y.w+16,height:Y.h+16,fill:"transparent",rx:12,onMouseEnter:()=>j(Y.id),onMouseLeave:()=>j(null),onMouseUp:ne=>{ne.stopPropagation(),V()}},`drop-${Y.id}`):null),B(),D()]})}const Gn="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",Ei="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",Qt="block text-[11px] text-text-secondary mb-0.5";function X3({fromLabel:e,toLabel:i,condition:r,fromStep:s,agentTypes:l,onUpdateCondition:f,onDelete:m}){const o=s&&(s.type==="sub_agent"||s.type==="agent")?l.find(h=>h.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(o==null?void 0:o.results)&&o.results.length>0;return c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),c.jsx("button",{onClick:m,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("span",{className:"font-medium text-text-primary",children:e}),c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),c.jsx("span",{className:"font-medium text-text-primary",children:i})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Condition"}),c.jsx("select",{value:r.type,onChange:h=>{f(h.target.value==="step_result"?{type:"step_result",result:"success"}:{type:h.target.value})},className:Ei,children:Tb.map(h=>c.jsx("option",{value:h.value,children:h.label},h.value))})]}),r.type==="step_result"&&c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Result"}),d?c.jsx("select",{value:r.result??o.results[0],onChange:h=>{f({type:"step_result",result:h.target.value})},className:Ei,children:o.results.map(h=>c.jsx("option",{value:h,children:h},h))}):c.jsx("input",{type:"text",value:r.result??"success",onChange:h=>f({type:"step_result",result:h.target.value}),placeholder:"e.g. success, passed, failed",className:Gn})]}),c.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Bd({variables:e,onInsert:i}){return e.length===0?null:c.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(r=>c.jsx("button",{type:"button",onClick:()=>i(r.name),title:r.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:`{{${r.name}}}`},r.name))})}function Z3({step:e,isEntry:i,agentTypes:r,transitionCount:s,templateVariables:l,onUpdate:f,onRemove:m,onSetEntry:o}){const{color:d,name:h}=Wh(e,r);return c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:h}),i&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[!i&&c.jsx("button",{onClick:o,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),c.jsx("button",{onClick:m,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Type"}),c.jsx("select",{value:e.type,onChange:g=>{const p=g.target.value,v=p==="sub_agent"?"verification":"build";if(p==="agent"){const S=r.find(E=>!E.subagent);f({...e,type:p,phase:v,toolMode:(S==null?void 0:S.id)??"builder",name:(S==null?void 0:S.name)??"Agent"})}else if(p==="sub_agent"){const S=r.find(E=>E.subagent);f({...e,type:p,phase:v,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else f({...e,type:p,phase:v,name:"Shell"})},className:Ei,children:V3.map(g=>c.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Agent Type"}),c.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const p=r.find(v=>v.id===g.target.value);f({...e,toolMode:g.target.value,name:(p==null?void 0:p.name)??g.target.value})},className:Ei,children:r.filter(g=>!g.subagent).map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Sub-Agent Type"}),c.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const p=r.find(v=>v.id===g.target.value);f({...e,subAgentType:g.target.value,name:(p==null?void 0:p.name)??g.target.value})},className:Ei,children:[c.jsx("option",{value:"",children:"— select —"}),r.filter(g=>g.subagent).map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Prompt"}),c.jsx("textarea",{value:e.prompt??"",onChange:g=>f({...e,prompt:g.target.value||void 0}),rows:6,className:`${Gn} resize-y text-xs`,placeholder:"Injected on first entry..."}),c.jsx(Bd,{variables:l,onInsert:g=>f({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Nudge Prompt"}),c.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>f({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Gn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),c.jsx(Bd,{variables:l,onInsert:g=>f({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Command"}),c.jsx("textarea",{value:e.command??"",onChange:g=>f({...e,command:g.target.value}),rows:3,className:`${Gn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),c.jsx(Bd,{variables:l,onInsert:g=>f({...e,command:(e.command??"")+`{{${g}}}`})})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Timeout (ms)"}),c.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>f({...e,timeout:Number(g.target.value)}),className:`${Gn} font-mono text-xs`})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Success Codes"}),c.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>f({...e,successExitCodes:g.target.value.split(",").map(p=>Number(p.trim())).filter(p=>!isNaN(p))}),className:`${Gn} font-mono text-xs`})]})]})]}),c.jsx("div",{className:"pt-1 border-t border-border/50",children:c.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const zv=[];function Ab({isOpen:e,onClose:i,initialEditId:r}){const s=$t(pe=>pe.workflows),l=$t(pe=>pe.modifiedIds),f=$t(pe=>pe.loading),m=$t(pe=>pe.templateVariables),o=$t(pe=>pe.fetchWorkflows),d=$t(pe=>pe.fetchWorkflow),h=$t(pe=>pe.fetchTemplateVariables),g=$t(pe=>pe.createWorkflow),p=$t(pe=>pe.updateWorkflow),v=$t(pe=>pe.deleteWorkflow),S=$t(pe=>pe.restoreDefault),E=$t(pe=>pe.restoreAllDefaults),[C,b]=F.useState("list"),[x,_]=F.useState(null),[y,j]=F.useState(null),[A,N]=F.useState(null),[R,T]=F.useState(null),[I,H]=F.useState(""),[G,K]=F.useState(""),[q,O]=F.useState(""),[W,V]=F.useState("1.0.0"),[Q,te]=F.useState("#3b82f6"),[L,D]=F.useState(""),[B,U]=F.useState(50),[P,Y]=F.useState(zv),[ne,Z]=F.useState({type:"always"}),[X,z]=F.useState(""),[ae,se]=F.useState(!1),[ge,be]=F.useState([]),[je,Te]=F.useState(null),[Le,Pe]=F.useState(!1);F.useEffect(()=>{e&&(o(),h(),fetch("/api/agents").then(pe=>pe.json()).then(pe=>be(pe.agents??[])).catch(()=>{}),j(null),Te(null),Pe(!1),N(null),T(null),r?(b("edit"),_(r),z(""),d(r).then(pe=>{pe&&(H(pe.metadata.name),K(pe.metadata.id),O(pe.metadata.description),V(pe.metadata.version),te(pe.metadata.color??"#3b82f6"),D(pe.entryStep),U(pe.settings.maxIterations),Y(pe.steps),Z(pe.startCondition??{type:"always"}))})):(b("list"),_(null)))},[e,o,d,h,r]);const we=()=>{_(null),H(""),K(""),O(""),V("1.0.0"),te("#3b82f6"),D(""),U(50),Y(structuredClone(zv)),Z({type:"always"}),z(""),N(null),T(null),b("edit")},st=async pe=>{const _e=await d(pe);_e&&(_(pe),H(_e.metadata.name),K(_e.metadata.id),O(_e.metadata.description),V(_e.metadata.version),te(_e.metadata.color??"#3b82f6"),D(_e.entryStep),U(_e.settings.maxIterations),Y(_e.steps),Z(_e.startCondition??{type:"always"}),z(""),N(null),T(null),b("edit"))},lt=async()=>{var Je;const pe=x??G;if(!pe||!I)return z("Name is required."),!1;if(P.length===0)return z("Add at least one step."),!1;let _e=L;if(!_e||!P.some(Me=>Me.id===_e)){if(_e=((Je=P.find(Me=>Me.id))==null?void 0:Je.id)??"",!_e)return z("All steps need an ID."),!1;D(_e)}se(!0),z("");const Ie={metadata:{id:pe,name:I,description:q,version:W||"1.0.0",color:Q},entryStep:_e,settings:{maxIterations:B},steps:P,startCondition:ne},We=x?await p(x,Ie):await g(Ie);return se(!1),We.success?(x||_(pe),!0):(z(We.error??"Failed to save."),!1)},he=async()=>{await lt()},De=async()=>{await lt()&&(r?i():b("list"))},Ze=()=>{r?i():b("list")},Qe=pe=>{H(pe),x||K(W3(pe))},qe=F.useCallback(pe=>{N(pe),T(null)},[]),at=F.useCallback(pe=>{T(pe),N(null)},[]),de=A!==null?Number(A):-1,ee=de>=0?P[de]??null:null,ve=F.useCallback(pe=>{Y(_e=>_e.map((Ie,We)=>We===de?pe:Ie))},[de]),Se=ne.type==="step_result"?`${ne.result}`:Nb[ne.type]??ne.type,Ce=()=>{const pe=P.length,_e=G3(P),Ie=ge.find(We=>!We.subagent);Y([...P,{id:_e,name:(Ie==null?void 0:Ie.name)??"Agent",type:"agent",phase:"build",toolMode:(Ie==null?void 0:Ie.id)??"builder",transitions:[]}]),L||D(_e),qe(String(pe))},ze=F.useCallback((pe,_e)=>{pe==="$start"?(D(_e),at("start")):Y(Ie=>{const We=Ie.find(Me=>Me.id===pe),Je=We?We.transitions.length:0;return at(`${pe}:${Je}`),Ie.map(Me=>Me.id===pe?{...Me,transitions:[...Me.transitions,{when:{type:"always"},goto:_e}]}:Me)})},[at]),Be=F.useCallback((pe,_e)=>{if(pe==="start")D(_e);else{const Ie=pe.lastIndexOf(":"),We=pe.slice(0,Ie),Je=parseInt(pe.slice(Ie+1));Y(Me=>Me.map(Dt=>Dt.id===We?{...Dt,transitions:Dt.transitions.map((kt,Wt)=>Wt===Je?{...kt,goto:_e}:kt)}:Dt))}},[]),ct=F.useCallback((pe,_e)=>{const Ie=pe.lastIndexOf(":"),We=pe.slice(0,Ie),Je=parseInt(pe.slice(Ie+1));Y(Me=>{const Dt=Me.find(Wt=>Wt.id===We);if(!Dt)return Me;const kt=Dt.transitions[Je];return kt?Me.map(Wt=>Wt.id===We?{...Wt,transitions:Wt.transitions.filter(($l,Ds)=>Ds!==Je)}:Wt.id===_e?{...Wt,transitions:[...Wt.transitions,kt]}:Wt):Me}),T(null)},[]),ut=F.useCallback(pe=>{if(pe==="start")D("");else{const _e=pe.lastIndexOf(":"),Ie=pe.slice(0,_e),We=parseInt(pe.slice(_e+1));Y(Je=>Je.map(Me=>Me.id===Ie?{...Me,transitions:Me.transitions.filter((Dt,kt)=>kt!==We)}:Me))}T(null)},[]),yt=F.useCallback((pe,_e)=>{if(pe==="start")Z(_e);else{const Ie=pe.lastIndexOf(":"),We=pe.slice(0,Ie),Je=parseInt(pe.slice(Ie+1));Y(Me=>Me.map(Dt=>Dt.id===We?{...Dt,transitions:Dt.transitions.map((kt,Wt)=>Wt===Je?{...kt,when:_e}:kt)}:Dt))}},[]),nt=pe=>Wh(pe,ge).name,An=()=>{if(!R)return null;if(R==="start"){const kt=P.find(Wt=>Wt.id===L);return{type:"start",fromLabel:"Start",toLabel:kt?nt(kt):"(none)",condition:ne}}const pe=R.lastIndexOf(":"),_e=R.slice(0,pe),Ie=parseInt(R.slice(pe+1)),We=P.find(kt=>kt.id===_e);if(!We)return null;const Je=We.transitions[Ie];if(!Je)return null;const Me=P.find(kt=>kt.id===Je.goto),Dt=Je.goto==="$done"?"Done":Me?nt(Me):Je.goto;return{type:"step",fromLabel:nt(We),toLabel:Dt,condition:Je.when}};if(C==="edit"){const pe=An();return c.jsxs(xn,{isOpen:e,onClose:Ze,title:x?"Edit Workflow":"New Workflow",size:"full",children:[X&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:X}),c.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[c.jsxs("div",{className:"min-w-[140px]",children:[c.jsx("label",{className:Qt,children:"Name"}),c.jsx("input",{value:I,onChange:_e=>Qe(_e.target.value),placeholder:"Workflow name",className:Gn})]}),c.jsxs("div",{className:"min-w-[100px]",children:[c.jsx("label",{className:Qt,children:"ID"}),c.jsx("input",{value:G,onChange:_e=>!x&&K(_e.target.value),readOnly:!!x,className:`${Gn} font-mono ${x?"opacity-50":""}`})]}),c.jsxs("div",{className:"flex-1 min-w-[140px]",children:[c.jsx("label",{className:Qt,children:"Description"}),c.jsx("input",{value:q,onChange:_e=>O(_e.target.value),placeholder:"What does this workflow do?",className:Gn})]}),c.jsxs("div",{className:"w-20",children:[c.jsx("label",{className:Qt,children:"Max Iter."}),c.jsx("input",{type:"number",value:B,onChange:_e=>U(Number(_e.target.value)),className:`${Gn} font-mono`})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Color"}),c.jsx("input",{type:"color",value:Q,onChange:_e=>te(_e.target.value),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent"})]})]}),c.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[c.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[c.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),c.jsx("button",{onClick:Ce,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),c.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[c.jsx(K3,{steps:P,entryStep:L,selectedNodeId:(ee==null?void 0:ee.id)??null,selectedEdgeKey:R,startConditionLabel:Se,agentTypes:ge,onSelectNode:_e=>{if(_e===null){qe(null);return}const Ie=P.findIndex(We=>We.id===_e);qe(Ie>=0?String(Ie):null)},onSelectEdge:at,onRemoveStep:_e=>{var We;const Ie=P.findIndex(Je=>Je.id===_e);if(Y(Je=>Je.filter(Me=>Me.id!==_e)),de===Ie&&qe(null),L===_e){const Je=P.filter(Me=>Me.id!==_e);D(((We=Je[0])==null?void 0:We.id)??"")}},onCreateTransition:ze,onReconnectTo:Be,onReconnectFrom:ct,onDeleteTransition:ut}),P.length===0&&c.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[c.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),c.jsx("button",{onClick:Ce,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"})]})]})]}),c.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[c.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:c.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),c.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:pe?pe.type==="start"?c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),L&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),c.jsx("span",{className:"text-text-primary font-medium",children:pe.toLabel})]}),c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Activation Condition"}),c.jsx("select",{value:ne.type,onChange:_e=>Z(_e.target.value==="step_result"?{type:"step_result",result:"success"}:{type:_e.target.value}),className:Ei,children:Tb.map(_e=>c.jsx("option",{value:_e.value,children:_e.label},_e.value))})]}),ne.type==="step_result"&&c.jsxs("div",{children:[c.jsx("label",{className:Qt,children:"Result"}),L&&(()=>{const _e=P.find(Me=>Me.id===L),Ie=_e&&(_e.type==="sub_agent"||_e.type==="agent")?ge.find(Me=>Me.id===(_e.type==="sub_agent"?_e.subAgentType:_e.toolMode)):void 0,We=(Ie==null?void 0:Ie.results)&&Ie.results.length>0,Je=(Ie==null?void 0:Ie.results)??[];return We?c.jsx("select",{value:ne.result??Je[0],onChange:Me=>Z({type:"step_result",result:Me.target.value}),className:Ei,children:Je.map(Me=>c.jsx("option",{value:Me,children:Me},Me))}):c.jsx("input",{type:"text",value:ne.result??"success",onChange:Me=>Z({type:"step_result",result:Me.target.value}),placeholder:"e.g. success, passed, failed",className:Gn})})()]}),c.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."})]}):c.jsx(X3,{fromLabel:pe.fromLabel,toLabel:pe.toLabel,condition:pe.condition,fromStep:pe.type==="step"?P.find(_e=>_e.id===pe.fromLabel):void 0,agentTypes:ge,onUpdateCondition:_e=>yt(R,_e),onDelete:()=>ut(R)}):ee?c.jsx(Z3,{step:ee,isEntry:ee.id===L,agentTypes:ge,transitionCount:ee.transitions.length,templateVariables:m,onUpdate:ve,onRemove:()=>{var _e;if(ee&&(Y(P.filter((Ie,We)=>We!==de)),qe(null),L===ee.id)){const Ie=P.filter((We,Je)=>Je!==de);D(((_e=Ie[0])==null?void 0:_e.id)??"")}},onSetEntry:()=>D(ee.id)}):c.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",c.jsx("br",{}),"Drag from a port to connect."]})})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[c.jsx(xt,{variant:"secondary",onClick:Ze,children:"Cancel"}),c.jsx(xt,{variant:"secondary",onClick:he,disabled:ae||!I,children:ae?"Saving...":"Save"}),c.jsx(xt,{variant:"primary",onClick:De,disabled:ae||!I,children:"Save & Close"})]})]})}return c.jsxs(xn,{isOpen:e,onClose:i,title:"Workflows",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(Le?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await E(),Pe(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),c.jsx("button",{onClick:()=>Pe(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Pe(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all workflows to defaults",children:"Restore Defaults"})),c.jsx(xt,{variant:"primary",size:"sm",onClick:we,children:"+ New"})]})]}),f&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):c.jsx("div",{className:"space-y-2",children:s.map(pe=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:pe.name}),c.jsxs("span",{className:"text-text-muted text-xs",children:["v",pe.version]}),l.includes(pe.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:pe.description})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.includes(pe.id)&&(je===pe.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await S(pe.id),Te(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),c.jsx("button",{onClick:()=>Te(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Te(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(Jr,{onClick:()=>st(pe.id)}),pe.id!=="default"&&(y===pe.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>{v(pe.id),j(null)},className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs",children:"Delete"}),c.jsx("button",{onClick:()=>j(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs",children:"Cancel"})]}):c.jsx("button",{onClick:()=>j(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}))]})]},pe.id))})]})}function Q3(e,i){const r=e.startCondition;if(!r||r.type==="always")return!0;switch(r.type){case"has_pending_criteria":return i.some(s=>s.status.type!=="passed");case"all_criteria_passed":return i.length===0||i.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return i.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return i.some(s=>s.status.type==="failed"&&s.attempts.filter(l=>l.status==="failed").length>=4);case"step_result":return null;default:return null}}function J3({onSelectWorkflow:e,onOpenManager:i,criteria:r}){const[s,l]=F.useState(!1),[f,m]=F.useState(""),[o,d]=F.useState(0),[h,g]=F.useState(null),p=F.useRef(null),v=F.useRef(null),S=$t(y=>y.workflows),E=$t(y=>y.fetchWorkflows);F.useEffect(()=>{s&&(E(),m(""),d(0),requestAnimationFrame(()=>{var y;return(y=v.current)==null?void 0:y.focus()}))},[s,E]),F.useEffect(()=>{if(!s)return;const y=j=>{p.current&&!p.current.contains(j.target)&&l(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const C=S.filter(y=>{if(!f)return!0;const j=f.toLowerCase();return y.name.toLowerCase().includes(j)}),b=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),d(j=>Math.min(j+1,C.length-1));break;case"ArrowUp":y.preventDefault(),d(j=>Math.max(j-1,0));break;case"Enter":y.preventDefault(),C[o]&&x(C[o].id);break;case"Escape":y.preventDefault(),l(!1);break}},x=y=>{e(y),l(!1)},_=()=>{l(!1),i()};return c.jsxs("div",{ref:p,className:"relative",children:[c.jsxs("button",{type:"button",onClick:()=>l(y=>!y),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Workflows",c.jsx("svg",{className:`w-3 h-3 transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&c.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:b,children:[c.jsx("div",{className:"p-2 border-b border-border",children:c.jsx("input",{ref:v,value:f,onChange:y=>{m(y.target.value),d(0)},placeholder:"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),c.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:C.length===0?c.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:S.length===0?"No workflows yet":"No matches"}):C.map((y,j)=>{const A=Q3(y,r),N=y.color??"#3b82f6";return c.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${j===o?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[c.jsxs("button",{type:"button",onClick:()=>x(y.id),className:"flex-1 text-left flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:N}}),c.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:y.name}),A!==null&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:A?"#22c55e":"#6b7280"},title:A?"Entry condition met":"Entry condition not met"})]}),c.jsx(Jr,{className:"opacity-0 group-hover:opacity-100",onClick:R=>{R.stopPropagation(),l(!1),g(y.id)}})]},y.id)})}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:_,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 Workflows..."})})]}),c.jsx(Ab,{isOpen:!!h,onClose:()=>g(null),initialEditId:h})]})}function eT(e){return e==="criterion"}function tT(e){var i,r;return e.role!=="assistant"||e.subAgentId||(i=e.content)!=null&&i.trim()||(r=e.thinkingContent)!=null&&r.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>eT(s.name))}function nT(e,i=[]){const r=[];let s=null,l=[],f,m=1;const o=new Map,d=new Map,h=[];for(const S of i)S.type==="message"?o.set(S.message.id,S):S.type==="subagent"?d.set(S.subAgentId,S):S.type==="criteria-batch"&&h.push(S);let g=0;const p=()=>{if(l.length>0){const S=h[g];S&&S.type==="criteria-batch"&&S.toolCalls.length===l.length&&S.toolCalls.every((C,b)=>{var x;return C.id===((x=l[b])==null?void 0:x.id)})?r.push(S):r.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},v=()=>{if(!s)return;const S=s,E=d.get(S.subAgentId);E&&E.type==="subagent"&&E.messages.length===S.messages.length&&E.messages.every((b,x)=>b===S.messages[x])?r.push(E):r.push({type:"subagent",subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:S.messages}),s=null};for(const S of e)if(S.role!=="tool"){if(S.contextWindowId&&f&&S.contextWindowId!==f&&(p(),v(),m++,r.push({type:"context-divider",windowSequence:m})),f=S.contextWindowId,tT(S)){v();for(const E of S.toolCalls)l.push(E);continue}if(p(),S.subAgentId&&S.subAgentType)s&&s.subAgentId===S.subAgentId?s.messages.push(S):(v(),s={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{v();const E=o.get(S.id);E&&E.type==="message"&&E.message===S?r.push(E):r.push({type:"message",message:S})}}return p(),v(),r}function rT(e){const i=new Date(e),r=i.getFullYear(),s=String(i.getMonth()+1).padStart(2,"0"),l=String(i.getDate()).padStart(2,"0"),f=String(i.getHours()).padStart(2,"0"),m=String(i.getMinutes()).padStart(2,"0");return`${r}/${s}/${l} ${f}:${m}`}function iT(e,i){return e.length<=i?e:e.substring(0,i)+"..."}const sT=10,aT=150;function oT(e,i,r){const s=[],l=e.filter(o=>o.role==="user"&&!o.isSystemGenerated&&o.messageKind!=="auto-prompt");for(const o of l)s.push({id:o.id,content:o.content,timestamp:o.timestamp,sessionId:r,sessionName:"This session"});for(const o of i)if(!(r&&o.id===r)&&o.recentUserPrompts)for(const d of o.recentUserPrompts)s.push({id:d.id,content:d.content,timestamp:d.timestamp,sessionId:o.id,sessionName:o.title||o.id});s.sort((o,d)=>new Date(d.timestamp).getTime()-new Date(o.timestamp).getTime());const f=s.slice(0,sT);f.reverse();const m=[];for(const o of f)m.push({id:o.id,content:o.content,timestamp:o.timestamp,formattedTimestamp:rT(o.timestamp),trimmedContent:iT(o.content,aT),sessionId:o.sessionId||void 0,sessionName:o.sessionName});return m}function lT(e,i=[],r=null){const[s,l]=F.useState(0),[f,m]=F.useState(!1),o=F.useMemo(()=>oT(e,i,r),[e,i,r]),d=F.useCallback(()=>{o.length>0&&(l(o.length-1),m(!0))},[o.length]),h=F.useCallback(()=>{m(!1),l(0)},[]),g=F.useCallback(()=>{l(S=>o.length===0?S:S===0?o.length-1:S-1)},[o.length]),p=F.useCallback(()=>{l(S=>o.length===0?S:S===o.length-1?0:S+1)},[o.length]),v=F.useCallback(()=>{if(o.length===0||!f)return null;const S=o[s];return(S==null?void 0:S.content)??null},[o,s,f]);return{history:o,selectedIndex:s,showHistory:f,openHistory:d,closeHistory:h,navigateUp:g,navigateDown:p,selectCurrent:v}}const cT=(e,i)=>{let r,s=!1,l=!1,f=!1,m=!1;const o=()=>{m=!0;const h=e.current;h&&(h.scrollTop=h.scrollHeight),setTimeout(()=>{m=!1},100)},d=()=>{r=requestAnimationFrame(o),setTimeout(()=>{r=requestAnimationFrame(o)},250),setTimeout(()=>{r=requestAnimationFrame(o)},500),setTimeout(()=>{r=requestAnimationFrame(o)},1e3)};return F.useEffect(()=>{const h=e.current;if(!h)return;const g=new MutationObserver(()=>{if(s||l){cancelAnimationFrame(r);return}r=requestAnimationFrame(o)});d(),g.observe(h,{childList:!0,subtree:!0,characterData:!0});const p=setInterval(()=>{if(s||l){cancelAnimationFrame(r);return}o()},1e3),v=C=>{if(f||m)return;h.scrollHeight-h.scrollTop-h.offsetHeight>50?(cancelAnimationFrame(r),s=!0,console.log("Scroll detected!",C)):s=!1},S=()=>l=!0,E=()=>l=!1;return h.addEventListener("wheel",v,{passive:!0}),h.addEventListener("touchstart",S,{passive:!0}),h.addEventListener("touchend",E,{passive:!0}),()=>{h.removeEventListener("wheel",v),h.removeEventListener("touchstart",S),h.removeEventListener("touchend",E),g.disconnect(),clearInterval(p)}},[i==null?void 0:i.id]),{force_scroll_to_bottom:()=>{s=!1,l=!1,f=!0,o(),setTimeout(()=>o(),250),setTimeout(()=>o(),500),setTimeout(()=>o(),750),setTimeout(()=>o(),1e3),setTimeout(()=>{f=!1},1250)}}};function uT(){const[e,i]=F.useState(!0),[r,s]=F.useState(""),[l,f]=F.useState([]),[m,o]=F.useState(!1),[d,h]=F.useState(null),[g,p]=F.useState(!1),[v,S]=F.useState(!1),E=F.useRef(null),C=F.useRef(null),b=F.useRef(null),x=Ee(ee=>ee.currentSession),_=Ee(ee=>ee.messages),y=Ee(ee=>ee.streamingMessage),j=Ee(ee=>ee.sessions),A=Ee(ee=>ee.error),N=Ee(ee=>ee.pendingQuestion),R=Xv(),T=Ee(ee=>ee.sendMessage),I=Ee(ee=>ee.clearError),H=Ee(ee=>ee.acceptAndBuild),G=Ee(ee=>ee.stopGeneration),K=Ee(ee=>ee.launchRunner),q=Ee(ee=>ee.cancelQueued),O=X1(),W=$t(ee=>ee.workflows),V=$t(ee=>ee.fetchWorkflows);F.useEffect(()=>{V()},[V]);const{history:Q,selectedIndex:te,showHistory:L,openHistory:D,closeHistory:B,navigateUp:U,navigateDown:P,selectCurrent:Y}=lT(_,j,x==null?void 0:x.id),ne=F.useMemo(()=>y?_.map(ee=>ee.id===y.id?y:ee):_,[_,y]),Z=F.useRef([]),X=F.useMemo(()=>{const ee=nT(ne,Z.current);return Z.current=ee,ee},[ne]),z=F.useMemo(()=>H3(_),[_]),{force_scroll_to_bottom:ae}=cT(E,x),se=F.useCallback(()=>{const ee=C.current;if(!ee)return;ee.style.height="auto";const ve=Math.min(200,ee.scrollHeight);ee.style.height=`${ve}px`},[]);F.useEffect(()=>{if(!(x!=null&&x.id))return;const ee=`openfox:draft:${x.id}`,ve=localStorage.getItem(ee);ve!==null&&s(ve)},[x==null?void 0:x.id]),F.useEffect(()=>{var ee;(ee=C.current)==null||ee.focus(),se()},[x==null?void 0:x.id,se]),F.useEffect(()=>{if(!(x!=null&&x.id))return;const ee=`openfox:draft:${x.id}`,ve=setTimeout(()=>{r?localStorage.setItem(ee,r):localStorage.removeItem(ee)},500);return()=>clearTimeout(ve)},[x==null?void 0:x.id,r]),F.useEffect(()=>{se()},[r,se]),F.useEffect(()=>{const ee=ve=>{ve.key==="Escape"&&R&&G()};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[R,G]),F.useEffect(()=>{const ee=C.current;if(!ee)return;const ve=Se=>{var ze;if(document.activeElement!==ee)return;const Ce=(ze=Se.clipboardData)==null?void 0:ze.items;if(Ce){for(const Be of Array.from(Ce))if(Be.type.startsWith("image/")){Se.preventDefault();const ct=Be.getAsFile();if(!ct)continue;(async()=>{try{if(!Md(ct)){h("Only PNG, JPG, and GIF images are supported.");return}const ut=Od(ct,50*1024*1024);if(!ut.valid){h(ut.error??"Image file is too large");return}const yt=await Ld(ct,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),nt={id:gl(),filename:"pasted-image",mimeType:yt.mimeType,size:yt.size,data:yt.dataUrl};f(An=>[...An,nt])}catch(ut){const yt=ut instanceof Error?ut.message??"Failed to process image":"Failed to process image";h(yt)}})()}}};return ee.addEventListener("paste",ve),()=>ee.removeEventListener("paste",ve)},[]);const ge=()=>{s(""),f([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},be=async ee=>{ee.preventDefault(),!(!r.trim()&&l.length===0)&&(ae(),T(r,l.length>0?l:void 0),ge())},je=ee=>{if(L)switch(ee.key){case"Enter":ee.preventDefault();const ve=Y();ve&&(s(ve),B());return;case"Escape":ee.preventDefault(),B(),R&&G();return;case"ArrowUp":ee.preventDefault(),U();return;case"ArrowDown":ee.preventDefault(),P();return}if(ee.key==="ArrowUp"&&r.trim()===""&&!L){ee.preventDefault(),D();return}ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),be(ee))},Te=F.useCallback(async ee=>{const ve=ee.target.files;if(!(!ve||ve.length===0)){h(null);for(const Se of Array.from(ve))try{if(!Md(Se)){h(`Unsupported file type: ${Se.type}. Only PNG, JPG, and GIF are supported.`);continue}const Ce=Od(Se,50*1024*1024);if(!Ce.valid){h(Ce.error??"Image file is too large");continue}const ze=await Ld(Se,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),Be={id:gl(),filename:Se.name,mimeType:ze.mimeType,size:ze.size,data:ze.dataUrl};f(ct=>[...ct,Be])}catch(Ce){const ze=Ce instanceof Error?Ce.message??"Failed to process image":"Failed to process image";h(ze)}b.current&&(b.current.value="")}},[]),Le=F.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),o(!0)},[]),Pe=F.useCallback(ee=>{ee.preventDefault(),ee.stopPropagation(),o(!1)},[]),we=F.useCallback(async ee=>{ee.preventDefault(),ee.stopPropagation(),o(!1),h(null);const ve=ee.dataTransfer.files;if(!(!ve||ve.length===0))for(const Se of Array.from(ve))try{if(!Md(Se)){h(`Unsupported file type: ${Se.type}. Only PNG, JPG, and GIF are supported.`);continue}const Ce=Od(Se,50*1024*1024);if(!Ce.valid){h(Ce.error??"Image file is too large");continue}const ze=await Ld(Se,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),Be={id:gl(),filename:Se.name,mimeType:ze.mimeType,size:ze.size,data:ze.dataUrl};f(ct=>[...ct,Be])}catch(Ce){const ze=Ce instanceof Error?Ce.message??"Failed to process image":"Failed to process image";h(ze)}},[]),st=F.useCallback(ee=>{f(ve=>ve.filter(Se=>Se.id!==ee))},[]),lt=F.useCallback(()=>{var ee;(ee=b.current)==null||ee.click()},[]),he=(x==null?void 0:x.mode)==="planner",De=(x==null?void 0:x.mode)==="builder",Ze=((x==null?void 0:x.criteria.length)??0)>0,Qe=(x==null?void 0:x.phase)==="done",qe=X.some(ee=>ee.type==="message"&&ee.message.role==="assistant"),at=he&&Ze&&!R&&qe&&!Qe,de=ee=>{const ve=r.trim()?r:void 0,Se=l.length>0?l:void 0;he?H(ee,ve,Se):De&&K(ve,Se,ee),ge()};return c.jsxs(hw,{criteriaSidebarOpen:e,messages:ne,children:[N&&c.jsx(j3,{question:N}),c.jsx(pw,{criteriaSidebarOpen:e,onCriteriaSidebarToggle:()=>i(!e)}),c.jsxs("div",{ref:E,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto",children:[c.jsx("div",{className:"pt-4",children:X.map((ee,ve)=>{if(ee.type==="context-divider")return c.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[c.jsx("div",{className:"flex-1 border-t border-border"}),c.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),c.jsx("div",{className:"flex-1 border-t border-border"})]},ve);if(ee.type==="subagent"){const Ce=ee.messages.some(ze=>ze.isStreaming);return c.jsx("div",{className:"px-2 md:px-4",children:c.jsx(S3,{messages:ee.messages,subAgentType:ee.subAgentType,isStreaming:Ce})},ve)}if(ee.type==="criteria-batch")return c.jsx("div",{className:"feed-item px-2 md:px-4",children:c.jsx(Cb,{toolCalls:ee.toolCalls,criteria:x==null?void 0:x.criteria})},ve);const Se=ee.message;return Se.role==="assistant"?c.jsx("div",{className:"px-2 md:px-4",children:c.jsx($h,{message:Se,showStats:!0})},ve):c.jsx("div",{className:"px-2 md:px-4",children:c.jsx(kb,{message:Se,isLastAssistantMessage:!1,promptContext:Se.role==="user"?z[Se.id]:void 0})},ve)})}),c.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[A&&c.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-red-400 text-sm font-medium",children:A.code}),c.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:A.message})]}),c.jsx("button",{onClick:I,className:"text-red-400 hover:text-red-300 p-0.5","aria-label":"Dismiss error",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),at&&c.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:W.map(ee=>{const ve=ee.color??"#3b82f6",Se=parseInt(ve.slice(1,3),16),Ce=parseInt(ve.slice(3,5),16),ze=parseInt(ve.slice(5,7),16),Be=`rgba(${Se},${Ce},${ze},0.12)`,ct=`rgba(${Se},${Ce},${ze},0.22)`,ut=`rgba(${Se},${Ce},${ze},0.25)`;return c.jsxs("button",{onClick:()=>H(ee.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:Be,color:ve,border:`1px solid ${ut}`},onMouseEnter:yt=>{yt.currentTarget.style.backgroundColor=ct},onMouseLeave:yt=>{yt.currentTarget.style.backgroundColor=Be},children:["▶ ",ee.name]},ee.id)})}),R&&c.jsx(N3,{})]})]}),c.jsxs("form",{onSubmit:be,className:"p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[c.jsx("input",{ref:b,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:Te,className:"hidden",multiple:!0}),d&&c.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:d}),l.length>0&&c.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:l.map(ee=>c.jsx(T3,{attachment:ee,onRemove:st},ee.id))}),L&&c.jsx(A3,{history:Q,selectedIndex:te,onSelect:ee=>{s(ee),B()},onEscape:B,onNavigate:ee=>{ee==="up"?U():P()}}),O.length>0&&c.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:O.map(ee=>c.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ee.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:[c.jsxs("span",{className:"font-medium",children:[ee.mode==="asap"?"ASAP":"Queue",":"]}),c.jsx("span",{className:"truncate max-w-[200px]",children:ee.content}),c.jsx("button",{type:"button",onClick:()=>q(ee.queueId),className:"hover:text-white transition-colors",children:c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},ee.queueId))}),c.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${m?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:Le,onDragLeave:Pe,onDrop:we,children:[c.jsx("button",{type:"button",onClick:lt,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("textarea",{ref:C,value:r,onChange:ee=>{s(ee.target.value),L&&B()},onKeyDown:je,placeholder:he?"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"}}),c.jsxs("div",{className:"flex flex-col items-end gap-1",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(q3,{onSendCommand:(ee,ve,Se,Ce)=>{var Be;ve&&(x==null?void 0:x.mode)!==ve&&Ee.getState().switchMode(ve);const ze=Se&&Se.trim()?`${Se.trim()}
140
+
141
+ ${ee}`:ee;(Be=E.current)==null||Be.scrollTo({top:E.current.scrollHeight,behavior:"smooth"}),T(ze,Ce!=null&&Ce.length?Ce:void 0,{messageKind:"command",isSystemGenerated:!0}),ge()},onOpenManager:()=>p(!0),textareaContent:r,attachments:l.length>0?l:void 0}),c.jsx(J3,{onSelectWorkflow:de,onOpenManager:()=>S(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("button",{type:"button",onClick:()=>{var ee;!r.trim()&&l.length===0||((ee=E.current)==null||ee.scrollTo({top:E.current.scrollHeight,behavior:"smooth"}),T(r,l),ge())},disabled:!r.trim()&&l.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"})})]})]}),c.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(k3,{}),c.jsx(E3,{})]}),c.jsx(U3,{})]})]}),c.jsx(jb,{isOpen:g,onClose:()=>p(!1)}),c.jsx(Ab,{isOpen:v,onClose:()=>S(!1)})]})}F.memo(function({item:i}){const[r,s]=F.useState(!1);return i.type==="start"?c.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:[c.jsx("span",{className:"animate-pulse",children:"●"}),c.jsx("span",{children:"Delegating image to fallback vision model..."}),i.filename&&c.jsxs("span",{className:"text-amber-400/70",children:["(",i.filename,")"]})]}):c.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[c.jsx("span",{className:"text-accent-success",children:"✓"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),c.jsx("button",{type:"button",onClick:()=>s(!r),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:r?"Hide":"Show"})]}),r&&i.description&&c.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:c.jsx(As,{content:i.description})})]})]})});function Db(){return c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(ch,{})})}function dT({sidebarOpen:e,onSidebarToggle:i}){const[,r]=ih("/p/:projectId"),s=r==null?void 0:r.projectId,l=Ee(h=>h.connectionStatus),f=Ee(h=>h.listSessions),m=Ee(h=>h.clearSession),o=qt(h=>h.currentProject),d=qt(h=>h.loadProject);return F.useEffect(()=>{l==="connected"&&s&&((o==null?void 0:o.id)!==s&&d(s),f(s),m())},[l,s,o==null?void 0:o.id,d,f,m]),!o||o.id!==s?c.jsx(Db,{}):c.jsxs(c.Fragment,{children:[c.jsx(n0,{projectId:s,isOpen:e,onClose:i}),c.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:c.jsx(RS,{})})]})}function hT({sidebarOpen:e,onSidebarToggle:i}){const[,r]=ih("/p/:projectId/s/:sessionId"),s=r==null?void 0:r.projectId,l=r==null?void 0:r.sessionId,[,f]=Ni(),m=Ee(C=>C.connectionStatus),o=Ee(C=>C.currentSession),d=Ee(C=>C.loadSession),h=Ee(C=>C.listSessions),g=Ee(C=>C.pendingSessionCreate),p=Ee(C=>C.error),v=Ee(C=>C.clearError),S=qt(C=>C.currentProject),E=qt(C=>C.loadProject);return F.useEffect(()=>{m==="connected"&&s&&(S==null?void 0:S.id)!==s&&E(s)},[m,s,S==null?void 0:S.id,E]),F.useEffect(()=>{m==="connected"&&l&&(o==null?void 0:o.id)!==l&&!g&&d(l),m==="connected"&&s&&h(s)},[m,l,o==null?void 0:o.id,d,h,g,s]),F.useEffect(()=>{(p==null?void 0:p.code)==="NOT_FOUND"&&s&&(v(),f(`/p/${s}`))},[p,s,v,f]),!S||S.id!==s?c.jsx(Db,{}):c.jsxs(c.Fragment,{children:[c.jsx(n0,{projectId:s,isOpen:e,onClose:i}),c.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:c.jsx(uT,{})})]})}function fT(){const{connectionStatus:e}=Q1(),i=Zt(l=>l.fetchConfig),[r,s]=F.useState(!1);return F.useEffect(()=>{i()},[i]),e!=="connected"?c.jsx("div",{className:"h-screen flex items-center justify-center",children:c.jsx(AS,{text:e==="reconnecting"?"Reconnecting...":"Connecting to server..."})}):c.jsxs("div",{className:"h-screen flex flex-col",children:[c.jsx(wS,{}),c.jsx(bS,{onMenuClick:()=>s(!r)}),c.jsx("div",{className:"flex-1 flex overflow-hidden",children:c.jsxs(k1,{children:[c.jsx(ll,{path:"/p/:projectId/s/:sessionId",children:c.jsx(hT,{sidebarOpen:r,onSidebarToggle:()=>s(!1)})}),c.jsx(ll,{path:"/p/:projectId/new",children:c.jsx(DS,{})}),c.jsx(ll,{path:"/p/:projectId",children:c.jsx(dT,{sidebarOpen:r,onSidebarToggle:()=>s(!1)})}),c.jsx(ll,{path:"/",children:c.jsx(NS,{})})]})})]})}r1.createRoot(document.getElementById("root")).render(c.jsx(an.StrictMode,{children:c.jsx(fT,{})}));