@rynx-ai/server 0.1.9 → 0.1.10-beta.3

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 (39) hide show
  1. package/dist/browser-surface-ws.d.ts +2 -0
  2. package/dist/browser-surface-ws.js +1 -0
  3. package/dist/control-api.d.ts +17 -0
  4. package/dist/control-api.js +809 -9
  5. package/dist/control-web/assets/{highlighted-body-OFNGDK62-e-w61YLy.js → highlighted-body-OFNGDK62-D-FhYROw.js} +1 -1
  6. package/dist/control-web/assets/index-BKzSsGxH.js +671 -0
  7. package/dist/control-web/assets/index-DykWY_Vk.css +32 -0
  8. package/dist/control-web/assets/{mermaid-GHXKKRXX-DZn7Hbr2.js → mermaid-GHXKKRXX-DE-Ovg9T.js} +3 -3
  9. package/dist/control-web/index.html +2 -2
  10. package/dist/desktop-browser-host.d.ts +20 -3
  11. package/dist/desktop-browser-host.js +126 -44
  12. package/dist/direct-runtime-browser-inspect-server.d.ts +72 -0
  13. package/dist/direct-runtime-browser-inspect-server.js +749 -0
  14. package/dist/direct-runtime-server.d.ts +6 -0
  15. package/dist/direct-runtime-server.js +29 -1
  16. package/dist/emulator-surface-ws.d.ts +2 -0
  17. package/dist/emulator-surface-ws.js +1 -0
  18. package/dist/machine-session-service.d.ts +88 -5
  19. package/dist/machine-session-service.js +283 -20
  20. package/dist/remote-runtime-dispatcher.d.ts +1 -1
  21. package/dist/remote-runtime-dispatcher.js +25 -2
  22. package/dist/remote-runtime-session-projection.js +10 -0
  23. package/dist/runtime-web-auth.d.ts +5 -0
  24. package/dist/runtime-web-auth.js +43 -3
  25. package/dist/server.d.ts +78 -8
  26. package/dist/server.js +42 -17
  27. package/dist/session-browser-service.d.ts +30 -0
  28. package/dist/session-browser-service.js +89 -3
  29. package/dist/session-browser-surface-coordinator.d.ts +4 -3
  30. package/dist/session-browser-surface-coordinator.js +374 -268
  31. package/dist/session-runtime-index.d.ts +6 -0
  32. package/dist/session-runtime-index.js +10 -0
  33. package/dist/session-terminal-host.d.ts +6 -1
  34. package/dist/session-terminal-host.js +18 -0
  35. package/dist/terminal-ws.d.ts +3 -0
  36. package/dist/terminal-ws.js +1 -0
  37. package/package.json +12 -7
  38. package/dist/control-web/assets/index-BQ7XVBKO.css +0 -32
  39. package/dist/control-web/assets/index-ClpzuBJx.js +0 -606
@@ -0,0 +1,671 @@
1
+ var KD=Object.defineProperty;var XD=(e,t,r)=>t in e?KD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Fr=(e,t,r)=>XD(e,typeof t!="symbol"?t+"":t,r);function ZD(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();function gx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jg={exports:{}},eu={};/**
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 HS;function QD(){if(HS)return eu;HS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,s,o){var u=null;if(o!==void 0&&(u=""+o),s.key!==void 0&&(u=""+s.key),"key"in s){o={};for(var d in s)d!=="key"&&(o[d]=s[d])}else o=s;return s=o.ref,{$$typeof:e,type:i,key:u,ref:s!==void 0?s:null,props:o}}return eu.Fragment=t,eu.jsx=r,eu.jsxs=r,eu}var FS;function JD(){return FS||(FS=1,Jg.exports=QD()),Jg.exports}var l=JD(),ev={exports:{}},Ye={};/**
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 WS;function eL(){if(WS)return Ye;WS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),x=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function S(I,Y,X){this.props=I,this.context=Y,this.refs=E,this.updater=X||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,Y){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,Y,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=S.prototype;function k(I,Y,X){this.props=I,this.context=Y,this.refs=E,this.updater=X||w}var R=k.prototype=new N;R.constructor=k,C(R,S.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function L(){}var z={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function W(I,Y,X){var ee=X.ref;return{$$typeof:e,type:I,key:Y,ref:ee!==void 0?ee:null,props:X}}function G(I,Y){return W(I.type,Y,I.props)}function q(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function B(I){var Y={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(X){return Y[X]})}var j=/\/+/g;function O(I,Y){return typeof I=="object"&&I!==null&&I.key!=null?B(""+I.key):Y.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(L,L):(I.status="pending",I.then(function(Y){I.status==="pending"&&(I.status="fulfilled",I.value=Y)},function(Y){I.status==="pending"&&(I.status="rejected",I.reason=Y)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function T(I,Y,X,ee,re){var oe=typeof I;(oe==="undefined"||oe==="boolean")&&(I=null);var Z=!1;if(I===null)Z=!0;else switch(oe){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(I.$$typeof){case e:case t:Z=!0;break;case v:return Z=I._init,T(Z(I._payload),Y,X,ee,re)}}if(Z)return re=re(I),Z=ee===""?"."+O(I,0):ee,M(re)?(X="",Z!=null&&(X=Z.replace(j,"$&/")+"/"),T(re,Y,X,"",function(we){return we})):re!=null&&(q(re)&&(re=G(re,X+(re.key==null||I&&I.key===re.key?"":(""+re.key).replace(j,"$&/")+"/")+Z)),Y.push(re)),1;Z=0;var ce=ee===""?".":ee+":";if(M(I))for(var ne=0;ne<I.length;ne++)ee=I[ne],oe=ce+O(ee,ne),Z+=T(ee,Y,X,oe,re);else if(ne=y(I),typeof ne=="function")for(I=ne.call(I),ne=0;!(ee=I.next()).done;)ee=ee.value,oe=ce+O(ee,ne++),Z+=T(ee,Y,X,oe,re);else if(oe==="object"){if(typeof I.then=="function")return T($(I),Y,X,ee,re);throw Y=String(I),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Z}function U(I,Y,X){if(I==null)return I;var ee=[],re=0;return T(I,ee,"","",function(oe){return Y.call(X,oe,re++)}),ee}function H(I){if(I._status===-1){var Y=I._result;Y=Y(),Y.then(function(X){(I._status===0||I._status===-1)&&(I._status=1,I._result=X)},function(X){(I._status===0||I._status===-1)&&(I._status=2,I._result=X)}),I._status===-1&&(I._status=0,I._result=Y)}if(I._status===1)return I._result.default;throw I._result}var F=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},V={map:U,forEach:function(I,Y,X){U(I,function(){Y.apply(this,arguments)},X)},count:function(I){var Y=0;return U(I,function(){Y++}),Y},toArray:function(I){return U(I,function(Y){return Y})||[]},only:function(I){if(!q(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Ye.Activity=p,Ye.Children=V,Ye.Component=S,Ye.Fragment=r,Ye.Profiler=s,Ye.PureComponent=k,Ye.StrictMode=i,Ye.Suspense=m,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(I){return z.H.useMemoCache(I)}},Ye.cache=function(I){return function(){return I.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(I,Y,X){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ee=C({},I.props),re=I.key;if(Y!=null)for(oe in Y.key!==void 0&&(re=""+Y.key),Y)!D.call(Y,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&Y.ref===void 0||(ee[oe]=Y[oe]);var oe=arguments.length-2;if(oe===1)ee.children=X;else if(1<oe){for(var Z=Array(oe),ce=0;ce<oe;ce++)Z[ce]=arguments[ce+2];ee.children=Z}return W(I.type,re,ee)},Ye.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:o,_context:I},I},Ye.createElement=function(I,Y,X){var ee,re={},oe=null;if(Y!=null)for(ee in Y.key!==void 0&&(oe=""+Y.key),Y)D.call(Y,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(re[ee]=Y[ee]);var Z=arguments.length-2;if(Z===1)re.children=X;else if(1<Z){for(var ce=Array(Z),ne=0;ne<Z;ne++)ce[ne]=arguments[ne+2];re.children=ce}if(I&&I.defaultProps)for(ee in Z=I.defaultProps,Z)re[ee]===void 0&&(re[ee]=Z[ee]);return W(I,oe,re)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(I){return{$$typeof:d,render:I}},Ye.isValidElement=q,Ye.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:H}},Ye.memo=function(I,Y){return{$$typeof:h,type:I,compare:Y===void 0?null:Y}},Ye.startTransition=function(I){var Y=z.T,X={};z.T=X;try{var ee=I(),re=z.S;re!==null&&re(X,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(L,F)}catch(oe){F(oe)}finally{Y!==null&&X.types!==null&&(Y.types=X.types),z.T=Y}},Ye.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ye.use=function(I){return z.H.use(I)},Ye.useActionState=function(I,Y,X){return z.H.useActionState(I,Y,X)},Ye.useCallback=function(I,Y){return z.H.useCallback(I,Y)},Ye.useContext=function(I){return z.H.useContext(I)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(I,Y){return z.H.useDeferredValue(I,Y)},Ye.useEffect=function(I,Y){return z.H.useEffect(I,Y)},Ye.useEffectEvent=function(I){return z.H.useEffectEvent(I)},Ye.useId=function(){return z.H.useId()},Ye.useImperativeHandle=function(I,Y,X){return z.H.useImperativeHandle(I,Y,X)},Ye.useInsertionEffect=function(I,Y){return z.H.useInsertionEffect(I,Y)},Ye.useLayoutEffect=function(I,Y){return z.H.useLayoutEffect(I,Y)},Ye.useMemo=function(I,Y){return z.H.useMemo(I,Y)},Ye.useOptimistic=function(I,Y){return z.H.useOptimistic(I,Y)},Ye.useReducer=function(I,Y,X){return z.H.useReducer(I,Y,X)},Ye.useRef=function(I){return z.H.useRef(I)},Ye.useState=function(I){return z.H.useState(I)},Ye.useSyncExternalStore=function(I,Y,X){return z.H.useSyncExternalStore(I,Y,X)},Ye.useTransition=function(){return z.H.useTransition()},Ye.version="19.2.7",Ye}var qS;function vx(){return qS||(qS=1,ev.exports=eL()),ev.exports}var g=vx();const Ce=gx(g),La=ZD({__proto__:null,default:Ce},[g]);var tv={exports:{}},tu={},rv={exports:{}},iv={};/**
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 VS;function tL(){return VS||(VS=1,(function(e){function t(T,U){var H=T.length;T.push(U);e:for(;0<H;){var F=H-1>>>1,V=T[F];if(0<s(V,U))T[F]=U,T[H]=V,H=F;else break e}}function r(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var U=T[0],H=T.pop();if(H!==U){T[0]=H;e:for(var F=0,V=T.length,I=V>>>1;F<I;){var Y=2*(F+1)-1,X=T[Y],ee=Y+1,re=T[ee];if(0>s(X,H))ee<V&&0>s(re,X)?(T[F]=re,T[ee]=H,F=ee):(T[F]=X,T[Y]=H,F=Y);else if(ee<V&&0>s(re,H))T[F]=re,T[ee]=H,F=ee;else break e}}return U}function s(T,U){var H=T.sortIndex-U.sortIndex;return H!==0?H:T.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],h=[],v=1,p=null,x=3,y=!1,w=!1,C=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function R(T){for(var U=r(h);U!==null;){if(U.callback===null)i(h);else if(U.startTime<=T)i(h),U.sortIndex=U.expirationTime,t(m,U);else break;U=r(h)}}function M(T){if(C=!1,R(T),!w)if(r(m)!==null)w=!0,L||(L=!0,B());else{var U=r(h);U!==null&&$(M,U.startTime-T)}}var L=!1,z=-1,D=5,W=-1;function G(){return E?!0:!(e.unstable_now()-W<D)}function q(){if(E=!1,L){var T=e.unstable_now();W=T;var U=!0;try{e:{w=!1,C&&(C=!1,N(z),z=-1),y=!0;var H=x;try{t:{for(R(T),p=r(m);p!==null&&!(p.expirationTime>T&&G());){var F=p.callback;if(typeof F=="function"){p.callback=null,x=p.priorityLevel;var V=F(p.expirationTime<=T);if(T=e.unstable_now(),typeof V=="function"){p.callback=V,R(T),U=!0;break t}p===r(m)&&i(m),R(T)}else i(m);p=r(m)}if(p!==null)U=!0;else{var I=r(h);I!==null&&$(M,I.startTime-T),U=!1}}break e}finally{p=null,x=H,y=!1}U=void 0}}finally{U?B():L=!1}}}var B;if(typeof k=="function")B=function(){k(q)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,O=j.port2;j.port1.onmessage=q,B=function(){O.postMessage(null)}}else B=function(){S(q,0)};function $(T,U){z=S(function(){T(e.unstable_now())},U)}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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(T){switch(x){case 1:case 2:case 3:var U=3;break;default:U=x}var H=x;x=U;try{return T()}finally{x=H}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(T,U){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var H=x;x=T;try{return U()}finally{x=H}},e.unstable_scheduleCallback=function(T,U,H){var F=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?F+H:F):H=F,T){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=H+V,T={id:v++,callback:U,priorityLevel:T,startTime:H,expirationTime:V,sortIndex:-1},H>F?(T.sortIndex=H,t(h,T),r(m)===null&&T===r(h)&&(C?(N(z),z=-1):C=!0,$(M,H-F))):(T.sortIndex=V,t(m,T),w||y||(w=!0,L||(L=!0,B()))),T},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(T){var U=x;return function(){var H=x;x=U;try{return T.apply(this,arguments)}finally{x=H}}}})(iv)),iv}var GS;function rL(){return GS||(GS=1,rv.exports=tL()),rv.exports}var nv={exports:{}},Wr={};/**
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 YS;function iL(){if(YS)return Wr;YS=1;var e=vx();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Wr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Wr.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,v)},Wr.flushSync=function(m){var h=u.T,v=i.p;try{if(u.T=null,i.p=2,m)return m()}finally{u.T=h,i.p=v,i.d.f()}},Wr.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(m,h))},Wr.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},Wr.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,p=d(v,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?i.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:x,fetchPriority:y}):v==="script"&&i.d.X(m,{crossOrigin:p,integrity:x,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Wr.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=d(h.as,h.crossOrigin);i.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(m)},Wr.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,p=d(v,h.crossOrigin);i.d.L(m,v,{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})}},Wr.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=d(h.as,h.crossOrigin);i.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(m)},Wr.requestFormReset=function(m){i.d.r(m)},Wr.unstable_batchedUpdates=function(m,h){return m(h)},Wr.useFormState=function(m,h,v){return u.H.useFormState(m,h,v)},Wr.useFormStatus=function(){return u.H.useHostTransitionStatus()},Wr.version="19.2.7",Wr}var KS;function iR(){if(KS)return nv.exports;KS=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(t){console.error(t)}}return e(),nv.exports=iL(),nv.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 XS;function nL(){if(XS)return tu;XS=1;var e=rL(),t=vx(),r=iR();function i(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function d(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(o(n)!==n)throw Error(i(188))}function h(n){var a=n.alternate;if(!a){if(a=o(n),a===null)throw Error(i(188));return a!==n?null:n}for(var c=n,f=a;;){var _=c.return;if(_===null)break;var b=_.alternate;if(b===null){if(f=_.return,f!==null){c=f;continue}break}if(_.child===b.child){for(b=_.child;b;){if(b===c)return m(_),n;if(b===f)return m(_),a;b=b.sibling}throw Error(i(188))}if(c.return!==f.return)c=_,f=b;else{for(var A=!1,P=_.child;P;){if(P===c){A=!0,c=_,f=b;break}if(P===f){A=!0,f=_,c=b;break}P=P.sibling}if(!A){for(P=b.child;P;){if(P===c){A=!0,c=b,f=_;break}if(P===f){A=!0,f=b,c=_;break}P=P.sibling}if(!A)throw Error(i(189))}}if(c.alternate!==f)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:a}function v(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=v(n),a!==null)return a;n=n.sibling}return null}var p=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=q&&n[q]||n["@@iterator"],typeof n=="function"?n:null)}var j=Symbol.for("react.client.reference");function O(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===j?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case C:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case M:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case w:return"Portal";case k:return n.displayName||"Context";case N:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return a=n.displayName||null,a!==null?a:O(n.type)||"Memo";case D:a=n._payload,n=n._init;try{return O(n(a))}catch{}}return null}var $=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},F=[],V=-1;function I(n){return{current:n}}function Y(n){0>V||(n.current=F[V],F[V]=null,V--)}function X(n,a){V++,F[V]=n.current,n.current=a}var ee=I(null),re=I(null),oe=I(null),Z=I(null);function ce(n,a){switch(X(oe,a),X(re,n),X(ee,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?dS(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=dS(a),n=hS(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Y(ee),X(ee,n)}function ne(){Y(ee),Y(re),Y(oe)}function we(n){n.memoizedState!==null&&X(Z,n);var a=ee.current,c=hS(a,n.type);a!==c&&(X(re,n),X(ee,c))}function xe(n){re.current===n&&(Y(ee),Y(re)),Z.current===n&&(Y(Z),Xc._currentValue=H)}var ye,J;function ie(n){if(ye===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ye=a&&a[1]||"",J=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ye+n+J}var Re=!1;function ve(n,a){if(!n||Re)return"";Re=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ue){var le=ue}Reflect.construct(n,[],pe)}else{try{pe.call()}catch(ue){le=ue}n.call(pe.prototype)}}else{try{throw Error()}catch(ue){le=ue}(pe=n())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ue){if(ue&&le&&typeof ue.stack=="string")return[ue.stack,le.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=f.DetermineComponentFrameRoot(),A=b[0],P=b[1];if(A&&P){var K=A.split(`
44
+ `),ae=P.split(`
45
+ `);for(_=f=0;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;for(;_<ae.length&&!ae[_].includes("DetermineComponentFrameRoot");)_++;if(f===K.length||_===ae.length)for(f=K.length-1,_=ae.length-1;1<=f&&0<=_&&K[f]!==ae[_];)_--;for(;1<=f&&0<=_;f--,_--)if(K[f]!==ae[_]){if(f!==1||_!==1)do if(f--,_--,0>_||K[f]!==ae[_]){var de=`
46
+ `+K[f].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=f&&0<=_);break}}}finally{Re=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?ie(c):""}function Ae(n,a){switch(n.tag){case 26:case 27:case 5:return ie(n.type);case 16:return ie("Lazy");case 13:return n.child!==a&&a!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return ve(n.type,!1);case 11:return ve(n.type.render,!1);case 1:return ve(n.type,!0);case 31:return ie("Activity");default:return""}}function Ie(n){try{var a="",c=null;do a+=Ae(n,c),c=n,n=n.return;while(n);return a}catch(f){return`
47
+ Error generating stack: `+f.message+`
48
+ `+f.stack}}var Oe=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,rt=e.unstable_cancelCallback,Be=e.unstable_shouldYield,dt=e.unstable_requestPaint,He=e.unstable_now,Ot=e.unstable_getCurrentPriorityLevel,Ht=e.unstable_ImmediatePriority,gi=e.unstable_UserBlockingPriority,Bt=e.unstable_NormalPriority,vt=e.unstable_LowPriority,ur=e.unstable_IdlePriority,At=e.log,an=e.unstable_setDisableYieldValue,is=null,Ar=null;function vi(n){if(typeof At=="function"&&an(n),Ar&&typeof Ar.setStrictMode=="function")try{Ar.setStrictMode(is,n)}catch{}}var vr=Math.clz32?Math.clz32:_i,Wa=Math.log,Hs=Math.LN2;function _i(n){return n>>>=0,n===0?32:31-(Wa(n)/Hs|0)|0}var ns=256,ss=262144,Tn=4194304;function xi(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ue(n,a,c){var f=n.pendingLanes;if(f===0)return 0;var _=0,b=n.suspendedLanes,A=n.pingedLanes;n=n.warmLanes;var P=f&134217727;return P!==0?(f=P&~b,f!==0?_=xi(f):(A&=P,A!==0?_=xi(A):c||(c=P&~n,c!==0&&(_=xi(c))))):(P=f&~b,P!==0?_=xi(P):A!==0?_=xi(A):c||(c=f&~n,c!==0&&(_=xi(c)))),_===0?0:a!==0&&a!==_&&(a&b)===0&&(b=_&-_,c=a&-a,b>=c||b===32&&(c&4194048)!==0)?a:_}function me(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function ke(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Fe(){var n=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),n}function bt(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Ze(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ft(n,a,c,f,_,b){var A=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var P=n.entanglements,K=n.expirationTimes,ae=n.hiddenUpdates;for(c=A&~c;0<c;){var de=31-vr(c),pe=1<<de;P[de]=0,K[de]=-1;var le=ae[de];if(le!==null)for(ae[de]=null,de=0;de<le.length;de++){var ue=le[de];ue!==null&&(ue.lane&=-536870913)}c&=~pe}f!==0&&ii(n,f,0),b!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=b&~(A&~a))}function ii(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var f=31-vr(a);n.entangledLanes|=a,n.entanglements[f]=n.entanglements[f]|1073741824|c&261930}function Wt(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var f=31-vr(c),_=1<<f;_&a|n[f]&a&&(n[f]|=a),c&=~_}}function ni(n,a){var c=a&-a;return c=(c&42)!==0?1:Fo(c),(c&(n.suspendedLanes|a))!==0?0:c}function Fo(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function on(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Fm(){var n=U.p;return n!==0?n:(n=window.event,n===void 0?32:OS(n.type))}function Zy(n,a){var c=U.p;try{return U.p=n,a()}finally{U.p=c}}var Fs=Math.random().toString(36).slice(2),Tr="__reactFiber$"+Fs,si="__reactProps$"+Fs,Wo="__reactContainer$"+Fs,Wm="__reactEvents$"+Fs,Ij="__reactListeners$"+Fs,zj="__reactHandles$"+Fs,Qy="__reactResources$"+Fs,dc="__reactMarker$"+Fs;function qm(n){delete n[Tr],delete n[si],delete n[Wm],delete n[Ij],delete n[zj]}function qo(n){var a=n[Tr];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Wo]||c[Tr]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=xS(n);n!==null;){if(c=n[Tr])return c;n=xS(n)}return a}n=c,c=n.parentNode}return null}function Vo(n){if(n=n[Tr]||n[Wo]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function hc(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(i(33))}function Go(n){var a=n[Qy];return a||(a=n[Qy]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function _r(n){n[dc]=!0}var Jy=new Set,eb={};function qa(n,a){Yo(n,a),Yo(n+"Capture",a)}function Yo(n,a){for(eb[n]=a,n=0;n<a.length;n++)Jy.add(a[n])}var $j=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]*$"),tb={},rb={};function Uj(n){return Oe.call(rb,n)?!0:Oe.call(tb,n)?!1:$j.test(n)?rb[n]=!0:(tb[n]=!0,!1)}function _d(n,a,c){if(Uj(a))if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+c)}}function xd(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function as(n,a,c,f){if(f===null)n.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+f)}}function ji(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ib(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Hj(n,a,c){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var _=f.get,b=f.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return _.call(this)},set:function(A){c=""+A,b.call(this,A)}}),Object.defineProperty(n,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(A){c=""+A},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function Vm(n){if(!n._valueTracker){var a=ib(n)?"checked":"value";n._valueTracker=Hj(n,a,""+n[a])}}function nb(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return n&&(f=ib(n)?n.checked?"true":"false":n.value),n=f,n!==c?(a.setValue(n),!0):!1}function yd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Fj=/[\n"\\]/g;function Di(n){return n.replace(Fj,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Gm(n,a,c,f,_,b,A,P){n.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.type=A:n.removeAttribute("type"),a!=null?A==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ji(a)):n.value!==""+ji(a)&&(n.value=""+ji(a)):A!=="submit"&&A!=="reset"||n.removeAttribute("value"),a!=null?Ym(n,A,ji(a)):c!=null?Ym(n,A,ji(c)):f!=null&&n.removeAttribute("value"),_==null&&b!=null&&(n.defaultChecked=!!b),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?n.name=""+ji(P):n.removeAttribute("name")}function sb(n,a,c,f,_,b,A,P){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.type=b),a!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){Vm(n);return}c=c!=null?""+ji(c):"",a=a!=null?""+ji(a):c,P||a===n.value||(n.value=a),n.defaultValue=a}f=f??_,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=P?n.checked:!!f,n.defaultChecked=!!f,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(n.name=A),Vm(n)}function Ym(n,a,c){a==="number"&&yd(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function Ko(n,a,c,f){if(n=n.options,a){a={};for(var _=0;_<c.length;_++)a["$"+c[_]]=!0;for(c=0;c<n.length;c++)_=a.hasOwnProperty("$"+n[c].value),n[c].selected!==_&&(n[c].selected=_),_&&f&&(n[c].defaultSelected=!0)}else{for(c=""+ji(c),a=null,_=0;_<n.length;_++){if(n[_].value===c){n[_].selected=!0,f&&(n[_].defaultSelected=!0);return}a!==null||n[_].disabled||(a=n[_])}a!==null&&(a.selected=!0)}}function ab(n,a,c){if(a!=null&&(a=""+ji(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+ji(c):""}function ob(n,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(i(92));if($(f)){if(1<f.length)throw Error(i(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=ji(a),n.defaultValue=c,f=n.textContent,f===c&&f!==""&&f!==null&&(n.value=f),Vm(n)}function Xo(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var Wj=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 lb(n,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":f?n.setProperty(a,c):typeof c!="number"||c===0||Wj.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function cb(n,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(n=n.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var _ in a)f=a[_],a.hasOwnProperty(_)&&c[_]!==f&&lb(n,_,f)}else for(var b in a)a.hasOwnProperty(b)&&lb(n,b,a[b])}function Km(n){if(n.indexOf("-")===-1)return!1;switch(n){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 qj=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"]]),Vj=/^[\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 bd(n){return Vj.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function os(){}var Xm=null;function Zm(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zo=null,Qo=null;function ub(n){var a=Vo(n);if(a&&(n=a.stateNode)){var c=n[si]||null;e:switch(n=a.stateNode,a.type){case"input":if(Gm(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Di(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==n&&f.form===n.form){var _=f[si]||null;if(!_)throw Error(i(90));Gm(f,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===n.form&&nb(f)}break e;case"textarea":ab(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Ko(n,!!c.multiple,a,!1)}}}var Qm=!1;function db(n,a,c){if(Qm)return n(a,c);Qm=!0;try{var f=n(a);return f}finally{if(Qm=!1,(Zo!==null||Qo!==null)&&(lh(),Zo&&(a=Zo,n=Qo,Qo=Zo=null,ub(a),n)))for(a=0;a<n.length;a++)ub(n[a])}}function fc(n,a){var c=n.stateNode;if(c===null)return null;var f=c[si]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var ls=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jm=!1;if(ls)try{var mc={};Object.defineProperty(mc,"passive",{get:function(){Jm=!0}}),window.addEventListener("test",mc,mc),window.removeEventListener("test",mc,mc)}catch{Jm=!1}var Ws=null,ep=null,wd=null;function hb(){if(wd)return wd;var n,a=ep,c=a.length,f,_="value"in Ws?Ws.value:Ws.textContent,b=_.length;for(n=0;n<c&&a[n]===_[n];n++);var A=c-n;for(f=1;f<=A&&a[c-f]===_[b-f];f++);return wd=_.slice(n,1<f?1-f:void 0)}function Sd(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Cd(){return!0}function fb(){return!1}function ai(n){function a(c,f,_,b,A){this._reactName=c,this._targetInst=_,this.type=f,this.nativeEvent=b,this.target=A,this.currentTarget=null;for(var P in n)n.hasOwnProperty(P)&&(c=n[P],this[P]=c?c(b):b[P]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Cd:fb,this.isPropagationStopped=fb,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Cd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Cd)},persist:function(){},isPersistent:Cd}),a}var Va={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ed=ai(Va),pc=p({},Va,{view:0,detail:0}),Gj=ai(pc),tp,rp,gc,Rd=p({},pc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:np,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==gc&&(gc&&n.type==="mousemove"?(tp=n.screenX-gc.screenX,rp=n.screenY-gc.screenY):rp=tp=0,gc=n),tp)},movementY:function(n){return"movementY"in n?n.movementY:rp}}),mb=ai(Rd),Yj=p({},Rd,{dataTransfer:0}),Kj=ai(Yj),Xj=p({},pc,{relatedTarget:0}),ip=ai(Xj),Zj=p({},Va,{animationName:0,elapsedTime:0,pseudoElement:0}),Qj=ai(Zj),Jj=p({},Va,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),e3=ai(Jj),t3=p({},Va,{data:0}),pb=ai(t3),r3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i3={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"},n3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function s3(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=n3[n])?!!a[n]:!1}function np(){return s3}var a3=p({},pc,{key:function(n){if(n.key){var a=r3[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Sd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?i3[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:np,charCode:function(n){return n.type==="keypress"?Sd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Sd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),o3=ai(a3),l3=p({},Rd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gb=ai(l3),c3=p({},pc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:np}),u3=ai(c3),d3=p({},Va,{propertyName:0,elapsedTime:0,pseudoElement:0}),h3=ai(d3),f3=p({},Rd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),m3=ai(f3),p3=p({},Va,{newState:0,oldState:0}),g3=ai(p3),v3=[9,13,27,32],sp=ls&&"CompositionEvent"in window,vc=null;ls&&"documentMode"in document&&(vc=document.documentMode);var _3=ls&&"TextEvent"in window&&!vc,vb=ls&&(!sp||vc&&8<vc&&11>=vc),_b=" ",xb=!1;function yb(n,a){switch(n){case"keyup":return v3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bb(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Jo=!1;function x3(n,a){switch(n){case"compositionend":return bb(a);case"keypress":return a.which!==32?null:(xb=!0,_b);case"textInput":return n=a.data,n===_b&&xb?null:n;default:return null}}function y3(n,a){if(Jo)return n==="compositionend"||!sp&&yb(n,a)?(n=hb(),wd=ep=Ws=null,Jo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return vb&&a.locale!=="ko"?null:a.data;default:return null}}var b3={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 wb(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!b3[n.type]:a==="textarea"}function Sb(n,a,c,f){Zo?Qo?Qo.push(f):Qo=[f]:Zo=f,a=ph(a,"onChange"),0<a.length&&(c=new Ed("onChange","change",null,c,f),n.push({event:c,listeners:a}))}var _c=null,xc=null;function w3(n){sS(n,0)}function kd(n){var a=hc(n);if(nb(a))return n}function Cb(n,a){if(n==="change")return a}var Eb=!1;if(ls){var ap;if(ls){var op="oninput"in document;if(!op){var Rb=document.createElement("div");Rb.setAttribute("oninput","return;"),op=typeof Rb.oninput=="function"}ap=op}else ap=!1;Eb=ap&&(!document.documentMode||9<document.documentMode)}function kb(){_c&&(_c.detachEvent("onpropertychange",Nb),xc=_c=null)}function Nb(n){if(n.propertyName==="value"&&kd(xc)){var a=[];Sb(a,xc,n,Zm(n)),db(w3,a)}}function S3(n,a,c){n==="focusin"?(kb(),_c=a,xc=c,_c.attachEvent("onpropertychange",Nb)):n==="focusout"&&kb()}function C3(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return kd(xc)}function E3(n,a){if(n==="click")return kd(a)}function R3(n,a){if(n==="input"||n==="change")return kd(a)}function k3(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var yi=typeof Object.is=="function"?Object.is:k3;function yc(n,a){if(yi(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var _=c[f];if(!Oe.call(a,_)||!yi(n[_],a[_]))return!1}return!0}function Ab(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Tb(n,a){var c=Ab(n);n=0;for(var f;c;){if(c.nodeType===3){if(f=n+c.textContent.length,n<=a&&f>=a)return{node:c,offset:a-n};n=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Ab(c)}}function Mb(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Mb(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function jb(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=yd(n.document);a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=yd(n.document)}return a}function lp(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var N3=ls&&"documentMode"in document&&11>=document.documentMode,el=null,cp=null,bc=null,up=!1;function Db(n,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;up||el==null||el!==yd(f)||(f=el,"selectionStart"in f&&lp(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),bc&&yc(bc,f)||(bc=f,f=ph(cp,"onSelect"),0<f.length&&(a=new Ed("onSelect","select",null,a,c),n.push({event:a,listeners:f}),a.target=el)))}function Ga(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var tl={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},dp={},Lb={};ls&&(Lb=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function Ya(n){if(dp[n])return dp[n];if(!tl[n])return n;var a=tl[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in Lb)return dp[n]=a[c];return n}var Ob=Ya("animationend"),Bb=Ya("animationiteration"),Pb=Ya("animationstart"),A3=Ya("transitionrun"),T3=Ya("transitionstart"),M3=Ya("transitioncancel"),Ib=Ya("transitionend"),zb=new Map,hp="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(" ");hp.push("scrollEnd");function ln(n,a){zb.set(n,a),qa(a,[n])}var Nd=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Li=[],rl=0,fp=0;function Ad(){for(var n=rl,a=fp=rl=0;a<n;){var c=Li[a];Li[a++]=null;var f=Li[a];Li[a++]=null;var _=Li[a];Li[a++]=null;var b=Li[a];if(Li[a++]=null,f!==null&&_!==null){var A=f.pending;A===null?_.next=_:(_.next=A.next,A.next=_),f.pending=_}b!==0&&$b(c,_,b)}}function Td(n,a,c,f){Li[rl++]=n,Li[rl++]=a,Li[rl++]=c,Li[rl++]=f,fp|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function mp(n,a,c,f){return Td(n,a,c,f),Md(n)}function Ka(n,a){return Td(n,null,null,a),Md(n)}function $b(n,a,c){n.lanes|=c;var f=n.alternate;f!==null&&(f.lanes|=c);for(var _=!1,b=n.return;b!==null;)b.childLanes|=c,f=b.alternate,f!==null&&(f.childLanes|=c),b.tag===22&&(n=b.stateNode,n===null||n._visibility&1||(_=!0)),n=b,b=b.return;return n.tag===3?(b=n.stateNode,_&&a!==null&&(_=31-vr(c),n=b.hiddenUpdates,f=n[_],f===null?n[_]=[a]:f.push(a),a.lane=c|536870912),b):null}function Md(n){if(50<Fc)throw Fc=0,Sg=null,Error(i(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var il={};function j3(n,a,c,f){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bi(n,a,c,f){return new j3(n,a,c,f)}function pp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function cs(n,a){var c=n.alternate;return c===null?(c=bi(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function Ub(n,a){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,a=c.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function jd(n,a,c,f,_,b){var A=0;if(f=n,typeof n=="function")pp(n)&&(A=1);else if(typeof n=="string")A=PD(n,c,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case W:return n=bi(31,c,a,_),n.elementType=W,n.lanes=b,n;case C:return Xa(c.children,_,b,a);case E:A=8,_|=24;break;case S:return n=bi(12,c,a,_|2),n.elementType=S,n.lanes=b,n;case M:return n=bi(13,c,a,_),n.elementType=M,n.lanes=b,n;case L:return n=bi(19,c,a,_),n.elementType=L,n.lanes=b,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case k:A=10;break e;case N:A=9;break e;case R:A=11;break e;case z:A=14;break e;case D:A=16,f=null;break e}A=29,c=Error(i(130,n===null?"null":typeof n,"")),f=null}return a=bi(A,c,a,_),a.elementType=n,a.type=f,a.lanes=b,a}function Xa(n,a,c,f){return n=bi(7,n,f,a),n.lanes=c,n}function gp(n,a,c){return n=bi(6,n,null,a),n.lanes=c,n}function Hb(n){var a=bi(18,null,null,0);return a.stateNode=n,a}function vp(n,a,c){return a=bi(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var Fb=new WeakMap;function Oi(n,a){if(typeof n=="object"&&n!==null){var c=Fb.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Ie(a)},Fb.set(n,a),a)}return{value:n,source:a,stack:Ie(a)}}var nl=[],sl=0,Dd=null,wc=0,Bi=[],Pi=0,qs=null,Mn=1,jn="";function us(n,a){nl[sl++]=wc,nl[sl++]=Dd,Dd=n,wc=a}function Wb(n,a,c){Bi[Pi++]=Mn,Bi[Pi++]=jn,Bi[Pi++]=qs,qs=n;var f=Mn;n=jn;var _=32-vr(f)-1;f&=~(1<<_),c+=1;var b=32-vr(a)+_;if(30<b){var A=_-_%5;b=(f&(1<<A)-1).toString(32),f>>=A,_-=A,Mn=1<<32-vr(a)+_|c<<_|f,jn=b+n}else Mn=1<<b|c<<_|f,jn=n}function _p(n){n.return!==null&&(us(n,1),Wb(n,1,0))}function xp(n){for(;n===Dd;)Dd=nl[--sl],nl[sl]=null,wc=nl[--sl],nl[sl]=null;for(;n===qs;)qs=Bi[--Pi],Bi[Pi]=null,jn=Bi[--Pi],Bi[Pi]=null,Mn=Bi[--Pi],Bi[Pi]=null}function qb(n,a){Bi[Pi++]=Mn,Bi[Pi++]=jn,Bi[Pi++]=qs,Mn=a.id,jn=a.overflow,qs=n}var Mr=null,Tt=null,ut=!1,Vs=null,Ii=!1,yp=Error(i(519));function Gs(n){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sc(Oi(a,n)),yp}function Vb(n){var a=n.stateNode,c=n.type,f=n.memoizedProps;switch(a[Tr]=n,a[si]=f,c){case"dialog":st("cancel",a),st("close",a);break;case"iframe":case"object":case"embed":st("load",a);break;case"video":case"audio":for(c=0;c<qc.length;c++)st(qc[c],a);break;case"source":st("error",a);break;case"img":case"image":case"link":st("error",a),st("load",a);break;case"details":st("toggle",a);break;case"input":st("invalid",a),sb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":st("invalid",a);break;case"textarea":st("invalid",a),ob(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||cS(a.textContent,c)?(f.popover!=null&&(st("beforetoggle",a),st("toggle",a)),f.onScroll!=null&&st("scroll",a),f.onScrollEnd!=null&&st("scrollend",a),f.onClick!=null&&(a.onclick=os),a=!0):a=!1,a||Gs(n,!0)}function Gb(n){for(Mr=n.return;Mr;)switch(Mr.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mr=Mr.return}}function al(n){if(n!==Mr)return!1;if(!ut)return Gb(n),ut=!0,!1;var a=n.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||Ig(n.type,n.memoizedProps)),c=!c),c&&Tt&&Gs(n),Gb(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Tt=_S(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Tt=_S(n)}else a===27?(a=Tt,oa(n.type)?(n=Fg,Fg=null,Tt=n):Tt=a):Tt=Mr?$i(n.stateNode.nextSibling):null;return!0}function Za(){Tt=Mr=null,ut=!1}function bp(){var n=Vs;return n!==null&&(ui===null?ui=n:ui.push.apply(ui,n),Vs=null),n}function Sc(n){Vs===null?Vs=[n]:Vs.push(n)}var wp=I(null),Qa=null,ds=null;function Ys(n,a,c){X(wp,a._currentValue),a._currentValue=c}function hs(n){n._currentValue=wp.current,Y(wp)}function Sp(n,a,c){for(;n!==null;){var f=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),n===c)break;n=n.return}}function Cp(n,a,c,f){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var b=_.dependencies;if(b!==null){var A=_.child;b=b.firstContext;e:for(;b!==null;){var P=b;b=_;for(var K=0;K<a.length;K++)if(P.context===a[K]){b.lanes|=c,P=b.alternate,P!==null&&(P.lanes|=c),Sp(b.return,c,n),f||(A=null);break e}b=P.next}}else if(_.tag===18){if(A=_.return,A===null)throw Error(i(341));A.lanes|=c,b=A.alternate,b!==null&&(b.lanes|=c),Sp(A,c,n),A=null}else A=_.child;if(A!==null)A.return=_;else for(A=_;A!==null;){if(A===n){A=null;break}if(_=A.sibling,_!==null){_.return=A.return,A=_;break}A=A.return}_=A}}function ol(n,a,c,f){n=null;for(var _=a,b=!1;_!==null;){if(!b){if((_.flags&524288)!==0)b=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var A=_.alternate;if(A===null)throw Error(i(387));if(A=A.memoizedProps,A!==null){var P=_.type;yi(_.pendingProps.value,A.value)||(n!==null?n.push(P):n=[P])}}else if(_===Z.current){if(A=_.alternate,A===null)throw Error(i(387));A.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Xc):n=[Xc])}_=_.return}n!==null&&Cp(a,n,c,f),a.flags|=262144}function Ld(n){for(n=n.firstContext;n!==null;){if(!yi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ja(n){Qa=n,ds=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function jr(n){return Yb(Qa,n)}function Od(n,a){return Qa===null&&Ja(n),Yb(n,a)}function Yb(n,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},ds===null){if(n===null)throw Error(i(308));ds=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else ds=ds.next=a;return c}var D3=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(c,f){n.push(f)}};this.abort=function(){a.aborted=!0,n.forEach(function(c){return c()})}},L3=e.unstable_scheduleCallback,O3=e.unstable_NormalPriority,rr={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ep(){return{controller:new D3,data:new Map,refCount:0}}function Cc(n){n.refCount--,n.refCount===0&&L3(O3,function(){n.controller.abort()})}var Ec=null,Rp=0,ll=0,cl=null;function B3(n,a){if(Ec===null){var c=Ec=[];Rp=0,ll=Ag(),cl={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Rp++,a.then(Kb,Kb),a}function Kb(){if(--Rp===0&&Ec!==null){cl!==null&&(cl.status="fulfilled");var n=Ec;Ec=null,ll=0,cl=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function P3(n,a){var c=[],f={status:"pending",value:null,reason:null,then:function(_){c.push(_)}};return n.then(function(){f.status="fulfilled",f.value=a;for(var _=0;_<c.length;_++)(0,c[_])(a)},function(_){for(f.status="rejected",f.reason=_,_=0;_<c.length;_++)(0,c[_])(void 0)}),f}var Xb=T.S;T.S=function(n,a){Dw=He(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&B3(n,a),Xb!==null&&Xb(n,a)};var eo=I(null);function kp(){var n=eo.current;return n!==null?n:Rt.pooledCache}function Bd(n,a){a===null?X(eo,eo.current):X(eo,a.pool)}function Zb(){var n=kp();return n===null?null:{parent:rr._currentValue,pool:n}}var ul=Error(i(460)),Np=Error(i(474)),Pd=Error(i(542)),Id={then:function(){}};function Qb(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Jb(n,a,c){switch(c=n[c],c===void 0?n.push(a):c!==a&&(a.then(os,os),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,t1(n),n;default:if(typeof a.status=="string")a.then(os,os);else{if(n=Rt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=a,n.status="pending",n.then(function(f){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=f}},function(f){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,t1(n),n}throw ro=a,ul}}function to(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ro=c,ul):c}}var ro=null;function e1(){if(ro===null)throw Error(i(459));var n=ro;return ro=null,n}function t1(n){if(n===ul||n===Pd)throw Error(i(483))}var dl=null,Rc=0;function zd(n){var a=Rc;return Rc+=1,dl===null&&(dl=[]),Jb(dl,n,a)}function kc(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function $d(n,a){throw a.$$typeof===x?Error(i(525)):(n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function r1(n){function a(te,Q){if(n){var se=te.deletions;se===null?(te.deletions=[Q],te.flags|=16):se.push(Q)}}function c(te,Q){if(!n)return null;for(;Q!==null;)a(te,Q),Q=Q.sibling;return null}function f(te){for(var Q=new Map;te!==null;)te.key!==null?Q.set(te.key,te):Q.set(te.index,te),te=te.sibling;return Q}function _(te,Q){return te=cs(te,Q),te.index=0,te.sibling=null,te}function b(te,Q,se){return te.index=se,n?(se=te.alternate,se!==null?(se=se.index,se<Q?(te.flags|=67108866,Q):se):(te.flags|=67108866,Q)):(te.flags|=1048576,Q)}function A(te){return n&&te.alternate===null&&(te.flags|=67108866),te}function P(te,Q,se,fe){return Q===null||Q.tag!==6?(Q=gp(se,te.mode,fe),Q.return=te,Q):(Q=_(Q,se),Q.return=te,Q)}function K(te,Q,se,fe){var Pe=se.type;return Pe===C?de(te,Q,se.props.children,fe,se.key):Q!==null&&(Q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&to(Pe)===Q.type)?(Q=_(Q,se.props),kc(Q,se),Q.return=te,Q):(Q=jd(se.type,se.key,se.props,null,te.mode,fe),kc(Q,se),Q.return=te,Q)}function ae(te,Q,se,fe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==se.containerInfo||Q.stateNode.implementation!==se.implementation?(Q=vp(se,te.mode,fe),Q.return=te,Q):(Q=_(Q,se.children||[]),Q.return=te,Q)}function de(te,Q,se,fe,Pe){return Q===null||Q.tag!==7?(Q=Xa(se,te.mode,fe,Pe),Q.return=te,Q):(Q=_(Q,se),Q.return=te,Q)}function pe(te,Q,se){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=gp(""+Q,te.mode,se),Q.return=te,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return se=jd(Q.type,Q.key,Q.props,null,te.mode,se),kc(se,Q),se.return=te,se;case w:return Q=vp(Q,te.mode,se),Q.return=te,Q;case D:return Q=to(Q),pe(te,Q,se)}if($(Q)||B(Q))return Q=Xa(Q,te.mode,se,null),Q.return=te,Q;if(typeof Q.then=="function")return pe(te,zd(Q),se);if(Q.$$typeof===k)return pe(te,Od(te,Q),se);$d(te,Q)}return null}function le(te,Q,se,fe){var Pe=Q!==null?Q.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return Pe!==null?null:P(te,Q,""+se,fe);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case y:return se.key===Pe?K(te,Q,se,fe):null;case w:return se.key===Pe?ae(te,Q,se,fe):null;case D:return se=to(se),le(te,Q,se,fe)}if($(se)||B(se))return Pe!==null?null:de(te,Q,se,fe,null);if(typeof se.then=="function")return le(te,Q,zd(se),fe);if(se.$$typeof===k)return le(te,Q,Od(te,se),fe);$d(te,se)}return null}function ue(te,Q,se,fe,Pe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(se)||null,P(Q,te,""+fe,Pe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:return te=te.get(fe.key===null?se:fe.key)||null,K(Q,te,fe,Pe);case w:return te=te.get(fe.key===null?se:fe.key)||null,ae(Q,te,fe,Pe);case D:return fe=to(fe),ue(te,Q,se,fe,Pe)}if($(fe)||B(fe))return te=te.get(se)||null,de(Q,te,fe,Pe,null);if(typeof fe.then=="function")return ue(te,Q,se,zd(fe),Pe);if(fe.$$typeof===k)return ue(te,Q,se,Od(Q,fe),Pe);$d(Q,fe)}return null}function je(te,Q,se,fe){for(var Pe=null,ht=null,De=Q,Qe=Q=0,lt=null;De!==null&&Qe<se.length;Qe++){De.index>Qe?(lt=De,De=null):lt=De.sibling;var ft=le(te,De,se[Qe],fe);if(ft===null){De===null&&(De=lt);break}n&&De&&ft.alternate===null&&a(te,De),Q=b(ft,Q,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft,De=lt}if(Qe===se.length)return c(te,De),ut&&us(te,Qe),Pe;if(De===null){for(;Qe<se.length;Qe++)De=pe(te,se[Qe],fe),De!==null&&(Q=b(De,Q,Qe),ht===null?Pe=De:ht.sibling=De,ht=De);return ut&&us(te,Qe),Pe}for(De=f(De);Qe<se.length;Qe++)lt=ue(De,te,Qe,se[Qe],fe),lt!==null&&(n&&lt.alternate!==null&&De.delete(lt.key===null?Qe:lt.key),Q=b(lt,Q,Qe),ht===null?Pe=lt:ht.sibling=lt,ht=lt);return n&&De.forEach(function(ha){return a(te,ha)}),ut&&us(te,Qe),Pe}function $e(te,Q,se,fe){if(se==null)throw Error(i(151));for(var Pe=null,ht=null,De=Q,Qe=Q=0,lt=null,ft=se.next();De!==null&&!ft.done;Qe++,ft=se.next()){De.index>Qe?(lt=De,De=null):lt=De.sibling;var ha=le(te,De,ft.value,fe);if(ha===null){De===null&&(De=lt);break}n&&De&&ha.alternate===null&&a(te,De),Q=b(ha,Q,Qe),ht===null?Pe=ha:ht.sibling=ha,ht=ha,De=lt}if(ft.done)return c(te,De),ut&&us(te,Qe),Pe;if(De===null){for(;!ft.done;Qe++,ft=se.next())ft=pe(te,ft.value,fe),ft!==null&&(Q=b(ft,Q,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return ut&&us(te,Qe),Pe}for(De=f(De);!ft.done;Qe++,ft=se.next())ft=ue(De,te,Qe,ft.value,fe),ft!==null&&(n&&ft.alternate!==null&&De.delete(ft.key===null?Qe:ft.key),Q=b(ft,Q,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return n&&De.forEach(function(YD){return a(te,YD)}),ut&&us(te,Qe),Pe}function Ct(te,Q,se,fe){if(typeof se=="object"&&se!==null&&se.type===C&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case y:e:{for(var Pe=se.key;Q!==null;){if(Q.key===Pe){if(Pe=se.type,Pe===C){if(Q.tag===7){c(te,Q.sibling),fe=_(Q,se.props.children),fe.return=te,te=fe;break e}}else if(Q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&to(Pe)===Q.type){c(te,Q.sibling),fe=_(Q,se.props),kc(fe,se),fe.return=te,te=fe;break e}c(te,Q);break}else a(te,Q);Q=Q.sibling}se.type===C?(fe=Xa(se.props.children,te.mode,fe,se.key),fe.return=te,te=fe):(fe=jd(se.type,se.key,se.props,null,te.mode,fe),kc(fe,se),fe.return=te,te=fe)}return A(te);case w:e:{for(Pe=se.key;Q!==null;){if(Q.key===Pe)if(Q.tag===4&&Q.stateNode.containerInfo===se.containerInfo&&Q.stateNode.implementation===se.implementation){c(te,Q.sibling),fe=_(Q,se.children||[]),fe.return=te,te=fe;break e}else{c(te,Q);break}else a(te,Q);Q=Q.sibling}fe=vp(se,te.mode,fe),fe.return=te,te=fe}return A(te);case D:return se=to(se),Ct(te,Q,se,fe)}if($(se))return je(te,Q,se,fe);if(B(se)){if(Pe=B(se),typeof Pe!="function")throw Error(i(150));return se=Pe.call(se),$e(te,Q,se,fe)}if(typeof se.then=="function")return Ct(te,Q,zd(se),fe);if(se.$$typeof===k)return Ct(te,Q,Od(te,se),fe);$d(te,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,Q!==null&&Q.tag===6?(c(te,Q.sibling),fe=_(Q,se),fe.return=te,te=fe):(c(te,Q),fe=gp(se,te.mode,fe),fe.return=te,te=fe),A(te)):c(te,Q)}return function(te,Q,se,fe){try{Rc=0;var Pe=Ct(te,Q,se,fe);return dl=null,Pe}catch(De){if(De===ul||De===Pd)throw De;var ht=bi(29,De,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var io=r1(!0),i1=r1(!1),Ks=!1;function Ap(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tp(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Xs(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Zs(n,a,c){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(pt&2)!==0){var _=f.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),f.pending=a,a=Md(n),$b(n,null,c),a}return Td(n,f,a,c),Md(n)}function Nc(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,Wt(n,c)}}function Mp(n,a){var c=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var _=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var A={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?_=b=A:b=b.next=A,c=c.next}while(c!==null);b===null?_=b=a:b=b.next=a}else _=b=a;c={baseState:f.baseState,firstBaseUpdate:_,lastBaseUpdate:b,shared:f.shared,callbacks:f.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}var jp=!1;function Ac(){if(jp){var n=cl;if(n!==null)throw n}}function Tc(n,a,c,f){jp=!1;var _=n.updateQueue;Ks=!1;var b=_.firstBaseUpdate,A=_.lastBaseUpdate,P=_.shared.pending;if(P!==null){_.shared.pending=null;var K=P,ae=K.next;K.next=null,A===null?b=ae:A.next=ae,A=K;var de=n.alternate;de!==null&&(de=de.updateQueue,P=de.lastBaseUpdate,P!==A&&(P===null?de.firstBaseUpdate=ae:P.next=ae,de.lastBaseUpdate=K))}if(b!==null){var pe=_.baseState;A=0,de=ae=K=null,P=b;do{var le=P.lane&-536870913,ue=le!==P.lane;if(ue?(ot&le)===le:(f&le)===le){le!==0&&le===ll&&(jp=!0),de!==null&&(de=de.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var je=n,$e=P;le=a;var Ct=c;switch($e.tag){case 1:if(je=$e.payload,typeof je=="function"){pe=je.call(Ct,pe,le);break e}pe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=$e.payload,le=typeof je=="function"?je.call(Ct,pe,le):je,le==null)break e;pe=p({},pe,le);break e;case 2:Ks=!0}}le=P.callback,le!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[le]:ue.push(le))}else ue={lane:le,tag:P.tag,payload:P.payload,callback:P.callback,next:null},de===null?(ae=de=ue,K=pe):de=de.next=ue,A|=le;if(P=P.next,P===null){if(P=_.shared.pending,P===null)break;ue=P,P=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);de===null&&(K=pe),_.baseState=K,_.firstBaseUpdate=ae,_.lastBaseUpdate=de,b===null&&(_.shared.lanes=0),ra|=A,n.lanes=A,n.memoizedState=pe}}function n1(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function s1(n,a){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)n1(c[n],a)}var hl=I(null),Ud=I(0);function a1(n,a){n=bs,X(Ud,n),X(hl,a),bs=n|a.baseLanes}function Dp(){X(Ud,bs),X(hl,hl.current)}function Lp(){bs=Ud.current,Y(hl),Y(Ud)}var wi=I(null),zi=null;function Qs(n){var a=n.alternate;X(Qt,Qt.current&1),X(wi,n),zi===null&&(a===null||hl.current!==null||a.memoizedState!==null)&&(zi=n)}function Op(n){X(Qt,Qt.current),X(wi,n),zi===null&&(zi=n)}function o1(n){n.tag===22?(X(Qt,Qt.current),X(wi,n),zi===null&&(zi=n)):Js()}function Js(){X(Qt,Qt.current),X(wi,wi.current)}function Si(n){Y(wi),zi===n&&(zi=null),Y(Qt)}var Qt=I(0);function Hd(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ug(c)||Hg(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var fs=0,Xe=null,wt=null,ir=null,Fd=!1,fl=!1,no=!1,Wd=0,Mc=0,ml=null,I3=0;function qt(){throw Error(i(321))}function Bp(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!yi(n[c],a[c]))return!1;return!0}function Pp(n,a,c,f,_,b){return fs=b,Xe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,T.H=n===null||n.memoizedState===null?W1:Qp,no=!1,b=c(f,_),no=!1,fl&&(b=c1(a,c,f,_)),l1(n),b}function l1(n){T.H=Lc;var a=wt!==null&&wt.next!==null;if(fs=0,ir=wt=Xe=null,Fd=!1,Mc=0,ml=null,a)throw Error(i(300));n===null||nr||(n=n.dependencies,n!==null&&Ld(n)&&(nr=!0))}function c1(n,a,c,f){Xe=n;var _=0;do{if(fl&&(ml=null),Mc=0,fl=!1,25<=_)throw Error(i(301));if(_+=1,ir=wt=null,n.updateQueue!=null){var b=n.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}T.H=q1,b=a(c,f)}while(fl);return b}function z3(){var n=T.H,a=n.useState()[0];return a=typeof a.then=="function"?jc(a):a,n=n.useState()[0],(wt!==null?wt.memoizedState:null)!==n&&(Xe.flags|=1024),a}function Ip(){var n=Wd!==0;return Wd=0,n}function zp(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function $p(n){if(Fd){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Fd=!1}fs=0,ir=wt=Xe=null,fl=!1,Mc=Wd=0,ml=null}function Kr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ir===null?Xe.memoizedState=ir=n:ir=ir.next=n,ir}function Jt(){if(wt===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=wt.next;var a=ir===null?Xe.memoizedState:ir.next;if(a!==null)ir=a,wt=n;else{if(n===null)throw Xe.alternate===null?Error(i(467)):Error(i(310));wt=n,n={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},ir===null?Xe.memoizedState=ir=n:ir=ir.next=n}return ir}function qd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jc(n){var a=Mc;return Mc+=1,ml===null&&(ml=[]),n=Jb(ml,n,a),a=Xe,(ir===null?a.memoizedState:ir.next)===null&&(a=a.alternate,T.H=a===null||a.memoizedState===null?W1:Qp),n}function Vd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return jc(n);if(n.$$typeof===k)return jr(n)}throw Error(i(438,String(n)))}function Up(n){var a=null,c=Xe.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Xe.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=qd(),Xe.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(n),f=0;f<n;f++)c[f]=G;return a.index++,c}function ms(n,a){return typeof a=="function"?a(n):a}function Gd(n){var a=Jt();return Hp(a,wt,n)}function Hp(n,a,c){var f=n.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=c;var _=n.baseQueue,b=f.pending;if(b!==null){if(_!==null){var A=_.next;_.next=b.next,b.next=A}a.baseQueue=_=b,f.pending=null}if(b=n.baseState,_===null)n.memoizedState=b;else{a=_.next;var P=A=null,K=null,ae=a,de=!1;do{var pe=ae.lane&-536870913;if(pe!==ae.lane?(ot&pe)===pe:(fs&pe)===pe){var le=ae.revertLane;if(le===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),pe===ll&&(de=!0);else if((fs&le)===le){ae=ae.next,le===ll&&(de=!0);continue}else pe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(P=K=pe,A=b):K=K.next=pe,Xe.lanes|=le,ra|=le;pe=ae.action,no&&c(b,pe),b=ae.hasEagerState?ae.eagerState:c(b,pe)}else le={lane:pe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(P=K=le,A=b):K=K.next=le,Xe.lanes|=pe,ra|=pe;ae=ae.next}while(ae!==null&&ae!==a);if(K===null?A=b:K.next=P,!yi(b,n.memoizedState)&&(nr=!0,de&&(c=cl,c!==null)))throw c;n.memoizedState=b,n.baseState=A,n.baseQueue=K,f.lastRenderedState=b}return _===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function Fp(n){var a=Jt(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var f=c.dispatch,_=c.pending,b=a.memoizedState;if(_!==null){c.pending=null;var A=_=_.next;do b=n(b,A.action),A=A.next;while(A!==_);yi(b,a.memoizedState)||(nr=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),c.lastRenderedState=b}return[b,f]}function u1(n,a,c){var f=Xe,_=Jt(),b=ut;if(b){if(c===void 0)throw Error(i(407));c=c()}else c=a();var A=!yi((wt||_).memoizedState,c);if(A&&(_.memoizedState=c,nr=!0),_=_.queue,Vp(f1.bind(null,f,_,n),[n]),_.getSnapshot!==a||A||ir!==null&&ir.memoizedState.tag&1){if(f.flags|=2048,pl(9,{destroy:void 0},h1.bind(null,f,_,c,a),null),Rt===null)throw Error(i(349));b||(fs&127)!==0||d1(f,a,c)}return c}function d1(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=Xe.updateQueue,a===null?(a=qd(),Xe.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function h1(n,a,c,f){a.value=c,a.getSnapshot=f,m1(a)&&p1(n)}function f1(n,a,c){return c(function(){m1(a)&&p1(n)})}function m1(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!yi(n,c)}catch{return!0}}function p1(n){var a=Ka(n,2);a!==null&&di(a,n,2)}function Wp(n){var a=Kr();if(typeof n=="function"){var c=n;if(n=c(),no){vi(!0);try{c()}finally{vi(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},a}function g1(n,a,c,f){return n.baseState=c,Hp(n,wt,typeof f=="function"?f:ms)}function $3(n,a,c,f,_){if(Xd(n))throw Error(i(485));if(n=a.action,n!==null){var b={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){b.listeners.push(A)}};T.T!==null?c(!0):b.isTransition=!1,f(b),c=a.pending,c===null?(b.next=a.pending=b,v1(a,b)):(b.next=c.next,a.pending=c.next=b)}}function v1(n,a){var c=a.action,f=a.payload,_=n.state;if(a.isTransition){var b=T.T,A={};T.T=A;try{var P=c(_,f),K=T.S;K!==null&&K(A,P),_1(n,a,P)}catch(ae){qp(n,a,ae)}finally{b!==null&&A.types!==null&&(b.types=A.types),T.T=b}}else try{b=c(_,f),_1(n,a,b)}catch(ae){qp(n,a,ae)}}function _1(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){x1(n,a,f)},function(f){return qp(n,a,f)}):x1(n,a,c)}function x1(n,a,c){a.status="fulfilled",a.value=c,y1(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,v1(n,c)))}function qp(n,a,c){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,y1(a),a=a.next;while(a!==f)}n.action=null}function y1(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function b1(n,a){return a}function w1(n,a){if(ut){var c=Rt.formState;if(c!==null){e:{var f=Xe;if(ut){if(Tt){t:{for(var _=Tt,b=Ii;_.nodeType!==8;){if(!b){_=null;break t}if(_=$i(_.nextSibling),_===null){_=null;break t}}b=_.data,_=b==="F!"||b==="F"?_:null}if(_){Tt=$i(_.nextSibling),f=_.data==="F!";break e}}Gs(f)}f=!1}f&&(a=c[0])}}return c=Kr(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:b1,lastRenderedState:a},c.queue=f,c=U1.bind(null,Xe,f),f.dispatch=c,f=Wp(!1),b=Zp.bind(null,Xe,!1,f.queue),f=Kr(),_={state:a,dispatch:null,action:n,pending:null},f.queue=_,c=$3.bind(null,Xe,_,b,c),_.dispatch=c,f.memoizedState=n,[a,c,!1]}function S1(n){var a=Jt();return C1(a,wt,n)}function C1(n,a,c){if(a=Hp(n,a,b1)[0],n=Gd(ms)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=jc(a)}catch(A){throw A===ul?Pd:A}else f=a;a=Jt();var _=a.queue,b=_.dispatch;return c!==a.memoizedState&&(Xe.flags|=2048,pl(9,{destroy:void 0},U3.bind(null,_,c),null)),[f,b,n]}function U3(n,a){n.action=a}function E1(n){var a=Jt(),c=wt;if(c!==null)return C1(a,c,n);Jt(),a=a.memoizedState,c=Jt();var f=c.queue.dispatch;return c.memoizedState=n,[a,f,!1]}function pl(n,a,c,f){return n={tag:n,create:c,deps:f,inst:a,next:null},a=Xe.updateQueue,a===null&&(a=qd(),Xe.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=n.next=n:(f=c.next,c.next=n,n.next=f,a.lastEffect=n),n}function R1(){return Jt().memoizedState}function Yd(n,a,c,f){var _=Kr();Xe.flags|=n,_.memoizedState=pl(1|a,{destroy:void 0},c,f===void 0?null:f)}function Kd(n,a,c,f){var _=Jt();f=f===void 0?null:f;var b=_.memoizedState.inst;wt!==null&&f!==null&&Bp(f,wt.memoizedState.deps)?_.memoizedState=pl(a,b,c,f):(Xe.flags|=n,_.memoizedState=pl(1|a,b,c,f))}function k1(n,a){Yd(8390656,8,n,a)}function Vp(n,a){Kd(2048,8,n,a)}function H3(n){Xe.flags|=4;var a=Xe.updateQueue;if(a===null)a=qd(),Xe.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function N1(n){var a=Jt().memoizedState;return H3({ref:a,nextImpl:n}),function(){if((pt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function A1(n,a){return Kd(4,2,n,a)}function T1(n,a){return Kd(4,4,n,a)}function M1(n,a){if(typeof a=="function"){n=n();var c=a(n);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function j1(n,a,c){c=c!=null?c.concat([n]):null,Kd(4,4,M1.bind(null,a,n),c)}function Gp(){}function D1(n,a){var c=Jt();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&Bp(a,f[1])?f[0]:(c.memoizedState=[n,a],n)}function L1(n,a){var c=Jt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&Bp(a,f[1]))return f[0];if(f=n(),no){vi(!0);try{n()}finally{vi(!1)}}return c.memoizedState=[f,a],f}function Yp(n,a,c){return c===void 0||(fs&1073741824)!==0&&(ot&261930)===0?n.memoizedState=a:(n.memoizedState=c,n=Ow(),Xe.lanes|=n,ra|=n,c)}function O1(n,a,c,f){return yi(c,a)?c:hl.current!==null?(n=Yp(n,c,f),yi(n,a)||(nr=!0),n):(fs&42)===0||(fs&1073741824)!==0&&(ot&261930)===0?(nr=!0,n.memoizedState=c):(n=Ow(),Xe.lanes|=n,ra|=n,a)}function B1(n,a,c,f,_){var b=U.p;U.p=b!==0&&8>b?b:8;var A=T.T,P={};T.T=P,Zp(n,!1,a,c);try{var K=_(),ae=T.S;if(ae!==null&&ae(P,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var de=P3(K,f);Dc(n,a,de,Ri(n))}else Dc(n,a,f,Ri(n))}catch(pe){Dc(n,a,{then:function(){},status:"rejected",reason:pe},Ri())}finally{U.p=b,A!==null&&P.types!==null&&(A.types=P.types),T.T=A}}function F3(){}function Kp(n,a,c,f){if(n.tag!==5)throw Error(i(476));var _=P1(n).queue;B1(n,_,a,H,c===null?F3:function(){return I1(n),c(f)})}function P1(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:H},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:c},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function I1(n){var a=P1(n);a.next===null&&(a=n.alternate.memoizedState),Dc(n,a.next.queue,{},Ri())}function Xp(){return jr(Xc)}function z1(){return Jt().memoizedState}function $1(){return Jt().memoizedState}function W3(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=Ri();n=Xs(c);var f=Zs(a,n,c);f!==null&&(di(f,a,c),Nc(f,a,c)),a={cache:Ep()},n.payload=a;return}a=a.return}}function q3(n,a,c){var f=Ri();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Xd(n)?H1(a,c):(c=mp(n,a,c,f),c!==null&&(di(c,n,f),F1(c,a,f)))}function U1(n,a,c){var f=Ri();Dc(n,a,c,f)}function Dc(n,a,c,f){var _={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Xd(n))H1(a,_);else{var b=n.alternate;if(n.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var A=a.lastRenderedState,P=b(A,c);if(_.hasEagerState=!0,_.eagerState=P,yi(P,A))return Td(n,a,_,0),Rt===null&&Ad(),!1}catch{}finally{}if(c=mp(n,a,_,f),c!==null)return di(c,n,f),F1(c,a,f),!0}return!1}function Zp(n,a,c,f){if(f={lane:2,revertLane:Ag(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Xd(n)){if(a)throw Error(i(479))}else a=mp(n,c,f,2),a!==null&&di(a,n,2)}function Xd(n){var a=n.alternate;return n===Xe||a!==null&&a===Xe}function H1(n,a){fl=Fd=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function F1(n,a,c){if((c&4194048)!==0){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,Wt(n,c)}}var Lc={readContext:jr,use:Vd,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};Lc.useEffectEvent=qt;var W1={readContext:jr,use:Vd,useCallback:function(n,a){return Kr().memoizedState=[n,a===void 0?null:a],n},useContext:jr,useEffect:k1,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Yd(4194308,4,M1.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Yd(4194308,4,n,a)},useInsertionEffect:function(n,a){Yd(4,2,n,a)},useMemo:function(n,a){var c=Kr();a=a===void 0?null:a;var f=n();if(no){vi(!0);try{n()}finally{vi(!1)}}return c.memoizedState=[f,a],f},useReducer:function(n,a,c){var f=Kr();if(c!==void 0){var _=c(a);if(no){vi(!0);try{c(a)}finally{vi(!1)}}}else _=a;return f.memoizedState=f.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},f.queue=n,n=n.dispatch=q3.bind(null,Xe,n),[f.memoizedState,n]},useRef:function(n){var a=Kr();return n={current:n},a.memoizedState=n},useState:function(n){n=Wp(n);var a=n.queue,c=U1.bind(null,Xe,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:Gp,useDeferredValue:function(n,a){var c=Kr();return Yp(c,n,a)},useTransition:function(){var n=Wp(!1);return n=B1.bind(null,Xe,n.queue,!0,!1),Kr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var f=Xe,_=Kr();if(ut){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),Rt===null)throw Error(i(349));(ot&127)!==0||d1(f,a,c)}_.memoizedState=c;var b={value:c,getSnapshot:a};return _.queue=b,k1(f1.bind(null,f,b,n),[n]),f.flags|=2048,pl(9,{destroy:void 0},h1.bind(null,f,b,c,a),null),c},useId:function(){var n=Kr(),a=Rt.identifierPrefix;if(ut){var c=jn,f=Mn;c=(f&~(1<<32-vr(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Wd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=I3++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Xp,useFormState:w1,useActionState:w1,useOptimistic:function(n){var a=Kr();a.memoizedState=a.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Zp.bind(null,Xe,!0,c),c.dispatch=a,[n,a]},useMemoCache:Up,useCacheRefresh:function(){return Kr().memoizedState=W3.bind(null,Xe)},useEffectEvent:function(n){var a=Kr(),c={impl:n};return a.memoizedState=c,function(){if((pt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},Qp={readContext:jr,use:Vd,useCallback:D1,useContext:jr,useEffect:Vp,useImperativeHandle:j1,useInsertionEffect:A1,useLayoutEffect:T1,useMemo:L1,useReducer:Gd,useRef:R1,useState:function(){return Gd(ms)},useDebugValue:Gp,useDeferredValue:function(n,a){var c=Jt();return O1(c,wt.memoizedState,n,a)},useTransition:function(){var n=Gd(ms)[0],a=Jt().memoizedState;return[typeof n=="boolean"?n:jc(n),a]},useSyncExternalStore:u1,useId:z1,useHostTransitionStatus:Xp,useFormState:S1,useActionState:S1,useOptimistic:function(n,a){var c=Jt();return g1(c,wt,n,a)},useMemoCache:Up,useCacheRefresh:$1};Qp.useEffectEvent=N1;var q1={readContext:jr,use:Vd,useCallback:D1,useContext:jr,useEffect:Vp,useImperativeHandle:j1,useInsertionEffect:A1,useLayoutEffect:T1,useMemo:L1,useReducer:Fp,useRef:R1,useState:function(){return Fp(ms)},useDebugValue:Gp,useDeferredValue:function(n,a){var c=Jt();return wt===null?Yp(c,n,a):O1(c,wt.memoizedState,n,a)},useTransition:function(){var n=Fp(ms)[0],a=Jt().memoizedState;return[typeof n=="boolean"?n:jc(n),a]},useSyncExternalStore:u1,useId:z1,useHostTransitionStatus:Xp,useFormState:E1,useActionState:E1,useOptimistic:function(n,a){var c=Jt();return wt!==null?g1(c,wt,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:Up,useCacheRefresh:$1};q1.useEffectEvent=N1;function Jp(n,a,c,f){a=n.memoizedState,c=c(f,a),c=c==null?a:p({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var eg={enqueueSetState:function(n,a,c){n=n._reactInternals;var f=Ri(),_=Xs(f);_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(di(a,n,f),Nc(a,n,f))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var f=Ri(),_=Xs(f);_.tag=1,_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(di(a,n,f),Nc(a,n,f))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=Ri(),f=Xs(c);f.tag=2,a!=null&&(f.callback=a),a=Zs(n,f,c),a!==null&&(di(a,n,c),Nc(a,n,c))}};function V1(n,a,c,f,_,b,A){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,b,A):a.prototype&&a.prototype.isPureReactComponent?!yc(c,f)||!yc(_,b):!0}function G1(n,a,c,f){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==n&&eg.enqueueReplaceState(a,a.state,null)}function so(n,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(n=n.defaultProps){c===a&&(c=p({},c));for(var _ in n)c[_]===void 0&&(c[_]=n[_])}return c}function Y1(n){Nd(n)}function K1(n){console.error(n)}function X1(n){Nd(n)}function Zd(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function Z1(n,a,c){try{var f=n.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function tg(n,a,c){return c=Xs(c),c.tag=3,c.payload={element:null},c.callback=function(){Zd(n,a)},c}function Q1(n){return n=Xs(n),n.tag=3,n}function J1(n,a,c,f){var _=c.type.getDerivedStateFromError;if(typeof _=="function"){var b=f.value;n.payload=function(){return _(b)},n.callback=function(){Z1(a,c,f)}}var A=c.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(n.callback=function(){Z1(a,c,f),typeof _!="function"&&(ia===null?ia=new Set([this]):ia.add(this));var P=f.stack;this.componentDidCatch(f.value,{componentStack:P!==null?P:""})})}function V3(n,a,c,f,_){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&ol(a,c,_,!0),c=wi.current,c!==null){switch(c.tag){case 31:case 13:return zi===null?ch():c.alternate===null&&Vt===0&&(Vt=3),c.flags&=-257,c.flags|=65536,c.lanes=_,f===Id?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),Rg(n,f,_)),!1;case 22:return c.flags|=65536,f===Id?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),Rg(n,f,_)),!1}throw Error(i(435,c.tag))}return Rg(n,f,_),ch(),!1}if(ut)return a=wi.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,f!==yp&&(n=Error(i(422),{cause:f}),Sc(Oi(n,c)))):(f!==yp&&(a=Error(i(423),{cause:f}),Sc(Oi(a,c))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,f=Oi(f,c),_=tg(n.stateNode,f,_),Mp(n,_),Vt!==4&&(Vt=2)),!1;var b=Error(i(520),{cause:f});if(b=Oi(b,c),Hc===null?Hc=[b]:Hc.push(b),Vt!==4&&(Vt=2),a===null)return!0;f=Oi(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=_&-_,c.lanes|=n,n=tg(c.stateNode,f,n),Mp(c,n),!1;case 1:if(a=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ia===null||!ia.has(b))))return c.flags|=65536,_&=-_,c.lanes|=_,_=Q1(_),J1(_,n,c,f),Mp(c,_),!1}c=c.return}while(c!==null);return!1}var rg=Error(i(461)),nr=!1;function Dr(n,a,c,f){a.child=n===null?i1(a,null,c,f):io(a,n.child,c,f)}function ew(n,a,c,f,_){c=c.render;var b=a.ref;if("ref"in f){var A={};for(var P in f)P!=="ref"&&(A[P]=f[P])}else A=f;return Ja(a),f=Pp(n,a,c,A,b,_),P=Ip(),n!==null&&!nr?(zp(n,a,_),ps(n,a,_)):(ut&&P&&_p(a),a.flags|=1,Dr(n,a,f,_),a.child)}function tw(n,a,c,f,_){if(n===null){var b=c.type;return typeof b=="function"&&!pp(b)&&b.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=b,rw(n,a,b,f,_)):(n=jd(c.type,null,f,a,a.mode,_),n.ref=a.ref,n.return=a,a.child=n)}if(b=n.child,!ug(n,_)){var A=b.memoizedProps;if(c=c.compare,c=c!==null?c:yc,c(A,f)&&n.ref===a.ref)return ps(n,a,_)}return a.flags|=1,n=cs(b,f),n.ref=a.ref,n.return=a,a.child=n}function rw(n,a,c,f,_){if(n!==null){var b=n.memoizedProps;if(yc(b,f)&&n.ref===a.ref)if(nr=!1,a.pendingProps=f=b,ug(n,_))(n.flags&131072)!==0&&(nr=!0);else return a.lanes=n.lanes,ps(n,a,_)}return ig(n,a,c,f,_)}function iw(n,a,c,f){var _=f.children,b=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|c:c,n!==null){for(f=a.child=n.child,_=0;f!==null;)_=_|f.lanes|f.childLanes,f=f.sibling;f=_&~b}else f=0,a.child=null;return nw(n,a,b,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Bd(a,b!==null?b.cachePool:null),b!==null?a1(a,b):Dp(),o1(a);else return f=a.lanes=536870912,nw(n,a,b!==null?b.baseLanes|c:c,c,f)}else b!==null?(Bd(a,b.cachePool),a1(a,b),Js(),a.memoizedState=null):(n!==null&&Bd(a,null),Dp(),Js());return Dr(n,a,_,c),a.child}function Oc(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function nw(n,a,c,f,_){var b=kp();return b=b===null?null:{parent:rr._currentValue,pool:b},a.memoizedState={baseLanes:c,cachePool:b},n!==null&&Bd(a,null),Dp(),o1(a),n!==null&&ol(n,a,f,!0),a.childLanes=_,null}function Qd(n,a){return a=eh({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function sw(n,a,c){return io(a,n.child,null,c),n=Qd(a,a.pendingProps),n.flags|=2,Si(a),a.memoizedState=null,n}function G3(n,a,c){var f=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(ut){if(f.mode==="hidden")return n=Qd(a,f),a.lanes=536870912,Oc(null,n);if(Op(a),(n=Tt)?(n=vS(n,Ii),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:Mn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},c=Hb(n),c.return=a,a.child=c,Mr=a,Tt=null)):n=null,n===null)throw Gs(a);return a.lanes=536870912,null}return Qd(a,f)}var b=n.memoizedState;if(b!==null){var A=b.dehydrated;if(Op(a),_)if(a.flags&256)a.flags&=-257,a=sw(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(i(558));else if(nr||ol(n,a,c,!1),_=(c&n.childLanes)!==0,nr||_){if(f=Rt,f!==null&&(A=ni(f,c),A!==0&&A!==b.retryLane))throw b.retryLane=A,Ka(n,A),di(f,n,A),rg;ch(),a=sw(n,a,c)}else n=b.treeContext,Tt=$i(A.nextSibling),Mr=a,ut=!0,Vs=null,Ii=!1,n!==null&&qb(a,n),a=Qd(a,f),a.flags|=4096;return a}return n=cs(n.child,{mode:f.mode,children:f.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Jd(n,a){var c=a.ref;if(c===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(n===null||n.ref!==c)&&(a.flags|=4194816)}}function ig(n,a,c,f,_){return Ja(a),c=Pp(n,a,c,f,void 0,_),f=Ip(),n!==null&&!nr?(zp(n,a,_),ps(n,a,_)):(ut&&f&&_p(a),a.flags|=1,Dr(n,a,c,_),a.child)}function aw(n,a,c,f,_,b){return Ja(a),a.updateQueue=null,c=c1(a,f,c,_),l1(n),f=Ip(),n!==null&&!nr?(zp(n,a,b),ps(n,a,b)):(ut&&f&&_p(a),a.flags|=1,Dr(n,a,c,b),a.child)}function ow(n,a,c,f,_){if(Ja(a),a.stateNode===null){var b=il,A=c.contextType;typeof A=="object"&&A!==null&&(b=jr(A)),b=new c(f,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=eg,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=f,b.state=a.memoizedState,b.refs={},Ap(a),A=c.contextType,b.context=typeof A=="object"&&A!==null?jr(A):il,b.state=a.memoizedState,A=c.getDerivedStateFromProps,typeof A=="function"&&(Jp(a,c,A,f),b.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(A=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),A!==b.state&&eg.enqueueReplaceState(b,b.state,null),Tc(a,f,b,_),Ac(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(n===null){b=a.stateNode;var P=a.memoizedProps,K=so(c,P);b.props=K;var ae=b.context,de=c.contextType;A=il,typeof de=="object"&&de!==null&&(A=jr(de));var pe=c.getDerivedStateFromProps;de=typeof pe=="function"||typeof b.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,de||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(P||ae!==A)&&G1(a,b,f,A),Ks=!1;var le=a.memoizedState;b.state=le,Tc(a,f,b,_),Ac(),ae=a.memoizedState,P||le!==ae||Ks?(typeof pe=="function"&&(Jp(a,c,pe,f),ae=a.memoizedState),(K=Ks||V1(a,c,K,f,le,ae,A))?(de||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ae),b.props=f,b.state=ae,b.context=A,f=K):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{b=a.stateNode,Tp(n,a),A=a.memoizedProps,de=so(c,A),b.props=de,pe=a.pendingProps,le=b.context,ae=c.contextType,K=il,typeof ae=="object"&&ae!==null&&(K=jr(ae)),P=c.getDerivedStateFromProps,(ae=typeof P=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(A!==pe||le!==K)&&G1(a,b,f,K),Ks=!1,le=a.memoizedState,b.state=le,Tc(a,f,b,_),Ac();var ue=a.memoizedState;A!==pe||le!==ue||Ks||n!==null&&n.dependencies!==null&&Ld(n.dependencies)?(typeof P=="function"&&(Jp(a,c,P,f),ue=a.memoizedState),(de=Ks||V1(a,c,de,f,le,ue,K)||n!==null&&n.dependencies!==null&&Ld(n.dependencies))?(ae||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(f,ue,K),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(f,ue,K)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ue),b.props=f,b.state=ue,b.context=K,f=de):(typeof b.componentDidUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=1024),f=!1)}return b=f,Jd(n,a),f=(a.flags&128)!==0,b||f?(b=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,n!==null&&f?(a.child=io(a,n.child,null,_),a.child=io(a,null,c,_)):Dr(n,a,c,_),a.memoizedState=b.state,n=a.child):n=ps(n,a,_),n}function lw(n,a,c,f){return Za(),a.flags|=256,Dr(n,a,c,f),a.child}var ng={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sg(n){return{baseLanes:n,cachePool:Zb()}}function ag(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=Ei),n}function cw(n,a,c){var f=a.pendingProps,_=!1,b=(a.flags&128)!==0,A;if((A=b)||(A=n!==null&&n.memoizedState===null?!1:(Qt.current&2)!==0),A&&(_=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,n===null){if(ut){if(_?Qs(a):Js(),(n=Tt)?(n=vS(n,Ii),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:Mn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},c=Hb(n),c.return=a,a.child=c,Mr=a,Tt=null)):n=null,n===null)throw Gs(a);return Hg(n)?a.lanes=32:a.lanes=536870912,null}var P=f.children;return f=f.fallback,_?(Js(),_=a.mode,P=eh({mode:"hidden",children:P},_),f=Xa(f,_,c,null),P.return=a,f.return=a,P.sibling=f,a.child=P,f=a.child,f.memoizedState=sg(c),f.childLanes=ag(n,A,c),a.memoizedState=ng,Oc(null,f)):(Qs(a),og(a,P))}var K=n.memoizedState;if(K!==null&&(P=K.dehydrated,P!==null)){if(b)a.flags&256?(Qs(a),a.flags&=-257,a=lg(n,a,c)):a.memoizedState!==null?(Js(),a.child=n.child,a.flags|=128,a=null):(Js(),P=f.fallback,_=a.mode,f=eh({mode:"visible",children:f.children},_),P=Xa(P,_,c,null),P.flags|=2,f.return=a,P.return=a,f.sibling=P,a.child=f,io(a,n.child,null,c),f=a.child,f.memoizedState=sg(c),f.childLanes=ag(n,A,c),a.memoizedState=ng,a=Oc(null,f));else if(Qs(a),Hg(P)){if(A=P.nextSibling&&P.nextSibling.dataset,A)var ae=A.dgst;A=ae,f=Error(i(419)),f.stack="",f.digest=A,Sc({value:f,source:null,stack:null}),a=lg(n,a,c)}else if(nr||ol(n,a,c,!1),A=(c&n.childLanes)!==0,nr||A){if(A=Rt,A!==null&&(f=ni(A,c),f!==0&&f!==K.retryLane))throw K.retryLane=f,Ka(n,f),di(A,n,f),rg;Ug(P)||ch(),a=lg(n,a,c)}else Ug(P)?(a.flags|=192,a.child=n.child,a=null):(n=K.treeContext,Tt=$i(P.nextSibling),Mr=a,ut=!0,Vs=null,Ii=!1,n!==null&&qb(a,n),a=og(a,f.children),a.flags|=4096);return a}return _?(Js(),P=f.fallback,_=a.mode,K=n.child,ae=K.sibling,f=cs(K,{mode:"hidden",children:f.children}),f.subtreeFlags=K.subtreeFlags&65011712,ae!==null?P=cs(ae,P):(P=Xa(P,_,c,null),P.flags|=2),P.return=a,f.return=a,f.sibling=P,a.child=f,Oc(null,f),f=a.child,P=n.child.memoizedState,P===null?P=sg(c):(_=P.cachePool,_!==null?(K=rr._currentValue,_=_.parent!==K?{parent:K,pool:K}:_):_=Zb(),P={baseLanes:P.baseLanes|c,cachePool:_}),f.memoizedState=P,f.childLanes=ag(n,A,c),a.memoizedState=ng,Oc(n.child,f)):(Qs(a),c=n.child,n=c.sibling,c=cs(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,n!==null&&(A=a.deletions,A===null?(a.deletions=[n],a.flags|=16):A.push(n)),a.child=c,a.memoizedState=null,c)}function og(n,a){return a=eh({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function eh(n,a){return n=bi(22,n,null,a),n.lanes=0,n}function lg(n,a,c){return io(a,n.child,null,c),n=og(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function uw(n,a,c){n.lanes|=a;var f=n.alternate;f!==null&&(f.lanes|=a),Sp(n.return,a,c)}function cg(n,a,c,f,_,b){var A=n.memoizedState;A===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:_,treeForkCount:b}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=f,A.tail=c,A.tailMode=_,A.treeForkCount=b)}function dw(n,a,c){var f=a.pendingProps,_=f.revealOrder,b=f.tail;f=f.children;var A=Qt.current,P=(A&2)!==0;if(P?(A=A&1|2,a.flags|=128):A&=1,X(Qt,A),Dr(n,a,f,c),f=ut?wc:0,!P&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&uw(n,c,a);else if(n.tag===19)uw(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(_){case"forwards":for(c=a.child,_=null;c!==null;)n=c.alternate,n!==null&&Hd(n)===null&&(_=c),c=c.sibling;c=_,c===null?(_=a.child,a.child=null):(_=c.sibling,c.sibling=null),cg(a,!1,_,c,b,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,_=a.child,a.child=null;_!==null;){if(n=_.alternate,n!==null&&Hd(n)===null){a.child=_;break}n=_.sibling,_.sibling=c,c=_,_=n}cg(a,!0,c,null,b,f);break;case"together":cg(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function ps(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),ra|=a.lanes,(c&a.childLanes)===0)if(n!==null){if(ol(n,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(i(153));if(a.child!==null){for(n=a.child,c=cs(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=cs(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function ug(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Ld(n)))}function Y3(n,a,c){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Ys(a,rr,n.memoizedState.cache),Za();break;case 27:case 5:we(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Ys(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Op(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Qs(a),a.flags|=128,null):(c&a.child.childLanes)!==0?cw(n,a,c):(Qs(a),n=ps(n,a,c),n!==null?n.sibling:null);Qs(a);break;case 19:var _=(n.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(ol(n,a,c,!1),f=(c&a.childLanes)!==0),_){if(f)return dw(n,a,c);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),X(Qt,Qt.current),f)break;return null;case 22:return a.lanes=0,iw(n,a,c,a.pendingProps);case 24:Ys(a,rr,n.memoizedState.cache)}return ps(n,a,c)}function hw(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)nr=!0;else{if(!ug(n,c)&&(a.flags&128)===0)return nr=!1,Y3(n,a,c);nr=(n.flags&131072)!==0}else nr=!1,ut&&(a.flags&1048576)!==0&&Wb(a,wc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(n=to(a.elementType),a.type=n,typeof n=="function")pp(n)?(f=so(n,f),a.tag=1,a=ow(null,a,n,f,c)):(a.tag=0,a=ig(null,a,n,f,c));else{if(n!=null){var _=n.$$typeof;if(_===R){a.tag=11,a=ew(null,a,n,f,c);break e}else if(_===z){a.tag=14,a=tw(null,a,n,f,c);break e}}throw a=O(n)||n,Error(i(306,a,""))}}return a;case 0:return ig(n,a,a.type,a.pendingProps,c);case 1:return f=a.type,_=so(f,a.pendingProps),ow(n,a,f,_,c);case 3:e:{if(ce(a,a.stateNode.containerInfo),n===null)throw Error(i(387));f=a.pendingProps;var b=a.memoizedState;_=b.element,Tp(n,a),Tc(a,f,null,c);var A=a.memoizedState;if(f=A.cache,Ys(a,rr,f),f!==b.cache&&Cp(a,[rr],c,!0),Ac(),f=A.element,b.isDehydrated)if(b={element:f,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=lw(n,a,f,c);break e}else if(f!==_){_=Oi(Error(i(424)),a),Sc(_),a=lw(n,a,f,c);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Tt=$i(n.firstChild),Mr=a,ut=!0,Vs=null,Ii=!0,c=i1(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Za(),f===_){a=ps(n,a,c);break e}Dr(n,a,f,c)}a=a.child}return a;case 26:return Jd(n,a),n===null?(c=SS(a.type,null,a.pendingProps,null))?a.memoizedState=c:ut||(c=a.type,n=a.pendingProps,f=gh(oe.current).createElement(c),f[Tr]=a,f[si]=n,Lr(f,c,n),_r(f),a.stateNode=f):a.memoizedState=SS(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return we(a),n===null&&ut&&(f=a.stateNode=yS(a.type,a.pendingProps,oe.current),Mr=a,Ii=!0,_=Tt,oa(a.type)?(Fg=_,Tt=$i(f.firstChild)):Tt=_),Dr(n,a,a.pendingProps.children,c),Jd(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&ut&&((_=f=Tt)&&(f=CD(f,a.type,a.pendingProps,Ii),f!==null?(a.stateNode=f,Mr=a,Tt=$i(f.firstChild),Ii=!1,_=!0):_=!1),_||Gs(a)),we(a),_=a.type,b=a.pendingProps,A=n!==null?n.memoizedProps:null,f=b.children,Ig(_,b)?f=null:A!==null&&Ig(_,A)&&(a.flags|=32),a.memoizedState!==null&&(_=Pp(n,a,z3,null,null,c),Xc._currentValue=_),Jd(n,a),Dr(n,a,f,c),a.child;case 6:return n===null&&ut&&((n=c=Tt)&&(c=ED(c,a.pendingProps,Ii),c!==null?(a.stateNode=c,Mr=a,Tt=null,n=!0):n=!1),n||Gs(a)),null;case 13:return cw(n,a,c);case 4:return ce(a,a.stateNode.containerInfo),f=a.pendingProps,n===null?a.child=io(a,null,f,c):Dr(n,a,f,c),a.child;case 11:return ew(n,a,a.type,a.pendingProps,c);case 7:return Dr(n,a,a.pendingProps,c),a.child;case 8:return Dr(n,a,a.pendingProps.children,c),a.child;case 12:return Dr(n,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,Ys(a,a.type,f.value),Dr(n,a,f.children,c),a.child;case 9:return _=a.type._context,f=a.pendingProps.children,Ja(a),_=jr(_),f=f(_),a.flags|=1,Dr(n,a,f,c),a.child;case 14:return tw(n,a,a.type,a.pendingProps,c);case 15:return rw(n,a,a.type,a.pendingProps,c);case 19:return dw(n,a,c);case 31:return G3(n,a,c);case 22:return iw(n,a,c,a.pendingProps);case 24:return Ja(a),f=jr(rr),n===null?(_=kp(),_===null&&(_=Rt,b=Ep(),_.pooledCache=b,b.refCount++,b!==null&&(_.pooledCacheLanes|=c),_=b),a.memoizedState={parent:f,cache:_},Ap(a),Ys(a,rr,_)):((n.lanes&c)!==0&&(Tp(n,a),Tc(a,null,null,c),Ac()),_=n.memoizedState,b=a.memoizedState,_.parent!==f?(_={parent:f,cache:f},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),Ys(a,rr,f)):(f=b.cache,Ys(a,rr,f),f!==_.cache&&Cp(a,[rr],c,!0))),Dr(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function gs(n){n.flags|=4}function dg(n,a,c,f,_){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if(zw())n.flags|=8192;else throw ro=Id,Np}else n.flags&=-16777217}function fw(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!NS(a))if(zw())n.flags|=8192;else throw ro=Id,Np}function th(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Fe():536870912,n.lanes|=a,xl|=a)}function Bc(n,a){if(!ut)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Mt(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,f=0;if(a)for(var _=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags&65011712,f|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags,f|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=f,n.childLanes=c,a}function K3(n,a,c){var f=a.pendingProps;switch(xp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(a),null;case 1:return Mt(a),null;case 3:return c=a.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),hs(rr),ne(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(al(a)?gs(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,bp())),Mt(a),null;case 26:var _=a.type,b=a.memoizedState;return n===null?(gs(a),b!==null?(Mt(a),fw(a,b)):(Mt(a),dg(a,_,null,f,c))):b?b!==n.memoizedState?(gs(a),Mt(a),fw(a,b)):(Mt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==f&&gs(a),Mt(a),dg(a,_,n,f,c)),null;case 27:if(xe(a),c=oe.current,_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Mt(a),null}n=ee.current,al(a)?Vb(a):(n=yS(_,f,c),a.stateNode=n,gs(a))}return Mt(a),null;case 5:if(xe(a),_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Mt(a),null}if(b=ee.current,al(a))Vb(a);else{var A=gh(oe.current);switch(b){case 1:b=A.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:b=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":b=A.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":b=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":b=A.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof f.is=="string"?A.createElement("select",{is:f.is}):A.createElement("select"),f.multiple?b.multiple=!0:f.size&&(b.size=f.size);break;default:b=typeof f.is=="string"?A.createElement(_,{is:f.is}):A.createElement(_)}}b[Tr]=a,b[si]=f;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)b.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=b;e:switch(Lr(b,_,f),_){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&gs(a)}}return Mt(a),dg(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,c),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(i(166));if(n=oe.current,al(a)){if(n=a.stateNode,c=a.memoizedProps,f=null,_=Mr,_!==null)switch(_.tag){case 27:case 5:f=_.memoizedProps}n[Tr]=a,n=!!(n.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||cS(n.nodeValue,c)),n||Gs(a,!0)}else n=gh(n).createTextNode(f),n[Tr]=a,a.stateNode=n}return Mt(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(f=al(a),c!==null){if(n===null){if(!f)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Tr]=a}else Za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),n=!1}else c=bp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(Si(a),a):(Si(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Mt(a),null;case 13:if(f=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=al(a),f!==null&&f.dehydrated!==null){if(n===null){if(!_)throw Error(i(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(i(317));_[Tr]=a}else Za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),_=!1}else _=bp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Si(a),a):(Si(a),null)}return Si(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,n=n!==null&&n.memoizedState!==null,c&&(f=a.child,_=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(_=f.alternate.memoizedState.cachePool.pool),b=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),b!==_&&(f.flags|=2048)),c!==n&&c&&(a.child.flags|=8192),th(a,a.updateQueue),Mt(a),null);case 4:return ne(),n===null&&Dg(a.stateNode.containerInfo),Mt(a),null;case 10:return hs(a.type),Mt(a),null;case 19:if(Y(Qt),f=a.memoizedState,f===null)return Mt(a),null;if(_=(a.flags&128)!==0,b=f.rendering,b===null)if(_)Bc(f,!1);else{if(Vt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(b=Hd(n),b!==null){for(a.flags|=128,Bc(f,!1),n=b.updateQueue,a.updateQueue=n,th(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)Ub(c,n),c=c.sibling;return X(Qt,Qt.current&1|2),ut&&us(a,f.treeForkCount),a.child}n=n.sibling}f.tail!==null&&He()>ah&&(a.flags|=128,_=!0,Bc(f,!1),a.lanes=4194304)}else{if(!_)if(n=Hd(b),n!==null){if(a.flags|=128,_=!0,n=n.updateQueue,a.updateQueue=n,th(a,n),Bc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!b.alternate&&!ut)return Mt(a),null}else 2*He()-f.renderingStartTime>ah&&c!==536870912&&(a.flags|=128,_=!0,Bc(f,!1),a.lanes=4194304);f.isBackwards?(b.sibling=a.child,a.child=b):(n=f.last,n!==null?n.sibling=b:a.child=b,f.last=b)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=He(),n.sibling=null,c=Qt.current,X(Qt,_?c&1|2:c&1),ut&&us(a,f.treeForkCount),n):(Mt(a),null);case 22:case 23:return Si(a),Lp(),f=a.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Mt(a),a.subtreeFlags&6&&(a.flags|=8192)):Mt(a),c=a.updateQueue,c!==null&&th(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),n!==null&&Y(eo),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),hs(rr),Mt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function X3(n,a){switch(xp(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return hs(rr),ne(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return xe(a),null;case 31:if(a.memoizedState!==null){if(Si(a),a.alternate===null)throw Error(i(340));Za()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Si(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Za()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Y(Qt),null;case 4:return ne(),null;case 10:return hs(a.type),null;case 22:case 23:return Si(a),Lp(),n!==null&&Y(eo),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return hs(rr),null;case 25:return null;default:return null}}function mw(n,a){switch(xp(a),a.tag){case 3:hs(rr),ne();break;case 26:case 27:case 5:xe(a);break;case 4:ne();break;case 31:a.memoizedState!==null&&Si(a);break;case 13:Si(a);break;case 19:Y(Qt);break;case 10:hs(a.type);break;case 22:case 23:Si(a),Lp(),n!==null&&Y(eo);break;case 24:hs(rr)}}function Pc(n,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var _=f.next;c=_;do{if((c.tag&n)===n){f=void 0;var b=c.create,A=c.inst;f=b(),A.destroy=f}c=c.next}while(c!==_)}}catch(P){xt(a,a.return,P)}}function ea(n,a,c){try{var f=a.updateQueue,_=f!==null?f.lastEffect:null;if(_!==null){var b=_.next;f=b;do{if((f.tag&n)===n){var A=f.inst,P=A.destroy;if(P!==void 0){A.destroy=void 0,_=a;var K=c,ae=P;try{ae()}catch(de){xt(_,K,de)}}}f=f.next}while(f!==b)}}catch(de){xt(a,a.return,de)}}function pw(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{s1(a,c)}catch(f){xt(n,n.return,f)}}}function gw(n,a,c){c.props=so(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(f){xt(n,a,f)}}function Ic(n,a){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof c=="function"?n.refCleanup=c(f):c.current=f}}catch(_){xt(n,a,_)}}function Dn(n,a){var c=n.ref,f=n.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(_){xt(n,a,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(_){xt(n,a,_)}else c.current=null}function vw(n){var a=n.type,c=n.memoizedProps,f=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(_){xt(n,n.return,_)}}function hg(n,a,c){try{var f=n.stateNode;_D(f,n.type,c,a),f[si]=a}catch(_){xt(n,n.return,_)}}function _w(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&oa(n.type)||n.tag===4}function fg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||_w(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&oa(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function mg(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(n),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=os));else if(f!==4&&(f===27&&oa(n.type)&&(c=n.stateNode,a=null),n=n.child,n!==null))for(mg(n,a,c),n=n.sibling;n!==null;)mg(n,a,c),n=n.sibling}function rh(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(f!==4&&(f===27&&oa(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(rh(n,a,c),n=n.sibling;n!==null;)rh(n,a,c),n=n.sibling}function xw(n){var a=n.stateNode,c=n.memoizedProps;try{for(var f=n.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);Lr(a,f,c),a[Tr]=n,a[si]=c}catch(b){xt(n,n.return,b)}}var vs=!1,sr=!1,pg=!1,yw=typeof WeakSet=="function"?WeakSet:Set,xr=null;function Z3(n,a){if(n=n.containerInfo,Bg=Sh,n=jb(n),lp(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var _=f.anchorOffset,b=f.focusNode;f=f.focusOffset;try{c.nodeType,b.nodeType}catch{c=null;break e}var A=0,P=-1,K=-1,ae=0,de=0,pe=n,le=null;t:for(;;){for(var ue;pe!==c||_!==0&&pe.nodeType!==3||(P=A+_),pe!==b||f!==0&&pe.nodeType!==3||(K=A+f),pe.nodeType===3&&(A+=pe.nodeValue.length),(ue=pe.firstChild)!==null;)le=pe,pe=ue;for(;;){if(pe===n)break t;if(le===c&&++ae===_&&(P=A),le===b&&++de===f&&(K=A),(ue=pe.nextSibling)!==null)break;pe=le,le=pe.parentNode}pe=ue}c=P===-1||K===-1?null:{start:P,end:K}}else c=null}c=c||{start:0,end:0}}else c=null;for(Pg={focusedElem:n,selectionRange:c},Sh=!1,xr=a;xr!==null;)if(a=xr,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,xr=n;else for(;xr!==null;){switch(a=xr,b=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)_=n[c],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&b!==null){n=void 0,c=a,_=b.memoizedProps,b=b.memoizedState,f=c.stateNode;try{var je=so(c.type,_);n=f.getSnapshotBeforeUpdate(je,b),f.__reactInternalSnapshotBeforeUpdate=n}catch($e){xt(c,c.return,$e)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,c=n.nodeType,c===9)$g(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":$g(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=a.sibling,n!==null){n.return=a.return,xr=n;break}xr=a.return}}function bw(n,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:xs(n,c),f&4&&Pc(5,c);break;case 1:if(xs(n,c),f&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(A){xt(c,c.return,A)}else{var _=so(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(_,a,n.__reactInternalSnapshotBeforeUpdate)}catch(A){xt(c,c.return,A)}}f&64&&pw(c),f&512&&Ic(c,c.return);break;case 3:if(xs(n,c),f&64&&(n=c.updateQueue,n!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{s1(n,a)}catch(A){xt(c,c.return,A)}}break;case 27:a===null&&f&4&&xw(c);case 26:case 5:xs(n,c),a===null&&f&4&&vw(c),f&512&&Ic(c,c.return);break;case 12:xs(n,c);break;case 31:xs(n,c),f&4&&Cw(n,c);break;case 13:xs(n,c),f&4&&Ew(n,c),f&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=aD.bind(null,c),RD(n,c))));break;case 22:if(f=c.memoizedState!==null||vs,!f){a=a!==null&&a.memoizedState!==null||sr,_=vs;var b=sr;vs=f,(sr=a)&&!b?ys(n,c,(c.subtreeFlags&8772)!==0):xs(n,c),vs=_,sr=b}break;case 30:break;default:xs(n,c)}}function ww(n){var a=n.alternate;a!==null&&(n.alternate=null,ww(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&qm(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Pt=null,oi=!1;function _s(n,a,c){for(c=c.child;c!==null;)Sw(n,a,c),c=c.sibling}function Sw(n,a,c){if(Ar&&typeof Ar.onCommitFiberUnmount=="function")try{Ar.onCommitFiberUnmount(is,c)}catch{}switch(c.tag){case 26:sr||Dn(c,a),_s(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sr||Dn(c,a);var f=Pt,_=oi;oa(c.type)&&(Pt=c.stateNode,oi=!1),_s(n,a,c),Gc(c.stateNode),Pt=f,oi=_;break;case 5:sr||Dn(c,a);case 6:if(f=Pt,_=oi,Pt=null,_s(n,a,c),Pt=f,oi=_,Pt!==null)if(oi)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(c.stateNode)}catch(b){xt(c,a,b)}else try{Pt.removeChild(c.stateNode)}catch(b){xt(c,a,b)}break;case 18:Pt!==null&&(oi?(n=Pt,pS(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),kl(n)):pS(Pt,c.stateNode));break;case 4:f=Pt,_=oi,Pt=c.stateNode.containerInfo,oi=!0,_s(n,a,c),Pt=f,oi=_;break;case 0:case 11:case 14:case 15:ea(2,c,a),sr||ea(4,c,a),_s(n,a,c);break;case 1:sr||(Dn(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&gw(c,a,f)),_s(n,a,c);break;case 21:_s(n,a,c);break;case 22:sr=(f=sr)||c.memoizedState!==null,_s(n,a,c),sr=f;break;default:_s(n,a,c)}}function Cw(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{kl(n)}catch(c){xt(a,a.return,c)}}}function Ew(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{kl(n)}catch(c){xt(a,a.return,c)}}function Q3(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new yw),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new yw),a;default:throw Error(i(435,n.tag))}}function ih(n,a){var c=Q3(n);a.forEach(function(f){if(!c.has(f)){c.add(f);var _=oD.bind(null,n,f);f.then(_,_)}})}function li(n,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var _=c[f],b=n,A=a,P=A;e:for(;P!==null;){switch(P.tag){case 27:if(oa(P.type)){Pt=P.stateNode,oi=!1;break e}break;case 5:Pt=P.stateNode,oi=!1;break e;case 3:case 4:Pt=P.stateNode.containerInfo,oi=!0;break e}P=P.return}if(Pt===null)throw Error(i(160));Sw(b,A,_),Pt=null,oi=!1,b=_.alternate,b!==null&&(b.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Rw(a,n),a=a.sibling}var cn=null;function Rw(n,a){var c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:li(a,n),ci(n),f&4&&(ea(3,n,n.return),Pc(3,n),ea(5,n,n.return));break;case 1:li(a,n),ci(n),f&512&&(sr||c===null||Dn(c,c.return)),f&64&&vs&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var _=cn;if(li(a,n),ci(n),f&512&&(sr||c===null||Dn(c,c.return)),f&4){var b=c!==null?c.memoizedState:null;if(f=n.memoizedState,c===null)if(f===null)if(n.stateNode===null){e:{f=n.type,c=n.memoizedProps,_=_.ownerDocument||_;t:switch(f){case"title":b=_.getElementsByTagName("title")[0],(!b||b[dc]||b[Tr]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=_.createElement(f),_.head.insertBefore(b,_.querySelector("head > title"))),Lr(b,f,c),b[Tr]=n,_r(b),f=b;break e;case"link":var A=RS("link","href",_).get(f+(c.href||""));if(A){for(var P=0;P<A.length;P++)if(b=A[P],b.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&b.getAttribute("rel")===(c.rel==null?null:c.rel)&&b.getAttribute("title")===(c.title==null?null:c.title)&&b.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){A.splice(P,1);break t}}b=_.createElement(f),Lr(b,f,c),_.head.appendChild(b);break;case"meta":if(A=RS("meta","content",_).get(f+(c.content||""))){for(P=0;P<A.length;P++)if(b=A[P],b.getAttribute("content")===(c.content==null?null:""+c.content)&&b.getAttribute("name")===(c.name==null?null:c.name)&&b.getAttribute("property")===(c.property==null?null:c.property)&&b.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&b.getAttribute("charset")===(c.charSet==null?null:c.charSet)){A.splice(P,1);break t}}b=_.createElement(f),Lr(b,f,c),_.head.appendChild(b);break;default:throw Error(i(468,f))}b[Tr]=n,_r(b),f=b}n.stateNode=f}else kS(_,n.type,n.stateNode);else n.stateNode=ES(_,f,n.memoizedProps);else b!==f?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,f===null?kS(_,n.type,n.stateNode):ES(_,f,n.memoizedProps)):f===null&&n.stateNode!==null&&hg(n,n.memoizedProps,c.memoizedProps)}break;case 27:li(a,n),ci(n),f&512&&(sr||c===null||Dn(c,c.return)),c!==null&&f&4&&hg(n,n.memoizedProps,c.memoizedProps);break;case 5:if(li(a,n),ci(n),f&512&&(sr||c===null||Dn(c,c.return)),n.flags&32){_=n.stateNode;try{Xo(_,"")}catch(je){xt(n,n.return,je)}}f&4&&n.stateNode!=null&&(_=n.memoizedProps,hg(n,_,c!==null?c.memoizedProps:_)),f&1024&&(pg=!0);break;case 6:if(li(a,n),ci(n),f&4){if(n.stateNode===null)throw Error(i(162));f=n.memoizedProps,c=n.stateNode;try{c.nodeValue=f}catch(je){xt(n,n.return,je)}}break;case 3:if(xh=null,_=cn,cn=vh(a.containerInfo),li(a,n),cn=_,ci(n),f&4&&c!==null&&c.memoizedState.isDehydrated)try{kl(a.containerInfo)}catch(je){xt(n,n.return,je)}pg&&(pg=!1,kw(n));break;case 4:f=cn,cn=vh(n.stateNode.containerInfo),li(a,n),ci(n),cn=f;break;case 12:li(a,n),ci(n);break;case 31:li(a,n),ci(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 13:li(a,n),ci(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(sh=He()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 22:_=n.memoizedState!==null;var K=c!==null&&c.memoizedState!==null,ae=vs,de=sr;if(vs=ae||_,sr=de||K,li(a,n),sr=de,vs=ae,ci(n),f&8192)e:for(a=n.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(c===null||K||vs||sr||ao(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){K=c=a;try{if(b=K.stateNode,_)A=b.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{P=K.stateNode;var pe=K.memoizedProps.style,le=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;P.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(je){xt(K,K.return,je)}}}else if(a.tag===6){if(c===null){K=a;try{K.stateNode.nodeValue=_?"":K.memoizedProps}catch(je){xt(K,K.return,je)}}}else if(a.tag===18){if(c===null){K=a;try{var ue=K.stateNode;_?gS(ue,!0):gS(K.stateNode,!1)}catch(je){xt(K,K.return,je)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=n.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,ih(n,c))));break;case 19:li(a,n),ci(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 30:break;case 21:break;default:li(a,n),ci(n)}}function ci(n){var a=n.flags;if(a&2){try{for(var c,f=n.return;f!==null;){if(_w(f)){c=f;break}f=f.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var _=c.stateNode,b=fg(n);rh(n,b,_);break;case 5:var A=c.stateNode;c.flags&32&&(Xo(A,""),c.flags&=-33);var P=fg(n);rh(n,P,A);break;case 3:case 4:var K=c.stateNode.containerInfo,ae=fg(n);mg(n,ae,K);break;default:throw Error(i(161))}}catch(de){xt(n,n.return,de)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function kw(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;kw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function xs(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)bw(n,a.alternate,a),a=a.sibling}function ao(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ea(4,a,a.return),ao(a);break;case 1:Dn(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&gw(a,a.return,c),ao(a);break;case 27:Gc(a.stateNode);case 26:case 5:Dn(a,a.return),ao(a);break;case 22:a.memoizedState===null&&ao(a);break;case 30:ao(a);break;default:ao(a)}n=n.sibling}}function ys(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,_=n,b=a,A=b.flags;switch(b.tag){case 0:case 11:case 15:ys(_,b,c),Pc(4,b);break;case 1:if(ys(_,b,c),f=b,_=f.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ae){xt(f,f.return,ae)}if(f=b,_=f.updateQueue,_!==null){var P=f.stateNode;try{var K=_.shared.hiddenCallbacks;if(K!==null)for(_.shared.hiddenCallbacks=null,_=0;_<K.length;_++)n1(K[_],P)}catch(ae){xt(f,f.return,ae)}}c&&A&64&&pw(b),Ic(b,b.return);break;case 27:xw(b);case 26:case 5:ys(_,b,c),c&&f===null&&A&4&&vw(b),Ic(b,b.return);break;case 12:ys(_,b,c);break;case 31:ys(_,b,c),c&&A&4&&Cw(_,b);break;case 13:ys(_,b,c),c&&A&4&&Ew(_,b);break;case 22:b.memoizedState===null&&ys(_,b,c),Ic(b,b.return);break;case 30:break;default:ys(_,b,c)}a=a.sibling}}function gg(n,a){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Cc(c))}function vg(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Cc(n))}function un(n,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Nw(n,a,c,f),a=a.sibling}function Nw(n,a,c,f){var _=a.flags;switch(a.tag){case 0:case 11:case 15:un(n,a,c,f),_&2048&&Pc(9,a);break;case 1:un(n,a,c,f);break;case 3:un(n,a,c,f),_&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Cc(n)));break;case 12:if(_&2048){un(n,a,c,f),n=a.stateNode;try{var b=a.memoizedProps,A=b.id,P=b.onPostCommit;typeof P=="function"&&P(A,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(K){xt(a,a.return,K)}}else un(n,a,c,f);break;case 31:un(n,a,c,f);break;case 13:un(n,a,c,f);break;case 23:break;case 22:b=a.stateNode,A=a.alternate,a.memoizedState!==null?b._visibility&2?un(n,a,c,f):zc(n,a):b._visibility&2?un(n,a,c,f):(b._visibility|=2,gl(n,a,c,f,(a.subtreeFlags&10256)!==0||!1)),_&2048&&gg(A,a);break;case 24:un(n,a,c,f),_&2048&&vg(a.alternate,a);break;default:un(n,a,c,f)}}function gl(n,a,c,f,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=n,A=a,P=c,K=f,ae=A.flags;switch(A.tag){case 0:case 11:case 15:gl(b,A,P,K,_),Pc(8,A);break;case 23:break;case 22:var de=A.stateNode;A.memoizedState!==null?de._visibility&2?gl(b,A,P,K,_):zc(b,A):(de._visibility|=2,gl(b,A,P,K,_)),_&&ae&2048&&gg(A.alternate,A);break;case 24:gl(b,A,P,K,_),_&&ae&2048&&vg(A.alternate,A);break;default:gl(b,A,P,K,_)}a=a.sibling}}function zc(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,f=a,_=f.flags;switch(f.tag){case 22:zc(c,f),_&2048&&gg(f.alternate,f);break;case 24:zc(c,f),_&2048&&vg(f.alternate,f);break;default:zc(c,f)}a=a.sibling}}var $c=8192;function vl(n,a,c){if(n.subtreeFlags&$c)for(n=n.child;n!==null;)Aw(n,a,c),n=n.sibling}function Aw(n,a,c){switch(n.tag){case 26:vl(n,a,c),n.flags&$c&&n.memoizedState!==null&&ID(c,cn,n.memoizedState,n.memoizedProps);break;case 5:vl(n,a,c);break;case 3:case 4:var f=cn;cn=vh(n.stateNode.containerInfo),vl(n,a,c),cn=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=$c,$c=16777216,vl(n,a,c),$c=f):vl(n,a,c));break;default:vl(n,a,c)}}function Tw(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Uc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];xr=f,jw(f,n)}Tw(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Mw(n),n=n.sibling}function Mw(n){switch(n.tag){case 0:case 11:case 15:Uc(n),n.flags&2048&&ea(9,n,n.return);break;case 3:Uc(n);break;case 12:Uc(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,nh(n)):Uc(n);break;default:Uc(n)}}function nh(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];xr=f,jw(f,n)}Tw(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ea(8,a,a.return),nh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,nh(a));break;default:nh(a)}n=n.sibling}}function jw(n,a){for(;xr!==null;){var c=xr;switch(c.tag){case 0:case 11:case 15:ea(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Cc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,xr=f;else e:for(c=n;xr!==null;){f=xr;var _=f.sibling,b=f.return;if(ww(f),f===c){xr=null;break e}if(_!==null){_.return=b,xr=_;break e}xr=b}}}var J3={getCacheForType:function(n){var a=jr(rr),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return jr(rr).controller.signal}},eD=typeof WeakMap=="function"?WeakMap:Map,pt=0,Rt=null,nt=null,ot=0,_t=0,Ci=null,ta=!1,_l=!1,_g=!1,bs=0,Vt=0,ra=0,oo=0,xg=0,Ei=0,xl=0,Hc=null,ui=null,yg=!1,sh=0,Dw=0,ah=1/0,oh=null,ia=null,dr=0,na=null,yl=null,ws=0,bg=0,wg=null,Lw=null,Fc=0,Sg=null;function Ri(){return(pt&2)!==0&&ot!==0?ot&-ot:T.T!==null?Ag():Fm()}function Ow(){if(Ei===0)if((ot&536870912)===0||ut){var n=ss;ss<<=1,(ss&3932160)===0&&(ss=262144),Ei=n}else Ei=536870912;return n=wi.current,n!==null&&(n.flags|=32),Ei}function di(n,a,c){(n===Rt&&(_t===2||_t===9)||n.cancelPendingCommit!==null)&&(bl(n,0),sa(n,ot,Ei,!1)),Ze(n,c),((pt&2)===0||n!==Rt)&&(n===Rt&&((pt&2)===0&&(oo|=c),Vt===4&&sa(n,ot,Ei,!1)),Ln(n))}function Bw(n,a,c){if((pt&6)!==0)throw Error(i(327));var f=!c&&(a&127)===0&&(a&n.expiredLanes)===0||me(n,a),_=f?iD(n,a):Eg(n,a,!0),b=f;do{if(_===0){_l&&!f&&sa(n,a,0,!1);break}else{if(c=n.current.alternate,b&&!tD(c)){_=Eg(n,a,!1),b=!1;continue}if(_===2){if(b=a,n.errorRecoveryDisabledLanes&b)var A=0;else A=n.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var P=n;_=Hc;var K=P.current.memoizedState.isDehydrated;if(K&&(bl(P,A).flags|=256),A=Eg(P,A,!1),A!==2){if(_g&&!K){P.errorRecoveryDisabledLanes|=b,oo|=b,_=4;break e}b=ui,ui=_,b!==null&&(ui===null?ui=b:ui.push.apply(ui,b))}_=A}if(b=!1,_!==2)continue}}if(_===1){bl(n,0),sa(n,a,0,!0);break}e:{switch(f=n,b=_,b){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:sa(f,a,Ei,!ta);break e;case 2:ui=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(_=sh+300-He(),10<_)){if(sa(f,a,Ei,!ta),Ue(f,0,!0)!==0)break e;ws=a,f.timeoutHandle=fS(Pw.bind(null,f,c,ui,oh,yg,a,Ei,oo,xl,ta,b,"Throttled",-0,0),_);break e}Pw(f,c,ui,oh,yg,a,Ei,oo,xl,ta,b,null,-0,0)}}break}while(!0);Ln(n)}function Pw(n,a,c,f,_,b,A,P,K,ae,de,pe,le,ue){if(n.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:os},Aw(a,b,pe);var je=(b&62914560)===b?sh-He():(b&4194048)===b?Dw-He():0;if(je=zD(pe,je),je!==null){ws=b,n.cancelPendingCommit=je(qw.bind(null,n,a,b,c,f,_,A,P,K,de,pe,null,le,ue)),sa(n,b,A,!ae);return}}qw(n,a,b,c,f,_,A,P,K)}function tD(n){for(var a=n;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var _=c[f],b=_.getSnapshot;_=_.value;try{if(!yi(b(),_))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function sa(n,a,c,f){a&=~xg,a&=~oo,n.suspendedLanes|=a,n.pingedLanes&=~a,f&&(n.warmLanes|=a),f=n.expirationTimes;for(var _=a;0<_;){var b=31-vr(_),A=1<<b;f[b]=-1,_&=~A}c!==0&&ii(n,c,a)}function lh(){return(pt&6)===0?(Wc(0),!1):!0}function Cg(){if(nt!==null){if(_t===0)var n=nt.return;else n=nt,ds=Qa=null,$p(n),dl=null,Rc=0,n=nt;for(;n!==null;)mw(n.alternate,n),n=n.return;nt=null}}function bl(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,bD(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),ws=0,Cg(),Rt=n,nt=c=cs(n.current,null),ot=a,_t=0,Ci=null,ta=!1,_l=me(n,a),_g=!1,xl=Ei=xg=oo=ra=Vt=0,ui=Hc=null,yg=!1,(a&8)!==0&&(a|=a&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=a;0<f;){var _=31-vr(f),b=1<<_;a|=n[_],f&=~b}return bs=a,Ad(),c}function Iw(n,a){Xe=null,T.H=Lc,a===ul||a===Pd?(a=e1(),_t=3):a===Np?(a=e1(),_t=4):_t=a===rg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ci=a,nt===null&&(Vt=1,Zd(n,Oi(a,n.current)))}function zw(){var n=wi.current;return n===null?!0:(ot&4194048)===ot?zi===null:(ot&62914560)===ot||(ot&536870912)!==0?n===zi:!1}function $w(){var n=T.H;return T.H=Lc,n===null?Lc:n}function Uw(){var n=T.A;return T.A=J3,n}function ch(){Vt=4,ta||(ot&4194048)!==ot&&wi.current!==null||(_l=!0),(ra&134217727)===0&&(oo&134217727)===0||Rt===null||sa(Rt,ot,Ei,!1)}function Eg(n,a,c){var f=pt;pt|=2;var _=$w(),b=Uw();(Rt!==n||ot!==a)&&(oh=null,bl(n,a)),a=!1;var A=Vt;e:do try{if(_t!==0&&nt!==null){var P=nt,K=Ci;switch(_t){case 8:Cg(),A=6;break e;case 3:case 2:case 9:case 6:wi.current===null&&(a=!0);var ae=_t;if(_t=0,Ci=null,wl(n,P,K,ae),c&&_l){A=0;break e}break;default:ae=_t,_t=0,Ci=null,wl(n,P,K,ae)}}rD(),A=Vt;break}catch(de){Iw(n,de)}while(!0);return a&&n.shellSuspendCounter++,ds=Qa=null,pt=f,T.H=_,T.A=b,nt===null&&(Rt=null,ot=0,Ad()),A}function rD(){for(;nt!==null;)Hw(nt)}function iD(n,a){var c=pt;pt|=2;var f=$w(),_=Uw();Rt!==n||ot!==a?(oh=null,ah=He()+500,bl(n,a)):_l=me(n,a);e:do try{if(_t!==0&&nt!==null){a=nt;var b=Ci;t:switch(_t){case 1:_t=0,Ci=null,wl(n,a,b,1);break;case 2:case 9:if(Qb(b)){_t=0,Ci=null,Fw(a);break}a=function(){_t!==2&&_t!==9||Rt!==n||(_t=7),Ln(n)},b.then(a,a);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:Qb(b)?(_t=0,Ci=null,Fw(a)):(_t=0,Ci=null,wl(n,a,b,7));break;case 5:var A=null;switch(nt.tag){case 26:A=nt.memoizedState;case 5:case 27:var P=nt;if(A?NS(A):P.stateNode.complete){_t=0,Ci=null;var K=P.sibling;if(K!==null)nt=K;else{var ae=P.return;ae!==null?(nt=ae,uh(ae)):nt=null}break t}}_t=0,Ci=null,wl(n,a,b,5);break;case 6:_t=0,Ci=null,wl(n,a,b,6);break;case 8:Cg(),Vt=6;break e;default:throw Error(i(462))}}nD();break}catch(de){Iw(n,de)}while(!0);return ds=Qa=null,T.H=f,T.A=_,pt=c,nt!==null?0:(Rt=null,ot=0,Ad(),Vt)}function nD(){for(;nt!==null&&!Be();)Hw(nt)}function Hw(n){var a=hw(n.alternate,n,bs);n.memoizedProps=n.pendingProps,a===null?uh(n):nt=a}function Fw(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=aw(c,a,a.pendingProps,a.type,void 0,ot);break;case 11:a=aw(c,a,a.pendingProps,a.type.render,a.ref,ot);break;case 5:$p(a);default:mw(c,a),a=nt=Ub(a,bs),a=hw(c,a,bs)}n.memoizedProps=n.pendingProps,a===null?uh(n):nt=a}function wl(n,a,c,f){ds=Qa=null,$p(a),dl=null,Rc=0;var _=a.return;try{if(V3(n,_,a,c,ot)){Vt=1,Zd(n,Oi(c,n.current)),nt=null;return}}catch(b){if(_!==null)throw nt=_,b;Vt=1,Zd(n,Oi(c,n.current)),nt=null;return}a.flags&32768?(ut||f===1?n=!0:_l||(ot&536870912)!==0?n=!1:(ta=n=!0,(f===2||f===9||f===3||f===6)&&(f=wi.current,f!==null&&f.tag===13&&(f.flags|=16384))),Ww(a,n)):uh(a)}function uh(n){var a=n;do{if((a.flags&32768)!==0){Ww(a,ta);return}n=a.return;var c=K3(a.alternate,a,bs);if(c!==null){nt=c;return}if(a=a.sibling,a!==null){nt=a;return}nt=a=n}while(a!==null);Vt===0&&(Vt=5)}function Ww(n,a){do{var c=X3(n.alternate,n);if(c!==null){c.flags&=32767,nt=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(n=n.sibling,n!==null)){nt=n;return}nt=n=c}while(n!==null);Vt=6,nt=null}function qw(n,a,c,f,_,b,A,P,K){n.cancelPendingCommit=null;do dh();while(dr!==0);if((pt&6)!==0)throw Error(i(327));if(a!==null){if(a===n.current)throw Error(i(177));if(b=a.lanes|a.childLanes,b|=fp,Ft(n,c,b,A,P,K),n===Rt&&(nt=Rt=null,ot=0),yl=a,na=n,ws=c,bg=b,wg=_,Lw=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,lD(Bt,function(){return Xw(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=T.T,T.T=null,_=U.p,U.p=2,A=pt,pt|=4;try{Z3(n,a,c)}finally{pt=A,U.p=_,T.T=f}}dr=1,Vw(),Gw(),Yw()}}function Vw(){if(dr===1){dr=0;var n=na,a=yl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=pt;pt|=4;try{Rw(a,n);var b=Pg,A=jb(n.containerInfo),P=b.focusedElem,K=b.selectionRange;if(A!==P&&P&&P.ownerDocument&&Mb(P.ownerDocument.documentElement,P)){if(K!==null&&lp(P)){var ae=K.start,de=K.end;if(de===void 0&&(de=ae),"selectionStart"in P)P.selectionStart=ae,P.selectionEnd=Math.min(de,P.value.length);else{var pe=P.ownerDocument||document,le=pe&&pe.defaultView||window;if(le.getSelection){var ue=le.getSelection(),je=P.textContent.length,$e=Math.min(K.start,je),Ct=K.end===void 0?$e:Math.min(K.end,je);!ue.extend&&$e>Ct&&(A=Ct,Ct=$e,$e=A);var te=Tb(P,$e),Q=Tb(P,Ct);if(te&&Q&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var se=pe.createRange();se.setStart(te.node,te.offset),ue.removeAllRanges(),$e>Ct?(ue.addRange(se),ue.extend(Q.node,Q.offset)):(se.setEnd(Q.node,Q.offset),ue.addRange(se))}}}}for(pe=[],ue=P;ue=ue.parentNode;)ue.nodeType===1&&pe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<pe.length;P++){var fe=pe[P];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Sh=!!Bg,Pg=Bg=null}finally{pt=_,U.p=f,T.T=c}}n.current=a,dr=2}}function Gw(){if(dr===2){dr=0;var n=na,a=yl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=pt;pt|=4;try{bw(n,a.alternate,a)}finally{pt=_,U.p=f,T.T=c}}dr=3}}function Yw(){if(dr===4||dr===3){dr=0,dt();var n=na,a=yl,c=ws,f=Lw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?dr=5:(dr=0,yl=na=null,Kw(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(ia=null),on(c),a=a.stateNode,Ar&&typeof Ar.onCommitFiberRoot=="function")try{Ar.onCommitFiberRoot(is,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=T.T,_=U.p,U.p=2,T.T=null;try{for(var b=n.onRecoverableError,A=0;A<f.length;A++){var P=f[A];b(P.value,{componentStack:P.stack})}}finally{T.T=a,U.p=_}}(ws&3)!==0&&dh(),Ln(n),_=n.pendingLanes,(c&261930)!==0&&(_&42)!==0?n===Sg?Fc++:(Fc=0,Sg=n):Fc=0,Wc(0)}}function Kw(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Cc(a)))}function dh(){return Vw(),Gw(),Yw(),Xw()}function Xw(){if(dr!==5)return!1;var n=na,a=bg;bg=0;var c=on(ws),f=T.T,_=U.p;try{U.p=32>c?32:c,T.T=null,c=wg,wg=null;var b=na,A=ws;if(dr=0,yl=na=null,ws=0,(pt&6)!==0)throw Error(i(331));var P=pt;if(pt|=4,Mw(b.current),Nw(b,b.current,A,c),pt=P,Wc(0,!1),Ar&&typeof Ar.onPostCommitFiberRoot=="function")try{Ar.onPostCommitFiberRoot(is,b)}catch{}return!0}finally{U.p=_,T.T=f,Kw(n,a)}}function Zw(n,a,c){a=Oi(c,a),a=tg(n.stateNode,a,2),n=Zs(n,a,2),n!==null&&(Ze(n,2),Ln(n))}function xt(n,a,c){if(n.tag===3)Zw(n,n,c);else for(;a!==null;){if(a.tag===3){Zw(a,n,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ia===null||!ia.has(f))){n=Oi(c,n),c=Q1(2),f=Zs(a,c,2),f!==null&&(J1(c,f,a,n),Ze(f,2),Ln(f));break}}a=a.return}}function Rg(n,a,c){var f=n.pingCache;if(f===null){f=n.pingCache=new eD;var _=new Set;f.set(a,_)}else _=f.get(a),_===void 0&&(_=new Set,f.set(a,_));_.has(c)||(_g=!0,_.add(c),n=sD.bind(null,n,a,c),a.then(n,n))}function sD(n,a,c){var f=n.pingCache;f!==null&&f.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Rt===n&&(ot&c)===c&&(Vt===4||Vt===3&&(ot&62914560)===ot&&300>He()-sh?(pt&2)===0&&bl(n,0):xg|=c,xl===ot&&(xl=0)),Ln(n)}function Qw(n,a){a===0&&(a=Fe()),n=Ka(n,a),n!==null&&(Ze(n,a),Ln(n))}function aD(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),Qw(n,c)}function oD(n,a){var c=0;switch(n.tag){case 31:case 13:var f=n.stateNode,_=n.memoizedState;_!==null&&(c=_.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(a),Qw(n,c)}function lD(n,a){return ze(n,a)}var hh=null,Sl=null,kg=!1,fh=!1,Ng=!1,aa=0;function Ln(n){n!==Sl&&n.next===null&&(Sl===null?hh=Sl=n:Sl=Sl.next=n),fh=!0,kg||(kg=!0,uD())}function Wc(n,a){if(!Ng&&fh){Ng=!0;do for(var c=!1,f=hh;f!==null;){if(n!==0){var _=f.pendingLanes;if(_===0)var b=0;else{var A=f.suspendedLanes,P=f.pingedLanes;b=(1<<31-vr(42|n)+1)-1,b&=_&~(A&~P),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,rS(f,b))}else b=ot,b=Ue(f,f===Rt?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(b&3)===0||me(f,b)||(c=!0,rS(f,b));f=f.next}while(c);Ng=!1}}function cD(){Jw()}function Jw(){fh=kg=!1;var n=0;aa!==0&&yD()&&(n=aa);for(var a=He(),c=null,f=hh;f!==null;){var _=f.next,b=eS(f,a);b===0?(f.next=null,c===null?hh=_:c.next=_,_===null&&(Sl=c)):(c=f,(n!==0||(b&3)!==0)&&(fh=!0)),f=_}dr!==0&&dr!==5||Wc(n),aa!==0&&(aa=0)}function eS(n,a){for(var c=n.suspendedLanes,f=n.pingedLanes,_=n.expirationTimes,b=n.pendingLanes&-62914561;0<b;){var A=31-vr(b),P=1<<A,K=_[A];K===-1?((P&c)===0||(P&f)!==0)&&(_[A]=ke(P,a)):K<=a&&(n.expiredLanes|=P),b&=~P}if(a=Rt,c=ot,c=Ue(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,c===0||n===a&&(_t===2||_t===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&rt(f),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||me(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(f!==null&&rt(f),on(c)){case 2:case 8:c=gi;break;case 32:c=Bt;break;case 268435456:c=ur;break;default:c=Bt}return f=tS.bind(null,n),c=ze(c,f),n.callbackPriority=a,n.callbackNode=c,a}return f!==null&&f!==null&&rt(f),n.callbackPriority=2,n.callbackNode=null,2}function tS(n,a){if(dr!==0&&dr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(dh()&&n.callbackNode!==c)return null;var f=ot;return f=Ue(n,n===Rt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(Bw(n,f,a),eS(n,He()),n.callbackNode!=null&&n.callbackNode===c?tS.bind(null,n):null)}function rS(n,a){if(dh())return null;Bw(n,a,!0)}function uD(){wD(function(){(pt&6)!==0?ze(Ht,cD):Jw()})}function Ag(){if(aa===0){var n=ll;n===0&&(n=ns,ns<<=1,(ns&261888)===0&&(ns=256)),aa=n}return aa}function iS(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:bd(""+n)}function nS(n,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,n.id&&c.setAttribute("form",n.id),a.parentNode.insertBefore(c,a),n=new FormData(n),c.parentNode.removeChild(c),n}function dD(n,a,c,f,_){if(a==="submit"&&c&&c.stateNode===_){var b=iS((_[si]||null).action),A=f.submitter;A&&(a=(a=A[si]||null)?iS(a.formAction):A.getAttribute("formAction"),a!==null&&(b=a,A=null));var P=new Ed("action","action",null,f,_);n.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(aa!==0){var K=A?nS(_,A):new FormData(_);Kp(c,{pending:!0,data:K,method:_.method,action:b},null,K)}}else typeof b=="function"&&(P.preventDefault(),K=A?nS(_,A):new FormData(_),Kp(c,{pending:!0,data:K,method:_.method,action:b},b,K))},currentTarget:_}]})}}for(var Tg=0;Tg<hp.length;Tg++){var Mg=hp[Tg],hD=Mg.toLowerCase(),fD=Mg[0].toUpperCase()+Mg.slice(1);ln(hD,"on"+fD)}ln(Ob,"onAnimationEnd"),ln(Bb,"onAnimationIteration"),ln(Pb,"onAnimationStart"),ln("dblclick","onDoubleClick"),ln("focusin","onFocus"),ln("focusout","onBlur"),ln(A3,"onTransitionRun"),ln(T3,"onTransitionStart"),ln(M3,"onTransitionCancel"),ln(Ib,"onTransitionEnd"),Yo("onMouseEnter",["mouseout","mouseover"]),Yo("onMouseLeave",["mouseout","mouseover"]),Yo("onPointerEnter",["pointerout","pointerover"]),Yo("onPointerLeave",["pointerout","pointerover"]),qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qc="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(" "),mD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qc));function sS(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var f=n[c],_=f.event;f=f.listeners;e:{var b=void 0;if(a)for(var A=f.length-1;0<=A;A--){var P=f[A],K=P.instance,ae=P.currentTarget;if(P=P.listener,K!==b&&_.isPropagationStopped())break e;b=P,_.currentTarget=ae;try{b(_)}catch(de){Nd(de)}_.currentTarget=null,b=K}else for(A=0;A<f.length;A++){if(P=f[A],K=P.instance,ae=P.currentTarget,P=P.listener,K!==b&&_.isPropagationStopped())break e;b=P,_.currentTarget=ae;try{b(_)}catch(de){Nd(de)}_.currentTarget=null,b=K}}}}function st(n,a){var c=a[Wm];c===void 0&&(c=a[Wm]=new Set);var f=n+"__bubble";c.has(f)||(aS(a,n,2,!1),c.add(f))}function jg(n,a,c){var f=0;a&&(f|=4),aS(c,n,f,a)}var mh="_reactListening"+Math.random().toString(36).slice(2);function Dg(n){if(!n[mh]){n[mh]=!0,Jy.forEach(function(c){c!=="selectionchange"&&(mD.has(c)||jg(c,!1,n),jg(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[mh]||(a[mh]=!0,jg("selectionchange",!1,a))}}function aS(n,a,c,f){switch(OS(a)){case 2:var _=HD;break;case 8:_=FD;break;default:_=Yg}c=_.bind(null,a,c,n),_=void 0,!Jm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),f?_!==void 0?n.addEventListener(a,c,{capture:!0,passive:_}):n.addEventListener(a,c,!0):_!==void 0?n.addEventListener(a,c,{passive:_}):n.addEventListener(a,c,!1)}function Lg(n,a,c,f,_){var b=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var A=f.tag;if(A===3||A===4){var P=f.stateNode.containerInfo;if(P===_)break;if(A===4)for(A=f.return;A!==null;){var K=A.tag;if((K===3||K===4)&&A.stateNode.containerInfo===_)return;A=A.return}for(;P!==null;){if(A=qo(P),A===null)return;if(K=A.tag,K===5||K===6||K===26||K===27){f=b=A;continue e}P=P.parentNode}}f=f.return}db(function(){var ae=b,de=Zm(c),pe=[];e:{var le=zb.get(n);if(le!==void 0){var ue=Ed,je=n;switch(n){case"keypress":if(Sd(c)===0)break e;case"keydown":case"keyup":ue=o3;break;case"focusin":je="focus",ue=ip;break;case"focusout":je="blur",ue=ip;break;case"beforeblur":case"afterblur":ue=ip;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=mb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Kj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=u3;break;case Ob:case Bb:case Pb:ue=Qj;break;case Ib:ue=h3;break;case"scroll":case"scrollend":ue=Gj;break;case"wheel":ue=m3;break;case"copy":case"cut":case"paste":ue=e3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=gb;break;case"toggle":case"beforetoggle":ue=g3}var $e=(a&4)!==0,Ct=!$e&&(n==="scroll"||n==="scrollend"),te=$e?le!==null?le+"Capture":null:le;$e=[];for(var Q=ae,se;Q!==null;){var fe=Q;if(se=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||se===null||te===null||(fe=fc(Q,te),fe!=null&&$e.push(Vc(Q,fe,se))),Ct)break;Q=Q.return}0<$e.length&&(le=new ue(le,je,null,c,de),pe.push({event:le,listeners:$e}))}}if((a&7)===0){e:{if(le=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",le&&c!==Xm&&(je=c.relatedTarget||c.fromElement)&&(qo(je)||je[Wo]))break e;if((ue||le)&&(le=de.window===de?de:(le=de.ownerDocument)?le.defaultView||le.parentWindow:window,ue?(je=c.relatedTarget||c.toElement,ue=ae,je=je?qo(je):null,je!==null&&(Ct=o(je),$e=je.tag,je!==Ct||$e!==5&&$e!==27&&$e!==6)&&(je=null)):(ue=null,je=ae),ue!==je)){if($e=mb,fe="onMouseLeave",te="onMouseEnter",Q="mouse",(n==="pointerout"||n==="pointerover")&&($e=gb,fe="onPointerLeave",te="onPointerEnter",Q="pointer"),Ct=ue==null?le:hc(ue),se=je==null?le:hc(je),le=new $e(fe,Q+"leave",ue,c,de),le.target=Ct,le.relatedTarget=se,fe=null,qo(de)===ae&&($e=new $e(te,Q+"enter",je,c,de),$e.target=se,$e.relatedTarget=Ct,fe=$e),Ct=fe,ue&&je)t:{for($e=pD,te=ue,Q=je,se=0,fe=te;fe;fe=$e(fe))se++;fe=0;for(var Pe=Q;Pe;Pe=$e(Pe))fe++;for(;0<se-fe;)te=$e(te),se--;for(;0<fe-se;)Q=$e(Q),fe--;for(;se--;){if(te===Q||Q!==null&&te===Q.alternate){$e=te;break t}te=$e(te),Q=$e(Q)}$e=null}else $e=null;ue!==null&&oS(pe,le,ue,$e,!1),je!==null&&Ct!==null&&oS(pe,Ct,je,$e,!0)}}e:{if(le=ae?hc(ae):window,ue=le.nodeName&&le.nodeName.toLowerCase(),ue==="select"||ue==="input"&&le.type==="file")var ht=Cb;else if(wb(le))if(Eb)ht=R3;else{ht=C3;var De=S3}else ue=le.nodeName,!ue||ue.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&Km(ae.elementType)&&(ht=Cb):ht=E3;if(ht&&(ht=ht(n,ae))){Sb(pe,ht,c,de);break e}De&&De(n,le,ae),n==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&Ym(le,"number",le.value)}switch(De=ae?hc(ae):window,n){case"focusin":(wb(De)||De.contentEditable==="true")&&(el=De,cp=ae,bc=null);break;case"focusout":bc=cp=el=null;break;case"mousedown":up=!0;break;case"contextmenu":case"mouseup":case"dragend":up=!1,Db(pe,c,de);break;case"selectionchange":if(N3)break;case"keydown":case"keyup":Db(pe,c,de)}var Qe;if(sp)e:{switch(n){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else Jo?yb(n,c)&&(lt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(lt="onCompositionStart");lt&&(vb&&c.locale!=="ko"&&(Jo||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Jo&&(Qe=hb()):(Ws=de,ep="value"in Ws?Ws.value:Ws.textContent,Jo=!0)),De=ph(ae,lt),0<De.length&&(lt=new pb(lt,n,null,c,de),pe.push({event:lt,listeners:De}),Qe?lt.data=Qe:(Qe=bb(c),Qe!==null&&(lt.data=Qe)))),(Qe=_3?x3(n,c):y3(n,c))&&(lt=ph(ae,"onBeforeInput"),0<lt.length&&(De=new pb("onBeforeInput","beforeinput",null,c,de),pe.push({event:De,listeners:lt}),De.data=Qe)),dD(pe,n,ae,c,de)}sS(pe,a)})}function Vc(n,a,c){return{instance:n,listener:a,currentTarget:c}}function ph(n,a){for(var c=a+"Capture",f=[];n!==null;){var _=n,b=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||b===null||(_=fc(n,c),_!=null&&f.unshift(Vc(n,_,b)),_=fc(n,a),_!=null&&f.push(Vc(n,_,b))),n.tag===3)return f;n=n.return}return[]}function pD(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function oS(n,a,c,f,_){for(var b=a._reactName,A=[];c!==null&&c!==f;){var P=c,K=P.alternate,ae=P.stateNode;if(P=P.tag,K!==null&&K===f)break;P!==5&&P!==26&&P!==27||ae===null||(K=ae,_?(ae=fc(c,b),ae!=null&&A.unshift(Vc(c,ae,K))):_||(ae=fc(c,b),ae!=null&&A.push(Vc(c,ae,K)))),c=c.return}A.length!==0&&n.push({event:a,listeners:A})}var gD=/\r\n?/g,vD=/\u0000|\uFFFD/g;function lS(n){return(typeof n=="string"?n:""+n).replace(gD,`
49
+ `).replace(vD,"")}function cS(n,a){return a=lS(a),lS(n)===a}function St(n,a,c,f,_,b){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Xo(n,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Xo(n,""+f);break;case"className":xd(n,"class",f);break;case"tabIndex":xd(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":xd(n,c,f);break;case"style":cb(n,f,b);break;case"data":if(a!=="object"){xd(n,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){n.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=bd(""+f),n.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){n.setAttribute(c,"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 b=="function"&&(c==="formAction"?(a!=="input"&&St(n,a,"name",_.name,_,null),St(n,a,"formEncType",_.formEncType,_,null),St(n,a,"formMethod",_.formMethod,_,null),St(n,a,"formTarget",_.formTarget,_,null)):(St(n,a,"encType",_.encType,_,null),St(n,a,"method",_.method,_,null),St(n,a,"target",_.target,_,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=bd(""+f),n.setAttribute(c,f);break;case"onClick":f!=null&&(n.onclick=os);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}c=bd(""+f),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""+f):n.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":f===!0?n.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,f):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(c,f):n.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(c):n.setAttribute(c,f);break;case"popover":st("beforetoggle",n),st("toggle",n),_d(n,"popover",f);break;case"xlinkActuate":as(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":as(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":as(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":as(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":as(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":as(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":as(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":as(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":as(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":_d(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=qj.get(c)||c,_d(n,c,f))}}function Og(n,a,c,f,_,b){switch(c){case"style":cb(n,f,b);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"children":typeof f=="string"?Xo(n,f):(typeof f=="number"||typeof f=="bigint")&&Xo(n,""+f);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"onClick":f!=null&&(n.onclick=os);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!eb.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(_=c.endsWith("Capture"),a=c.slice(2,_?c.length-7:void 0),b=n[si]||null,b=b!=null?b[c]:null,typeof b=="function"&&n.removeEventListener(a,b,_),typeof f=="function")){typeof b!="function"&&b!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(a,f,_);break e}c in n?n[c]=f:f===!0?n.setAttribute(c,""):_d(n,c,f)}}}function Lr(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var f=!1,_=!1,b;for(b in c)if(c.hasOwnProperty(b)){var A=c[b];if(A!=null)switch(b){case"src":f=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:St(n,a,b,A,c,null)}}_&&St(n,a,"srcSet",c.srcSet,c,null),f&&St(n,a,"src",c.src,c,null);return;case"input":st("invalid",n);var P=b=A=_=null,K=null,ae=null;for(f in c)if(c.hasOwnProperty(f)){var de=c[f];if(de!=null)switch(f){case"name":_=de;break;case"type":A=de;break;case"checked":K=de;break;case"defaultChecked":ae=de;break;case"value":b=de;break;case"defaultValue":P=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,a));break;default:St(n,a,f,de,c,null)}}sb(n,b,P,K,ae,A,_,!1);return;case"select":st("invalid",n),f=A=b=null;for(_ in c)if(c.hasOwnProperty(_)&&(P=c[_],P!=null))switch(_){case"value":b=P;break;case"defaultValue":A=P;break;case"multiple":f=P;default:St(n,a,_,P,c,null)}a=b,c=A,n.multiple=!!f,a!=null?Ko(n,!!f,a,!1):c!=null&&Ko(n,!!f,c,!0);return;case"textarea":st("invalid",n),b=_=f=null;for(A in c)if(c.hasOwnProperty(A)&&(P=c[A],P!=null))switch(A){case"value":f=P;break;case"defaultValue":_=P;break;case"children":b=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(91));break;default:St(n,a,A,P,c,null)}ob(n,f,_,b);return;case"option":for(K in c)if(c.hasOwnProperty(K)&&(f=c[K],f!=null))switch(K){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:St(n,a,K,f,c,null)}return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(f=0;f<qc.length;f++)st(qc[f],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(f=c[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:St(n,a,ae,f,c,null)}return;default:if(Km(a)){for(de in c)c.hasOwnProperty(de)&&(f=c[de],f!==void 0&&Og(n,a,de,f,c,void 0));return}}for(P in c)c.hasOwnProperty(P)&&(f=c[P],f!=null&&St(n,a,P,f,c,null))}function _D(n,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,b=null,A=null,P=null,K=null,ae=null,de=null;for(ue in c){var pe=c[ue];if(c.hasOwnProperty(ue)&&pe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=pe;default:f.hasOwnProperty(ue)||St(n,a,ue,null,f,pe)}}for(var le in f){var ue=f[le];if(pe=c[le],f.hasOwnProperty(le)&&(ue!=null||pe!=null))switch(le){case"type":b=ue;break;case"name":_=ue;break;case"checked":ae=ue;break;case"defaultChecked":de=ue;break;case"value":A=ue;break;case"defaultValue":P=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:ue!==pe&&St(n,a,le,ue,f,pe)}}Gm(n,A,P,K,ae,de,b,_);return;case"select":ue=A=P=le=null;for(b in c)if(K=c[b],c.hasOwnProperty(b)&&K!=null)switch(b){case"value":break;case"multiple":ue=K;default:f.hasOwnProperty(b)||St(n,a,b,null,f,K)}for(_ in f)if(b=f[_],K=c[_],f.hasOwnProperty(_)&&(b!=null||K!=null))switch(_){case"value":le=b;break;case"defaultValue":P=b;break;case"multiple":A=b;default:b!==K&&St(n,a,_,b,f,K)}a=P,c=A,f=ue,le!=null?Ko(n,!!c,le,!1):!!f!=!!c&&(a!=null?Ko(n,!!c,a,!0):Ko(n,!!c,c?[]:"",!1));return;case"textarea":ue=le=null;for(P in c)if(_=c[P],c.hasOwnProperty(P)&&_!=null&&!f.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:St(n,a,P,null,f,_)}for(A in f)if(_=f[A],b=c[A],f.hasOwnProperty(A)&&(_!=null||b!=null))switch(A){case"value":le=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:_!==b&&St(n,a,A,_,f,b)}ab(n,le,ue);return;case"option":for(var je in c)if(le=c[je],c.hasOwnProperty(je)&&le!=null&&!f.hasOwnProperty(je))switch(je){case"selected":n.selected=!1;break;default:St(n,a,je,null,f,le)}for(K in f)if(le=f[K],ue=c[K],f.hasOwnProperty(K)&&le!==ue&&(le!=null||ue!=null))switch(K){case"selected":n.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:St(n,a,K,le,f,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 $e in c)le=c[$e],c.hasOwnProperty($e)&&le!=null&&!f.hasOwnProperty($e)&&St(n,a,$e,null,f,le);for(ae in f)if(le=f[ae],ue=c[ae],f.hasOwnProperty(ae)&&le!==ue&&(le!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,a));break;default:St(n,a,ae,le,f,ue)}return;default:if(Km(a)){for(var Ct in c)le=c[Ct],c.hasOwnProperty(Ct)&&le!==void 0&&!f.hasOwnProperty(Ct)&&Og(n,a,Ct,void 0,f,le);for(de in f)le=f[de],ue=c[de],!f.hasOwnProperty(de)||le===ue||le===void 0&&ue===void 0||Og(n,a,de,le,f,ue);return}}for(var te in c)le=c[te],c.hasOwnProperty(te)&&le!=null&&!f.hasOwnProperty(te)&&St(n,a,te,null,f,le);for(pe in f)le=f[pe],ue=c[pe],!f.hasOwnProperty(pe)||le===ue||le==null&&ue==null||St(n,a,pe,le,f,ue)}function uS(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xD(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var _=c[f],b=_.transferSize,A=_.initiatorType,P=_.duration;if(b&&P&&uS(A)){for(A=0,P=_.responseEnd,f+=1;f<c.length;f++){var K=c[f],ae=K.startTime;if(ae>P)break;var de=K.transferSize,pe=K.initiatorType;de&&uS(pe)&&(K=K.responseEnd,A+=de*(K<P?1:(P-ae)/(K-ae)))}if(--f,a+=8*(b+A)/(_.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Bg=null,Pg=null;function gh(n){return n.nodeType===9?n:n.ownerDocument}function dS(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hS(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Ig(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var zg=null;function yD(){var n=window.event;return n&&n.type==="popstate"?n===zg?!1:(zg=n,!0):(zg=null,!1)}var fS=typeof setTimeout=="function"?setTimeout:void 0,bD=typeof clearTimeout=="function"?clearTimeout:void 0,mS=typeof Promise=="function"?Promise:void 0,wD=typeof queueMicrotask=="function"?queueMicrotask:typeof mS<"u"?function(n){return mS.resolve(null).then(n).catch(SD)}:fS;function SD(n){setTimeout(function(){throw n})}function oa(n){return n==="head"}function pS(n,a){var c=a,f=0;do{var _=c.nextSibling;if(n.removeChild(c),_&&_.nodeType===8)if(c=_.data,c==="/$"||c==="/&"){if(f===0){n.removeChild(_),kl(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Gc(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Gc(c);for(var b=c.firstChild;b;){var A=b.nextSibling,P=b.nodeName;b[dc]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&b.rel.toLowerCase()==="stylesheet"||c.removeChild(b),b=A}}else c==="body"&&Gc(n.ownerDocument.body);c=_}while(c);kl(a)}function gS(n,a){var c=n;n=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=f}while(c)}function $g(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":$g(c),qm(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function CD(n,a,c,f){for(;n.nodeType===1;){var _=c;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[dc])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(b=n.getAttribute("rel"),b==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(b!==_.rel||n.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||n.getAttribute("title")!==(_.title==null?null:_.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(b=n.getAttribute("src"),(b!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&b&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var b=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===b)return n}else return n;if(n=$i(n.nextSibling),n===null)break}return null}function ED(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=$i(n.nextSibling),n===null))return null;return n}function vS(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=$i(n.nextSibling),n===null))return null;return n}function Ug(n){return n.data==="$?"||n.data==="$~"}function Hg(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function RD(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function $i(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Fg=null;function _S(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return $i(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function xS(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return n;a--}else c!=="/$"&&c!=="/&"||a++}n=n.previousSibling}return null}function yS(n,a,c){switch(a=gh(c),n){case"html":if(n=a.documentElement,!n)throw Error(i(452));return n;case"head":if(n=a.head,!n)throw Error(i(453));return n;case"body":if(n=a.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function Gc(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);qm(n)}var Ui=new Map,bS=new Set;function vh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ss=U.d;U.d={f:kD,r:ND,D:AD,C:TD,L:MD,m:jD,X:LD,S:DD,M:OD};function kD(){var n=Ss.f(),a=lh();return n||a}function ND(n){var a=Vo(n);a!==null&&a.tag===5&&a.type==="form"?I1(a):Ss.r(n)}var Cl=typeof document>"u"?null:document;function wS(n,a,c){var f=Cl;if(f&&typeof a=="string"&&a){var _=Di(a);_='link[rel="'+n+'"][href="'+_+'"]',typeof c=="string"&&(_+='[crossorigin="'+c+'"]'),bS.has(_)||(bS.add(_),n={rel:n,crossOrigin:c,href:a},f.querySelector(_)===null&&(a=f.createElement("link"),Lr(a,"link",n),_r(a),f.head.appendChild(a)))}}function AD(n){Ss.D(n),wS("dns-prefetch",n,null)}function TD(n,a){Ss.C(n,a),wS("preconnect",n,a)}function MD(n,a,c){Ss.L(n,a,c);var f=Cl;if(f&&n&&a){var _='link[rel="preload"][as="'+Di(a)+'"]';a==="image"&&c&&c.imageSrcSet?(_+='[imagesrcset="'+Di(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(_+='[imagesizes="'+Di(c.imageSizes)+'"]')):_+='[href="'+Di(n)+'"]';var b=_;switch(a){case"style":b=El(n);break;case"script":b=Rl(n)}Ui.has(b)||(n=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),Ui.set(b,n),f.querySelector(_)!==null||a==="style"&&f.querySelector(Yc(b))||a==="script"&&f.querySelector(Kc(b))||(a=f.createElement("link"),Lr(a,"link",n),_r(a),f.head.appendChild(a)))}}function jD(n,a){Ss.m(n,a);var c=Cl;if(c&&n){var f=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+Di(f)+'"][href="'+Di(n)+'"]',b=_;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Rl(n)}if(!Ui.has(b)&&(n=p({rel:"modulepreload",href:n},a),Ui.set(b,n),c.querySelector(_)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Kc(b)))return}f=c.createElement("link"),Lr(f,"link",n),_r(f),c.head.appendChild(f)}}}function DD(n,a,c){Ss.S(n,a,c);var f=Cl;if(f&&n){var _=Go(f).hoistableStyles,b=El(n);a=a||"default";var A=_.get(b);if(!A){var P={loading:0,preload:null};if(A=f.querySelector(Yc(b)))P.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":a},c),(c=Ui.get(b))&&Wg(n,c);var K=A=f.createElement("link");_r(K),Lr(K,"link",n),K._p=new Promise(function(ae,de){K.onload=ae,K.onerror=de}),K.addEventListener("load",function(){P.loading|=1}),K.addEventListener("error",function(){P.loading|=2}),P.loading|=4,_h(A,a,f)}A={type:"stylesheet",instance:A,count:1,state:P},_.set(b,A)}}}function LD(n,a){Ss.X(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),b=f.get(_);b||(b=c.querySelector(Kc(_)),b||(n=p({src:n,async:!0},a),(a=Ui.get(_))&&qg(n,a),b=c.createElement("script"),_r(b),Lr(b,"link",n),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(_,b))}}function OD(n,a){Ss.M(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),b=f.get(_);b||(b=c.querySelector(Kc(_)),b||(n=p({src:n,async:!0,type:"module"},a),(a=Ui.get(_))&&qg(n,a),b=c.createElement("script"),_r(b),Lr(b,"link",n),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(_,b))}}function SS(n,a,c,f){var _=(_=oe.current)?vh(_):null;if(!_)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=El(c.href),c=Go(_).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=El(c.href);var b=Go(_).hoistableStyles,A=b.get(n);if(A||(_=_.ownerDocument||_,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(n,A),(b=_.querySelector(Yc(n)))&&!b._p&&(A.instance=b,A.state.loading=5),Ui.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ui.set(n,c),b||BD(_,n,c,A.state))),a&&f===null)throw Error(i(528,""));return A}if(a&&f!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Rl(c),c=Go(_).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function El(n){return'href="'+Di(n)+'"'}function Yc(n){return'link[rel="stylesheet"]['+n+"]"}function CS(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function BD(n,a,c,f){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=n.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Lr(a,"link",c),_r(a),n.head.appendChild(a))}function Rl(n){return'[src="'+Di(n)+'"]'}function Kc(n){return"script[async]"+n}function ES(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=n.querySelector('style[data-href~="'+Di(c.href)+'"]');if(f)return a.instance=f,_r(f),f;var _=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),_r(f),Lr(f,"style",_),_h(f,c.precedence,n),a.instance=f;case"stylesheet":_=El(c.href);var b=n.querySelector(Yc(_));if(b)return a.state.loading|=4,a.instance=b,_r(b),b;f=CS(c),(_=Ui.get(_))&&Wg(f,_),b=(n.ownerDocument||n).createElement("link"),_r(b);var A=b;return A._p=new Promise(function(P,K){A.onload=P,A.onerror=K}),Lr(b,"link",f),a.state.loading|=4,_h(b,c.precedence,n),a.instance=b;case"script":return b=Rl(c.src),(_=n.querySelector(Kc(b)))?(a.instance=_,_r(_),_):(f=c,(_=Ui.get(b))&&(f=p({},c),qg(f,_)),n=n.ownerDocument||n,_=n.createElement("script"),_r(_),Lr(_,"link",f),n.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,_h(f,c.precedence,n));return a.instance}function _h(n,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=f.length?f[f.length-1]:null,b=_,A=0;A<f.length;A++){var P=f[A];if(P.dataset.precedence===a)b=P;else if(b!==_)break}b?b.parentNode.insertBefore(n,b.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(n,a.firstChild))}function Wg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function qg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var xh=null;function RS(n,a,c){if(xh===null){var f=new Map,_=xh=new Map;_.set(c,f)}else _=xh,f=_.get(c),f||(f=new Map,_.set(c,f));if(f.has(n))return f;for(f.set(n,null),c=c.getElementsByTagName(n),_=0;_<c.length;_++){var b=c[_];if(!(b[dc]||b[Tr]||n==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var A=b.getAttribute(a)||"";A=n+A;var P=f.get(A);P?P.push(b):f.set(A,[b])}}return f}function kS(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function PD(n,a,c){if(c===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function NS(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function ID(n,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var _=El(f.href),b=a.querySelector(Yc(_));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=yh.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=b,_r(b);return}b=a.ownerDocument||a,f=CS(f),(_=Ui.get(_))&&Wg(f,_),b=b.createElement("link"),_r(b);var A=b;A._p=new Promise(function(P,K){A.onload=P,A.onerror=K}),Lr(b,"link",f),c.instance=b}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=yh.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var Vg=0;function zD(n,a){return n.stylesheets&&n.count===0&&wh(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var f=setTimeout(function(){if(n.stylesheets&&wh(n,n.stylesheets),n.unsuspend){var b=n.unsuspend;n.unsuspend=null,b()}},6e4+a);0<n.imgBytes&&Vg===0&&(Vg=62500*xD());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&wh(n,n.stylesheets),n.unsuspend)){var b=n.unsuspend;n.unsuspend=null,b()}},(n.imgBytes>Vg?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(_)}}:null}function yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var bh=null;function wh(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,bh=new Map,a.forEach($D,n),bh=null,yh.call(n))}function $D(n,a){if(!(a.state.loading&4)){var c=bh.get(n);if(c)var f=c.get(null);else{c=new Map,bh.set(n,c);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<_.length;b++){var A=_[b];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(c.set(A.dataset.precedence,A),f=A)}f&&c.set(null,f)}_=a.instance,A=_.getAttribute("data-precedence"),b=c.get(A)||f,b===f&&c.set(null,_),c.set(A,_),this.count++,f=yh.bind(this),_.addEventListener("load",f),_.addEventListener("error",f),b?b.parentNode.insertBefore(_,b.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),a.state.loading|=4}}var Xc={$$typeof:k,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function UD(n,a,c,f,_,b,A,P,K){this.tag=1,this.containerInfo=n,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=bt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bt(0),this.hiddenUpdates=bt(null),this.identifierPrefix=f,this.onUncaughtError=_,this.onCaughtError=b,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function AS(n,a,c,f,_,b,A,P,K,ae,de,pe){return n=new UD(n,a,c,A,K,ae,de,pe,P),a=1,b===!0&&(a|=24),b=bi(3,null,null,a),n.current=b,b.stateNode=n,a=Ep(),a.refCount++,n.pooledCache=a,a.refCount++,b.memoizedState={element:f,isDehydrated:c,cache:a},Ap(b),n}function TS(n){return n?(n=il,n):il}function MS(n,a,c,f,_,b){_=TS(_),f.context===null?f.context=_:f.pendingContext=_,f=Xs(a),f.payload={element:c},b=b===void 0?null:b,b!==null&&(f.callback=b),c=Zs(n,f,a),c!==null&&(di(c,n,a),Nc(c,n,a))}function jS(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function Gg(n,a){jS(n,a),(n=n.alternate)&&jS(n,a)}function DS(n){if(n.tag===13||n.tag===31){var a=Ka(n,67108864);a!==null&&di(a,n,67108864),Gg(n,67108864)}}function LS(n){if(n.tag===13||n.tag===31){var a=Ri();a=Fo(a);var c=Ka(n,a);c!==null&&di(c,n,a),Gg(n,a)}}var Sh=!0;function HD(n,a,c,f){var _=T.T;T.T=null;var b=U.p;try{U.p=2,Yg(n,a,c,f)}finally{U.p=b,T.T=_}}function FD(n,a,c,f){var _=T.T;T.T=null;var b=U.p;try{U.p=8,Yg(n,a,c,f)}finally{U.p=b,T.T=_}}function Yg(n,a,c,f){if(Sh){var _=Kg(f);if(_===null)Lg(n,a,f,Ch,c),BS(n,f);else if(qD(_,n,a,c,f))f.stopPropagation();else if(BS(n,f),a&4&&-1<WD.indexOf(n)){for(;_!==null;){var b=Vo(_);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var A=xi(b.pendingLanes);if(A!==0){var P=b;for(P.pendingLanes|=2,P.entangledLanes|=2;A;){var K=1<<31-vr(A);P.entanglements[1]|=K,A&=~K}Ln(b),(pt&6)===0&&(ah=He()+500,Wc(0))}}break;case 31:case 13:P=Ka(b,2),P!==null&&di(P,b,2),lh(),Gg(b,2)}if(b=Kg(f),b===null&&Lg(n,a,f,Ch,c),b===_)break;_=b}_!==null&&f.stopPropagation()}else Lg(n,a,f,null,c)}}function Kg(n){return n=Zm(n),Xg(n)}var Ch=null;function Xg(n){if(Ch=null,n=qo(n),n!==null){var a=o(n);if(a===null)n=null;else{var c=a.tag;if(c===13){if(n=u(a),n!==null)return n;n=null}else if(c===31){if(n=d(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Ch=n,null}function OS(n){switch(n){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(Ot()){case Ht:return 2;case gi:return 8;case Bt:case vt:return 32;case ur:return 268435456;default:return 32}default:return 32}}var Zg=!1,la=null,ca=null,ua=null,Zc=new Map,Qc=new Map,da=[],WD="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 BS(n,a){switch(n){case"focusin":case"focusout":la=null;break;case"dragenter":case"dragleave":ca=null;break;case"mouseover":case"mouseout":ua=null;break;case"pointerover":case"pointerout":Zc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qc.delete(a.pointerId)}}function Jc(n,a,c,f,_,b){return n===null||n.nativeEvent!==b?(n={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:b,targetContainers:[_]},a!==null&&(a=Vo(a),a!==null&&DS(a)),n):(n.eventSystemFlags|=f,a=n.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),n)}function qD(n,a,c,f,_){switch(a){case"focusin":return la=Jc(la,n,a,c,f,_),!0;case"dragenter":return ca=Jc(ca,n,a,c,f,_),!0;case"mouseover":return ua=Jc(ua,n,a,c,f,_),!0;case"pointerover":var b=_.pointerId;return Zc.set(b,Jc(Zc.get(b)||null,n,a,c,f,_)),!0;case"gotpointercapture":return b=_.pointerId,Qc.set(b,Jc(Qc.get(b)||null,n,a,c,f,_)),!0}return!1}function PS(n){var a=qo(n.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){n.blockedOn=a,Zy(n.priority,function(){LS(c)});return}}else if(a===31){if(a=d(c),a!==null){n.blockedOn=a,Zy(n.priority,function(){LS(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Eh(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=Kg(n.nativeEvent);if(c===null){c=n.nativeEvent;var f=new c.constructor(c.type,c);Xm=f,c.target.dispatchEvent(f),Xm=null}else return a=Vo(c),a!==null&&DS(a),n.blockedOn=c,!1;a.shift()}return!0}function IS(n,a,c){Eh(n)&&c.delete(a)}function VD(){Zg=!1,la!==null&&Eh(la)&&(la=null),ca!==null&&Eh(ca)&&(ca=null),ua!==null&&Eh(ua)&&(ua=null),Zc.forEach(IS),Qc.forEach(IS)}function Rh(n,a){n.blockedOn===a&&(n.blockedOn=null,Zg||(Zg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,VD)))}var kh=null;function zS(n){kh!==n&&(kh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kh===n&&(kh=null);for(var a=0;a<n.length;a+=3){var c=n[a],f=n[a+1],_=n[a+2];if(typeof f!="function"){if(Xg(f||c)===null)continue;break}var b=Vo(c);b!==null&&(n.splice(a,3),a-=3,Kp(b,{pending:!0,data:_,method:c.method,action:f},f,_))}}))}function kl(n){function a(K){return Rh(K,n)}la!==null&&Rh(la,n),ca!==null&&Rh(ca,n),ua!==null&&Rh(ua,n),Zc.forEach(a),Qc.forEach(a);for(var c=0;c<da.length;c++){var f=da[c];f.blockedOn===n&&(f.blockedOn=null)}for(;0<da.length&&(c=da[0],c.blockedOn===null);)PS(c),c.blockedOn===null&&da.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var _=c[f],b=c[f+1],A=_[si]||null;if(typeof b=="function")A||zS(c);else if(A){var P=null;if(b&&b.hasAttribute("formAction")){if(_=b,A=b[si]||null)P=A.formAction;else if(Xg(_)!==null)continue}else P=A.action;typeof P=="function"?c[f+1]=P:(c.splice(f,3),f-=3),zS(c)}}}function $S(){function n(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(A){return _=A})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,_=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function Qg(n){this._internalRoot=n}Nh.prototype.render=Qg.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,f=Ri();MS(c,f,n,a,null,null)},Nh.prototype.unmount=Qg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;MS(n.current,2,null,n,null,null),lh(),a[Wo]=null}};function Nh(n){this._internalRoot=n}Nh.prototype.unstable_scheduleHydration=function(n){if(n){var a=Fm();n={blockedOn:null,target:n,priority:a};for(var c=0;c<da.length&&a!==0&&a<da[c].priority;c++);da.splice(c,0,n),c===0&&PS(n)}};var US=t.version;if(US!=="19.2.7")throw Error(i(527,US,"19.2.7"));U.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=h(a),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var GD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ah=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ah.isDisabled&&Ah.supportsFiber)try{is=Ah.inject(GD),Ar=Ah}catch{}}return tu.createRoot=function(n,a){if(!s(n))throw Error(i(299));var c=!1,f="",_=Y1,b=K1,A=X1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=AS(n,1,!1,null,null,c,f,null,_,b,A,$S),n[Wo]=a.current,Dg(n),new Qg(a)},tu.hydrateRoot=function(n,a,c){if(!s(n))throw Error(i(299));var f=!1,_="",b=Y1,A=K1,P=X1,K=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onUncaughtError!==void 0&&(b=c.onUncaughtError),c.onCaughtError!==void 0&&(A=c.onCaughtError),c.onRecoverableError!==void 0&&(P=c.onRecoverableError),c.formState!==void 0&&(K=c.formState)),a=AS(n,1,!0,a,c??null,f,_,K,b,A,P,$S),a.context=TS(null),c=a.current,f=Ri(),f=Fo(f),_=Xs(f),_.callback=null,Zs(c,_,f),c=f,a.current.lanes=c,Ze(a,c),Ln(a),n[Wo]=a.current,Dg(n),new Nh(a)},tu.version="19.2.7",tu}var ZS;function sL(){if(ZS)return tv.exports;ZS=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(t){console.error(t)}}return e(),tv.exports=nL(),tv.exports}var aL=sL();/**
50
+ * react-router v7.18.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var _x=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,nR=/^[\\/]{2}/;function oL(e,t){return t+e.replace(/\\/g,"/")}var QS="popstate";function JS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function lL(e={}){function t(i,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:m}=o||i.location;return P_("",{pathname:u,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,s){return typeof s=="string"?s:Bu(s)}return uL(t,r,null,e)}function cr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function cL(){return Math.random().toString(36).substring(2,10)}function eC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function P_(e,t,r=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Qu(t):t,state:r,key:t&&t.key||i||cL(),mask:s}}function Bu({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Qu(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function uL(e,t,r,i={}){let{window:s=document.defaultView,v5Compat:o=!1}=i,u=s.history,d="POP",m=null,h=v();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function v(){return(u.state||{idx:null}).idx}function p(){d="POP";let E=v(),S=E==null?null:E-h;h=E,m&&m({action:d,location:C.location,delta:S})}function x(E,S){d="PUSH";let N=JS(E)?E:P_(C.location,E,S);h=v()+1;let k=eC(N,h),R=C.createHref(N.mask||N);try{u.pushState(k,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;s.location.assign(R)}o&&m&&m({action:d,location:C.location,delta:1})}function y(E,S){d="REPLACE";let N=JS(E)?E:P_(C.location,E,S);h=v();let k=eC(N,h),R=C.createHref(N.mask||N);u.replaceState(k,"",R),o&&m&&m({action:d,location:C.location,delta:0})}function w(E){return dL(s,E)}let C={get action(){return d},get location(){return e(s,u)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(QS,p),m=E,()=>{s.removeEventListener(QS,p),m=null}},createHref(E){return t(s,E)},createURL:w,encodeLocation(E){let S=w(E);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:y,go(E){return u.go(E)}};return C}function dL(e,t,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),cr(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Bu(t);return s=s.replace(/ $/,"%20"),!r&&nR.test(s)&&(s=i+s),new URL(s,i)}function sR(e,t,r="/"){return hL(e,t,r,!1)}function hL(e,t,r,i,s){let o=typeof t=="string"?Qu(t):t,u=Ds(o.pathname||"/",r);if(u==null)return null;let d=fL(e),m=null,h=CL(u);for(let v=0;m==null&&v<d.length;++v)m=SL(d[v],h,i);return m}function fL(e){let t=aR(e);return mL(t),t}function aR(e,t=[],r=[],i="",s=!1){let o=(u,d,m=s,h)=>{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(i)&&m)return;cr(v.relativePath.startsWith(i),`Absolute route path "${v.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(i.length)}let p=gn([i,v.relativePath]),x=r.concat(v);u.children&&u.children.length>0&&(cr(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),aR(u.children,t,x,p,m)),!(u.path==null&&!u.index)&&t.push({path:p,score:bL(p,u.index),routesMeta:x.map((y,w)=>{let[C,E]=cR(y.relativePath,y.caseSensitive,w===x.length-1);return{...y,matcher:C,compiledParams:E}})})};return e.forEach((u,d)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))o(u,d);else for(let h of oR(u.path))o(u,d,!0,h)}),t}function oR(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(i.length===0)return s?[o,""]:[o];let u=oR(i.join("/")),d=[];return d.push(...u.map(m=>m===""?o:[o,m].join("/"))),s&&d.push(...u),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function mL(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:wL(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var pL=/^:[\w-]+$/,gL=3,vL=2,_L=1,xL=10,yL=-2,tC=e=>e==="*";function bL(e,t){let r=e.split("/"),i=r.length;return r.some(tC)&&(i+=yL),t&&(i+=vL),r.filter(s=>!tC(s)).reduce((s,o)=>s+(pL.test(o)?gL:o===""?_L:xL),i)}function wL(e,t){return e.length===t.length&&e.slice(0,-1).every((i,s)=>i===t[s])?e[e.length-1]-t[t.length-1]:0}function SL(e,t,r=!1){let{routesMeta:i}=e,s={},o="/",u=[];for(let d=0;d<i.length;++d){let m=i[d],h=d===i.length-1,v=o==="/"?t:t.slice(o.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},x=m.matcher&&m.compiledParams?lR(p,v,m.matcher,m.compiledParams):Cf(p,v),y=m.route;if(!x&&h&&r&&!i[i.length-1].route.index&&(x=Cf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(s,x.params),u.push({params:s,pathname:gn([o,x.pathname]),pathnameBase:kL(gn([o,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(o=gn([o,x.pathnameBase]))}return u}function Cf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=cR(e.path,e.caseSensitive,e.end);return lR(e,t,r,i)}function lR(e,t,r,i){let s=t.match(r);if(!s)return null;let o=s[0],u=o.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:i.reduce((h,{paramName:v,isOptional:p},x)=>{if(v==="*"){let w=d[x]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const y=d[x];return p&&!y?h[v]=void 0:h[v]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:u,pattern:e}}function cR(e,t=!1,r=!0){Zi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,h,v)=>{if(i.push({paramName:d,isOptional:m!=null}),m){let p=v.charAt(h+u.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),i]}function CL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ds(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function EL(e,t="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?Qu(e):e,o;return r?(r=uR(r),r.startsWith("/")?o=rC(r.substring(1),"/"):o=rC(r,t)):o=t,{pathname:o,search:NL(i),hash:AL(s)}}function rC(e,t){let r=Ef(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function sv(e,t,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function RL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function xx(e){let t=RL(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function Zf(e,t,r,i=!1){let s;typeof e=="string"?s=Qu(e):(s={...e},cr(!s.pathname||!s.pathname.includes("?"),sv("?","pathname","search",s)),cr(!s.pathname||!s.pathname.includes("#"),sv("#","pathname","hash",s)),cr(!s.search||!s.search.includes("#"),sv("#","search","hash",s)));let o=e===""||s.pathname==="",u=o?"/":s.pathname,d;if(u==null)d=r;else{let p=t.length-1;if(!i&&u.startsWith("..")){let x=u.split("/");for(;x[0]==="..";)x.shift(),p-=1;s.pathname=x.join("/")}d=p>=0?t[p]:"/"}let m=EL(s,d),h=u&&u!=="/"&&u.endsWith("/"),v=(o||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||v)&&(m.pathname+="/"),m}var uR=e=>e.replace(/[\\/]{2,}/g,"/"),gn=e=>uR(e.join("/")),Ef=e=>e.replace(/\/+$/,""),kL=e=>Ef(e).replace(/^\/*/,"/"),NL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,AL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,TL=class{constructor(e,t,r,i=!1){this.status=e,this.statusText=t||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function ML(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jL(e){let t=e.map(r=>r.route.path).filter(Boolean);return gn(t)||"/"}var dR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hR(e,t){let r=e;if(typeof r!="string"||!_x.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(dR)try{let o=new URL(window.location.href),u=nR.test(r)?new URL(oL(r,o.protocol)):new URL(r),d=Ds(u.pathname,t);u.origin===o.origin&&d!=null?r=d+u.search+u.hash:s=!0}catch{Zi(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fR=["POST","PUT","PATCH","DELETE"];new Set(fR);var DL=["GET",...fR];new Set(DL);var LL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function OL(e){try{return LL.includes(new URL(e).protocol)}catch{return!1}}var Jl=g.createContext(null);Jl.displayName="DataRouter";var Qf=g.createContext(null);Qf.displayName="DataRouterState";var mR=g.createContext(!1);function BL(){return g.useContext(mR)}var pR=g.createContext({isTransitioning:!1});pR.displayName="ViewTransition";var PL=g.createContext(new Map);PL.displayName="Fetchers";var IL=g.createContext(null);IL.displayName="Await";var Mi=g.createContext(null);Mi.displayName="Navigation";var Jf=g.createContext(null);Jf.displayName="Location";var wn=g.createContext({outlet:null,matches:[],isDataRoute:!1});wn.displayName="Route";var yx=g.createContext(null);yx.displayName="RouteError";var gR="REACT_ROUTER_ERROR",zL="REDIRECT",$L="ROUTE_ERROR_RESPONSE";function UL(e){if(e.startsWith(`${gR}:${zL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function HL(e){if(e.startsWith(`${gR}:${$L}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new TL(t.status,t.statusText,t.data)}catch{}}function FL(e,{relative:t}={}){cr(ec(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=g.useContext(Mi),{hash:s,pathname:o,search:u}=Ju(e,{relative:t}),d=o;return r!=="/"&&(d=o==="/"?r:gn([r,o])),i.createHref({pathname:d,search:u,hash:s})}function ec(){return g.useContext(Jf)!=null}function Hr(){return cr(ec(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Jf).location}var vR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _R(e){g.useContext(Mi).static||g.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=g.useContext(wn);return e?r4():WL()}function WL(){cr(ec(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Jl),{basename:t,navigator:r}=g.useContext(Mi),{matches:i}=g.useContext(wn),{pathname:s}=Hr(),o=JSON.stringify(xx(i)),u=g.useRef(!1);return _R(()=>{u.current=!0}),g.useCallback((m,h={})=>{if(Zi(u.current,vR),!u.current)return;if(typeof m=="number"){r.go(m);return}let v=Zf(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:gn([t,v.pathname])),(h.replace?r.replace:r.push)(v,h.state,h)},[t,r,o,s,e])}g.createContext(null);function xR(){let{matches:e}=g.useContext(wn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Ju(e,{relative:t}={}){let{matches:r}=g.useContext(wn),{pathname:i}=Hr(),s=JSON.stringify(xx(r));return g.useMemo(()=>Zf(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function qL(e,t){return yR(e)}function yR(e,t,r){cr(ec(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Mi),{matches:s}=g.useContext(wn),o=s[s.length-1],u=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let E=h&&h.path||"";wR(d,!h||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let v=Hr(),p;p=v;let x=p.pathname||"/",y=x;if(m!=="/"){let E=m.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(E=>Object.assign(E,{route:r.manifest[E.route.id]||E.route})):sR(e,{pathname:y});return Zi(h||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Zi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),XL(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:gn([m,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:gn([m,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,r)}function VL(){let e=t4(),t=ML(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:s},r):null,u)}var GL=g.createElement(VL,null),bR=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=HL(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(wn.Provider,{value:this.props.routeContext},g.createElement(yx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(YL,{error:e},t):t}};bR.contextType=mR;var av=new WeakMap;function YL({children:e,error:t}){let{basename:r}=g.useContext(Mi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=UL(t.digest);if(i){let s=av.get(t);if(s)throw s;let o=hR(i.location,r),u=o.absoluteURL||o.to;if(OL(u))throw new Error("Invalid redirect location");if(dR&&!av.get(t))if(o.isExternal||i.reloadDocument)window.location.href=u;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw av.set(t,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function KL({routeContext:e,match:t,children:r}){let i=g.useContext(Jl);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(wn.Provider,{value:e},r)}function XL(e,t=[],r){let i=r==null?void 0:r.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,o=i==null?void 0:i.errors;if(o!=null){let v=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);cr(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,v+1))}let u=!1,d=-1;if(r&&i){u=i.renderFallback;for(let v=0;v<s.length;v++){let p=s[v];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=v),p.route.id){let{loaderData:x,errors:y}=i,w=p.route.loader&&!x.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,h=i&&m?(v,p)=>{var x,y;m(v,{location:i.location,params:((y=(x=i.matches)==null?void 0:x[0])==null?void 0:y.params)??{},pattern:jL(i.matches),errorInfo:p})}:void 0;return s.reduceRight((v,p,x)=>{let y,w=!1,C=null,E=null;i&&(y=o&&p.route.id?o[p.route.id]:void 0,C=p.route.errorElement||GL,u&&(d<0&&x===0?(wR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===x&&(w=!0,E=p.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,x+1)),N=()=>{let k;return y?k=C:w?k=E:p.route.Component?k=g.createElement(p.route.Component,null):p.route.element?k=p.route.element:k=v,g.createElement(KL,{match:p,routeContext:{outlet:v,matches:S,isDataRoute:i!=null},children:k})};return i&&(p.route.ErrorBoundary||p.route.errorElement||x===0)?g.createElement(bR,{location:i.location,revalidation:i.revalidation,component:C,error:y,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):N()},null)}function bx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZL(e){let t=g.useContext(Jl);return cr(t,bx(e)),t}function QL(e){let t=g.useContext(Qf);return cr(t,bx(e)),t}function JL(e){let t=g.useContext(wn);return cr(t,bx(e)),t}function wx(e){let t=JL(e),r=t.matches[t.matches.length-1];return cr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function e4(){return wx("useRouteId")}function t4(){var i;let e=g.useContext(yx),t=QL("useRouteError"),r=wx("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function r4(){let{router:e}=ZL("useNavigate"),t=wx("useNavigate"),r=g.useRef(!1);return _R(()=>{r.current=!0}),g.useCallback(async(s,o={})=>{Zi(r.current,vR),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var iC={};function wR(e,t,r){!t&&!iC[e]&&(iC[e]=!0,Zi(!1,r))}g.memo(i4);function i4({routes:e,manifest:t,future:r,state:i,isStatic:s,onError:o}){return yR(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function go({to:e,replace:t,state:r,relative:i}){cr(ec(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=g.useContext(Mi);Zi(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=g.useContext(wn),{pathname:u}=Hr(),d=Oa(),m=Zf(e,xx(o),u,i==="path"),h=JSON.stringify(m);return g.useEffect(()=>{d(JSON.parse(h),{replace:t,state:r,relative:i})},[d,h,i,t,r]),null}function n4({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:u}){cr(!ec(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=g.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:u,future:{}}),[d,s,o,u]);typeof r=="string"&&(r=Qu(r));let{pathname:h="/",search:v="",hash:p="",state:x=null,key:y="default",mask:w}=r,C=g.useMemo(()=>{let E=Ds(h,d);return E==null?null:{location:{pathname:E,search:v,hash:p,state:x,key:y,mask:w},navigationType:i}},[d,h,v,p,x,y,i,w]);return Zi(C!=null,`<Router basename="${d}"> is not able to match the URL "${h}${v}${p}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:g.createElement(Mi.Provider,{value:m},g.createElement(Jf.Provider,{children:t,value:C}))}var sf="get",af="application/x-www-form-urlencoded";function em(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function s4(e){return em(e)&&e.tagName.toLowerCase()==="button"}function a4(e){return em(e)&&e.tagName.toLowerCase()==="form"}function o4(e){return em(e)&&e.tagName.toLowerCase()==="input"}function l4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function c4(e,t){return e.button===0&&(!t||t==="_self")&&!l4(e)}function I_(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(s=>[r,s]):[[r,i]])},[]))}function u4(e,t){let r=I_(e);return t&&t.forEach((i,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}var Th=null;function d4(){if(Th===null)try{new FormData(document.createElement("form"),0),Th=!1}catch{Th=!0}return Th}var h4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ov(e){return e!=null&&!h4.has(e)?(Zi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${af}"`),null):e}function f4(e,t){let r,i,s,o,u;if(a4(e)){let d=e.getAttribute("action");i=d?Ds(d,t):null,r=e.getAttribute("method")||sf,s=ov(e.getAttribute("enctype"))||af,o=new FormData(e)}else if(s4(e)||o4(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(i=m?Ds(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||sf,s=ov(e.getAttribute("formenctype"))||ov(d.getAttribute("enctype"))||af,o=new FormData(d,e),!d4()){let{name:h,type:v,value:p}=e;if(v==="image"){let x=h?`${h}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else h&&o.append(h,p)}}else{if(em(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=sf,i=null,s=af,u=e}return o&&s==="text/plain"&&(u=o,o=void 0),{action:i,method:r.toLowerCase(),encType:s,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Sx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function SR(e,t,r,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:t&&Ds(s.pathname,t)==="/"?s.pathname=`${Ef(t)}/_root.${i}`:s.pathname=`${Ef(s.pathname)}.${i}`,s}async function m4(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function p4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function g4(e,t,r){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let u=await m4(o,r);return u.links?u.links():[]}return[]}));return y4(i.flat(1).filter(p4).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function nC(e,t,r,i,s,o){let u=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,d=(m,h)=>{var v;return r[h].pathname!==m.pathname||((v=r[h].route.path)==null?void 0:v.endsWith("*"))&&r[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>u(m,h)||d(m,h)):o==="data"?t.filter((m,h)=>{var p;let v=i.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=r[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function v4(e,t,{includeHydrateFallback:r}={}){return _4(e.map(i=>{let s=t.routes[i.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function _4(e){return[...new Set(e)]}function x4(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function y4(e,t){let r=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(x4(s));return r.has(o)||(r.add(o),i.push({key:o,link:s})),i},[])}function Cx(){let e=g.useContext(Jl);return Sx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function b4(){let e=g.useContext(Qf);return Sx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ex=g.createContext(void 0);Ex.displayName="FrameworkContext";function tm(){let e=g.useContext(Ex);return Sx(e,"You must render this element inside a <HydratedRouter> element"),e}function w4(e,t){let r=g.useContext(Ex),[i,s]=g.useState(!1),[o,u]=g.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:v,onTouchStart:p}=t,x=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=S=>{S.forEach(N=>{u(N.isIntersecting)})},E=new IntersectionObserver(C,{threshold:.5});return x.current&&E.observe(x.current),()=>{E.disconnect()}}},[e]),g.useEffect(()=>{if(i){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[i]);let y=()=>{s(!0)},w=()=>{s(!1),u(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:ru(d,y),onBlur:ru(m,w),onMouseEnter:ru(h,y),onMouseLeave:ru(v,w),onTouchStart:ru(p,y)}]:[!1,x,{}]}function ru(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function S4({page:e,...t}){let r=BL(),{nonce:i}=tm(),{router:s}=Cx(),o=g.useMemo(()=>sR(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?g.createElement(E4,{page:e,matches:o,...t}):g.createElement(R4,{page:e,matches:o,...t})):null}function C4(e){let{manifest:t,routeModules:r}=tm(),[i,s]=g.useState([]);return g.useEffect(()=>{let o=!1;return g4(e,t,r).then(u=>{o||s(u)}),()=>{o=!0}},[e,t,r]),i}function E4({page:e,matches:t,...r}){let i=Hr(),{future:s}=tm(),{basename:o}=Cx(),u=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=SR(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?m=!0:h.push(v.route.id);return m&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[o,s.v8_trailingSlashAwareDataRequests,e,i,t]);return g.createElement(g.Fragment,null,u.map(d=>g.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function R4({page:e,matches:t,...r}){let i=Hr(),{future:s,manifest:o,routeModules:u}=tm(),{basename:d}=Cx(),{loaderData:m,matches:h}=b4(),v=g.useMemo(()=>nC(e,t,h,o,i,"data"),[e,t,h,o,i]),p=g.useMemo(()=>nC(e,t,h,o,i,"assets"),[e,t,h,o,i]),x=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,E=!1;if(t.forEach(N=>{var R;let k=o.routes[N.route.id];!k||!k.hasLoader||(!v.some(M=>M.route.id===N.route.id)&&N.route.id in m&&((R=u[N.route.id])!=null&&R.shouldRevalidate)||k.hasClientLoader?E=!0:C.add(N.route.id))}),C.size===0)return[];let S=SR(e,d,s.v8_trailingSlashAwareDataRequests,"data");return E&&C.size>0&&S.searchParams.set("_routes",t.filter(N=>C.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,m,i,o,v,t,e,u]),y=g.useMemo(()=>v4(p,o),[p,o]),w=C4(p);return g.createElement(g.Fragment,null,x.map(C=>g.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),y.map(C=>g.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),w.map(({key:C,link:E})=>g.createElement("link",{key:C,nonce:r.nonce,...E,crossOrigin:E.crossOrigin??r.crossOrigin})))}function k4(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var N4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{N4&&(window.__reactRouterVersion="7.18.1")}catch{}function A4({basename:e,children:t,useTransitions:r,window:i}){let s=g.useRef();s.current==null&&(s.current=lL({window:i,v5Compat:!0}));let o=s.current,[u,d]=g.useState({action:o.action,location:o.location}),m=g.useCallback(h=>{r===!1?d(h):g.startTransition(()=>d(h))},[r]);return g.useLayoutEffect(()=>o.listen(m),[o,m]),g.createElement(n4,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:r})}var CR=g.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:s,reloadDocument:o,replace:u,mask:d,state:m,target:h,to:v,preventScrollReset:p,viewTransition:x,defaultShouldRevalidate:y,...w},C){let{basename:E,navigator:S,useTransitions:N}=g.useContext(Mi),k=typeof v=="string"&&_x.test(v),R=hR(v,E);v=R.to;let M=FL(v,{relative:s}),L=Hr(),z=null;if(d){let $=Zf(d,[],L.mask?L.mask.pathname:"/",!0);E!=="/"&&($.pathname=$.pathname==="/"?E:gn([E,$.pathname])),z=S.createHref($)}let[D,W,G]=w4(i,w),q=j4(v,{replace:u,mask:d,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:x,defaultShouldRevalidate:y,useTransitions:N});function B($){t&&t($),$.defaultPrevented||q($)}let j=!(R.isExternal||o),O=g.createElement("a",{...w,...G,href:(j?z:void 0)||R.absoluteURL||M,onClick:j?B:t,ref:k4(C,W),target:h,"data-discover":!k&&r==="render"?"true":void 0});return D&&!k?g.createElement(g.Fragment,null,O,g.createElement(S4,{page:M})):O});CR.displayName="Link";var Sa=g.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:s=!1,style:o,to:u,viewTransition:d,children:m,...h},v){let p=Ju(u,{relative:h.relative}),x=Hr(),y=g.useContext(Qf),{navigator:w,basename:C}=g.useContext(Mi),E=y!=null&&I4(p)&&d===!0,S=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,N=x.pathname,k=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(N=N.toLowerCase(),k=k?k.toLowerCase():null,S=S.toLowerCase()),k&&C&&(k=Ds(k,C)||k);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=N===S||!s&&N.startsWith(S)&&N.charAt(R)==="/",L=k!=null&&(k===S||!s&&k.startsWith(S)&&k.charAt(S.length)==="/"),z={isActive:M,isPending:L,isTransitioning:E},D=M?t:void 0,W;typeof i=="function"?W=i(z):W=[i,M?"active":null,L?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let G=typeof o=="function"?o(z):o;return g.createElement(CR,{...h,"aria-current":D,className:W,ref:v,style:G,to:u,viewTransition:d},typeof m=="function"?m(z):m)});Sa.displayName="NavLink";var T4=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:s,state:o,method:u=sf,action:d,onSubmit:m,relative:h,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x,...y},w)=>{let{useTransitions:C}=g.useContext(Mi),E=B4(),S=P4(d,{relative:h}),N=u.toLowerCase()==="get"?"get":"post",k=typeof d=="string"&&_x.test(d),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let L=M.nativeEvent.submitter,z=(L==null?void 0:L.getAttribute("formmethod"))||u,D=()=>E(L||M.currentTarget,{fetcherKey:t,method:z,navigate:r,replace:s,state:o,relative:h,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x});C&&r!==!1?g.startTransition(()=>D()):D()};return g.createElement("form",{ref:w,method:N,action:S,onSubmit:i?m:R,...y,"data-discover":!k&&e==="render"?"true":void 0})});T4.displayName="Form";function M4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ER(e){let t=g.useContext(Jl);return cr(t,M4(e)),t}function j4(e,{target:t,replace:r,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:h}={}){let v=Oa(),p=Hr(),x=Ju(e,{relative:u});return g.useCallback(y=>{if(c4(y,t)){y.preventDefault();let w=r!==void 0?r:Bu(p)===Bu(x),C=()=>v(e,{replace:w,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m});h?g.startTransition(()=>C()):C()}},[p,v,x,r,i,s,t,e,o,u,d,m,h])}function D4(e){Zi(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=g.useRef(I_(e)),r=g.useRef(!1),i=Hr(),s=g.useMemo(()=>u4(i.search,r.current?null:t.current),[i.search]),o=Oa(),u=g.useCallback((d,m)=>{const h=I_(typeof d=="function"?d(new URLSearchParams(s)):d);r.current=!0,o("?"+h,m)},[o,s]);return[s,u]}var L4=0,O4=()=>`__${String(++L4)}__`;function B4(){let{router:e}=ER("useSubmit"),{basename:t}=g.useContext(Mi),r=e4(),i=e.fetch,s=e.navigate;return g.useCallback(async(o,u={})=>{let{action:d,method:m,encType:h,formData:v,body:p}=f4(o,t);if(u.navigate===!1){let x=u.fetcherKey||O4();await i(x,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,s,t,r])}function P4(e,{relative:t}={}){let{basename:r}=g.useContext(Mi),i=g.useContext(wn);cr(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...Ju(e||".",{relative:t})},u=Hr();if(e==null){o.search=u.search;let d=new URLSearchParams(o.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let v=d.toString();o.search=v?`?${v}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:gn([r,o.pathname])),Bu(o)}function I4(e,{relative:t}={}){let r=g.useContext(pR);cr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=ER("useViewTransitionState"),s=Ju(e,{relative:t});if(!r.isTransitioning)return!1;let o=Ds(r.currentLocation.pathname,i)||r.currentLocation.pathname,u=Ds(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Cf(s.pathname,u)!=null||Cf(s.pathname,o)!=null}/**
61
+ * @license lucide-react v0.475.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const z4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),RR=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim();/**
66
+ * @license lucide-react v0.475.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var $4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.475.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const U4=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:u,...d},m)=>g.createElement("svg",{ref:m,...$4,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:RR("lucide",s),...d},[...u.map(([h,v])=>g.createElement(h,v)),...Array.isArray(o)?o:[o]]));/**
76
+ * @license lucide-react v0.475.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const Ee=(e,t)=>{const r=g.forwardRef(({className:i,...s},o)=>g.createElement(U4,{ref:o,iconNode:t,className:RR(`lucide-${z4(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
81
+ * @license lucide-react v0.475.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const H4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Yl=Ee("ArrowLeft",H4);/**
86
+ * @license lucide-react v0.475.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const F4=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kR=Ee("ArrowRight",F4);/**
91
+ * @license lucide-react v0.475.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const W4=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Rx=Ee("Bot",W4);/**
96
+ * @license lucide-react v0.475.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const q4=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],NR=Ee("Boxes",q4);/**
101
+ * @license lucide-react v0.475.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const V4=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],kx=Ee("Cable",V4);/**
106
+ * @license lucide-react v0.475.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const G4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ba=Ee("Check",G4);/**
111
+ * @license lucide-react v0.475.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const Y4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Nx=Ee("ChevronDown",Y4);/**
116
+ * @license lucide-react v0.475.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const K4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],AR=Ee("ChevronLeft",K4);/**
121
+ * @license lucide-react v0.475.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const X4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jo=Ee("ChevronRight",X4);/**
126
+ * @license lucide-react v0.475.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const Z4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Q4=Ee("ChevronUp",Z4);/**
131
+ * @license lucide-react v0.475.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const J4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],tc=Ee("CircleAlert",J4);/**
136
+ * @license lucide-react v0.475.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const eO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Wl=Ee("CircleArrowUp",eO);/**
141
+ * @license lucide-react v0.475.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const tO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ax=Ee("CircleCheck",tO);/**
146
+ * @license lucide-react v0.475.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const rO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],iO=Ee("CircleHelp",rO);/**
151
+ * @license lucide-react v0.475.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const nO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],sO=Ee("CircleSlash",nO);/**
156
+ * @license lucide-react v0.475.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const aO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],oO=Ee("CircleStop",aO);/**
161
+ * @license lucide-react v0.475.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const lO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],cO=Ee("CircleX",lO);/**
166
+ * @license lucide-react v0.475.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const uO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dO=Ee("Circle",uO);/**
171
+ * @license lucide-react v0.475.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const hO=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Tx=Ee("Command",hO);/**
176
+ * @license lucide-react v0.475.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const fO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],TR=Ee("Copy",fO);/**
181
+ * @license lucide-react v0.475.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const mO=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Mx=Ee("Download",mO);/**
186
+ * @license lucide-react v0.475.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const pO=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Pu=Ee("Earth",pO);/**
191
+ * @license lucide-react v0.475.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const gO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],vO=Ee("Ellipsis",gO);/**
196
+ * @license lucide-react v0.475.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const _O=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],xO=Ee("Eraser",_O);/**
201
+ * @license lucide-react v0.475.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const yO=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],bO=Ee("Expand",yO);/**
206
+ * @license lucide-react v0.475.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const wO=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],sC=Ee("ExternalLink",wO);/**
211
+ * @license lucide-react v0.475.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const SO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],CO=Ee("FileText",SO);/**
216
+ * @license lucide-react v0.475.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const EO=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],RO=Ee("Fingerprint",EO);/**
221
+ * @license lucide-react v0.475.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const kO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],NO=Ee("Folder",kO);/**
226
+ * @license lucide-react v0.475.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const AO=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],TO=Ee("GitBranch",AO);/**
231
+ * @license lucide-react v0.475.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const MO=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],MR=Ee("House",MO);/**
236
+ * @license lucide-react v0.475.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const jO=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],DO=Ee("ImageOff",jO);/**
241
+ * @license lucide-react v0.475.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const LO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],OO=Ee("Image",LO);/**
246
+ * @license lucide-react v0.475.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const BO=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],jR=Ee("KeyRound",BO);/**
251
+ * @license lucide-react v0.475.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const PO=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],jx=Ee("Laptop",PO);/**
256
+ * @license lucide-react v0.475.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const IO=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],zO=Ee("LayoutDashboard",IO);/**
261
+ * @license lucide-react v0.475.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const $O=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],UO=Ee("Link2",$O);/**
266
+ * @license lucide-react v0.475.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const HO=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],FO=Ee("ListChecks",HO);/**
271
+ * @license lucide-react v0.475.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const WO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ge=Ee("LoaderCircle",WO);/**
276
+ * @license lucide-react v0.475.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const qO=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],VO=Ee("MapPin",qO);/**
281
+ * @license lucide-react v0.475.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const GO=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],YO=Ee("MessageSquare",GO);/**
286
+ * @license lucide-react v0.475.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const KO=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],z_=Ee("MonitorSmartphone",KO);/**
291
+ * @license lucide-react v0.475.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const XO=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],ZO=Ee("MonitorUp",XO);/**
296
+ * @license lucide-react v0.475.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const QO=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],DR=Ee("Monitor",QO);/**
301
+ * @license lucide-react v0.475.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const JO=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],eB=Ee("Moon",JO);/**
306
+ * @license lucide-react v0.475.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const tB=[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]],rB=Ee("MousePointerBan",tB);/**
311
+ * @license lucide-react v0.475.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const iB=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],nB=Ee("MousePointerClick",iB);/**
316
+ * @license lucide-react v0.475.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const sB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],aB=Ee("PanelLeftClose",sB);/**
321
+ * @license lucide-react v0.475.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const oB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],LR=Ee("PanelLeftOpen",oB);/**
326
+ * @license lucide-react v0.475.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const lB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],cB=Ee("PanelRightClose",lB);/**
331
+ * @license lucide-react v0.475.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const uB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],dB=Ee("PanelRightOpen",uB);/**
336
+ * @license lucide-react v0.475.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const hB=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],fB=Ee("Paperclip",hB);/**
341
+ * @license lucide-react v0.475.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const mB=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],pB=Ee("Pause",mB);/**
346
+ * @license lucide-react v0.475.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const gB=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],vB=Ee("Pencil",gB);/**
351
+ * @license lucide-react v0.475.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const _B=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],OR=Ee("Play",_B);/**
356
+ * @license lucide-react v0.475.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const xB=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qi=Ee("Plus",xB);/**
361
+ * @license lucide-react v0.475.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const yB=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Rf=Ee("Power",yB);/**
366
+ * @license lucide-react v0.475.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const bB=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Nt=Ee("RefreshCw",bB);/**
371
+ * @license lucide-react v0.475.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const wB=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],BR=Ee("RotateCw",wB);/**
376
+ * @license lucide-react v0.475.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const SB=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]],CB=Ee("ScanEye",SB);/**
381
+ * @license lucide-react v0.475.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const EB=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]],RB=Ee("ScanSearch",EB);/**
386
+ * @license lucide-react v0.475.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const kB=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],PR=Ee("ScrollText",kB);/**
391
+ * @license lucide-react v0.475.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const NB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],AB=Ee("Search",NB);/**
396
+ * @license lucide-react v0.475.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const TB=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],IR=Ee("Send",TB);/**
401
+ * @license lucide-react v0.475.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const MB=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ed=Ee("Server",MB);/**
406
+ * @license lucide-react v0.475.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const jB=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],DB=Ee("Settings",jB);/**
411
+ * @license lucide-react v0.475.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const LB=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],OB=Ee("Share2",LB);/**
416
+ * @license lucide-react v0.475.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const BB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],PB=Ee("ShieldAlert",BB);/**
421
+ * @license lucide-react v0.475.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const IB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kf=Ee("ShieldCheck",IB);/**
426
+ * @license lucide-react v0.475.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const zB=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],Dx=Ee("ShieldOff",zB);/**
431
+ * @license lucide-react v0.475.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const $B=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],UB=Ee("Shrink",$B);/**
436
+ * @license lucide-react v0.475.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const HB=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Kl=Ee("Smartphone",HB);/**
441
+ * @license lucide-react v0.475.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const FB=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],zR=Ee("Sparkles",FB);/**
446
+ * @license lucide-react v0.475.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const WB=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Lx=Ee("SquareTerminal",WB);/**
451
+ * @license lucide-react v0.475.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const qB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],VB=Ee("Square",qB);/**
456
+ * @license lucide-react v0.475.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const GB=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],YB=Ee("Sun",GB);/**
461
+ * @license lucide-react v0.475.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const KB=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],XB=Ee("Terminal",KB);/**
466
+ * @license lucide-react v0.475.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const ZB=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Pa=Ee("Trash2",ZB);/**
471
+ * @license lucide-react v0.475.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const QB=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ea=Ee("TriangleAlert",QB);/**
476
+ * @license lucide-react v0.475.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const JB=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],e6=Ee("Unlink",JB);/**
481
+ * @license lucide-react v0.475.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const t6=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],r6=Ee("Workflow",t6);/**
486
+ * @license lucide-react v0.475.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const i6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Na=Ee("X",i6);var Ia=iR();const n6=gx(Ia);function s6(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const a6=e=>{switch(e){case"success":return c6;case"info":return d6;case"warning":return u6;case"error":return h6;default:return null}},o6=Array(12).fill(0),l6=({visible:e,className:t})=>Ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ce.createElement("div",{className:"sonner-spinner"},o6.map((r,i)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),c6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),u6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),d6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),h6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),f6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),m6=()=>{const[e,t]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let $_=1;class p6{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:i,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:$_++,u=this.toasts.find(m=>m.id===o),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),u?this.toasts=this.toasts.map(m=>m.id===o?(this.publish({...m,...t,id:o,title:i}),{...m,...t,id:o,dismissible:d,title:i}):m):this.addToast({title:i,...s,dismissible:d,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=i!==void 0,u;const d=s.then(async h=>{if(u=["resolve",h],Ce.isValidElement(h))o=!1,this.create({id:i,type:"default",message:h});else if(v6(h)&&!h.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:x,...w})}else if(h instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(h):r.error,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:x,...w})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(h):r.success,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"success",description:x,...w})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){o=!1;const v=typeof r.error=="function"?await r.error(h):r.error,p=typeof r.description=="function"?await r.description(h):r.description,y=typeof v=="object"&&!Ce.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:p,...y})}}).finally(()=>{o&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((h,v)=>d.then(()=>u[0]==="reject"?v(u[1]):h(u[1])).catch(v));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(t,r)=>{const i=(r==null?void 0:r.id)||$_++;return this.create({jsx:t(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const mi=new p6,g6=(e,t)=>{const r=(t==null?void 0:t.id)||$_++;return mi.addToast({title:e,...t,id:r}),r},v6=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",_6=g6,x6=()=>mi.toasts,y6=()=>mi.getActiveToasts(),_e=Object.assign(_6,{success:mi.success,info:mi.info,warning:mi.warning,error:mi.error,custom:mi.custom,message:mi.message,promise:mi.promise,dismiss:mi.dismiss,loading:mi.loading},{getHistory:x6,getToasts:y6});s6("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Mh(e){return e.label!==void 0}const b6=3,w6="24px",S6="16px",aC=4e3,C6=356,E6=14,R6=45,k6=200;function On(...e){return e.filter(Boolean).join(" ")}function N6(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const A6=e=>{var t,r,i,s,o,u,d,m,h;const{invert:v,toast:p,unstyled:x,interacting:y,setHeights:w,visibleToasts:C,heights:E,index:S,toasts:N,expanded:k,removeToast:R,defaultRichColors:M,closeButton:L,style:z,cancelButtonStyle:D,actionButtonStyle:W,className:G="",descriptionClassName:q="",duration:B,position:j,gap:O,expandByDefault:$,classNames:T,icons:U,closeButtonAriaLabel:H="Close toast"}=e,[F,V]=Ce.useState(null),[I,Y]=Ce.useState(null),[X,ee]=Ce.useState(!1),[re,oe]=Ce.useState(!1),[Z,ce]=Ce.useState(!1),[ne,we]=Ce.useState(!1),[xe,ye]=Ce.useState(!1),[J,ie]=Ce.useState(0),[Re,ve]=Ce.useState(0),Ae=Ce.useRef(p.duration||B||aC),Ie=Ce.useRef(null),Oe=Ce.useRef(null),ze=S===0,rt=S+1<=C,Be=p.type,dt=p.dismissible!==!1,He=p.className||"",Ot=p.descriptionClassName||"",Ht=Ce.useMemo(()=>E.findIndex(Ue=>Ue.toastId===p.id)||0,[E,p.id]),gi=Ce.useMemo(()=>{var Ue;return(Ue=p.closeButton)!=null?Ue:L},[p.closeButton,L]),Bt=Ce.useMemo(()=>p.duration||B||aC,[p.duration,B]),vt=Ce.useRef(0),ur=Ce.useRef(0),At=Ce.useRef(0),an=Ce.useRef(null),[is,Ar]=j.split("-"),vi=Ce.useMemo(()=>E.reduce((Ue,me,ke)=>ke>=Ht?Ue:Ue+me.height,0),[E,Ht]),vr=m6(),Wa=p.invert||v,Hs=Be==="loading";ur.current=Ce.useMemo(()=>Ht*O+vi,[Ht,vi]),Ce.useEffect(()=>{Ae.current=Bt},[Bt]),Ce.useEffect(()=>{ee(!0)},[]),Ce.useEffect(()=>{const Ue=Oe.current;if(Ue){const me=Ue.getBoundingClientRect().height;return ve(me),w(ke=>[{toastId:p.id,height:me,position:p.position},...ke]),()=>w(ke=>ke.filter(Fe=>Fe.toastId!==p.id))}},[w,p.id]),Ce.useLayoutEffect(()=>{if(!X)return;const Ue=Oe.current,me=Ue.style.height;Ue.style.height="auto";const ke=Ue.getBoundingClientRect().height;Ue.style.height=me,ve(ke),w(Fe=>Fe.find(Ze=>Ze.toastId===p.id)?Fe.map(Ze=>Ze.toastId===p.id?{...Ze,height:ke}:Ze):[{toastId:p.id,height:ke,position:p.position},...Fe])},[X,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const _i=Ce.useCallback(()=>{oe(!0),ie(ur.current),w(Ue=>Ue.filter(me=>me.toastId!==p.id)),setTimeout(()=>{R(p)},k6)},[p,R,w,ur]);Ce.useEffect(()=>{if(p.promise&&Be==="loading"||p.duration===1/0||p.type==="loading")return;let Ue;return k||y||vr?(()=>{if(At.current<vt.current){const Fe=new Date().getTime()-vt.current;Ae.current=Ae.current-Fe}At.current=new Date().getTime()})():(()=>{Ae.current!==1/0&&(vt.current=new Date().getTime(),Ue=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),_i()},Ae.current))})(),()=>clearTimeout(Ue)},[k,y,p,Be,vr,_i]),Ce.useEffect(()=>{p.delete&&(_i(),p.onDismiss==null||p.onDismiss.call(p,p))},[_i,p.delete]);function ns(){var Ue;if(U!=null&&U.loading){var me;return Ce.createElement("div",{className:On(T==null?void 0:T.loader,p==null||(me=p.classNames)==null?void 0:me.loader,"sonner-loader"),"data-visible":Be==="loading"},U.loading)}return Ce.createElement(l6,{className:On(T==null?void 0:T.loader,p==null||(Ue=p.classNames)==null?void 0:Ue.loader),visible:Be==="loading"})}const ss=p.icon||(U==null?void 0:U[Be])||a6(Be);var Tn,xi;return Ce.createElement("li",{tabIndex:0,ref:Oe,className:On(G,He,T==null?void 0:T.toast,p==null||(t=p.classNames)==null?void 0:t.toast,T==null?void 0:T.default,T==null?void 0:T[Be],p==null||(r=p.classNames)==null?void 0:r[Be]),"data-sonner-toast":"","data-rich-colors":(Tn=p.richColors)!=null?Tn:M,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":X,"data-promise":!!p.promise,"data-swiped":xe,"data-removed":re,"data-visible":rt,"data-y-position":is,"data-x-position":Ar,"data-index":S,"data-front":ze,"data-swiping":Z,"data-dismissible":dt,"data-type":Be,"data-invert":Wa,"data-swipe-out":ne,"data-swipe-direction":I,"data-expanded":!!(k||$&&X),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":N.length-S,"--offset":`${re?J:ur.current}px`,"--initial-height":$?"auto":`${Re}px`,...z,...p.style},onDragEnd:()=>{ce(!1),V(null),an.current=null},onPointerDown:Ue=>{Ue.button!==2&&(Hs||!dt||(Ie.current=new Date,ie(ur.current),Ue.target.setPointerCapture(Ue.pointerId),Ue.target.tagName!=="BUTTON"&&(ce(!0),an.current={x:Ue.clientX,y:Ue.clientY})))},onPointerUp:()=>{var Ue,me,ke;if(ne||!dt)return;an.current=null;const Fe=Number(((Ue=Oe.current)==null?void 0:Ue.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),bt=Number(((me=Oe.current)==null?void 0:me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ze=new Date().getTime()-((ke=Ie.current)==null?void 0:ke.getTime()),Ft=F==="x"?Fe:bt,ii=Math.abs(Ft)/Ze;if(Math.abs(Ft)>=R6||ii>.11){ie(ur.current),p.onDismiss==null||p.onDismiss.call(p,p),Y(F==="x"?Fe>0?"right":"left":bt>0?"down":"up"),_i(),we(!0);return}else{var Wt,ni;(Wt=Oe.current)==null||Wt.style.setProperty("--swipe-amount-x","0px"),(ni=Oe.current)==null||ni.style.setProperty("--swipe-amount-y","0px")}ye(!1),ce(!1),V(null)},onPointerMove:Ue=>{var me,ke,Fe;if(!an.current||!dt||((me=window.getSelection())==null?void 0:me.toString().length)>0)return;const Ze=Ue.clientY-an.current.y,Ft=Ue.clientX-an.current.x;var ii;const Wt=(ii=e.swipeDirections)!=null?ii:N6(j);!F&&(Math.abs(Ft)>1||Math.abs(Ze)>1)&&V(Math.abs(Ft)>Math.abs(Ze)?"x":"y");let ni={x:0,y:0};const Fo=on=>1/(1.5+Math.abs(on)/20);if(F==="y"){if(Wt.includes("top")||Wt.includes("bottom"))if(Wt.includes("top")&&Ze<0||Wt.includes("bottom")&&Ze>0)ni.y=Ze;else{const on=Ze*Fo(Ze);ni.y=Math.abs(on)<Math.abs(Ze)?on:Ze}}else if(F==="x"&&(Wt.includes("left")||Wt.includes("right")))if(Wt.includes("left")&&Ft<0||Wt.includes("right")&&Ft>0)ni.x=Ft;else{const on=Ft*Fo(Ft);ni.x=Math.abs(on)<Math.abs(Ft)?on:Ft}(Math.abs(ni.x)>0||Math.abs(ni.y)>0)&&ye(!0),(ke=Oe.current)==null||ke.style.setProperty("--swipe-amount-x",`${ni.x}px`),(Fe=Oe.current)==null||Fe.style.setProperty("--swipe-amount-y",`${ni.y}px`)}},gi&&!p.jsx&&Be!=="loading"?Ce.createElement("button",{"aria-label":H,"data-disabled":Hs,"data-close-button":!0,onClick:Hs||!dt?()=>{}:()=>{_i(),p.onDismiss==null||p.onDismiss.call(p,p)},className:On(T==null?void 0:T.closeButton,p==null||(i=p.classNames)==null?void 0:i.closeButton)},(xi=U==null?void 0:U.close)!=null?xi:f6):null,(Be||p.icon||p.promise)&&p.icon!==null&&((U==null?void 0:U[Be])!==null||p.icon)?Ce.createElement("div",{"data-icon":"",className:On(T==null?void 0:T.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||ns():null,p.type!=="loading"?ss:null):null,Ce.createElement("div",{"data-content":"",className:On(T==null?void 0:T.content,p==null||(o=p.classNames)==null?void 0:o.content)},Ce.createElement("div",{"data-title":"",className:On(T==null?void 0:T.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Ce.createElement("div",{"data-description":"",className:On(q,Ot,T==null?void 0:T.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),Ce.isValidElement(p.cancel)?p.cancel:p.cancel&&Mh(p.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||D,onClick:Ue=>{Mh(p.cancel)&&dt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ue),_i())},className:On(T==null?void 0:T.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Ce.isValidElement(p.action)?p.action:p.action&&Mh(p.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||W,onClick:Ue=>{Mh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Ue),!Ue.defaultPrevented&&_i())},className:On(T==null?void 0:T.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function oC(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function T6(e,t){const r={};return[e,t].forEach((i,s)=>{const o=s===1,u=o?"--mobile-offset":"--offset",d=o?S6:w6;function m(h){["top","right","bottom","left"].forEach(v=>{r[`${u}-${v}`]=typeof h=="number"?`${h}px`:h})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(h=>{i[h]===void 0?r[`${u}-${h}`]=d:r[`${u}-${h}`]=typeof i[h]=="number"?`${i[h]}px`:i[h]}):m(d)}),r}const M6=Ce.forwardRef(function(t,r){const{id:i,invert:s,position:o="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:h,offset:v,mobileOffset:p,theme:x="light",richColors:y,duration:w,style:C,visibleToasts:E=b6,toastOptions:S,dir:N=oC(),gap:k=E6,icons:R,containerAriaLabel:M="Notifications"}=t,[L,z]=Ce.useState([]),D=Ce.useMemo(()=>i?L.filter(X=>X.toasterId===i):L.filter(X=>!X.toasterId),[L,i]),W=Ce.useMemo(()=>Array.from(new Set([o].concat(D.filter(X=>X.position).map(X=>X.position)))),[D,o]),[G,q]=Ce.useState([]),[B,j]=Ce.useState(!1),[O,$]=Ce.useState(!1),[T,U]=Ce.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ce.useRef(null),F=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=Ce.useRef(null),I=Ce.useRef(!1),Y=Ce.useCallback(X=>{z(ee=>{var re;return(re=ee.find(oe=>oe.id===X.id))!=null&&re.delete||mi.dismiss(X.id),ee.filter(({id:oe})=>oe!==X.id)})},[]);return Ce.useEffect(()=>mi.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{z(ee=>ee.map(re=>re.id===X.id?{...re,delete:!0}:re))});return}setTimeout(()=>{n6.flushSync(()=>{z(ee=>{const re=ee.findIndex(oe=>oe.id===X.id);return re!==-1?[...ee.slice(0,re),{...ee[re],...X},...ee.slice(re+1)]:[X,...ee]})})})}),[L]),Ce.useEffect(()=>{if(x!=="system"){U(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:ee})=>{U(ee?"dark":"light")})}catch{X.addListener(({matches:re})=>{try{U(re?"dark":"light")}catch(oe){console.error(oe)}})}},[x]),Ce.useEffect(()=>{L.length<=1&&j(!1)},[L]),Ce.useEffect(()=>{const X=ee=>{var re;if(u.every(ce=>ee[ce]||ee.code===ce)){var Z;j(!0),(Z=H.current)==null||Z.focus()}ee.code==="Escape"&&(document.activeElement===H.current||(re=H.current)!=null&&re.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[u]),Ce.useEffect(()=>{if(H.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,I.current=!1)}},[H.current]),Ce.createElement("section",{ref:r,"aria-label":`${M} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((X,ee)=>{var re;const[oe,Z]=X.split("-");return D.length?Ce.createElement("ol",{key:X,dir:N==="auto"?oC():N,tabIndex:-1,ref:H,className:h,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":oe,"data-x-position":Z,style:{"--front-toast-height":`${((re=G[0])==null?void 0:re.height)||0}px`,"--width":`${C6}px`,"--gap":`${k}px`,...C,...T6(v,p)},onBlur:ce=>{I.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(I.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||I.current||(I.current=!0,V.current=ce.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{O||j(!1)},onDragEnd:()=>j(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},D.filter(ce=>!ce.position&&ee===0||ce.position===X).map((ce,ne)=>{var we,xe;return Ce.createElement(A6,{key:ce.id,icons:R,index:ne,toast:ce,defaultRichColors:y,duration:(we=S==null?void 0:S.duration)!=null?we:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:s,visibleToasts:E,closeButton:(xe=S==null?void 0:S.closeButton)!=null?xe:m,interacting:O,position:X,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,closeButtonAriaLabel:S==null?void 0:S.closeButtonAriaLabel,removeToast:Y,toasts:D.filter(ye=>ye.position==ce.position),heights:G.filter(ye=>ye.position==ce.position),setHeights:q,expandByDefault:d,gap:k,expanded:B,swipeDirections:t.swipeDirections})})):null}))});function Sn(e,t=[]){let r=[];function i(o,u){const d=g.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=p=>{var S;const{scope:x,children:y,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:y})};h.displayName=o+"Provider";function v(p,x,y={}){var S;const{optional:w=!1}=y,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useContext(C);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return[h,v]}const s=()=>{const o=r.map(u=>g.createContext(u));return function(d){const m=(d==null?void 0:d[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[i,j6(s,...t)]}function j6(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function lC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function D6(...e){return t=>{let r=!1;const i=e.map(s=>{const o=lC(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():lC(e[s],null)}}}}function it(...e){return g.useCallback(D6(...e),e)}function Le(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Xt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},L6=La[" useId ".trim().toString()]||(()=>{}),O6=0;function vn(e){const[t,r]=g.useState(L6());return Xt(()=>{r(i=>i??String(O6++))},[e]),t?`radix-${t}`:""}var B6=La[" useInsertionEffect ".trim().toString()]||Xt;function Eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[s,o,u]=P6({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s;{const v=g.useRef(e!==void 0);g.useEffect(()=>{const p=v.current;p!==d&&console.warn(`${i} is changing from ${p?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=d},[d,i])}const h=g.useCallback(v=>{var p;if(d){const x=I6(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else o(v)},[d,e,o,u]);return[m,h]}function P6({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),s=g.useRef(r),o=g.useRef(t);return B6(()=>{o.current=t},[t]),g.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}function I6(e){return typeof e=="function"}function Ro(e){const t=g.forwardRef((r,i)=>{let{children:s,...o}=r,u=null,d=!1;const m=[];cC(s)&&typeof jh=="function"&&(s=jh(s._payload)),g.Children.forEach(s,x=>{var y;if(W6(x)){d=!0;const w=x;let C="child"in w.props?w.props.child:w.props.children;cC(C)&&typeof jh=="function"&&(C=jh(C._payload)),u=U6(w,C),m.push((y=u==null?void 0:u.props)==null?void 0:y.children)}else m.push(x)}),u?u=g.cloneElement(u,void 0,m):!d&&g.Children.count(s)===1&&g.isValidElement(s)&&(u=s);const h=u?F6(u):void 0,v=it(i,h);if(!u){if(s||s===0)throw new Error(d?Y6(e):G6(e));return s}const p=H6(o,u.props??{});return u.type!==g.Fragment&&(p.ref=i?v:h),g.cloneElement(u,p)});return t.displayName=`${e}.Slot`,t}var z6=Ro("Slot"),$6=Symbol.for("radix.slottable"),U6=(e,t)=>{if("child"in e.props){const r=e.props.child;return g.isValidElement(r)?g.cloneElement(r,void 0,e.props.children(r.props.children)):null}return g.isValidElement(t)?t:null};function H6(e,t){const r={...t};for(const i in t){const s=e[i],o=t[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...d)=>{const m=o(...d);return s(...d),m}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function F6(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function W6(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$6}var q6=Symbol.for("react.lazy");function cC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===q6&&"_payload"in e&&V6(e._payload)}function V6(e){return typeof e=="object"&&e!==null&&"then"in e}var G6=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Y6=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,jh=La[" use ".trim().toString()],K6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ve=K6.reduce((e,t)=>{const r=Ro(`Primitive.${t}`),i=g.forwardRef((s,o)=>{const{asChild:u,...d}=s,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function $R(e,t){e&&Ia.flushSync(()=>e.dispatchEvent(t))}function pr(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}var X6="DismissableLayer",U_="dismissableLayer.update",Z6="dismissableLayer.pointerDownOutside",Q6="dismissableLayer.focusOutside",uC,Ox=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),rm=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...h}=e,v=g.useContext(Ox),[p,x]=g.useState(null),y=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=g.useState({}),C=it(t,x),E=Array.from(v.layers),[S]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),N=S?E.indexOf(S):-1,k=p?E.indexOf(p):-1,R=v.layersWithOutsidePointerEventsDisabled.size>0,M=k>=N,L=g.useRef(!1),z=iP(q=>{o==null||o(q),d==null||d(q),q.defaultPrevented||m==null||m()},{ownerDocument:y,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:v.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(q=>{if(!(q instanceof Node))return!1;const B=[...v.branches].some(j=>j.contains(q));return M&&!B},[v.branches,M])}),D=nP(q=>{if(i&&L.current)return;const B=q.target;[...v.branches].some(O=>O.contains(B))||(u==null||u(q),d==null||d(q),q.defaultPrevented||m==null||m())},y),W=p?k===E.length-1:!1,G=pr(q=>{q.key==="Escape"&&(s==null||s(q),!q.defaultPrevented&&m&&(q.preventDefault(),m()))});return g.useEffect(()=>{if(W)return y.addEventListener("keydown",G,{capture:!0}),()=>y.removeEventListener("keydown",G,{capture:!0})},[y,W,G]),g.useEffect(()=>{if(p)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(uC=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(p)),v.layers.add(p),dC(),()=>{r&&(v.layersWithOutsidePointerEventsDisabled.delete(p),v.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=uC))}},[p,y,r,v]),g.useEffect(()=>()=>{p&&(v.layers.delete(p),v.layersWithOutsidePointerEventsDisabled.delete(p),dC())},[p,v]),g.useEffect(()=>{const q=()=>w({});return document.addEventListener(U_,q),()=>document.removeEventListener(U_,q)},[]),l.jsx(Ve.div,{...h,ref:C,style:{pointerEvents:R?M?"auto":"none":void 0,...e.style},onFocusCapture:Le(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Le(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Le(e.onPointerDownCapture,z.onPointerDownCapture)})});rm.displayName=X6;var J6="DismissableLayerBranch",eP=g.forwardRef((e,t)=>{const r=g.useContext(Ox),i=g.useRef(null),s=it(t,i);return g.useEffect(()=>{const o=i.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(Ve.div,{...e,ref:s})});eP.displayName=J6;function tP(){const e=g.useContext(Ox),[t,r]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var rP=()=>!0;function iP(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:u=rP}=t,d=pr(e),m=g.useRef(!1),h=g.useRef(!1),v=g.useRef(new Map),p=g.useRef(()=>{});return g.useEffect(()=>{function x(){h.current=!1,s.current=!1,v.current.clear()}function y(){return Array.from(v.current.values()).some(Boolean)}function w(k){if(!h.current)return;const R=k.target;R instanceof Node&&[...o].some(L=>L.contains(R))||v.current.set(k.type,!0),k.type==="click"&&window.setTimeout(()=>{h.current&&p.current()},0)}function C(k){h.current&&v.current.set(k.type,!1)}const E=k=>{if(k.target&&!m.current){let R=function(){r.removeEventListener("click",p.current);const L=y();x(),L||UR(Z6,d,M,{discrete:!0})};if(!u(k.target)){r.removeEventListener("click",p.current),x(),m.current=!1;return}const M={originalEvent:k};h.current=!0,s.current=i&&k.button===0,v.current.clear(),!i||k.button!==0?R():(r.removeEventListener("click",p.current),p.current=R,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),x();m.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const k of S)r.addEventListener(k,w,!0),r.addEventListener(k,C);const N=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(N),r.removeEventListener("pointerdown",E),r.removeEventListener("click",p.current);for(const k of S)r.removeEventListener(k,w,!0),r.removeEventListener(k,C)}},[r,d,i,s,o,u]),{onPointerDownCapture:()=>m.current=!0}}function nP(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),i=g.useRef(!1);return g.useEffect(()=>{const s=o=>{o.target&&!i.current&&UR(Q6,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function dC(){const e=new CustomEvent(U_);document.dispatchEvent(e)}function UR(e,t,r,{discrete:i}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),i?$R(s,o):s.dispatchEvent(o)}var lv="focusScope.autoFocusOnMount",cv="focusScope.autoFocusOnUnmount",hC={bubbles:!1,cancelable:!0},sP="FocusScope",im=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...u}=e,[d,m]=g.useState(null),h=pr(s),v=pr(o),p=g.useRef(null),x=it(t,m),y=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let C=function(k){if(y.paused||!d)return;const R=k.target;d.contains(R)?p.current=R:xa(p.current,{select:!0})},E=function(k){if(y.paused||!d)return;const R=k.relatedTarget;R!==null&&(d.contains(R)||xa(p.current,{select:!0}))},S=function(k){if(document.activeElement===document.body)for(const M of k)M.removedNodes.length>0&&xa(d)};document.addEventListener("focusin",C),document.addEventListener("focusout",E);const N=new MutationObserver(S);return d&&N.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",E),N.disconnect()}}},[i,d,y.paused]),g.useEffect(()=>{if(d){mC.add(y);const C=document.activeElement;if(!d.contains(C)){const S=new CustomEvent(lv,hC);d.addEventListener(lv,h),d.dispatchEvent(S),S.defaultPrevented||(aP(dP(HR(d)),{select:!0}),document.activeElement===C&&xa(d))}return()=>{d.removeEventListener(lv,h),setTimeout(()=>{const S=new CustomEvent(cv,hC);d.addEventListener(cv,v),d.dispatchEvent(S),S.defaultPrevented||xa(C??document.body,{select:!0}),d.removeEventListener(cv,v),mC.remove(y)},0)}}},[d,h,v,y]);const w=g.useCallback(C=>{if(!r&&!i||y.paused)return;const E=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,S=document.activeElement;if(E&&S){const N=C.currentTarget,[k,R]=oP(N);k&&R?!C.shiftKey&&S===R?(C.preventDefault(),r&&xa(k,{select:!0})):C.shiftKey&&S===k&&(C.preventDefault(),r&&xa(R,{select:!0})):S===N&&C.preventDefault()}},[r,i,y.paused]);return l.jsx(Ve.div,{tabIndex:-1,...u,ref:x,onKeyDown:w})});im.displayName=sP;function aP(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(xa(i,{select:t}),document.activeElement!==r)return}function oP(e){const t=HR(e),r=fC(t,e),i=fC(t.reverse(),e);return[r,i]}function HR(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function fC(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):lP(i,{upTo:t})))return i}function lP(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function cP(e){return e instanceof HTMLInputElement&&"select"in e}function xa(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&cP(e)&&t&&e.select()}}var mC=uP();function uP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=pC(e,t),e.unshift(t)},remove(t){var r;e=pC(e,t),(r=e[0])==null||r.resume()}}}function pC(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function dP(e){return e.filter(t=>t.tagName!=="A")}var hP="Portal",nm=g.forwardRef((e,t)=>{var d;const{container:r,...i}=e,[s,o]=g.useState(!1);Xt(()=>o(!0),[]);const u=r||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Ia.createPortal(l.jsx(Ve.div,{...i,ref:t}),u):null});nm.displayName=hP;function fP(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}var Cn=e=>{const{present:t,children:r}=e,i=mP(t),s=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=pP(i.ref,gP(s));return typeof r=="function"||i.isPresent?g.cloneElement(s,{ref:o}):null};Cn.displayName="Presence";function mP(e){const[t,r]=g.useState(),i=g.useRef(null),s=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=fP(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{m==="mounted"?(o.current=u.current??iu(i.current),u.current=void 0):o.current="none"},[m]),Xt(()=>{const v=i.current,p=s.current;if(p!==e){const y=o.current,w=iu(v);e?(u.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(p&&y!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Xt(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=w=>{const E=iu(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(h("ANIMATION_END"),!s.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},y=w=>{w.target===t&&(o.current=iu(i.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=iu(p)}else i.current=null;r(v)},[])}}function gC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pP(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=gC(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():gC(i[u],null)}}},[])}function iu(e){return(e==null?void 0:e.animationName)||"none"}function gP(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Dh=0,Bn=null;function Bx(){g.useEffect(()=>{Bn||(Bn={start:vC(),end:vC()});const{start:e,end:t}=Bn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Dh++,()=>{Dh===1&&(Bn==null||Bn.start.remove(),Bn==null||Bn.end.remove(),Bn=null),Dh=Math.max(0,Dh-1)}},[])}function vC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Vn=function(){return Vn=Object.assign||function(t){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Vn.apply(this,arguments)};function FR(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function vP(e,t,r){if(r||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}var of="right-scroll-bar-position",lf="width-before-scroll-bar",_P="with-scroll-bars-hidden",xP="--removed-body-scroll-bar-size";function uv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yP(e,t){var r=g.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(i){var s=r.value;s!==i&&(r.value=i,r.callback(i,s))}}}})[0];return r.callback=t,r.facade}var bP=typeof window<"u"?g.useLayoutEffect:g.useEffect,_C=new WeakMap;function wP(e,t){var r=yP(null,function(i){return e.forEach(function(s){return uv(s,i)})});return bP(function(){var i=_C.get(r);if(i){var s=new Set(i),o=new Set(e),u=r.current;s.forEach(function(d){o.has(d)||uv(d,null)}),o.forEach(function(d){s.has(d)||uv(d,u)})}_C.set(r,e)},[e]),r}function SP(e){return e}function CP(e,t){t===void 0&&(t=SP);var r=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var u=t(o,i);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(o){for(i=!0;r.length;){var u=r;r=[],u.forEach(o)}r={push:function(d){return o(d)},filter:function(){return r}}},assignMedium:function(o){i=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(o),u=r}var m=function(){var v=u;u=[],v.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),r={push:function(v){u.push(v),h()},filter:function(v){return u=u.filter(v),r}}}};return s}function EP(e){e===void 0&&(e={});var t=CP(null);return t.options=Vn({async:!0,ssr:!1},e),t}var WR=function(e){var t=e.sideCar,r=FR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return g.createElement(i,Vn({},r))};WR.isSideCarExport=!0;function RP(e,t){return e.useMedium(t),WR}var qR=EP(),dv=function(){},sm=g.forwardRef(function(e,t){var r=g.useRef(null),i=g.useState({onScrollCapture:dv,onWheelCapture:dv,onTouchMoveCapture:dv}),s=i[0],o=i[1],u=e.forwardProps,d=e.children,m=e.className,h=e.removeScrollBar,v=e.enabled,p=e.shards,x=e.sideCar,y=e.noRelative,w=e.noIsolation,C=e.inert,E=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,k=e.gapMode,R=FR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=x,L=wP([r,t]),z=Vn(Vn({},R),s);return g.createElement(g.Fragment,null,v&&g.createElement(M,{sideCar:qR,removeScrollBar:h,shards:p,noRelative:y,noIsolation:w,inert:C,setCallbacks:o,allowPinchZoom:!!E,lockRef:r,gapMode:k}),u?g.cloneElement(g.Children.only(d),Vn(Vn({},z),{ref:L})):g.createElement(N,Vn({},z,{className:m,ref:L}),d))});sm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};sm.classNames={fullWidth:lf,zeroRight:of};var kP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kP();return t&&e.setAttribute("nonce",t),e}function AP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var MP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=NP())&&(AP(t,r),TP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jP=function(){var e=MP();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},VR=function(){var e=jP(),t=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return t},DP={left:0,top:0,right:0,gap:0},hv=function(e){return parseInt(e||"",10)||0},LP=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[hv(r),hv(i),hv(s)]},OP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return DP;var t=LP(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-r+t[2]-t[0])}},BP=VR(),ql="data-scroll-locked",PP=function(e,t,r,i){var s=e.left,o=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
491
+ .`.concat(_P,` {
492
+ overflow: hidden `).concat(i,`;
493
+ padding-right: `).concat(d,"px ").concat(i,`;
494
+ }
495
+ body[`).concat(ql,`] {
496
+ overflow: hidden `).concat(i,`;
497
+ overscroll-behavior: contain;
498
+ `).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&`
499
+ padding-left: `.concat(s,`px;
500
+ padding-top: `).concat(o,`px;
501
+ padding-right: `).concat(u,`px;
502
+ margin-left:0;
503
+ margin-top:0;
504
+ margin-right: `).concat(d,"px ").concat(i,`;
505
+ `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),`
506
+ }
507
+
508
+ .`).concat(of,` {
509
+ right: `).concat(d,"px ").concat(i,`;
510
+ }
511
+
512
+ .`).concat(lf,` {
513
+ margin-right: `).concat(d,"px ").concat(i,`;
514
+ }
515
+
516
+ .`).concat(of," .").concat(of,` {
517
+ right: 0 `).concat(i,`;
518
+ }
519
+
520
+ .`).concat(lf," .").concat(lf,` {
521
+ margin-right: 0 `).concat(i,`;
522
+ }
523
+
524
+ body[`).concat(ql,`] {
525
+ `).concat(xP,": ").concat(d,`px;
526
+ }
527
+ `)},xC=function(){var e=parseInt(document.body.getAttribute(ql)||"0",10);return isFinite(e)?e:0},IP=function(){g.useEffect(function(){return document.body.setAttribute(ql,(xC()+1).toString()),function(){var e=xC()-1;e<=0?document.body.removeAttribute(ql):document.body.setAttribute(ql,e.toString())}},[])},zP=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;IP();var o=g.useMemo(function(){return OP(s)},[s]);return g.createElement(BP,{styles:PP(o,!t,s,r?"":"!important")})},H_=!1;if(typeof window<"u")try{var Lh=Object.defineProperty({},"passive",{get:function(){return H_=!0,!0}});window.addEventListener("test",Lh,Lh),window.removeEventListener("test",Lh,Lh)}catch{H_=!1}var Nl=H_?{passive:!1}:!1,$P=function(e){return e.tagName==="TEXTAREA"},GR=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!$P(e)&&r[t]==="visible")},UP=function(e){return GR(e,"overflowY")},HP=function(e){return GR(e,"overflowX")},yC=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=YR(e,i);if(s){var o=KR(e,i),u=o[1],d=o[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},FP=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},WP=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},YR=function(e,t){return e==="v"?UP(t):HP(t)},KR=function(e,t){return e==="v"?FP(t):WP(t)},qP=function(e,t){return e==="h"&&t==="rtl"?-1:1},VP=function(e,t,r,i,s){var o=qP(e,window.getComputedStyle(t).direction),u=o*i,d=r.target,m=t.contains(d),h=!1,v=u>0,p=0,x=0;do{if(!d)break;var y=KR(e,d),w=y[0],C=y[1],E=y[2],S=C-E-o*w;(w||S)&&YR(e,d)&&(p+=S,x+=w);var N=d.parentNode;d=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(v&&Math.abs(p)<1||!v&&Math.abs(x)<1)&&(h=!0),h},Oh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bC=function(e){return[e.deltaX,e.deltaY]},wC=function(e){return e&&"current"in e?e.current:e},GP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},YP=function(e){return`
528
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
529
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
530
+ `)},KP=0,Al=[];function XP(e){var t=g.useRef([]),r=g.useRef([0,0]),i=g.useRef(),s=g.useState(KP++)[0],o=g.useState(VR)[0],u=g.useRef(e);g.useEffect(function(){u.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var C=vP([e.lockRef.current],(e.shards||[]).map(wC),!0).filter(Boolean);return C.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=g.useCallback(function(C,E){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var S=Oh(C),N=r.current,k="deltaX"in C?C.deltaX:N[0]-S[0],R="deltaY"in C?C.deltaY:N[1]-S[1],M,L=C.target,z=Math.abs(k)>Math.abs(R)?"h":"v";if("touches"in C&&z==="h"&&L.type==="range")return!1;var D=window.getSelection(),W=D&&D.anchorNode,G=W?W===L||W.contains(L):!1;if(G)return!1;var q=yC(z,L);if(!q)return!0;if(q?M=z:(M=z==="v"?"h":"v",q=yC(z,L)),!q)return!1;if(!i.current&&"changedTouches"in C&&(k||R)&&(i.current=M),!M)return!0;var B=i.current||M;return VP(B,E,C,B==="h"?k:R)},[]),m=g.useCallback(function(C){var E=C;if(!(!Al.length||Al[Al.length-1]!==o)){var S="deltaY"in E?bC(E):Oh(E),N=t.current.filter(function(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&GP(M.delta,S)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(u.current.shards||[]).map(wC).filter(Boolean).filter(function(M){return M.contains(E.target)}),R=k.length>0?d(E,k[0]):!u.current.noIsolation;R&&E.cancelable&&E.preventDefault()}}},[]),h=g.useCallback(function(C,E,S,N){var k={name:C,delta:E,target:S,should:N,shadowParent:ZP(S)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(R){return R!==k})},1)},[]),v=g.useCallback(function(C){r.current=Oh(C),i.current=void 0},[]),p=g.useCallback(function(C){h(C.type,bC(C),C.target,d(C,e.lockRef.current))},[]),x=g.useCallback(function(C){h(C.type,Oh(C),C.target,d(C,e.lockRef.current))},[]);g.useEffect(function(){return Al.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Nl),document.addEventListener("touchmove",m,Nl),document.addEventListener("touchstart",v,Nl),function(){Al=Al.filter(function(C){return C!==o}),document.removeEventListener("wheel",m,Nl),document.removeEventListener("touchmove",m,Nl),document.removeEventListener("touchstart",v,Nl)}},[]);var y=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(o,{styles:YP(s)}):null,y?g.createElement(zP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ZP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const QP=RP(qR,XP);var am=g.forwardRef(function(e,t){return g.createElement(sm,Vn({},e,{ref:t,sideCar:QP}))});am.classNames=sm.classNames;var JP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Tl=new WeakMap,Bh=new WeakMap,Ph={},fv=0,XR=function(e){return e&&(e.host||XR(e.parentNode))},eI=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=XR(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},tI=function(e,t,r,i){var s=eI(t,Array.isArray(e)?e:[e]);Ph[r]||(Ph[r]=new WeakMap);var o=Ph[r],u=[],d=new Set,m=new Set(s),h=function(p){!p||d.has(p)||(d.add(p),h(p.parentNode))};s.forEach(h);var v=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(x){if(d.has(x))v(x);else try{var y=x.getAttribute(i),w=y!==null&&y!=="false",C=(Tl.get(x)||0)+1,E=(o.get(x)||0)+1;Tl.set(x,C),o.set(x,E),u.push(x),C===1&&w&&Bh.set(x,!0),E===1&&x.setAttribute(r,"true"),w||x.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return v(t),d.clear(),fv++,function(){u.forEach(function(p){var x=Tl.get(p)-1,y=o.get(p)-1;Tl.set(p,x),o.set(p,y),x||(Bh.has(p)||p.removeAttribute(i),Bh.delete(p)),y||p.removeAttribute(r)}),fv--,fv||(Tl=new WeakMap,Tl=new WeakMap,Bh=new WeakMap,Ph={})}},Px=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=JP(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),tI(i,s,r,"aria-hidden")):function(){return null}},om="Dialog",[ZR,QR]=Sn(om),[rI,En]=ZR(om),Ix=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:u=!0}=e,d=g.useRef(null),m=g.useRef(null),[h,v]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:om});return l.jsx(rI,{scope:t,triggerRef:d,contentRef:m,contentId:vn(),titleId:vn(),descriptionId:vn(),open:h,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(p=>!p),[v]),modal:u,children:r})};Ix.displayName=om;var JR="DialogTrigger",lm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(JR,r),o=it(t,s.triggerRef);return l.jsx(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ux(s.open),...i,ref:o,onClick:Le(e.onClick,s.onOpenToggle)})});lm.displayName=JR;var zx="DialogPortal",[iI,ek]=ZR(zx,{forceMount:void 0}),$x=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:s}=e,o=En(zx,t);return l.jsx(iI,{scope:t,forceMount:r,children:g.Children.map(i,u=>l.jsx(Cn,{present:r||o.open,children:l.jsx(nm,{asChild:!0,container:s,children:u})}))})};$x.displayName=zx;var Nf="DialogOverlay",cm=g.forwardRef((e,t)=>{const r=ek(Nf,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=En(Nf,e.__scopeDialog);return o.modal?l.jsx(Cn,{present:i||o.open,children:l.jsx(sI,{...s,ref:t})}):null});cm.displayName=Nf;var nI=Ro("DialogOverlay.RemoveScroll"),sI=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(Nf,r),o=tP(),u=it(t,o);return l.jsx(am,{as:nI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Ve.div,{"data-state":Ux(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Xl="DialogContent",um=g.forwardRef((e,t)=>{const r=ek(Xl,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=En(Xl,e.__scopeDialog);return l.jsx(Cn,{present:i||o.open,children:o.modal?l.jsx(aI,{...s,ref:t}):l.jsx(oI,{...s,ref:t})})});um.displayName=Xl;var aI=g.forwardRef((e,t)=>{const r=En(Xl,e.__scopeDialog),i=g.useRef(null),s=it(t,r.contentRef,i);return g.useEffect(()=>{const o=i.current;if(o)return Px(o)},[]),l.jsx(tk,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Le(e.onCloseAutoFocus,o=>{var u;o.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Le(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&o.preventDefault()}),onFocusOutside:Le(e.onFocusOutside,o=>o.preventDefault())})}),oI=g.forwardRef((e,t)=>{const r=En(Xl,e.__scopeDialog),i=g.useRef(!1),s=g.useRef(!1);return l.jsx(tk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,o),o.defaultPrevented||(i.current||(d=r.triggerRef.current)==null||d.focus(),o.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=o.target;((h=r.triggerRef.current)==null?void 0:h.contains(u))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),tk=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,...u}=e,d=En(Xl,r);return Bx(),l.jsx(l.Fragment,{children:l.jsx(im,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(rm,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Ux(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),rk="DialogTitle",dm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(rk,r);return l.jsx(Ve.h2,{id:s.titleId,...i,ref:t})});dm.displayName=rk;var ik="DialogDescription",hm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(ik,r);return l.jsx(Ve.p,{id:s.descriptionId,...i,ref:t})});hm.displayName=ik;var nk="DialogClose",Do=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(nk,r);return l.jsx(Ve.button,{type:"button",...i,ref:t,onClick:Le(e.onClick,()=>s.onOpenChange(!1))})});Do.displayName=nk;function Ux(e){return e?"open":"closed"}var sk="AlertDialog",[lI]=Sn(sk,[QR]),Ps=QR(),ak=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx(Ix,{...i,...r,modal:!0})};ak.displayName=sk;var cI="AlertDialogTrigger",ok=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(lm,{...s,...i,ref:t})});ok.displayName=cI;var uI="AlertDialogPortal",lk=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx($x,{...i,...r})};lk.displayName=uI;var dI="AlertDialogOverlay",ck=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(cm,{...s,...i,ref:t})});ck.displayName=dI;var uk="AlertDialogContent",[hI,fI]=lI(uk),dk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...s}=e,o=Ps(r),u=g.useRef(null),d=it(t,u),m=g.useRef(null);return l.jsx(hI,{scope:r,cancelRef:m,children:l.jsx(um,{role:"alertdialog",...o,...s,ref:d,onOpenAutoFocus:Le(s.onOpenAutoFocus,h=>{var v;h.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:i})})});dk.displayName=uk;var mI="AlertDialogTitle",hk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(dm,{...s,...i,ref:t})});hk.displayName=mI;var pI="AlertDialogDescription",fk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(hm,{...s,...i,ref:t})});fk.displayName=pI;var gI="AlertDialogAction",mk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(Do,{...s,...i,ref:t})});mk.displayName=gI;var pk="AlertDialogCancel",gk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:s}=fI(pk,r),o=Ps(r),u=it(t,s);return l.jsx(Do,{...o,...i,ref:u})});gk.displayName=pk;var vI=ak,vk=ok,_I=lk,_k=ck,xk=dk,yk=mk,bk=gk,wk=hk,Sk=fk;function Ck(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ck(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function Hx(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ck(e))&&(i&&(i+=" "),i+=t);return i}const xI=(e,t)=>{const r=new Array(e.length+t.length);for(let i=0;i<e.length;i++)r[i]=e[i];for(let i=0;i<t.length;i++)r[e.length+i]=t[i];return r},yI=(e,t)=>({classGroupId:e,validator:t}),Ek=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Af="-",SC=[],bI="arbitrary..",wI=e=>{const t=CI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return SI(u);const d=u.split(Af),m=d[0]===""&&d.length>1?1:0;return Rk(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],h=r[u];return m?h?xI(h,m):m:h||SC}return r[u]||SC}}},Rk=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],o=r.nextPart.get(s);if(o){const h=Rk(e,t+1,o);if(h)return h}const u=r.validators;if(u===null)return;const d=t===0?e.join(Af):e.slice(t).join(Af),m=u.length;for(let h=0;h<m;h++){const v=u[h];if(v.validator(d))return v.classGroupId}},SI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),i=t.slice(0,r);return i?bI+i:void 0})(),CI=e=>{const{theme:t,classGroups:r}=e;return EI(r,t)},EI=(e,t)=>{const r=Ek();for(const i in e){const s=e[i];Fx(s,r,i,t)}return r},Fx=(e,t,r,i)=>{const s=e.length;for(let o=0;o<s;o++){const u=e[o];RI(u,t,r,i)}},RI=(e,t,r,i)=>{if(typeof e=="string"){kI(e,t,r);return}if(typeof e=="function"){NI(e,t,r,i);return}AI(e,t,r,i)},kI=(e,t,r)=>{const i=e===""?t:kk(t,e);i.classGroupId=r},NI=(e,t,r,i)=>{if(TI(e)){Fx(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(yI(r,e))},AI=(e,t,r,i)=>{const s=Object.entries(e),o=s.length;for(let u=0;u<o;u++){const[d,m]=s[u];Fx(m,kk(t,d),r,i)}},kk=(e,t)=>{let r=e;const i=t.split(Af),s=i.length;for(let o=0;o<s;o++){const u=i[o];let d=r.nextPart.get(u);d||(d=Ek(),r.nextPart.set(u,d)),r=d}return r},TI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,MI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const s=(o,u)=>{r[o]=u,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(o){let u=r[o];if(u!==void 0)return u;if((u=i[o])!==void 0)return s(o,u),u},set(o,u){o in r?r[o]=u:s(o,u)}}},F_="!",CC=":",jI=[],EC=(e,t,r,i,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),DI=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=s=>{const o=[];let u=0,d=0,m=0,h;const v=s.length;for(let C=0;C<v;C++){const E=s[C];if(u===0&&d===0){if(E===CC){o.push(s.slice(m,C)),m=C+1;continue}if(E==="/"){h=C;continue}}E==="["?u++:E==="]"?u--:E==="("?d++:E===")"&&d--}const p=o.length===0?s:s.slice(m);let x=p,y=!1;p.endsWith(F_)?(x=p.slice(0,-1),y=!0):p.startsWith(F_)&&(x=p.slice(1),y=!0);const w=h&&h>m?h-m:void 0;return EC(o,y,x,w)};if(t){const s=t+CC,o=i;i=u=>u.startsWith(s)?o(u.slice(s.length)):EC(jI,!1,u,void 0,!0)}if(r){const s=i;i=o=>r({className:o,parseClassName:s})}return i},LI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let s=[];for(let o=0;o<r.length;o++){const u=r[o],d=u[0]==="[",m=t.has(u);d||m?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(u)):s.push(u)}return s.length>0&&(s.sort(),i.push(...s)),i}},OI=e=>({cache:MI(e.cacheSize),parseClassName:DI(e),sortModifiers:LI(e),postfixLookupClassGroupIds:BI(e),...wI(e)}),BI=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i<r.length;i++)t[r[i]]=!0;return t},PI=/\s+/,II=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(PI);let h="";for(let v=m.length-1;v>=0;v-=1){const p=m[v],{isExternal:x,modifiers:y,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:E}=r(p);if(x){h=p+(h.length>0?" "+h:h);continue}let S=!!E,N;if(S){const z=C.substring(0,E);N=i(z);const D=N&&u[N]?i(C):void 0;D&&D!==N&&(N=D,S=!1)}else N=i(C);if(!N){if(!S){h=p+(h.length>0?" "+h:h);continue}if(N=i(C),!N){h=p+(h.length>0?" "+h:h);continue}S=!1}const k=y.length===0?"":y.length===1?y[0]:o(y).join(":"),R=w?k+F_:k,M=R+N;if(d.indexOf(M)>-1)continue;d.push(M);const L=s(N,S);for(let z=0;z<L.length;++z){const D=L[z];d.push(R+D)}h=p+(h.length>0?" "+h:h)}return h},zI=(...e)=>{let t=0,r,i,s="";for(;t<e.length;)(r=e[t++])&&(i=Nk(r))&&(s&&(s+=" "),s+=i);return s},Nk=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=Nk(e[i]))&&(r&&(r+=" "),r+=t);return r},$I=(e,...t)=>{let r,i,s,o;const u=m=>{const h=t.reduce((v,p)=>p(v),e());return r=OI(h),i=r.cache.get,s=r.cache.set,o=d,d(m)},d=m=>{const h=i(m);if(h)return h;const v=II(m,r);return s(m,v),v};return o=u,(...m)=>o(zI(...m))},UI=[],hr=e=>{const t=r=>r[e]||UI;return t.isThemeGetter=!0,t},Ak=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,HI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,FI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,WI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,GI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=e=>HI.test(e),et=e=>!!e&&!Number.isNaN(Number(e)),Pn=e=>!!e&&Number.isInteger(Number(e)),mv=e=>e.endsWith("%")&&et(e.slice(0,-1)),Cs=e=>FI.test(e),Mk=()=>!0,YI=e=>WI.test(e)&&!qI.test(e),Wx=()=>!1,KI=e=>VI.test(e),XI=e=>GI.test(e),ZI=e=>!Te(e)&&!Me(e),QI=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),JI=e=>za(e,Lk,Wx),Te=e=>Ak.test(e),lo=e=>za(e,Ok,YI),RC=e=>za(e,o8,et),e8=e=>za(e,Pk,Mk),t8=e=>za(e,Bk,Wx),kC=e=>za(e,jk,Wx),r8=e=>za(e,Dk,XI),Ih=e=>za(e,Ik,KI),Me=e=>Tk.test(e),nu=e=>Lo(e,Ok),i8=e=>Lo(e,Bk),NC=e=>Lo(e,jk),n8=e=>Lo(e,Lk),s8=e=>Lo(e,Dk),zh=e=>Lo(e,Ik,!0),a8=e=>Lo(e,Pk,!0),za=(e,t,r)=>{const i=Ak.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Lo=(e,t,r=!1)=>{const i=Tk.exec(e);return i?i[1]?t(i[1]):r:!1},jk=e=>e==="position"||e==="percentage",Dk=e=>e==="image"||e==="url",Lk=e=>e==="length"||e==="size"||e==="bg-size",Ok=e=>e==="length",o8=e=>e==="number",Bk=e=>e==="family-name",Pk=e=>e==="number"||e==="weight",Ik=e=>e==="shadow",l8=()=>{const e=hr("color"),t=hr("font"),r=hr("text"),i=hr("font-weight"),s=hr("tracking"),o=hr("leading"),u=hr("breakpoint"),d=hr("container"),m=hr("spacing"),h=hr("radius"),v=hr("shadow"),p=hr("inset-shadow"),x=hr("text-shadow"),y=hr("drop-shadow"),w=hr("blur"),C=hr("perspective"),E=hr("aspect"),S=hr("ease"),N=hr("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...R(),Me,Te],L=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],D=()=>[Me,Te,m],W=()=>[fa,"full","auto",...D()],G=()=>[Pn,"none","subgrid",Me,Te],q=()=>["auto",{span:["full",Pn,Me,Te]},Pn,Me,Te],B=()=>[Pn,"auto",Me,Te],j=()=>["auto","min","max","fr",Me,Te],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...D()],U=()=>[fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],H=()=>[fa,"screen","full","dvw","lvw","svw","min","max","fit",...D()],F=()=>[fa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],V=()=>[e,Me,Te],I=()=>[...R(),NC,kC,{position:[Me,Te]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",n8,JI,{size:[Me,Te]}],ee=()=>[mv,nu,lo],re=()=>["","none","full",h,Me,Te],oe=()=>["",et,nu,lo],Z=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[et,mv,NC,kC],we=()=>["","none",w,Me,Te],xe=()=>["none",et,Me,Te],ye=()=>["none",et,Me,Te],J=()=>[et,Me,Te],ie=()=>[fa,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Cs],breakpoint:[Cs],color:[Mk],container:[Cs],"drop-shadow":[Cs],ease:["in","out","in-out"],font:[ZI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Cs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Cs],shadow:[Cs],spacing:["px",et],text:[Cs],"text-shadow":[Cs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fa,Te,Me,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Me,Te]}],"container-named":[QI],columns:[{columns:[et,Te,Me,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{"inset-s":W(),start:W()}],end:[{"inset-e":W(),end:W()}],"inset-bs":[{"inset-bs":W()}],"inset-be":[{"inset-be":W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Pn,"auto",Me,Te]}],basis:[{basis:[fa,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[et,fa,"auto","initial","none",Te]}],grow:[{grow:["",et,Me,Te]}],shrink:[{shrink:["",et,Me,Te]}],order:[{order:[Pn,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[d,"screen",...U()]}],"min-w":[{"min-w":[d,"screen","none",...U()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,nu,lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,a8,e8]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mv,Te]}],"font-family":[{font:[i8,t8,t]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Me,Te]}],"line-clamp":[{"line-clamp":[et,"none",Me,RC]}],leading:[{leading:[o,...D()]}],"list-image":[{"list-image":["none",Me,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[et,"from-font","auto",Me,lo]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[et,"auto",Me,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[Pn,Me,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Pn,Me,Te],radial:["",Me,Te],conic:[Pn,Me,Te]},s8,r8]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[et,Me,Te]}],"outline-w":[{outline:["",et,nu,lo]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",v,zh,Ih]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,zh,Ih]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[et,lo]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",x,zh,Ih]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[et,Me,Te]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[et]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Me,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[et]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Te]}],filter:[{filter:["","none",Me,Te]}],blur:[{blur:we()}],brightness:[{brightness:[et,Me,Te]}],contrast:[{contrast:[et,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",y,zh,Ih]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",et,Me,Te]}],"hue-rotate":[{"hue-rotate":[et,Me,Te]}],invert:[{invert:["",et,Me,Te]}],saturate:[{saturate:[et,Me,Te]}],sepia:[{sepia:["",et,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[et,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[et,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",et,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[et,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",et,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[et,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[et,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",et,Me,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[et,"initial",Me,Te]}],ease:[{ease:["linear","initial",S,Me,Te]}],delay:[{delay:[et,Me,Te]}],animate:[{animate:["none",N,Me,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Me,Te]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[Me,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":["translate-none"],zoom:[{zoom:[Pn,Me,Te]}],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":V()}],"scrollbar-track-color":[{"scrollbar-track":V()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Te]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[et,nu,lo,RC]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},zk=$I(l8);function ct(...e){return zk(Hx(e))}const AC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,TC=Hx,$k=(e,t)=>r=>{var i;if((t==null?void 0:t.variants)==null)return TC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,u=Object.keys(s).map(h=>{const v=r==null?void 0:r[h],p=o==null?void 0:o[h];if(v===null)return null;const x=AC(v)||AC(p);return s[h][x]}),d=r&&Object.entries(r).reduce((h,v)=>{let[p,x]=v;return x===void 0||(h[p]=x),h},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((h,v)=>{let{class:p,className:x,...y}=v;return Object.entries(y).every(w=>{let[C,E]=w;return Array.isArray(E)?E.includes({...o,...d}[C]):{...o,...d}[C]===E})?[...h,p,x]:h},[]);return TC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},c8=$k("group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)]","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),he=g.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...s},o)=>{const u=i?z6:"button";return l.jsx(u,{ref:o,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:ct(c8({variant:t,size:r,className:e})),...s})});he.displayName="Button";function Rn(e){return l.jsx(vI,{"data-slot":"alert-dialog",...e})}const es=g.forwardRef((e,t)=>l.jsx(vk,{ref:t,"data-slot":"alert-dialog-trigger",...e}));es.displayName=vk.displayName;function u8(e){return l.jsx(_I,{"data-slot":"alert-dialog-portal",...e})}const Uk=g.forwardRef(({className:e,...t},r)=>l.jsx(_k,{ref:r,"data-slot":"alert-dialog-overlay",className:ct("fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));Uk.displayName=_k.displayName;const Ji=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsxs(u8,{children:[l.jsx(Uk,{}),l.jsx(xk,{ref:i,"data-slot":"alert-dialog-content","data-size":t,className:ct("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));Ji.displayName=xk.displayName;function kn({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:ct("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Nn({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function d8({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-media",className:ct("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",e),...t})}const en=g.forwardRef(({className:e,...t},r)=>l.jsx(wk,{ref:r,"data-slot":"alert-dialog-title",className:ct("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));en.displayName=wk.displayName;const tn=g.forwardRef(({className:e,...t},r)=>l.jsx(Sk,{ref:r,"data-slot":"alert-dialog-description",className:ct("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));tn.displayName=Sk.displayName;const An=g.forwardRef(({className:e,variant:t="default",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(yk,{ref:s,"data-slot":"alert-dialog-action",className:ct(e),...i})}));An.displayName=yk.displayName;const rn=g.forwardRef(({className:e,variant:t="outline",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(bk,{ref:s,"data-slot":"alert-dialog-cancel",className:ct(e),...i})}));rn.displayName=bk.displayName;function Oo(e){return l.jsx(Ix,{"data-slot":"dialog",...e})}const Hk=g.forwardRef((e,t)=>l.jsx(lm,{ref:t,"data-slot":"dialog-trigger",...e}));Hk.displayName=lm.displayName;function h8(e){return l.jsx($x,{"data-slot":"dialog-portal",...e})}const td=g.forwardRef((e,t)=>l.jsx(Do,{ref:t,"data-slot":"dialog-close",...e}));td.displayName=Do.displayName;const Fk=g.forwardRef(({className:e,...t},r)=>l.jsx(cm,{ref:r,"data-slot":"dialog-overlay",className:ct("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));Fk.displayName=cm.displayName;const $a=g.forwardRef(({className:e,children:t,showCloseButton:r=!0,...i},s)=>l.jsxs(h8,{children:[l.jsx(Fk,{}),l.jsxs(um,{ref:s,"data-slot":"dialog-content",className:ct("fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...i,children:[t,r&&l.jsx(Do,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(he,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[l.jsx(Na,{"aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));$a.displayName=um.displayName;function Bo({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:ct("flex flex-col gap-2",e),...t})}function rd({className:e,showCloseButton:t=!1,children:r,...i}){return l.jsxs("div",{"data-slot":"dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...i,children:[r,t&&l.jsx(Do,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Close"})})]})}const Ua=g.forwardRef(({className:e,...t},r)=>l.jsx(dm,{ref:r,"data-slot":"dialog-title",className:ct("text-base leading-none font-medium",e),...t}));Ua.displayName=dm.displayName;const fm=g.forwardRef(({className:e,...t},r)=>l.jsx(hm,{ref:r,"data-slot":"dialog-description",className:ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));fm.displayName=hm.displayName;function qx(e){const t=e+"CollectionProvider",[r,i]=Sn(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:E,children:S}=C,N=g.useRef(null),k=g.useRef(new Map).current;return l.jsx(s,{scope:E,itemMap:k,collectionRef:N,children:S})};u.displayName=t;const d=e+"CollectionSlot",m=Ro(d),h=g.forwardRef((C,E)=>{const{scope:S,children:N}=C,k=o(d,S),R=it(E,k.collectionRef);return l.jsx(m,{ref:R,children:N})});h.displayName=d;const v=e+"CollectionItemSlot",p="data-radix-collection-item",x=Ro(v),y=g.forwardRef((C,E)=>{const{scope:S,children:N,...k}=C,R=g.useRef(null),M=it(E,R),L=o(v,S);return g.useEffect(()=>(L.itemMap.set(R,{ref:R,...k}),()=>void L.itemMap.delete(R))),l.jsx(x,{[p]:"",ref:M,children:N})});y.displayName=v;function w(C){const E=o(e+"CollectionConsumer",C);return g.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(E.itemMap.values()).sort((L,z)=>k.indexOf(L.ref.current)-k.indexOf(z.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:h,ItemSlot:y},w,i]}var f8=g.createContext(void 0);function id(e){const t=g.useContext(f8);return e||t||"ltr"}const m8=["top","right","bottom","left"],Aa=Math.min,Ai=Math.max,Tf=Math.round,$h=Math.floor,Kn=e=>({x:e,y:e}),p8={left:"right",right:"left",bottom:"top",top:"bottom"};function W_(e,t,r){return Ai(e,Aa(t,r))}function Ls(e,t){return typeof e=="function"?e(t):e}function Os(e){return e.split("-")[0]}function rc(e){return e.split("-")[1]}function Vx(e){return e==="x"?"y":"x"}function Gx(e){return e==="y"?"height":"width"}function Gn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Yx(e){return Vx(Gn(e))}function g8(e,t,r){r===void 0&&(r=!1);const i=rc(e),s=Yx(e),o=Gx(s);let u=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(u=Mf(u)),[u,Mf(u)]}function v8(e){const t=Mf(e);return[q_(e),t,q_(t)]}function q_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const MC=["left","right"],jC=["right","left"],_8=["top","bottom"],x8=["bottom","top"];function y8(e,t,r){switch(e){case"top":case"bottom":return r?t?jC:MC:t?MC:jC;case"left":case"right":return t?_8:x8;default:return[]}}function b8(e,t,r,i){const s=rc(e);let o=y8(Os(e),r==="start",i);return s&&(o=o.map(u=>u+"-"+s),t&&(o=o.concat(o.map(q_)))),o}function Mf(e){const t=Os(e);return p8[t]+e.slice(t.length)}function w8(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wk(e){return typeof e!="number"?w8(e):{top:e,right:e,bottom:e,left:e}}function jf(e){const{x:t,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:t,right:t+i,bottom:r+s,x:t,y:r}}function DC(e,t,r){let{reference:i,floating:s}=e;const o=Gn(t),u=Yx(t),d=Gx(u),m=Os(t),h=o==="y",v=i.x+i.width/2-s.width/2,p=i.y+i.height/2-s.height/2,x=i[d]/2-s[d]/2;let y;switch(m){case"top":y={x:v,y:i.y-s.height};break;case"bottom":y={x:v,y:i.y+i.height};break;case"right":y={x:i.x+i.width,y:p};break;case"left":y={x:i.x-s.width,y:p};break;default:y={x:i.x,y:i.y}}switch(rc(t)){case"start":y[u]-=x*(r&&h?-1:1);break;case"end":y[u]+=x*(r&&h?-1:1);break}return y}async function S8(e,t){var r;t===void 0&&(t={});const{x:i,y:s,platform:o,rects:u,elements:d,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:p="floating",altBoundary:x=!1,padding:y=0}=Ls(t,e),w=Wk(y),E=d[x?p==="floating"?"reference":"floating":p],S=jf(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(E)))==null||r?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:m})),N=p==="floating"?{x:i,y:s,width:u.floating.width,height:u.floating.height}:u.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d.floating)),R=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},M=jf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:N,offsetParent:k,strategy:m}):N);return{top:(S.top-M.top+w.top)/R.y,bottom:(M.bottom-S.bottom+w.bottom)/R.y,left:(S.left-M.left+w.left)/R.x,right:(M.right-S.right+w.right)/R.x}}const C8=50,E8=async(e,t,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:S8},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:v,y:p}=DC(h,i,m),x=i,y=0;const w={};for(let C=0;C<o.length;C++){const E=o[C];if(!E)continue;const{name:S,fn:N}=E,{x:k,y:R,data:M,reset:L}=await N({x:v,y:p,initialPlacement:i,placement:x,strategy:s,middlewareData:w,rects:h,platform:d,elements:{reference:e,floating:t}});v=k??v,p=R??p,w[S]={...w[S],...M},L&&y<C8&&(y++,typeof L=="object"&&(L.placement&&(x=L.placement),L.rects&&(h=L.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):L.rects),{x:v,y:p}=DC(h,x,m)),C=-1)}return{x:v,y:p,placement:x,strategy:s,middlewareData:w}},R8=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:s,rects:o,platform:u,elements:d,middlewareData:m}=t,{element:h,padding:v=0}=Ls(e,t)||{};if(h==null)return{};const p=Wk(v),x={x:r,y:i},y=Yx(s),w=Gx(y),C=await u.getDimensions(h),E=y==="y",S=E?"top":"left",N=E?"bottom":"right",k=E?"clientHeight":"clientWidth",R=o.reference[w]+o.reference[y]-x[y]-o.floating[w],M=x[y]-o.reference[y],L=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let z=L?L[k]:0;(!z||!await(u.isElement==null?void 0:u.isElement(L)))&&(z=d.floating[k]||o.floating[w]);const D=R/2-M/2,W=z/2-C[w]/2-1,G=Aa(p[S],W),q=Aa(p[N],W),B=G,j=z-C[w]-q,O=z/2-C[w]/2+D,$=W_(B,O,j),T=!m.arrow&&rc(s)!=null&&O!==$&&o.reference[w]/2-(O<B?G:q)-C[w]/2<0,U=T?O<B?O-B:O-j:0;return{[y]:x[y]+U,data:{[y]:$,centerOffset:O-$-U,...T&&{alignmentOffset:U}},reset:T}}}),k8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,i;const{placement:s,middlewareData:o,rects:u,initialPlacement:d,platform:m,elements:h}=t,{mainAxis:v=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...E}=Ls(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const S=Os(s),N=Gn(d),k=Os(d)===d,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=x||(k||!C?[Mf(d)]:v8(d)),L=w!=="none";!x&&L&&M.push(...b8(d,C,w,R));const z=[d,...M],D=await m.detectOverflow(t,E),W=[];let G=((i=o.flip)==null?void 0:i.overflows)||[];if(v&&W.push(D[S]),p){const O=g8(s,u,R);W.push(D[O[0]],D[O[1]])}if(G=[...G,{placement:s,overflows:W}],!W.every(O=>O<=0)){var q,B;const O=(((q=o.flip)==null?void 0:q.index)||0)+1,$=z[O];if($&&(!(p==="alignment"?N!==Gn($):!1)||G.every(H=>Gn(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:O,overflows:G},reset:{placement:$}};let T=(B=G.filter(U=>U.overflows[0]<=0).sort((U,H)=>U.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!T)switch(y){case"bestFit":{var j;const U=(j=G.filter(H=>{if(L){const F=Gn(H.placement);return F===N||F==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(F=>F>0).reduce((F,V)=>F+V,0)]).sort((H,F)=>H[1]-F[1])[0])==null?void 0:j[0];U&&(T=U);break}case"initialPlacement":T=d;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function LC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function OC(e){return m8.some(t=>e[t]>=0)}const N8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:s="referenceHidden",...o}=Ls(e,t);switch(s){case"referenceHidden":{const u=await i.detectOverflow(t,{...o,elementContext:"reference"}),d=LC(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:OC(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...o,altBoundary:!0}),d=LC(u,r.floating);return{data:{escapedOffsets:d,escaped:OC(d)}}}default:return{}}}}},qk=new Set(["left","top"]);async function A8(e,t){const{placement:r,platform:i,elements:s}=e,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),u=Os(r),d=rc(r),m=Gn(r)==="y",h=qk.has(u)?-1:1,v=o&&m?-1:1,p=Ls(t,e);let{mainAxis:x,crossAxis:y,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return d&&typeof w=="number"&&(y=d==="end"?w*-1:w),m?{x:y*v,y:x*h}:{x:x*h,y:y*v}}const T8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:s,y:o,placement:u,middlewareData:d}=t,m=await A8(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:u}}}}},M8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:s,platform:o}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:S=>{let{x:N,y:k}=S;return{x:N,y:k}}},...h}=Ls(e,t),v={x:r,y:i},p=await o.detectOverflow(t,h),x=Gn(Os(s)),y=Vx(x);let w=v[y],C=v[x];if(u){const S=y==="y"?"top":"left",N=y==="y"?"bottom":"right",k=w+p[S],R=w-p[N];w=W_(k,w,R)}if(d){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=C+p[S],R=C-p[N];C=W_(k,C,R)}const E=m.fn({...t,[y]:w,[x]:C});return{...E,data:{x:E.x-r,y:E.y-i,enabled:{[y]:u,[x]:d}}}}}},j8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:s,rects:o,middlewareData:u}=t,{offset:d=0,mainAxis:m=!0,crossAxis:h=!0}=Ls(e,t),v={x:r,y:i},p=Gn(s),x=Vx(p);let y=v[x],w=v[p];const C=Ls(d,t),E=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const k=x==="y"?"height":"width",R=o.reference[x]-o.floating[k]+E.mainAxis,M=o.reference[x]+o.reference[k]-E.mainAxis;y<R?y=R:y>M&&(y=M)}if(h){var S,N;const k=x==="y"?"width":"height",R=qk.has(Os(s)),M=o.reference[p]-o.floating[k]+(R&&((S=u.offset)==null?void 0:S[p])||0)+(R?0:E.crossAxis),L=o.reference[p]+o.reference[k]+(R?0:((N=u.offset)==null?void 0:N[p])||0)-(R?E.crossAxis:0);w<M?w=M:w>L&&(w=L)}return{[x]:y,[p]:w}}}},D8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:s,rects:o,platform:u,elements:d}=t,{apply:m=()=>{},...h}=Ls(e,t),v=await u.detectOverflow(t,h),p=Os(s),x=rc(s),y=Gn(s)==="y",{width:w,height:C}=o.floating;let E,S;p==="top"||p==="bottom"?(E=p,S=x===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(S=p,E=x==="end"?"top":"bottom");const N=C-v.top-v.bottom,k=w-v.left-v.right,R=Aa(C-v[E],N),M=Aa(w-v[S],k),L=!t.middlewareData.shift;let z=R,D=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(D=k),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(z=N),L&&!x){const G=Ai(v.left,0),q=Ai(v.right,0),B=Ai(v.top,0),j=Ai(v.bottom,0);y?D=w-2*(G!==0||q!==0?G+q:Ai(v.left,v.right)):z=C-2*(B!==0||j!==0?B+j:Ai(v.top,v.bottom))}await m({...t,availableWidth:D,availableHeight:z});const W=await u.getDimensions(d.floating);return w!==W.width||C!==W.height?{reset:{rects:!0}}:{}}}};function mm(){return typeof window<"u"}function ic(e){return Vk(e)?(e.nodeName||"").toLowerCase():"#document"}function Ti(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ts(e){var t;return(t=(Vk(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vk(e){return mm()?e instanceof Node||e instanceof Ti(e).Node:!1}function _n(e){return mm()?e instanceof Element||e instanceof Ti(e).Element:!1}function Is(e){return mm()?e instanceof HTMLElement||e instanceof Ti(e).HTMLElement:!1}function BC(e){return!mm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ti(e).ShadowRoot}function nd(e){const{overflow:t,overflowX:r,overflowY:i,display:s}=xn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&s!=="inline"&&s!=="contents"}function L8(e){return/^(table|td|th)$/.test(ic(e))}function pm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const O8=/transform|translate|scale|rotate|perspective|filter/,B8=/paint|layout|strict|content/,co=e=>!!e&&e!=="none";let pv;function Kx(e){const t=_n(e)?xn(e):e;return co(t.transform)||co(t.translate)||co(t.scale)||co(t.rotate)||co(t.perspective)||!Xx()&&(co(t.backdropFilter)||co(t.filter))||O8.test(t.willChange||"")||B8.test(t.contain||"")}function P8(e){let t=Ta(e);for(;Is(t)&&!Zl(t);){if(Kx(t))return t;if(pm(t))return null;t=Ta(t)}return null}function Xx(){return pv==null&&(pv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),pv}function Zl(e){return/^(html|body|#document)$/.test(ic(e))}function xn(e){return Ti(e).getComputedStyle(e)}function gm(e){return _n(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ta(e){if(ic(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BC(e)&&e.host||ts(e);return BC(t)?t.host:t}function Gk(e){const t=Ta(e);return Zl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&nd(t)?t:Gk(t)}function Iu(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Gk(e),o=s===((i=e.ownerDocument)==null?void 0:i.body),u=Ti(s);if(o){const d=V_(u);return t.concat(u,u.visualViewport||[],nd(s)?s:[],d&&r?Iu(d):[])}else return t.concat(s,Iu(s,[],r))}function V_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yk(e){const t=xn(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=Is(e),o=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=Tf(r)!==o||Tf(i)!==u;return d&&(r=o,i=u),{width:r,height:i,$:d}}function Zx(e){return _n(e)?e:e.contextElement}function Vl(e){const t=Zx(e);if(!Is(t))return Kn(1);const r=t.getBoundingClientRect(),{width:i,height:s,$:o}=Yk(t);let u=(o?Tf(r.width):r.width)/i,d=(o?Tf(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const I8=Kn(0);function Kk(e){const t=Ti(e);return!Xx()||!t.visualViewport?I8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function z8(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ti(e)?!1:t}function ko(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=Zx(e);let u=Kn(1);t&&(i?_n(i)&&(u=Vl(i)):u=Vl(e));const d=z8(o,r,i)?Kk(o):Kn(0);let m=(s.left+d.x)/u.x,h=(s.top+d.y)/u.y,v=s.width/u.x,p=s.height/u.y;if(o){const x=Ti(o),y=i&&_n(i)?Ti(i):i;let w=x,C=V_(w);for(;C&&i&&y!==w;){const E=Vl(C),S=C.getBoundingClientRect(),N=xn(C),k=S.left+(C.clientLeft+parseFloat(N.paddingLeft))*E.x,R=S.top+(C.clientTop+parseFloat(N.paddingTop))*E.y;m*=E.x,h*=E.y,v*=E.x,p*=E.y,m+=k,h+=R,w=Ti(C),C=V_(w)}}return jf({width:v,height:p,x:m,y:h})}function vm(e,t){const r=gm(e).scrollLeft;return t?t.left+r:ko(ts(e)).left+r}function Xk(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-vm(e,r),s=r.top+t.scrollTop;return{x:i,y:s}}function $8(e){let{elements:t,rect:r,offsetParent:i,strategy:s}=e;const o=s==="fixed",u=ts(i),d=t?pm(t.floating):!1;if(i===u||d&&o)return r;let m={scrollLeft:0,scrollTop:0},h=Kn(1);const v=Kn(0),p=Is(i);if((p||!p&&!o)&&((ic(i)!=="body"||nd(u))&&(m=gm(i)),p)){const y=ko(i);h=Vl(i),v.x=y.x+i.clientLeft,v.y=y.y+i.clientTop}const x=u&&!p&&!o?Xk(u,m):Kn(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+v.x+x.x,y:r.y*h.y-m.scrollTop*h.y+v.y+x.y}}function U8(e){return Array.from(e.getClientRects())}function H8(e){const t=ts(e),r=gm(e),i=e.ownerDocument.body,s=Ai(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=Ai(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+vm(e);const d=-r.scrollTop;return xn(i).direction==="rtl"&&(u+=Ai(t.clientWidth,i.clientWidth)-s),{width:s,height:o,x:u,y:d}}const PC=25;function F8(e,t){const r=Ti(e),i=ts(e),s=r.visualViewport;let o=i.clientWidth,u=i.clientHeight,d=0,m=0;if(s){o=s.width,u=s.height;const v=Xx();(!v||v&&t==="fixed")&&(d=s.offsetLeft,m=s.offsetTop)}const h=vm(i);if(h<=0){const v=i.ownerDocument,p=v.body,x=getComputedStyle(p),y=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-y);w<=PC&&(o-=w)}else h<=PC&&(o+=h);return{width:o,height:u,x:d,y:m}}function W8(e,t){const r=ko(e,!0,t==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,o=Is(e)?Vl(e):Kn(1),u=e.clientWidth*o.x,d=e.clientHeight*o.y,m=s*o.x,h=i*o.y;return{width:u,height:d,x:m,y:h}}function IC(e,t,r){let i;if(t==="viewport")i=F8(e,r);else if(t==="document")i=H8(ts(e));else if(_n(t))i=W8(t,r);else{const s=Kk(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return jf(i)}function Zk(e,t){const r=Ta(e);return r===t||!_n(r)||Zl(r)?!1:xn(r).position==="fixed"||Zk(r,t)}function q8(e,t){const r=t.get(e);if(r)return r;let i=Iu(e,[],!1).filter(d=>_n(d)&&ic(d)!=="body"),s=null;const o=xn(e).position==="fixed";let u=o?Ta(e):e;for(;_n(u)&&!Zl(u);){const d=xn(u),m=Kx(u);!m&&d.position==="fixed"&&(s=null),(o?!m&&!s:!m&&d.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||nd(u)&&!m&&Zk(e,u))?i=i.filter(v=>v!==u):s=d,u=Ta(u)}return t.set(e,i),i}function V8(e){let{element:t,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?pm(t)?[]:q8(t,this._c):[].concat(r),i],d=IC(t,u[0],s);let m=d.top,h=d.right,v=d.bottom,p=d.left;for(let x=1;x<u.length;x++){const y=IC(t,u[x],s);m=Ai(y.top,m),h=Aa(y.right,h),v=Aa(y.bottom,v),p=Ai(y.left,p)}return{width:h-p,height:v-m,x:p,y:m}}function G8(e){const{width:t,height:r}=Yk(e);return{width:t,height:r}}function Y8(e,t,r){const i=Is(t),s=ts(t),o=r==="fixed",u=ko(e,!0,o,t);let d={scrollLeft:0,scrollTop:0};const m=Kn(0);function h(){m.x=vm(s)}if(i||!i&&!o)if((ic(t)!=="body"||nd(s))&&(d=gm(t)),i){const y=ko(t,!0,o,t);m.x=y.x+t.clientLeft,m.y=y.y+t.clientTop}else s&&h();o&&!i&&s&&h();const v=s&&!i&&!o?Xk(s,d):Kn(0),p=u.left+d.scrollLeft-m.x-v.x,x=u.top+d.scrollTop-m.y-v.y;return{x:p,y:x,width:u.width,height:u.height}}function gv(e){return xn(e).position==="static"}function zC(e,t){if(!Is(e)||xn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ts(e)===r&&(r=r.ownerDocument.body),r}function Qk(e,t){const r=Ti(e);if(pm(e))return r;if(!Is(e)){let s=Ta(e);for(;s&&!Zl(s);){if(_n(s)&&!gv(s))return s;s=Ta(s)}return r}let i=zC(e,t);for(;i&&L8(i)&&gv(i);)i=zC(i,t);return i&&Zl(i)&&gv(i)&&!Kx(i)?r:i||P8(e)||r}const K8=async function(e){const t=this.getOffsetParent||Qk,r=this.getDimensions,i=await r(e.floating);return{reference:Y8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function X8(e){return xn(e).direction==="rtl"}const Z8={convertOffsetParentRelativeRectToViewportRelativeRect:$8,getDocumentElement:ts,getClippingRect:V8,getOffsetParent:Qk,getElementRects:K8,getClientRects:U8,getDimensions:G8,getScale:Vl,isElement:_n,isRTL:X8};function Jk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Q8(e,t){let r=null,i;const s=ts(e);function o(){var d;clearTimeout(i),(d=r)==null||d.disconnect(),r=null}function u(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),o();const h=e.getBoundingClientRect(),{left:v,top:p,width:x,height:y}=h;if(d||t(),!x||!y)return;const w=$h(p),C=$h(s.clientWidth-(v+x)),E=$h(s.clientHeight-(p+y)),S=$h(v),k={rootMargin:-w+"px "+-C+"px "+-E+"px "+-S+"px",threshold:Ai(0,Aa(1,m))||1};let R=!0;function M(L){const z=L[0].intersectionRatio;if(z!==m){if(!R)return u();z?u(!1,z):i=setTimeout(()=>{u(!1,1e-7)},1e3)}z===1&&!Jk(h,e.getBoundingClientRect())&&u(),R=!1}try{r=new IntersectionObserver(M,{...k,root:s.ownerDocument})}catch{r=new IntersectionObserver(M,k)}r.observe(e)}return u(!0),o}function J8(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,h=Zx(e),v=s||o?[...h?Iu(h):[],...t?Iu(t):[]]:[];v.forEach(S=>{s&&S.addEventListener("scroll",r,{passive:!0}),o&&S.addEventListener("resize",r)});const p=h&&d?Q8(h,r):null;let x=-1,y=null;u&&(y=new ResizeObserver(S=>{let[N]=S;N&&N.target===h&&y&&t&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=y)==null||k.observe(t)})),r()}),h&&!m&&y.observe(h),t&&y.observe(t));let w,C=m?ko(e):null;m&&E();function E(){const S=ko(e);C&&!Jk(C,S)&&r(),C=S,w=requestAnimationFrame(E)}return r(),()=>{var S;v.forEach(N=>{s&&N.removeEventListener("scroll",r),o&&N.removeEventListener("resize",r)}),p==null||p(),(S=y)==null||S.disconnect(),y=null,m&&cancelAnimationFrame(w)}}const ez=T8,tz=M8,rz=k8,iz=D8,nz=N8,$C=R8,sz=j8,az=(e,t,r)=>{const i=new Map,s={platform:Z8,...r},o={...s.platform,_c:i};return E8(e,t,{...s,platform:o})};var oz=typeof document<"u",lz=function(){},cf=oz?g.useLayoutEffect:lz;function Df(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,i,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!Df(e[i],t[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){const o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!Df(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function eN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UC(e,t){const r=eN(e);return Math.round(t*r)/r}function vv(e){const t=g.useRef(e);return cf(()=>{t.current=e}),t}function cz(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:o,floating:u}={},transform:d=!0,whileElementsMounted:m,open:h}=e,[v,p]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,y]=g.useState(i);Df(x,i)||y(i);const[w,C]=g.useState(null),[E,S]=g.useState(null),N=g.useCallback(H=>{H!==L.current&&(L.current=H,C(H))},[]),k=g.useCallback(H=>{H!==z.current&&(z.current=H,S(H))},[]),R=o||w,M=u||E,L=g.useRef(null),z=g.useRef(null),D=g.useRef(v),W=m!=null,G=vv(m),q=vv(s),B=vv(h),j=g.useCallback(()=>{if(!L.current||!z.current)return;const H={placement:t,strategy:r,middleware:x};q.current&&(H.platform=q.current),az(L.current,z.current,H).then(F=>{const V={...F,isPositioned:B.current!==!1};O.current&&!Df(D.current,V)&&(D.current=V,Ia.flushSync(()=>{p(V)}))})},[x,t,r,q,B]);cf(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[h]);const O=g.useRef(!1);cf(()=>(O.current=!0,()=>{O.current=!1}),[]),cf(()=>{if(R&&(L.current=R),M&&(z.current=M),R&&M){if(G.current)return G.current(R,M,j);j()}},[R,M,j,G,W]);const $=g.useMemo(()=>({reference:L,floating:z,setReference:N,setFloating:k}),[N,k]),T=g.useMemo(()=>({reference:R,floating:M}),[R,M]),U=g.useMemo(()=>{const H={position:r,left:0,top:0};if(!T.floating)return H;const F=UC(T.floating,v.x),V=UC(T.floating,v.y);return d?{...H,transform:"translate("+F+"px, "+V+"px)",...eN(T.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:V}},[r,d,T.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:j,refs:$,elements:T,floatingStyles:U}),[v,j,$,T,U])}const uz=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?$C({element:i.current,padding:s}).fn(r):{}:i?$C({element:i,padding:s}).fn(r):{}}}},dz=(e,t)=>{const r=ez(e);return{name:r.name,fn:r.fn,options:[e,t]}},hz=(e,t)=>{const r=tz(e);return{name:r.name,fn:r.fn,options:[e,t]}},fz=(e,t)=>({fn:sz(e).fn,options:[e,t]}),mz=(e,t)=>{const r=rz(e);return{name:r.name,fn:r.fn,options:[e,t]}},pz=(e,t)=>{const r=iz(e);return{name:r.name,fn:r.fn,options:[e,t]}},gz=(e,t)=>{const r=nz(e);return{name:r.name,fn:r.fn,options:[e,t]}},vz=(e,t)=>{const r=uz(e);return{name:r.name,fn:r.fn,options:[e,t]}};var _z="Arrow",tN=g.forwardRef((e,t)=>{const{children:r,width:i=10,height:s=5,...o}=e;return l.jsx(Ve.svg,{...o,ref:t,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});tN.displayName=_z;var xz=tN;function yz(e){const[t,r]=g.useState(void 0);return Xt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}var Qx="Popper",[rN,_m]=Sn(Qx),[bz,iN]=rN(Qx),nN=e=>{const{__scopePopper:t,children:r}=e,[i,s]=g.useState(null),[o,u]=g.useState(void 0);return l.jsx(bz,{scope:t,anchor:i,onAnchorChange:s,placementState:o,setPlacementState:u,children:r})};nN.displayName=Qx;var sN="PopperAnchor",aN=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...s}=e,o=iN(sN,r),u=g.useRef(null),d=o.onAnchorChange,m=g.useCallback(w=>{u.current=w,w&&d(w)},[d]),h=it(t,m),v=g.useRef(null);g.useEffect(()=>{if(!i)return;const w=v.current;v.current=i.current,w!==v.current&&d(v.current)});const p=o.placementState&&ey(o.placementState),x=p==null?void 0:p[0],y=p==null?void 0:p[1];return i?null:l.jsx(Ve.div,{"data-radix-popper-side":x,"data-radix-popper-align":y,...s,ref:h})});aN.displayName=sN;var Jx="PopperContent",[wz,Sz]=rN(Jx),oN=g.forwardRef((e,t)=>{var ce,ne,we,xe,ye,J;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:v=0,sticky:p="partial",hideWhenDetached:x=!1,updatePositionStrategy:y="optimized",onPlaced:w,...C}=e,E=iN(Jx,r),[S,N]=g.useState(null),k=it(t,N),[R,M]=g.useState(null),L=yz(R),z=(L==null?void 0:L.width)??0,D=(L==null?void 0:L.height)??0,W=i+(o!=="center"?"-"+o:""),G=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},q=Array.isArray(h)?h:[h],B=q.length>0,j={padding:G,boundary:q.filter(Ez),altBoundary:B},{refs:O,floatingStyles:$,placement:T,isPositioned:U,middlewareData:H}=cz({strategy:"fixed",placement:W,whileElementsMounted:(...ie)=>J8(...ie,{animationFrame:y==="always"}),elements:{reference:E.anchor},middleware:[dz({mainAxis:s+D,alignmentAxis:u}),m&&hz({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?fz():void 0,...j}),m&&mz({...j}),pz({...j,apply:({elements:ie,rects:Re,availableWidth:ve,availableHeight:Ae})=>{const{width:Ie,height:Oe}=Re.reference,ze=ie.floating.style;ze.setProperty("--radix-popper-available-width",`${ve}px`),ze.setProperty("--radix-popper-available-height",`${Ae}px`),ze.setProperty("--radix-popper-anchor-width",`${Ie}px`),ze.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),R&&vz({element:R,padding:d}),Rz({arrowWidth:z,arrowHeight:D}),x&&gz({strategy:"referenceHidden",...j,boundary:B?j.boundary:void 0})]}),F=E.setPlacementState;Xt(()=>(F(T),()=>{F(void 0)}),[T,F]);const[V,I]=ey(T),Y=pr(w);Xt(()=>{U&&(Y==null||Y())},[U,Y]);const X=(ce=H.arrow)==null?void 0:ce.x,ee=(ne=H.arrow)==null?void 0:ne.y,re=((we=H.arrow)==null?void 0:we.centerOffset)!==0,[oe,Z]=g.useState();return Xt(()=>{S&&Z(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:U?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(xe=H.transformOrigin)==null?void 0:xe.x,(ye=H.transformOrigin)==null?void 0:ye.y].join(" "),...((J=H.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(wz,{scope:r,placedSide:V,placedAlign:I,onArrowChange:M,arrowX:X,arrowY:ee,shouldHideArrow:re,children:l.jsx(Ve.div,{"data-side":V,"data-align":I,...C,ref:k,style:{...C.style,animation:U?void 0:"none"}})})})});oN.displayName=Jx;var lN="PopperArrow",Cz={top:"bottom",right:"left",bottom:"top",left:"right"},cN=g.forwardRef(function(t,r){const{__scopePopper:i,...s}=t,o=Sz(lN,i),u=Cz[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(xz,{...s,ref:r,style:{...s.style,display:"block"}})})});cN.displayName=lN;function Ez(e){return e!==null}var Rz=e=>({name:"transformOrigin",options:e,fn(t){var E,S,N;const{placement:r,rects:i,middlewareData:s}=t,u=((E=s.arrow)==null?void 0:E.centerOffset)!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[h,v]=ey(r),p={start:"0%",center:"50%",end:"100%"}[v],x=(((S=s.arrow)==null?void 0:S.x)??0)+d/2,y=(((N=s.arrow)==null?void 0:N.y)??0)+m/2;let w="",C="";return h==="bottom"?(w=u?p:`${x}px`,C=`${-m}px`):h==="top"?(w=u?p:`${x}px`,C=`${i.floating.height+m}px`):h==="right"?(w=`${-m}px`,C=u?p:`${y}px`):h==="left"&&(w=`${i.floating.width+m}px`,C=u?p:`${y}px`),{data:{x:w,y:C}}}});function ey(e){const[t,r="center"]=e.split("-");return[t,r]}var uN=nN,dN=aN,hN=oN,fN=cN,_v=!1;function kz(){const[e,t]=g.useState(_v);return g.useEffect(()=>{_v||(_v=!0,t(!0))},[]),e}var mN=La[" useSyncExternalStore ".trim().toString()];function Nz(){return()=>{}}function Az(){return mN(Nz,()=>!0,()=>!1)}var Tz=typeof mN=="function"?Az:kz,xv="rovingFocusGroup.onEntryFocus",Mz={bubbles:!1,cancelable:!0},sd="RovingFocusGroup",[G_,pN,jz]=qx(sd),[Dz,xm]=Sn(sd,[jz]),[Lz,Oz]=Dz(sd),gN=g.forwardRef((e,t)=>l.jsx(G_.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(G_.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Bz,{...e,ref:t})})}));gN.displayName=sd;var Bz=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:v=!1,...p}=e,x=g.useRef(null),y=it(t,x),w=id(o),[C,E]=Eo({prop:u,defaultProp:d??null,onChange:m,caller:sd}),[S,N]=g.useState(!1),k=pr(h),R=pN(r),M=g.useRef(!1),[L,z]=g.useState(0);return g.useEffect(()=>{const D=x.current;if(D)return D.addEventListener(xv,k),()=>D.removeEventListener(xv,k)},[k]),l.jsx(Lz,{scope:r,orientation:i,dir:w,loop:s,currentTabStopId:C,onItemFocus:g.useCallback(D=>E(D),[E]),onItemShiftTab:g.useCallback(()=>N(!0),[]),onFocusableItemAdd:g.useCallback(()=>z(D=>D+1),[]),onFocusableItemRemove:g.useCallback(()=>z(D=>D-1),[]),children:l.jsx(Ve.div,{tabIndex:S||L===0?-1:0,"data-orientation":i,...p,ref:y,style:{outline:"none",...e.style},onMouseDown:Le(e.onMouseDown,()=>{M.current=!0}),onFocus:Le(e.onFocus,D=>{const W=!M.current;if(D.target===D.currentTarget&&W&&!S){const G=new CustomEvent(xv,Mz);if(D.currentTarget.dispatchEvent(G),!G.defaultPrevented){const q=R().filter(T=>T.focusable),B=q.find(T=>T.active),j=q.find(T=>T.id===C),$=[B,j,...q].filter(Boolean).map(T=>T.ref.current);xN($,v)}}M.current=!1}),onBlur:Le(e.onBlur,()=>N(!1))})})}),vN="RovingFocusGroupItem",_N=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:u,...d}=e,m=vn(),h=o||m,v=Oz(vN,r),p=v.currentTabStopId===h,x=pN(r),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:C}=v,E=Tz();return Xt(()=>{if(!(!E||!i))return y(),()=>w()},[E,i,y,w]),g.useEffect(()=>{if(!(E||!i))return y(),()=>w()},[E,i,y,w]),l.jsx(G_.ItemSlot,{scope:r,id:h,focusable:i,active:s,children:l.jsx(Ve.span,{tabIndex:p?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Le(e.onMouseDown,S=>{i?v.onItemFocus(h):S.preventDefault()}),onFocus:Le(e.onFocus,()=>v.onItemFocus(h)),onKeyDown:Le(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){v.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const N=zz(S,v.orientation,v.dir);if(N!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=x().filter(M=>M.focusable).map(M=>M.ref.current);if(N==="last")R.reverse();else if(N==="prev"||N==="next"){N==="prev"&&R.reverse();const M=R.indexOf(S.currentTarget);R=v.loop?$z(R,M+1):R.slice(M+1)}setTimeout(()=>xN(R))}}),children:typeof u=="function"?u({isCurrentTabStop:p,hasTabStop:C!=null}):u})})});_N.displayName=vN;var Pz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Iz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zz(e,t,r){const i=Iz(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Pz[i]}function xN(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function $z(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var yN=gN,bN=_N,Y_=["Enter"," "],Uz=["ArrowDown","PageUp","Home"],wN=["ArrowUp","PageDown","End"],Hz=[...Uz,...wN],Fz={ltr:[...Y_,"ArrowRight"],rtl:[...Y_,"ArrowLeft"]},Wz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ad="Menu",[zu,qz,Vz]=qx(ad),[Po,SN]=Sn(ad,[Vz,_m,xm]),ym=_m(),CN=xm(),[Gz,Io]=Po(ad),[Yz,od]=Po(ad),EN=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:s,onOpenChange:o,modal:u=!0}=e,d=ym(t),[m,h]=g.useState(null),v=g.useRef(!1),p=pr(o),x=id(s);return g.useEffect(()=>{const y=()=>{v.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>v.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),g.useEffect(()=>{if(!r)return;const y=()=>p(!1);return window.addEventListener("blur",y),()=>window.removeEventListener("blur",y)},[r,p]),l.jsx(uN,{...d,children:l.jsx(Gz,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:h,children:l.jsx(Yz,{scope:t,onClose:g.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:v,dir:x,modal:u,children:i})})})};EN.displayName=ad;var Kz="MenuAnchor",ty=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=ym(r);return l.jsx(dN,{...s,...i,ref:t})});ty.displayName=Kz;var ry="MenuPortal",[Xz,RN]=Po(ry,{forceMount:void 0}),kN=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:s}=e,o=Io(ry,t);return l.jsx(Xz,{scope:t,forceMount:r,children:l.jsx(Cn,{present:r||o.open,children:l.jsx(nm,{asChild:!0,container:s,children:i})})})};kN.displayName=ry;var Ki="MenuContent",[Zz,iy]=Po(Ki),NN=g.forwardRef((e,t)=>{const r=RN(Ki,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,o=Io(Ki,e.__scopeMenu),u=od(Ki,e.__scopeMenu);return l.jsx(zu.Provider,{scope:e.__scopeMenu,children:l.jsx(Cn,{present:i||o.open,children:l.jsx(zu.Slot,{scope:e.__scopeMenu,children:u.modal?l.jsx(Qz,{...s,ref:t}):l.jsx(Jz,{...s,ref:t})})})})}),Qz=g.forwardRef((e,t)=>{const r=Io(Ki,e.__scopeMenu),i=g.useRef(null),s=it(t,i);return g.useEffect(()=>{const o=i.current;if(o)return Px(o)},[]),l.jsx(ny,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Le(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Jz=g.forwardRef((e,t)=>{const r=Io(Ki,e.__scopeMenu);return l.jsx(ny,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),e7=Ro("MenuContent.ScrollLock"),ny=g.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:y,disableOutsideScroll:w,...C}=e,E=Io(Ki,r),S=od(Ki,r),N=ym(r),k=CN(r),R=qz(r),[M,L]=g.useState(null),z=g.useRef(null),D=it(t,z,E.onContentChange),W=g.useRef(0),G=g.useRef(""),q=g.useRef(0),B=g.useRef(null),j=g.useRef("right"),O=g.useRef(0),$=w?am:g.Fragment,T=w?{as:e7,allowPinchZoom:!0}:void 0,U=F=>{var Z,ce;const V=G.current+F,I=R().filter(ne=>!ne.disabled),Y=document.activeElement,X=(Z=I.find(ne=>ne.ref.current===Y))==null?void 0:Z.textValue,ee=I.map(ne=>ne.textValue),re=h7(ee,V,X),oe=(ce=I.find(ne=>ne.textValue===re))==null?void 0:ce.ref.current;(function ne(we){G.current=we,window.clearTimeout(W.current),we!==""&&(W.current=window.setTimeout(()=>ne(""),1e3))})(V),oe&&setTimeout(()=>oe.focus())};g.useEffect(()=>()=>window.clearTimeout(W.current),[]),Bx();const H=g.useCallback(F=>{var I,Y;return j.current===((I=B.current)==null?void 0:I.side)&&m7(F,(Y=B.current)==null?void 0:Y.area)},[]);return l.jsx(Zz,{scope:r,searchRef:G,onItemEnter:g.useCallback(F=>{H(F)&&F.preventDefault()},[H]),onItemLeave:g.useCallback(F=>{var V;H(F)||((V=z.current)==null||V.focus(),L(null))},[H]),onTriggerLeave:g.useCallback(F=>{H(F)&&F.preventDefault()},[H]),pointerGraceTimerRef:q,onPointerGraceIntentChange:g.useCallback(F=>{B.current=F},[]),children:l.jsx($,{...T,children:l.jsx(im,{asChild:!0,trapped:s,onMountAutoFocus:Le(o,F=>{var V;F.preventDefault(),(V=z.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:l.jsx(rm,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:y,children:l.jsx(yN,{asChild:!0,...k,dir:S.dir,orientation:"vertical",loop:i,currentTabStopId:M,onCurrentTabStopIdChange:L,onEntryFocus:Le(m,F=>{S.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(hN,{role:"menu","aria-orientation":"vertical","data-state":WN(E.open),"data-radix-menu-content":"",dir:S.dir,...N,...C,ref:D,style:{outline:"none",...C.style},onKeyDown:Le(C.onKeyDown,F=>{const I=F.target.closest("[data-radix-menu-content]")===F.currentTarget,Y=F.ctrlKey||F.altKey||F.metaKey,X=F.key.length===1;I&&(F.key==="Tab"&&F.preventDefault(),!Y&&X&&U(F.key));const ee=z.current;if(F.target!==ee||!Hz.includes(F.key))return;F.preventDefault();const oe=R().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);wN.includes(F.key)&&oe.reverse(),u7(oe)}),onBlur:Le(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(W.current),G.current="")}),onPointerMove:Le(e.onPointerMove,$u(F=>{const V=F.target,I=O.current!==F.clientX;if(F.currentTarget.contains(V)&&I){const Y=F.clientX>O.current?"right":"left";j.current=Y,O.current=F.clientX}}))})})})})})})});NN.displayName=Ki;var t7="MenuGroup",sy=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{role:"group",...i,ref:t})});sy.displayName=t7;var r7="MenuLabel",AN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{...i,ref:t})});AN.displayName=r7;var Lf="MenuItem",HC="menu.itemSelect",bm=g.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...s}=e,o=g.useRef(null),u=od(Lf,e.__scopeMenu),d=iy(Lf,e.__scopeMenu),m=it(t,o),h=g.useRef(!1),v=()=>{const p=o.current;if(!r&&p){const x=new CustomEvent(HC,{bubbles:!0,cancelable:!0});p.addEventListener(HC,y=>i==null?void 0:i(y),{once:!0}),$R(p,x),x.defaultPrevented?h.current=!1:u.onClose()}};return l.jsx(TN,{...s,ref:m,disabled:r,onClick:Le(e.onClick,v),onPointerDown:p=>{var x;(x=e.onPointerDown)==null||x.call(e,p),h.current=!0},onPointerUp:Le(e.onPointerUp,p=>{var x;h.current||(x=p.currentTarget)==null||x.click()}),onKeyDown:Le(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||Y_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});bm.displayName=Lf;var TN=g.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=e,u=iy(Lf,r),d=CN(r),m=g.useRef(null),h=it(t,m),[v,p]=g.useState(!1),[x,y]=g.useState("");return g.useEffect(()=>{const w=m.current;w&&y((w.textContent??"").trim())},[o.children]),l.jsx(zu.ItemSlot,{scope:r,disabled:i,textValue:s??x,children:l.jsx(bN,{asChild:!0,...d,focusable:!i,children:l.jsx(Ve.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:h,onPointerMove:Le(e.onPointerMove,$u(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(e.onPointerLeave,$u(w=>u.onItemLeave(w))),onFocus:Le(e.onFocus,()=>p(!0)),onBlur:Le(e.onBlur,()=>p(!1))})})})}),i7="MenuCheckboxItem",MN=g.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return l.jsx(BN,{scope:e.__scopeMenu,checked:r,children:l.jsx(bm,{role:"menuitemcheckbox","aria-checked":Of(r)?"mixed":r,...s,ref:t,"data-state":oy(r),onSelect:Le(s.onSelect,()=>i==null?void 0:i(Of(r)?!0:!r),{checkForDefaultPrevented:!1})})})});MN.displayName=i7;var jN="MenuRadioGroup",[n7,s7]=Po(jN,{value:void 0,onValueChange:()=>{}}),DN=g.forwardRef((e,t)=>{const{value:r,onValueChange:i,...s}=e,o=pr(i);return l.jsx(n7,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(sy,{...s,ref:t})})});DN.displayName=jN;var LN="MenuRadioItem",ON=g.forwardRef((e,t)=>{const{value:r,...i}=e,s=s7(LN,e.__scopeMenu),o=r===s.value;return l.jsx(BN,{scope:e.__scopeMenu,checked:o,children:l.jsx(bm,{role:"menuitemradio","aria-checked":o,...i,ref:t,"data-state":oy(o),onSelect:Le(i.onSelect,()=>{var u;return(u=s.onValueChange)==null?void 0:u.call(s,r)},{checkForDefaultPrevented:!1})})})});ON.displayName=LN;var ay="MenuItemIndicator",[BN,a7]=Po(ay,{checked:!1}),PN=g.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...s}=e,o=a7(ay,r);return l.jsx(Cn,{present:i||Of(o.checked)||o.checked===!0,children:l.jsx(Ve.span,{...s,ref:t,"data-state":oy(o.checked)})})});PN.displayName=ay;var o7="MenuSeparator",IN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});IN.displayName=o7;var l7="MenuArrow",zN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=ym(r);return l.jsx(fN,{...s,...i,ref:t})});zN.displayName=l7;var c7="MenuSub",[EZ,$N]=Po(c7),wu="MenuSubTrigger",UN=g.forwardRef((e,t)=>{const r=Io(wu,e.__scopeMenu),i=od(wu,e.__scopeMenu),s=$N(wu,e.__scopeMenu),o=iy(wu,e.__scopeMenu),u=g.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,h={__scopeMenu:e.__scopeMenu},v=g.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);g.useEffect(()=>v,[v]),g.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]);const p=it(t,s.onTriggerChange);return l.jsx(ty,{asChild:!0,...h,children:l.jsx(TN,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":WN(r.open),...e,ref:p,onClick:x=>{var y;(y=e.onClick)==null||y.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Le(e.onPointerMove,$u(x=>{o.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(o.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),v()},100))})),onPointerLeave:Le(e.onPointerLeave,$u(x=>{var w,C;v();const y=(w=r.content)==null?void 0:w.getBoundingClientRect();if(y){const E=(C=r.content)==null?void 0:C.dataset.side,S=E==="right",N=S?-5:5,k=y[S?"left":"right"],R=y[S?"right":"left"];o.onPointerGraceIntentChange({area:[{x:x.clientX+N,y:x.clientY},{x:k,y:y.top},{x:R,y:y.top},{x:R,y:y.bottom},{x:k,y:y.bottom}],side:E}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(x),x.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Le(e.onKeyDown,x=>{var w;e.disabled||x.target!==x.currentTarget||o.searchRef.current!==""&&x.key===" "||Fz[i.dir].includes(x.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),x.preventDefault())})})})});UN.displayName=wu;var HN="MenuSubContent",FN=g.forwardRef((e,t)=>{const r=RN(Ki,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=e,u=Io(Ki,e.__scopeMenu),d=od(Ki,e.__scopeMenu),m=$N(HN,e.__scopeMenu),h=g.useRef(null),v=it(t,h);return l.jsx(zu.Provider,{scope:e.__scopeMenu,children:l.jsx(Cn,{present:i||u.open,children:l.jsx(zu.Slot,{scope:e.__scopeMenu,children:l.jsx(ny,{id:m.contentId,"aria-labelledby":m.triggerId,...o,ref:v,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var x;d.isUsingKeyboardRef.current&&((x=h.current)==null||x.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Le(e.onFocusOutside,p=>{p.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Le(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Le(e.onKeyDown,p=>{var w;const x=p.currentTarget.contains(p.target),y=Wz[d.dir].includes(p.key);x&&y&&(u.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});FN.displayName=HN;function WN(e){return e?"open":"closed"}function Of(e){return e==="indeterminate"}function oy(e){return Of(e)?"indeterminate":e?"checked":"unchecked"}function u7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function d7(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function h7(e,t,r){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=d7(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function f7(e,t){const{x:r,y:i}=e;let s=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const d=t[o],m=t[u],h=d.x,v=d.y,p=m.x,x=m.y;v>i!=x>i&&r<(p-h)*(i-v)/(x-v)+h&&(s=!s)}return s}function m7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return f7(r,t)}function $u(e){return t=>t.pointerType==="mouse"?e(t):void 0}var p7=EN,g7=ty,v7=kN,_7=NN,x7=sy,y7=AN,b7=bm,w7=MN,S7=DN,C7=ON,E7=PN,R7=IN,k7=zN,N7=UN,A7=FN,wm="DropdownMenu",[T7]=Sn(wm,[SN]),ei=SN(),[M7,qN]=T7(wm),VN=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:s,defaultOpen:o,onOpenChange:u,modal:d=!0}=e,m=ei(t),h=g.useRef(null),[v,p]=Eo({prop:s,defaultProp:o??!1,onChange:u,caller:wm});return l.jsx(M7,{scope:t,triggerId:vn(),triggerRef:h,contentId:vn(),open:v,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(x=>!x),[p]),modal:d,children:l.jsx(p7,{...m,open:v,onOpenChange:p,dir:i,modal:d,children:r})})};VN.displayName=wm;var GN="DropdownMenuTrigger",YN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,o=qN(GN,r),u=ei(r),d=it(t,o.triggerRef);return l.jsx(g7,{asChild:!0,...u,children:l.jsx(Ve.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Le(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(o.onOpenToggle(),o.open||m.preventDefault())}),onKeyDown:Le(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&o.onOpenToggle(),m.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});YN.displayName=GN;var j7="DropdownMenuPortal",KN=e=>{const{__scopeDropdownMenu:t,...r}=e,i=ei(t);return l.jsx(v7,{...i,...r})};KN.displayName=j7;var XN="DropdownMenuContent",ZN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=qN(XN,r),o=ei(r),u=g.useRef(!1);return l.jsx(_7,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:t,onCloseAutoFocus:Le(e.onCloseAutoFocus,d=>{var m;u.current||(m=s.triggerRef.current)==null||m.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Le(e.onInteractOutside,d=>{const m=d.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,v=m.button===2||h;(!s.modal||v)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ZN.displayName=XN;var D7="DropdownMenuGroup",L7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(x7,{...s,...i,ref:t})});L7.displayName=D7;var O7="DropdownMenuLabel",B7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(y7,{...s,...i,ref:t})});B7.displayName=O7;var P7="DropdownMenuItem",QN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(b7,{...s,...i,ref:t})});QN.displayName=P7;var I7="DropdownMenuCheckboxItem",z7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(w7,{...s,...i,ref:t})});z7.displayName=I7;var $7="DropdownMenuRadioGroup",U7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(S7,{...s,...i,ref:t})});U7.displayName=$7;var H7="DropdownMenuRadioItem",F7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(C7,{...s,...i,ref:t})});F7.displayName=H7;var W7="DropdownMenuItemIndicator",q7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(E7,{...s,...i,ref:t})});q7.displayName=W7;var V7="DropdownMenuSeparator",G7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(R7,{...s,...i,ref:t})});G7.displayName=V7;var Y7="DropdownMenuArrow",K7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(k7,{...s,...i,ref:t})});K7.displayName=Y7;var X7="DropdownMenuSubTrigger",Z7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(N7,{...s,...i,ref:t})});Z7.displayName=X7;var Q7="DropdownMenuSubContent",J7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ei(r);return l.jsx(A7,{...s,...i,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});J7.displayName=Q7;var e$=VN,JN=YN,t$=KN,eA=ZN,tA=QN;function K_(e){return l.jsx(e$,{"data-slot":"dropdown-menu",...e})}const Bf=g.forwardRef((e,t)=>l.jsx(JN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));Bf.displayName=JN.displayName;const Pf=g.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...i},s)=>l.jsx(t$,{children:l.jsx(eA,{ref:s,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:ct("cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));Pf.displayName=eA.displayName;const If=g.forwardRef(({className:e,variant:t="default",...r},i)=>l.jsx(tA,{ref:i,"data-slot":"dropdown-menu-item","data-variant":t,className:ct("relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t==="destructive"&&"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20",e),...r}));If.displayName=tA.displayName;const yt=g.forwardRef(({className:e,type:t,...r},i)=>l.jsx("input",{ref:i,type:t,"data-slot":"input",className:ct("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r}));yt.displayName="Input";function Sm({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:ct("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function r$({idPrefix:e,fields:t,activeFieldId:r,answers:i,otherValues:s,otherSelections:o,errors:u={},disabled:d=!1,onNavigate:m,onAnswerChange:h,onOtherValueChange:v,onOtherSelectionChange:p}){const x=g.useRef(null),y=g.useRef(void 0),w=g.useRef(void 0),C=t.findIndex(D=>D.id===r),E=C>=0?C:0,S=t[E],N=S?u[S.id]:void 0,k=S?i[S.id]:void 0;if(g.useEffect(()=>{if(!S)return;const D=y.current!==void 0&&y.current!==S.id,W=!!N&&w.current!==N;if(y.current=S.id,w.current=N,!D&&!W)return;const G=x.current,q=(G==null?void 0:G.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(G==null?void 0:G.querySelector("input:checked:not([disabled])"))??(G==null?void 0:G.querySelector("input:not([disabled]), textarea:not([disabled])"));q==null||q.focus()},[N,S]),!S)return null;const R=`${e}-field-${E}`,M=S.description?`${R}-description`:void 0,L=N?`${R}-error`:void 0,z=[M,L].filter(Boolean).join(" ")||void 0;return l.jsxs("div",{className:"grid gap-3",children:[t.length>1&&l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",E+1," of ",t.length]}),l.jsx("div",{className:"text-[11px] text-muted-foreground",children:S.required?"Required":"Optional"})]}),l.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":E+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:l.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(E+1)/t.length*100}%`}})})]}),l.jsx("div",{ref:x,children:S.type==="text"?l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("label",{htmlFor:R,className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(qC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),S.multiline&&!S.secret?l.jsx(Sm,{id:R,value:typeof k=="string"?k:"",disabled:d,placeholder:S.placeholder,"aria-invalid":N?!0:void 0,"aria-describedby":z,required:S.required,onChange:D=>h(S.id,D.target.value)}):l.jsx(yt,{id:R,type:S.secret?"password":"text",autoComplete:"off",value:typeof k=="string"?k:"",disabled:d,placeholder:S.placeholder,"aria-invalid":N?!0:void 0,"aria-describedby":z,required:S.required,onChange:D=>h(S.id,D.target.value)}),l.jsx(WC,{id:L,error:N})]}):l.jsxs("fieldset",{disabled:d,role:S.multiple?void 0:"radiogroup","aria-required":!S.multiple&&S.required?!0:void 0,"aria-invalid":N?!0:void 0,"aria-describedby":z,className:"grid gap-1.5",children:[l.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(qC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),l.jsxs("div",{className:"grid gap-1.5",children:[S.options.map((D,W)=>{const G=`${R}-option-${W}`,q=S.multiple?Array.isArray(k)&&k.includes(D.value):o[S.id]!==!0&&k===D.value;return l.jsx(FC,{id:G,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:q,label:D.label,description:D.description,onChange:B=>{if(S.multiple){const j=Array.isArray(k)?k:[];h(S.id,B?[...j.filter(O=>O!==D.value),D.value]:j.filter(O=>O!==D.value))}else h(S.id,D.value),p(S.id,!1)}},D.value)}),S.allowOther&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[l.jsx(FC,{id:`${R}-other`,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:o[S.id]===!0,label:"Other",embedded:!0,onChange:D=>{p(S.id,D),D&&!S.multiple&&h(S.id,"")}}),l.jsx(yt,{value:s[S.id]??"",disabled:d||o[S.id]!==!0,"aria-label":`Other answer for ${S.label}`,"aria-invalid":N?!0:void 0,"aria-describedby":z,placeholder:"Enter another answer",onChange:D=>v(S.id,D.target.value)})]}),!S.required&&!S.multiple&&(o[S.id]===!0||typeof k=="string"&&k.length>0)&&l.jsx(he,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{h(S.id,""),p(S.id,!1)},children:"Clear selection"})]}),l.jsx(WC,{id:L,error:N})]})}),t.length>1&&l.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[l.jsxs(he,{type:"button",size:"xs",variant:"ghost",disabled:d||E===0,onClick:()=>m(t[E-1].id),children:[l.jsx(AR,{}),"Previous"]}),l.jsxs(he,{type:"button",size:"xs",variant:"outline",disabled:d||E===t.length-1,onClick:()=>m(t[E+1].id),children:["Next",l.jsx(jo,{})]})]})]})}function FC({id:e,name:t,type:r,checked:i,label:s,description:o,embedded:u=!1,onChange:d}){return l.jsxs("label",{htmlFor:e,className:ct("flex cursor-pointer items-start gap-2 text-xs text-foreground",!u&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[l.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[l.jsx("input",{id:e,type:r,name:t,checked:i,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),l.jsx(Ba,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block",children:s}),o&&l.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:o})]})]})}function WC({id:e,error:t}){return t?l.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function qC(){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),l.jsx("span",{className:"sr-only",children:" (required)"})]})}function Ma({className:e,size:t="default",...r}){return l.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:ct("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[l.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),l.jsx(Nx,{"aria-hidden":"true","data-slot":"native-select-icon",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"})]})}var i$=Object.defineProperty,Bs=(e,t)=>i$(e,"name",{value:t,configurable:!0});function rA(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}Bs(rA,"useStateMachine");var Cm=Bs(e=>{const{present:t,children:r}=e,i=iA(t),s=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=nA(i.ref,sA(s));return typeof r=="function"||i.isPresent?g.cloneElement(s,{ref:o}):null},"Presence");function iA(e){const[t,r]=g.useState(),i=g.useRef(null),s=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=rA(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{m==="mounted"?(o.current=u.current??Pl(i.current),u.current=void 0):o.current="none"},[m]),Xt(()=>{const v=i.current,p=s.current;if(p!==e){const y=o.current,w=Pl(v);e?(u.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(p&&y!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Xt(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=Bs(w=>{const E=Pl(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(h("ANIMATION_END"),!s.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),y=Bs(w=>{w.target===t&&(o.current=Pl(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=Pl(p)}else i.current=null;r(v)},[])}}Bs(iA,"usePresence");function X_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Bs(X_,"setRef");function nA(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=X_(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():X_(i[u],null)}}},[])}Bs(nA,"useStableComposedRefs");function Pl(e){return(e==null?void 0:e.animationName)||"none"}Bs(Pl,"getAnimationName");function sA(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Bs(sA,"getElementRef");function Z_(e,[t,r]){return Math.min(r,Math.max(t,e))}var n$=Object.defineProperty,nc=(e,t)=>n$(e,"name",{value:t,configurable:!0}),aA=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ra(e,t,{checkForDefaultPrevented:r=!0}={}){return nc(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}nc(Ra,"composeEventHandlers");function s$(e){var t;if(!aA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}nc(s$,"getOwnerWindow");function Q_(e){if(!aA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}nc(Q_,"getOwnerDocument");function oA(e,t=!1){const{activeElement:r}=Q_(e);if(!(r!=null&&r.nodeName))return null;if(lA(r)&&r.contentDocument)return oA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=Q_(r).getElementById(i);if(s)return s}}return r}nc(oA,"getActiveElement");function lA(e){return e.tagName==="IFRAME"}nc(lA,"isFrame");var a$=Object.defineProperty,at=(e,t)=>a$(e,"name",{value:t,configurable:!0});function cA(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}at(cA,"useStateMachine");var uA="ScrollArea",[dA]=Sn(uA),[o$,nn]=dA(uA),l$=g.forwardRef(at(function(t,r){const{__scopeScrollArea:i,type:s="hover",dir:o,scrollHideDelay:u=600,...d}=t,[m,h]=g.useState(null),[v,p]=g.useState(null),[x,y]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(null),[N,k]=g.useState(0),[R,M]=g.useState(0),[L,z]=g.useState(!1),[D,W]=g.useState(!1),G=it(r,h),q=id(o);return l.jsx(o$,{scope:i,type:s,dir:q,scrollHideDelay:u,scrollArea:m,viewport:v,onViewportChange:p,content:x,onContentChange:y,scrollbarX:w,onScrollbarXChange:C,scrollbarXEnabled:L,onScrollbarXEnabledChange:z,scrollbarY:E,onScrollbarYChange:S,scrollbarYEnabled:D,onScrollbarYEnabledChange:W,onCornerWidthChange:k,onCornerHeightChange:M,children:l.jsx(Ve.div,{dir:q,...d,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":R+"px",...t.style}})})},"ScrollArea")),c$="ScrollAreaViewport",u$=g.forwardRef(at(function(t,r){const{__scopeScrollArea:i,children:s,nonce:o,...u}=t,d=nn(c$,i),m=g.useRef(null),h=it(r,m,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx(d$,{nonce:o}),l.jsx(Ve.div,{"data-radix-scroll-area-viewport":"",...u,ref:h,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),d$=g.memo(at(function({nonce:t}){return l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),zs="ScrollAreaScrollbar",hA=g.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),{onScrollbarXEnabledChange:u,onScrollbarYEnabledChange:d}=o,m=t.orientation==="horizontal";return g.useEffect(()=>(m?u(!0):d(!0),()=>{m?u(!1):d(!1)}),[m,u,d]),o.type==="hover"?l.jsx(h$,{...s,ref:r,forceMount:i}):o.type==="scroll"?l.jsx(f$,{...s,ref:r,forceMount:i}):o.type==="auto"?l.jsx(fA,{...s,ref:r,forceMount:i}):o.type==="always"?l.jsx(ly,{...s,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),h$=g.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),[u,d]=g.useState(!1);return g.useEffect(()=>{const m=o.scrollArea;let h=0;if(m){const v=at(()=>{window.clearTimeout(h),d(!0)},"handlePointerEnter"),p=at(()=>{h=window.setTimeout(()=>d(!1),o.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",v),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(h),m.removeEventListener("pointerenter",v),m.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(Cm,{present:i||u,children:l.jsx(fA,{"data-state":u?"visible":"hidden",...s,ref:r})})},"ScrollAreaScrollbarHover")),f$=g.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),u=t.orientation==="horizontal",d=cd(()=>h("SCROLL_END"),100),[m,h]=cA("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(m==="idle"){const v=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(v)}},[m,o.scrollHideDelay,h]),g.useEffect(()=>{const v=o.viewport,p=u?"scrollLeft":"scrollTop";if(v){let x=v[p];const y=at(()=>{const w=v[p];x!==w&&(h("SCROLL"),d()),x=w},"handleScroll");return v.addEventListener("scroll",y),()=>v.removeEventListener("scroll",y)}},[o.viewport,u,h,d]),l.jsx(Cm,{present:i||m!=="hidden",children:l.jsx(ly,{"data-state":m==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:Ra(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Ra(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),fA=g.forwardRef(at(function(t,r){const i=nn(zs,t.__scopeScrollArea),{forceMount:s,...o}=t,[u,d]=g.useState(!1),m=t.orientation==="horizontal",h=cd(()=>{if(i.viewport){const v=i.viewport.offsetWidth<i.viewport.scrollWidth,p=i.viewport.offsetHeight<i.viewport.scrollHeight;d(m?v:p)}},10);return No(i.viewport,h),No(i.content,h),l.jsx(Cm,{present:s||u,children:l.jsx(ly,{"data-state":u?"visible":"hidden",...o,ref:r})})},"ScrollAreaScrollbarAuto")),ly=g.forwardRef(at(function(t,r){const{orientation:i="vertical",...s}=t,o=nn(zs,t.__scopeScrollArea),u=g.useRef(null),d=g.useRef(0),[m,h]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),v=cy(m.viewport,m.content),p={...s,sizes:m,onSizesChange:h,hasThumb:v>0&&v<1,onThumbChange:at(y=>u.current=y,"onThumbChange"),onThumbPointerUp:at(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:at(y=>d.current=y,"onThumbPointerDown")};function x(y,w){return vA(y,d.current,m,w)}return at(x,"getScrollPosition"),i==="horizontal"?l.jsx(m$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const y=o.viewport.scrollLeft,w=e0(y,m,o.dir);u.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollLeft=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollLeft=x(y,o.dir))}}):i==="vertical"?l.jsx(p$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const y=o.viewport.scrollTop,w=e0(y,m);u.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:y=>{o.viewport&&(o.viewport.scrollTop=y)},onDragScroll:y=>{o.viewport&&(o.viewport.scrollTop=x(y))}}):null},"ScrollAreaScrollbarVisible")),m$=g.forwardRef(at(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=nn(zs,t.__scopeScrollArea),[d,m]=g.useState(),h=g.useRef(null),v=it(r,h,u.onScrollbarXChange);return g.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(pA,{"data-orientation":"horizontal",...o,ref:v,sizes:i,style:{bottom:0,left:u.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:u.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ld(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(u.viewport){const y=u.viewport.scrollLeft+p.deltaX;t.onWheelScroll(y),dy(y,x)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollWidth,viewport:u.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Uu(d.paddingLeft),paddingEnd:Uu(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),p$=g.forwardRef(at(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=nn(zs,t.__scopeScrollArea),[d,m]=g.useState(),h=g.useRef(null),v=it(r,h,u.onScrollbarYChange);return g.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(pA,{"data-orientation":"vertical",...o,ref:v,sizes:i,style:{top:0,right:u.dir==="ltr"?0:void 0,left:u.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ld(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(u.viewport){const y=u.viewport.scrollTop+p.deltaY;t.onWheelScroll(y),dy(y,x)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollHeight,viewport:u.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Uu(d.paddingTop),paddingEnd:Uu(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[g$,mA]=dA(zs),pA=g.forwardRef(at(function(t,r){const{__scopeScrollArea:i,sizes:s,hasThumb:o,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:h,onDragScroll:v,onWheelScroll:p,onResize:x,...y}=t,w=nn(zs,i),[C,E]=g.useState(null),S=it(r,E),N=g.useRef(null),k=g.useRef(""),R=w.viewport,M=s.content-s.viewport,L=pr(p),z=pr(h),D=cd(x,10);function W(G){if(N.current){const q=G.clientX-N.current.left,B=G.clientY-N.current.top;v({x:q,y:B})}}return at(W,"handleDragScroll"),g.useEffect(()=>{const G=at(q=>{const B=q.target;(C==null?void 0:C.contains(B))&&L(q,M)},"handleWheel");return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[R,C,M,L]),g.useEffect(z,[s,z]),No(C,D),No(w.content,D),l.jsx(g$,{scope:i,scrollbar:C,hasThumb:o,onThumbChange:pr(u),onThumbPointerUp:pr(d),onThumbPositionChange:z,onThumbPointerDown:pr(m),children:l.jsx(Ve.div,{...y,ref:S,style:{position:"absolute",...y.style},onPointerDown:Ra(t.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),N.current=C.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),W(G))}),onPointerMove:Ra(t.onPointerMove,W),onPointerUp:Ra(t.onPointerUp,G=>{const q=G.target;q.hasPointerCapture(G.pointerId)&&q.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=k.current,w.viewport&&(w.viewport.style.scrollBehavior=""),N.current=null})})})},"ScrollAreaScrollbarImpl")),J_="ScrollAreaThumb",v$=g.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=mA(J_,t.__scopeScrollArea);return l.jsx(Cm,{present:i||o.hasThumb,children:l.jsx(_$,{ref:r,...s})})},"ScrollAreaThumb")),_$=g.forwardRef(at(function(t,r){const{__scopeScrollArea:i,style:s,...o}=t,u=nn(J_,i),d=mA(J_,i),{onThumbPositionChange:m}=d,h=it(r,d.onThumbChange),v=g.useRef(void 0),p=cd(()=>{v.current&&(v.current(),v.current=void 0)},100);return g.useEffect(()=>{const x=u.viewport;if(x){const y=at(()=>{if(p(),!v.current){const w=b$(x,m);v.current=w,m()}},"handleScroll");return m(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[u.viewport,p,m]),l.jsx(Ve.div,{"data-state":d.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Ra(t.onPointerDownCapture,x=>{const w=x.target.getBoundingClientRect(),C=x.clientX-w.left,E=x.clientY-w.top;d.onThumbPointerDown({x:C,y:E})}),onPointerUp:Ra(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),gA="ScrollAreaCorner",x$=g.forwardRef(at(function(t,r){const i=nn(gA,t.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?l.jsx(y$,{...t,ref:r}):null},"ScrollAreaCorner")),y$=g.forwardRef(at(function(t,r){const{__scopeScrollArea:i,...s}=t,o=nn(gA,i),[u,d]=g.useState(0),[m,h]=g.useState(0),v=!!(u&&m),{onCornerWidthChange:p,onCornerHeightChange:x}=o;return No(o.scrollbarX,()=>{var w;const y=((w=o.scrollbarX)==null?void 0:w.offsetHeight)||0;o.onCornerHeightChange(y),h(y)}),No(o.scrollbarY,()=>{var w;const y=((w=o.scrollbarY)==null?void 0:w.offsetWidth)||0;o.onCornerWidthChange(y),d(y)}),g.useEffect(()=>()=>{p(0),x(0)},[p,x]),v?l.jsx(Ve.div,{...s,ref:r,style:{width:u,height:m,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Uu(e){return e?parseInt(e,10):0}at(Uu,"toInt");function cy(e,t){const r=e/t;return isNaN(r)?0:r}at(cy,"getThumbRatio");function ld(e){const t=cy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=(e.scrollbar.size-r)*t;return Math.max(i,18)}at(ld,"getThumbSize");function vA(e,t,r,i="ltr"){const s=ld(r),o=s/2,u=t||o,d=s-u,m=r.scrollbar.paddingStart+u,h=r.scrollbar.size-r.scrollbar.paddingEnd-d,v=r.content-r.viewport,p=i==="ltr"?[0,v]:[v*-1,0];return uy([m,h],p)(e)}at(vA,"getScrollPositionFromPointer");function e0(e,t,r="ltr"){const i=ld(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,u=t.content-t.viewport,d=o-i,m=r==="ltr"?[0,u]:[u*-1,0],h=Z_(e,m);return uy([0,u],[0,d])(h)}at(e0,"getThumbOffsetFromScroll");function uy(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const i=(t[1]-t[0])/(e[1]-e[0]);return t[0]+i*(r-e[0])}}at(uy,"linearScale");function dy(e,t){return e>0&&e<t}at(dy,"isScrollingWithinScrollbarBounds");var b$=at((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},i=0;return at((function s(){const o={left:e.scrollLeft,top:e.scrollTop},u=r.left!==o.left,d=r.top!==o.top;(u||d)&&t(),r=o,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function cd(e,t){const r=pr(e),i=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),g.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(r,t)},[r,t])}at(cd,"useDebounceCallback");function No(e,t){const r=pr(t);Xt(()=>{let i=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(i),s.unobserve(e)}}},[e,r])}at(No,"useResizeObserver");var _A=l$,w$=u$,S$=x$;const yn=g.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:i,viewportProps:s,scrollbars:o="vertical",type:u="auto",...d},m)=>l.jsxs(_A,{ref:m,"data-slot":"scroll-area",type:u,className:ct("relative overflow-hidden",e),...d,children:[l.jsx(w$,{ref:i,"data-slot":"scroll-area-viewport",className:ct("size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45",o==="vertical"&&"[&>div]:!block [&>div]:min-w-0 [&>div]:w-full",r),...s,children:t}),o!=="horizontal"&&l.jsx(t0,{orientation:"vertical"}),o!=="vertical"&&l.jsx(t0,{orientation:"horizontal"}),l.jsx(S$,{"data-slot":"scroll-area-corner"})]}));yn.displayName=_A.displayName;const t0=g.forwardRef(({className:e,orientation:t="vertical",style:r,...i},s)=>l.jsx(hA,{ref:s,"data-slot":"scroll-area-scrollbar",orientation:t,className:ct("group flex touch-none select-none p-px transition-colors",t==="vertical"&&"h-full w-2",t==="horizontal"&&"h-2 flex-col",e),style:{...t==="vertical"?{right:2}:{bottom:2},...r},...i,children:l.jsx(v$,{"data-slot":"scroll-area-thumb",className:ct("relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]",t==="vertical"?"min-h-8 w-full":"h-full min-w-8")})}));t0.displayName=hA.displayName;function C$(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),E$="VisuallyHidden",R$=g.forwardRef((e,t)=>l.jsx(Ve.span,{...e,ref:t,style:{...xA,...e.style}}));R$.displayName=E$;var k$=[" ","Enter","ArrowUp","ArrowDown"],N$=[" ","Enter"],Ao="Select",[Em,Rm,A$]=qx(Ao),[zo]=Sn(Ao,[A$,_m]),km=_m(),[T$,Ha]=zo(Ao),[M$,j$]=zo(Ao),D$="SelectProvider";function yA(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:s,onOpenChange:o,value:u,defaultValue:d,onValueChange:m,dir:h,name:v,autoComplete:p,disabled:x,required:y,form:w,internal_do_not_use_render:C}=e,E=km(t),[S,N]=g.useState(null),[k,R]=g.useState(null),[M,L]=g.useState(!1),z=id(h),[D,W]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:Ao}),[G,q]=Eo({prop:u,defaultProp:d,onChange:m,caller:Ao}),B=g.useRef(null),j=g.useRef(G);g.useEffect(()=>{const Y=w?S==null?void 0:S.ownerDocument.getElementById(w):S==null?void 0:S.form;if(Y instanceof HTMLFormElement){const X=()=>q(j.current);return Y.addEventListener("reset",X),()=>Y.removeEventListener("reset",X)}},[w,S,q]);const O=S?!!w||!!S.closest("form"):!0,[$,T]=g.useState(new Set),U=vn(),H=Array.from($).map(Y=>Y.props.value).join(";"),F=g.useCallback(Y=>{T(X=>new Set(X).add(Y))},[]),V=g.useCallback(Y=>{T(X=>{const ee=new Set(X);return ee.delete(Y),ee})},[]),I={required:y,trigger:S,onTriggerChange:N,valueNode:k,onValueNodeChange:R,valueNodeHasChildren:M,onValueNodeHasChildrenChange:L,contentId:U,value:G,onValueChange:q,open:D,onOpenChange:W,dir:z,triggerPointerDownPosRef:B,disabled:x,name:v,autoComplete:p,form:w,nativeOptions:$,nativeSelectKey:H,isFormControl:O};return l.jsx(uN,{...E,children:l.jsx(T$,{scope:t,...I,children:l.jsx(Em.Provider,{scope:t,children:l.jsx(M$,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:V,children:G$(C)?C(I):r})})})})}yA.displayName=D$;var bA=e=>{const{__scopeSelect:t,children:r,...i}=e;return l.jsx(yA,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:s})=>l.jsxs(l.Fragment,{children:[r,s?l.jsx(UA,{__scopeSelect:t}):null]})})};bA.displayName=Ao;var wA="SelectTrigger",hy=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,o=km(r),u=Ha(wA,r),d=u.disabled||i,m=it(t,u.onTriggerChange),h=Rm(r),v=g.useRef("touch"),[p,x,y]=HA(C=>{const E=h().filter(k=>!k.disabled),S=E.find(k=>k.value===u.value),N=FA(E,C,S);N!==void 0&&u.onValueChange(N.value)}),w=C=>{d||(u.onOpenChange(!0),y()),C&&(u.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return l.jsx(dN,{asChild:!0,...o,children:l.jsx(Ve.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Nm(u.value)?"":void 0,...s,ref:m,onClick:Le(s.onClick,C=>{C.currentTarget.focus(),v.current!=="mouse"&&w(C)}),onPointerDown:Le(s.onPointerDown,C=>{v.current=C.pointerType;const E=C.target;E.hasPointerCapture(C.pointerId)&&E.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(w(C),C.preventDefault())}),onKeyDown:Le(s.onKeyDown,C=>{const E=p.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&x(C.key),!(E&&C.key===" ")&&k$.includes(C.key)&&(w(),C.preventDefault())})})})});hy.displayName=wA;var SA="SelectValue",fy=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,children:o,placeholder:u="",...d}=e,m=Ha(SA,r),{onValueNodeHasChildrenChange:h}=m,v=o!==void 0,p=it(t,m.onValueNodeChange);Xt(()=>{h(v)},[h,v]);const x=Nm(m.value);return l.jsx(Ve.span,{...d,asChild:x?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:l.jsx(g.Fragment,{children:x?u:o},x?"placeholder":"value")})});fy.displayName=SA;var L$="SelectIcon",CA=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...s}=e;return l.jsx(Ve.span,{"aria-hidden":!0,...s,ref:t,children:i||"▼"})});CA.displayName=L$;var EA="SelectPortal",[O$,B$]=zo(EA,{forceMount:void 0}),RA=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return l.jsx(O$,{scope:e.__scopeSelect,forceMount:r,children:l.jsx(nm,{asChild:!0,...i})})};RA.displayName=EA;var ja="SelectContent",my=g.forwardRef((e,t)=>{const r=B$(ja,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=Ha(ja,e.__scopeSelect),[u,d]=g.useState();return Xt(()=>{d(new DocumentFragment)},[]),l.jsx(Cn,{present:i||o.open,children:({present:m})=>m?l.jsx(AA,{...s,ref:t}):l.jsx(kA,{...s,fragment:u})})});my.displayName=ja;var kA=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?Ia.createPortal(l.jsx(NA,{scope:r,children:l.jsx(Em.Slot,{scope:r,children:l.jsx("div",{ref:t,children:i})})}),s):null});kA.displayName="SelectContentFragment";var mn=10,[NA,Fa]=zo(ja),P$="SelectContentImpl",I$=Ro("SelectContent.RemoveScroll"),AA=g.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:u,side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:C,avoidCollisions:E,...S}=e,N=Ha(ja,r),[k,R]=g.useState(null),[M,L]=g.useState(null),z=it(t,R),[D,W]=g.useState(null),[G,q]=g.useState(null),B=Rm(r),[j,O]=g.useState(!1),$=g.useRef(!1);g.useEffect(()=>{if(k)return Px(k)},[k]),Bx();const T=g.useCallback(Z=>{const[ce,...ne]=B().map(ye=>ye.ref.current),[we]=ne.slice(-1),xe=document.activeElement;for(const ye of Z)if(ye===xe||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===ce&&M&&(M.scrollTop=0),ye===we&&M&&(M.scrollTop=M.scrollHeight),ye==null||ye.focus(),document.activeElement!==xe))return},[B,M]),U=g.useCallback(()=>T([D,k]),[T,D,k]);g.useEffect(()=>{j&&U()},[j,U]);const{onOpenChange:H,triggerPointerDownPosRef:F}=N;g.useEffect(()=>{if(k){let Z={x:0,y:0};const ce=we=>{var xe,ye;Z={x:Math.abs(Math.round(we.pageX)-(((xe=F.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(we.pageY)-(((ye=F.current)==null?void 0:ye.y)??0))}},ne=we=>{Z.x<=10&&Z.y<=10?we.preventDefault():we.composedPath().includes(k)||H(!1),document.removeEventListener("pointermove",ce),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",ne,{capture:!0})}}},[k,H,F]),g.useEffect(()=>{const Z=()=>H(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[H]);const[V,I]=HA(Z=>{const ce=B().filter(xe=>!xe.disabled),ne=ce.find(xe=>xe.ref.current===document.activeElement),we=FA(ce,Z,ne);we&&setTimeout(()=>{var xe;return(xe=we.ref.current)==null?void 0:xe.focus()})}),Y=g.useCallback((Z,ce,ne)=>{const we=!$.current&&!ne;(N.value!==void 0&&N.value===ce||we)&&(W(Z),we&&($.current=!0))},[N.value]),X=g.useCallback(()=>k==null?void 0:k.focus(),[k]),ee=g.useCallback((Z,ce,ne)=>{const we=!$.current&&!ne;(N.value!==void 0&&N.value===ce||we)&&q(Z)},[N.value]),re=i==="popper"?r0:TA,oe=re===r0?{side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:C,avoidCollisions:E}:{};return l.jsx(NA,{scope:r,content:k,viewport:M,onViewportChange:L,itemRefCallback:Y,selectedItem:D,onItemLeave:X,itemTextRefCallback:ee,focusSelectedItem:U,selectedItemText:G,position:i,isPositioned:j,searchRef:V,children:l.jsx(am,{as:I$,allowPinchZoom:!0,children:l.jsx(im,{asChild:!0,trapped:N.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Le(s,Z=>{var ce;(ce=N.trigger)==null||ce.focus({preventScroll:!0}),Z.preventDefault()}),children:l.jsx(rm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(re,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Z=>Z.preventDefault(),...S,...oe,onPlaced:()=>O(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Le(S.onKeyDown,Z=>{const ce=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ce&&Z.key.length===1&&I(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let we=B().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const xe=Z.target,ye=we.indexOf(xe);we=we.slice(ye+1)}setTimeout(()=>T(we)),Z.preventDefault()}})})})})})})});AA.displayName=P$;var z$="SelectItemAlignedPosition",TA=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,o=Ha(ja,r),u=Fa(ja,r),[d,m]=g.useState(null),[h,v]=g.useState(null),p=it(t,v),x=Rm(r),y=g.useRef(!1),w=g.useRef(!0),{viewport:C,selectedItem:E,selectedItemText:S,focusSelectedItem:N}=u,k=g.useCallback(()=>{if(o.trigger&&o.valueNode&&d&&h&&C&&E&&S){const z=o.trigger.getBoundingClientRect(),D=h.getBoundingClientRect(),W=o.valueNode.getBoundingClientRect(),G=S.getBoundingClientRect();if(o.dir!=="rtl"){const xe=G.left-D.left,ye=W.left-xe,J=z.left-ye,ie=z.width+J,Re=Math.max(ie,D.width),ve=window.innerWidth-mn,Ae=Z_(ye,[mn,Math.max(mn,ve-Re)]);d.style.minWidth=ie+"px",d.style.left=Ae+"px"}else{const xe=D.right-G.right,ye=window.innerWidth-W.right-xe,J=window.innerWidth-z.right-ye,ie=z.width+J,Re=Math.max(ie,D.width),ve=window.innerWidth-mn,Ae=Z_(ye,[mn,Math.max(mn,ve-Re)]);d.style.minWidth=ie+"px",d.style.right=Ae+"px"}const q=x(),B=window.innerHeight-mn*2,j=C.scrollHeight,O=window.getComputedStyle(h),$=parseInt(O.borderTopWidth,10),T=parseInt(O.paddingTop,10),U=parseInt(O.borderBottomWidth,10),H=parseInt(O.paddingBottom,10),F=$+T+j+H+U,V=Math.min(E.offsetHeight*5,F),I=window.getComputedStyle(C),Y=parseInt(I.paddingTop,10),X=parseInt(I.paddingBottom,10),ee=z.top+z.height/2-mn,re=B-ee,oe=E.offsetHeight/2,Z=E.offsetTop+oe,ce=$+T+Z,ne=F-ce;if(ce<=ee){const xe=q.length>0&&E===q[q.length-1].ref.current;d.style.bottom="0px";const ye=h.clientHeight-C.offsetTop-C.offsetHeight,J=Math.max(re,oe+(xe?X:0)+ye+U),ie=ce+J;d.style.height=ie+"px"}else{const xe=q.length>0&&E===q[0].ref.current;d.style.top="0px";const J=Math.max(ee,$+C.offsetTop+(xe?Y:0)+oe)+ne;d.style.height=J+"px",C.scrollTop=ce-ee+C.offsetTop}d.style.margin=`${mn}px 0`,d.style.minHeight=V+"px",d.style.maxHeight=B+"px",i==null||i(),requestAnimationFrame(()=>y.current=!0)}},[x,o.trigger,o.valueNode,d,h,C,E,S,o.dir,i]);Xt(()=>k(),[k]);const[R,M]=g.useState();Xt(()=>{h&&M(window.getComputedStyle(h).zIndex)},[h]);const L=g.useCallback(z=>{z&&w.current===!0&&(k(),N==null||N(),w.current=!1)},[k,N]);return l.jsx(U$,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:y,onScrollButtonChange:L,children:l.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:l.jsx(Ve.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});TA.displayName=z$;var $$="SelectPopperPosition",r0=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=mn,...o}=e,u=km(r);return l.jsx(hN,{...u,...o,ref:t,align:i,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});r0.displayName=$$;var[U$,py]=zo(ja,{}),i0="SelectViewport",MA=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...s}=e,o=Fa(i0,r),u=py(i0,r),d=it(t,o.onViewportChange),m=g.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),l.jsx(Em.Slot,{scope:r,children:l.jsx(Ve.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Le(s.onScroll,h=>{const v=h.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&p){const y=Math.abs(m.current-v.scrollTop);if(y>0){const w=window.innerHeight-mn*2,C=parseFloat(p.style.minHeight),E=parseFloat(p.style.height),S=Math.max(C,E);if(S<w){const N=S+y,k=Math.min(w,N),R=N-k;p.style.height=k+"px",p.style.bottom==="0px"&&(v.scrollTop=R>0?R:0,p.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});MA.displayName=i0;var jA="SelectGroup",[H$,F$]=zo(jA),gy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=vn();return l.jsx(H$,{scope:r,id:s,children:l.jsx(Ve.div,{role:"group","aria-labelledby":s,...i,ref:t})})});gy.displayName=jA;var DA="SelectLabel",vy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=F$(DA,r);return l.jsx(Ve.div,{id:s.id,...i,ref:t})});vy.displayName=DA;var zf="SelectItem",[W$,LA]=zo(zf),_y=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...u}=e,d=Ha(zf,r),m=Fa(zf,r),h=d.value===i,[v,p]=g.useState(o??""),[x,y]=g.useState(!1),w=pr(k=>{var R;return(R=m.itemRefCallback)==null?void 0:R.call(m,k,i,s)}),C=it(t,w),E=vn(),S=g.useRef("touch"),N=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return l.jsx(W$,{scope:r,value:i,disabled:s,textId:E,isSelected:h,onItemTextChange:g.useCallback(k=>{p(R=>R||((k==null?void 0:k.textContent)??"").trim())},[]),children:l.jsx(Em.ItemSlot,{scope:r,value:i,disabled:s,textValue:v,children:l.jsx(Ve.div,{role:"option","aria-labelledby":E,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:C,onFocus:Le(u.onFocus,()=>y(!0)),onBlur:Le(u.onBlur,()=>y(!1)),onClick:Le(u.onClick,()=>{S.current!=="mouse"&&N()}),onPointerUp:Le(u.onPointerUp,()=>{S.current==="mouse"&&N()}),onPointerDown:Le(u.onPointerDown,k=>{S.current=k.pointerType}),onPointerMove:Le(u.onPointerMove,k=>{var R;S.current=k.pointerType,s?(R=m.onItemLeave)==null||R.call(m):S.current==="mouse"&&k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Le(u.onPointerLeave,k=>{var R;k.currentTarget===document.activeElement&&((R=m.onItemLeave)==null||R.call(m))}),onKeyDown:Le(u.onKeyDown,k=>{var M;s||k.target!==k.currentTarget||((M=m.searchRef)==null?void 0:M.current)!==""&&k.key===" "||(N$.includes(k.key)&&N(),k.key===" "&&k.preventDefault())})})})})});_y.displayName=zf;var Su="SelectItemText",OA=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,...o}=e,u=Ha(Su,r),d=Fa(Su,r),m=LA(Su,r),h=j$(Su,r),[v,p]=g.useState(null),x=pr(N=>{var k;return(k=d.itemTextRefCallback)==null?void 0:k.call(d,N,m.value,m.disabled)}),y=it(t,p,m.onItemTextChange,x),w=v==null?void 0:v.textContent,C=g.useMemo(()=>l.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:S}=h;return Xt(()=>(E(C),()=>S(C)),[E,S,C]),l.jsxs(l.Fragment,{children:[l.jsx(Ve.span,{id:m.textId,...o,ref:y}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Nm(u.value)?Ia.createPortal(o.children,u.valueNode):null]})});OA.displayName=Su;var BA="SelectItemIndicator",PA=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return LA(BA,r).isSelected?l.jsx(Ve.span,{"aria-hidden":!0,...i,ref:t}):null});PA.displayName=BA;var n0="SelectScrollUpButton",xy=g.forwardRef((e,t)=>{const r=Fa(n0,e.__scopeSelect),i=py(n0,e.__scopeSelect),[s,o]=g.useState(!1),u=it(t,i.onScrollButtonChange);return Xt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollTop>0;o(h)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(IA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});xy.displayName=n0;var s0="SelectScrollDownButton",yy=g.forwardRef((e,t)=>{const r=Fa(s0,e.__scopeSelect),i=py(s0,e.__scopeSelect),[s,o]=g.useState(!1),u=it(t,i.onScrollButtonChange);return Xt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<h;o(v)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(IA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});yy.displayName=s0;var IA=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,o=Fa("SelectScrollButton",r),u=g.useRef(null),d=Rm(r),m=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>m(),[m]),Xt(()=>{var v;const h=d().find(p=>p.ref.current===document.activeElement);(v=h==null?void 0:h.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),l.jsx(Ve.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Le(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Le(s.onPointerMove,()=>{var h;(h=o.onItemLeave)==null||h.call(o),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Le(s.onPointerLeave,()=>{m()})})}),q$="SelectSeparator",by=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return l.jsx(Ve.div,{"aria-hidden":!0,...i,ref:t})});by.displayName=q$;var zA="SelectArrow",V$=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=km(r);return Fa(zA,r).position==="popper"?l.jsx(fN,{...s,...i,ref:t}):null});V$.displayName=zA;var $A="SelectBubbleInput",UA=g.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Ha($A,e),{value:s,onValueChange:o,required:u,disabled:d,name:m,autoComplete:h,form:v}=i,{nativeOptions:p,nativeSelectKey:x}=i,y=g.useRef(null),w=it(r,y),C=s??"",E=C$(C),S=Array.from(p).some(N=>(N.props.value??"")==="");return g.useEffect(()=>{const N=y.current;if(!N)return;const k=window.HTMLSelectElement.prototype,M=Object.getOwnPropertyDescriptor(k,"value").set;if(E!==C&&M){const L=new Event("change",{bubbles:!0});M.call(N,C),N.dispatchEvent(L)}},[E,C]),l.jsxs(Ve.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:h,disabled:d,form:v,onChange:N=>o(N.target.value),...t,style:{...xA,...t.style},ref:w,defaultValue:C,children:[Nm(s)&&!S?l.jsx("option",{value:""}):null,Array.from(p)]},x)});UA.displayName=$A;function G$(e){return typeof e=="function"}function Nm(e){return e===""||e===void 0}function HA(e){const t=pr(e),r=g.useRef(""),i=g.useRef(0),s=g.useCallback(u=>{const d=r.current+u;t(d),(function m(h){r.current=h,window.clearTimeout(i.current),h!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),o=g.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,o]}function FA(e,t,r){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=Y$(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function Y$(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function Am(e){return l.jsx(bA,{"data-slot":"select",...e})}const a0=g.forwardRef(({className:e,...t},r)=>l.jsx(gy,{ref:r,"data-slot":"select-group",className:ct("scroll-my-1 p-1",e),...t}));a0.displayName=gy.displayName;const ud=g.forwardRef((e,t)=>l.jsx(fy,{ref:t,"data-slot":"select-value",...e}));ud.displayName=fy.displayName;const dd=g.forwardRef(({className:e,size:t="default",children:r,...i},s)=>l.jsxs(hy,{ref:s,"data-slot":"select-trigger","data-size":t,className:ct("flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[r,l.jsx(CA,{asChild:!0,children:l.jsx(Nx,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));dd.displayName=hy.displayName;const WA=g.forwardRef(({className:e,...t},r)=>l.jsx(xy,{ref:r,"data-slot":"select-scroll-up-button",className:ct("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Q4,{"aria-hidden":"true"})}));WA.displayName=xy.displayName;const qA=g.forwardRef(({className:e,...t},r)=>l.jsx(yy,{ref:r,"data-slot":"select-scroll-down-button",className:ct("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Nx,{"aria-hidden":"true"})}));qA.displayName=yy.displayName;const hd=g.forwardRef(({className:e,children:t,position:r="popper",align:i="center",sideOffset:s=4,collisionPadding:o=8,...u},d)=>l.jsx(RA,{children:l.jsxs(my,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:i,sideOffset:s,collisionPadding:o,className:ct("cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...u,children:[l.jsx(WA,{}),l.jsx(MA,{"data-position":r,className:ct("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(qA,{})]})}));hd.displayName=my.displayName;const o0=g.forwardRef(({className:e,...t},r)=>l.jsx(vy,{ref:r,"data-slot":"select-label",className:ct("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));o0.displayName=vy.displayName;const Xn=g.forwardRef(({className:e,children:t,...r},i)=>l.jsxs(_y,{ref:i,"data-slot":"select-item",className:ct("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:l.jsx(PA,{children:l.jsx(Ba,{"aria-hidden":"true",className:"pointer-events-none"})})}),l.jsx(OA,{children:t})]}));Xn.displayName=_y.displayName;const wy=g.forwardRef(({className:e,...t},r)=>l.jsx(by,{ref:r,"data-slot":"select-separator",className:ct("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));wy.displayName=by.displayName;var K$=Object.defineProperty,sc=(e,t)=>K$(e,"name",{value:t,configurable:!0}),VA=!!(typeof window<"u"&&window.document&&window.document.createElement);function Sy(e,t,{checkForDefaultPrevented:r=!0}={}){return sc(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}sc(Sy,"composeEventHandlers");function X$(e){var t;if(!VA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}sc(X$,"getOwnerWindow");function l0(e){if(!VA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}sc(l0,"getOwnerDocument");function GA(e,t=!1){const{activeElement:r}=l0(e);if(!(r!=null&&r.nodeName))return null;if(YA(r)&&r.contentDocument)return GA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=l0(r).getElementById(i);if(s)return s}}return r}sc(GA,"getActiveElement");function YA(e){return e.tagName==="IFRAME"}sc(YA,"isFrame");var Z$=Object.defineProperty,Cy=(e,t)=>Z$(e,"name",{value:t,configurable:!0});function c0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Cy(c0,"setRef");function KA(...e){return t=>{let r=!1;const i=e.map(s=>{const o=c0(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():c0(e[s],null)}}}}Cy(KA,"composeRefs");function Tm(...e){return g.useCallback(KA(...e),e)}Cy(Tm,"useComposedRefs");var Q$=Object.defineProperty,Yi=(e,t)=>Q$(e,"name",{value:t,configurable:!0});function J$(e,t){const r=g.createContext(t);r.displayName=e+"Context";const i=Yi(o=>{const{children:u,...d}=o,m=g.useMemo(()=>d,Object.values(d));return l.jsx(r.Provider,{value:m,children:u})},"Provider");i.displayName=e+"Provider";function s(o,u={}){const{optional:d=!1}=u,m=g.useContext(r);if(m)return m;if(t!==void 0)return t;if(!d)throw new Error(`\`${o}\` must be used within \`${e}\``)}return Yi(s,"useContext"),[i,s]}Yi(J$,"createContext");function XA(e,t=[]){let r=[];function i(o,u){const d=g.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=Yi(p=>{var S;const{scope:x,children:y,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:y})},"Provider");h.displayName=o+"Provider";function v(p,x,y={}){var S;const{optional:w=!1}=y,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useContext(C);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return Yi(v,"useContext"),[h,v]}Yi(i,"createContext");const s=Yi(()=>{const o=r.map(u=>g.createContext(u));return Yi(function(d){const m=(d==null?void 0:d[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return s.scopeName=e,[i,ZA(s,...t)]}Yi(XA,"createContextScope");function ZA(...e){const t=e[0];if(e.length===1)return t;const r=Yi(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Yi(function(o){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}Yi(ZA,"composeContextScopes");var Ey=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},e9=Object.defineProperty,t9=(e,t)=>e9(e,"name",{value:t,configurable:!0}),VC=La[" useEffectEvent ".trim().toString()],GC=La[" useInsertionEffect ".trim().toString()];function QA(e){if(typeof VC=="function")return VC(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof GC=="function"?GC(()=>{t.current=e}):Ey(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}t9(QA,"useEffectEvent");var r9=Object.defineProperty,fd=(e,t)=>r9(e,"name",{value:t,configurable:!0}),i9=La[" useInsertionEffect ".trim().toString()]||Ey;function JA({prop:e,defaultProp:t,onChange:r=fd(()=>{},"onChange"),caller:i}){const[s,o,u]=eT({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s,h=g.useCallback(v=>{var p;if(d){const x=tT(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else o(v)},[d,e,o,u]);return[m,h]}fd(JA,"useControllableState");function eT({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),s=g.useRef(r),o=g.useRef(t);return i9(()=>{o.current=t},[t]),g.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}fd(eT,"useUncontrolledState");function tT(e){return typeof e=="function"}fd(tT,"isFunction");var YC=Symbol("RADIX:SYNC_STATE");function n9(e,t,r,i){const{prop:s,defaultProp:o,onChange:u,caller:d}=t,m=s!==void 0,h=QA(u),v=[{...r,state:o}];i&&v.push(i);const[p,x]=g.useReducer((E,S)=>{if(S.type===YC)return{...E,state:S.state};const N=e(E,S);return m&&!Object.is(N.state,E.state)&&h(N.state),N},...v),y=p.state,w=g.useRef(y);g.useEffect(()=>{w.current!==y&&(w.current=y,m||h(y))},[y,w,m]);const C=g.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return g.useEffect(()=>{m&&!Object.is(s,p.state)&&x({type:YC,state:s})},[s,p.state,m]),[C,x]}fd(n9,"useControllableStateReducer");var s9=Object.defineProperty,a9=(e,t)=>s9(e,"name",{value:t,configurable:!0});function rT(e){const[t,r]=g.useState(void 0);return Ey(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}a9(rT,"useSize");var o9=Object.defineProperty,sn=(e,t)=>o9(e,"name",{value:t,configurable:!0}),l9=sn(((e,t)=>{const r={...t};for(const i in t){const s=e[i],o=t[i];if(/^on[A-Z]/.test(i))if(s&&o){const d=typeof s=="function",m=typeof o=="function";r[i]=(...h)=>{const v=m?o(...h):void 0;return d&&s(...h),v}}else s&&(r[i]=s);else i==="style"?r[i]={...typeof s=="object"?s:null,...typeof o=="object"?o:null}:i==="className"?r[i]=[s,o].filter(Boolean).join(" "):i==="aria-describedby"&&(r[i]=iT(o,s))}return{...e,...r}}),"mergeProps");function iT(...e){const t=new Set;for(const r of e)if(typeof r=="string")for(const i of String(r).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}sn(iT,"concatAriaDescribedby");var nT=g.createContext(l9);nT.displayName="SlotContext";function sT(e){const t=g.forwardRef((r,i)=>{const s=g.useContext(nT);let{children:o,mergeProps:u=s,...d}=r,m=null,h=!1;const v=[];u0(o)&&typeof Uh=="function"&&(o=Uh(o._payload)),g.Children.forEach(o,w=>{var C;if(lT(w)){h=!0;const E=w;let S="child"in E.props?E.props.child:E.props.children;u0(S)&&typeof Uh=="function"&&(S=Uh(S._payload)),m=u9(E,S),v.push((C=m==null?void 0:m.props)==null?void 0:C.children)}else v.push(w)}),m?m=g.cloneElement(m,void 0,v):!h&&g.Children.count(o)===1&&g.isValidElement(o)&&(m=o);const p=m?oT(m):void 0,x=Tm(i,p);if(!m){if(o||o===0)throw new Error(h?f9(e):h9(e));return o}const y=u(d,m.props??{});return m.type!==g.Fragment&&(y.ref=i?x:p),g.cloneElement(m,y)});return t.displayName=`${e}.Slot`,t}sn(sT,"createSlot");var aT=Symbol.for("radix.slottable");function c9(e){const t=sn(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=aT,t}sn(c9,"createSlottable");var u9=sn((e,t)=>{if("child"in e.props){const r=e.props.child;return g.isValidElement(r)?g.cloneElement(r,void 0,e.props.children(r.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function oT(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}sn(oT,"getElementRef");function lT(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===aT}sn(lT,"isSlottable");var d9=Symbol.for("react.lazy");function u0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===d9&&"_payload"in e&&cT(e._payload)}sn(u0,"isLazyComponent");function cT(e){return typeof e=="object"&&e!==null&&"then"in e}sn(cT,"isPromiseLike");var h9=sn(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),f9=sn(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Uh=La[" use ".trim().toString()],m9=Object.defineProperty,p9=(e,t)=>m9(e,"name",{value:t,configurable:!0}),g9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ry=g9.reduce((e,t)=>{const r=sT(`Primitive.${t}`),i=g.forwardRef((s,o)=>{const{asChild:u,...d}=s,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function v9(e,t){e&&Ia.flushSync(()=>e.dispatchEvent(t))}p9(v9,"dispatchDiscreteCustomEvent");var _9=Object.defineProperty,Da=(e,t)=>_9(e,"name",{value:t,configurable:!0}),ky="Switch",[x9,RZ]=XA(ky),[y9,Ny]=x9(ky);function uT(e){const{__scopeSwitch:t,checked:r,children:i,defaultChecked:s,disabled:o,form:u,name:d,onCheckedChange:m,required:h,value:v="on",internal_do_not_use_render:p}=e,[x,y]=JA({prop:r,defaultProp:s??!1,onChange:m,caller:ky}),[w,C]=g.useState(null),[E,S]=g.useState(null),N=g.useRef(!1),[k,R]=g.useReducer(z=>z+1,0),M=w?!!u||!!w.closest("form"):!0,L={checked:x,setChecked:y,disabled:o,control:w,setControl:C,name:d,form:u,value:v,hasConsumerStoppedPropagationRef:N,userInteractionCount:k,onUserInteraction:R,required:h,defaultChecked:s,isFormControl:M,bubbleInput:E,setBubbleInput:S};return l.jsx(y9,{scope:t,...L,children:hT(p)?p(L):i})}Da(uT,"SwitchProvider");var b9="SwitchTrigger",w9=g.forwardRef(Da(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,form:u,value:d,disabled:m,checked:h,required:v,setControl:p,setChecked:x,hasConsumerStoppedPropagationRef:y,onUserInteraction:w,isFormControl:C,bubbleInput:E}=Ny(b9,t),S=Tm(s,p),N=g.useRef(h);return g.useEffect(()=>{const k=u?o==null?void 0:o.ownerDocument.getElementById(u):o==null?void 0:o.form;if(k instanceof HTMLFormElement){const R=Da(()=>x(N.current),"reset");return k.addEventListener("reset",R),()=>k.removeEventListener("reset",R)}},[o,u,x]),l.jsx(Ry.button,{type:"button",role:"switch","aria-checked":h,"aria-required":v,"data-state":Ay(h),"data-disabled":m?"":void 0,disabled:m,value:d,...i,ref:S,onClick:Sy(r,k=>{w(),x(R=>!R),E&&C&&(y.current=k.isPropagationStopped(),y.current||k.stopPropagation())})})},"SwitchTrigger")),dT=g.forwardRef(Da(function(t,r){const{__scopeSwitch:i,name:s,checked:o,defaultChecked:u,required:d,disabled:m,value:h,onCheckedChange:v,form:p,...x}=t;return l.jsx(uT,{__scopeSwitch:i,checked:o,defaultChecked:u,disabled:m,required:d,onCheckedChange:v,name:s,form:p,value:h,internal_do_not_use_render:({isFormControl:y})=>l.jsxs(l.Fragment,{children:[l.jsx(w9,{...x,ref:r,__scopeSwitch:i}),y&&l.jsx(R9,{__scopeSwitch:i})]})})},"Switch")),S9="SwitchThumb",C9=g.forwardRef(Da(function(t,r){const{__scopeSwitch:i,...s}=t,o=Ny(S9,i);return l.jsx(Ry.span,{"data-state":Ay(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})},"SwitchThumb")),E9="SwitchBubbleInput",R9=g.forwardRef(Da(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:m,defaultChecked:h,required:v,disabled:p,name:x,value:y,form:w,bubbleInput:C,setBubbleInput:E}=Ny(E9,t),S=Tm(s,E),N=rT(o),k=g.useRef(!1),R=g.useRef(m),M=g.useRef(d);g.useEffect(()=>{const z=C;if(!z)return;const D=window.HTMLInputElement.prototype,G=Object.getOwnPropertyDescriptor(D,"checked").set,q=d!==M.current;M.current=d;const B=R.current!==m;R.current=m;const j=!(q&&u.current);if(B&&G){k.current=!q;const O=new Event("click",{bubbles:j});G.call(z,m),z.dispatchEvent(O),k.current=!1}},[C,m,u,d]);const L=g.useRef(m);return l.jsx(Ry.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??L.current,required:v,disabled:p,name:x,value:y,form:w,...i,tabIndex:-1,ref:S,onClick:Sy(r,z=>{k.current&&z.stopPropagation()}),style:{...i.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function hT(e){return typeof e=="function"}Da(hT,"isFunction");function Ay(e){return e?"checked":"unchecked"}Da(Ay,"getState");const fT=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsx(dT,{ref:i,"data-slot":"switch","data-size":t,className:ct("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80",e),...r,children:l.jsx(C9,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"})}));fT.displayName=dT.displayName;var Mm="Tabs",[k9]=Sn(Mm,[xm]),mT=xm(),[N9,Ty]=k9(Mm),pT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:s,defaultValue:o,orientation:u="horizontal",dir:d,activationMode:m="automatic",...h}=e,v=id(d),[p,x]=Eo({prop:i,onChange:s,defaultProp:o??"",caller:Mm});return l.jsx(N9,{scope:r,baseId:vn(),value:p,onValueChange:x,orientation:u,dir:v,activationMode:m,children:l.jsx(Ve.div,{dir:v,"data-orientation":u,...h,ref:t})})});pT.displayName=Mm;var gT="TabsList",vT=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:i=!0,...s}=e,o=Ty(gT,r),u=mT(r);return l.jsx(yN,{asChild:!0,...u,orientation:o.orientation,dir:o.dir,loop:i,children:l.jsx(Ve.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});vT.displayName=gT;var _T="TabsTrigger",xT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,disabled:s=!1,...o}=e,u=Ty(_T,r),d=mT(r),m=wT(u.baseId,i),h=ST(u.baseId,i),v=i===u.value;return l.jsx(bN,{asChild:!0,...d,focusable:!s,active:v,children:l.jsx(Ve.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":h,"data-state":v?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:m,...o,ref:t,onMouseDown:Le(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?u.onValueChange(i):p.preventDefault()}),onKeyDown:Le(e.onKeyDown,p=>{s||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&u.onValueChange(i)}),onFocus:Le(e.onFocus,()=>{const p=u.activationMode!=="manual";!v&&!s&&p&&u.onValueChange(i)})})})});xT.displayName=_T;var yT="TabsContent",bT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,forceMount:s,children:o,...u}=e,d=Ty(yT,r),m=wT(d.baseId,i),h=ST(d.baseId,i),v=i===d.value,p=g.useRef(v);return g.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),l.jsx(Cn,{present:s||v,children:({present:x})=>l.jsx(Ve.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:h,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:x&&o})})});bT.displayName=yT;function wT(e,t){return`${e}-trigger-${t}`}function ST(e,t){return`${e}-content-${t}`}var A9=pT,T9=vT,M9=xT,j9=bT;const mt={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",updates:"/settings/updates",runtimes:"/settings/runtimes",providers:"/settings/providers",agents:"/settings/agents",skills:"/settings/skills",channels:"/settings/channels",instances:"/settings/instances",logs:"/settings/logs",daemon:"/settings/daemon",command:"/settings/command",computer:"/settings/computer",inspection:"/settings/inspection"},Hu="/settings",d0=mt.overview,D9="/runtimes/:runtimeSelector/sessions",L9="/runtimes/:runtimeSelector/sessions/:sessionId",Fu="!invalid-runtime-owner",O9=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,B9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",agents:"/agents",skills:"/skills",channels:"/channels",instances:"/instances",logs:"/logs"},CT=["updates","daemon","command","computer","inspection"];function P9(e){return CT.includes(e)}function ET(e,t){return!P9(e)||t}function RT(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(h0(t)||t===mt.sessions||t.startsWith(`${mt.sessions}/`))return"sessions";const r=Object.entries(mt).find(([,i])=>i===t);return(r==null?void 0:r[0])??"sessions"}function I9(e,t=!0){const r=RT(e);return r==="sessions"||!ET(r,t)?null:r}function h0(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return NT(decodeURIComponent(t[1]))}catch{return Fu}}function kT(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?Fu:NT(t[0])}function NT(e){return O9.test(e)?e:Fu}function uf(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function xo(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function AT(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==Hu&&!r.startsWith(`${Hu}/`)?r:t}class yo extends Error{constructor(r,i,s,o){super(r);Fr(this,"status");Fr(this,"code");Fr(this,"outcome");this.name="ApiRequestError",this.status=i,this.code=s,this.outcome=o}}function My(e){return e instanceof yo&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const z9="/api/runtimes/capability",$9="x-rynx-runtime-capability";let Il;async function U9(e,t,r){const i=location.protocol==="https:"?"wss":"ws",s=await Wu(r.refreshCapability),o=new URLSearchParams({capability:s,role:r.role??"owner",cols:String(r.cols),rows:String(r.rows)});return`${i}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${o.toString()}`}function H9(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams;e&&r.set("device",e);const i=r.toString();return`${t}://${location.host}/api/emulator/touch${i?`?${i}`:""}`}async function F9(e,t,r,i){const s=i?`${Br(i,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,o={method:"POST",body:JSON.stringify({resolution:r})};return(i?await kt(s,o):await Ke(s,o)).disposition}async function Ke(e,t={}){return TT(e,{},t)}async function TT(e,t,r={}){const i=new Headers(r.headers);r.body&&!i.has("content-type")&&i.set("content-type","application/json");const s=await fetch(e,{...r,headers:i});if(!s.ok){let u=`${s.status}`,d,m;try{const h=await s.json();typeof h.error=="string"&&(d=h.error,u=h.error),(h.outcome==="not_started"||h.outcome==="unknown")&&(m=h.outcome)}catch{}throw new yo(u,s.status,d,m)}const o=await s.text();return o?JSON.parse(o):t}async function Wu(e=!1){return e&&(Il=void 0),Il||(Il=Ke(z9,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw Il=void 0,t})),Il}async function kt(e,t){const r=async s=>{const o=new Headers(t.headers);return o.set($9,s),Ke(e,{...t,headers:o})},i=await Wu();try{return await r(i)}catch(s){if(!(s instanceof Error)||s.message!=="invalid_runtime_capability")throw s;return Il=void 0,r(await Wu())}}async function yv(e,t={}){const r=new Headers(t.headers),i=await fetch(e,{...t,headers:r});if(!i.ok){let s=`${i.status}`;try{const o=await i.json();o.error&&(s=o.error)}catch{}throw new Error(s)}return i.blob()}async function KC(e,t,r,i){const s=new Headers({"content-type":"application/json"}),o=await fetch(e,{method:"POST",headers:s,body:t===void 0?void 0:JSON.stringify(t),signal:i});await MT(o,r)}async function W9(e,t,r){const i=await fetch(e,{signal:r});await MT(i,t)}async function MT(e,t){if(!e.ok||!e.body){let o=`${e.status}`;try{const u=await e.json();u.error&&(o=u.error)}catch{}throw new Error(o)}const r=e.body.getReader(),i=new TextDecoder;let s="";for(;;){const{done:o,value:u}=await r.read();if(o)break;s+=i.decode(u,{stream:!0});let d;for(;(d=s.indexOf(`
531
+
532
+ `))!==-1;){const m=s.slice(0,d);s=s.slice(d+2);const h=q9(m);h&&t(h)}}}function q9(e){let t="message",r="";for(const s of e.split(`
533
+ `))s.startsWith("event:")?t=s.slice(6).trim():s.startsWith("data:")&&(r+=s.slice(5).trim());if(!t&&!r)return null;let i={};try{r&&(i=JSON.parse(r))}catch{}return{event:t,data:i}}function f0(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function su(e,t,r){const i=f0(e,t);return e?kt(i,r):Ke(i,r)}function Br(e,t,r){const i=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return i;const s=`${i}/${encodeURIComponent(t)}`;return r?`${s}/${r}`:s}function zl(e,t,...r){const i=`${Br(e,t)}/browser`;return r.length===0?i:`${i}/${r.map(s=>encodeURIComponent(s)).join("/")}`}function uo(e,t,r){const i=`${Br(e,t)}/emulator`;return r?`${i}/${r}`:i}function V9(e,t,r){const i=new URLSearchParams({bindingId:r});return`${Br(e,t)}/emulator/frame?${i.toString()}`}function au(e,t,r,i,s){return kt(zl(e,t,"pages",i,s),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function bv(e,t,r){return e?Br(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const be={meta:()=>Ke("/api/meta"),listRuntimeShareAddresses:()=>Ke("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>kt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Ke("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>kt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>kt(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>Ke("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Ke(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>kt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Ke(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>kt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>kt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>kt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>TT(zl(e,t),null),openRuntimeBrowser:(e,t,r)=>kt(zl(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>kt(zl(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,i)=>kt(zl(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...i===void 0?{}:{url:i}})}),closeRuntimeBrowserPage:(e,t,r,i)=>au(e,t,r,i,"close"),activateRuntimeBrowserPage:(e,t,r,i)=>au(e,t,r,i,"activate"),navigateRuntimeBrowserPage:(e,t,r,i,s)=>kt(zl(e,t,"pages",i,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:s})}),backRuntimeBrowserPage:(e,t,r,i)=>au(e,t,r,i,"back"),forwardRuntimeBrowserPage:(e,t,r,i)=>au(e,t,r,i,"forward"),reloadRuntimeBrowserPage:(e,t,r,i)=>au(e,t,r,i,"reload"),getSessionEmulator:(e,t)=>Ke(uo(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Ke(uo(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>kt(uo(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>kt(uo(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,i,s)=>kt(uo(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:i,y:s})}),gestureSessionEmulator:(e,t,r,i)=>kt(uo(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:i})}),buttonSessionEmulator:(e,t,r,i)=>kt(uo(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:i})}),sessionEmulatorFrameBlob:(e,t,r,i)=>yv(V9(e,t,r),{signal:i,cache:"no-store"}),channelTypes:()=>Ke("/api/channel-types").then(e=>e.channelTypes),listChannels:()=>Ke("/api/channels").then(e=>e.channels),createChannel:e=>Ke("/api/channels",{method:"POST",body:JSON.stringify(e)}),updateChannel:(e,t)=>Ke(`/api/channels/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteChannel:e=>Ke(`/api/channels/${encodeURIComponent(e)}`,{method:"DELETE"}),authorizeChannel:(e,t,r)=>KC(`/api/channels/${encodeURIComponent(e)}/authorize`,void 0,t,r),listInstances:()=>Ke("/api/instances").then(e=>e.instances),createInstance:e=>Ke("/api/instances",{method:"POST",body:JSON.stringify(e)}),updateInstance:(e,t)=>Ke(`/api/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),instanceAction:(e,t)=>Ke(`/api/instances/${encodeURIComponent(e)}/${t}`,{method:"POST"}),deleteInstance:e=>Ke(`/api/instances/${encodeURIComponent(e)}`,{method:"DELETE"}),emulatorDevices:e=>Ke(f0(e,"devices")).then(t=>t.devices),activeEmulator:e=>Ke(f0(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>su(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,i)=>su(i,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>su(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>su(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>su(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>yv(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>Ke("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>yv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Ke("/api/agents").then(e=>e.agents),getAgent:e=>Ke(`/api/agents/${encodeURIComponent(e)}`),writeAgent:e=>Ke("/api/agents",{method:"POST",body:JSON.stringify(e)}),deleteAgent:e=>Ke(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listSkills:()=>Ke("/api/skills").then(e=>e.skills),getSkill:e=>Ke(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Ke(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Ke("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),deleteSkill:e=>Ke(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),logs:(e,t=200)=>Ke(`/api/logs?lines=${t}${e?`&instance=${encodeURIComponent(e)}`:""}`).then(r=>r.logs),listSessions:e=>Ke(e?Br(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Ke(`${Br(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Ke(`${Br(e)}/launch-options`),createSession:(e,t)=>{const r=t?Br(t):"/api/sessions",i={method:"POST",body:JSON.stringify(e)};return t?kt(r,i):Ke(r,i)},sendSessionMessage:(e,t,r,i,s)=>s?kt(Br(s,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:i}).then(()=>{}):KC(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,i),getSessionResourcePolicy:(e,t)=>Ke(`${Br(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,i,s)=>kt(Br(e,t,"resources"),{method:"POST",body:r,signal:s,headers:{"content-type":r.type,"x-rynx-upload-id":i,"x-rynx-filename":encodeURIComponent(r.name)}}).then(o=>o.resource),deleteSessionResource:(e,t,r)=>kt(`${Br(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>`${Br(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`,enqueueSessionMessage:(e,t,r)=>kt(Br(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t,r)=>kt(Br(e,t,"terminal/start"),{method:"POST",body:"{}",signal:r}),streamSession:(e,t,r,i)=>W9(bv(i,e,"stream"),t,r),getSessionHistory:e=>Ke(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Ke(bv(r,e,"snapshot"),{signal:t}),closeSession:(e,t)=>{const r=t?Br(t,e):`/api/sessions/${encodeURIComponent(e)}`,i={method:"DELETE"};return t?kt(r,i):Ke(r,i)},interruptSession:(e,t)=>{const r=bv(t,e,"interrupt"),i={method:"POST"};return t?kt(r,i):Ke(r,i)}},jT="rynx.control.runtime-target.v1",DT={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function G9(e){var t;if(!e)return"local";try{return((t=e.getItem(jT))==null?void 0:t.trim())||"local"}catch{return"local"}}function XC(e,t){if(e)try{e.setItem(jT,t)}catch{}}function Y9(e){const t=new Map;for(const r of e)!r.selector||t.has(r.selector)||t.set(r.selector,r);return t.has("local")||t.set("local",DT),[...t.values()].sort((r,i)=>r.selector==="local"?-1:i.selector==="local"?1:r.displayName.localeCompare(i.displayName))}const LT=g.createContext(null);function K9({children:e}){const t=Hr(),r=Oa(),i=h0(t.pathname)??(t.pathname===mt.sessions?kT(t.search):null),[s,o]=g.useState(()=>G9(typeof window>"u"?void 0:window.localStorage)),u=i??s,[d,m]=g.useState([DT]),h=g.useCallback(y=>{m(Y9(y))},[]),v=g.useCallback(async()=>{try{h(await be.listRuntimes())}catch(y){_e.error(`Failed to load Runtimes: ${y.message}`)}},[h]);g.useEffect(()=>{v()},[v]),g.useEffect(()=>{!i||i===Fu||(o(i),XC(typeof window>"u"?void 0:window.localStorage,i))},[i]);const p=g.useCallback(y=>{const w=y.trim();if(!w)return;o(w),XC(typeof window>"u"?void 0:window.localStorage,w),(t.pathname===mt.sessions||t.pathname.startsWith(`${mt.sessions}/`)||h0(t.pathname)!==null)&&i!==w&&r(xo(w))},[t.pathname,r,i]),x=g.useMemo(()=>{const y=d.find(C=>C.selector===u)??(u===Fu?{selector:u,daemonId:u,displayName:"Invalid Runtime URL",binding:"direct"}:{selector:u,daemonId:u,displayName:`${u} (unavailable)`,binding:u==="local"?"local":"direct"}),w=u!=="local";return{runtimes:d,runtimeSelector:u,runtimeRoute:w?u:void 0,selectedRuntime:y,isRemoteRuntime:w,selectRuntime:p,refreshRuntimes:v,updateRuntimes:h}},[v,u,d,p,h]);return l.jsx(LT.Provider,{value:x,children:e})}function ac(){const e=g.useContext(LT);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const ZC="!add-runtime";function X9(){const e=Hr(),t=Oa(),{runtimes:r,runtimeSelector:i,selectedRuntime:s,selectRuntime:o}=ac(),u=r.some(m=>m.selector===i)?r:[...r,s],d=m=>{if(m===ZC){t(mt.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}o(m)};return l.jsx("div",{className:"ml-auto w-44 max-w-full sm:w-60",children:l.jsxs(Am,{value:i,onValueChange:d,children:[l.jsxs(dd,{className:"h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7","aria-label":"Active Runtime",children:[l.jsx("span",{className:"hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline",children:"Runtime ·"}),l.jsx(ud,{placeholder:"Select Runtime"})]}),l.jsxs(hd,{align:"end",children:[u.map(m=>{const h=m.binding==="local"?jx:ed;return l.jsx(Xn,{value:m.selector,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(h,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),l.jsx(wy,{}),l.jsx(Xn,{value:ZC,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Qi,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function oc(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function OT(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function df(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||OT(e)&&t}const BT=g.createContext({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function Z9({children:e}){const t=oc(),[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState(null);g.useEffect(()=>{if(!t)return;let p=!0;const x=t.onAppUpdateStatus(y=>{p&&(i(y),y.error||d(null))});return t.getAppUpdateStatus().then(y=>{p&&i(y)}).catch(y=>{p&&d(wv(y))}),()=>{p=!1,x()}},[t]);const m=g.useCallback(async()=>{if(!t)return null;o("check"),d(null);try{const p=await t.checkForAppUpdates();return i(p),p}catch(p){return d(wv(p)),null}finally{o(null)}},[t]),h=g.useCallback(async()=>{if(!t)return null;o("install"),d(null);try{const p=await t.installAppUpdate();return i(p),p}catch(p){return d(wv(p)),null}finally{o(null)}},[t]),v=g.useMemo(()=>({status:r,operation:s,error:u,checkForUpdates:m,installUpdate:h}),[m,u,h,s,r]);return l.jsx(BT.Provider,{value:v,children:e})}function PT(){return g.useContext(BT)}function wv(e){return e instanceof Error?e.message:String(e)}function Q9(){const{status:e,operation:t,error:r,installUpdate:i}=PT();if(!(e!=null&&e.availableVersion)||e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="installing")return null;const s=t==="install"||e.phase==="installing",o=e.phase==="ready"&&!s,u=r??e.error;return l.jsxs("div",{className:"group/update relative flex shrink-0 items-center",children:[l.jsxs(he,{variant:"ghost",size:"icon-xs",className:"relative text-[var(--primary)] hover:text-[var(--primary)]","aria-label":`Rynx ${e.availableVersion} update available`,"aria-haspopup":"dialog",children:[e.phase==="downloading"||s?l.jsx(Ge,{className:"animate-spin"}):l.jsx(Wl,{}),l.jsx("span",{className:"absolute right-0.5 top-0.5 size-1.5 rounded-full bg-[var(--primary)] ring-2 ring-[var(--background)]","aria-hidden":"true"})]}),l.jsx("div",{role:"dialog","aria-label":"Rynx update",className:"invisible absolute bottom-full right-0 z-50 w-72 translate-y-1 pb-2 opacity-0 transition-[opacity,transform,visibility] duration-150 group-hover/update:visible group-hover/update:translate-y-0 group-hover/update:opacity-100 group-focus-within/update:visible group-focus-within/update:translate-y-0 group-focus-within/update:opacity-100",children:l.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-[var(--popover)] p-3 font-sans text-[var(--popover-foreground)] shadow-xl",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]",children:o?l.jsx(Wl,{className:"size-4"}):e.phase==="downloading"?l.jsx(Mx,{className:"size-4"}):l.jsx(Ge,{className:"size-4 animate-spin"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-xs font-semibold text-[var(--foreground)]",children:o?"Update ready":s?"Preparing update":"Downloading update"}),l.jsx("p",{className:"mt-0.5 text-[11px] leading-4 text-[var(--muted-foreground)]",children:o?`${e.appName} ${e.availableVersion} is ready to install.`:s?"Rynx will restart when the local Runtime is safe to stop.":`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),o&&l.jsxs(he,{size:"sm",className:"mt-3 w-full",onClick:()=>void i(),children:[l.jsx(Wl,{}),"Restart to update"]}),u&&l.jsx("p",{className:"mt-2 text-[10px] leading-4 text-[var(--destructive)]",children:u})]})})]})}function qe(...e){return zk(Hx(e))}function J9({children:e,theme:t,onToggleTheme:r}){const i=Hr(),{runtimeSelector:s}=ac(),o=RT(i.pathname),u=i.pathname===Hu||i.pathname.startsWith(`${Hu}/`),d=AT(i.state,xo(s)),m=u?d:d0,h=u?void 0:{returnTo:`${i.pathname}${i.search}${i.hash}`};return l.jsxs("div",{className:"grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]",children:[l.jsx("main",{className:"min-h-0 overflow-hidden focus:outline-none",children:e}),l.jsxs("footer",{className:"app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3",children:[l.jsx("span",{className:"hidden truncate uppercase tracking-[0.12em] min-[480px]:block",children:u?o==="emulator"?"Emulator · local device":"Settings · local configuration":"Session workbench"}),l.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[u?l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[l.jsx("span",{className:"text-[var(--foreground)]",children:"Control Plane"}),l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:"This device"})]}):l.jsx(X9,{}),l.jsx("span",{className:"h-3.5 w-px bg-[var(--border)]","aria-hidden":"true"}),l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[l.jsx(Q9,{}),l.jsx(he,{variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:r,"aria-label":t==="dark"?"Use light mode":"Use dark mode",title:t==="dark"?"Light mode":"Dark mode",children:t==="dark"?l.jsx(YB,{}):l.jsx(eB,{})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"icon-xs",className:qe("shrink-0",u&&"text-[var(--primary)]"),children:l.jsx(Sa,{to:m,state:h,"aria-label":u?"Back to app":"Settings",title:u?"Back to app":"Settings",children:l.jsx(DB,{})})})]})]})]})]})}const $f="/assets/rynx-wordmark-LL1QRYHD.png";function eU({bridge:e,children:t}){const[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState("refresh"),[m,h]=g.useState(!1),v=g.useCallback(async(E=!1)=>{d("refresh"),o(null);try{const S=await e.getStatus(E);df(S,!1)?i(await e.completeOnboarding()):i(S)}catch(S){o(S.message)}finally{d(null)}},[e]);g.useEffect(()=>{e.initialOnboardingCompleted||v()},[e.initialOnboardingCompleted,v]);const p=r?df(r,m):!1;async function x(){const E=r==null?void 0:r.globalCli.path;if(E){d("install"),o(null);try{const S=await e.installCli(E);h(!1),df(S,!1)?i(await e.completeOnboarding()):i(S)}catch(S){o(S.message);try{i(await e.getStatus(!0))}catch{}}finally{d(null)}}}async function y(){d("runtime"),o(null);try{i(await e.restartDaemon())}catch(E){o(E.message)}finally{d(null)}}async function w(){if(!(!r||!p)){d("complete"),o(null);try{i(await e.completeOnboarding())}catch(E){o(E.message)}finally{d(null)}}}if(e.initialOnboardingCompleted||r!=null&&r.onboardingCompleted)return t;const C=!!(r!=null&&r.runtime.ready&&(r!=null&&r.builtinSkill.ready));return l.jsxs("div",{className:"grid h-dvh min-h-0 overflow-hidden bg-[var(--background)] md:grid-cols-[15rem_minmax(0,1fr)]",children:[l.jsxs("aside",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] bg-[var(--muted)]/18 p-4 md:border-r md:border-b-0 md:p-5",children:[l.jsx("img",{src:$f,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),l.jsxs("div",{className:"app-no-drag mt-6",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsx("p",{className:"label-caps text-[10px] text-[var(--primary)]",children:"Setup"}),l.jsx("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:"1/1"})]}),l.jsx("ol",{className:"mt-3","aria-label":"Setup steps",children:l.jsxs("li",{"aria-current":"step",className:"flex items-center gap-2 rounded-lg bg-[var(--muted)] px-3 py-2.5 text-sm font-medium text-[var(--foreground)] ring-1 ring-inset ring-[var(--border)]",children:[l.jsx("span",{className:"grid size-5 shrink-0 place-items-center rounded-full bg-[var(--primary)] text-[10px] font-semibold text-[var(--primary-foreground)]",children:"1"}),l.jsx("span",{className:"truncate",children:"Terminal command"})]})})]})]}),l.jsxs("main",{className:"app-no-drag relative min-h-0 overflow-auto",children:[l.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),l.jsx("div",{className:"grid min-h-full place-items-center px-5 py-12 sm:px-8 md:px-12",children:l.jsxs("section",{className:"w-full max-w-xl","aria-labelledby":"onboarding-command-title",children:[l.jsx(tU,{titleId:"onboarding-command-title",title:"Set up the Terminal command",description:"Install one small command so Rynx is available from any Terminal."}),l.jsx("div",{className:"mt-7 rounded-lg border border-[var(--border)] bg-[var(--card)] p-5 shadow-sm","aria-busy":u!==null,children:r?C?l.jsx(rU,{status:r,pending:u,acknowledged:m,onAcknowledgedChange:h,onInstall:()=>void x(),onRefresh:()=>void v(!0),onContinue:()=>void w()}):l.jsx(iU,{status:r,pending:u,onRetry:()=>void y()}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="refresh"&&l.jsx(Ge,{className:"size-4 animate-spin"}),u==="refresh"?"Getting Rynx ready…":"Setup status is unavailable."]})}),s&&l.jsxs("div",{role:"alert",className:"mt-5 flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(tc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})})]})]})}function tU({titleId:e,title:t,description:r}){return l.jsxs("div",{children:[l.jsx("h1",{id:e,className:"text-2xl font-semibold tracking-tight",children:t}),l.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-[var(--muted-foreground)]",children:r})]})}function rU({status:e,pending:t,acknowledged:r,onAcknowledgedChange:i,onInstall:s,onRefresh:o,onContinue:u}){const m=e.globalCli.state==="installed"&&!e.globalCli.canInstall,h=OT(e),v=df(e,r);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:m?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:m?l.jsx(Ba,{className:"size-4"}):l.jsx(Tx,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-medium",children:"Terminal command"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:nU(e)})]})]}),h&&l.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--background))] p-3 text-xs",children:[l.jsx("input",{type:"checkbox",checked:r,onChange:p=>i(p.target.checked),className:"mt-0.5 size-4 shrink-0 accent-[var(--primary)]"}),l.jsxs("span",{children:["Continue without Terminal access. I'll resolve the"," ",l.jsx("code",{className:"font-mono",children:"rynx"})," command later."]})]}),l.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[e.globalCli.canInstall&&l.jsxs(he,{disabled:t!==null,onClick:s,children:[t==="install"&&l.jsx(Ge,{className:"animate-spin"}),"Install command"]}),(m||h)&&l.jsxs(he,{disabled:t!==null||!v,onClick:u,children:["Continue",l.jsx(kR,{})]}),l.jsxs(he,{variant:"outline",disabled:t!==null,onClick:o,children:[l.jsx(Nt,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function iU({status:e,pending:t,onRetry:r}){return l.jsxs("div",{role:"alert",className:"flex items-start gap-3",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:l.jsx(tc,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{className:"text-sm font-medium",children:e.builtinSkill.ready?"Rynx couldn’t finish starting":"Rynx needs to be reinstalled"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:e.builtinSkill.ready?"Try again to continue.":"A required app component is unavailable. Reinstall Rynx, then open it again."}),e.builtinSkill.ready&&l.jsxs(he,{className:"mt-4",variant:"outline",disabled:t!==null,onClick:r,children:[t==="runtime"&&l.jsx(Ge,{className:"animate-spin"}),"Try again"]})]})]})}function nU(e){switch(e.globalCli.state){case"installed":return e.globalCli.canInstall?"Install the rynx command to use Rynx from Terminal.":"Rynx is ready to use from Terminal.";case"missing":return"Install the rynx command to use Rynx from Terminal.";case"stale":return"An older rynx command was found. Repair it to continue.";case"foreign":return"Another command named rynx already exists. Resolve it later in Settings.";case"unwritable":return"Rynx could not install the command automatically. Resolve it later in Settings.";case"error":return"Rynx could not check the command. Check again before continuing."}}function sU({bridge:e}){const[t,r]=g.useState(null),[i,s]=g.useState(!1),[o,u]=g.useState(null),d=g.useRef(!1),m=g.useRef(0),h=g.useCallback(y=>{y.requestId<=m.current||(m.current=y.requestId,r(y),s(!1),u(null),d.current=!1)},[]);g.useEffect(()=>{let y=!0;const w=e.onQuitPrompt(C=>{y&&h(C)});return e.getPendingQuitPrompt().then(C=>{y&&C&&h(C)}).catch(()=>{}),()=>{y=!1,w()}},[h,e]);const v=g.useCallback(async()=>{if(!(!t||i||d.current)){d.current=!0;try{const y=await e.respondToQuit(t.requestId,"cancel");if(y.outcome==="failed"){u(y.message);return}if(y.outcome==="quitting"){s(!0);return}y.outcome==="cancelled"&&(r(null),u(null))}catch{u("Rynx couldn’t dismiss the quit request. Try again.")}finally{d.current=!1}}},[e,t,i]),p=g.useCallback(async()=>{if(!(!t||t.kind!=="active-work"||d.current)){d.current=!0,s(!0),u(null);try{const y=await e.respondToQuit(t.requestId,"force");y.outcome==="failed"?(u(y.message),s(!1)):y.outcome==="cancelled"&&(r(null),s(!1))}catch{u("Rynx couldn’t stop the running work. Try again."),s(!1)}finally{d.current=!1}}},[e,t]),x=(t==null?void 0:t.kind)==="active-work";return l.jsx(Rn,{open:t!==null,onOpenChange:y=>{y||v()},children:l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(d8,{className:"bg-destructive/10 text-destructive",children:l.jsx(Ea,{"aria-hidden":"true"})}),l.jsx(en,{children:x?"Quit Rynx?":"Rynx couldn’t quit"}),l.jsx(tn,{children:x?"Work is still running. Quitting now will stop it and close the open workspace.":"Rynx couldn’t stop its local service safely. Keep the app open and try again."})]}),o&&l.jsx("p",{role:"alert",className:"text-sm text-destructive",children:o}),l.jsxs(Nn,{children:[l.jsx(rn,{disabled:i,children:x?"Keep working":"Close"}),x&&l.jsx(he,{type:"button",variant:"destructive",disabled:i,onClick:()=>void p(),children:i?l.jsxs(l.Fragment,{children:[l.jsx(Ge,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const aU=[{label:"General",items:[{id:"overview",label:"Overview",icon:zO},{id:"updates",label:"Software update",icon:Wl}]},{label:"Connections",items:[{id:"runtimes",label:"Runtimes",icon:ed}]},{label:"Devices",items:[{id:"emulator",label:"Emulator",icon:Kl}]},{label:"Desktop",items:[{id:"daemon",label:"Daemon",icon:Rf},{id:"command",label:"Terminal command",icon:Tx},{id:"computer",label:"Computer integration",icon:DR},{id:"inspection",label:"Chrome inspection",icon:RB}]},{label:"Agents",items:[{id:"providers",label:"Providers",icon:Lx},{id:"agents",label:"Agents",icon:Rx},{id:"skills",label:"Skills",icon:zR}]},{label:"Integrations",items:[{id:"channels",label:"Channels",icon:kx},{id:"instances",label:"Instances",icon:NR}]},{label:"Diagnostics",items:[{id:"logs",label:"Logs",icon:PR}]}];function oU({activeView:e,desktopIntegrationAvailable:t,children:r}){const i=Oa(),s=Hr(),{runtimeSelector:o}=ac(),u=AT(s.state,xo(o)),d={returnTo:u},m=aU.map(v=>({...v,items:v.items.filter(({id:p})=>ET(p,t))})).filter(v=>v.items.length>0),h=m.flatMap(v=>v.items);return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[l.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[l.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:l.jsxs(Sa,{to:u,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[l.jsx("img",{src:$f,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),l.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:l.jsxs(Sa,{to:u,children:[l.jsx(Yl,{className:"size-3.5"}),"Back to app"]})})]}),l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:m.map(v=>l.jsxs("div",{children:[l.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:v.label}),l.jsx("div",{className:"grid gap-0.5",children:v.items.map(({id:p,label:x,icon:y})=>l.jsxs(Sa,{to:mt[p],state:d,"aria-current":e===p?"page":void 0,className:qe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",e===p?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]"),children:[l.jsx(y,{className:"size-3.5 shrink-0"}),x]},p))})]},v.label))})})]}),l.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[l.jsx(Sa,{to:u,className:"app-no-drag shrink-0","aria-label":"Rynx",children:l.jsx("img",{src:$f,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:l.jsxs(Sa,{to:u,children:[l.jsx(Yl,{className:"size-3.5"}),"Back"]})}),l.jsx(Ma,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:v=>i(mt[v.target.value],{state:d}),children:h.map(({id:v,label:p})=>l.jsx("option",{value:v,children:p},v))})]}),e==="emulator"?l.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:r}):l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var lU="Label",IT=g.forwardRef((e,t)=>l.jsx(Ve.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));IT.displayName=lU;var cU=IT;const $r=g.forwardRef(({className:e,...t},r)=>l.jsx(cU,{ref:r,className:qe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));$r.displayName="Label";function zT({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[i,s]=g.useState(!1),[o,u]=g.useState(""),[d,m]=g.useState(""),[h,v]=g.useState(""),[p,x]=g.useState(!1);function y(){u(""),m(""),v("")}const w=(()=>{const N=o.trim();return!N||!d.trim()?N:`${N}#${d.trim()}`})(),C=!!d.trim()&&o.includes("#");async function E(){const N=w;if(N){if(C){_e.error("Source already pins a ref with '#' — clear one of the two.");return}x(!0);try{const k=await be.installSkill({tool:"skills-cli",source:N,...h.trim()?{skill:h.trim()}:{}});_e.success(`Installed ${h.trim()||N}`),e(k),y(),s(!1)}catch(k){_e.error(`Install failed: ${k.message}`)}finally{x(!1)}}}const S=["npx skills add",w||"<source>",h.trim()&&`--skill ${h.trim()}`].filter(Boolean).join(" ");return l.jsxs(Oo,{open:i,onOpenChange:N=>{s(N),N||y()},children:[l.jsx(Hk,{asChild:!0,children:l.jsxs(he,{size:"sm",variant:r,children:[l.jsx(Qi,{})," ",t]})}),l.jsxs($a,{children:[l.jsxs(Bo,{children:[l.jsx(Ua,{children:"Install a skill"}),l.jsxs(fm,{children:["From the open skills ecosystem (skills.sh). Runs ",l.jsx("code",{children:"npx skills add"})," into the global catalog (",l.jsx("code",{children:"~/.rynx/skills"}),")."]})]}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs($r,{children:["Source ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(yt,{value:o,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:N=>u(N.target.value)}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",l.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Skill"}),l.jsx(yt,{value:h,placeholder:"find-skills",onChange:N=>v(N.target.value)}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Branch"}),l.jsx(yt,{value:d,placeholder:"main",onChange:N=>m(N.target.value)}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Optional — a git ref, sent as ",l.jsx("code",{children:"#<branch>"}),"."]})]})]}),l.jsx("pre",{className:"overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]",children:S})]}),l.jsxs(rd,{children:[l.jsx(he,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),l.jsx(he,{onClick:E,disabled:p||!o.trim(),children:p?"Installing…":"Install"})]})]})]})}const uU=["codex","traex","claude"],dU=["none","minimal","low","medium","high","xhigh","max","ultra"],hU=["read-only","workspace-write","danger-full-access"],fU=["never","on-failure","on-request","untrusted"],mU=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function pU({value:e,onChange:t}){return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:l.jsx(yt,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),l.jsx(tr,{label:"Description",children:l.jsx(yt,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),l.jsx(tr,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:l.jsx(Sm,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function gU({value:e,onChange:t}){const r=e.executor??{},i=r.retry??{},s=u=>t({...e,executor:{...r,...u}}),o=u=>t({...e,executor:{...r,retry:{...i,...u}}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(tr,{label:"Runtime",children:l.jsx(ju,{value:r.runtime,options:uU,required:!0,onChange:u=>s({runtime:u})})}),l.jsx(tr,{label:"Reasoning effort",children:l.jsx(ju,{value:r.reasoningEffort,options:dU,onChange:u=>s({reasoningEffort:u})})})]}),l.jsx(tr,{label:"Model",help:"Blank inherits the runtime default.",children:l.jsx(yt,{value:r.model??"",placeholder:"runtime default",onChange:u=>s({model:u.target.value||void 0})})}),l.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(tr,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:l.jsx(ou,{value:r.timeout,onChange:u=>s({timeout:u})})}),l.jsx(tr,{label:"Max iterations",help:"claude only (→ --max-turns).",children:l.jsx(ou,{value:r.maxIterations,onChange:u=>s({maxIterations:u})})}),l.jsx(tr,{label:"Context window",help:"codex/traex token budget.",children:l.jsx(ou,{value:r.contextWindow,onChange:u=>s({contextWindow:u})})}),l.jsx(tr,{label:"Retry: max retries",children:l.jsx(ou,{value:i.maxRetries,onChange:u=>o({maxRetries:u})})}),l.jsx(tr,{label:"Retry: timeout/req (s)",children:l.jsx(ou,{value:i.timeoutPerRequestSeconds,onChange:u=>o({timeoutPerRequestSeconds:u})})})]})]})}function vU({value:e,onChange:t}){var o;const r=e.osEnv??{},i=u=>t({...e,osEnv:{...r,...u}}),s=((o=e.executor)==null?void 0:o.runtime)??"codex";return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s==="claude"?l.jsx(tr,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:l.jsx(ju,{value:r.permissionMode,options:mU,onChange:u=>i({permissionMode:u})})}):l.jsxs(l.Fragment,{children:[l.jsx(tr,{label:"Sandbox",children:l.jsx(ju,{value:r.sandbox,options:hU,onChange:u=>i({sandbox:u})})}),l.jsx(tr,{label:"Approval policy",help:"Codex's approval axis.",children:l.jsx(ju,{value:r.approvalPolicy,options:fU,onChange:u=>i({approvalPolicy:u})})})]}),l.jsx(tr,{label:"Working directory (cwd)",children:l.jsx(yt,{value:r.cwd??"",placeholder:"(inherit)",onChange:u=>i({cwd:u.target.value||void 0})})}),l.jsx(tr,{label:"Full auto",children:l.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[l.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:u=>i({fullAuto:u.target.checked||void 0})}),l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]}),l.jsx(tr,{label:"Allowed dirs",help:"Extra writable roots beyond the base allow-list.",children:l.jsx(p0,{items:r.allowedDirs??[],placeholder:"/path/to/dir",onChange:u=>i({allowedDirs:u})})})]})}function _U({value:e,onChange:t}){const r=e.tools??{},i=s=>t({...e,tools:{...r,...s}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:l.jsx(p0,{items:r.allowed??[],placeholder:"ToolName",onChange:s=>i({allowed:s})})}),l.jsx(tr,{label:"Disallowed tools",children:l.jsx(p0,{items:r.disallowed??[],placeholder:"ToolName",onChange:s=>i({disallowed:s})})}),l.jsx(tr,{label:"MCP servers",help:"HTTP transport only.",children:l.jsx(yU,{rows:r.mcp??[],onChange:s=>i({mcp:s})})})]})}function xU({value:e,onChange:t}){const r=e.skills??[],[i,s]=g.useState(null);g.useEffect(()=>{be.listSkills().then(s).catch(v=>{s([]),_e.error(`Load skills failed: ${v.message}`)})},[]);const o=new Set(r.map(v=>v.name)),u=v=>{v.ref&&t({...e,skills:[...r,{...v.ref}]})},d=v=>t({...e,skills:r.filter(p=>p.name!==v)}),m=new Set((i??[]).map(v=>v.name)),h=r.map(v=>v.name).filter(v=>!m.has(v));return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:i===null?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):i.length===0&&h.length===0?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):l.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[i.map(v=>l.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(v.ref?"cursor-pointer hover:bg-[var(--muted)]/50":"opacity-60"),children:[l.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",disabled:!v.ref,checked:o.has(v.name),onChange:p=>p.target.checked?u(v):d(v.name)}),l.jsxs("span",{className:"grid",children:[l.jsxs("span",{className:"font-mono text-sm",children:[v.name,!v.ref&&l.jsx("span",{className:"ml-1 text-xs text-[var(--warning)]",children:"(no install recipe — reinstall to make selectable)"})]}),l.jsx("span",{className:"line-clamp-2 text-xs text-[var(--muted-foreground)]",children:v.description})]})]},v.name)),h.map(v=>l.jsxs("label",{className:"flex items-center gap-2 rounded-sm p-1.5",children:[l.jsx("input",{type:"checkbox",className:"size-4 shrink-0",checked:!0,onChange:()=>d(v)}),l.jsxs("span",{className:"font-mono text-sm",children:[v," ",l.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},v))]})}),l.jsx("div",{children:l.jsx(zT,{onInstalled:s,triggerVariant:"outline"})})]})}function $T(e){const{skills:t,...r}=e,i=m0(r)??{};return Array.isArray(t)&&t.length>0&&(i.skills=t),i}function m0(e){if(Array.isArray(e)){const t=e.map(m0).filter(r=>r!==void 0);return t.length>0?t:void 0}if(e&&typeof e=="object"){const t={};for(const[r,i]of Object.entries(e)){const s=m0(i);s!==void 0&&(t[r]=s)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function tr({label:e,help:t,children:r}){return l.jsxs("div",{className:"grid content-start gap-1.5",children:[l.jsx($r,{children:e}),r,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const Sv="__default__";function ju({value:e,options:t,onChange:r,disabled:i,required:s}){return l.jsxs(Am,{value:e??(s?t[0]:Sv),disabled:i,onValueChange:o=>r(o===Sv?void 0:o),children:[l.jsx(dd,{children:l.jsx(ud,{})}),l.jsxs(hd,{children:[!s&&l.jsx(Xn,{value:Sv,children:l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(o=>l.jsx(Xn,{value:o,children:o},o))]})]})}function ou({value:e,onChange:t}){return l.jsx(yt,{type:"number",value:e??"",onChange:r=>{const i=r.target.value;t(i===""?void 0:Number(i))}})}function p0({items:e,placeholder:t,onChange:r}){const i=(o,u)=>r(e.map((d,m)=>m===o?u:d)),s=o=>r(e.filter((u,d)=>d!==o));return l.jsxs("div",{className:"grid gap-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(yt,{value:o,placeholder:t,onChange:d=>i(u,d.target.value)}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>s(u),children:l.jsx(Na,{})})]},u)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[l.jsx(Qi,{})," Add"]})]})}function yU({rows:e,onChange:t}){const r=g.useRef(0),[i,s]=g.useState(()=>e.map(()=>r.current++)),o=(m,h)=>t(e.map((v,p)=>p===m?{...v,...h}:v)),u=m=>{t(e.filter((h,v)=>v!==m)),s(i.filter((h,v)=>v!==m))},d=()=>{t([...e,{name:"",url:""}]),s([...i,r.current++])};return l.jsxs("div",{className:"grid gap-2",children:[e.map((m,h)=>l.jsxs("div",{className:"grid gap-2 rounded-md border border-[var(--border)] p-3",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(yt,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:v=>o(h,{name:v.target.value})}),l.jsx("span",{className:"label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:"HTTP"}),l.jsx(yt,{value:m.url??"",placeholder:"https://server/mcp",onChange:v=>o(h,{url:v.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:l.jsx(Na,{})})]}),l.jsx(bU,{headers:m.headers??{},onChange:v=>o(h,{headers:v})})]},i[h]??h)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[l.jsx(Qi,{})," Add MCP server"]})]})}function bU({headers:e,onChange:t}){const[r,i]=g.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function s(d){i(d);const m={};for(const{k:h,v}of d){const p=h.trim();p&&(m[p]=v)}t(Object.keys(m).length>0?m:void 0)}const o=(d,m)=>s(r.map((h,v)=>v===d?{...h,...m}:h)),u=d=>s(r.filter((m,h)=>h!==d));return l.jsxs("div",{className:"grid gap-1.5",children:[r.map((d,m)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(yt,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:h=>o(m,{k:h.target.value})}),l.jsx(yt,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:h=>o(m,{v:h.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(m),children:l.jsx(Na,{})})]},m)),l.jsxs(he,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>s([...r,{k:"",v:""}]),children:[l.jsx(Qi,{})," Add header"]})]})}function Ur({className:e,...t}){return l.jsx("div",{className:qe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function Jr({className:e,...t}){return l.jsx("div",{className:qe("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function Gr({className:e,...t}){return l.jsx("h3",{className:qe("text-sm font-semibold tracking-tight",e),...t})}function Yr({className:e,...t}){return l.jsx("div",{className:qe("p-5",e),...t})}const Cv=/^[a-z0-9][a-z0-9-]{0,63}$/,g0=[{id:"identity",label:"Identity",blurb:"Name, description, and system instructions."},{id:"model",label:"Model & Budget",blurb:"Runtime, model, reasoning effort, and execution limits."},{id:"environment",label:"Environment",blurb:"Sandbox, per-runtime approvals, working dir, writable roots."},{id:"tools",label:"Tools & MCP",blurb:"Allowed/disallowed tools and MCP servers."},{id:"skills",label:"Skills",blurb:"Which skills this agent can use."},{id:"review",label:"Review",blurb:"Confirm and save."}];function wU({initial:e,onClose:t,onSaved:r}){const i=e.id==="",[s,o]=g.useState(e.id),[u,d]=g.useState(e.spec),[m,h]=g.useState("identity"),[v,p]=g.useState("form"),[x,y]=g.useState(()=>JSON.stringify(e.spec,null,2)),[w,C]=g.useState(!1);function E(N){if(N!==v)if(N==="json")y(JSON.stringify(u,null,2)),p("json");else try{d(JSON.parse(x)),p("form")}catch(k){_e.error(`Invalid JSON: ${k.message}`)}}async function S(){const N=s.trim();if(i&&!Cv.test(N))return h("identity"),_e.error(N?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let k;if(v==="json")try{k=JSON.parse(x)}catch(R){return _e.error(`Invalid JSON: ${R.message}`)}else k=u;C(!0);try{await be.writeAgent({...$T(k),id:s.trim()}),_e.success(`Agent "${s}" saved`),await r()}catch(R){_e.error(`Save failed: ${R.message}`)}finally{C(!1)}}return l.jsxs("div",{className:"grid gap-5",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]",children:[l.jsx(Yl,{className:"size-3.5"})," Agents"]}),l.jsx("h1",{className:"text-xl font-semibold",children:i?"New agent":`Edit "${e.id}"`})]}),l.jsx("div",{className:"inline-flex rounded-md border border-[var(--border)] p-0.5",children:["form","json"].map(N=>l.jsx("button",{type:"button",onClick:()=>E(N),className:qe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",v===N?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:N},N))})]}),v==="json"?l.jsx(Sm,{value:x,onChange:N=>y(N.target.value),className:"min-h-[28rem] font-mono text-xs"}):l.jsxs("div",{className:"grid grid-cols-[12rem_1fr] gap-6",children:[l.jsx("nav",{className:"sticky top-6 grid h-fit gap-0.5",children:g0.map(N=>l.jsx("button",{type:"button",onClick:()=>h(N.id),className:qe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===N.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:N.label},N.id))}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"mb-4",children:[l.jsx("h2",{className:"text-base font-semibold",children:QC(m).label}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:QC(m).blurb})]}),l.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs($r,{children:["Agent ID ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(yt,{value:s,disabled:!i,onChange:N=>o(N.target.value),placeholder:"polly","aria-invalid":i&&s.trim()!==""&&!Cv.test(s.trim())}),i&&s.trim()!==""&&!Cv.test(s.trim())?l.jsx("p",{className:"text-xs text-[var(--destructive)]",children:"Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit."}):l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["The config directory name. References (",l.jsx("code",{children:"/agent <id>"}),", bindings) use it; it can't change after creation."]})]}),l.jsx(pU,{value:u,onChange:d})]}),m==="model"&&l.jsx(gU,{value:u,onChange:d}),m==="environment"&&l.jsx(vU,{value:u,onChange:d}),m==="tools"&&l.jsx(_U,{value:u,onChange:d}),m==="skills"&&l.jsx(xU,{value:u,onChange:d}),m==="review"&&l.jsx(SU,{id:s,spec:u})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[l.jsx(he,{variant:"outline",onClick:t,children:"Cancel"}),l.jsx(he,{onClick:S,disabled:w,children:w?"Saving…":"Save"})]})]})}function QC(e){return g0.find(t=>t.id===e)??g0[0]}function SU({id:e,spec:t}){var s,o,u,d,m,h;const r=$T(t),i=[["Agent ID",e||"—"],["Display name",((s=t.name)==null?void 0:s.trim())||"—"],["Runtime",((o=t.executor)==null?void 0:o.runtime)??"default"],["Model",((d=(u=t.executor)==null?void 0:u.model)==null?void 0:d.trim())||"runtime default"],["Skills",CU(t.skills)],["MCP servers",String(((h=(m=t.tools)==null?void 0:m.mcp)==null?void 0:h.filter(v=>{var p;return(p=v.url)==null?void 0:p.trim()}).length)??0)]];return l.jsxs("div",{className:"grid gap-4",children:[l.jsx("dl",{className:"grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm",children:i.map(([v,p])=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-[var(--muted-foreground)]",children:v}),l.jsx("dd",{className:"font-medium",children:p})]},v))}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Resulting spec"}),l.jsx("pre",{className:"max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:JSON.stringify({id:e||void 0,...r},null,2)})]})]})}function CU(e){return e!=null&&e.length?`${e.length} declared`:"None"}const EU={instructions:"You are a helpful agent.",executor:{runtime:"claude",model:"claude-sonnet-4-6",reasoningEffort:"medium",timeout:1800,retry:{maxRetries:2}},osEnv:{sandbox:"danger-full-access",approvalPolicy:"never"}};function RU({agents:e,onChange:t}){const[r,i]=g.useState(null);function s(){i({id:"",spec:structuredClone(EU)})}async function o(u){try{const d=await be.getAgent(u);delete d.id,i({id:u,spec:d})}catch(d){_e.error(`Load failed: ${d.message}`)}}return r?l.jsx(wU,{initial:r,onClose:()=>i(null),onSaved:async()=>{i(null),await t()}}):l.jsxs(Ur,{children:[l.jsxs(Jr,{children:[l.jsxs(Gr,{children:["Agents ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:s,children:[l.jsx(Qi,{})," New agent"]})]}),l.jsx(Yr,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Agent"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Runtime"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Model"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"No agents yet."})}),e.map(u=>l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:u.name??u.id}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:u.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:u.runtime??"—"}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:u.model??"—"}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>void o(u.id),children:[l.jsx(vB,{})," Edit"]}),l.jsx(kU,{id:u.id,onChange:t})]})})]},u.id))]})]})})]})}function kU({id:e,onChange:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete agent "',e,'"?']}),l.jsx(tn,{children:"Removes its config directory. Instances bound to it fall back to defaults."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:async()=>{try{await be.deleteAgent(e),_e.success(`Agent "${e}" deleted`),await t()}catch(r){_e.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}const NU=$k("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",{variants:{variant:{default:"border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]",success:"border-transparent bg-[var(--success)]/15 text-[var(--success)]",warning:"border-transparent bg-[var(--warning)]/15 text-[var(--warning)]",destructive:"border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]",outline:"text-[var(--muted-foreground)]"}},defaultVariants:{variant:"default"}});function gt({className:e,variant:t,...r}){return l.jsx("span",{className:qe(NU({variant:t}),e),...r})}function AU(){const{status:e,operation:t,error:r,checkForUpdates:i,installUpdate:s}=PT(),o=t!==null||(e==null?void 0:e.phase)==="checking"||(e==null?void 0:e.phase)==="downloading"||(e==null?void 0:e.phase)==="installing",u=r??(e==null?void 0:e.error);async function d(){const m=await i();m&&(m.error?_e.error(`Could not check for updates: ${m.error}`):m.phase==="idle"?_e.success(`${m.appName} is up to date`):m.availableVersion&&_e.message(`Rynx ${m.availableVersion} is available`))}return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Software update"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Review the installed Desktop version and check GitHub Releases for updates."})]}),l.jsxs(Ur,{"aria-busy":o,children:[l.jsxs(Jr,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Gr,{children:"Rynx Desktop"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Preview and stable builds remain on their own update channels."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o||!(e!=null&&e.supported),onClick:()=>void d(),children:[l.jsx(Nt,{className:t==="check"||(e==null?void 0:e.phase)==="checking"?"animate-spin":""}),"Check for updates"]})]}),l.jsxs(Yr,{className:"grid gap-4",children:[e?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[l.jsx("span",{className:MU(e),children:l.jsx(TU,{status:e})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:e.appName}),l.jsxs(gt,{variant:"outline",children:["Version ",e.currentVersion]}),l.jsx(gt,{variant:e.channel==="preview"?"warning":"default",children:DU(e.channel)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:jU(e)}),e.lastCheckedAt&&l.jsxs("p",{className:"mt-1 text-[10px] text-[var(--muted-foreground)]",children:["Last checked ",LU(e.lastCheckedAt)]})]}),e.phase==="ready"&&l.jsxs(he,{size:"sm",disabled:t==="install",onClick:()=>void s(),children:[t==="install"?l.jsx(Ge,{className:"animate-spin"}):l.jsx(Wl,{}),"Restart to update"]})]}),!e.supported&&l.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3 text-xs leading-5 text-[var(--muted-foreground)]",children:"Automatic updates are available in signed release builds. Local development builds display their version here but do not contact the release feed."})]}):l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),"Loading version information…"]}),u&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(tc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:u})]})]})]})]})}function TU({status:e}){return e.phase==="checking"||e.phase==="installing"?l.jsx(Ge,{className:"size-5 animate-spin"}):e.phase==="downloading"?l.jsx(Mx,{className:"size-5"}):e.phase==="ready"?l.jsx(Wl,{className:"size-5"}):l.jsx(Ax,{className:"size-5"})}function MU(e){return e.phase==="downloading"||e.phase==="ready"||e.phase==="installing"?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]"}function jU(e){if(!e.supported)return"This local build does not check for automatic updates.";switch(e.phase){case"disabled":return"Automatic updates are disabled for this build.";case"idle":return e.error?"The last update check did not complete.":e.lastCheckedAt?"This version is up to date.":"Ready to check for updates.";case"checking":return"Checking GitHub Releases for a newer version…";case"downloading":return`Rynx ${e.availableVersion??""} is downloading in the background.`;case"ready":return`Rynx ${e.availableVersion??""} is ready. Restart to finish the update.`;case"installing":return"Preparing the Runtime and restarting Rynx safely…"}}function DU(e){switch(e){case"local":return"Local build";case"preview":return"Preview channel";case"stable":return"Stable channel"}}function LU(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}var Ml={},Ev,JC;function OU(){return JC||(JC=1,Ev=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ev}var Rv={},ma={},e2;function $o(){if(e2)return ma;e2=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return ma.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},ma.getSymbolTotalCodewords=function(i){return t[i]},ma.getBCHDigit=function(r){let i=0;for(;r!==0;)i++,r>>>=1;return i},ma.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},ma.isKanjiModeEnabled=function(){return typeof e<"u"},ma.toSJIS=function(i){return e(i)},ma}var kv={},t2;function jy(){return t2||(t2=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,s){if(e.isValid(i))return i;try{return t(i)}catch{return s}}})(kv)),kv}var Nv,r2;function BU(){if(r2)return Nv;r2=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let i=0;i<r;i++)this.putBit((t>>>r-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},Nv=e,Nv}var Av,i2;function PU(){if(i2)return Av;i2=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,i,s){const o=t*this.size+r;this.data[o]=i,s&&(this.reservedBit[o]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,i){this.data[t*this.size+r]^=i},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},Av=e,Av}var Tv={},n2;function IU(){return n2||(n2=1,(function(e){const t=$o().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,o=t(i),u=o===145?26:Math.ceil((o-13)/(2*s-2))*2,d=[o-7];for(let m=1;m<s-1;m++)d[m]=d[m-1]-u;return d.push(6),d.reverse()},e.getPositions=function(i){const s=[],o=e.getRowColCoords(i),u=o.length;for(let d=0;d<u;d++)for(let m=0;m<u;m++)d===0&&m===0||d===0&&m===u-1||d===u-1&&m===0||s.push([o[d],o[m]]);return s}})(Tv)),Tv}var Mv={},s2;function zU(){if(s2)return Mv;s2=1;const e=$o().getSymbolSize,t=7;return Mv.getPositions=function(i){const s=e(i);return[[0,0],[s-t,0],[0,s-t]]},Mv}var jv={},a2;function $U(){return a2||(a2=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const o=s.size;let u=0,d=0,m=0,h=null,v=null;for(let p=0;p<o;p++){d=m=0,h=v=null;for(let x=0;x<o;x++){let y=s.get(p,x);y===h?d++:(d>=5&&(u+=t.N1+(d-5)),h=y,d=1),y=s.get(x,p),y===v?m++:(m>=5&&(u+=t.N1+(m-5)),v=y,m=1)}d>=5&&(u+=t.N1+(d-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(s){const o=s.size;let u=0;for(let d=0;d<o-1;d++)for(let m=0;m<o-1;m++){const h=s.get(d,m)+s.get(d,m+1)+s.get(d+1,m)+s.get(d+1,m+1);(h===4||h===0)&&u++}return u*t.N2},e.getPenaltyN3=function(s){const o=s.size;let u=0,d=0,m=0;for(let h=0;h<o;h++){d=m=0;for(let v=0;v<o;v++)d=d<<1&2047|s.get(h,v),v>=10&&(d===1488||d===93)&&u++,m=m<<1&2047|s.get(v,h),v>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(s){let o=0;const u=s.data.length;for(let m=0;m<u;m++)o+=s.data[m];return Math.abs(Math.ceil(o*100/u/5)-10)*t.N4};function r(i,s,o){switch(i){case e.Patterns.PATTERN000:return(s+o)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(s+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return s*o%2+s*o%3===0;case e.Patterns.PATTERN110:return(s*o%2+s*o%3)%2===0;case e.Patterns.PATTERN111:return(s*o%3+(s+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(s,o){const u=o.size;for(let d=0;d<u;d++)for(let m=0;m<u;m++)o.isReserved(m,d)||o.xor(m,d,r(s,m,d))},e.getBestMask=function(s,o){const u=Object.keys(e.Patterns).length;let d=0,m=1/0;for(let h=0;h<u;h++){o(h),e.applyMask(h,s);const v=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(h,s),v<m&&(m=v,d=h)}return d}})(jv)),jv}var Hh={},o2;function UT(){if(o2)return Hh;o2=1;const e=jy(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Hh.getBlocksCount=function(s,o){switch(o){case e.L:return t[(s-1)*4+0];case e.M:return t[(s-1)*4+1];case e.Q:return t[(s-1)*4+2];case e.H:return t[(s-1)*4+3];default:return}},Hh.getTotalCodewordsCount=function(s,o){switch(o){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},Hh}var Dv={},lu={},l2;function UU(){if(l2)return lu;l2=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)e[s]=i,t[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),lu.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},lu.exp=function(i){return e[i]},lu.mul=function(i,s){return i===0||s===0?0:e[t[i]+t[s]]},lu}var c2;function HU(){return c2||(c2=1,(function(e){const t=UU();e.mul=function(i,s){const o=new Uint8Array(i.length+s.length-1);for(let u=0;u<i.length;u++)for(let d=0;d<s.length;d++)o[u+d]^=t.mul(i[u],s[d]);return o},e.mod=function(i,s){let o=new Uint8Array(i);for(;o.length-s.length>=0;){const u=o[0];for(let m=0;m<s.length;m++)o[m]^=t.mul(s[m],u);let d=0;for(;d<o.length&&o[d]===0;)d++;o=o.slice(d)}return o},e.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let o=0;o<i;o++)s=e.mul(s,new Uint8Array([1,t.exp(o)]));return s}})(Dv)),Dv}var Lv,u2;function FU(){if(u2)return Lv;u2=1;const e=HU();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const o=e.mod(s,this.genPoly),u=this.degree-o.length;if(u>0){const d=new Uint8Array(this.degree);return d.set(o,u),d}return o},Lv=t,Lv}var Ov={},Bv={},Pv={},d2;function HT(){return d2||(d2=1,Pv.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Pv}var In={},h2;function FT(){if(h2)return In;h2=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
534
+ ]))+`;In.KANJI=new RegExp(r,"g"),In.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),In.BYTE=new RegExp(i,"g"),In.NUMERIC=new RegExp(e,"g"),In.ALPHANUMERIC=new RegExp(t,"g");const s=new RegExp("^"+r+"$"),o=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return In.testKanji=function(m){return s.test(m)},In.testNumeric=function(m){return o.test(m)},In.testAlphanumeric=function(m){return u.test(m)},In}var f2;function Uo(){return f2||(f2=1,(function(e){const t=HT(),r=FT();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,u){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?o.ccBits[0]:u<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return r.testNumeric(o)?e.NUMERIC:r.testAlphanumeric(o)?e.ALPHANUMERIC:r.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(o,u){if(e.isValid(o))return o;try{return i(o)}catch{return u}}})(Bv)),Bv}var m2;function WU(){return m2||(m2=1,(function(e){const t=$o(),r=UT(),i=jy(),s=Uo(),o=HT(),u=7973,d=t.getBCHDigit(u);function m(x,y,w){for(let C=1;C<=40;C++)if(y<=e.getCapacity(C,w,x))return C}function h(x,y){return s.getCharCountIndicator(x,y)+4}function v(x,y){let w=0;return x.forEach(function(C){const E=h(C.mode,y);w+=E+C.getBitsLength()}),w}function p(x,y){for(let w=1;w<=40;w++)if(v(x,w)<=e.getCapacity(w,y,s.MIXED))return w}e.from=function(y,w){return o.isValid(y)?parseInt(y,10):w},e.getCapacity=function(y,w,C){if(!o.isValid(y))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=s.BYTE);const E=t.getSymbolTotalCodewords(y),S=r.getTotalCodewordsCount(y,w),N=(E-S)*8;if(C===s.MIXED)return N;const k=N-h(C,y);switch(C){case s.NUMERIC:return Math.floor(k/10*3);case s.ALPHANUMERIC:return Math.floor(k/11*2);case s.KANJI:return Math.floor(k/13);case s.BYTE:default:return Math.floor(k/8)}},e.getBestVersionForData=function(y,w){let C;const E=i.from(w,i.M);if(Array.isArray(y)){if(y.length>1)return p(y,E);if(y.length===0)return 1;C=y[0]}else C=y;return m(C.mode,C.getLength(),E)},e.getEncodedBits=function(y){if(!o.isValid(y)||y<7)throw new Error("Invalid QR Code version");let w=y<<12;for(;t.getBCHDigit(w)-d>=0;)w^=u<<t.getBCHDigit(w)-d;return y<<12|w}})(Ov)),Ov}var Iv={},p2;function qU(){if(p2)return Iv;p2=1;const e=$o(),t=1335,r=21522,i=e.getBCHDigit(t);return Iv.getEncodedBits=function(o,u){const d=o.bit<<3|u;let m=d<<10;for(;e.getBCHDigit(m)-i>=0;)m^=t<<e.getBCHDigit(m)-i;return(d<<10|m)^r},Iv}var zv={},$v,g2;function VU(){if(g2)return $v;g2=1;const e=Uo();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let s,o,u;for(s=0;s+3<=this.data.length;s+=3)o=this.data.substr(s,3),u=parseInt(o,10),i.put(u,10);const d=this.data.length-s;d>0&&(o=this.data.substr(s),u=parseInt(o,10),i.put(u,d*3+1))},$v=t,$v}var Uv,v2;function GU(){if(v2)return Uv;v2=1;const e=Uo(),t=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function r(i){this.mode=e.ALPHANUMERIC,this.data=i}return r.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let o;for(o=0;o+2<=this.data.length;o+=2){let u=t.indexOf(this.data[o])*45;u+=t.indexOf(this.data[o+1]),s.put(u,11)}this.data.length%2&&s.put(t.indexOf(this.data[o]),6)},Uv=r,Uv}var Hv,_2;function YU(){if(_2)return Hv;_2=1;const e=Uo();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let i=0,s=this.data.length;i<s;i++)r.put(this.data[i],8)},Hv=t,Hv}var Fv,x2;function KU(){if(x2)return Fv;x2=1;const e=Uo(),t=$o();function r(i){this.mode=e.KANJI,this.data=i}return r.getBitsLength=function(s){return s*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let o=t.toSJIS(this.data[s]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
535
+ Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},Fv=r,Fv}var Wv={exports:{}},y2;function XU(){return y2||(y2=1,(function(e){var t={single_source_shortest_paths:function(r,i,s){var o={},u={};u[i]=0;var d=t.PriorityQueue.make();d.push(i,0);for(var m,h,v,p,x,y,w,C,E;!d.empty();){m=d.pop(),h=m.value,p=m.cost,x=r[h]||{};for(v in x)x.hasOwnProperty(v)&&(y=x[v],w=p+y,C=u[v],E=typeof u[v]>"u",(E||C>w)&&(u[v]=w,d.push(v,w),o[v]=h))}if(typeof s<"u"&&typeof u[s]>"u"){var S=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(S)}return o},extract_shortest_path_from_predecessor_list:function(r,i){for(var s=[],o=i;o;)s.push(o),r[o],o=r[o];return s.reverse(),s},find_path:function(r,i,s){var o=t.single_source_shortest_paths(r,i,s);return t.extract_shortest_path_from_predecessor_list(o,s)},PriorityQueue:{make:function(r){var i=t.PriorityQueue,s={},o;r=r||{};for(o in i)i.hasOwnProperty(o)&&(s[o]=i[o]);return s.queue=[],s.sorter=r.sorter||i.default_sorter,s},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var s={value:r,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Wv)),Wv.exports}var b2;function ZU(){return b2||(b2=1,(function(e){const t=Uo(),r=VU(),i=GU(),s=YU(),o=KU(),u=FT(),d=$o(),m=XU();function h(S){return unescape(encodeURIComponent(S)).length}function v(S,N,k){const R=[];let M;for(;(M=S.exec(k))!==null;)R.push({data:M[0],index:M.index,mode:N,length:M[0].length});return R}function p(S){const N=v(u.NUMERIC,t.NUMERIC,S),k=v(u.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,M;return d.isKanjiModeEnabled()?(R=v(u.BYTE,t.BYTE,S),M=v(u.KANJI,t.KANJI,S)):(R=v(u.BYTE_KANJI,t.BYTE,S),M=[]),N.concat(k,R,M).sort(function(z,D){return z.index-D.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function x(S,N){switch(N){case t.NUMERIC:return r.getBitsLength(S);case t.ALPHANUMERIC:return i.getBitsLength(S);case t.KANJI:return o.getBitsLength(S);case t.BYTE:return s.getBitsLength(S)}}function y(S){return S.reduce(function(N,k){const R=N.length-1>=0?N[N.length-1]:null;return R&&R.mode===k.mode?(N[N.length-1].data+=k.data,N):(N.push(k),N)},[])}function w(S){const N=[];for(let k=0;k<S.length;k++){const R=S[k];switch(R.mode){case t.NUMERIC:N.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:N.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:N.push([R,{data:R.data,mode:t.BYTE,length:h(R.data)}]);break;case t.BYTE:N.push([{data:R.data,mode:t.BYTE,length:h(R.data)}])}}return N}function C(S,N){const k={},R={start:{}};let M=["start"];for(let L=0;L<S.length;L++){const z=S[L],D=[];for(let W=0;W<z.length;W++){const G=z[W],q=""+L+W;D.push(q),k[q]={node:G,lastCount:0},R[q]={};for(let B=0;B<M.length;B++){const j=M[B];k[j]&&k[j].node.mode===G.mode?(R[j][q]=x(k[j].lastCount+G.length,G.mode)-x(k[j].lastCount,G.mode),k[j].lastCount+=G.length):(k[j]&&(k[j].lastCount=G.length),R[j][q]=x(G.length,G.mode)+4+t.getCharCountIndicator(G.mode,N))}}M=D}for(let L=0;L<M.length;L++)R[M[L]].end=0;return{map:R,table:k}}function E(S,N){let k;const R=t.getBestModeForData(S);if(k=t.from(N,R),k!==t.BYTE&&k.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(k)+`.
536
+ Suggested mode is: `+t.toString(R));switch(k===t.KANJI&&!d.isKanjiModeEnabled()&&(k=t.BYTE),k){case t.NUMERIC:return new r(S);case t.ALPHANUMERIC:return new i(S);case t.KANJI:return new o(S);case t.BYTE:return new s(S)}}e.fromArray=function(N){return N.reduce(function(k,R){return typeof R=="string"?k.push(E(R,null)):R.data&&k.push(E(R.data,R.mode)),k},[])},e.fromString=function(N,k){const R=p(N,d.isKanjiModeEnabled()),M=w(R),L=C(M,k),z=m.find_path(L.map,"start","end"),D=[];for(let W=1;W<z.length-1;W++)D.push(L.table[z[W]].node);return e.fromArray(y(D))},e.rawSplit=function(N){return e.fromArray(p(N,d.isKanjiModeEnabled()))}})(zv)),zv}var w2;function QU(){if(w2)return Rv;w2=1;const e=$o(),t=jy(),r=BU(),i=PU(),s=IU(),o=zU(),u=$U(),d=UT(),m=FU(),h=WU(),v=qU(),p=Uo(),x=ZU();function y(L,z){const D=L.size,W=o.getPositions(z);for(let G=0;G<W.length;G++){const q=W[G][0],B=W[G][1];for(let j=-1;j<=7;j++)if(!(q+j<=-1||D<=q+j))for(let O=-1;O<=7;O++)B+O<=-1||D<=B+O||(j>=0&&j<=6&&(O===0||O===6)||O>=0&&O<=6&&(j===0||j===6)||j>=2&&j<=4&&O>=2&&O<=4?L.set(q+j,B+O,!0,!0):L.set(q+j,B+O,!1,!0))}}function w(L){const z=L.size;for(let D=8;D<z-8;D++){const W=D%2===0;L.set(D,6,W,!0),L.set(6,D,W,!0)}}function C(L,z){const D=s.getPositions(z);for(let W=0;W<D.length;W++){const G=D[W][0],q=D[W][1];for(let B=-2;B<=2;B++)for(let j=-2;j<=2;j++)B===-2||B===2||j===-2||j===2||B===0&&j===0?L.set(G+B,q+j,!0,!0):L.set(G+B,q+j,!1,!0)}}function E(L,z){const D=L.size,W=h.getEncodedBits(z);let G,q,B;for(let j=0;j<18;j++)G=Math.floor(j/3),q=j%3+D-8-3,B=(W>>j&1)===1,L.set(G,q,B,!0),L.set(q,G,B,!0)}function S(L,z,D){const W=L.size,G=v.getEncodedBits(z,D);let q,B;for(q=0;q<15;q++)B=(G>>q&1)===1,q<6?L.set(q,8,B,!0):q<8?L.set(q+1,8,B,!0):L.set(W-15+q,8,B,!0),q<8?L.set(8,W-q-1,B,!0):q<9?L.set(8,15-q-1+1,B,!0):L.set(8,15-q-1,B,!0);L.set(W-8,8,1,!0)}function N(L,z){const D=L.size;let W=-1,G=D-1,q=7,B=0;for(let j=D-1;j>0;j-=2)for(j===6&&j--;;){for(let O=0;O<2;O++)if(!L.isReserved(G,j-O)){let $=!1;B<z.length&&($=(z[B]>>>q&1)===1),L.set(G,j-O,$),q--,q===-1&&(B++,q=7)}if(G+=W,G<0||D<=G){G-=W,W=-W;break}}}function k(L,z,D){const W=new r;D.forEach(function(O){W.put(O.mode.bit,4),W.put(O.getLength(),p.getCharCountIndicator(O.mode,L)),O.write(W)});const G=e.getSymbolTotalCodewords(L),q=d.getTotalCodewordsCount(L,z),B=(G-q)*8;for(W.getLengthInBits()+4<=B&&W.put(0,4);W.getLengthInBits()%8!==0;)W.putBit(0);const j=(B-W.getLengthInBits())/8;for(let O=0;O<j;O++)W.put(O%2?17:236,8);return R(W,L,z)}function R(L,z,D){const W=e.getSymbolTotalCodewords(z),G=d.getTotalCodewordsCount(z,D),q=W-G,B=d.getBlocksCount(z,D),j=W%B,O=B-j,$=Math.floor(W/B),T=Math.floor(q/B),U=T+1,H=$-T,F=new m(H);let V=0;const I=new Array(B),Y=new Array(B);let X=0;const ee=new Uint8Array(L.buffer);for(let ne=0;ne<B;ne++){const we=ne<O?T:U;I[ne]=ee.slice(V,V+we),Y[ne]=F.encode(I[ne]),V+=we,X=Math.max(X,we)}const re=new Uint8Array(W);let oe=0,Z,ce;for(Z=0;Z<X;Z++)for(ce=0;ce<B;ce++)Z<I[ce].length&&(re[oe++]=I[ce][Z]);for(Z=0;Z<H;Z++)for(ce=0;ce<B;ce++)re[oe++]=Y[ce][Z];return re}function M(L,z,D,W){let G;if(Array.isArray(L))G=x.fromArray(L);else if(typeof L=="string"){let $=z;if(!$){const T=x.rawSplit(L);$=h.getBestVersionForData(T,D)}G=x.fromString(L,$||40)}else throw new Error("Invalid data");const q=h.getBestVersionForData(G,D);if(!q)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=q;else if(z<q)throw new Error(`
537
+ The chosen QR Code version cannot contain this amount of data.
538
+ Minimum version required to store current data is: `+q+`.
539
+ `);const B=k(z,D,G),j=e.getSymbolSize(z),O=new i(j);return y(O,z),w(O),C(O,z),S(O,D,0),z>=7&&E(O,z),N(O,B),isNaN(W)&&(W=u.getBestMask(O,S.bind(null,O,D))),u.applyMask(W,O),S(O,D,W),{modules:O,version:z,errorCorrectionLevel:D,maskPattern:W,segments:G}}return Rv.create=function(z,D){if(typeof z>"u"||z==="")throw new Error("No input text");let W=t.M,G,q;return typeof D<"u"&&(W=t.from(D.errorCorrectionLevel,t.M),G=h.from(D.version),q=u.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),M(z,G,W,q)},Rv}var qv={},Vv={},S2;function WT(){return S2||(S2=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,u=i.scale||4;return{width:o,scale:o?4:u,margin:s,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},e.getImageWidth=function(i,s){const o=e.getScale(i,s);return Math.floor((i+s.margin*2)*o)},e.qrToImageData=function(i,s,o){const u=s.modules.size,d=s.modules.data,m=e.getScale(u,o),h=Math.floor((u+o.margin*2)*m),v=o.margin*m,p=[o.color.light,o.color.dark];for(let x=0;x<h;x++)for(let y=0;y<h;y++){let w=(x*h+y)*4,C=o.color.light;if(x>=v&&y>=v&&x<h-v&&y<h-v){const E=Math.floor((x-v)/m),S=Math.floor((y-v)/m);C=p[d[E*u+S]?1:0]}i[w++]=C.r,i[w++]=C.g,i[w++]=C.b,i[w]=C.a}}})(Vv)),Vv}var C2;function JU(){return C2||(C2=1,(function(e){const t=WT();function r(s,o,u){s.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=u,o.width=u,o.style.height=u+"px",o.style.width=u+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,u,d){let m=d,h=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(h=i()),m=t.getOptions(m);const v=t.getImageWidth(o.modules.size,m),p=h.getContext("2d"),x=p.createImageData(v,v);return t.qrToImageData(x.data,o,m),r(p,h,v),p.putImageData(x,0,0),h},e.renderToDataURL=function(o,u,d){let m=d;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const h=e.render(o,u,m),v=m.type||"image/png",p=m.rendererOpts||{};return h.toDataURL(v,p.quality)}})(qv)),qv}var Gv={},E2;function eH(){if(E2)return Gv;E2=1;const e=WT();function t(s,o){const u=s.a/255,d=o+'="'+s.hex+'"';return u<1?d+" "+o+'-opacity="'+u.toFixed(2).slice(1)+'"':d}function r(s,o,u){let d=s+o;return typeof u<"u"&&(d+=" "+u),d}function i(s,o,u){let d="",m=0,h=!1,v=0;for(let p=0;p<s.length;p++){const x=Math.floor(p%o),y=Math.floor(p/o);!x&&!h&&(h=!0),s[p]?(v++,p>0&&x>0&&s[p-1]||(d+=h?r("M",x+u,.5+y+u):r("m",m,0),m=0,h=!1),x+1<o&&s[p+1]||(d+=r("h",v),v=0)):m++}return d}return Gv.render=function(o,u,d){const m=e.getOptions(u),h=o.modules.size,v=o.modules.data,p=h+m.margin*2,x=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+p+"v"+p+'H0z"/>':"",y="<path "+t(m.color.dark,"stroke")+' d="'+i(v,h,m.margin)+'"/>',w='viewBox="0 0 '+p+" "+p+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+w+' shape-rendering="crispEdges">'+x+y+`</svg>
540
+ `;return typeof d=="function"&&d(null,E),E},Gv}var R2;function tH(){if(R2)return Ml;R2=1;const e=OU(),t=QU(),r=JU(),i=eH();function s(o,u,d,m,h){const v=[].slice.call(arguments,1),p=v.length,x=typeof v[p-1]=="function";if(!x&&!e())throw new Error("Callback required as last argument");if(x){if(p<2)throw new Error("Too few arguments provided");p===2?(h=d,d=u,u=m=void 0):p===3&&(u.getContext&&typeof h>"u"?(h=m,m=void 0):(h=m,m=d,d=u,u=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(d=u,u=m=void 0):p===2&&!u.getContext&&(m=d,d=u,u=void 0),new Promise(function(y,w){try{const C=t.create(d,m);y(o(C,u,m))}catch(C){w(C)}})}try{const y=t.create(d,m);h(null,o(y,u,m))}catch(y){h(y)}}return Ml.create=t.create,Ml.toCanvas=s.bind(null,r.render),Ml.toDataURL=s.bind(null,r.renderToDataURL),Ml.toString=s.bind(null,function(o,u,d){return i.render(o,d)}),Ml}var rH=tH();const iH=gx(rH);function k2({lines:e}){const t=g.useRef(null);return g.useEffect(()=>{var r;(r=t.current)==null||r.scrollTo({top:t.current.scrollHeight})},[e]),e.length===0?null:l.jsx("div",{ref:t,className:"max-h-48 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2 font-mono text-xs",children:e.map((r,i)=>l.jsx("div",{className:"whitespace-pre-wrap break-all",children:r},i))})}function qT({channelId:e,onDone:t,onCancel:r}){const[i,s]=g.useState("running"),[o,u]=g.useState(),[d,m]=g.useState(),[h,v]=g.useState([]),[p,x]=g.useState();return g.useEffect(()=>{const y=new AbortController;let w=!1;const C=E=>{switch(E.event){case"qr":{const S=String(E.data.url??"");m(S),iH.toDataURL(S,{margin:1,width:224}).then(u).catch(()=>{});break}case"link":m(String(E.data.url??""));break;case"status":v(S=>[...S,String(E.data.text??"")]);break;case"done":w=!0,s("done"),t();break;case"error":w=!0,s("error"),x(String(E.data.message??"authorization failed"));break;default:E.data.url?m(String(E.data.url)):v(S=>[...S,JSON.stringify(E.data)])}};return be.authorizeChannel(e,C,y.signal).then(()=>{w||(s("error"),x("connection closed before completion"))}).catch(E=>{y.signal.aborted||w||(s("error"),x(E instanceof Error?E.message:String(E)))}),()=>y.abort()},[e,t]),i==="done"?l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Authorized — credentials saved."}):i==="error"?l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("p",{className:"text-sm text-[var(--destructive)]",children:["Authorization failed: ",p]}),l.jsx(k2,{lines:h}),l.jsx(he,{variant:"outline",size:"sm",onClick:r,children:"Close"})]}):l.jsxs("div",{className:"grid gap-3 text-center",children:[o?l.jsx("img",{src:o,alt:"Scan to authorize",className:"mx-auto rounded-md border border-[var(--border)] bg-white p-2",width:224,height:224}):l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Starting authorization…"}),d&&l.jsx("a",{href:d,target:"_blank",rel:"noreferrer",className:"break-all text-xs text-[var(--primary)] underline",children:"Or open this link"}),l.jsx(k2,{lines:h}),l.jsx(he,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function nH(e,t){const r={};for(const i of e){const s=t[i.key]??i.default;if(i.type==="boolean"){r[i.key]=typeof s=="boolean"?s:!1;continue}if(s==null||String(s).trim()===""){if(i.required)throw new Error(`${i.label} is required`);continue}if(i.type==="number"){const o=typeof s=="number"?s:Number(s);if(!Number.isFinite(o))throw new Error(`${i.label} must be a number`);r[i.key]=o;continue}r[i.key]=String(s).trim()}return r}function sH({schema:e,values:t,onChange:r}){function i(s,o){r({...t,[s]:o})}return l.jsx("div",{className:"grid gap-3",children:e.map(s=>l.jsx(aH,{label:s.label,help:s.help,required:s.required,children:s.type==="boolean"?l.jsx("input",{type:"checkbox",className:"size-4",checked:!!(t[s.key]??s.default??!1),onChange:o=>i(s.key,o.target.checked)}):s.type==="select"?l.jsx(Ma,{className:"w-full",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value),children:(s.options??[]).map(o=>l.jsx("option",{value:o.value,children:o.label},o.value))}):l.jsx(yt,{type:s.type==="secret"?"password":s.type==="number"?"number":"text",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value)})},s.key))})}function aH({label:e,help:t,required:r,children:i}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs($r,{children:[e,r&&l.jsx("span",{className:"ml-0.5 text-[var(--destructive)]",children:"*"})]}),i,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}function oH(e){return!!(e.options&&Object.keys(e.options).length>0)}function lH({channels:e,channelTypes:t,onChange:r}){const[i,s]=g.useState(!1),[o,u]=g.useState(null),d=g.useMemo(()=>new Map(t.map(h=>[h.type,h])),[t]);async function m(h,v){try{await v(),_e.success(h),await r()}catch(p){_e.error(`${h} failed: ${p.message}`)}}return l.jsxs(Ur,{children:[l.jsxs(Jr,{children:[l.jsxs(Gr,{children:["Channels ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:()=>s(!0),disabled:t.length===0,children:[l.jsx(Qi,{})," Add channel"]})]}),l.jsx(Yr,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Credentials"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No chat plugins installed. Install one via: rynx plugin manage install <source>.":"No channels. Add one to configure a connection."})}),e.map(h=>{var v;return l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:h.name}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:h.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:h.type}),l.jsx("td",{className:"px-3 py-3",children:oH(h)?l.jsx(gt,{variant:"success",children:"● set"}):l.jsx(gt,{variant:"outline",children:"○ needs setup"})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[((v=d.get(h.type))==null?void 0:v.authorize)&&l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:[l.jsx(jR,{})," Authorize"]}),l.jsx(cH,{name:h.name,onDeleted:()=>m("Deleted",()=>be.deleteChannel(h.id))})]})})]},h.id)})]})]})}),i&&l.jsx(uH,{channelTypes:t,onClose:()=>s(!1),onAdded:async()=>{s(!1),await r()}}),o&&l.jsx(Oo,{open:!0,onOpenChange:h=>!h&&u(null),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsxs(Ua,{children:['Authorize "',o.name,'"']})}),l.jsx(qT,{channelId:o.id,onDone:()=>{_e.success("Authorized"),u(null),r()},onCancel:()=>u(null)})]})})]})}function cH({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete channel "',e,'"?']}),l.jsx(tn,{children:"This removes its credentials and any instance bound to it (which is stopped first)."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function uH({channelTypes:e,onClose:t,onAdded:r}){var N;const[i,s]=g.useState(""),[o,u]=g.useState(((N=e[0])==null?void 0:N.type)??""),[d,m]=g.useState("manual"),[h,v]=g.useState({}),[p,x]=g.useState(null),y=g.useMemo(()=>e.find(k=>k.type===o),[e,o]),w=(y==null?void 0:y.configSchema)??[],C=!!(y!=null&&y.authorize);function E(k){u(k),v({});const R=e.find(M=>M.type===k);m(R!=null&&R.authorize?"authorize":"manual")}async function S(){if(!i.trim())return _e.error("Channel name is required");if(!o)return _e.error("Pick a channel type");try{if(d==="authorize"){const{id:k}=await be.createChannel({name:i.trim(),type:o});x(k)}else await be.createChannel({name:i.trim(),type:o,options:nH(w,h)}),_e.success(`Channel "${i}" created`),await r()}catch(k){_e.error(`Create failed: ${k.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:k=>!k&&t(),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsx(Ua,{children:"Add channel"})}),p?l.jsx(qT,{channelId:p,onDone:async()=>{_e.success(`Channel "${i}" authorized`),await r()},onCancel:()=>void r()}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsx(Yv,{label:"Channel name",children:l.jsx(yt,{value:i,onChange:k=>s(k.target.value),placeholder:"lark-prod"})}),l.jsx(Yv,{label:"Type",children:l.jsx(Ma,{value:o,onChange:k=>E(k.target.value),className:"w-full",children:e.map(k=>l.jsx("option",{value:k.type,children:k.type},k.type))})}),C&&l.jsx(Yv,{label:"Setup",children:l.jsxs(Ma,{value:d,onChange:k=>m(k.target.value),className:"w-full",children:[l.jsx("option",{value:"authorize",children:"Scan / authorize"}),l.jsx("option",{value:"manual",children:"Enter credentials manually"})]})}),d==="manual"&&w.length>0&&l.jsx(sH,{schema:w,values:h,onChange:v})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:S,children:d==="authorize"?"Create & authorize":"Create"})]})]})]})})}function Yv({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:e}),t]})}async function VT(e,t){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{return await navigator.clipboard.writeText(e),"clipboard"}catch{}if(!t||typeof document>"u")return"unavailable";t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);try{if(typeof document.execCommand=="function"&&document.execCommand("copy"))return"selection"}catch{}return"selected"}const N2="127.0.0.1:9333";function dH(){const e=oc(),t=g.useRef(null),[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState("load"),m=g.useCallback(async()=>{if(!e){d(null),o("Chrome inspection is available only in the Rynx app.");return}d("load"),o(null);try{i(await e.getChromeInspectionStatus())}catch(y){o(y.message)}finally{d(null)}},[e]);g.useEffect(()=>{m()},[m]);async function h(y){if(e){d("save"),o(null);try{i(await e.configureChromeInspection(y))}catch(w){const C=w.message;o(C),_e.error(`Could not update Chrome inspection: ${C}`)}finally{d(null)}}}async function v(){const y=await VT(N2,t.current);y==="clipboard"||y==="selection"?_e.success("Address copied"):y==="selected"?_e.info("Address selected — copy it manually"):_e.error("Copy is unavailable")}const p=r==null?void 0:r.settings,x=u!==null;return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Chrome inspection"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Inspect Rynx-managed browser pages with Chrome DevTools."})]}),l.jsxs(Ur,{"aria-busy":u!==null,children:[l.jsxs(Jr,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Gr,{children:"DevTools discovery"}),r&&l.jsx(hH,{status:r})]}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Chrome connects to one local address and discovers the browsers you choose."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:x,onClick:()=>void m(),children:[l.jsx(Nt,{className:u==="load"?"animate-spin":""}),"Check"]})]}),l.jsxs(Yr,{className:"grid gap-5",children:[r&&p?l.jsxs(l.Fragment,{children:[l.jsx(fH,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:l.jsx(fT,{"aria-label":"Enable Chrome inspection",checked:p.enabled,disabled:x,onCheckedChange:y=>void h({...p,enabled:y})})}),l.jsx("div",{className:"h-px bg-[var(--border)]"}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:"Browsers to include"}),l.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Only selected browser pages appear in Chrome."})]}),l.jsx(A2,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:p.includeLocal,disabled:x||!p.enabled,onChange:y=>void h({...p,includeLocal:y})}),r.remotes.map(y=>l.jsx(A2,{title:y.displayName,detail:pH(y.status),badge:y.status,checked:p.remoteDaemonIds.includes(y.daemonId),disabled:x||!p.enabled||y.status==="incompatible",onChange:w=>void h({...p,remoteDaemonIds:w?[...p.remoteDaemonIds,y.daemonId]:p.remoteDaemonIds.filter(C=>C!==y.daemonId)})},y.daemonId))]}),l.jsx("div",{className:"h-px bg-[var(--border)]"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:"Connect Chrome once"}),l.jsxs("p",{className:"mt-0.5 text-xs leading-5 text-[var(--muted-foreground)]",children:["Open ",l.jsx("span",{className:"font-mono",children:"chrome://inspect"}),", choose"," ",l.jsx("strong",{children:"Configure…"}),", then add this address."]})]}),l.jsxs("div",{className:"flex max-w-sm gap-2",children:[l.jsx(yt,{ref:t,value:N2,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),l.jsxs(he,{variant:"outline",onClick:()=>void v(),"aria-label":"Copy Chrome inspection address",children:[l.jsx(TR,{}),"Copy"]})]})]}),r.runtime.state==="error"&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] p-3 text-xs text-[var(--warning)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0"}),l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:"Chrome inspection could not start"}),l.jsx("div",{className:"mt-0.5 text-[var(--foreground)]",children:r.runtime.error})]})]}),l.jsxs("div",{role:"note",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_30%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_6%,var(--background))] p-3 text-xs leading-5",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0 text-[var(--destructive)]"}),l.jsx("span",{children:"Any process on this device can use this address to fully control every browser exposed here. Enable it only while you need DevTools."})]})]}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="load"&&l.jsx(Ge,{className:"size-4 animate-spin"}),u==="load"?"Loading Chrome inspection…":"Chrome inspection settings are unavailable."]}),s&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})]})]})}function hH({status:e}){return e.runtime.state==="listening"?l.jsxs(gt,{variant:"success",children:[l.jsx(Ba,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?l.jsx(gt,{variant:"warning",children:"Needs attention"}):l.jsx(gt,{variant:"outline",children:"Off"})}function fH({title:e,description:t,children:r}){return l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:t})]}),r]})}function A2({title:e,detail:t,badge:r,checked:i,disabled:s,onChange:o}){return l.jsxs("label",{className:qe("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",s&&"opacity-55"),children:[l.jsx("input",{type:"checkbox",checked:i,disabled:s,onChange:u=>o(u.target.checked),className:"size-4 accent-[var(--primary)]"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e,r&&l.jsx(gt,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:mH(r)})]}),l.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function mH(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function pH(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function gH(){const e=oc(),[t,r]=g.useState(null),[i,s]=g.useState(null),[o,u]=g.useState("refresh"),d=g.useCallback(async()=>{if(e){u("refresh"),s(null);try{r(await e.getStatus())}catch(h){s(h.message)}finally{u(null)}}},[e]);g.useEffect(()=>{d()},[d]);async function m(h){if(e){u("permission"),s(null);try{await e.openSystemSettings(h),_e.message("After granting access, return to Rynx and click Check again.")}catch(v){const p=v.message;s(p),_e.error(`Could not open System Settings: ${p}`)}finally{u(null)}}}return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer integration"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Review the macOS permissions for the separate Computer Use integration. Browser and Emulator automation stay in the bundled rynx-cli Skill."})]}),l.jsxs(Ur,{"aria-busy":o!==null,children:[l.jsxs(Jr,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Gr,{children:"macOS permissions"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This page checks readiness only. Permissions remain under your control in System Settings."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void d(),children:[l.jsx(Nt,{className:o==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(Yr,{className:"grid gap-3",children:[t?l.jsxs(l.Fragment,{children:[l.jsx(T2,{icon:l.jsx(CB,{className:"size-4"}),ready:t.permissions.accessibility==="granted",title:"Accessibility",description:M2(t.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:t.permissions.accessibility!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void m("accessibility"),children:[l.jsx(sC,{}),"Open Settings"]}):void 0}),l.jsx(T2,{icon:l.jsx(ZO,{className:"size-4"}),ready:t.permissions.screenRecording==="granted",title:"Screen Recording",description:M2(t.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:t.permissions.screenRecording!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void m("screen-recording"),children:[l.jsx(sC,{}),"Open Settings"]}):void 0})]}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o==="refresh"&&l.jsx(Ge,{className:"size-4 animate-spin"}),o==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(tc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function T2({icon:e,ready:t,title:r,description:i,action:s}){return l.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[l.jsx("span",{className:t?"grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:t?l.jsx(Ba,{className:"size-4"}):e}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"text-sm font-medium",children:r}),l.jsx(gt,{variant:t?"success":"warning",children:t?"Ready":"Needs access"})]}),l.jsx("p",{className:"mt-1 break-words text-xs leading-5 text-[var(--muted-foreground)]",children:i})]}),s&&l.jsx("div",{className:"sm:justify-self-end",children:s})]})}function M2(e,t){switch(e){case"granted":return t;case"not-granted":return"Not granted. Open System Settings to allow access.";case"unknown":return"Rynx could not determine this permission. Open System Settings to verify it."}}function vH(){const e=oc(),[t,r]=g.useState(null),[i,s]=g.useState(null),[o,u]=g.useState(!1),d=g.useCallback(async()=>{if(e){u(!0),s(null);try{r(await e.getStatus())}catch(v){s(v.message)}finally{u(!1)}}},[e]);g.useEffect(()=>{d()},[d]);async function m(v){if(!(!e||v===(t==null?void 0:t.runtime.lifecycleMode))){u(!0),s(null);try{r(await e.setDaemonLifecycleMode(v)),_e.success(v==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(p){const x=p.message;s(x),_e.error(`Could not change Runtime mode: ${x}`)}finally{u(!1)}}}async function h(){if(e){u(!0),s(null);try{r(await e.restartDaemon()),_e.success("Local Runtime restarted")}catch(v){const p=v.message;s(p),_e.error(`Could not restart Runtime: ${p}`)}finally{u(!1)}}}return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Daemon"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Choose whether the local Runtime follows the Desktop app or stays available in the background."})]}),l.jsxs(Ur,{"aria-busy":o,children:[l.jsxs(Jr,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Gr,{children:"Local Runtime"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This setting applies to the Runtime bundled with Rynx."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(he,{variant:"outline",size:"sm",disabled:o,onClick:()=>void d(),children:[l.jsx(Nt,{className:o?"animate-spin":""}),"Check"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o,onClick:()=>void h(),children:[l.jsx(Nt,{}),"Restart"]})]})]}),l.jsxs(Yr,{className:"grid gap-5",children:[t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[l.jsx("span",{className:t.runtime.ready?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:l.jsx(ed,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:"Runtime status"}),l.jsx(gt,{variant:t.runtime.ready?"success":"warning",children:_H(t.runtime.state)}),l.jsx(gt,{variant:"outline",children:t.runtime.managedBy==="app"?"Managed by app":t.runtime.managedBy==="external"?"External":"Not managed"})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:t.runtime.detail??xH(t)})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx($r,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),l.jsxs(Ma,{id:"daemon-lifecycle-mode",value:t.runtime.lifecycleMode,disabled:o,className:"max-w-sm",onChange:v=>void m(v.target.value),children:[l.jsx("option",{value:"follow-app",children:"Follow Rynx app"}),l.jsx("option",{value:"resident",children:"Stay available in background"})]}),l.jsx("p",{className:"max-w-2xl text-xs leading-5 text-[var(--muted-foreground)]",children:t.runtime.lifecycleMode==="follow-app"?"The Runtime and its embedded Browser Host start with Rynx and stop when the app fully quits. Closing a window does not quit the app.":"The Runtime and its embedded Browser Host keep running when the app quits, so Terminals, agents, and Session browsers remain available."})]})]}):l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o&&l.jsx(Ge,{className:"size-4 animate-spin"}),o?"Checking Runtime…":"Runtime status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(tc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function _H(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function xH(e){const t=[e.runtime.version?`Version ${e.runtime.version}`:null,e.runtime.pid?`PID ${e.runtime.pid}`:null].filter(Boolean);return t.length>0?t.join(" · "):"No additional Runtime details."}const yH=700,bH=250,j2=33333,hf=new Uint8Array([0,0,0,1]);function wH(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Kv(e,t){for(let r=t;r<=e.length-3;r+=1)if(!(e[r]!==0||e[r+1]!==0)){if(e[r+2]===1)return{index:r,length:3};if(r<=e.length-4&&e[r+2]===0&&e[r+3]===1)return{index:r,length:4}}return null}function D2(e,t){const r=wH(e,t),i=Kv(r,0);if(!i)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const s=[];let o=i.index,u=i.index+i.length,d=Kv(r,u);for(;d;)d.index>u&&s.push(r.slice(u,d.index)),o=d.index,u=d.index+d.length,d=Kv(r,u);return{nals:s,pending:r.slice(o)}}function jm(e){return e[0]&31}function SH(e){if(jm(e)!==7||e.length<4)return null;const t=r=>r.toString(16).padStart(2,"0").toUpperCase();return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function CH(e){const t=e.reduce((s,o)=>s+hf.length+o.length,0),r=new Uint8Array(t);let i=0;for(const s of e)r.set(hf,i),i+=hf.length,r.set(s,i),i+=s.length;return r}function L2(e){const t=jm(e);return t===1||t===5}function EH(e){return e.some(t=>jm(t)===5)}function Xv(e,t,r,i){(e.width!==r||e.height!==i)&&(e.width=r,e.height=i);const s=e.getContext("2d");s&&s.drawImage(t,0,0,r,i)}function RH(e,t){return new Promise((r,i)=>{if(t.aborted){i(t.reason);return}const s=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(s),i(t.reason)},{once:!0})})}function O2(e){return e instanceof Error?e.message:String(e)}function kH(e){return e instanceof DOMException&&e.name==="AbortError"}function NH({device:e,alt:t,mediaRef:r,onFrameSize:i}){const s=g.useRef(null),o=g.useRef(!1),u=g.useRef(!1),d=g.useRef(null),[m,h]=g.useState("video"),[v,p]=g.useState(!1),[x,y]=g.useState("Loading preview..."),w=g.useCallback(S=>{s.current=S,r==null||r(S)},[r]),C=g.useCallback(()=>{o.current||(o.current=!0,p(!0),y(""))},[]),E=g.useCallback((S,N)=>{const k=d.current;(k==null?void 0:k.width)===S&&k.height===N||(d.current={width:S,height:N},i==null||i(S,N))},[i]);return g.useEffect(()=>{o.current=!1,u.current=!1,d.current=null,p(!1),y("Loading preview..."),h("video")},[e]),g.useEffect(()=>{if(m!=="video"||o.current)return;let S=!1;return(async()=>{try{const k=await be.emulatorFrameBlob(e);if(S||o.current)return;const R=await createImageBitmap(k);try{const M=s.current;M&&!o.current&&(Xv(M,R,R.width,R.height),E(R.width,R.height),C())}finally{R.close()}}catch{}})(),()=>{S=!0}},[e,C,m,E]),g.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){y("Video decoder unavailable"),h("fallback");return}const S=new AbortController,N=R=>{const M=s.current;try{if(M){const L=R.displayWidth||R.codedWidth,z=R.displayHeight||R.codedHeight;Xv(M,R,L,z),E(L,z),u.current=!0,C()}}finally{R.close()}};return(async()=>{for(;!S.signal.aborted;){let R=null,M=null,L=new Uint8Array,z=[],D=!1,W=0,G="avc1.42E01F";const q=async()=>{if(R)return R;const O={codec:G,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(O)).supported)throw new Error(`Unsupported Android video codec: ${G}`);return R=new VideoDecoder({output:N,error:T=>{y(T.message)}}),R.configure(O),R},B=async()=>{if(!D){z=[];return}const O=await q(),$=EH(z),T=CH(z),U=W;W+=j2,z=[],D=!1,!(O.decodeQueueSize>2&&!$)&&O.decode(new EncodedVideoChunk({type:$?"key":"delta",timestamp:U,duration:j2,data:T}))},j=async O=>{const $=SH(O);$&&(G=$),(jm(O)===9||L2(O))&&D&&await B(),z.push(O),L2(O)&&(D=!0)};try{const O=await fetch(be.emulatorVideoStreamUrl(e),{cache:"no-store",signal:S.signal});if(!O.ok||!O.body)throw new Error(`Android video stream failed: ${O.status}`);for(M=O.body.getReader();;){const{done:T,value:U}=await M.read();if(T)break;const H=D2(L,U);L=H.pending;for(const F of H.nals)await j(F)}const $=D2(L,hf);for(const T of $.nals)await j(T);await B(),(R==null?void 0:R.state)==="configured"&&await R.flush()}catch(O){if(S.signal.aborted||kH(O))break;if(y(O2(O)),!u.current){h("fallback");break}}finally{try{M==null||M.releaseLock()}catch{}(R==null?void 0:R.state)!=="closed"&&(R==null||R.close())}S.signal.aborted||await RH(bH,S.signal).catch(()=>{})}})(),()=>{S.abort()}},[e,C,m,E]),g.useEffect(()=>{if(m!=="fallback")return;let S=!1,N;const k=async()=>{try{const R=await be.emulatorFrameBlob(e);if(S)return;const M=await createImageBitmap(R);try{const L=s.current;L&&(Xv(L,M,M.width,M.height),E(M.width,M.height),C())}finally{M.close()}}catch(R){S||y(O2(R))}finally{S||(N=window.setTimeout(k,yH))}};return k(),()=>{S=!0,N&&window.clearTimeout(N)}},[e,C,m,E]),l.jsxs("div",{className:"relative h-full w-full",children:[l.jsx("canvas",{ref:w,"aria-label":t,width:720,height:1520,className:"pointer-events-none h-full w-full select-none object-contain"}),!v&&l.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:x})]})}const B2=8,AH=.012,TH=1500,MH=35,jH=260,DH=40,LH=3,OH=5e3,BH=750;function P2(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function I2(e,t,r){return Math.max(t,Math.min(r,e))}function z2(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function PH(e){const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const r="naturalWidth"in e?e.naturalWidth||t.width:e.width||t.width,i="naturalHeight"in e?e.naturalHeight||t.height:e.height||t.height;if(r<=0||i<=0)return t;const s=r/i;if(t.width/t.height>s){const d=t.height*s;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const u=t.width/s;return new DOMRect(t.left,t.top+(t.height-u)/2,t.width,u)}function Zv(e,t,r){if(!e)return null;const i=PH(e);if(!i)return null;const s=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;return!r&&(s<0||s>1||o<0||o>1)?null:{x:I2(s,0,1),y:I2(o,0,1)}}function IH(e){return new Promise(t=>setTimeout(t,e))}function zH(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=LH,r.set(t,1),r.buffer}function $H(){const[e,t]=g.useState([]),[r,i]=g.useState(null),[s,o]=g.useState(!0),[u,d]=g.useState(null),[m,h]=g.useState(null),[v,p]=g.useState(!1),[x,y]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(!1),[N,k]=g.useState(0),R=g.useRef(null),M=g.useRef(null),L=g.useRef(null),z=g.useRef(null),D=g.useRef(null),W=g.useRef(null),G=g.useCallback(async()=>{o(!0);try{const[J,ie]=await Promise.all([be.emulatorDevices(),be.activeEmulator()]);t(J),i(ie)}catch(J){_e.error(`Failed to load emulator: ${J.message}`)}finally{o(!1)}},[]);g.useEffect(()=>{G()},[G]),g.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current),M.current!==null&&window.clearTimeout(M.current)},[]),g.useEffect(()=>()=>{var ie;const J=(ie=z.current)==null?void 0:ie.socket;z.current=null,J&&J.readyState!==WebSocket.CLOSED&&J.close()},[r==null?void 0:r.wsUrl]),g.useEffect(()=>{var J;if((r==null?void 0:r.backend)!=="android"){const ie=(J=D.current)==null?void 0:J.socket;D.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close();return}return re(r.deviceUdid).catch(()=>{}),()=>{var Re;const ie=(Re=D.current)==null?void 0:Re.socket;D.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const q=(r==null?void 0:r.streamUrl)??null,B=q&&N>0?`${q}${q.includes("?")?"&":"?"}rynx_preview_retry=${N}`:q,j=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,O=!!(q||j),$=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},T=g.useCallback((J,ie)=>{if(!Number.isFinite(J)||!Number.isFinite(ie)||J<=0||ie<=0)return;const Re=J/ie;C(ve=>ve!==null&&Math.abs(ve-Re)<1e-4?ve:Re)},[]),U=g.useCallback(()=>{M.current!==null&&(window.clearTimeout(M.current),M.current=null)},[]),H=g.useCallback((J,ie)=>{U(),T(J,ie),S(!0)},[U,T]),F=g.useCallback(()=>{S(!1),M.current===null&&(M.current=window.setTimeout(()=>{M.current=null,k(J=>J+1)},BH))},[]);g.useEffect(()=>{if(U(),C(null),S(!1),k(0),!q)return;const J=()=>{const Re=R.current;Re instanceof HTMLImageElement&&Re.naturalWidth>0&&Re.naturalHeight>0&&H(Re.naturalWidth,Re.naturalHeight)};J();const ie=window.setInterval(J,500);return()=>window.clearInterval(ie)},[U,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,H,q]),g.useEffect(()=>{if(!q||E)return;const J=window.setTimeout(F,OH);return()=>window.clearTimeout(J)},[N,E,q,F]);async function V(J){if(r){y("home");try{await be.buttonEmulator(J,r.deviceUdid)}catch(ie){_e.error(`${J==="appswitch"?"App switcher":"Home"} failed: ${ie.message}`)}finally{y(null)}}}function I(){if(!(!r||x)){if(L.current!==null){window.clearTimeout(L.current),L.current=null,V("appswitch");return}L.current=window.setTimeout(()=>{L.current=null,V("home")},jH)}}async function Y(J,ie){const Re=(r==null?void 0:r.deviceUdid)===J;L.current!==null&&(window.clearTimeout(L.current),L.current=null),h(J),Re&&y("shutdown");try{await be.shutdownEmulator(J),Re&&i(null),_e.success(`Shutdown ${ie}`),G()}catch(ve){_e.error(`Shutdown failed: ${ve.message}`)}finally{h(null),Re&&y(null)}}async function X(J){d(J.id);try{const ie=await be.attachEmulator(J.id);i(ie),_e.success(`Attached ${ie.deviceName??ie.deviceUdid}`),G()}catch(ie){_e.error(`Attach failed: ${ie.message}`)}finally{d(null)}}function ee(J){var Ae;const ie=z.current;if((ie==null?void 0:ie.url)===J){if(((Ae=ie.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const Re={url:J,socket:null,connecting:null},ve=new Promise((Ie,Oe)=>{const ze=new WebSocket(J),rt=window.setTimeout(()=>{ze.close(),Oe(new Error("Timed out connecting to emulator gesture stream."))},1500),Be=()=>window.clearTimeout(rt);ze.binaryType="arraybuffer",ze.addEventListener("open",()=>{Be(),Re.socket=ze,Re.connecting=null,Ie(ze)},{once:!0}),ze.addEventListener("error",()=>{Be(),Re.connecting=null,Oe(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),ze.addEventListener("close",()=>{var dt;((dt=z.current)==null?void 0:dt.socket)===ze&&(z.current=null)})});return Re.connecting=ve,z.current=Re,ve}function re(J){var Ae;const ie=D.current;if((ie==null?void 0:ie.device)===J){if(((Ae=ie.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const Re={device:J,socket:null,connecting:null},ve=new Promise((Ie,Oe)=>{const ze=new WebSocket(H9(J));let rt=!1;const Be=window.setTimeout(()=>{rt||(rt=!0,ze.close(),Oe(new Error("Timed out connecting to Android touch stream.")))},TH),dt=()=>window.clearTimeout(Be);ze.addEventListener("message",He=>{if(!rt&&typeof He.data=="string")try{const Ot=JSON.parse(He.data);Ot.t==="opened"?(rt=!0,dt(),Re.socket=ze,Re.connecting=null,Ie(ze)):Ot.t==="error"&&(rt=!0,dt(),Re.connecting=null,Oe(new Error(Ot.message??"Android touch stream failed.")))}catch{}}),ze.addEventListener("error",()=>{rt||(rt=!0,dt(),Re.connecting=null,Oe(new Error("Failed to connect to Android touch stream.")))},{once:!0}),ze.addEventListener("close",()=>{var He;dt(),Re.connecting=null,rt||(rt=!0,Oe(new Error("Android touch stream closed before it was ready."))),((He=D.current)==null?void 0:He.socket)===ze&&(D.current=null)})});return Re.connecting=ve,D.current=Re,ve}async function oe(J,ie){if(J.backend==="android"){if(J.liveFailed)return!1;try{return(await re(J.device)).send(JSON.stringify(ie)),J.sentLiveFrames+=1,!0}catch(Re){return J.liveFailed=!0,J.sentLiveFrames>0&&_e.error(`Android touch stream failed: ${Re.message}`),!1}}if(!J.wsUrl||J.liveFailed)return!1;try{return(await ee(J.wsUrl)).send(zH(ie)),J.sentLiveFrames+=1,!0}catch(Re){return J.liveFailed=!0,J.sentLiveFrames>0&&_e.error(`Gesture stream failed: ${Re.message}`),!1}}function Z(J,ie){be.gestureEmulator([{type:"begin",x:J.x,y:J.y}],ie).catch(Re=>{_e.error(`Tap failed: ${Re.message}`)})}function ce(J,ie){be.gestureEmulator(J,ie).catch(Re=>{_e.error(`Gesture failed: ${Re.message}`)})}function ne(J){if(!r||!O||!J.isPrimary||J.pointerType==="mouse"&&J.button!==0)return;const ie=Zv(R.current,J,!1);ie&&(J.preventDefault(),J.currentTarget.setPointerCapture(J.pointerId),W.current={backend:r.backend,pointerId:J.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:J.clientX,startClientY:J.clientY,lastPoint:ie,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:ie.x,y:ie.y}]},oe(W.current,{type:"begin",x:ie.x,y:ie.y}),p(!0))}function we(J){const ie=W.current;if(!ie||ie.pointerId!==J.pointerId)return;const Re=Zv(R.current,J,!0);if(!Re)return;J.preventDefault();const ve=Math.hypot(J.clientX-ie.startClientX,J.clientY-ie.startClientY)>B2,Ae=z2(Re,ie.lastPoint)>AH;if(ie.lastPoint=Re,ve&&(Ae||!ie.moved)){ie.moved=!0;const Ie={type:"move",x:Re.x,y:Re.y};ie.points.push(Ie),oe(ie,Ie)}}async function xe(J){const ie=W.current;if(!ie||ie.pointerId!==J.pointerId)return;J.preventDefault();const Re=Zv(R.current,J,!0)??ie.lastPoint,ve=Math.hypot(J.clientX-ie.startClientX,J.clientY-ie.startClientY)>B2;W.current=null,p(!1);try{J.currentTarget.releasePointerCapture(J.pointerId)}catch{}const Ae={type:"end",x:Re.x,y:Re.y};if((ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&(!ie.moved&&!ve&&await IH(ie.backend==="android"?MH:DH),await oe(ie,Ae)||ie.sentLiveFrames>0))return;if(!ie.moved&&!ve){Z(Re,ie.device);return}const Ie=[...ie.points],Oe=Ie[Ie.length-1];Oe&&z2(Oe,Re)<=.001?Ie[Ie.length-1]=Ae:Ie.push(Ae),ce(Ie,ie.device)}function ye(J){const ie=W.current;!ie||ie.pointerId!==J.pointerId||(W.current=null,p(!1),(ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&oe(ie,{type:"end",x:ie.lastPoint.x,y:ie.lastPoint.y}))}return l.jsxs("div",{className:"grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]",children:[l.jsxs(Ur,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(Jr,{className:"px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(Gr,{className:"flex items-center gap-2",children:[l.jsx(DR,{className:"size-4"}),"Preview"]}),l.jsx("div",{className:"label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]",children:r?`This device · ${r.backend} · ${r.deviceName??r.deviceUdid}`:"This device · not attached"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:I,disabled:!r||x!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:l.jsx(MR,{className:qe(x==="home"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&Y(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||x!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:l.jsx(Rf,{className:qe(x==="shutdown"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void G(),disabled:s,"aria-label":"Refresh emulator",title:"Refresh",children:l.jsx(Nt,{className:qe(s&&"animate-spin")})})]})]}),l.jsxs(Yr,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":O&&!E,children:[O?l.jsx("div",{className:qe("relative grid touch-none select-none place-items-center overflow-hidden bg-black",E?"max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm":"pointer-events-none absolute inset-0",E&&(v?"cursor-grabbing":"cursor-crosshair")),style:E?$:void 0,onPointerDown:ne,onPointerMove:we,onPointerUp:xe,onPointerCancel:ye,children:q?l.jsx("img",{ref:J=>{R.current=J},src:B??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:J=>{H(J.currentTarget.naturalWidth,J.currentTarget.naturalHeight)},onError:F,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${N}`):r&&j?l.jsx(NH,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:J=>{R.current=J},onFrameSize:H},r.deviceUdid):null}):l.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),O&&!E&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[l.jsx(Nt,{className:"size-4 animate-spin text-[var(--primary)]"}),l.jsx("span",{children:"Loading preview…"})]})})]})]}),l.jsxs(Ur,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(Jr,{children:[l.jsxs(Gr,{className:"flex items-center gap-2",children:[l.jsx(Kl,{className:"size-4"}),"Devices"]}),l.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),l.jsx(Yr,{className:"min-h-0 flex-1 p-0",children:e.length===0?l.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:s?"Loading...":"No devices"}):l.jsx(yn,{className:"h-full min-h-0",children:l.jsx("ul",{className:"grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3",children:e.map(J=>{const ie=(r==null?void 0:r.deviceUdid)===J.id,Re=u===J.id,ve=m===J.id;return l.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5",children:[l.jsx(Kl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("div",{className:"truncate text-sm font-medium",children:J.name}),l.jsxs(gt,{variant:J.state==="booted"?"success":J.state==="shutdown"?"outline":"warning",className:"h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase",children:[l.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),J.state]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:P2(J),children:P2(J)})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(he,{size:"xs",variant:ie?"outline":"default",onClick:()=>void X(J),disabled:Re||m!==null,children:Re?"Attaching…":ie?"Reattach":"Attach"}),J.state==="booted"&&l.jsx(he,{size:"icon-xs",variant:"destructive",onClick:()=>void Y(J.id,J.name),disabled:u!==null||m!==null,"aria-label":`Shutdown ${J.name}`,title:`Shutdown ${J.name}`,children:l.jsx(Rf,{className:qe(ve&&"animate-pulse")})})]})]},`${J.backend}:${J.id}`)})})})})]})]})}function GT({inst:e}){return e.running?e.connected===!1||e.lastError?l.jsx(gt,{variant:"destructive",children:"● error"}):e.connected&&!e.lastEventAt?l.jsx(gt,{variant:"default",children:"● connected (idle)"}):e.connected?l.jsx(gt,{variant:"success",children:"● connected"}):l.jsx(gt,{variant:"default",children:"● running"}):l.jsx(gt,{variant:"outline",children:"● stopped"})}function UH({instances:e,channels:t,agents:r,onChange:i}){const[s,o]=g.useState(!1),u=g.useMemo(()=>new Set(e.map(h=>h.channelId)),[e]),d=t.filter(h=>!u.has(h.id));async function m(h,v){try{await v(),_e.success(h),await i()}catch(p){_e.error(`${h} failed: ${p.message}`)}}return l.jsxs(Ur,{children:[l.jsxs(Jr,{children:[l.jsxs(Gr,{children:["Instances ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void i(),children:[l.jsx(Nt,{})," Refresh"]}),l.jsxs(he,{size:"sm",onClick:()=>o(!0),disabled:d.length===0,children:[l.jsx(Qi,{})," Add instance"]})]})]}),l.jsx(Yr,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Status"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Agent"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:5,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No channels yet. Configure one on the Channels tab first.":"No instances. Bind a channel to an agent to start it."})}),e.map(h=>l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:h.channelName}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:h.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:h.type}),l.jsxs("td",{className:"px-3 py-3",children:[l.jsx(GT,{inst:h}),h.lastError&&l.jsx("div",{className:"mt-0.5 max-w-[16rem] truncate text-xs text-[var(--destructive)]",children:h.lastError})]}),l.jsx("td",{className:"px-3 py-3",children:l.jsxs(Ma,{value:h.agent??"",onChange:v=>void m("Agent updated",()=>be.updateInstance(h.id,{agent:v.target.value||void 0})),children:[l.jsx("option",{value:"",children:"(none)"}),r.map(v=>l.jsx("option",{value:v.id,children:v.name??v.id},v.id))]})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[h.enabled?l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Disabled",()=>be.instanceAction(h.id,"disable")),children:[l.jsx(pB,{})," Disable"]}):l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Enabled",()=>be.instanceAction(h.id,"enable")),children:[l.jsx(OR,{})," Enable"]}),l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>void m("Restarted",()=>be.instanceAction(h.id,"restart")),children:[l.jsx(BR,{})," Restart"]}),l.jsx(HH,{name:h.channelName,onDeleted:()=>m("Deleted",()=>be.deleteInstance(h.id))})]})})]},h.id))]})]})}),s&&l.jsx(FH,{freeChannels:d,agents:r,onClose:()=>o(!1),onAdded:async()=>{o(!1),await i()}})]})}function HH({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete instance for "',e,'"?']}),l.jsx(tn,{children:"This stops the binding. The channel + its credentials stay; you can re-bind it later."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function FH({freeChannels:e,agents:t,onClose:r,onAdded:i}){var h;const[s,o]=g.useState(((h=e[0])==null?void 0:h.id)??""),[u,d]=g.useState("");async function m(){if(!s)return _e.error("Pick a channel");try{await be.createInstance({channelId:s,agent:u||void 0}),_e.success("Instance created"),await i()}catch(v){_e.error(`Create failed: ${v.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:v=>!v&&r(),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsx(Ua,{children:"Add instance"})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsx($2,{label:"Channel",children:l.jsx(Ma,{value:s,onChange:v=>o(v.target.value),className:"w-full",children:e.map(v=>l.jsxs("option",{value:v.id,children:[v.name," (",v.type,")"]},v.id))})}),l.jsx($2,{label:"Agent",children:l.jsxs(Ma,{value:u,onChange:v=>d(v.target.value),className:"w-full",children:[l.jsx("option",{value:"",children:"(none)"}),t.map(v=>l.jsx("option",{value:v.id,children:v.name??v.id},v.id))]})})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:m,children:"Create"})]})]})})}function $2({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:e}),t]})}function WH(){const[e,t]=g.useState(""),[r,i]=g.useState("");async function s(){try{i(await be.logs(e.trim()||void 0)||"(empty)")}catch(o){_e.error(`Failed to read logs: ${o.message}`)}}return l.jsxs(Ur,{children:[l.jsxs(Jr,{children:[l.jsx(Gr,{children:"Logs"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(yt,{value:e,onChange:o=>t(o.target.value),placeholder:"filter by instance (optional)",className:"h-8 w-56"}),l.jsxs(he,{size:"sm",onClick:()=>void s(),children:[l.jsx(PR,{})," Tail"]})]})]}),l.jsx(Yr,{children:l.jsx("pre",{className:"max-h-[28rem] overflow-auto rounded-lg bg-[var(--muted)] p-4 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:r||"Press Tail to load the latest daemon logs."})})]})}function qH(e){return!!(e.options&&Object.keys(e.options).length>0)}function VH({instances:e,channels:t,agents:r}){const i=Oa(),s=m=>i(mt[m]),o=e.filter(m=>m.running).length,u=e.filter(m=>m.connected).length,d=t.filter(qH).length;return l.jsxs("div",{className:"grid gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Overview"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Channels, agents, and the instances binding them together."})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[l.jsx(Qv,{icon:NR,label:"Instances",value:e.length,sub:`${o} running · ${u} connected`,onClick:()=>s("instances")}),l.jsx(Qv,{icon:kx,label:"Channels",value:t.length,sub:`${d} configured`,onClick:()=>s("channels")}),l.jsx(Qv,{icon:Rx,label:"Agents",value:r.length,sub:r.length===1?"1 defined":`${r.length} defined`,onClick:()=>s("agents")})]}),l.jsxs(Ur,{children:[l.jsxs(Jr,{children:[l.jsx(Gr,{children:"Instances"}),l.jsx(he,{variant:"outline",size:"sm",onClick:()=>s("instances"),children:"Manage"})]}),l.jsx(Yr,{className:"p-0",children:e.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:[t.length===0?"No channels yet — add one to get started.":"No instances yet — bind a channel to an agent.",l.jsx("div",{className:"mt-3",children:l.jsx(he,{size:"sm",onClick:()=>s(t.length===0?"channels":"instances"),children:t.length===0?"Add channel":"Add instance"})})]}):l.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(m=>l.jsxs("li",{className:"flex items-center justify-between gap-3 px-5 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-sm font-medium",children:m.channelName}),l.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[m.type,m.agent?` · ${m.agent}`:""]})]}),l.jsx(GT,{inst:m})]},m.id))})})]})]})}function Qv({icon:e,label:t,value:r,sub:i,onClick:s}){return l.jsx(Ur,{children:l.jsxs("button",{onClick:s,className:"flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(e,{className:"size-5"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-3xl font-semibold leading-none tabular-nums",children:r}),l.jsx("div",{className:"label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]",children:t}),l.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:i})]})]})})}const Jv="local",GH={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function YH(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[s,o]=g.useState(!1),[u,d]=g.useState({}),m=g.useRef(0),h=g.useCallback(async(p=!1)=>{const x=++m.current;p&&o(!0),i(null);try{const y=await be.listProviderClis(Jv);x===m.current&&t(y)}catch(y){x===m.current&&(t(null),i(y instanceof Error?y.message:String(y)))}finally{x===m.current&&o(!1)}},[]);g.useEffect(()=>{h()},[h]);const v=async(p,x)=>{try{let y=(await be.startProviderCliOperation(Jv,p,x)).job;for(d(w=>({...w,[p]:y}));y.state==="running";)await tF(750),y=await be.getProviderCliJob(Jv,y.id),d(w=>({...w,[p]:y}));y.state==="succeeded"?(_e.success(`${U2(p)} ${x} completed`),await h(),d(w=>{const C={...w};return delete C[p],C})):_e.error(y.error??`${U2(p)} ${x} failed`)}catch(y){_e.error(y.message),d(w=>{const C={...w};return delete C[p],C})}};return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Providers"}),l.jsx("p",{className:"mt-1 max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Inspect and manage the coding-agent providers installed on this device."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(gt,{variant:"outline",className:"gap-1.5",children:[l.jsx(jx,{className:"size-3"}),"This device"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:s,onClick:()=>void h(!0),children:[l.jsx(Nt,{className:s?"animate-spin":""}),"Refresh"]})]})]}),r&&l.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[l.jsx(Ea,{className:"size-4"})," Could not inspect Providers"]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),l.jsxs(he,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void h(!0),children:[l.jsx(Nt,{})," Retry"]})]}),e===null&&!r?l.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>l.jsx(XH,{},p))}):l.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>l.jsx(KH,{provider:p,job:u[p.id],readOnly:e.management==="read_only",onOperation:v},p.id))})]})}function KH({provider:e,job:t,readOnly:r,onOperation:i}){const s=e.availability!=="installed"?e.canInstall?"install":void 0:e.updateState==="available"&&e.canUpdate?"update":void 0,o=(t==null?void 0:t.state)==="running";return l.jsx(Ur,{className:"min-w-0",children:l.jsxs(Yr,{className:"grid gap-3 p-4 text-xs",children:[l.jsxs("div",{className:"grid gap-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[l.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Lx,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx(Gr,{children:e.name}),l.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),l.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2 lg:grid-cols-[minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(10rem,0.8fr)]",children:[l.jsx(e_,{icon:VO,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),l.jsx(e_,{icon:Nt,label:"Version",value:JH(e),mono:!0,noWrap:!0}),l.jsx(e_,{icon:jR,label:"Authentication",value:eF(e)})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:max-w-56 xl:justify-end",children:[l.jsx(ZH,{provider:e}),!r&&s&&l.jsx(QH,{provider:e,operation:s,disabled:o,onConfirm:()=>i(e.id,s)})]})]}),e.error&&l.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[o?l.jsx(Nt,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?l.jsx(Ax,{className:"size-3.5 text-[var(--success)]"}):l.jsx(Ea,{className:"size-3.5 text-[var(--destructive)]"}),l.jsx("span",{children:t.error??GH[t.stage]})]})]})})}function XH(){return l.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"size-9 rounded-lg bg-[var(--muted)]"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"h-3.5 w-20 rounded bg-[var(--muted)]"}),l.jsx("div",{className:"h-2.5 w-12 rounded bg-[var(--muted)]"})]})]}),l.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:["w-full","w-24","w-32"].map((e,t)=>l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"h-2.5 w-16 rounded bg-[var(--muted)]"}),l.jsx("div",{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t))}),l.jsxs("div",{className:"flex items-center gap-2 xl:justify-end",children:[l.jsx("div",{className:"h-5 w-24 rounded-full bg-[var(--muted)]"}),l.jsx("div",{className:"h-8 w-24 rounded-md bg-[var(--muted)]"})]})]})}function ZH({provider:e}){return e.availability==="missing"?l.jsx(gt,{variant:"warning",children:"Not installed"}):e.availability==="broken"?l.jsx(gt,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?l.jsx(gt,{variant:"warning",children:"New version"}):l.jsx(gt,{variant:"success",children:"Installed"})}function e_({icon:e,label:t,value:r,mono:i=!1,noWrap:s=!1}){return l.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[l.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),l.jsx("div",{className:qe("mt-0.5",i&&"font-mono text-[11px]",i&&!s&&"break-all",s&&"whitespace-nowrap"),children:r})]})]})}function QH({provider:e,operation:t,disabled:r,onConfirm:i}){const s=t==="install"?"Install":"Update";return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Mx,{}),r?"Working…":s]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:[s," ",e.name,"?"]}),l.jsxs(tn,{children:["Rynx will run ",e.name,"'s official ",t," mechanism on this Runtime. The daemon will verify the executable and version when it finishes."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{onClick:()=>void i(),children:s})]})]})]})}function JH(e){return e.currentVersion?e.latestVersion?e.updateState==="available"?`${e.currentVersion} → ${e.latestVersion}`:`${e.currentVersion} · latest`:`${e.currentVersion} · latest unknown`:e.availability==="missing"?"—":"Unknown"}function eF(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function U2(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function tF(e){return new Promise(t=>window.setTimeout(t,e))}function rF(e,t){if(e instanceof yo)switch(e.code){case"offer_expired":return"This Share Link has expired. Generate a new link on the remote Host and try again.";case"offer_rejected":return"The remote Host rejected this Share Link. It may already have been used, expired, or revoked. Generate a new link and use it once.";case"invalid_offer":return"This is not a valid Rynx Share Link. Copy and paste the complete link from the remote Host."}return`${t} failed: ${e instanceof Error?e.message:String(e)}`}function iF(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=ac(),[i,s]=g.useState(null),[o,u]=g.useState(!1),[d,m]=g.useState(null),[h,v]=g.useState(null),[p,x]=g.useState({}),[y,w]=g.useState({});async function C(){try{const N=await be.listRuntimes();s(N),r(N)}catch(N){s([]),_e.error(`Failed to load Runtimes: ${N.message}`)}}g.useEffect(()=>{C()},[]);async function E(N){v(N.selector);try{const k=await be.testRuntime(N.selector);x(R=>({...R,[N.selector]:k})),w(R=>{const M={...R};return delete M[N.selector],M}),_e.success(`${N.displayName} is reachable`)}catch(k){x(M=>{const L={...M};return delete L[N.selector],L});const R={code:k instanceof yo?k.code:void 0,message:k.message};w(M=>({...M,[N.selector]:R})),_e.error(R.code==="authentication_failed"?"Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.":`Connection test failed: ${R.message}`)}finally{v(null)}}async function S(N){try{await be.forgetRuntime(N.daemonId),x(k=>{const R={...k};return delete R[N.selector],R}),w(k=>{const R={...k};return delete R[N.selector],R}),_e.success(`Forgot ${N.displayName}`),e===N.selector&&t("local"),await C()}catch(k){_e.error(`Forget failed: ${k.message}`)}}return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(nF,{}),l.jsxs(Ur,{children:[l.jsxs(Jr,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Gr,{children:["Runtimes"," ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(i==null?void 0:i.length)??0})]}),l.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),l.jsxs(he,{size:"sm",onClick:()=>u(!0),children:[l.jsx(Qi,{})," Add Runtime"]})]}),l.jsx(Yr,{className:"p-0",children:l.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[i===null&&l.jsx("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Loading Runtimes…"}),i==null?void 0:i.map(N=>{const k=p[N.selector],R=y[N.selector],M=(R==null?void 0:R.code)==="authentication_failed";return l.jsxs("article",{className:"grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[l.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[l.jsx("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:N.binding==="local"?l.jsx(jx,{className:"size-4"}):l.jsx(ed,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"font-medium",children:N.displayName}),l.jsx(gt,{variant:N.binding==="local"?"default":"outline",children:N.binding}),k&&l.jsxs(gt,{variant:"success",children:[l.jsx(Ax,{className:"mr-1 size-3"})," reachable"]}),M&&l.jsxs(gt,{variant:"warning",children:[l.jsx(Dx,{className:"size-3"})," authorization required"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:N.daemonId}),N.endpoint&&l.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:N.endpoint}),N.identityKeyFingerprint&&l.jsxs("div",{className:"mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:[l.jsx(kf,{className:"size-3 shrink-0"}),N.identityKeyFingerprint]}),k&&l.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",k.status.daemonInstanceId]})]})]}),l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[N.binding==="direct"&&l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>m(N),children:[l.jsx(kf,{}),"Reauthorize"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:h===N.selector,onClick:()=>void E(N),children:[l.jsx(Nt,{className:h===N.selector?"animate-spin":""}),"Test"]}),N.binding==="direct"&&l.jsx(cF,{target:N,onForget:()=>S(N)})]})]},N.selector)})]})})]}),l.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]",children:"Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device."}),l.jsx(W2,{open:o,onOpenChange:u,onAdded:async N=>{x(k=>({...k,[N.target.selector]:N})),await C()}}),l.jsx(W2,{open:d!==null,target:d,onOpenChange:N=>{N||m(null)},onAdded:async N=>{x(k=>({...k,[N.target.selector]:N})),w(k=>{const R={...k};return delete R[N.target.selector],R}),await C()}})]})}const H2="__rynx_custom_share_address__";function nF(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState(!1),[m,h]=g.useState(!1),[v,p]=g.useState(""),[x,y]=g.useState(!1),[w,C]=g.useState(""),[E,S]=g.useState(!1),[N,k]=g.useState(null),R=g.useRef(null),[M,L]=g.useState(null),[z,D]=g.useState(null),[W,G]=g.useState(!1),[q,B]=g.useState(null),[j,O]=g.useState(null),$=g.useCallback(async(Z=!1)=>{G(!0);try{L(await be.listRuntimeAccess()),D(null),Z&&_e.success("Shared access refreshed")}catch(ce){const ne=ce.message;D(ne),Z&&_e.error(`Failed to refresh shared access: ${ne}`)}finally{G(!1)}},[]),T=g.useCallback(async(Z=!1)=>{d(!0);try{const ce=await be.listRuntimeShareAddresses();t(ce),o(null),i(ne=>(ne==null?void 0:ne.kind)==="custom"||ne&&ce.some(we=>we.address===ne.address)?ne:ce[0]?{kind:"detected",address:ce[0].address}:null),Z&&_e.success("Network addresses refreshed")}catch(ce){const ne=ce.message;t(we=>we??[]),o(ne),Z&&_e.error(`Failed to refresh network addresses: ${ne}`)}finally{d(!1)}},[]);g.useEffect(()=>{$(),T()},[$,T]);const U=(r==null?void 0:r.address)??"",H=w.trim(),F=N&&N.address===U.trim()&&N.clientLabel===H?N.code:"";function V(Z){if(Z===H2){p((r==null?void 0:r.kind)==="custom"?r.address:""),y(!1),h(!0);return}Z!==t_(r)&&e!=null&&e.some(ce=>ce.address===Z)&&i({kind:"detected",address:Z})}function I(){const Z=v.trim();if(!aF(Z)){y(!0);return}i({kind:"custom",address:Z}),h(!1),y(!1)}async function Y(){const Z=U.trim();if(!Z){_e.error("Choose an address that the other device can reach");return}S(!0);try{const ce=await be.shareRuntime({address:Z,...H?{clientLabel:H}:{}});k({code:ce.pairingCode,address:Z,clientLabel:H}),_e.success("Pairing link generated"),await $()}catch(ce){_e.error(`Failed to generate pairing link: ${ce.message}`)}finally{S(!1)}}async function X(){if(!F)return;const Z=await VT(F,R.current);Z==="clipboard"||Z==="selection"?_e.success("Pairing link copied"):Z==="selected"?_e.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):_e.error("Copy is unavailable — select the pairing link and copy it manually")}async function ee(Z){B(Z.grantId);try{const ce=await be.revokeRuntimeAccess(Z.grantId);_e.success(`Revoked ${Du(Z)}${ce.closedConnections>0?` and closed ${ce.closedConnections} active connection${ce.closedConnections===1?"":"s"}`:""}`),await $()}catch(ce){_e.error(`Revoke failed: ${ce.message}`)}finally{B(null)}}async function re(Z){O(Z.grantId);try{await be.deleteRevokedRuntimeAccess(Z.grantId),_e.success(`Removed revoked access record for ${Du(Z)}`),await $()}catch(ce){_e.error(`Remove failed: ${ce.message}`)}finally{O(null)}}const oe=(M==null?void 0:M.filter(Z=>Z.revokedAt===null).length)??0;return l.jsxs(Ur,{children:[l.jsx(Jr,{className:"items-start",children:l.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[l.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(OB,{className:"size-4"})}),l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Gr,{children:"Share this device"}),l.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Generate a revocable pairing link so another Rynx Control Plane can connect to this Runtime. Use a LAN, Tailscale, or tunnel address reachable from that device."})]})]})}),l.jsxs(Yr,{className:"grid gap-6",children:[l.jsxs("form",{className:"grid gap-3",onSubmit:Z=>{Z.preventDefault(),Y()},children:[l.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-share-address",children:"Connection address"}),l.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[l.jsxs(Am,{value:(r==null?void 0:r.kind)==="custom"?t_(r):r==null?void 0:r.address,onValueChange:V,disabled:e===null,children:[l.jsx(dd,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:l.jsx(ud,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?sF(e??[],r.address):void 0})}),l.jsxs(hd,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&l.jsxs(Xn,{value:t_(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Z=>l.jsx(Xn,{value:Z.address,children:YT(Z)},Z.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&l.jsx(wy,{}),l.jsx(Xn,{value:H2,children:"Enter custom address…"})]})]}),l.jsx(he,{type:"button",variant:"outline",size:"icon",disabled:u,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void T(!0),children:l.jsx(Nt,{className:u?"animate-spin":""})})]})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-share-label",children:"Client label"}),l.jsx(yt,{id:"runtime-share-label",value:w,onChange:Z=>C(Z.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),l.jsxs(he,{type:"submit",disabled:E||!r,children:[E?l.jsx(Nt,{className:"animate-spin"}):l.jsx(UO,{}),"Generate Link"]})]}),l.jsx("p",{id:"runtime-share-address-help",className:s?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:s?"alert":void 0,children:s?`Could not refresh network addresses: ${s}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),F&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[l.jsx($r,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),l.jsxs("div",{className:"flex min-w-0 gap-2",children:[l.jsx(yt,{id:"runtime-pairing-code",ref:R,value:F,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),l.jsxs(he,{type:"button",variant:"outline",onClick:()=>void X(),children:[l.jsx(TR,{})," Copy"]})]}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),l.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",l.jsx("span",{className:"text-[var(--muted-foreground)]",children:oe})]}),l.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Active clients can reconnect until their grant is revoked."})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",disabled:W,"aria-label":"Refresh shared access",onClick:()=>void $(!0),children:l.jsx(Nt,{className:W?"animate-spin":""})})]}),M===null&&!z&&l.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),z&&l.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2",children:[l.jsxs("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:["Could not load shared access: ",z]}),l.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>void $(),children:"Retry"})]}),(M==null?void 0:M.length)===0&&!z&&l.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),M&&M.length>0&&l.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:M.map(Z=>l.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium",children:Du(Z)}),l.jsxs(gt,{variant:Z.revokedAt?"destructive":"success",children:[Z.revokedAt?l.jsx(Dx,{className:"size-3"}):l.jsx(kf,{className:"size-3"}),Z.revokedAt?"revoked":"active"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:Z.grantId}),l.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:Z.lastUsedAt?`Last used ${F2(Z.lastUsedAt)}`:`Created ${F2(Z.createdAt)} · never connected`})]}),Z.revokedAt?l.jsx(lF,{client:Z,disabled:j===Z.grantId,onRemove:()=>re(Z)}):l.jsx(oF,{client:Z,disabled:q===Z.grantId,onRevoke:()=>ee(Z)})]},Z.grantId))})]})]}),l.jsx(Oo,{open:m,onOpenChange:Z=>{h(Z),Z||y(!1)},children:l.jsxs($a,{className:"sm:max-w-md",children:[l.jsxs(Bo,{children:[l.jsx(Ua,{children:"Enter custom address"}),l.jsx(fm,{children:"Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:Z=>{Z.preventDefault(),I()},children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),l.jsx(yt,{id:"runtime-custom-share-address",value:v,onChange:Z=>{p(Z.target.value),Z.target.value.trim()&&y(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":x,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),l.jsx("p",{id:"runtime-custom-share-address-help",className:x?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:x?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(he,{type:"submit",disabled:!v.trim(),children:"Use Address"})]})]})]})})]})}function YT(e){return`${e.interfaceName} (${e.address})`}function sF(e,t){const r=e.find(i=>i.address===t);return r?YT(r):t}function t_(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function aF(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function oF({client:e,disabled:t,onRevoke:r}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Dx,{}),"Revoke"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Revoke access for “",Du(e),"”?"]}),l.jsx(tn,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function lF({client:e,disabled:t,onRemove:r}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Pa,{}),"Remove Record"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Remove revoked record for “",Du(e),"”?"]}),l.jsx(tn,{children:"This removes the revoked authorization record from this Host. It does not restore access or delete the credential stored on the client device."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Du(e){return e.clientLabel??e.clientId}function F2(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function W2({open:e,target:t=null,onOpenChange:r,onAdded:i}){const[s,o]=g.useState(""),[u,d]=g.useState(""),[m,h]=g.useState(!1),v=t!==null;g.useEffect(()=>{e&&(o((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function p(){const x=u.trim();if(x){h(!0);try{const y=await be.pairRuntime({offer:x,...s.trim()?{displayName:s.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});_e.success(v?`Reauthorized ${y.target.displayName}`:`Paired ${y.target.displayName}`),await i(y),o(""),d(""),r(!1)}catch(y){_e.error(rF(y,v?"Reauthorization":"Pairing"))}finally{h(!1)}}}return l.jsx(Oo,{open:e,onOpenChange:r,children:l.jsxs($a,{className:"sm:max-w-lg",children:[l.jsxs(Bo,{children:[l.jsx(Ua,{children:v?"Reauthorize Runtime":"Add Runtime"}),l.jsx(fm,{children:v?"Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.":"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:x=>{x.preventDefault(),p()},children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-name",children:"Display name"}),l.jsx(yt,{id:"runtime-name",value:s,onChange:x=>o(x.target.value),placeholder:"Remote lab",maxLength:128})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-offer",children:"Pairing link"}),l.jsx(yt,{id:"runtime-offer",value:u,onChange:x=>d(x.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",l.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsxs(he,{type:"submit",disabled:m||!u.trim(),children:[m?l.jsx(Nt,{className:"animate-spin"}):l.jsx(kf,{}),v?"Reauthorize":"Add Runtime"]})]})]})]})})}function cF({target:e,onForget:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[l.jsx(Pa,{}),l.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Forget “",e.displayName,"”?"]}),l.jsxs(tn,{children:["Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs ",l.jsx("code",{children:"rynx runtime clients revoke"}),"on that daemon."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}const uF="rynx.control.session-launch-selection.v2";function KT(e){return`${e.kind}:${e.id}`}function XT(e){return e==="provider:claude"?{kind:"provider",id:"claude"}:e==="provider:codex"?{kind:"provider",id:"codex"}:e==="provider:traex"?{kind:"provider",id:"traex"}:e.startsWith("agent:")&&e.length>6?{kind:"agent",id:e.slice(6)}:null}function dF(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function hF(e,t){const r=t?XT(t):null;if(r&&dF(r,e)&&(r.kind==="agent"&&e.agents.some(o=>o.id===r.id&&o.ready)||r.kind==="provider"&&e.providers.some(o=>o.id===r.id&&o.ready)))return r;for(const o of["claude","codex","traex"])if(e.providers.some(u=>u.id===o&&u.ready))return{kind:"provider",id:o};const i=e.providers.find(o=>o.ready);if(i)return{kind:"provider",id:i.id};const s=e.agents.find(o=>o.ready);return s?{kind:"agent",id:s.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function fF(e,t){if(!t)return null;try{return t.getItem(ZT(e))}catch{return null}}function mF(e,t,r){if(t)try{t.setItem(ZT(e),KT(r))}catch{}}function ZT(e){return`${uF}:${encodeURIComponent(e)}`}function pF(e,t){return e.kind==="provider"?{provider:e.id,title:t}:{agent:e.id,title:t}}function gF(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function vF(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function r_(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function qu(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function v0(e,t){if(!e)return null;if(e.kind==="provider")return t.providers.find(i=>i.id===e.id)??null;const r=t.agents.find(i=>i.id===e.id);return r?{name:r.name??r.id,ready:r.ready,...r.reason?{reason:r.reason}:{},...r.readiness?{readiness:r.readiness}:{}}:null}const QT=A9,JT=g.forwardRef(({className:e,...t},r)=>l.jsx(T9,{ref:r,className:qe("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));JT.displayName="TabsList";const _0=g.forwardRef(({className:e,...t},r)=>l.jsx(M9,{ref:r,className:qe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));_0.displayName="TabsTrigger";const Vu=g.forwardRef(({className:e,...t},r)=>l.jsx(j9,{ref:r,className:qe("mt-4 focus-visible:outline-none",e),...t}));Vu.displayName="TabsContent";function Lu(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function _F(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function xF(e){var i;const t=e.data.content.flatMap((s,o)=>"text"in s?[o]:[]);return t.length!==1?!1:((i=e.truncations)==null?void 0:i.some(({field:s})=>s===`data.content[${t[0]}].text`))===!0}function yF(e){return e.filter(t=>t.type==="input_image")}function bF(e,t){return e.length===t.length&&e.every((r,i)=>{var s;return r.resourceId===((s=t[i])==null?void 0:s.resourceId)})}function Fh(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const i=t[r],s=t[r-1];i.type!=="reasoning"||i.data.model!=="traex"||s.type!=="message"||s.data.role!=="assistant"||s.data.model!=="traex"||s.responseId!==i.responseId||i.createdAt<s.createdAt||i.createdAt-s.createdAt>500||(t[r]=s,t[r-1]=i)}return t}function qn(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function pi(e,t,r){e.items[t]=r}function pn(e,t){const r=e.items.length;return e.items.push(t),r}function q2(e,t,r){if(!r)return;const i=e.turns[t];e.turns[t]=i?{...i,model:i.model??r}:{status:"completed",model:r}}function eM(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=eM(r.children));return t}function bo(e){e.waitingForInteraction=eM(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function tM(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function x0(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?tM(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:x0(r.children,t)}:r)}function y0(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&y0(r.children,t);return t}function V2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:o})=>o.interactionId));for(const[o,u]of Object.entries(e.childStates)){const d=qn(u);d.items=x0(d.items,r),bo(d),e.childStates[o]=d;const m=e.callIndex[o];if(m!==void 0){const h=e.items[m];pi(e,m,{...h,children:d.items})}}e.items=x0(e.items,r);const i=y0(e.items);for(const o of Object.values(e.childStates))y0(o.items,i);for(const{responseId:o,interaction:u}of t.pendingInteractions){if(i.has(u.interactionId))continue;const d={kind:"interaction",id:u.interactionId,responseId:o,request:u,status:"pending"};e.interactionIndex[u.interactionId]=pn(e,d),i.add(u.interactionId)}const s=new Set(t.activeResponseIds);for(const[o,u]of Object.entries(e.turns))s.has(o)||u.status==="running"&&(e.turns[o]={...u,status:"completed"},b0(e,o));SF(e,s);for(const o of s)e.turns[o]={...e.turns[o],status:"running"};e.runStatus=t.status,e.waitingForInteraction=r.size>0}function G2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function Y2(e,t,r,i){const s=e.byId[t];if(s!==void 0)return s;const o=pn(e,i());return e.byId[t]=o,o}function Dm(e,t){e.items.splice(t,1);for(const r of[e.byId,e.callIndex,e.interactionIndex])for(const[i,s]of Object.entries(r))s===t?delete r[i]:s>t&&(r[i]=s-1)}function wF(e,t,r){const i=qn(e.childStates[t]??Lu());Ts(i,{...r,parentToolCallId:void 0}),bo(i),e.childStates[t]=i;const s=e.callIndex[t];if(s!==void 0){const o=e.items[s];pi(e,s,{...o,children:i.items})}}function Ts(e,t){var r;if(t.parentToolCallId){wF(e,t.parentToolCallId,t);return}switch(t.type){case"message":{q2(e,t.responseId,t.data.model);const i={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:_F(t.data.content),images:yF(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...xF(t)?{textPrefixTruncated:!0}:{}},s=e.byId[t.id];if(s!==void 0){pi(e,s,i);return}if(t.data.role==="user"){const o=e.items.findIndex(u=>u.kind==="message"&&u.optimistic&&u.role==="user"&&u.text===i.text&&bF(u.images,i.images));if(o!==-1){const u=e.items[o];delete e.byId[u.id],pi(e,o,i),e.byId[t.id]=o;return}}e.byId[t.id]=pn(e,i);return}case"reasoning":{q2(e,t.responseId,t.data.model);const i={kind:"reasoning",id:t.id,responseId:t.responseId,summary:t.data.summary.map(o=>o.text),model:t.data.model,streaming:!1},s=e.byId[t.id];s!==void 0?pi(e,s,i):e.byId[t.id]=pn(e,i);return}case"function_call":{const i=t.data.callId,s=e.pendingOutputs[i],o=(r=e.childStates[i])==null?void 0:r.items,u={kind:"tool",id:i,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:s?s.status??"completed":t.status,output:s==null?void 0:s.output,exitCode:s==null?void 0:s.exitCode,...o&&o.length?{children:o}:{}};s&&delete e.pendingOutputs[i];const d=e.callIndex[i];d!==void 0?pi(e,d,u):e.callIndex[i]=pn(e,u);return}case"function_call_output":{const i=t.data.callId,s=e.callIndex[i];if(s===void 0){e.pendingOutputs[i]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const o=e.items[s];pi(e,s,{...o,output:t.data.output,status:t.data.status??"completed",exitCode:t.data.exitCode});return}case"terminal_command":{const i={kind:"terminal_command",id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},s=e.byId[t.id];s!==void 0?pi(e,s,i):e.byId[t.id]=pn(e,i);return}case"interaction_request":{const i=t.data.interaction,s=i.interactionId,o=e.interactionIndex[s],u=e.pendingInteractionResolutions[s],d=o===void 0?void 0:e.items[o];let m={kind:"interaction",id:s,responseId:t.responseId,request:i,status:(d==null?void 0:d.status)??"pending",...d!=null&&d.resolution?{resolution:d.resolution}:{},...d!=null&&d.reason?{reason:d.reason}:{},...(d==null?void 0:d.resolvedAt)!==void 0?{resolvedAt:d.resolvedAt}:{}};u&&(m=G2(m,u),delete e.pendingInteractionResolutions[s]),o===void 0?e.interactionIndex[s]=pn(e,m):pi(e,o,m),e.byId[t.id]=e.interactionIndex[s];return}case"interaction_resolution":{const i=t.data,s=e.interactionIndex[i.interactionId];if(s===void 0){e.pendingInteractionResolutions[i.interactionId]={...i,responseId:t.responseId,itemId:t.id};return}const o=e.items[s];pi(e,s,G2(o,i)),e.byId[t.id]=s;return}case"error":{const i={kind:"error",id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},s=e.byId[t.id];s!==void 0?pi(e,s,i):e.byId[t.id]=pn(e,i);return}}}function b0(e,t){const r=i=>i===t;Uf(e,r),e.items=w0(e.items,t);for(const[i,s]of Object.entries(e.childStates)){const o=qn(s);Uf(o,r),o.items=w0(o.items,t),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];pi(e,u,{...d,children:o.items})}}}function SF(e,t){const r=i=>!t.has(i);Uf(e,r);for(const[i,s]of Object.entries(e.childStates)){const o=qn(s);Uf(o,r),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];pi(e,u,{...d,children:o.items})}}}function Uf(e,t){for(let r=e.items.length-1;r>=0;r-=1){const i=e.items[r];(i==null?void 0:i.kind)==="message"&&t(i.responseId)&&i.role==="assistant"&&i.liveDraft===!0&&Dm(e,r)}}function CF(e,t){const r=e.items.filter(i=>i.kind==="message"&&i.responseId===t&&i.role==="assistant"&&i.liveDraft!==!0);if(r.length!==0)for(let i=e.items.length-1;i>=0;i-=1){const s=e.items[i];(s==null?void 0:s.kind)==="message"&&s.responseId===t&&s.role==="assistant"&&s.liveDraft===!0&&r.some(o=>o.text===s.text||o.textPrefixTruncated===!0&&o.text.length>0&&s.text.startsWith(o.text))&&Dm(e,i)}}function w0(e,t){return e.map(r=>{const i=r.kind==="tool"&&r.children?{...r,children:w0(r.children,t)}:r;return i.responseId!==t?i:i.kind==="tool"&&i.status==="in_progress"?{...i,status:"incomplete"}:(i.kind==="message"||i.kind==="reasoning")&&i.streaming?{...i,streaming:!1}:i.kind==="interaction"&&i.status==="pending"?{...i,status:"inactive",reason:"Turn ended before this interaction was resolved"}:i})}function K2(e){return Object.values(e.turns).some(t=>t.status==="running")}function dn(e){e.note=void 0,e.statusKind=void 0}function EF(e,t){var r;switch(t.type){case"session.status":{e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note,e.statusKind=t.statusKind;return}case"response.created":{e.turns[t.responseId]={status:"running",model:t.model},e.runStatus="running",dn(e);return}case"response.output_text.delta":{dn(e);const i=e.byId[t.itemId],s=i===void 0?void 0:e.items[i];if(t.discard===!0){i!==void 0&&(s==null?void 0:s.kind)==="message"&&s.role==="assistant"&&s.responseId===t.responseId&&s.liveDraft===!0&&Dm(e,i);return}const o=(r=e.turns[t.responseId])==null?void 0:r.status;if(o==="completed"||o==="failed"||(s==null?void 0:s.kind)==="message"&&s.role==="assistant"&&s.liveDraft!==!0)return;const u=Y2(e,t.itemId,t.responseId,()=>({kind:"message",id:t.itemId,responseId:t.responseId,role:"assistant",text:"",images:[],streaming:!0,liveDraft:!0})),d=e.items[u];e.items[u]={...d,text:d.text+t.delta,streaming:!0},t.final&&CF(e,t.responseId);return}case"response.reasoning_summary_text.delta":{dn(e);const i=Y2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),s=e.items[i],o=s.summary.slice();o[t.summaryIndex]=(o[t.summaryIndex]??"")+t.delta,e.items[i]={...s,summary:o,streaming:!0};return}case"response.function_call_output.delta":{dn(e);const i=e.callIndex[t.callId];if(i===void 0){const o=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...o,output:(o.output??"")+t.delta};return}const s=e.items[i];e.items[i]={...s,output:(s.output??"")+t.delta};return}case"session.interaction.requested":{dn(e),Ts(e,t.item);const i=e.interactionIndex[t.interaction.interactionId];if(i!==void 0){const s=e.items[i];(s.status==="pending"||s.status==="inactive")&&pi(e,i,tM(s))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{dn(e),Ts(e,t.item);return}case"response.output_item.done":{dn(e),Ts(e,t.item);return}case"response.completed":{dn(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"completed",usage:t.usage},b0(e,t.responseId),!K2(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{dn(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"failed"},e.items.some(o=>o.kind==="error"&&o.responseId===t.responseId&&o.code===t.error.code)||pn(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),b0(e,t.responseId),e.runStatus=K2(e)?"running":"idle";return}case"session.input.consumed":{dn(e),Ts(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{pn(e,{kind:"divider",id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind==="fork"?"forked to a new session":"context cleared — new session",newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus="idle",dn(e);return}}}function RF(e,t){var r;switch(t.kind){case"reset":return Lu();case"snapshot":{const i=Lu();for(const s of Fh(t.items))Ts(i,s);return V2(i,t.runtime),i.historyLoaded=!0,i}case"reconcile_snapshot":{const i=qn(e);for(const s of Fh(t.items))Ts(i,s);return V2(i,t.runtime),i.historyLoaded=!0,i.error=void 0,i}case"history":{const i=Lu();for(const s of Fh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i}case"reconcile_history":{const i=qn(e);for(const s of Fh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i.error=void 0,i}case"event":{const i=qn(e);return EF(i,t.event),bo(i),i}case"optimistic_user":{const i=qn(e),s={kind:"message",id:t.id,responseId:t.id,role:"user",text:t.text,images:t.images??[],streaming:!1,optimistic:!0};return i.byId[t.id]=pn(i,s),i}case"discard_optimistic_user":{const i=e.byId[t.id];if(i===void 0||((r=e.items[i])==null?void 0:r.kind)!=="message"||!e.items[i].optimistic)return e;const s=qn(e);return Dm(s,i),s}case"stream_error":{const i=qn(e);return i.error=t.message,i}case"stream_done":return e}}function kF(e){let t;for(const r of e.items){const i=e.turns[r.responseId];i&&(t=i)}return t}function NF(e){let t=!1;const r=e.map(i=>i.kind!=="error"?i:i.code==="codex_error"&&i.message==="Codex turn was interrupted"||i.code==="traex_error"&&i.message==="Traex turn was interrupted"?(t=!0,{...i,code:"response_stopped",message:"Response stopped"}):i.code==="codex_error"&&i.message==="Codex turn failed"||i.code==="traex_error"&&i.message==="Traex turn failed"||i.code==="claude_error"&&i.message==="claude turn failed"?(t=!0,{...i,code:"agent_error",message:"Agent turn failed"}):i);return t?r:e}const S0="browser:",C0="emulator:",X2=.44,Cu=360,AF=420;function TF(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(S0)?{type:"browser",pageId:e.slice(S0.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(C0)?{type:"emulator",bindingId:e.slice(C0.length).trim()||null}:null:null}function Hn(e){return e?`${S0}${e}`:"browser"}function Fn(e){return e?`${C0}${e}`:"emulator"}function Z2(e,t){const r=new Set(t),i=new Set,s=[];for(const o of e)!r.has(o)||i.has(o)||(i.add(o),s.push(o));for(const o of t)i.has(o)||(i.add(o),s.push(o));return s}function Wh(e,t){const r=Math.max(0,e),i=Math.max(0,r-AF),s=Math.min(Cu,i);return Math.min(i,Math.max(s,t))}function MF(e,t,r){var i;return!e||e.pages.length===0?null:t&&e.pages.some(s=>s.pageId===t)?t:r&&e.pages.some(s=>s.pageId===r)?r:e.activePageId&&e.pages.some(s=>s.pageId===e.activePageId)?e.activePageId:((i=e.pages[0])==null?void 0:i.pageId)??null}function jF(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}let i_=0;function Gu(e){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return`${e}_${t.randomUUID()}`;if(typeof(t==null?void 0:t.getRandomValues)=="function"){const r=t.getRandomValues(new Uint8Array(16));return`${e}_${Array.from(r,i=>i.toString(16).padStart(2,"0")).join("")}`}return i_=i_+1>>>0,`${e}_${Date.now().toString(36)}_${i_.toString(36)}`}const DF=256,LF=4*1024*1024;function OF(e,t,r,i){return e||(r?t:i)}function BF(e){return e.type==="response.created"}function Q2(e,t,r){return r&&e!==null&&t===e}function PF(e,t){return e&&t}function IF(e,{runtimeSelector:t,allowSend:r=!0}={}){const[i,s]=g.useReducer(RF,void 0,Lu),[o,u]=g.useState(!1),[d,m]=g.useState(!1),h=g.useRef(null),v=g.useRef(0),p=g.useRef(null),x=g.useRef(null),y=g.useRef(0);g.useEffect(()=>{if(s({kind:"reset"}),p.current=null,x.current=null,u(!1),m(!1),!e)return;const E=new AbortController;let S=!1,N=!0,k;return(async()=>{let M=500;for(;!E.signal.aborted;){const L=new AbortController,z=()=>L.abort();E.signal.addEventListener("abort",z,{once:!0});let D=!1,W=!1,G=!1;const q={events:[],utf8Bytes:0};let B,j;const O=new Promise((U,H)=>{B=U,j=H}),$=be.streamSession(e,U=>{if(!(S||L.signal.aborted))if(U.event==="ready"){const H=$F(k,U.data);k=H.daemonInstanceId,H.changed&&(N=!0,s({kind:"reset"}),m(!1)),B()}else if(U.event==="event"){const H=U.data,F=p.current;F!==null&&BF(H)&&(x.current=F,Q2(p.current,x.current,D)&&(p.current=null,x.current=null,u(!1))),D?s({kind:"event",event:H}):zF(q,H)||(G=!0,L.abort())}else U.event==="error"&&s({kind:"stream_error",message:String(U.data.message??"stream error")})},L.signal,t).then(()=>(j(new Error("session stream closed before ready")),{error:void 0})).catch(U=>(j(U),{error:U}));try{await O,M=500;let U=500;for(;;){const H=new AbortController,F=()=>H.abort();L.signal.addEventListener("abort",F,{once:!0}),L.signal.aborted&&H.abort();const V=be.getSessionSnapshot(e,H.signal,t).then(ee=>({kind:"snapshot",snapshot:ee})).catch(ee=>({kind:"snapshot_error",error:ee})),I=await Promise.race([V,$.then(()=>({kind:"stream_ended"}))]);if(L.signal.removeEventListener("abort",F),I.kind==="stream_ended"){H.abort();break}if(S||E.signal.aborted)return;if(G)break;if(I.kind==="snapshot"){const{snapshot:ee}=I;s({kind:N?"snapshot":"reconcile_snapshot",items:ee.items,runtime:ee.runtime}),W=!0,N=!1;break}const{error:Y}=I;s({kind:"stream_error",message:Y instanceof Error?Y.message:String(Y)});const X=await Promise.race([$.then(()=>"stream_ended"),J2(U,E.signal).then(()=>"retry")]);if(E.signal.aborted)return;if(X==="stream_ended")break;U=Math.min(U*2,8e3)}}catch(U){!S&&!E.signal.aborted&&!G&&s({kind:"stream_error",message:U instanceof Error?U.message:String(U)})}finally{if(G||(D=!0),!S&&!E.signal.aborted&&!G){for(const U of q.events.splice(0))s({kind:"event",event:U});q.utf8Bytes=0,W&&(m(!0),Q2(p.current,x.current,!0)&&(p.current=null,x.current=null,u(!1)))}}const T=await $;if(S||m(!1),E.signal.removeEventListener("abort",z),L.abort(),E.signal.aborted)return;T.error,await J2(M,E.signal),M=Math.min(M*2,8e3)}})(),()=>{var M;S=!0,E.abort(),(M=h.current)==null||M.abort()}},[t,e]);const w=g.useCallback(async E=>{if(!e||!r)return;const S=typeof E=="string"?E:E.text,N=typeof E=="string"?[]:E.images,k=typeof E=="string"?void 0:E.clientMessageId??Gu("msg"),R=new AbortController,M=++v.current;h.current=R,p.current=M,x.current=null,u(!0);const L=`optimistic_${y.current++}`;s({kind:"optimistic_user",id:L,text:S,images:N});try{await be.sendSessionMessage(e,N.length===0?S:{content:[...N.map(z=>({type:"input_image",resourceId:z.resourceId,mediaType:z.mediaType,...z.filename?{filename:z.filename}:{},...z.byteLength?{byteLength:z.byteLength}:{},...z.width?{width:z.width}:{},...z.height?{height:z.height}:{}})),...S?[{type:"input_text",text:S}]:[]],clientMessageId:k},()=>{},R.signal,t)}catch(z){throw R.signal.aborted||(My(z)&&s({kind:"discard_optimistic_user",id:L}),s({kind:"stream_error",message:z.message})),p.current===M&&(p.current=null,x.current=null,u(!1)),z}finally{h.current===R&&(h.current=null)}},[r,t,e]),C=g.useCallback(async()=>{var E;if((E=h.current)==null||E.abort(),p.current=null,x.current=null,u(!1),!!e)try{await be.interruptSession(e,t)}catch{}},[t,e]);return g.useEffect(()=>{if(!o)return;if(PF(d,i.runStatus==="running"||i.waitingForInteraction)){p.current=null,x.current=null,u(!1);return}const E=p.current,S=window.setTimeout(()=>{p.current===E&&(p.current=null,x.current=null,u(!1))},15e3);return()=>window.clearTimeout(S)},[d,o,i.runStatus,i.waitingForInteraction]),{state:i,pendingSend:o,current:d,send:w,stop:C}}function zF(e,t,r={}){const i=r.events??DF,s=r.utf8Bytes??LF;let o;try{o=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=i||o>s||e.utf8Bytes+o>s?!1:(e.events.push(t),e.utf8Bytes+=o,!0)}function $F(e,t){const r=t&&typeof t=="object"&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof r!="string"||r.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:r,changed:e!==void 0&&e!==r}}function J2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const i=window.setTimeout(s,e);t.addEventListener("abort",s,{once:!0});function s(){window.clearTimeout(i),t.removeEventListener("abort",s),r()}})}const Dy="desktop-direct-view",UF=1,e5=32*1024,t5=4*1024*1024,HF=4096,FF=4096,WF=8847360,qF=4*1024,E0=512,VF=1024,r5=new Uint8Array([82,66,83,70]),jl=38,GF=1,YF=2,Hf=new TextEncoder,KF=new TextDecoder("utf-8",{fatal:!0});function XF(e){const t=QF(e);switch(t.type){case"browser.surface.ready":{n_(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=Ff(t.sourceWidth,"sourceWidth"),i=Ff(t.sourceHeight,"sourceHeight");return rM(r,i),{type:"browser.surface.ready",subscriptionId:Eu(t.subscriptionId,"subscriptionId"),browserGeneration:i5(t.browserGeneration,"browserGeneration"),viewportRevision:tW(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:i,deviceScaleFactor:iW(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:nW(t.format),grantedRole:ff(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{n_(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=ff(t.driver,["none","desktop","stream"],"driver"),i=t.driverSubscriptionId===void 0?void 0:Eu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(i!==void 0))throw Ut("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:Eu(t.subscriptionId,"subscriptionId"),browserGeneration:i5(t.browserGeneration,"browserGeneration"),driver:r,...i===void 0?{}:{driverSubscriptionId:i}}}case"browser.surface.closed":{n_(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:eW(t.message,"message",VF);return{type:"browser.surface.closed",subscriptionId:Eu(t.subscriptionId,"subscriptionId"),reason:ff(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw Ut("unknown Browser Surface server frame type")}}function ZF(e){if(!(e instanceof Uint8Array)||e.byteLength<jl+1||e.byteLength>jl+E0+t5)throw Ut("Browser Surface image frame has an invalid byte length");for(let x=0;x<r5.length;x+=1)if(e[x]!==r5[x])throw Ut("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==UF||t.getUint16(6,!1)!==0)throw Ut("Browser Surface image frame header is unsupported");const r=t.getUint8(5),i=r===GF?"jpeg":r===YF?"png":void 0;if(i===void 0)throw Ut("Browser Surface image frame format is unsupported");const s=t.getUint16(32,!1),o=t.getUint32(34,!1);if(s===0||s>E0||o===0||o>t5||jl+s+o!==e.byteLength)throw Ut("Browser Surface image frame lengths are invalid");let u;try{u=KF.decode(e.subarray(jl,jl+s))}catch{throw Ut("subscriptionId must be valid UTF-8")}u=Eu(u,"subscriptionId");const d=n5(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),h=n5(t.getBigUint64(20,!1),"timestampMilliseconds"),v=Ff(t.getUint16(28,!1),"width"),p=Ff(t.getUint16(30,!1),"height");return rM(v,p),{subscriptionId:u,frameSequence:d,viewportRevision:m,timestampMilliseconds:h,width:v,height:p,format:i,encodedBytes:new Uint8Array(e.subarray(jl+s))}}function QF(e){let t=e;if(typeof e=="string"){if(Hf.encode(e).byteLength>e5)throw Ut("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw Ut("Browser Surface control frame must be valid JSON")}}const r=JF(t,"Browser Surface control frame");let i;try{i=JSON.stringify(r)}catch{throw Ut("Browser Surface control frame must be serializable")}if(Hf.encode(i).byteLength>e5)throw Ut("Browser Surface control frame exceeds its byte limit");return r}function JF(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw Ut(`${t} must be an object`);return e}function n_(e,t,r,i=!1){const s=Object.keys(e),o=i?t.length-1:t.length;if(s.length<o||s.length>t.length||s.some(u=>!t.includes(u))||t.slice(0,o).some(u=>!Object.hasOwn(e,u)))throw Ut(`${r} contains unknown or missing fields`)}function Eu(e,t){if(typeof e!="string"||e.length===0||Hf.encode(e).byteLength>E0||!/^[\x21-\x7e]+$/.test(e))throw Ut(`${t} must be a bounded opaque identifier`);return e}function eW(e,t,r){if(typeof e!="string"||e.includes("\0")||Hf.encode(e).byteLength>r)throw Ut(`${t} exceeds its text byte limit`);return e}function i5(e,t){if(!Number.isSafeInteger(e)||e<1)throw Ut(`${t} must be a positive safe integer`);return e}function tW(e,t){if(!Number.isSafeInteger(e)||e<0)throw Ut(`${t} must be a nonnegative safe integer`);return e}function rW(e,t,r,i){if(!Number.isInteger(e)||e<t||e>r)throw Ut(`${i} must be an integer from ${t} to ${r}`);return e}function iW(e,t,r,i){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw Ut(`${i} must be a finite number from ${t} to ${r}`);return e}function Ff(e,t){const r=t.toLowerCase().includes("height")?FF:HF;return rW(e,1,r,t)}function rM(e,t){if(e*t>WF)throw Ut("Browser Surface viewport exceeds its maximum pixels")}function nW(e){return ff(e,["jpeg","png"],"format")}function ff(e,t,r){if(typeof e!="string"||!t.includes(e))throw Ut(`${r} is unsupported`);return e}function n5(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw Ut(`${t} exceeds a safe integer`);return Number(e)}function Ut(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const s5=1e4,sW=16,s_=1,a5=[500,1e3,2e3,4e3,8e3,15e3];function aW(e){const t=Math.max(0,Math.min(Math.trunc(e),a5.length-1));return a5[t]}function oW(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function lW(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function iM(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function qh(e){return!(e instanceof Error)||!e.message?"Browser operation failed":e.message==="failed_precondition"?"Browser Host is unavailable. On a headless Runtime, run `rynx browser install` on that host.":e.message.replaceAll("_"," ")}function cW(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(Dy)}function uW(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function dW(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(Dy)}async function hW(e,t){var o,u,d,m;const r=e.pages.findIndex(h=>h.pageId===e.activePageId);await t.close(e.browserGeneration);let i=await t.open((o=e.pages[0])==null?void 0:o.url);(u=t.onProgress)==null||u.call(t,i);for(const h of e.pages.slice(1))i=await t.createPage(i.browserGeneration,h.url),(d=t.onProgress)==null||d.call(t,i);const s=r>=0?i.pages[r]:void 0;return s&&i.activePageId!==s.pageId&&(i=await t.activatePage(i.browserGeneration,s.pageId),(m=t.onProgress)==null||m.call(t,i)),i}function fW({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:i=t}){const s=Math.max(0,r-t),o=r-i>s_;return{hasOverflow:o,canScrollLeft:o&&e>s_,canScrollRight:o&&e<s-s_}}function mW(e){return Math.max(120,e*.75)}function pW({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:i,inset:s=4}){const o=e,u=e+t,d=Math.max(0,r-s),m=r+i+s;return d<o?d-o:m>u?m-u:0}function gW(e,t,r,i){return{deltaX:o5(e+r),deltaY:o5(t+i)}}function o5(e){return Number.isFinite(e)?Math.max(-s5,Math.min(s5,e)):0}function vW(e){if(!e)return[];const t=new TextEncoder,r=[];let i="",s=0;for(const o of e){const u=t.encode(o).byteLength;if(s+u>qF){if(r.push(i),r.length>=sW)throw new RangeError("Browser text input is too large");i="",s=0}i+=o,s+=u}return i&&r.push(i),r}function _W(e,t){if(t.type==="pointerdown"){const i=l5(t.button);return i&&e.set(t.pointerId,i),i}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??l5(t.button)}function l5(e){if(e===0)return"left";if(e===1)return"middle";if(e===2)return"right";if(e===3)return"back";if(e===4)return"forward"}const xW=1,yW=2;function bW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i,toolbarHost:s}){const o=g.useRef(null),u=g.useRef(null),d=g.useRef(void 0),m=g.useRef(void 0),h=g.useRef(0),v=g.useRef(0),p=g.useRef(0),x=g.useRef(0),y=g.useRef(void 0),w=g.useRef(!1),C=g.useRef(!1),E=g.useRef(!1),S=g.useRef(void 0),N=g.useRef(void 0),k=g.useRef(void 0),R=g.useRef(new Map),[M,L]=g.useState("connecting"),[z,D]=g.useState(),[W,G]=g.useState(),[q,B]=g.useState("none"),[j,O]=g.useState(),[$,T]=g.useState(!1),[U,H]=g.useState(!1),F=q==="stream"&&j===(W==null?void 0:W.subscriptionId),V=g.useCallback(()=>{k.current!==void 0&&(window.cancelAnimationFrame(k.current),k.current=void 0),S.current=void 0,N.current=void 0,R.current.clear()},[]),I=g.useCallback(()=>{y.current!==void 0&&(window.clearTimeout(y.current),y.current=void 0)},[]),Y=g.useCallback(async({refreshCapability:ve=!1,preserveFrame:Ae=!1}={})=>{var ze;I();const Ie=++p.current;(ze=d.current)==null||ze.close(1e3,"Browser Surface reconnecting"),d.current=void 0,m.current=void 0,h.current=0,v.current=0,E.current=!1,C.current=!1,V(),L("connecting"),D(void 0),G(void 0),B("none"),O(void 0),H(!1),Ae||(w.current=!1,T(!1));const Oe=rt=>{if(p.current!==Ie)return;D(rt),L("connecting");const Be=aW(x.current++);y.current=window.setTimeout(()=>{y.current=void 0,Y({preserveFrame:!0})},Be)};try{const rt=await Wu(ve);if(p.current!==Ie)return;const Be=new WebSocket(CW({runtimeSelector:e,sessionId:t,pageId:i,browserGeneration:r,capability:rt}));Be.binaryType="arraybuffer",d.current=Be;let dt=ve,He=!1;Be.onmessage=Ot=>{var gi;if(p.current!==Ie||d.current!==Be)return;if(typeof Ot.data=="string"){try{const Bt=JSON.parse(Ot.data);if(Bt&&typeof Bt=="object"&&"type"in Bt&&Bt.type==="error"){const At="message"in Bt&&typeof Bt.message=="string"?Bt.message:"Browser Surface failed";D(At);return}const vt=XF(Bt);if(vt.type==="browser.surface.ready"){m.current=vt,h.current=vt.viewportRevision,I(),G(vt),L("ready");return}if(vt.type==="browser.surface.driver.changed"){const At=vt.driver==="stream"&&vt.driverSubscriptionId===((gi=m.current)==null?void 0:gi.subscriptionId);E.current=At,At||V(),B(vt.driver),O(vt.driverSubscriptionId);return}E.current=!1,V();const ur=vt.message??EW(vt.reason);He=!0,lW(vt.reason)?(Oe(ur),Be.close(1e3,"recovering Browser Surface")):(D(ur),L("closed"))}catch{He=!0,D("Browser Surface sent an invalid control frame"),L("closed"),Be.close(4400,"invalid Browser Surface control")}return}if(!(Ot.data instanceof ArrayBuffer)){D("Browser Surface sent an invalid image frame"),Be.close(4400,"invalid Browser Surface image");return}const Ht=()=>p.current===Ie&&d.current===Be;wW(Ot.data,Be,o.current,m.current,Ht).then(Bt=>{Bt===void 0||!Ht()||(h.current=Bt,w.current=!0,C.current=!0,x.current=0,T(!0),H(!0))}).catch(()=>{Ht()&&(He=!0,D("Browser preview could not be decoded"),L("closed"),Be.close(4400,"Browser Surface image decode failed"))})},Be.onclose=Ot=>{if(!(p.current!==Ie||d.current!==Be)&&(d.current=void 0,E.current=!1,V(),!He)){if((Ot.code===4403||Ot.code===1006)&&!dt){dt=!0,Y({refreshCapability:!0,preserveFrame:!0});return}if(oW(Ot.code)){Oe(d5(Ot.code));return}L("closed"),D(Ht=>Ht??d5(Ot.code))}},Be.onerror=()=>{d.current===Be&&D("Browser preview transport failed")}}catch(rt){if(p.current!==Ie)return;Oe(rt instanceof Error?rt.message:"Browser preview could not connect")}},[e,t,i,r,V,I]);g.useEffect(()=>(Y(),()=>{var ve;p.current+=1,I(),V(),(ve=d.current)==null||ve.close(1e3,"Browser Surface view unmounted"),d.current=void 0}),[Y,V,I]);const X=g.useCallback(()=>{x.current=0,Y({preserveFrame:!0})},[Y]),ee=g.useCallback(ve=>{const Ae=d.current;return!Ae||Ae.readyState!==WebSocket.OPEN?!1:(Ae.send(JSON.stringify(ve)),!0)},[]),re=g.useCallback(()=>{var Ae;const ve=m.current;!ve||!C.current||(ee({type:"browser.surface.driver.take",subscriptionId:ve.subscriptionId,browserGeneration:ve.browserGeneration,viewportRevision:h.current}),(Ae=u.current)==null||Ae.focus())},[ee]),oe=g.useCallback(()=>{const ve=m.current;ve&&(V(),u.current&&(u.current.value=""),ee({type:"browser.surface.driver.release",subscriptionId:ve.subscriptionId,browserGeneration:ve.browserGeneration}))},[ee,V]),Z=g.useCallback(ve=>{const Ae=m.current;return!Ae||!C.current||!E.current?!1:ee({type:"browser.surface.input",subscriptionId:Ae.subscriptionId,browserGeneration:Ae.browserGeneration,viewportRevision:h.current,inputSequence:v.current++,event:ve})},[ee]),ce=g.useCallback(ve=>{let Ae;try{Ae=vW(ve)}catch{return D("Text input is limited to 64 KiB at a time."),!1}let Ie=!1;for(const Oe of Ae){if(!Z({type:"text.insert",text:Oe}))return Ie;Ie=!0}return Ie},[Z]),ne=g.useCallback(()=>{k.current!==void 0&&(window.cancelAnimationFrame(k.current),k.current=void 0);const ve=S.current,Ae=N.current;S.current=void 0,N.current=void 0,E.current&&(ve&&Z({...ve}),Ae&&Z({...Ae}))},[Z]),we=g.useCallback(()=>{k.current===void 0&&(k.current=window.requestAnimationFrame(ne))},[ne]);g.useEffect(()=>{E.current=F,F||(V(),u.current&&(u.current.value="",u.current.blur()))},[F,V]);const xe=g.useCallback(ve=>{var rt;if(!F)return;const Ae=c5(ve.currentTarget,ve.clientX,ve.clientY);if(!Ae)return;if(ve.type==="pointermove"){S.current={type:"pointer.move",...Ae,modifiers:Vh(ve)},we(),ve.preventDefault();return}ne(),ve.type==="pointerdown"&&((rt=u.current)==null||rt.focus(),ve.currentTarget.setPointerCapture(ve.pointerId));const Ie=ve.type==="pointerdown"?"pointer.down":"pointer.up",Oe=_W(R.current,ve);if(!Oe)return;const ze={type:Ie,...Ae,button:Oe,modifiers:Vh(ve)};Z(ze)&&ve.preventDefault()},[F,Z,ne,we]),ye=g.useCallback(ve=>{if(!F)return;const Ae=c5(ve.currentTarget,ve.clientX,ve.clientY);if(!Ae)return;const Ie=ve.deltaMode===xW?16:ve.deltaMode===yW?Math.max(1,ve.currentTarget.clientHeight):1,Oe=N.current,ze=gW((Oe==null?void 0:Oe.deltaX)??0,(Oe==null?void 0:Oe.deltaY)??0,ve.deltaX*Ie,ve.deltaY*Ie);N.current={type:"wheel",...Ae,...ze,modifiers:Vh(ve)},we(),ve.preventDefault()},[F,we]),J=g.useCallback(ve=>{if(ve.nativeEvent.isComposing||ve.key==="Process"||ve.key==="Dead")return;ne();const Ae=Z({type:ve.type==="keydown"?"key.down":"key.up",key:ve.key,code:ve.code,repeat:ve.repeat,modifiers:Vh(ve)}),Ie=SW({type:ve.type,key:ve.key,altKey:ve.altKey,ctrlKey:ve.ctrlKey,metaKey:ve.metaKey,isComposing:ve.nativeEvent.isComposing}),Oe=Ie===void 0?!1:ce(Ie);(Ae||Oe)&&ve.preventDefault()},[Z,ce,ne]),ie=g.useCallback(ve=>{ne();const Ae=ve.clipboardData.getData("text/plain");Ae&&ce(Ae)&&ve.preventDefault()},[ce,ne]),Re=g.useCallback(ve=>{const Ae=ve.data||ve.currentTarget.value;ve.currentTarget.value="",Ae&&ce(Ae)},[ce]);return l.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]",children:[l.jsx("canvas",{ref:o,className:"max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-label":F?"Interactive browser preview":"Browser preview",tabIndex:-1,onPointerMove:xe,onPointerDown:xe,onPointerUp:xe,onPointerCancel:xe,onWheel:ye}),l.jsx("textarea",{ref:u,"aria-label":"Browser keyboard input",className:"pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0",tabIndex:F?0:-1,autoComplete:"off",spellCheck:!1,onKeyDown:J,onKeyUp:J,onPaste:ie,onCompositionEnd:Re}),M==="connecting"&&l.jsx(u5,{preserveFrame:$,icon:l.jsx(Ge,{className:"size-5 animate-spin"}),label:$?"Reconnecting preview…":"Connecting preview…"}),M==="ready"&&!U&&l.jsx(u5,{icon:l.jsx(Ge,{className:"size-5 animate-spin"}),label:"Waiting for first frame…"}),M==="closed"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center",children:l.jsxs("div",{className:"max-w-sm",children:[l.jsx("p",{className:"text-sm font-medium text-white",children:"Preview disconnected"}),l.jsx("p",{role:"alert",className:"mt-1 text-xs leading-5 text-white/60",children:z??"The Browser Surface ended."})]})}),s&&Ia.createPortal(l.jsx("div",{className:"flex items-center",children:M==="closed"?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:X,children:l.jsx(Nt,{className:"size-4"})}):M!=="ready"||!U?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":w.current?"Reconnecting browser preview":"Connecting browser preview",title:w.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:l.jsx(Ge,{className:"size-4 animate-spin"})}):F?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:oe,children:l.jsx(rB,{className:"size-4"})}):l.jsx(he,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:re,children:l.jsx(nB,{className:"size-4"})})}),s),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:z??(F?"Browser control active":`Browser preview ${M}`)})]})}async function wW(e,t,r,i,s){const o=ZF(new Uint8Array(e));if(!i||o.subscriptionId!==i.subscriptionId||o.format!==i.format)throw new Error("Browser Surface image does not match the active subscription");const u=await createImageBitmap(new Blob([o.encodedBytes],{type:o.format==="jpeg"?"image/jpeg":"image/png"}));try{if(!s()||!r||t.readyState!==WebSocket.OPEN)return;r.width=o.width,r.height=o.height;const d=r.getContext("2d",{alpha:!1});if(!d)throw new Error("Browser preview canvas is unavailable");return d.drawImage(u,0,0,o.width,o.height),t.send(JSON.stringify({type:"browser.surface.frame.ack",subscriptionId:i.subscriptionId,frameSequence:o.frameSequence})),o.viewportRevision}finally{u.close()}}function SW(e){if(!(e.type!=="keydown"||e.isComposing||e.key==="Process"||e.key==="Dead"||e.altKey||e.ctrlKey||e.metaKey||Array.from(e.key).length!==1))return e.key}function CW(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({generation:String(e.browserGeneration),role:"control",format:"jpeg",quality:"75",maximumFrameRate:"15",capability:e.capability});return`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${r.toString()}`}function c5(e,t,r){const i=e.getBoundingClientRect();if(!(i.width<=0||i.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-i.left)*e.width/i.width)),y:Math.max(0,Math.min(e.height,(r-i.top)*e.height/i.height))}}function Vh(e){const t=[];return e.altKey&&t.push("alt"),e.ctrlKey&&t.push("control"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift"),t}function u5({icon:e,label:t,preserveFrame:r=!1}){return l.jsx("div",{className:r?"absolute inset-0 grid place-items-center bg-[#111318]/55 text-white":"absolute inset-0 grid place-items-center bg-[#111318] text-white/70",children:l.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 text-sm",children:[e,t]})})}function EW(e){return e==="replaced"?"This preview was opened somewhere else.":e==="generation_changed"?"The Browser was restarted.":e==="page_closed"?"This Browser page was closed.":e==="idle_timeout"?"The Browser preview timed out.":e==="unauthorized"?"Browser preview authorization expired.":"The Browser preview ended."}function d5(e){return e===4403?"Browser preview authorization failed.":e===4406?"The selected Runtime cannot provide this Browser preview.":e===4408?"The Browser preview client was too slow.":e===1012?"The selected Runtime disconnected.":"The Browser preview connection closed."}const RW=400;function kW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}){const s=g.useRef(null),[o,u]=g.useState(0),[d,m]=g.useState("mounting"),[h,v]=g.useState("unavailable"),[p,x]=g.useState(!1),[y,w]=g.useState(),C=g.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}),[e,t,r,i]);g.useEffect(()=>{const S=window.rynxDesktopBrowser,N=s.current;if(!S||!N){m("unavailable");return}let k=!1,R=0,M;const L=a_(C),z=async()=>{if(k)return;const B=NW(N.getBoundingClientRect());if(!B){S.park(C);return}try{const j=await S.mount(C,B);if(k)return;if(j==="mounted"){m("mounted"),M!==void 0&&window.clearTimeout(M),M=void 0;return}}catch{}k||(m("mounting"),M=window.setTimeout(()=>void z(),RW))},D=()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>void z())},W=new ResizeObserver(D);W.observe(N),window.addEventListener("resize",D),window.addEventListener("scroll",D,!0);const G=S.onState(B=>{if(a_(B.resource)===L){if(B.state==="closed"){m("unavailable");return}D()}}),q=S.onDriver(B=>{a_(B.resource)===L&&(v(B.driver),B.driver==="desktop"&&(x(!1),w(void 0)))});return v(S.getDriver(C)),m("mounting"),D(),()=>{k=!0,W.disconnect(),G(),q(),window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0),window.cancelAnimationFrame(R),M!==void 0&&window.clearTimeout(M),S.park(C)}},[C,o]);const E=async()=>{const S=window.rynxDesktopBrowser;if(!(!S||p)){x(!0),w(void 0);try{if(await S.takeBack(C)!=="taken")throw new Error("The remote controller is no longer available.")}catch(N){x(!1),w(N instanceof Error?N.message:"Could not take back browser control.")}}};return l.jsxs("div",{ref:s,className:"relative flex min-h-0 flex-1 overflow-hidden bg-white","aria-label":"Embedded session browser page",children:[d!=="mounted"&&l.jsx("div",{className:"absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center",children:d==="mounting"?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),l.jsxs(he,{size:"sm",variant:"outline",onClick:()=>u(S=>S+1),children:[l.jsx(Nt,{}),"Retry"]})]})}),d==="mounted"&&h==="stream"&&l.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:l.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[l.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),l.jsxs(he,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void E(),children:[p?l.jsx(Ge,{className:"animate-spin"}):null,"Take back control"]}),y?l.jsx("p",{role:"alert",className:"mt-2 text-xs text-[var(--destructive)]",children:y}):null]})})]})}function NW(e){const t=Math.max(0,Math.ceil(e.left)),r=Math.max(0,Math.ceil(e.top)),i=Math.min(window.innerWidth,Math.floor(e.right)),s=Math.min(window.innerHeight,Math.floor(e.bottom));return i<=t||s<=r?null:{x:t,y:r,width:i-t,height:s-r}}function a_(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const AW="size-11 sm:size-8";function TW({sessionId:e,runtimeSelector:t,pageId:r,browserResource:i}){const{browser:s,loading:o,pendingAction:u,error:d,disabled:m,load:h,openBrowser:v,closeBrowser:p,recreateForDesktop:x,navigatePage:y,backPage:w,forwardPage:C,reloadPage:E}=i,S=g.useMemo(()=>s==null?void 0:s.pages.find(D=>D.pageId===r),[s,r]),N=s!==null&&cW(t,s,typeof window.rynxDesktopBrowser<"u"),k=s!==null&&s.sessionId===e&&uW(t,s,typeof window.rynxDesktopBrowser<"u"),R=s!==null&&s.sessionId===e&&dW(t,s,typeof window.rynxDesktopBrowser<"u"),M=g.useRef(null),[L,z]=g.useState(null);return g.useEffect(()=>{const D=`${t}
541
+ ${e}`;!k||M.current===D||(M.current=D,x())},[k,x,t,e]),o&&s===null?l.jsx(o_,{label:"Loading browser…"}):s===null?l.jsx(MW,{error:d,pending:u!==null,onOpen:D=>void v(D),onRetry:()=>void h(!0)}):l.jsxs("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]","aria-label":"Session browser page",children:[l.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[l.jsx(Gh,{label:"Go back",disabled:m||!(S!=null&&S.canGoBack),onClick:()=>S&&void w(S.pageId),children:l.jsx(Yl,{})}),l.jsx(Gh,{label:"Go forward",disabled:m||!(S!=null&&S.canGoForward),onClick:()=>S&&void C(S.pageId),children:l.jsx(kR,{})}),l.jsx(Gh,{label:"Reload page",disabled:m||!S,onClick:()=>S&&void E(S.pageId),children:l.jsx(BR,{className:S!=null&&S.loading?"animate-spin":void 0})})]}),S?l.jsx(jW,{page:S,disabled:m,onNavigate:D=>void y(S.pageId,D)},`${S.pageId}
542
+ ${S.url}`):l.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!N&&l.jsx("div",{ref:z,className:"flex shrink-0 items-center"}),R&&l.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void x(),children:"Open in app"}),l.jsx(Gh,{label:"Stop browser",disabled:u!==null,onClick:()=>void p(),children:l.jsx(Rf,{})})]}),l.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[k?l.jsx(o_,{label:"Opening in Desktop…"}):s.status==="ready"&&S?N?l.jsx(kW,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:S.pageId}):l.jsx(bW,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:S.pageId,toolbarHost:L}):s.status==="ready"?l.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]",children:"No browser page is open."}):s.status==="unavailable"?l.jsx(DW,{error:d,pending:u!==null,onRestart:()=>void v()}):l.jsx(o_,{label:s.status==="closing"?"Closing browser…":"Starting browser…"}),d&&s.status!=="unavailable"&&l.jsx("div",{role:"alert",className:"absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm",children:d})]}),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:u??d??(s.status==="ready"?"Browser ready":`Browser ${s.status}`)})]})}function MW({error:e,pending:t,onOpen:r,onRetry:i}){const[s,o]=g.useState(""),u=d=>{d.preventDefault(),r(iM(s))};return l.jsx(yn,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:l.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:l.jsxs("form",{onSubmit:u,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Pu,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"text-base font-semibold",children:"Open a browser for this session"}),l.jsx("p",{className:"mt-1 text-sm leading-5 text-[var(--muted-foreground)]",children:"The browser runs on the selected Runtime, beside the agent using it."})]})]}),l.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[l.jsx(yt,{value:s,onChange:d=>o(d.target.value),"aria-label":"Initial browser address",placeholder:"https://example.com (optional)",className:"h-11 flex-1 sm:h-9",disabled:t,autoFocus:!0}),l.jsxs(he,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?l.jsx(Ge,{className:"animate-spin"}):l.jsx(Pu,{}),t?"Opening…":"Open browser"]})]}),e&&l.jsxs("div",{role:"alert",className:"mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",children:[l.jsx("span",{children:e}),l.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:i,children:"Retry"})]}),l.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function jW({page:e,disabled:t,onNavigate:r}){const[i,s]=g.useState(e.url),o=u=>{u.preventDefault();const d=iM(i);d&&r(d)};return l.jsx("form",{onSubmit:o,className:"order-last flex min-w-full flex-1 sm:order-none sm:min-w-0",children:l.jsx(yt,{value:i,onChange:u=>s(u.target.value),"aria-label":"Browser address",className:"h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8",disabled:t,spellCheck:!1})})}function Gh({label:e,disabled:t,onClick:r,children:i}){return l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:AW,"aria-label":e,title:e,disabled:t,onClick:r,children:i})}function o_({label:e}){return l.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center gap-2 bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),e]})}function DW({error:e,pending:t,onRestart:r}){return l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center",role:"status",children:[l.jsx(Nt,{className:"size-5 text-[var(--muted-foreground)]"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&l.jsx(Ge,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function LW(e,t,r,i){return r===i?t:e}new TextEncoder;const OW=4,BW=5*1024*1024,PW=20*1024*1024,IW=8192,zW=4e7,$W=["image/png","image/jpeg","image/webp"];function UW(){return{enabled:!0,mediaTypes:[...$W],maxImagesPerMessage:OW,maxImageBytes:BW,maxMessageBytes:PW,maxImageSide:IW,maxImagePixels:zW}}function nM(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const R0=UW(),h5={...R0,enabled:!1};function sM({policy:e,upload:t,deleteResource:r,onChange:i}){const[s,o]=g.useState([]),u=g.useRef([]),d=g.useRef(new Map),m=g.useCallback(y=>{o(w=>{const C=y(w);return u.current=C,C})},[]);g.useEffect(()=>()=>{for(const y of d.current.values())y.abort();for(const y of u.current)URL.revokeObjectURL(y.previewUrl)},[]);const h=g.useCallback(y=>{if(!e.enabled)return;const w=Math.max(0,e.maxImagesPerMessage-u.current.length),C=y.slice(0,w);if(C.length!==0){i==null||i();for(const E of C){const S=Gu("attachment"),N=Gu("upl"),k=URL.createObjectURL(E),R=E.type;if(!e.mediaTypes.includes(R)){m(z=>[...z,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:"Unsupported image type"}]);continue}if(E.size<=0||E.size>e.maxImageBytes){m(z=>[...z,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:`Image must be smaller than ${HW(e.maxImageBytes)}`}]);continue}const M={id:S,file:E,clientUploadId:N,previewUrl:k,state:t?"uploading":"ready"};if(m(z=>[...z,M]),!t)continue;const L=new AbortController;d.current.set(S,L),t(E,N,L.signal).then(z=>{if(d.current.delete(S),!u.current.some(D=>D.id===S)){r==null||r(z).catch(()=>{});return}m(D=>D.map(W=>W.id===S?{...W,state:"ready",resource:z}:W))}).catch(z=>{d.current.delete(S),!L.signal.aborted&&m(D=>D.map(W=>W.id===S?{...W,state:"failed",error:z instanceof Error?z.message:"Upload failed"}:W))})}}},[r,i,e,m,t]),v=g.useCallback(y=>{const w=Array.from(y.clipboardData.files).filter(C=>C.type.startsWith("image/"));w.length!==0&&(y.preventDefault(),h(w))},[h]),p=g.useCallback(y=>{var w;i==null||i(),(w=d.current.get(y.id))==null||w.abort(),d.current.delete(y.id),m(C=>C.filter(E=>E.id!==y.id)),URL.revokeObjectURL(y.previewUrl),y.resource&&(r==null||r(y.resource).catch(()=>{}))},[r,i,m]),x=g.useCallback(()=>{for(const y of d.current.values())y.abort();d.current.clear();for(const y of u.current)URL.revokeObjectURL(y.previewUrl);u.current=[],o([])},[]);return{images:s,addFiles:h,onPaste:v,remove:p,clear:x,hasPending:s.some(y=>y.state==="uploading"),hasFailed:s.some(y=>y.state==="failed"),readyResources:s.flatMap(y=>y.state==="ready"&&y.resource?[y.resource]:[]),readyUploads:s.flatMap(y=>y.state==="ready"?[{file:y.file,clientUploadId:y.clientUploadId}]:[])}}function aM({images:e,disabled:t,onRemove:r,className:i}){return e.length===0?null:l.jsx("div",{className:qe("flex gap-2 overflow-x-auto px-2 pb-2",i),"aria-label":"Attached images",children:e.map(s=>l.jsxs("div",{className:"group relative size-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",title:s.error??s.file.name,children:[l.jsx("img",{src:s.previewUrl,alt:s.file.name,className:"size-full object-cover"}),s.state==="uploading"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:l.jsx(Ge,{className:"size-5 animate-spin"})}),s.state==="failed"&&l.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white",children:"Upload failed"}),l.jsx("button",{type:"button",className:"absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45","aria-label":`Remove ${s.file.name}`,disabled:t,onClick:()=>r(s),children:l.jsx(Na,{className:"size-3"})})]},s.id))})}function oM({policy:e,imageCount:t,disabled:r,onFiles:i,className:s}){const o=g.useRef(null);function u(d){i(Array.from(d.target.files??[])),d.target.value=""}return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:o,type:"file",accept:e.mediaTypes.join(","),multiple:!0,className:"hidden",onChange:u}),l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:qe("size-8 shrink-0",s),disabled:r||!e.enabled||t>=e.maxImagesPerMessage,"aria-label":"Attach images",title:`Attach up to ${e.maxImagesPerMessage} images`,onClick:()=>{var d;return(d=o.current)==null?void 0:d.click()},children:t>0?l.jsx(OO,{}):l.jsx(fB,{})})]})}function HW(e){return`${Math.round(e/(1024*1024))} MB`}const l_=200;function FW({initialDraft:e,model:t,running:r,disabled:i,sessionId:s,runtimeSelector:o,onSend:u,onStop:d}){const[m,h]=g.useState(e??""),[v,p]=g.useState(h5),[x,y]=g.useState(!1),w=g.useRef(null),C=g.useRef(!1),E=g.useRef(void 0),S=g.useRef(0),N=g.useRef(!1),k=sM({policy:v,upload:(L,z,D)=>be.uploadSessionResource(o,s,L,z,D),deleteResource:L=>be.deleteSessionResource(o,s,L.resourceId),onChange:()=>{E.current=void 0}});g.useEffect(()=>{let L=!1;return be.getSessionResourcePolicy(o,s).then(z=>{L||p(z)}).catch(()=>{L||p(h5)}),()=>{L=!0}},[o,s]),g.useLayoutEffect(()=>{const L=w.current;if(!L)return;L.style.height="auto";const z=L.scrollHeight;L.style.height=`${Math.min(z,l_)}px`,L.style.overflowY=z>l_?"auto":"hidden"},[m]);async function R(){if(N.current)return;const L=m,z=S.current,D=m.trim(),W=k.readyResources;if(!D&&W.length===0||k.hasPending||k.hasFailed)return;const G=W.length>0?E.current??Gu("msg"):void 0;G&&(E.current=G),N.current=!0,y(!0),h("");try{await u({text:D,images:W,clientMessageId:G}),k.clear(),E.current=void 0}catch(q){_e.error(`Could not send message: ${q instanceof Error?q.message:"unknown error"}`),My(q)?h(B=>LW(B,L,S.current,z)):(k.clear(),E.current=void 0)}finally{N.current=!1,y(!1)}}const M=!i&&!x&&!k.hasPending&&!k.hasFailed&&(!!m.trim()||k.images.length>0);return l.jsx("div",{className:"px-4 pb-3 pt-1",children:l.jsxs("div",{className:"mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]",children:[l.jsx(aM,{images:k.images,disabled:x,onRemove:k.remove}),l.jsx("textarea",{ref:w,value:m,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:i,onChange:L=>{S.current+=1,E.current=void 0,h(L.target.value)},onPaste:L=>{x||k.onPaste(L)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!C.current&&!L.nativeEvent.isComposing&&L.keyCode!==229&&(L.preventDefault(),M&&R())},className:qe("block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5","text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]","focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"),style:{maxHeight:l_}}),l.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[l.jsx(oM,{policy:v,imageCount:k.images.length,disabled:i||x,onFiles:k.addFiles}),t&&l.jsx("span",{className:"min-w-0 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]",children:t}),r?l.jsxs(he,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:d,title:"Stop the running turn",children:[l.jsx(VB,{})," Stop"]}):l.jsxs(he,{className:"ml-auto h-8 shrink-0",onClick:R,disabled:!M,children:[l.jsx(IR,{})," Send"]})]})]})})}const lM=24,WW={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function qW({pages:e,order:t,selectedPageId:r,selectionDisabled:i,mutationDisabled:s,createDisabled:o,createPending:u,emulatorAttached:d,emulator:m,onSelectPage:h,onClosePage:v,onCreatePage:p,onSelectEmulator:x,onCloseEmulator:y,onAddEmulator:w,headerLeadingAction:C,leadingAction:E,trailingAction:S}){const N=g.useRef(null),k=g.useRef(null),R=g.useRef(null),M=g.useRef(null),L=g.useRef(null),z=g.useRef(null),[D,W]=g.useState(WW),G=t.flatMap(F=>{if(F===Fn())return m?[{type:"emulator",key:F,emulator:m}]:[];const V=e.find(I=>Hn(I.pageId)===F);return V?[{type:"browser",key:F,page:V}]:[]}),q=G.map(F=>F.key).join(`
543
+ `),B=G.length,j=g.useCallback(()=>{const F=N.current,V=k.current,I=R.current;if(!(!F||!V||!I))return fW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,contentWidth:I.scrollWidth,availableWidth:F.clientWidth})},[]),O=g.useCallback(()=>{const F=j();F&&W(V=>VW(V,F)?V:F)},[j]),$=g.useCallback(()=>{L.current===null&&(L.current=window.requestAnimationFrame(()=>{L.current=null,O()}))},[O]),T=g.useCallback(F=>{const V=k.current,I=M.current;if(!V||!I)return;const Y=V.getBoundingClientRect(),X=I.getBoundingClientRect(),ee=pW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,tabLeft:V.scrollLeft+X.left-Y.left,tabWidth:X.width,inset:lM});ee!==0&&V.scrollBy({left:ee,behavior:F})},[]),U=g.useCallback(F=>{const V=k.current;if(!V)return;const I=mW(V.clientWidth);V.scrollBy({left:F==="left"?-I:I,behavior:m5()})},[]);g.useEffect(()=>()=>{L.current!==null&&window.cancelAnimationFrame(L.current)},[]),g.useLayoutEffect(()=>{const F=N.current,V=k.current,I=R.current;if(!F||!V||!I)return;const Y=()=>{const ee=V.clientWidth,re=z.current===null||Math.abs(ee-z.current)>1;z.current=ee,$(),re&&T("auto")},X=typeof ResizeObserver>"u"?void 0:new ResizeObserver(Y);return X==null||X.observe(F),X==null||X.observe(V),X==null||X.observe(I),window.addEventListener("resize",Y),O(),()=>{X==null||X.disconnect(),window.removeEventListener("resize",Y)}},[T,$,O]),g.useEffect(()=>{const F=k.current;if(!F)return;const V=I=>{if(I.ctrlKey||I.deltaY===0||Math.abs(I.deltaY)<=Math.abs(I.deltaX))return;const Y=j();(I.deltaY<0?Y!=null&&Y.canScrollLeft:Y!=null&&Y.canScrollRight)&&(I.preventDefault(),F.scrollLeft+=I.deltaY,$())};return F.addEventListener("wheel",V,{passive:!1}),()=>F.removeEventListener("wheel",V)},[j,$]),g.useLayoutEffect(()=>{T(m5()),$()},[q,T,$,D.hasOverflow,r]);function H(F,V){var X;let I;if(F.key==="ArrowLeft"?I=(V-1+B)%B:F.key==="ArrowRight"?I=(V+1)%B:F.key==="Home"?I=0:F.key==="End"&&(I=B-1),I===void 0||I===V)return;F.preventDefault();const Y=(X=R.current)==null?void 0:X.querySelectorAll('[role="tab"]').item(I);Y==null||Y.focus(),Y==null||Y.click()}return l.jsxs("div",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[C&&l.jsx("div",{className:"mb-1 flex h-8 shrink-0 items-center",children:C}),l.jsxs("div",{ref:N,className:"flex min-w-0 flex-1 items-end gap-1",children:[D.hasOverflow&&l.jsx(f5,{direction:"left",disabled:!D.canScrollLeft,onClick:()=>U("left")}),l.jsx("div",{ref:k,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:GW(D),onScroll:$,children:l.jsx("div",{ref:R,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:G.map((F,V)=>{if(F.type==="emulator"){const ee=F.emulator;return l.jsxs("div",{ref:ee.selected?M:void 0,role:"presentation",className:ee.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":ee.selected,"aria-label":ee.label,title:ee.label,tabIndex:ee.selected?0:-1,onClick:x,onKeyDown:re=>H(re,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[ee.busy?l.jsx(Ge,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Kl,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:ee.label})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:y,className:"ml-1",children:l.jsx(Na,{className:"size-3"})})]},F.key)}const I=F.page,Y=I.pageId===r,X=I.title||I.url||"New page";return l.jsxs("div",{ref:Y?M:void 0,role:"presentation",className:Y?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":Y,"aria-label":X,title:X,tabIndex:Y?0:-1,disabled:i,onClick:()=>h(I.pageId),onKeyDown:ee=>H(ee,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[I.loading?l.jsx(Ge,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Pu,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:X})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${X}`,title:`Close ${X}`,disabled:s,onClick:()=>v(I.pageId),className:"ml-1",children:l.jsx(Na,{className:"size-3"})})]},F.key)})})}),D.hasOverflow&&l.jsx(f5,{direction:"right",disabled:!D.canScrollRight,onClick:()=>U("right")})]}),E&&l.jsx("div",{className:"mb-1 shrink-0",children:E}),l.jsxs(K_,{children:[l.jsx(Bf,{asChild:!0,children:l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:l.jsx(Qi,{})})}),l.jsxs(Pf,{align:"end",children:[l.jsxs(If,{disabled:o,"aria-busy":u,onSelect:p,children:[u?l.jsx(Ge,{className:"animate-spin"}):l.jsx(Pu,{}),u?"Creating browser tab…":"New browser tab"]}),l.jsxs(If,{onSelect:w,children:[l.jsx(Kl,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),S&&l.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:S})]})}function f5({direction:e,disabled:t,onClick:r}){const i=e==="left"?AR:jo;return l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-7","aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:r,children:l.jsx(i,{})})}function m5(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function VW(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function GW(e){const t=`${lM}px`;let r;return e.canScrollLeft&&e.canScrollRight?r=`linear-gradient(to right, transparent, #000 ${t}, #000 calc(100% - ${t}), transparent)`:e.canScrollLeft?r=`linear-gradient(to right, transparent, #000 ${t}, #000 100%)`:e.canScrollRight&&(r=`linear-gradient(to right, #000 0, #000 calc(100% - ${t}), transparent)`),r?{WebkitMaskImage:r,maskImage:r}:void 0}const YW=8,KW=256,XW=4e3;function ZW({sessionId:e,runtimeSelector:t,controller:r}){return r.binding?l.jsx(JW,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r}):l.jsx(QW,{controller:r})}function QW({controller:e}){const[t,r]=g.useState(null),i=async s=>{r(s);try{await e.attach(s)}catch(o){_e.error(`Could not attach Emulator: ${o.message}`)}finally{r(null)}};return l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("div",{className:"p-4 sm:p-5",children:l.jsxs("div",{className:"mx-auto max-w-2xl",children:[l.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),l.jsx(he,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:l.jsx(Nt,{className:qe("size-4",e.devicesLoading&&"animate-spin")})})]}),e.error&&l.jsx("div",{className:"mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:e.error.message}),e.devicesLoading&&e.devices.length===0?l.jsx("div",{className:"grid min-h-40 place-items-center","aria-live":"polite",children:l.jsx(uM,{icon:l.jsx(Ge,{className:"size-5 animate-spin"}),label:"Loading devices…"})}):e.devices.length===0?l.jsxs("div",{className:"rounded-md border border-dashed border-[var(--border)] px-5 py-10 text-center",children:[l.jsx(z_,{className:"mx-auto mb-3 size-6 text-[var(--muted-foreground)]"}),l.jsx("p",{className:"text-sm font-medium",children:"No Emulator is available"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Boot a simulator on this Runtime, or release one from another Session."})]}):l.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.devices.map(s=>l.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void i(s.id),className:"group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60",children:[l.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]",children:t===s.id?l.jsx(Ge,{className:"size-4 animate-spin"}):l.jsx(z_,{className:"size-4"})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium",children:s.name}),l.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[l.jsx(cM,{state:s.state}),l.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:s.backend})]})]})]},`${s.backend}:${s.id}`))})]})})})}function JW({sessionId:e,runtimeSelector:t,binding:r,controller:i}){const[s,o]=g.useState(null),[u,d]=g.useState(!1),[m,h]=g.useState(null),[v,p]=g.useState(null),x=g.useRef(null),y=g.useRef(null),w=g.useRef(null),C=g.useRef(null),E=g.useRef(null);g.useEffect(()=>{o(null),d(!1),p(null),h(null);let D=!1,W,G,q=0,B=0,j=!1,O=null,$,T="png";const U=()=>{G!==void 0&&window.clearTimeout(G),G=void 0,h(null)},H=(Y,X=!1)=>{if(G!==void 0&&window.clearTimeout(G),X||O===null){h(Y);return}G=window.setTimeout(()=>{G=void 0,D||h(Y)},XW)},F=Y=>{if(D)return;const X=URL.createObjectURL(Y),ee=O;O=X,o(X),U(),q=0,j=!1,ee&&window.setTimeout(()=>URL.revokeObjectURL(ee),1e3)},V=(Y,X=!1)=>{if(D)return;W!==void 0&&window.clearTimeout(W);const ee=X?0:Math.min(8e3,500*2**q++);W=window.setTimeout(()=>void Y(X),ee)},I=async(Y=!1)=>{const X=++B;try{const ee=await Wu(Y);if(D||X!==B)return;const re=new WebSocket(eq({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:ee}));$=re,re.binaryType="arraybuffer",re.onmessage=oe=>{if(D||X!==B||$!==re)return;if(typeof oe.data=="string"){try{const ne=JSON.parse(oe.data);if(ne.type!=="emulator.surface.ready"||typeof ne.surfaceId!="string"||ne.format!=="png"&&ne.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");T=ne.format,y.current={socket:re,surfaceId:ne.surfaceId,inputSequence:0}}catch{re.close(4400,"invalid Emulator Surface ready frame")}return}const Z=oe.data instanceof ArrayBuffer||oe.data instanceof Blob?oe.data:null,ce=T==="jpeg"?"image/jpeg":"image/png";Z instanceof Blob?F(new Blob([Z],{type:ce})):Z&&F(new Blob([Z],{type:ce}))},re.onclose=oe=>{var ce;if(D||X!==B||$!==re)return;((ce=y.current)==null?void 0:ce.socket)===re&&(y.current=null);const Z=new Error(oe.code===4406?"emulator_surface_upgrade_required":oe.reason||"Remote Emulator Surface disconnected");H(Z,oe.code===4406),oe.code!==4406&&((oe.code===4403||oe.code===1006)&&!j?(j=!0,V(I,!0)):V(I))},re.onerror=()=>{}}catch(ee){if(D||X!==B)return;H(ee instanceof Error?ee:new Error(String(ee))),V(I)}};return I(),()=>{D=!0,B+=1,y.current=null,$==null||$.close(1e3,"Session Emulator pane closed"),W!==void 0&&window.clearTimeout(W),G!==void 0&&window.clearTimeout(G),O&&URL.revokeObjectURL(O)}},[r.backend,r.bindingId,t,e]);const S=g.useCallback((D,W,G)=>{const q=y.current;if(!q||q.socket.readyState!==WebSocket.OPEN||G!==void 0&&q.surfaceId!==G)return!1;try{return q.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:q.surfaceId,inputSequence:q.inputSequence++,phase:D,...W})),!0}catch{return!1}},[]),N=g.useCallback(()=>{C.current!==null&&window.cancelAnimationFrame(C.current),C.current=null;const D=w.current;w.current=null,D&&S("move",D,D.surfaceId)},[S]),k=g.useCallback(D=>{const W=x.current;if(!W)return null;const G=W.getBoundingClientRect();return G.width<=0||G.height<=0?null:{x:Math.max(0,Math.min(1,(D.clientX-G.left)/G.width)),y:Math.max(0,Math.min(1,(D.clientY-G.top)/G.height))}},[]),R=D=>{var B;if(i.mutating)return;const W=k(D.nativeEvent);if(!W)return;D.currentTarget.setPointerCapture(D.pointerId);const G=((B=y.current)==null?void 0:B.surfaceId)??null,q=G!==null&&S("begin",W,G);E.current={pointerId:D.pointerId,startX:D.clientX,startY:D.clientY,lastPoint:W,points:[{type:"begin",...W}],live:q,surfaceId:q?G:null}},M=D=>{const W=E.current;if(!W||W.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);G&&W.live?(W.lastPoint=G,w.current=W.surfaceId?{...G,surfaceId:W.surfaceId}:null,C.current===null&&(C.current=window.requestAnimationFrame(()=>N()))):G&&W.points.length<KW-1&&(W.lastPoint=G,W.points.push({type:"move",...G}))},L=D=>{const W=E.current;if(E.current=null,!W||W.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);if(!G)return;if(W.live){N(),W.surfaceId&&S("end",G,W.surfaceId);return}(Math.hypot(D.clientX-W.startX,D.clientY-W.startY)>YW?i.gesture([...W.points,{type:"end",...G}]):i.tap(G.x,G.y)).catch(j=>_e.error(`Emulator input failed: ${j.message}`))},z=async()=>{try{await i.detach()}catch(D){_e.error(`Could not detach Emulator: ${D.message}`)}};return l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-[var(--background)]",children:[l.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate text-xs font-medium",children:r.deviceName??r.deviceId}),l.jsx(cM,{state:r.deviceState}),!r.available&&l.jsx(gt,{variant:"outline",children:"Unavailable"}),m&&s&&l.jsxs(gt,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[l.jsx(Ge,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(he,{variant:"ghost",size:"icon-sm",disabled:!r.available||i.mutating,title:"Home","aria-label":"Home",onClick:()=>void i.button("home").catch(D=>_e.error(`Home failed: ${D.message}`)),children:l.jsx(MR,{})}),l.jsxs(he,{variant:"ghost",size:"sm",disabled:i.mutating,title:"Detach from this session",onClick:()=>void z(),children:[i.mutating?l.jsx(Ge,{className:"animate-spin"}):l.jsx(e6,{}),"Detach"]})]})]}),l.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-3",children:[!u&&!m&&l.jsx("div",{className:"absolute inset-0 z-10 grid place-items-center bg-[var(--background)]",children:l.jsx(uM,{icon:l.jsx(Ge,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),m&&!s&&l.jsxs("div",{className:"max-w-sm text-center",children:[l.jsx(z_,{className:"mx-auto mb-3 size-7 text-[var(--muted-foreground)]"}),l.jsx("p",{className:"text-sm font-medium",children:t==="local"?"Preview is unavailable":"Remote Emulator Surface is unavailable"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:m.message==="emulator_surface_upgrade_required"?"Upgrade the selected Runtime daemon to a version with Emulator Surface support.":m.message})]}),s&&l.jsx("img",{ref:x,src:s,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:D=>{p({width:D.currentTarget.naturalWidth,height:D.currentTarget.naturalHeight}),d(!0)},onPointerDown:R,onPointerMove:M,onPointerUp:L,onPointerCancel:()=>{const D=E.current;E.current=null,D!=null&&D.live&&(N(),D.surfaceId&&S("end",D.lastPoint,D.surfaceId))},className:"max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]",style:v?{aspectRatio:`${v.width} / ${v.height}`}:void 0})]})]})}function eq(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({bindingId:e.bindingId,maximumFrameRate:String(e.maximumFrameRate),capability:e.capability});return`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/emulator/surface?${r.toString()}`}function cM({state:e}){return l.jsxs(gt,{variant:"outline",className:qe("gap-1 px-1.5 py-0 font-mono text-[8px] uppercase",e==="booted"&&"border-[var(--success)]/30 text-[var(--success)]",e==="shutdown"&&"text-[var(--muted-foreground)]"),children:[l.jsx("span",{className:qe("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function uM({icon:e,label:t}){return l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 text-[var(--muted-foreground)]",children:[e,l.jsx("span",{className:"text-xs",children:t})]})}const dM="rynx.control.theme";function tq(){const e=localStorage.getItem(dM);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ly(){const[e,t]=g.useState(tq);return g.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(dM,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
544
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
545
+ * @license MIT
546
+ *
547
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
548
+ * @license MIT
549
+ *
550
+ * Originally forked from (with the author's permission):
551
+ * Fabrice Bellard's javascript vt100 for jslinux:
552
+ * http://bellard.org/jslinux/
553
+ * Copyright (c) 2011 Fabrice Bellard
554
+ */var rq=2,iq=1,nq=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._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 t=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),u={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=u.top+u.bottom,m=u.right+u.left,h=i-d,v=s-m-t;return{cols:Math.max(rq,Math.floor(v/e.css.cell.width)),rows:Math.max(iq,Math.floor(h/e.css.cell.height))}}};/**
555
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
556
+ * @license MIT
557
+ *
558
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
559
+ * @license MIT
560
+ *
561
+ * Originally forked from (with the author's permission):
562
+ * Fabrice Bellard's javascript vt100 for jslinux:
563
+ * http://bellard.org/jslinux/
564
+ * Copyright (c) 2011 Fabrice Bellard
565
+ */var sq=class{constructor(t,r,i,s={}){this._terminal=t,this._regex=r,this._handler=i,this._options=s}provideLinks(t,r){let i=oq.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(i,s)=>{if(this._options.hover){let{range:o}=r;this._options.hover(i,s,o)}},r))}};function aq(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var oq=class mf{static computeLink(t,r,i,s){let o=new RegExp(r.source,(r.flags||"")+"g"),[u,d]=mf._getWindowedLineStrings(t-1,i),m=u.join(""),h,v=[];for(;h=o.exec(m);){let p=h[0];if(!aq(p))continue;let[x,y]=mf._mapStrIdx(i,d,0,h.index),[w,C]=mf._mapStrIdx(i,x,y,p.length);if(x===-1||y===-1||w===-1||C===-1)continue;let E={start:{x:y+1,y:x+1},end:{x:C,y:w+1}};v.push({range:E,text:p,activate:s})}return v}static _getWindowedLineStrings(t,r){let i,s=t,o=t,u=0,d="",m=[];if(i=r.buffer.active.getLine(t)){let h=i.translateToString(!0);if(i.isWrapped&&h[0]!==" "){for(u=0;(i=r.buffer.active.getLine(--s))&&u<2048&&(d=i.translateToString(!0),u+=d.length,m.push(d),!(!i.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(h),u=0;(i=r.buffer.active.getLine(++o))&&i.isWrapped&&u<2048&&(d=i.translateToString(!0),u+=d.length,m.push(d),d.indexOf(" ")===-1););}return[m,s]}static _mapStrIdx(t,r,i,s){let o=t.buffer.active,u=o.getNullCell(),d=i;for(;s;){let m=o.getLine(r);if(!m)return[-1,-1];for(let h=d;h<m.length;++h){m.getCell(h,u);let v=u.getChars();if(u.getWidth()&&(s-=v.length||1,h===m.length-1&&v==="")){let p=o.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,u),u.getWidth()===2&&(s+=1))}if(s<0)return[r,h]}r++,d=0}return[r,d]}},lq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function cq(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var uq=class{constructor(t=cq,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,i=r.urlRegex||lq;this._linkProvider=this._terminal.registerLinkProvider(new sq(this._terminal,i,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
566
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
567
+ * @license MIT
568
+ *
569
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
570
+ * @license MIT
571
+ *
572
+ * Originally forked from (with the author's permission):
573
+ * Fabrice Bellard's javascript vt100 for jslinux:
574
+ * http://bellard.org/jslinux/
575
+ * Copyright (c) 2011 Fabrice Bellard
576
+ */var dq=(e,t,r,i)=>{for(var s=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=u(s)||s);return s},hq=(e,t)=>(r,i)=>t(r,i,e),fq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?p5.isErrorNoTelemetry(e)?new p5(e.message+`
577
+
578
+ `+e.stack):new Error(e.message+`
579
+
580
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},mq=new fq;function c_(e){pq(e)||mq.onUnexpectedError(e)}var k0="Canceled";function pq(e){return e instanceof gq?!0:e instanceof Error&&e.name===k0&&e.message===k0}var gq=class extends Error{constructor(){super(k0),this.name=this.message}},p5=class N0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof N0)return t;let r=new N0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},vq;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vq||(vq={}));function _q(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var hM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(R){yield R}e.single=s;function o(R){return t(R)?R:s(R)}e.wrap=o;function u(R){return R||r}e.from=u;function*d(R){for(let M=R.length-1;M>=0;M--)yield R[M]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,M){let L=0;for(let z of R)if(M(z,L++))return!0;return!1}e.some=v;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*x(R,M){for(let L of R)M(L)&&(yield L)}e.filter=x;function*y(R,M){let L=0;for(let z of R)yield M(z,L++)}e.map=y;function*w(R,M){let L=0;for(let z of R)yield*M(z,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let z=L;for(let D of R)z=M(z,D);return z}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let z=R[Symbol.iterator]();for(let D=0;D<M;D++){let W=z.next();if(W.done)return[L,e.empty()];L.push(W.value)}return[L,{[Symbol.iterator](){return z}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(hM||(hM={}));function fM(e){if(hM.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function mM(...e){return Vr(()=>fM(e))}function Vr(e){return{dispose:_q(()=>{e()})}}var pM=class gM{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?gM.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};pM.DISABLE_DISPOSED_WARNING=!1;var Gl=pM,bn=class{constructor(){this._store=new Gl,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};bn.None=Object.freeze({dispose(){}});var cu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Oy=typeof process<"u"&&"title"in process,Lm=Oy?"node":navigator.userAgent,xq=Oy?"node":navigator.platform,yq=Lm.includes("Firefox"),bq=Lm.includes("Edge"),vM=/^((?!chrome|android).)*safari/i.test(Lm);function wq(){if(!vM)return 0;let e=Lm.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}xq.indexOf("Linux")>=0;var Sq="",wr=0,Sr=0,Cr=0,Yt=0,Fi={css:"#00000000",rgba:0},Qr;(e=>{function t(s,o,u,d){return d!==void 0?`#${ho(s)}${ho(o)}${ho(u)}${ho(d)}`:`#${ho(s)}${ho(o)}${ho(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(Qr||(Qr={}));var Ru;(e=>{function t(m,h){if(Yt=(h.rgba&255)/255,Yt===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,p=h.rgba>>16&255,x=h.rgba>>8&255,y=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;wr=y+Math.round((v-y)*Yt),Sr=w+Math.round((p-w)*Yt),Cr=C+Math.round((x-C)*Yt);let E=Qr.toCss(wr,Sr,Cr),S=Qr.toRgba(wr,Sr,Cr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,v){let p=wo.ensureContrastRatio(m.rgba,h.rgba,v);if(p)return Qr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[wr,Sr,Cr]=wo.toChannels(h),{css:Qr.toCss(wr,Sr,Cr),rgba:h}}e.opaque=s;function o(m,h){return Yt=Math.round(h*255),[wr,Sr,Cr]=wo.toChannels(m.rgba),{css:Qr.toCss(wr,Sr,Cr,Yt),rgba:Qr.toRgba(wr,Sr,Cr,Yt)}}e.opacity=o;function u(m,h){return Yt=m.rgba&255,o(m,Yt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Ru||(Ru={}));var Cq;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return wr=parseInt(s.slice(1,2).repeat(2),16),Sr=parseInt(s.slice(2,3).repeat(2),16),Cr=parseInt(s.slice(3,4).repeat(2),16),Qr.toColor(wr,Sr,Cr);case 5:return wr=parseInt(s.slice(1,2).repeat(2),16),Sr=parseInt(s.slice(2,3).repeat(2),16),Cr=parseInt(s.slice(3,4).repeat(2),16),Yt=parseInt(s.slice(4,5).repeat(2),16),Qr.toColor(wr,Sr,Cr,Yt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return wr=parseInt(o[1]),Sr=parseInt(o[2]),Cr=parseInt(o[3]),Yt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Qr.toColor(wr,Sr,Cr,Yt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[wr,Sr,Cr,Yt]=t.getImageData(0,0,1,1).data,Yt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qr.toRgba(wr,Sr,Cr,Yt),css:s}}e.toColor=i})(Cq||(Cq={}));var Xr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let u=i/255,d=s/255,m=o/255,h=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(Xr||(Xr={}));var wo;(e=>{function t(u,d){if(Yt=(d&255)/255,Yt===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,y=u>>8&255;return wr=p+Math.round((m-p)*Yt),Sr=x+Math.round((h-x)*Yt),Cr=y+Math.round((v-y)*Yt),Qr.toRgba(wr,Sr,Cr)}e.blend=t;function r(u,d,m){let h=Xr.relativeLuminance(u>>8),v=Xr.relativeLuminance(d>>8);if(Es(h,v)<m){if(v<h){let y=i(u,d,m),w=Es(h,Xr.relativeLuminance(y>>8));if(w<m){let C=s(u,d,m),E=Es(h,Xr.relativeLuminance(C>>8));return w>E?y:C}return y}let p=s(u,d,m),x=Es(h,Xr.relativeLuminance(p>>8));if(x<m){let y=i(u,d,m),w=Es(h,Xr.relativeLuminance(y>>8));return x>w?p:y}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,C=Es(Xr.relativeLuminance2(x,y,w),Xr.relativeLuminance2(h,v,p));for(;C<m&&(x>0||y>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Es(Xr.relativeLuminance2(x,y,w),Xr.relativeLuminance2(h,v,p));return(x<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,C=Es(Xr.relativeLuminance2(x,y,w),Xr.relativeLuminance2(h,v,p));for(;C<m&&(x<255||y<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Es(Xr.relativeLuminance2(x,y,w),Xr.relativeLuminance2(h,v,p));return(x<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(wo||(wo={}));function ho(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Es(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function or(e){if(!e)throw new Error("value must not be falsy");return e}function By(e){return 57508<=e&&e<=57558}function Eq(e){return 57520<=e&&e<=57527}function Rq(e){return 57344<=e&&e<=63743}function kq(e){return 9472<=e&&e<=9631}function Nq(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Aq(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Nq(e)&&!By(e)&&!Rq(e)}function _M(e){return By(e)||kq(e)}function Tq(){return{css:{canvas:Yh(),cell:Yh()},device:{canvas:Yh(),cell:Yh(),char:{width:0,height:0,left:0,top:0}}}}function Yh(){return{width:0,height:0}}function Mq(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Or=0,yr=0,zn=!1,Rs=!1,Kh=!1,hi,u_=0,jq=class{constructor(e,t,r,i,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,yr=0,Or=0,Rs=!1,zn=!1,Kh=!1,hi=this._themeService.colors,u_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));u_=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Or=s.foregroundColorRGB.rgba>>8&16777215,zn=!0)}),Kh=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Kh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yr=(this.result.fg&16777215)<<8|255;break;case 0:default:yr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yr=(this.result.bg&16777215)<<8|255;break}yr=wo.blend(yr,(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else yr=(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Rs=!0,hi.selectionForeground&&(Or=hi.selectionForeground.rgba>>8&16777215,zn=!0),_M(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Or=(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Or=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Or=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Or=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Or=(this.result.fg&16777215)<<8|255;break;case 0:default:Or=this._themeService.colors.foreground.rgba}Or=wo.blend(Or,(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}zn=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Or=s.foregroundColorRGB.rgba>>8&16777215,zn=!0)}),Rs&&(Kh?yr=e.bg&-16777216&-134217729|yr|50331648:yr=e.bg&-16777216|yr|50331648),zn&&(Or=e.fg&-16777216&-67108865|Or|50331648),this.result.fg&67108864&&(Rs&&!zn&&((this.result.bg&50331648)===0?Or=this.result.fg&-134217728|hi.background.rgba>>8&16777215&16777215|50331648:Or=this.result.fg&-134217728|this.result.bg&67108863,zn=!0),!Rs&&zn&&((this.result.fg&50331648)===0?yr=this.result.bg&-67108864|hi.foreground.rgba>>8&16777215&16777215|50331648:yr=this.result.bg&-67108864|this.result.fg&67108863,Rs=!0)),hi=void 0,this.result.bg=Rs?yr:this.result.bg,this.result.fg=zn?Or:this.result.fg,this.result.ext&=536870911,this.result.ext|=u_<<29&3758096384}},Dq=.5,xM=yq||bq?"bottom":"ideographic",Lq={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Oq={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Bq={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Yu={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Yu[""]=Yu[""];Yu[""]=Yu[""];function Pq(e,t,r,i,s,o,u,d){let m=Lq[t];if(m)return Iq(e,m,r,i,s,o),!0;let h=Oq[t];if(h)return zq(e,h,r,i,s,o),!0;let v=Bq[t];if(v)return $q(e,v,r,i,s,o,d),!0;let p=Yu[t];return p?(Uq(e,p,r,i,s,o,u,d),!0):!1}function Iq(e,t,r,i,s,o){for(let u=0;u<t.length;u++){let d=t[u],m=s/8,h=o/8;e.fillRect(r+d.x*m,i+d.y*h,d.w*m,d.h*h)}}var g5=new Map;function zq(e,t,r,i,s,o){let u=g5.get(t);u||(u=new Map,g5.set(t,u));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let m=u.get(d);if(!m){let h=t[0].length,v=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=h,p.height=v;let x=or(p.getContext("2d")),y=new ImageData(h,v),w,C,E,S;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),C=parseInt(d.slice(3,5),16),E=parseInt(d.slice(5,7),16),S=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,C,E,S]=d.substring(5,d.length-1).split(",").map(N=>parseFloat(N));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let N=0;N<v;N++)for(let k=0;k<h;k++)y.data[(N*h+k)*4]=w,y.data[(N*h+k)*4+1]=C,y.data[(N*h+k)*4+2]=E,y.data[(N*h+k)*4+3]=t[N][k]*(S*255);x.putImageData(y,0,0),m=or(e.createPattern(p,null)),u.set(d,m)}e.fillStyle=m,e.fillRect(r,i,s,o)}function $q(e,t,r,i,s,o,u){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(d);let h;if(typeof m=="function"){let v=.15/o*s;h=m(.15,v)}else h=m;for(let v of h.split(" ")){let p=v[0],x=yM[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let y=v.substring(1).split(",");!y[0]||!y[1]||x(e,bM(y,s,o,r,i,!0,u))}e.stroke(),e.closePath()}}function Uq(e,t,r,i,s,o,u,d){let m=new Path2D;m.rect(r,i,s,o),e.clip(m),e.beginPath();let h=u/12;e.lineWidth=d*h;for(let v of t.d.split(" ")){let p=v[0],x=yM[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let y=v.substring(1).split(",");!y[0]||!y[1]||x(e,bM(y,s,o,r,i,!1,d,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function v5(e,t,r=0){return Math.max(Math.min(e,t),r)}var yM={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function bM(e,t,r,i,s,o,u,d=0,m=0){let h=e.map(v=>parseFloat(v)||parseInt(v));if(h.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<h.length;v+=2)h[v]*=t-d*u-m*u,o&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,t,0)),h[v]+=i+d*u;for(let v=1;v<h.length;v+=2)h[v]*=r,o&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,r,0)),h[v]+=s;return h}var _5=class{constructor(){this._data={}}set(t,r,i){this._data[t]||(this._data[t]={}),this._data[t][r]=i}get(t,r){return this._data[t]?this._data[t][r]:void 0}clear(){this._data={}}},x5=class{constructor(){this._data=new _5}set(e,t,r,i,s){this._data.get(e,t)||this._data.set(e,t,new _5),this._data.get(e,t).set(r,i,s)}get(e,t,r,i){var s;return(s=this._data.get(e,t))==null?void 0:s.get(r,i)}clear(){this._data.clear()}},wM=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},Hq=class extends wM{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},Fq=class extends wM{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Wq=!Oy&&"requestIdleCallback"in window?Fq:Hq,Ul=class SM{constructor(){this.fg=0,this.bg=0,this.extended=new CM}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new SM;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},CM=class EM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new EM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qq=globalThis.performance&&typeof globalThis.performance.now=="function",Vq=class RM{static create(t){return new RM(t)}constructor(t){this._now=qq&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ms;(e=>{e.None=()=>bn.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,$)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,$),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h(($,T=null,U)=>B(H=>$.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h(($,T=null,U)=>B(H=>{j(H),$.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h(($,T=null,U)=>B(H=>j(H)&&$.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,$)=>{let T=mM(...B.map(U=>U(H=>j.call(O,H))));return v(T,$)}}e.any=d;function m(B,j,O,$){let T=O;return i(B,U=>(T=j(T,U),T),$)}e.reduce=m;function h(B,j){let O,$={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new Lt($);return j==null||j.add(T),T.event}function v(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,$=!1,T=!1,U,H){let F,V,I,Y=0,X,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(oe=>{Y++,V=j(V,oe),$&&!I&&(re.fire(V),V=void 0),X=()=>{let Z=V;V=void 0,I=void 0,(!$||Y>1)&&re.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(X,O)):I===void 0&&(I=0,queueMicrotask(X))})},onWillRemoveListener(){T&&Y>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,F.dispose()}},re=new Lt(ee);return H==null||H.add(re),re.event}e.debounce=p;function x(B,j=0,O){return e.debounce(B,($,T)=>$?($.push(T),$):[T],j,void 0,!0,void 0,O)}e.accumulate=x;function y(B,j=($,T)=>$===T,O){let $=!0,T;return o(B,U=>{let H=$||!j(U,T);return $=!1,T=U,H},O)}e.latch=y;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,$=>!j($),O)]}e.split=w;function C(B,j=!1,O=[],$){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});$&&$.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new Lt({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),$&&$.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return $&&$.add(F),F.event}e.buffer=C;function E(B,j){return(O,$,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call($,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let $=O;return this.steps.push(T=>($=j($,T),$)),this}latch(j=(O,$)=>O===$){let O=!0,$;return this.steps.push(T=>{let U=O||!j(T,$);return O=!1,$=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.on(j,$),U=()=>B.removeListener(j,$),H=new Lt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,$),U=()=>B.removeEventListener(j,$),H=new Lt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new Lt;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function z(B,j){return B(O=>j.fire(O))}e.forward=z;function D(B,j,O){return j(O),B($=>j($))}e.runAndSubscribe=D;class W{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new Lt($),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new W(B,j).emitter.event}e.fromObservable=G;function q(B){return(j,O,$)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return $ instanceof Gl?$.add(F):Array.isArray($)&&$.push(F),F}}e.fromObservableLight=q})(Ms||(Ms={}));var A0=class T0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${T0._idPool++}`,T0.all.add(this)}start(t){this._stopWatch=new Vq,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};A0.all=new Set,A0._idPool=0;var Gq=A0,Yq=-1,kM=class NM{constructor(t,r,i=(NM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let m=new Zq(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};kM._idPool=1;var Kq=kM,Xq=class AM{constructor(t){this.value=t}static create(){let t=new Error;return new AM(t.stack??"")}print(){console.warn(this.value.split(`
581
+ `).slice(2).join(`
582
+ `))}},Zq=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},Qq=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},Jq=0,d_=class{constructor(e){this.value=e,this.id=Jq++}},eV=2,tV,Lt=class{constructor(t){var r,i,s,o;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new Kq((t==null?void 0:t.onListenerError)??c_,((i=this._options)==null?void 0:i.leakWarningThreshold)??Yq):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Gq(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,r,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var d,m,h,v,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let x=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(x);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new Qq(`${x}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((d=this._options)==null?void 0:d.onListenerError)||c_)(w),bn.None}if(this._disposed)return bn.None;r&&(t=t.bind(r));let s=new d_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Xq.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof d_?(this._deliveryQueue??(this._deliveryQueue=new rV),this._listeners=[this._listeners,s]):this._listeners.push(s):((h=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||h.call(m,this),this._listeners=s,(p=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||p.call(v,this)),this._size++;let u=Vr(()=>{o==null||o(),this._removeListener(s)});return i instanceof Gl?i.add(u):Array.isArray(i)&&i.push(u),u}),this._event}_removeListener(t){var o,u,d,m;if((u=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||u.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(m=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*eV<=r.length){let h=0;for(let v=0;v<r.length;v++)r[v]?r[h++]=r[v]:s&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=h}}_deliver(t,r){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||c_;if(!i){t.value(r);return}try{t.value(r)}catch(o){i(o)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,s,o;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof d_)this._deliver(this._listeners,t);else{let u=this._deliveryQueue;u.enqueue(this,t,this._listeners.length),this._deliverQueue(u)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},rV=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},y5={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},uu=2,du,ya=class $l{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new x5,this._cacheMapCombined=new x5,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ul,this._textureSize=512,this._onAddTextureAtlasCanvas=new Lt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Lt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=TM(t,this._config.deviceCellWidth*4+uu*2,this._config.deviceCellHeight+uu*2),this._tmpCtx=or(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Wq;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if($l.maxAtlasPages&&this._pages.length>=Math.max(4,$l.maxAtlasPages)){let r=this._pages.filter(h=>h.canvas.width*2<=($l.maxTextureSize||4096)).sort((h,v)=>v.canvas.width!==h.canvas.width?v.canvas.width-h.canvas.width:v.percentageUsed-h.percentageUsed),i=-1,s=0;for(let h=0;h<r.length;h++)if(r[h].canvas.width!==s)i=h,s=r[h].canvas.width;else if(h-i===3)break;let o=r.slice(i,i+4),u=o.map(h=>h.glyphs[0].texturePage).sort((h,v)=>h>v?1:-1),d=this.pages.length-o.length,m=this._mergePages(o,d);m.version++;for(let h=u.length-1;h>=0;h--)this._deletePage(u[h]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new h_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,s=new h_(this._document,i,t);for(let[o,u]of t.entries()){let d=o*u.canvas.width%i,m=Math.floor(o/2)*u.canvas.height;s.ctx.drawImage(u.canvas,d,m);for(let v of u.glyphs)v.texturePage=r,v.sizeClipSpace.x=v.size.x/i,v.sizeClipSpace.y=v.size.y/i,v.texturePosition.x+=d,v.texturePosition.y+=m,v.texturePositionClipSpace.x=v.texturePosition.x/i,v.texturePositionClipSpace.y=v.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let h=this._activePages.indexOf(u);h!==-1&&this._activePages.splice(h,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let s of i.glyphs)s.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,s,o,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,s,o,u)}getRasterizedGlyph(t,r,i,s,o,u){return this._getFromCacheMap(this._cacheMap,t,r,i,s,o,u)}_getFromCacheMap(t,r,i,s,o,u,d){return du=t.get(r,i,s,o),du||(du=this._drawToCache(r,i,s,o,u,d),t.set(r,i,s,o,du)),du}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,s){if(this._config.allowTransparency)return Fi;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(r);break;case 50331648:let u=Ul.toColorRGB(r);o=Qr.toColor(u[0],u[1],u[2]);break;case 0:default:i?o=Ru.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Ru.opaque(o)),o}_getForegroundColor(t,r,i,s,o,u,d,m,h,v){let p=this._getMinimumContrastColor(t,r,i,s,o,u,d,h,m,v);if(p)return p;let x;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&u<8&&(u+=8),x=this._getColorFromAnsiIndex(u);break;case 50331648:let y=Ul.toColorRGB(u);x=Qr.toColor(y[0],y[1],y[2]);break;case 0:default:d?x=this._config.colors.background:x=this._config.colors.foreground}return this._config.allowTransparency&&(x=Ru.opaque(x)),m&&(x=Ru.multiplyOpacity(x,Dq)),x}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,s,o,u,d,m,h,v){if(this._config.minimumContrastRatio===1||v)return;let p=this._getContrastCache(h),x=p.getColor(t,s);if(x!==void 0)return x||void 0;let y=this._resolveBackgroundRgba(r,i,d),w=this._resolveForegroundRgba(o,u,d,m),C=wo.ensureContrastRatio(y,w,this._config.minimumContrastRatio/(h?2:1));if(!C){p.setColor(t,s,null);return}let E=Qr.toColor(C>>24&255,C>>16&255,C>>8&255);return p.setColor(t,s,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,s,o,u){let d=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+uu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let h=Math.min(this._config.deviceCellHeight+uu*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return y5;let v=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),x=!!this._workAttributeData.isDim(),y=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),N=this._workAttributeData.getFgColorMode(),k=this._workAttributeData.getBgColor(),R=this._workAttributeData.getBgColorMode();if(p){let V=S;S=k,k=V;let I=N;N=R,R=I}let M=this._getBackgroundColor(R,k,p,x);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=v?this._config.fontWeightBold:this._config.fontWeight,z=y?"italic":"";this._tmpCtx.font=`${z} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=xM;let D=d.length===1&&By(d.charCodeAt(0)),W=d.length===1&&Eq(d.charCodeAt(0)),G=this._getForegroundColor(r,R,k,i,N,S,p,x,v,_M(d.charCodeAt(0)));this._tmpCtx.fillStyle=G.css;let q=W?0:uu*2,B=!1;this._config.customGlyphs!==!1&&(B=Pq(this._tmpCtx,d,q,q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let j=!D,O;if(typeof t=="number"?O=this._unicodeService.wcwidth(t):O=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;if(this._tmpCtx.lineWidth=V,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())j=!1,this._tmpCtx.strokeStyle=`rgb(${Ul.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{j=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let Y=q,X=Math.ceil(q+this._config.deviceCharHeight)-I-(o?V*2:0),ee=X+V,re=X+V*2,oe=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<O;Z++){this._tmpCtx.save();let ce=Y+Z*this._config.deviceCellWidth,ne=Y+(Z+1)*this._config.deviceCellWidth,we=ce+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X),this._tmpCtx.moveTo(ce,re),this._tmpCtx.lineTo(ne,re);break;case 3:let xe=V<=1?re:Math.ceil(q+this._config.deviceCharHeight-V/2)-I,ye=V<=1?X:Math.ceil(q+this._config.deviceCharHeight+V/2)-I,J=new Path2D;J.rect(ce,X,this._config.deviceCellWidth,re-X),this._tmpCtx.clip(J),this._tmpCtx.moveTo(ce-this._config.deviceCellWidth/2,ee),this._tmpCtx.bezierCurveTo(ce-this._config.deviceCellWidth/2,ye,ce,ye,ce,ee),this._tmpCtx.bezierCurveTo(ce,xe,we,xe,we,ee),this._tmpCtx.bezierCurveTo(we,ye,ne,ye,ne,ee),this._tmpCtx.bezierCurveTo(ne,xe,ne+this._config.deviceCellWidth/2,xe,ne+this._config.deviceCellWidth/2,ee);break;case 4:let ie=oe===0?0:oe>=V?V*2-oe:V-oe;oe>=V||ie===0?(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ce+ie,X),this._tmpCtx.lineTo(ne,X)):(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ce+ie,X),this._tmpCtx.moveTo(ce+ie+V,X),this._tmpCtx.lineTo(ne,X)),oe=Mq(ne-ce,V,oe);break;case 5:let Re=.6,ve=.3,Ae=ne-ce,Ie=Math.floor(Re*Ae),Oe=Math.floor(ve*Ae),ze=Ae-Ie-Oe;this._tmpCtx.setLineDash([Ie,Oe,ze]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X);break;case 1:default:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!B&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let ce=new Path2D;ce.rect(Y,X-Math.ceil(V/2),this._config.deviceCellWidth*O,re-X+Math.ceil(V/2)),this._tmpCtx.clip(ce),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(d,q,q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+I),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*O,q+I),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let V=f_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j);if(V)for(let I=1;I<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight-I),V=f_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j),!!V);I++);}if(C){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),I=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*O,q+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.stroke()}this._tmpCtx.restore();let $=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=iV($):T=f_($,M,G,j),T)return y5;let U=this._findGlyphBoundingBox($,this._workBoundingBox,m,W,B,q),H,F;for(;;){if(this._activePages.length===0){let V=this._createNewPage();H=V,F=V.currentRow,F.height=U.size.y;break}H=this._activePages[this._activePages.length-1],F=H.currentRow;for(let V of this._activePages)U.size.y<=V.currentRow.height&&(H=V,F=V.currentRow);for(let V=this._activePages.length-1;V>=0;V--)for(let I of this._activePages[V].fixedRows)I.height<=F.height&&U.size.y<=I.height&&(H=this._activePages[V],F=I);if(U.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new h_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),H=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+U.size.x>=H.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+U.size.y>=H.canvas.height||F.height>U.size.y+2){let V=!1;if(H.currentRow.y+H.currentRow.height+U.size.y>=H.canvas.height){let I;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+U.size.y<Y.canvas.height){I=Y;break}if(I)H=I;else if($l.maxAtlasPages&&this._pages.length>=$l.maxAtlasPages&&F.y+U.size.y<=H.canvas.height&&F.height>=U.size.y&&F.x+U.size.x<=H.canvas.width)V=!0;else{let Y=this._createNewPage();H=Y,F=Y.currentRow,F.height=U.size.y,V=!0}}V||(H.currentRow.height>0&&H.fixedRows.push(H.currentRow),F={x:0,y:H.currentRow.y+H.currentRow.height,height:U.size.y},H.fixedRows.push(F),H.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+U.size.x<=H.canvas.width)break;F===H.currentRow?(F.x=0,F.y+=F.height,F.height=0):H.fixedRows.splice(H.fixedRows.indexOf(F),1)}return U.texturePage=this._pages.indexOf(H),U.texturePosition.x=F.x,U.texturePosition.y=F.y,U.texturePositionClipSpace.x=F.x/H.canvas.width,U.texturePositionClipSpace.y=F.y/H.canvas.height,U.sizeClipSpace.x/=H.canvas.width,U.sizeClipSpace.y/=H.canvas.height,F.height=Math.max(F.height,U.size.y),F.x+=U.size.x,H.ctx.putImageData($,U.texturePosition.x-this._workBoundingBox.left,U.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,U.size.x,U.size.y),H.addGlyph(U),H.version++,U}_findGlyphBoundingBox(t,r,i,s,o,u){r.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,m=s?this._config.deviceCellWidth:i,h=!1;for(let v=0;v<d;v++){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.top=v,h=!0;break}}if(h)break}r.left=0,h=!1;for(let v=0;v<u+m;v++){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.left=v,h=!0;break}}if(h)break}r.right=m,h=!1;for(let v=u+m-1;v>=u;v--){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.right=v,h=!0;break}}if(h)break}r.bottom=d,h=!1;for(let v=d-1;v>=0;v--){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.bottom=v,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+u+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},h_=class{constructor(t,r,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=TM(t,r,r),this.ctx=or(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function f_(e,t,r,i){let s=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,h=r.rgba>>>8&255,v=Math.floor((Math.abs(s-d)+Math.abs(o-m)+Math.abs(u-h))/12),p=!0;for(let x=0;x<e.data.length;x+=4)e.data[x]===s&&e.data[x+1]===o&&e.data[x+2]===u||i&&Math.abs(e.data[x]-s)+Math.abs(e.data[x+1]-o)+Math.abs(e.data[x+2]-u)<v?e.data[x+3]=0:p=!1;return p}function iV(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function TM(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function nV(e,t,r,i,s,o,u,d){let m={foreground:o.foreground,background:o.background,cursor:Fi,cursorAccent:Fi,selectionForeground:Fi,selectionBackgroundTransparent:Fi,selectionBackgroundOpaque:Fi,selectionInactiveBackgroundTransparent:Fi,selectionInactiveBackgroundOpaque:Fi,overviewRulerBorder:Fi,scrollbarSliderBackground:Fi,scrollbarSliderHoverBackground:Fi,scrollbarSliderActiveBackground:Fi,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:m}}function b5(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function sV(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Gi=[];function MM(e,t,r,i,s,o,u,d,m){let h=nV(i,s,o,u,t,r,d,m);for(let x=0;x<Gi.length;x++){let y=Gi[x],w=y.ownedBy.indexOf(e);if(w>=0){if(b5(y.config,h))return y.atlas;y.ownedBy.length===1?(y.atlas.dispose(),Gi.splice(x,1)):y.ownedBy.splice(w,1);break}}for(let x=0;x<Gi.length;x++){let y=Gi[x];if(b5(y.config,h))return y.ownedBy.push(e),y.atlas}let v=e._core,p={atlas:new ya(document,h,v.unicodeService),config:h,ownedBy:[e]};return Gi.push(p),p.atlas}function w5(e){for(let t=0;t<Gi.length;t++){let r=Gi[t].ownedBy.indexOf(e);if(r!==-1){Gi[t].ownedBy.length===1?(Gi[t].atlas.dispose(),Gi.splice(t,1)):Gi[t].ownedBy.splice(r,1);break}}}var Xh=600,aV=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Xh){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Xh-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Xh-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Xh)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function S5(e,t,r){let i=new t.ResizeObserver(s=>{let o=s.find(m=>m.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i==null||i.disconnect(),i=void 0;return}let u=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;u>0&&d>0&&r(u,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Vr(()=>i==null?void 0:i.disconnect())}function oV(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var C5=class jM extends Ul{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new CM,this.combinedData=""}static fromCharData(t){let r=new jM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?oV(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},DM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function LM(e,t,r){let i=or(e.createProgram());if(e.attachShader(i,or(E5(e,e.VERTEX_SHADER,t))),e.attachShader(i,or(E5(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function E5(e,t,r){let i=or(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function lV(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let s=0;s<e.length;s++)i[s]=e[s];return i}var cV=class{constructor(t){this.texture=t,this.version=-1}},uV=`#version 300 es
583
+ layout (location = 0) in vec2 a_unitquad;
584
+ layout (location = 1) in vec2 a_cellpos;
585
+ layout (location = 2) in vec2 a_offset;
586
+ layout (location = 3) in vec2 a_size;
587
+ layout (location = 4) in float a_texpage;
588
+ layout (location = 5) in vec2 a_texcoord;
589
+ layout (location = 6) in vec2 a_texsize;
590
+
591
+ uniform mat4 u_projection;
592
+ uniform vec2 u_resolution;
593
+
594
+ out vec2 v_texcoord;
595
+ flat out int v_texpage;
596
+
597
+ void main() {
598
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
599
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
600
+ v_texpage = int(a_texpage);
601
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
602
+ }`;function dV(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
603
+ precision lowp float;
604
+
605
+ in vec2 v_texcoord;
606
+ flat in int v_texpage;
607
+
608
+ uniform sampler2D u_texture[${e}];
609
+
610
+ out vec4 outColor;
611
+
612
+ void main() {
613
+ if (v_texpage == 0) {
614
+ outColor = texture(u_texture[0], v_texcoord);
615
+ } ${t}
616
+ }`}var ba=11,Dl=ba*Float32Array.BYTES_PER_ELEMENT,hV=2,Gt=0,jt,m_=0,hu=0,fV=class extends bn{constructor(t,r,i,s){super(),this._terminal=t,this._gl=r,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;ya.maxAtlasPages===void 0&&(ya.maxAtlasPages=Math.min(32,or(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ya.maxTextureSize=or(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=or(LM(o,uV,dV(ya.maxAtlasPages))),this._register(Vr(()=>o.deleteProgram(this._program))),this._projectionLocation=or(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=or(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=or(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(Vr(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let m=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Vr(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,m,o.STATIC_DRAW),this._attributesBuffer=or(o.createBuffer()),this._register(Vr(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Dl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Dl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Dl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Dl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Dl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Dl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let v=new Int32Array(ya.maxAtlasPages);for(let p=0;p<ya.maxAtlasPages;p++)v[p]=p;o.uniform1iv(this._textureLocation,v),o.uniformMatrix4fv(this._projectionLocation,!1,DM),this._atlasTextures=[];for(let p=0;p<ya.maxAtlasPages;p++){let x=new cV(or(o.createTexture()));this._register(Vr(()=>o.deleteTexture(x.texture))),o.activeTexture(o.TEXTURE0+p),o.bindTexture(o.TEXTURE_2D,x.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[p]=x}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,i,s,o,u,d,m,h){this._updateCell(this._vertices.attributes,t,r,i,s,o,u,d,m,h)}_updateCell(t,r,i,s,o,u,d,m,h,v){if(Gt=(i*this._terminal.cols+r)*ba,s===0||s===void 0){t.fill(0,Gt,Gt+ba-1-hV);return}this._atlas&&(m&&m.length>1?jt=this._atlas.getRasterizedGlyphCombinedChar(m,o,u,d,!1,this._terminal.element):jt=this._atlas.getRasterizedGlyph(s,o,u,d,!1,this._terminal.element),m_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==v&&jt.offset.x>m_?(hu=jt.offset.x-m_,t[Gt]=-(jt.offset.x-hu)+this._dimensions.device.char.left,t[Gt+1]=-jt.offset.y+this._dimensions.device.char.top,t[Gt+2]=(jt.size.x-hu)/this._dimensions.device.canvas.width,t[Gt+3]=jt.size.y/this._dimensions.device.canvas.height,t[Gt+4]=jt.texturePage,t[Gt+5]=jt.texturePositionClipSpace.x+hu/this._atlas.pages[jt.texturePage].canvas.width,t[Gt+6]=jt.texturePositionClipSpace.y,t[Gt+7]=jt.sizeClipSpace.x-hu/this._atlas.pages[jt.texturePage].canvas.width,t[Gt+8]=jt.sizeClipSpace.y):(t[Gt]=-jt.offset.x+this._dimensions.device.char.left,t[Gt+1]=-jt.offset.y+this._dimensions.device.char.top,t[Gt+2]=jt.size.x/this._dimensions.device.canvas.width,t[Gt+3]=jt.size.y/this._dimensions.device.canvas.height,t[Gt+4]=jt.texturePage,t[Gt+5]=jt.texturePositionClipSpace.x,t[Gt+6]=jt.texturePositionClipSpace.y,t[Gt+7]=jt.sizeClipSpace.x,t[Gt+8]=jt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Aq(s,h,jt.size.x,this._dimensions.device.cell.width)&&(t[Gt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*ba;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==r?this._vertices.attributesBuffers[i]=new Float32Array(r):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=r,i=0;for(let s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=ba}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*ba,d=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*ba);i.set(d,s),s+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,i.subarray(0,s),r.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(r,this._atlas,o);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,s/ba)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=r.pages[i].version}setDimensions(t){this._dimensions=t}},mV=class{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(t,r,i,s=!1){if(this.selectionStart=r,this.selectionEnd=i,!r||!i||r[0]===i[0]&&r[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,u=r[1]-o,d=i[1]-o,m=Math.max(u,0),h=Math.min(d,t.rows-1);if(m>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=u,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=h,this.startCol=r[0],this.endCol=i[0]}isCellSelected(t,r,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&i>=this.viewportCappedStartRow&&r<this.endCol&&i<=this.viewportCappedEndRow:r<this.startCol&&i>=this.viewportCappedStartRow&&r>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol):!1}};function pV(){return new mV}var Wf=4,pf=1,gf=2,p_=3,gV=2147483648,vV=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=pV()}resize(t,r){let i=t*r*Wf;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},_V=`#version 300 es
617
+ layout (location = 0) in vec2 a_position;
618
+ layout (location = 1) in vec2 a_size;
619
+ layout (location = 2) in vec4 a_color;
620
+ layout (location = 3) in vec2 a_unitquad;
621
+
622
+ uniform mat4 u_projection;
623
+
624
+ out vec4 v_color;
625
+
626
+ void main() {
627
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
628
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
629
+ v_color = a_color;
630
+ }`,xV=`#version 300 es
631
+ precision lowp float;
632
+
633
+ in vec4 v_color;
634
+
635
+ out vec4 outColor;
636
+
637
+ void main() {
638
+ outColor = v_color;
639
+ }`,As=8,g_=As*Float32Array.BYTES_PER_ELEMENT,yV=20*As,R5=class{constructor(){this.attributes=new Float32Array(yV),this.count=0}},ks=0,k5=0,N5=0,A5=0,T5=0,M5=0,j5=0,bV=class extends bn{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new R5,this._verticesCursor=new R5;let s=this._gl;this._program=or(LM(s,_V,xV)),this._register(Vr(()=>s.deleteProgram(this._program))),this._projectionLocation=or(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=s.createBuffer();this._register(Vr(()=>s.deleteBuffer(u))),s.bindBuffer(s.ARRAY_BUFFER,u),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=s.createBuffer();this._register(Vr(()=>s.deleteBuffer(m))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=or(s.createBuffer()),this._register(Vr(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,g_,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,g_,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,g_,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,DM),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,i=1,s,o,u,d,m,h,v,p,x,y,w;for(s=0;s<t.rows;s++){for(u=-1,d=0,m=0,h=!1,o=0;o<t.cols;o++)v=(s*t.cols+o)*Wf,p=e.cells[v+pf],x=e.cells[v+gf],y=!!(x&67108864),(p!==d||x!==m&&(h||y))&&((d!==0||h&&m!==0)&&(w=i++*As,this._updateRectangle(r,w,m,d,u,o,s)),u=o,d=p,m=x,h=y);(d!==0||h&&m!==0)&&(w=i++*As,this._updateRectangle(r,w,m,d,u,t.cols,s))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,s=0;(r.style==="bar"||r.style==="outline")&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=s++*As,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,r,i,s,o,u){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:ks=(r&16777215)<<8;break;case 0:default:ks=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ks=(i&16777215)<<8;break;case 0:default:ks=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=lV(e.attributes,this._terminal.rows*this._terminal.cols*As)),k5=s*this._dimensions.device.cell.width,N5=u*this._dimensions.device.cell.height,A5=(ks>>24&255)/255,T5=(ks>>16&255)/255,M5=(ks>>8&255)/255,j5=1,this._addRectangle(e.attributes,t,k5,N5,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,A5,T5,M5,j5)}_addRectangle(e,t,r,i,s,o,u,d,m,h){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u,e[t+5]=d,e[t+6]=m,e[t+7]=h}_addRectangleFloat(e,t,r,i,s,o,u){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},wV=class extends bn{constructor(t,r,i,s,o,u,d,m){super(),this._container=r,this._alpha=o,this._coreBrowserService=u,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(Vr(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=or(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,i){}handleSelectionChanged(t,r,i,s=!1){}_setTransparency(t,r){if(r===this._alpha)return;let i=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=MM(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,r,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,r,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=xM,this._clipCell(i,s,r.getWidth()),this._ctx.fillText(r.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,i){let s=r?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},SV=class extends wV{constructor(t,r,i,s,o,u,d){super(i,t,"link",r,!0,o,u,d),this._register(s.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(s.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&sV(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},vo=typeof window=="object"?window:globalThis,M0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Lt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Lt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};M0.INSTANCE=new M0;var OM=M0;function CV(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}OM.INSTANCE.onDidChangeZoomLevel;OM.INSTANCE.onDidChangeFullscreen;var lc=typeof navigator=="object"?navigator.userAgent:"";lc.indexOf("Firefox")>=0;lc.indexOf("AppleWebKit")>=0;var EV=lc.indexOf("Chrome")>=0;!EV&&lc.indexOf("Safari")>=0;lc.indexOf("Electron/")>=0;lc.indexOf("Android")>=0;var v_=!1;if(typeof vo.matchMedia=="function"){let e=vo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=vo.matchMedia("(display-mode: fullscreen)");v_=e.matches,CV(vo,e,({matches:r})=>{v_&&t.matches||(v_=r)})}var Hl="en",__=!1,BM=!1,Zh,vf=Hl,D5=Hl,RV,hn,So=globalThis,Pr,XE;typeof So.vscode<"u"&&typeof So.vscode.process<"u"?Pr=So.vscode.process:typeof process<"u"&&typeof((XE=process==null?void 0:process.versions)==null?void 0:XE.node)=="string"&&(Pr=process);var ZE,kV=typeof((ZE=Pr==null?void 0:Pr.versions)==null?void 0:ZE.electron)=="string",NV=kV&&(Pr==null?void 0:Pr.type)==="renderer",QE;if(typeof Pr=="object"){Pr.platform,Pr.platform,__=Pr.platform==="linux",__&&Pr.env.SNAP&&Pr.env.SNAP_REVISION,Pr.env.CI||Pr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zh=Hl,vf=Hl;let e=Pr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zh=t.userLocale,D5=t.osLocale,vf=t.resolvedLanguage||Hl,RV=(QE=t.languagePack)==null?void 0:QE.translationsConfigFile}catch{}BM=!0}else typeof navigator=="object"&&!NV?(hn=navigator.userAgent,hn.indexOf("Windows")>=0,hn.indexOf("Macintosh")>=0,(hn.indexOf("Macintosh")>=0||hn.indexOf("iPad")>=0||hn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,__=hn.indexOf("Linux")>=0,(hn==null?void 0:hn.indexOf("Mobi"))>=0,vf=globalThis._VSCODE_NLS_LANGUAGE||Hl,Zh=navigator.language.toLowerCase(),D5=Zh):console.error("Unable to resolve platform.");var L5=BM,Qn=hn,pa=vf,AV;(e=>{function t(){return pa}e.value=t;function r(){return pa.length===2?pa==="en":pa.length>=3?pa[0]==="e"&&pa[1]==="n"&&pa[2]==="-":!1}e.isDefaultVariant=r;function i(){return pa==="en"}e.isDefault=i})(AV||(AV={}));var TV=typeof So.postMessage=="function"&&!So.importScripts;(()=>{if(TV){let e=[];So.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),So.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var MV=!!(Qn&&Qn.indexOf("Chrome")>=0);Qn&&Qn.indexOf("Firefox")>=0;!MV&&Qn&&Qn.indexOf("Safari")>=0;Qn&&Qn.indexOf("Edg/")>=0;Qn&&Qn.indexOf("Android")>=0;var Ll=typeof navigator=="object"?navigator:{};L5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ll&&Ll.clipboard&&Ll.clipboard.writeText,L5||Ll&&Ll.clipboard&&Ll.clipboard.readText;var Py=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},x_=new Py,O5=new Py,B5=new Py;new Array(230);var jV;(e=>{function t(d){return x_.keyCodeToStr(d)}e.toString=t;function r(d){return x_.strToKeyCode(d)}e.fromString=r;function i(d){return O5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return B5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return O5.strToKeyCode(d)||B5.strToKeyCode(d)}e.fromUserSettings=o;function u(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return x_.keyCodeToStr(d)}e.toElectronAccelerator=u})(jV||(jV={}));var PM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),DV;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof LV?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ms.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:PM})})(DV||(DV={}));var LV=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?PM:(this._emitter||(this._emitter=new Lt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},OV;(e=>{async function t(i){let s,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(u){o(u)}})}e.withAsyncBody=r})(OV||(OV={}));var P5=class Wi{static fromArray(t){return new Wi(r=>{r.emitMany(t)})}static fromPromise(t){return new Wi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Wi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Wi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Lt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ms.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Wi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Wi.map(this,t)}static filter(t,r){return new Wi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Wi.filter(this,t)}static coalesce(t){return Wi.filter(t,r=>!!r)}coalesce(){return Wi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Wi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};P5.EMPTY=P5.fromArray([]);var{getWindow:BV}=(function(){let e=new Map,t={window:vo,disposables:new Gl};e.set(vo.vscodeWindowId,t);let r=new Lt,i=new Lt,s=new Lt;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return bn.None;let d=new Gl,m={window:u,disposables:d.add(new Gl)};return e.set(u.vscodeWindowId,m),d.add(Vr(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(j0(u,IV.BEFORE_UNLOAD,()=>{s.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){var h;let d=u;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:vo},getDocument(u){return BV(u).document}}})(),PV=class{constructor(t,r,i,s){this._node=t,this._type=r,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function j0(e,t,r,i){return new PV(e,t,r,i)}var IV={BEFORE_UNLOAD:"beforeunload"},zV=class extends bn{constructor(t,r,i,s,o,u,d,m,h){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=u,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new cu,this._charAtlasDisposable=this._register(new cu),this._observerDisposable=this._register(new cu),this._model=new vV,this._workCell=new C5,this._workCell2=new C5,this._rectangleRenderer=this._register(new cu),this._glyphRenderer=this._register(new cu),this._onChangeTextureAtlas=this._register(new Lt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Lt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Lt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Lt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Lt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",v),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new jq(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new SV(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=Tq(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(j0(this._canvas,"webglcontextlost",p=>{console.log("webglcontextlost event received"),p.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(p)},3e3)})),this._register(j0(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,w5(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=S5(this._canvas,this._coreBrowserService.window,(p,x)=>this._setCanvasDevicePixelDimensions(p,x)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=S5(this._canvas,p,(x,y)=>this._setCanvasDevicePixelDimensions(x,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Vr(()=>{var p;for(let x of this._renderLayers)x.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),w5(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,r){var i,s,o,u;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let d of this._renderLayers)d.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(o=this._glyphRenderer.value)==null||o.setDimensions(this.dimensions),(u=this._glyphRenderer.value)==null||u.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let r of this._renderLayers)r.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let r of this._renderLayers)r.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,r,i);this._model.selection.update(this._core,t,r,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let r of this._renderLayers)r.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new bV(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new fV(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var r;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=MM(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=mM(Ms.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ms.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(r=this._glyphRenderer.value)==null||r.setAtlas(this._charAtlas)}_clearModel(t){var r;this._model.clear(),t&&((r=this._glyphRenderer.value)==null||r.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let r of this._renderLayers)r.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,r){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new aV(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let i=this._core,s=this._workCell,o,u,d,m,h,v,p=0,x=!0,y,w,C,E,S,N,k,R,M;t=I5(t,i.rows-1,0),r=I5(r,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=z-i.buffer.ydisp,W=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),G=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(u=t;u<=r;u++)for(d=u+i.buffer.ydisp,m=i.buffer.lines.get(d),this._model.lineLengths[u]=0,C=z===d,p=0,h=this._characterJoinerService.getJoinedCharacters(d),R=0;R<i.cols;R++){if(o=this._cellColorResolver.result.bg,m.loadCell(R,s),R===0&&(o=this._cellColorResolver.result.bg),v=!1,x=R>=p,y=R,h.length>0&&R===h[0][0]&&x){w=h.shift();let j=this._model.selection.isCellSelected(this._terminal,w[0],d);for(k=w[0]+1;k<w[1];k++)x&&(x=j===this._model.selection.isCellSelected(this._terminal,k,d));x&&(x=!C||W<w[0]||W>=w[1]),x?(v=!0,s=new $V(s,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),y=w[1]-1):p=w[1]}if(E=s.getChars(),S=s.getCode(),k=(u*i.cols+R)*Wf,this._cellColorResolver.resolve(s,R,d,this.dimensions.device.cell.width),q&&d===z&&(R===W&&(this._model.cursor={x:W,y:D,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},G=W+s.getWidth()-1),R>=W&&R<=G&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),S!==0&&(this._model.lineLengths[u]=R+1),!(this._model.cells[k]===S&&this._model.cells[k+pf]===this._cellColorResolver.result.bg&&this._model.cells[k+gf]===this._cellColorResolver.result.fg&&this._model.cells[k+p_]===this._cellColorResolver.result.ext)&&(B=!0,E.length>1&&(S|=gV),this._model.cells[k]=S,this._model.cells[k+pf]=this._cellColorResolver.result.bg,this._model.cells[k+gf]=this._cellColorResolver.result.fg,this._model.cells[k+p_]=this._cellColorResolver.result.ext,N=s.getWidth(),this._glyphRenderer.value.updateCell(R,u,S,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,N,o),v)){for(s=this._workCell,R++;R<=y;R++)M=(u*i.cols+R)*Wf,this._glyphRenderer.value.updateCell(R,u,0,0,0,0,Sq,0,0),this._model.cells[M]=0,this._model.cells[M+pf]=this._cellColorResolver.result.bg,this._model.cells[M+gf]=this._cellColorResolver.result.fg,this._model.cells[M+p_]=this._cellColorResolver.result.ext;R--}}B&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},$V=class extends Ul{constructor(t,r,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function I5(e,t,r=0){return Math.max(Math.min(e,t),r)}var z5="di$target",$5="di$dependencies",y_=new Map;function rs(e){if(y_.has(e))return y_.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");UV(t,r,s)};return t._id=e,y_.set(e,t),t}function UV(e,t,r){t[z5]===t?t[$5].push({id:e,index:r}):(t[$5]=[{id:e,index:r}],t[z5]=t)}rs("BufferService");rs("CoreMouseService");rs("CoreService");rs("CharsetService");rs("InstantiationService");rs("LogService");var HV=rs("OptionsService");rs("OscLinkService");rs("UnicodeService");rs("DecorationService");var FV={trace:0,debug:1,info:2,warn:3,error:4,off:5},WV="xterm.js: ",U5=class extends bn{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=FV[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":WV)+r,...i)}trace(t,...r){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,r)}debug(t,...r){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,r)}info(t,...r){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,r)}warn(t,...r){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,r)}error(t,...r){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,r)}};U5=dq([hq(0,HV)],U5);var qV=class extends bn{constructor(t){if(vM&&wq()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new Lt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Lt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Lt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Lt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=r.coreService,s=r.optionsService,o=r,u=o._renderService,d=o._characterJoinerService,m=o._charSizeService,h=o._coreBrowserService,v=o._decorationService;o._logService;let p=o._themeService;this._renderer=this._register(new zV(t,d,m,h,i,v,s,p,this._preserveDrawingBuffer)),this._register(Ms.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ms.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ms.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ms.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Vr(()=>{if(this._terminal._core._store._isDisposed)return;let x=this._terminal._core._renderService;x.setRenderer(this._terminal._core._createRenderer()),x.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
640
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
641
+ * @license MIT
642
+ *
643
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
644
+ * @license MIT
645
+ *
646
+ * Originally forked from (with the author's permission):
647
+ * Fabrice Bellard's javascript vt100 for jslinux:
648
+ * http://bellard.org/jslinux/
649
+ * Copyright (c) 2011 Fabrice Bellard
650
+ */var IM=Object.defineProperty,VV=Object.getOwnPropertyDescriptor,GV=(e,t)=>{for(var r in t)IM(e,r,{get:t[r],enumerable:!0})},Zt=(e,t,r,i)=>{for(var s=i>1?void 0:i?VV(t,r):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=(i?u(t,r,s):u(s))||s);return i&&s&&IM(t,r,s),s},Ne=(e,t)=>(r,i)=>t(r,i,e),H5="Terminal input",D0={get:()=>H5,set:e=>H5=e},F5="Too much output to announce, navigate to rows manually to read",L0={get:()=>F5,set:e=>F5=e};function YV(e){return e.replace(/\r?\n/g,"\r")}function KV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function XV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function ZV(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");zM(s,t,r,i)}}function zM(e,t,r,i){e=YV(e),e=KV(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function $M(e,t,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function W5(e,t,r,i,s){$M(e,t,r),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function wa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Om(e,t=0,r=e.length){let i="";for(let s=t;s<r;++s){let o=e[s];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var QV=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let o=e.charCodeAt(s++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=s;o<r;++o){let u=e.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return this._interim=u,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(u-55296)*1024+d-56320+65536:(t[i++]=u,t[i++]=d);continue}u!==65279&&(t[i++]=u)}return i}},JV=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s,o,u,d,m=0,h=0;if(this.interim[0]){let x=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)y<<=6,y|=C;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=E-w;for(;h<S;){if(h>=r)return 0;if(C=e[h++],(C&192)!==128){h--,x=!0;break}else this.interim[w++]=C,y<<=6,y|=C&63}x||(E===2?y<128?h--:t[i++]=y:E===3?y<2048||y>=55296&&y<=57343||y===65279||(t[i++]=y):y<65536||y>1114111||(t[i++]=y)),this.interim.fill(0)}let v=r-4,p=h;for(;p<r;){for(;p<v&&!((s=e[p])&128)&&!((o=e[p+1])&128)&&!((u=e[p+2])&128)&&!((d=e[p+3])&128);)t[i++]=s,t[i++]=o,t[i++]=u,t[i++]=d,p+=4;if(s=e[p++],s<128)t[i++]=s;else if((s&224)===192){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(m=(s&31)<<6|o&63,m<128){p--;continue}t[i++]=m}else if((s&240)===224){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(m=(s&15)<<12|(o&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[i++]=m}else if((s&248)===240){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=u,i;if(d=e[p++],(d&192)!==128){p--;continue}if(m=(s&7)<<18|(o&63)<<12|(u&63)<<6|d&63,m<65536||m>1114111)continue;t[i++]=m}}return i}},UM="",Ca=" ",md=class HM{constructor(){this.fg=0,this.bg=0,this.extended=new qf}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new HM;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},qf=class FM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new FM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Xi=class WM extends md{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new qf,this.combinedData=""}static fromCharData(t){let r=new WM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?wa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},q5="di$target",O0="di$dependencies",b_=new Map;function eG(e){return e[O0]||[]}function Nr(e){if(b_.has(e))return b_.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");tG(t,r,s)};return t._id=e,b_.set(e,t),t}function tG(e,t,r){t[q5]===t?t[O0].push({id:e,index:r}):(t[O0]=[{id:e,index:r}],t[q5]=t)}var ti=Nr("BufferService"),qM=Nr("CoreMouseService"),Ho=Nr("CoreService"),rG=Nr("CharsetService"),Iy=Nr("InstantiationService"),VM=Nr("LogService"),ri=Nr("OptionsService"),GM=Nr("OscLinkService"),iG=Nr("UnicodeService"),pd=Nr("DecorationService"),B0=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var v;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,o=new Xi,u=r.getTrimmedLength(),d=-1,m=-1,h=!1;for(let p=0;p<u;p++)if(!(m===-1&&!r.hasContent(p))){if(r.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(m===-1){m=p,d=o.extended.urlId;continue}else h=o.extended.urlId!==d;else m!==-1&&(h=!0);if(h||m!==-1&&p===u-1){let x=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(x){let y={start:{x:m+1,y:e},end:{x:p+(!h&&p===u-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let C=new URL(x);["http:","https:"].includes(C.protocol)||(w=!0)}catch{w=!0}w||i.push({text:x,range:y,activate:(C,E)=>s?s.activate(C,E,y):nG(C,E),hover:(C,E)=>{var S;return(S=s==null?void 0:s.hover)==null?void 0:S.call(s,C,E,y)},leave:(C,E)=>{var S;return(S=s==null?void 0:s.leave)==null?void 0:S.call(s,C,E,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(m=p,d=o.extended.urlId):(m=-1,d=-1)}}t(i)}};B0=Zt([Ne(0,ti),Ne(1,ri),Ne(2,GM)],B0);function nG(e,t){if(confirm(`Do you want to navigate to ${t}?
651
+
652
+ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Bm=Nr("CharSizeService"),$s=Nr("CoreBrowserService"),zy=Nr("MouseService"),Us=Nr("RenderService"),sG=Nr("SelectionService"),YM=Nr("CharacterJoinerService"),cc=Nr("ThemeService"),KM=Nr("LinkProviderService"),aG=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?V5.isErrorNoTelemetry(e)?new V5(e.message+`
653
+
654
+ `+e.stack):new Error(e.message+`
655
+
656
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},oG=new aG;function _f(e){lG(e)||oG.onUnexpectedError(e)}var P0="Canceled";function lG(e){return e instanceof cG?!0:e instanceof Error&&e.name===P0&&e.message===P0}var cG=class extends Error{constructor(){super(P0),this.name=this.message}};function uG(e){return new Error(`Illegal argument: ${e}`)}var V5=class I0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof I0)return t;let r=new I0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},z0=class XM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,XM.prototype)}};function ki(e,t=0){return e[e.length-(1+t)]}var dG;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(dG||(dG={}));function hG(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var ZM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(R){yield R}e.single=s;function o(R){return t(R)?R:s(R)}e.wrap=o;function u(R){return R||r}e.from=u;function*d(R){for(let M=R.length-1;M>=0;M--)yield R[M]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,M){let L=0;for(let z of R)if(M(z,L++))return!0;return!1}e.some=v;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*x(R,M){for(let L of R)M(L)&&(yield L)}e.filter=x;function*y(R,M){let L=0;for(let z of R)yield M(z,L++)}e.map=y;function*w(R,M){let L=0;for(let z of R)yield*M(z,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let z=L;for(let D of R)z=M(z,D);return z}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let z=R[Symbol.iterator]();for(let D=0;D<M;D++){let W=z.next();if(W.done)return[L,e.empty()];L.push(W.value)}return[L,{[Symbol.iterator](){return z}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(ZM||(ZM={}));function To(e){if(ZM.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function fG(...e){return It(()=>To(e))}function It(e){return{dispose:hG(()=>{e()})}}var QM=class JM{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{To(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?JM.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};QM.DISABLE_DISPOSED_WARNING=!1;var ka=QM,tt=class{constructor(){this._store=new ka,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};tt.None=Object.freeze({dispose(){}});var Ql=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},js=typeof window=="object"?window:globalThis,$0=class U0{constructor(t){this.element=t,this.next=U0.Undefined,this.prev=U0.Undefined}};$0.Undefined=new $0(void 0);var zt=$0,G5=class{constructor(){this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===zt.Undefined}clear(){let e=this._first;for(;e!==zt.Undefined;){let t=e.next;e.prev=zt.Undefined,e.next=zt.Undefined,e=t}this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new zt(e);if(this._first===zt.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==zt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==zt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==zt.Undefined&&e.next!==zt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===zt.Undefined&&e.next===zt.Undefined?(this._first=zt.Undefined,this._last=zt.Undefined):e.next===zt.Undefined?(this._last=this._last.prev,this._last.next=zt.Undefined):e.prev===zt.Undefined&&(this._first=this._first.next,this._first.prev=zt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==zt.Undefined;)yield e.element,e=e.next}},mG=globalThis.performance&&typeof globalThis.performance.now=="function",pG=class ej{static create(t){return new ej(t)}constructor(t){this._now=mG&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},zr;(e=>{e.None=()=>tt.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,$)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,$),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h(($,T=null,U)=>B(H=>$.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h(($,T=null,U)=>B(H=>{j(H),$.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h(($,T=null,U)=>B(H=>j(H)&&$.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,$)=>{let T=fG(...B.map(U=>U(H=>j.call(O,H))));return v(T,$)}}e.any=d;function m(B,j,O,$){let T=O;return i(B,U=>(T=j(T,U),T),$)}e.reduce=m;function h(B,j){let O,$={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new Se($);return j==null||j.add(T),T.event}function v(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,$=!1,T=!1,U,H){let F,V,I,Y=0,X,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(oe=>{Y++,V=j(V,oe),$&&!I&&(re.fire(V),V=void 0),X=()=>{let Z=V;V=void 0,I=void 0,(!$||Y>1)&&re.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(X,O)):I===void 0&&(I=0,queueMicrotask(X))})},onWillRemoveListener(){T&&Y>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,F.dispose()}},re=new Se(ee);return H==null||H.add(re),re.event}e.debounce=p;function x(B,j=0,O){return e.debounce(B,($,T)=>$?($.push(T),$):[T],j,void 0,!0,void 0,O)}e.accumulate=x;function y(B,j=($,T)=>$===T,O){let $=!0,T;return o(B,U=>{let H=$||!j(U,T);return $=!1,T=U,H},O)}e.latch=y;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,$=>!j($),O)]}e.split=w;function C(B,j=!1,O=[],$){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});$&&$.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new Se({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),$&&$.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return $&&$.add(F),F.event}e.buffer=C;function E(B,j){return(O,$,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call($,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let $=O;return this.steps.push(T=>($=j($,T),$)),this}latch(j=(O,$)=>O===$){let O=!0,$;return this.steps.push(T=>{let U=O||!j(T,$);return O=!1,$=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.on(j,$),U=()=>B.removeListener(j,$),H=new Se({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,$),U=()=>B.removeEventListener(j,$),H=new Se({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new Se;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function z(B,j){return B(O=>j.fire(O))}e.forward=z;function D(B,j,O){return j(O),B($=>j($))}e.runAndSubscribe=D;class W{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new Se($),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new W(B,j).emitter.event}e.fromObservable=G;function q(B){return(j,O,$)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return $ instanceof ka?$.add(F):Array.isArray($)&&$.push(F),F}}e.fromObservableLight=q})(zr||(zr={}));var H0=class F0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${F0._idPool++}`,F0.all.add(this)}start(t){this._stopWatch=new pG,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};H0.all=new Set,H0._idPool=0;var gG=H0,vG=-1,tj=class rj{constructor(t,r,i=(rj._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let m=new yG(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};tj._idPool=1;var _G=tj,xG=class ij{constructor(t){this.value=t}static create(){let t=new Error;return new ij(t.stack??"")}print(){console.warn(this.value.split(`
657
+ `).slice(2).join(`
658
+ `))}},yG=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},bG=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},wG=0,w_=class{constructor(e){this.value=e,this.id=wG++}},SG=2,CG,Se=class{constructor(e){var t,r,i,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new _G((e==null?void 0:e.onListenerError)??_f,((r=this._options)==null?void 0:r.leakWarningThreshold)??vG):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new gG(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var u,d,m,h,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new bG(`${p}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((u=this._options)==null?void 0:u.onListenerError)||_f)(y),tt.None}if(this._disposed)return tt.None;t&&(e=e.bind(t));let i=new w_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=xG.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof w_?(this._deliveryQueue??(this._deliveryQueue=new EG),this._listeners=[this._listeners,i]):this._listeners.push(i):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=i,(v=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||v.call(h,this)),this._size++;let o=It(()=>{s==null||s(),this._removeListener(i)});return r instanceof ka?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var s,o,u,d;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||d.call(u,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*SG<=t.length){let m=0;for(let h=0;h<t.length;h++)t[h]?t[m++]=t[h]:i&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var i;if(!e)return;let r=((i=this._options)==null?void 0:i.onListenerError)||_f;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,i,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof w_)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},EG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},W0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};W0.INSTANCE=new W0;var $y=W0;function RG(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}$y.INSTANCE.onDidChangeZoomLevel;function kG(e){return $y.INSTANCE.getZoomFactor(e)}$y.INSTANCE.onDidChangeFullscreen;var uc=typeof navigator=="object"?navigator.userAgent:"",q0=uc.indexOf("Firefox")>=0,NG=uc.indexOf("AppleWebKit")>=0,Uy=uc.indexOf("Chrome")>=0,AG=!Uy&&uc.indexOf("Safari")>=0;uc.indexOf("Electron/")>=0;uc.indexOf("Android")>=0;var S_=!1;if(typeof js.matchMedia=="function"){let e=js.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=js.matchMedia("(display-mode: fullscreen)");S_=e.matches,RG(js,e,({matches:r})=>{S_&&t.matches||(S_=r)})}var Fl="en",V0=!1,G0=!1,xf=!1,nj=!1,Qh,yf=Fl,Y5=Fl,TG,fn,Co=globalThis,Ir,JE;typeof Co.vscode<"u"&&typeof Co.vscode.process<"u"?Ir=Co.vscode.process:typeof process<"u"&&typeof((JE=process==null?void 0:process.versions)==null?void 0:JE.node)=="string"&&(Ir=process);var eR,MG=typeof((eR=Ir==null?void 0:Ir.versions)==null?void 0:eR.electron)=="string",jG=MG&&(Ir==null?void 0:Ir.type)==="renderer",tR;if(typeof Ir=="object"){V0=Ir.platform==="win32",G0=Ir.platform==="darwin",xf=Ir.platform==="linux",xf&&Ir.env.SNAP&&Ir.env.SNAP_REVISION,Ir.env.CI||Ir.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Qh=Fl,yf=Fl;let e=Ir.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Qh=t.userLocale,Y5=t.osLocale,yf=t.resolvedLanguage||Fl,TG=(tR=t.languagePack)==null?void 0:tR.translationsConfigFile}catch{}nj=!0}else typeof navigator=="object"&&!jG?(fn=navigator.userAgent,V0=fn.indexOf("Windows")>=0,G0=fn.indexOf("Macintosh")>=0,(fn.indexOf("Macintosh")>=0||fn.indexOf("iPad")>=0||fn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xf=fn.indexOf("Linux")>=0,(fn==null?void 0:fn.indexOf("Mobi"))>=0,yf=globalThis._VSCODE_NLS_LANGUAGE||Fl,Qh=navigator.language.toLowerCase(),Y5=Qh):console.error("Unable to resolve platform.");var sj=V0,Zn=G0,DG=xf,K5=nj,Jn=fn,ga=yf,LG;(e=>{function t(){return ga}e.value=t;function r(){return ga.length===2?ga==="en":ga.length>=3?ga[0]==="e"&&ga[1]==="n"&&ga[2]==="-":!1}e.isDefaultVariant=r;function i(){return ga==="en"}e.isDefault=i})(LG||(LG={}));var OG=typeof Co.postMessage=="function"&&!Co.importScripts;(()=>{if(OG){let e=[];Co.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Co.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var BG=!!(Jn&&Jn.indexOf("Chrome")>=0);Jn&&Jn.indexOf("Firefox")>=0;!BG&&Jn&&Jn.indexOf("Safari")>=0;Jn&&Jn.indexOf("Edg/")>=0;Jn&&Jn.indexOf("Android")>=0;var Ol=typeof navigator=="object"?navigator:{};K5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ol&&Ol.clipboard&&Ol.clipboard.writeText,K5||Ol&&Ol.clipboard&&Ol.clipboard.readText;var Hy=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},C_=new Hy,X5=new Hy,Z5=new Hy,PG=new Array(230),aj;(e=>{function t(d){return C_.keyCodeToStr(d)}e.toString=t;function r(d){return C_.strToKeyCode(d)}e.fromString=r;function i(d){return X5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return Z5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return X5.strToKeyCode(d)||Z5.strToKeyCode(d)}e.fromUserSettings=o;function u(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return C_.keyCodeToStr(d)}e.toElectronAccelerator=u})(aj||(aj={}));var IG=class oj{constructor(t,r,i,s,o){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=o}equals(t){return t instanceof oj&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new zG([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},zG=class{constructor(e){if(e.length===0)throw uG("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function $G(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return aj.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(q0)switch(t){case 59:return 85;case 60:if(DG)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Zn)return 57;break}else if(NG&&(Zn&&t===93||!Zn&&t===92))return 57;return PG[t]||0}var UG=Zn?256:2048,HG=512,FG=1024,WG=Zn?2048:256,Q5=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=$G(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=UG),this.altKey&&(t|=HG),this.shiftKey&&(t|=FG),this.metaKey&&(t|=WG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new IG(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},J5=new WeakMap;function qG(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var VG=class{static getSameOriginWindowChain(e){let t=J5.get(e);if(!t){t=[],J5.set(e,t);let r=e,i;do i=qG(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,i=0,s=this.getSameOriginWindowChain(e);for(let o of s){let u=o.window.deref();if(r+=(u==null?void 0:u.scrollY)??0,i+=(u==null?void 0:u.scrollX)??0,u===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();r+=d.top,i+=d.left}return{top:r,left:i}}},Jh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=VG.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},eE=class{constructor(e,t=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(Uy){let o=navigator.userAgent.match(/Chrome\/(\d+)/);i=(o?parseInt(o[1]):123)<=122}if(e){let o=e,u=e,d=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")i?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?q0&&!Zn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")AG&&sj?this.deltaX=-(o.wheelDeltaX/120):i?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?q0&&!Zn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},lj=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),GG;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof YG?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:zr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:lj})})(GG||(GG={}));var YG=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?lj:(this._emitter||(this._emitter=new Se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Fy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new z0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new z0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},KG=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new z0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=It(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},XG;(e=>{async function t(i){let s,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(u){o(u)}})}e.withAsyncBody=r})(XG||(XG={}));var tE=class qi{static fromArray(t){return new qi(r=>{r.emitMany(t)})}static fromPromise(t){return new qi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new qi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new qi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Se,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await zr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new qi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return qi.map(this,t)}static filter(t,r){return new qi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,r=>!!r)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return qi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};tE.EMPTY=tE.fromArray([]);var{getWindow:Yn,getWindowId:ZG,onDidRegisterWindow:QG}=(function(){let e=new Map,t={window:js,disposables:new ka};e.set(js.vscodeWindowId,t);let r=new Se,i=new Se,s=new Se;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return tt.None;let d=new ka,m={window:u,disposables:d.add(new ka)};return e.set(u.vscodeWindowId,m),d.add(It(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(We(u,br.BEFORE_UNLOAD,()=>{s.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){var h;let d=u;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:js},getDocument(u){return Yn(u).document}}})(),JG=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function We(e,t,r,i){return new JG(e,t,r,i)}var rE=function(e,t,r,i){return We(e,t,r,i)},Wy,eY=class extends KG{constructor(e){super(),this.defaultTarget=e&&Yn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},iE=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){_f(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,s=o=>{r.set(o,!1);let u=e.get(o)??[];for(t.set(o,u),e.set(o,[]),i.set(o,!0);u.length>0;)u.sort(iE.sort),u.shift().execute();i.set(o,!1)};Wy=(o,u,d=0)=>{let m=ZG(o),h=new iE(u,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(h),r.get(m)||(r.set(m,!0),o.requestAnimationFrame(()=>s(m))),h}})();function tY(e){let t=e.getBoundingClientRect(),r=Yn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var br={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},rY=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=fi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=fi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=fi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=fi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=fi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=fi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=fi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=fi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=fi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=fi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=fi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=fi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=fi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=fi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function fi(e){return typeof e=="number"?`${e}px`:e}function Ou(e){return new rY(e)}var cj=class{constructor(){this._hooks=new ka,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let o=e;try{e.setPointerCapture(t),this._hooks.add(It(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Yn(e)}this._hooks.add(We(o,br.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(We(o,br.POINTER_UP,u=>this.stopMonitoring(!0)))}};function iY(e,t,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let o=`$memoize$${t}`;r[i]=function(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,u)}),this[o]}}var Wn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Wn||(Wn={}));var ku=class qr extends tt{constructor(){super(),this.dispatched=!1,this.targets=new G5,this.ignoreTargets=new G5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(zr.runAndSubscribe(QG,({window:t,disposables:r})=>{r.add(We(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(We(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(We(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:js,disposables:this._store}))}static addTarget(t){if(!qr.isTouchDevice())return tt.None;qr.INSTANCE||(qr.INSTANCE=new qr);let r=qr.INSTANCE.targets.push(t);return It(r)}static ignoreTarget(t){if(!qr.isTouchDevice())return tt.None;qr.INSTANCE||(qr.INSTANCE=new qr);let r=qr.INSTANCE.ignoreTargets.push(t);return It(r)}static isTouchDevice(){return"ontouchstart"in js||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:r,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[r],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let u=this.newGestureEvent(Wn.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,u=r.changedTouches.length;o<u;o++){let d=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],h=Date.now()-m.initialTimeStamp;if(h<qr.HOLD_DELAY&&Math.abs(m.initialPageX-ki(m.rollingPageX))<30&&Math.abs(m.initialPageY-ki(m.rollingPageY))<30){let v=this.newGestureEvent(Wn.Tap,m.initialTarget);v.pageX=ki(m.rollingPageX),v.pageY=ki(m.rollingPageY),this.dispatchEvent(v)}else if(h>=qr.HOLD_DELAY&&Math.abs(m.initialPageX-ki(m.rollingPageX))<30&&Math.abs(m.initialPageY-ki(m.rollingPageY))<30){let v=this.newGestureEvent(Wn.Contextmenu,m.initialTarget);v.pageX=ki(m.rollingPageX),v.pageY=ki(m.rollingPageY),this.dispatchEvent(v)}else if(s===1){let v=ki(m.rollingPageX),p=ki(m.rollingPageY),x=ki(m.rollingTimestamps)-m.rollingTimestamps[0],y=v-m.rollingPageX[0],w=p-m.rollingPageY[0],C=[...this.targets].filter(E=>m.initialTarget instanceof Node&&E.contains(m.initialTarget));this.inertia(t,C,i,Math.abs(y)/x,y>0?1:-1,v,Math.abs(w)/x,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Wn.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===Wn.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>qr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===Wn.Change||t.type===Wn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,o=t.initialTarget;for(;o&&o!==i;)s++,o=o.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,s,o,u,d,m,h){this.handle=Wy(t,()=>{let v=Date.now(),p=v-i,x=0,y=0,w=!0;s+=qr.SCROLL_FRICTION*p,d+=qr.SCROLL_FRICTION*p,s>0&&(w=!1,x=o*s*p),d>0&&(w=!1,y=m*d*p);let C=this.newGestureEvent(Wn.Change);C.translationX=x,C.translationY=y,r.forEach(E=>E.dispatchEvent(C)),w||this.inertia(t,r,v,s,o,u+x,d,m,h+y)})}onTouchMove(t){let r=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let u=this.activeTouches[o.identifier],d=this.newGestureEvent(Wn.Change,u.initialTarget);d.translationX=o.pageX-ki(u.rollingPageX),d.translationY=o.pageY-ki(u.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(o.pageX),u.rollingPageY.push(o.pageY),u.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ku.SCROLL_FRICTION=-.005,ku.HOLD_DELAY=700,ku.CLEAR_TAP_COUNT_TIME=400,Zt([iY],ku,"isTouchDevice",1);var nY=ku,qy=class extends tt{onclick(e,t){this._register(We(e,br.CLICK,r=>t(new Jh(Yn(e),r))))}onmousedown(e,t){this._register(We(e,br.MOUSE_DOWN,r=>t(new Jh(Yn(e),r))))}onmouseover(e,t){this._register(We(e,br.MOUSE_OVER,r=>t(new Jh(Yn(e),r))))}onmouseleave(e,t){this._register(We(e,br.MOUSE_LEAVE,r=>t(new Jh(Yn(e),r))))}onkeydown(e,t){this._register(We(e,br.KEY_DOWN,r=>t(new Q5(r))))}onkeyup(e,t){this._register(We(e,br.KEY_UP,r=>t(new Q5(r))))}oninput(e,t){this._register(We(e,br.INPUT,t))}onblur(e,t){this._register(We(e,br.BLUR,t))}onfocus(e,t){this._register(We(e,br.FOCUS,t))}onchange(e,t){this._register(We(e,br.CHANGE,t))}ignoreGesture(e){return nY.ignoreTarget(e)}},nE=11,sY=class extends qy{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=nE+"px",this.domNode.style.height=nE+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new cj),this._register(rE(this.bgDomNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(rE(this.domNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new eY),this._pointerdownScheduleRepeatTimer=this._register(new Fy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Yn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},aY=class Y0{constructor(t,r,i,s,o,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,o=o|0,u=u|0,d=d|0),this.rawScrollLeft=s,this.rawScrollTop=d,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),o<0&&(o=0),d+o>u&&(d=u-o),d<0&&(d=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=o,this.scrollHeight=u,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Y0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Y0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:o,heightChanged:u,scrollHeightChanged:d,scrollTopChanged:m}}},oY=class extends tt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new aY(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new aE(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=aE.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},sE=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function E_(e,t){let r=t-e;return function(i){return e+r*uY(i)}}function lY(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var aE=class K0{constructor(t,r,i,s){this.from=t,this.to=r,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,i){if(Math.abs(t-r)>2.5*i){let s,o;return t<r?(s=t+.75*i,o=r-.75*i):(s=t-.75*i,o=r+.75*i),lY(E_(t,s),E_(o,r),.33)}return E_(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new sE(i,s,!1)}return new sE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return K0.start(t,r,i)}static start(t,r,i){i=i+10;let s=Date.now()-10;return new K0(t,r,s,i)}};function cY(e){return Math.pow(e,3)}function uY(e){return 1-cY(1-e)}var dY=class extends tt{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Fy)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},hY=140,uj=class extends qy{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new dY(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new cj),this._shouldRender=!0,this.domNode=Ou(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(We(this.domNode.domNode,br.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new sY(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=Ou(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(We(this.slider.domNode,br.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let s=tY(this.domNode.domNode);t=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let o=this._sliderOrthogonalPointerPosition(s),u=Math.abs(o-r);if(sj&&u>hY){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},dj=class X0{constructor(t,r,i,s,o,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=o,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new X0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,s,o){let u=Math.max(0,i-t),d=Math.max(0,u-2*r),m=s>0&&s>i;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(i*d/s))),v=(d-h)/(s-i),p=o*v;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:v,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=X0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},fY=class extends uj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new dj(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},mY=class extends uj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new dj(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},pY=500,oE=50,gY=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Z0=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,s=this._rear;do{let o=s===this._front?t:Math.pow(2,-i);if(t-=o,r+=this._memory[s].score*o,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Uy){let r=Yn(t.browserEvent),i=kG(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let s=null,o=new gY(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,s)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let s=Math.abs(t.deltaX),o=Math.abs(t.deltaY),u=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(s,u),1),h=Math.max(Math.min(o,d),1),v=Math.max(s,u),p=Math.max(o,d);v%m===0&&p%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Z0.INSTANCE=new Z0;var vY=Z0,_Y=class extends qy{constructor(e,t,r){super(),this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Se),this.onWillScroll=this._onWillScroll.event,this._options=yY(t),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new mY(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new fY(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ou(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ou(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ou(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Fy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=To(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Zn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new eE(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=To(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new eE(r))};this._mouseWheelToDispose.push(We(this._listenOnDomNode,br.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=vY.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+o===0?u=o=0:Math.abs(o)>=Math.abs(u)?u=0:o=0),this._options.flipAxes&&([o,u]=[u,o]);let d=!Zn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!u&&(u=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),h={};if(o){let v=oE*o,p=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(h,p)}if(u){let v=oE*u,p=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(h,p)}h=this._scrollable.validateScrollPosition(h),(m.scrollLeft!==h.scrollLeft||m.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",s=t?" top":"",o=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),pY)}},xY=class extends _Y{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function yY(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Zn&&(t.className+=" mac"),t}var Q0=class extends tt{constructor(e,t,r,i,s,o,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new oY({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Wy(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new xY(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(zr.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(It(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(It(()=>this._styleElement.remove())),this._register(zr.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
659
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Q0=Zt([Ne(2,ti),Ne(3,$s),Ne(4,qM),Ne(5,cc),Ne(6,ri),Ne(7,Us)],Q0);var J0=class extends tt{constructor(e,t,r,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(It(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};J0=Zt([Ne(1,ti),Ne(2,$s),Ne(3,pd),Ne(4,Us)],J0);var bY=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},$n={full:0,left:0,center:0,right:0},va={full:0,left:0,center:0,right:0},fu={full:0,left:0,center:0,right:0},Vf=class extends tt{constructor(e,t,r,i,s,o,u,d){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=o,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new bY,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(It(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);va.full=this._canvas.width,va.left=e,va.center=t,va.right=e,this._refreshDrawHeightConstants(),fu.full=1,fu.left=1,fu.center=1+va.left,fu.right=1+va.left+va.center}_refreshDrawHeightConstants(){$n.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);$n.left=t,$n.center=t,$n.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(fu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-$n[e.position||"full"]/2),va[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$n[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Vf=Zt([Ne(2,ti),Ne(3,pd),Ne(4,Us),Ne(5,ri),Ne(6,cc),Ne(7,$s)],Vf);var ge;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
660
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ge||(ge={}));var bf;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(bf||(bf={}));var hj;(e=>e.ST=`${ge.ESC}\\`)(hj||(hj={}));var ex=class{constructor(e,t,r,i,s,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ge.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ex=Zt([Ne(2,ti),Ne(3,ri),Ne(4,Ho),Ne(5,Us)],ex);var Er=0,Rr=0,kr=0,Kt=0,lE={css:"#00000000",rgba:0},lr;(e=>{function t(s,o,u,d){return d!==void 0?`#${fo(s)}${fo(o)}${fo(u)}${fo(d)}`:`#${fo(s)}${fo(o)}${fo(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(lr||(lr={}));var Dt;(e=>{function t(m,h){if(Kt=(h.rgba&255)/255,Kt===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,p=h.rgba>>16&255,x=h.rgba>>8&255,y=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Er=y+Math.round((v-y)*Kt),Rr=w+Math.round((p-w)*Kt),kr=C+Math.round((x-C)*Kt);let E=lr.toCss(Er,Rr,kr),S=lr.toRgba(Er,Rr,kr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,v){let p=wf.ensureContrastRatio(m.rgba,h.rgba,v);if(p)return lr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[Er,Rr,kr]=wf.toChannels(h),{css:lr.toCss(Er,Rr,kr),rgba:h}}e.opaque=s;function o(m,h){return Kt=Math.round(h*255),[Er,Rr,kr]=wf.toChannels(m.rgba),{css:lr.toCss(Er,Rr,kr,Kt),rgba:lr.toRgba(Er,Rr,kr,Kt)}}e.opacity=o;function u(m,h){return Kt=m.rgba&255,o(m,Kt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Dt||(Dt={}));var $t;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Er=parseInt(s.slice(1,2).repeat(2),16),Rr=parseInt(s.slice(2,3).repeat(2),16),kr=parseInt(s.slice(3,4).repeat(2),16),lr.toColor(Er,Rr,kr);case 5:return Er=parseInt(s.slice(1,2).repeat(2),16),Rr=parseInt(s.slice(2,3).repeat(2),16),kr=parseInt(s.slice(3,4).repeat(2),16),Kt=parseInt(s.slice(4,5).repeat(2),16),lr.toColor(Er,Rr,kr,Kt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Er=parseInt(o[1]),Rr=parseInt(o[2]),kr=parseInt(o[3]),Kt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),lr.toColor(Er,Rr,kr,Kt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Er,Rr,kr,Kt]=t.getImageData(0,0,1,1).data,Kt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lr.toRgba(Er,Rr,kr,Kt),css:s}}e.toColor=i})($t||($t={}));var Zr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let u=i/255,d=s/255,m=o/255,h=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(Zr||(Zr={}));var wf;(e=>{function t(u,d){if(Kt=(d&255)/255,Kt===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,y=u>>8&255;return Er=p+Math.round((m-p)*Kt),Rr=x+Math.round((h-x)*Kt),kr=y+Math.round((v-y)*Kt),lr.toRgba(Er,Rr,kr)}e.blend=t;function r(u,d,m){let h=Zr.relativeLuminance(u>>8),v=Zr.relativeLuminance(d>>8);if(Ns(h,v)<m){if(v<h){let y=i(u,d,m),w=Ns(h,Zr.relativeLuminance(y>>8));if(w<m){let C=s(u,d,m),E=Ns(h,Zr.relativeLuminance(C>>8));return w>E?y:C}return y}let p=s(u,d,m),x=Ns(h,Zr.relativeLuminance(p>>8));if(x<m){let y=i(u,d,m),w=Ns(h,Zr.relativeLuminance(y>>8));return x>w?p:y}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,C=Ns(Zr.relativeLuminance2(x,y,w),Zr.relativeLuminance2(h,v,p));for(;C<m&&(x>0||y>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Ns(Zr.relativeLuminance2(x,y,w),Zr.relativeLuminance2(h,v,p));return(x<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,C=Ns(Zr.relativeLuminance2(x,y,w),Zr.relativeLuminance2(h,v,p));for(;C<m&&(x<255||y<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Ns(Zr.relativeLuminance2(x,y,w),Zr.relativeLuminance2(h,v,p));return(x<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(wf||(wf={}));function fo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ns(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var wY=class extends md{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Gf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Xi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),s=0,o=0,u=0,d=t.getFg(0),m=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(h-s>1){let v=this._getJoinedRanges(i,u,o,t,s);for(let p=0;p<v.length;p++)r.push(v[p])}s=h,u=o,d=this._workCell.fg,m=this._workCell.bg}o+=this._workCell.getChars().length||Ca.length}if(this._bufferService.cols-s>1){let h=this._getJoinedRanges(i,u,o,t,s);for(let v=0;v<h.length;v++)r.push(h[v])}return r}_getJoinedRanges(e,t,r,i,s){let o=e.substring(t,r),u=[];try{u=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(o);for(let h=0;h<m.length;h++)Gf._mergeRanges(u,m[h])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,i,s),u}_stringRangesToCellRanges(e,t,r){let i=0,s=!1,o=0,u=e[i];if(u){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),h=t.getString(d).length||Ca.length;if(m!==0){if(!s&&u[0]<=o&&(u[0]=d,s=!0),u[1]<=o){if(u[1]=d,u=e[++i],!u)break;u[0]<=o?(u[0]=d,s=!0):s=!1}o+=h}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Gf=Zt([Ne(0,ti)],Gf);function SY(e){return 57508<=e&&e<=57558}function CY(e){return 9472<=e&&e<=9631}function EY(e){return SY(e)||CY(e)}function RY(){return{css:{canvas:ef(),cell:ef()},device:{canvas:ef(),cell:ef(),char:{width:0,height:0,left:0,top:0}}}}function ef(){return{width:0,height:0}}var tx=class{constructor(e,t,r,i,s,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=o,this._themeService=u,this._workCell=new Xi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,s,o,u,d,m,h,v){let p=[],x=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<o+1&&(w=o+1);let C,E=0,S="",N=0,k=0,R=0,M=0,L=!1,z=0,D=!1,W=0,G=0,q=[],B=h!==-1&&v!==-1;for(let j=0;j<w;j++){e.loadCell(j,this._workCell);let O=this._workCell.getWidth();if(O===0)continue;let $=!1,T=j>=G,U=j,H=this._workCell;if(x.length>0&&j===x[0][0]&&T){let J=x.shift(),ie=this._isCellInSelection(J[0],t);for(N=J[0]+1;N<J[1];N++)T&&(T=ie===this._isCellInSelection(N,t));T&&(T=!r||o<J[0]||o>=J[1]),T?($=!0,H=new wY(this._workCell,e.translateToString(!0,J[0],J[1]),J[1]-J[0]),U=J[1]-1,O=H.getWidth()):G=J[1]}let F=this._isCellInSelection(j,t),V=r&&j===o,I=B&&j>=h&&j<=v,Y=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,J=>{Y=!0});let X=H.getChars()||Ca;if(X===" "&&(H.isUnderline()||H.isOverline())&&(X=" "),W=O*d-m.get(X,H.isBold(),H.isItalic()),!C)C=this._document.createElement("span");else if(E&&(F&&D||!F&&!D&&H.bg===k)&&(F&&D&&y.selectionForeground||H.fg===R)&&H.extended.ext===M&&I===L&&W===z&&!V&&!$&&!Y&&T){H.isInvisible()?S+=Ca:S+=X,E++;continue}else E&&(C.textContent=S),C=this._document.createElement("span"),E=0,S="";if(k=H.bg,R=H.fg,M=H.extended.ext,L=I,z=W,D=F,$&&o>=j&&o<=U&&(o=j),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&q.push("xterm-cursor-blink"),q.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(H.isBold()&&q.push("xterm-bold"),H.isItalic()&&q.push("xterm-italic"),H.isDim()&&q.push("xterm-dim"),H.isInvisible()?S=Ca:S=H.getChars()||Ca,H.isUnderline()&&(q.push(`xterm-underline-${H.extended.underlineStyle}`),S===" "&&(S=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${md.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let J=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&J<8&&(J+=8),C.style.textDecorationColor=y.ansi[J].css}H.isOverline()&&(q.push("xterm-overline"),S===" "&&(S=" ")),H.isStrikethrough()&&q.push("xterm-strikethrough"),I&&(C.style.textDecoration="underline");let ee=H.getFgColor(),re=H.getFgColorMode(),oe=H.getBgColor(),Z=H.getBgColorMode(),ce=!!H.isInverse();if(ce){let J=ee;ee=oe,oe=J;let ie=re;re=Z,Z=ie}let ne,we,xe=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,J=>{J.options.layer!=="top"&&xe||(J.backgroundColorRGB&&(Z=50331648,oe=J.backgroundColorRGB.rgba>>8&16777215,ne=J.backgroundColorRGB),J.foregroundColorRGB&&(re=50331648,ee=J.foregroundColorRGB.rgba>>8&16777215,we=J.foregroundColorRGB),xe=J.options.layer==="top")}),!xe&&F&&(ne=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,oe=ne.rgba>>8&16777215,Z=50331648,xe=!0,y.selectionForeground&&(re=50331648,ee=y.selectionForeground.rgba>>8&16777215,we=y.selectionForeground)),xe&&q.push("xterm-decoration-top");let ye;switch(Z){case 16777216:case 33554432:ye=y.ansi[oe],q.push(`xterm-bg-${oe}`);break;case 50331648:ye=lr.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(C,`background-color:#${cE((oe>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(ye=y.foreground,q.push("xterm-bg-257")):ye=y.background}switch(ne||H.isDim()&&(ne=Dt.multiplyOpacity(ye,.5)),re){case 16777216:case 33554432:H.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(C,ye,y.ansi[ee],H,ne,void 0)||q.push(`xterm-fg-${ee}`);break;case 50331648:let J=lr.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(C,ye,J,H,ne,we)||this._addStyle(C,`color:#${cE(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,ye,y.foreground,H,ne,we)||ce&&q.push("xterm-fg-257")}q.length&&(C.className=q.join(" "),q.length=0),!V&&!$&&!Y&&T?E++:C.textContent=S,W!==this.defaultSpacing&&(C.style.letterSpacing=`${W}px`),p.push(C),j=U}return C&&E&&(C.textContent=S),p}_applyMinimumContrast(e,t,r,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||EY(i.getCode()))return!1;let u=this._getContrastCache(i),d;if(!s&&!o&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Dt.ensureContrastRatio(s||t,o||r,m),u.setColor((s||t).rgba,(o||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};tx=Zt([Ne(1,YM),Ne(2,ri),Ne(3,$s),Ne(4,Ho),Ne(5,pd),Ne(6,cc)],tx);function cE(e,t,r){for(;e.length<r;)e=t+e;return e}var kY=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,i,s,o],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(o),t.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(e,t,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let s=e;t&&(s+="B"),r&&(s+="I");let o=this._holey.get(s);if(o===void 0){let u=0;t&&(u|=1),r&&(u|=2),o=this._measure(e,u),o>0&&this._holey.set(s,o)}return o}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},NY=class{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(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,o=t[1]-s,u=r[1]-s,d=Math.max(o,0),m=Math.min(u,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=u,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function AY(){return new NY}var R_="xterm-dom-renderer-owner-",Hi="xterm-rows",tf="xterm-fg-",uE="xterm-bg-",mu="xterm-focus",rf="xterm-selection",TY=1,rx=class extends tt{constructor(e,t,r,i,s,o,u,d,m,h,v,p,x,y){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=o,this._linkifier2=u,this._charSizeService=m,this._optionsService=h,this._bufferService=v,this._coreService=p,this._coreBrowserService=x,this._themeService=y,this._terminalClass=TY++,this._rowElements=[],this._selectionRenderModel=AY(),this.onRequestRedraw=this._register(new Se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Hi),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(rf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=RY(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(tx,document),this._element.classList.add(R_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(It(()=>{this._element.classList.remove(R_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new kY(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Hi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Hi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Hi} .xterm-dim { color: ${Dt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Hi}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Hi}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Hi}.${mu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${rf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${tf}${o} { color: ${u.css}; }${this._terminalSelector} .${tf}${o}.xterm-dim { color: ${Dt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${uE}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${tf}257 { color: ${Dt.opaque(e.background).css}; }${this._terminalSelector} .${tf}257.xterm-dim { color: ${Dt.multiplyOpacity(Dt.opaque(e.background),.5).css}; }${this._terminalSelector} .${uE}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(mu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(mu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(o,m?t[0]:e[0],m?e[0]:t[0],u-o+1))}else{let m=i===o?e[0]:0,h=o===s?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,m,h));let v=u-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,v)),o!==u){let p=s===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,p))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,i=1){let s=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(r-t);return o+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-o),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${u}px`,s}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let h=m+r.ydisp,v=this._rowElements[m],p=r.lines.get(h);if(!v||!p)break;v.replaceChildren(...this._rowFactory.createRow(p,h,h===i,u,d,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${R_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,i,s,o){r<0&&(e=0),i<0&&(t=0);let u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),i=Math.max(Math.min(i,u),0),s=Math.min(s,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,h=Math.min(d.x,s-1),v=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=r;y<=i;++y){let w=y+d.ydisp,C=this._rowElements[y],E=d.lines.get(w);if(!C||!E)break;C.replaceChildren(...this._rowFactory.createRow(E,w,w===m,p,x,h,v,this.dimensions.css.cell.width,this._widthCache,o?y===r?e:0:-1,o?(y===i?t:s)-1:-1))}}};rx=Zt([Ne(7,Iy),Ne(8,Bm),Ne(9,ri),Ne(10,ti),Ne(11,Ho),Ne(12,$s),Ne(13,cc)],rx);var ix=class extends tt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new jY(this._optionsService))}catch{this._measureStrategy=this._register(new MY(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};ix=Zt([Ne(2,ri)],ix);var fj=class extends tt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},MY=class extends fj{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},jY=class extends fj{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},DY=class extends tt{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new LY(this._window)),this._onDprChange=this._register(new Se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(zr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(We(this._textarea,"focus",()=>this._isFocused=!0)),this._register(We(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},LY=class extends tt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ql),this._onDprChange=this._register(new Se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(It(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=We(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},OY=class extends tt{constructor(){super(),this.linkProviders=[],this._register(It(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Vy(e,t,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),o=parseInt(s.getPropertyValue("padding-left")),u=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function BY(e,t,r,i,s,o,u,d,m){if(!o)return;let h=Vy(e,t,r);if(h)return h[0]=Math.ceil((h[0]+(m?u/2:0))/u),h[1]=Math.ceil(h[1]/d),h[0]=Math.min(Math.max(h[0],1),i+(m?1:0)),h[1]=Math.min(Math.max(h[1],1),s),h}var nx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,s){return BY(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let r=Vy(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};nx=Zt([Ne(0,Us),Ne(1,Bm)],nx);var PY=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},mj={};GV(mj,{getSafariVersion:()=>zY,isChromeOS:()=>_j,isFirefox:()=>pj,isIpad:()=>$Y,isIphone:()=>UY,isLegacyEdge:()=>IY,isLinux:()=>Gy,isMac:()=>Yf,isNode:()=>Pm,isSafari:()=>gj,isWindows:()=>vj});var Pm=typeof process<"u"&&"title"in process,gd=Pm?"node":navigator.userAgent,vd=Pm?"node":navigator.platform,pj=gd.includes("Firefox"),IY=gd.includes("Edge"),gj=/^((?!chrome|android).)*safari/i.test(gd);function zY(){if(!gj)return 0;let e=gd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vd),$Y=vd==="iPad",UY=vd==="iPhone",vj=["Windows","Win16","Win32","WinCE"].includes(vd),Gy=vd.indexOf("Linux")>=0,_j=/\bCrOS\b/.test(gd),xj=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},HY=class extends xj{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},FY=class extends xj{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Kf=!Pm&&"requestIdleCallback"in window?FY:HY,WY=class{constructor(){this._queue=new Kf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sx=class extends tt{constructor(e,t,r,i,s,o,u,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=d,this._renderer=this._register(new Ql),this._pausedResizeTask=new WY,this._observerDisposable=this._register(new Ql),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 Se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new PY((h,v)=>this._renderRows(h,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new qY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(It(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=It(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};sx=Zt([Ne(2,ri),Ne(3,Bm),Ne(4,Ho),Ne(5,pd),Ne(6,ti),Ne(7,$s),Ne(8,cc)],sx);var qY=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function VY(e,t,r,i){let s=r.buffer.x,o=r.buffer.y;if(!r.buffer.hasScrollback)return KY(s,o,e,t,r,i)+Im(o,t,r,i)+XY(s,o,e,t,r,i);let u;if(o===t)return u=s>e?"D":"C",Xu(Math.abs(s-e),Ku(u,i));u=o>t?"D":"C";let d=Math.abs(o-t),m=YY(o>t?e:s,r)+(d-1)*r.cols+1+GY(o>t?s:e);return Xu(m,Ku(u,i))}function GY(e,t){return e-1}function YY(e,t){return t.cols-e}function KY(e,t,r,i,s,o){return Im(t,i,s,o).length===0?"":Xu(bj(e,t,e,t-Mo(t,s),!1,s).length,Ku("D",o))}function Im(e,t,r,i){let s=e-Mo(e,r),o=t-Mo(t,r),u=Math.abs(s-o)-ZY(e,t,r);return Xu(u,Ku(yj(e,t),i))}function XY(e,t,r,i,s,o){let u;Im(t,i,s,o).length>0?u=i-Mo(i,s):u=t;let d=i,m=QY(e,t,r,i,s,o);return Xu(bj(e,u,r,d,m==="C",s).length,Ku(m,o))}function ZY(e,t,r){var u;let i=0,s=e-Mo(e,r),o=t-Mo(t,r);for(let d=0;d<Math.abs(s-o);d++){let m=yj(e,t)==="A"?-1:1;(u=r.buffer.lines.get(s+m*d))!=null&&u.isWrapped&&i++}return i}function Mo(e,t){let r=0,i=t.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function QY(e,t,r,i,s,o){let u;return Im(r,i,s,o).length>0?u=i-Mo(i,s):u=t,e<r&&u<=i||e>=r&&u<i?"C":"D"}function yj(e,t){return e>t?"A":"B"}function bj(e,t,r,i,s,o){let u=e,d=t,m="";for(;(u!==r||d!==i)&&d>=0&&d<o.buffer.lines.length;)u+=s?1:-1,s&&u>o.cols-1?(m+=o.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!s&&u<0&&(m+=o.buffer.translateBufferLineToString(d,!1,0,e+1),u=o.cols-1,e=u,d--);return m+o.buffer.translateBufferLineToString(d,!1,e,u)}function Ku(e,t){let r=t?"O":"[";return ge.ESC+r+e}function Xu(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var JY=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function dE(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var k_=50,eK=15,tK=50,rK=500,iK=" ",nK=new RegExp(iK,"g"),ax=class extends tt{constructor(e,t,r,i,s,o,u,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=o,this._optionsService=u,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Xi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new JY(this._bufferService),this._activeSelectionMode=0,this._register(It(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let d=r.translateBufferLineToString(u,!0,s,o);i.push(d)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let o=e[1]+1;o<=t[1]-1;o++){let u=r.lines.get(o),d=r.translateBufferLineToString(o,!0);u!=null&&u.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(s=>s.replace(nK," ")).join(vj?`\r
661
+ `:`
662
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Gy&&e&&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(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,o;let r=(o=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=dE(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Vy(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-k_),k_),t/=k_,t/Math.abs(t)+Math.round(t*(eK-1)))}shouldForceSelection(e){return Yf?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),tK)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Yf&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<rK&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=VY(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&t!==i&&(r+=s-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let u=s.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),m=d,h=e[0]-d,v=0,p=0,x=0,y=0;if(u.charAt(d)===" "){for(;d>0&&u.charAt(d-1)===" ";)d--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let E=e[0],S=e[0];o.getWidth(E)===0&&(v++,E--),o.getWidth(S)===2&&(p++,S++);let N=o.getString(S).length;for(N>1&&(y+=N-1,m+=N-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):k>1&&(x+=k-1,d-=k-1),d--,E--}for(;S<o.length&&m+1<u.length&&!this._isCharWordSeparator(o.loadCell(S+1,this._workCell));){o.loadCell(S+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,S++):k>1&&(y+=k-1,m+=k-1),m++,S++}}m++;let w=d+h-v+x,C=Math.min(this._bufferService.cols,m-d+v+p-x-y);if(!(!t&&u.slice(d,m).trim()==="")){if(r&&w===0&&o.getCodePoint(0)!==32){let E=s.lines.get(e[1]-1);if(E&&o.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let N=this._bufferService.cols-S.start;w-=N,C+=N}}}if(i&&w+C===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=s.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(C+=S.length)}}return{start:w,length:C}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=dE(r,this._bufferService.cols)}};ax=Zt([Ne(3,ti),Ne(4,Ho),Ne(5,zy),Ne(6,ri),Ne(7,Us),Ne(8,$s)],ax);var hE=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},fE=class{constructor(){this._color=new hE,this._css=new hE}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},fr=Object.freeze((()=>{let e=[$t.toColor("#2e3436"),$t.toColor("#cc0000"),$t.toColor("#4e9a06"),$t.toColor("#c4a000"),$t.toColor("#3465a4"),$t.toColor("#75507b"),$t.toColor("#06989a"),$t.toColor("#d3d7cf"),$t.toColor("#555753"),$t.toColor("#ef2929"),$t.toColor("#8ae234"),$t.toColor("#fce94f"),$t.toColor("#729fcf"),$t.toColor("#ad7fa8"),$t.toColor("#34e2e2"),$t.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],s=t[r/6%6|0],o=t[r%6];e.push({css:lr.toCss(i,s,o),rgba:lr.toRgba(i,s,o)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:lr.toCss(i,i,i),rgba:lr.toRgba(i,i,i)})}return e})()),mo=$t.toColor("#ffffff"),Nu=$t.toColor("#000000"),mE=$t.toColor("#ffffff"),pE=Nu,pu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},sK=mo,ox=class extends tt{constructor(e){super(),this._optionsService=e,this._contrastCache=new fE,this._halfContrastCache=new fE,this._onChangeColors=this._register(new Se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:mo,background:Nu,cursor:mE,cursorAccent:pE,selectionForeground:void 0,selectionBackgroundTransparent:pu,selectionBackgroundOpaque:Dt.blend(Nu,pu),selectionInactiveBackgroundTransparent:pu,selectionInactiveBackgroundOpaque:Dt.blend(Nu,pu),scrollbarSliderBackground:Dt.opacity(mo,.2),scrollbarSliderHoverBackground:Dt.opacity(mo,.4),scrollbarSliderActiveBackground:Dt.opacity(mo,.5),overviewRulerBorder:mo,ansi:fr.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Et(e.foreground,mo),t.background=Et(e.background,Nu),t.cursor=Dt.blend(t.background,Et(e.cursor,mE)),t.cursorAccent=Dt.blend(t.background,Et(e.cursorAccent,pE)),t.selectionBackgroundTransparent=Et(e.selectionBackground,pu),t.selectionBackgroundOpaque=Dt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Et(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Dt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Et(e.selectionForeground,lE):void 0,t.selectionForeground===lE&&(t.selectionForeground=void 0),Dt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Dt.opacity(t.selectionBackgroundTransparent,.3)),Dt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Dt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Et(e.scrollbarSliderBackground,Dt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Et(e.scrollbarSliderHoverBackground,Dt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Et(e.scrollbarSliderActiveBackground,Dt.opacity(t.foreground,.5)),t.overviewRulerBorder=Et(e.overviewRulerBorder,sK),t.ansi=fr.slice(),t.ansi[0]=Et(e.black,fr[0]),t.ansi[1]=Et(e.red,fr[1]),t.ansi[2]=Et(e.green,fr[2]),t.ansi[3]=Et(e.yellow,fr[3]),t.ansi[4]=Et(e.blue,fr[4]),t.ansi[5]=Et(e.magenta,fr[5]),t.ansi[6]=Et(e.cyan,fr[6]),t.ansi[7]=Et(e.white,fr[7]),t.ansi[8]=Et(e.brightBlack,fr[8]),t.ansi[9]=Et(e.brightRed,fr[9]),t.ansi[10]=Et(e.brightGreen,fr[10]),t.ansi[11]=Et(e.brightYellow,fr[11]),t.ansi[12]=Et(e.brightBlue,fr[12]),t.ansi[13]=Et(e.brightMagenta,fr[13]),t.ansi[14]=Et(e.brightCyan,fr[14]),t.ansi[15]=Et(e.brightWhite,fr[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=Et(e.extendedAnsi[i],fr[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};ox=Zt([Ne(0,ri)],ox);function Et(e,t){if(e!==void 0)try{return $t.toColor(e)}catch{}return t}var aK=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},oK=class{constructor(){this._services=new aK,this._services.set(Iy,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=eG(e).sort((o,u)=>o.index-u.index),i=[];for(let o of r){let u=this._services.get(o.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(u)}let s=r.length>0?r[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},lK={trace:0,debug:1,info:2,warn:3,error:4,off:5},cK="xterm.js: ",lx=class extends tt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=lK[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":cK)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};lx=Zt([Ne(0,ri)],lx);var gE=class extends tt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=t-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Je=3,ar=Object.freeze(new md),nf=0,N_=2,Au=class wj{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Je);let s=r||Xi.fromCharData([0,UM,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let r=this._data[t*Je+0],i=r&2097151;return[this._data[t*Je+1],r&2097152?this._combined[t]:i?wa(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*Je+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Je+0]=t|2097152|r[2]<<22):this._data[t*Je+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Je+0]>>22}hasWidth(t){return this._data[t*Je+0]&12582912}getFg(t){return this._data[t*Je+1]}getBg(t){return this._data[t*Je+2]}hasContent(t){return this._data[t*Je+0]&4194303}getCodePoint(t){let r=this._data[t*Je+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Je+0]&2097152}getString(t){let r=this._data[t*Je+0];return r&2097152?this._combined[t]:r&2097151?wa(r&2097151):""}isProtected(t){return this._data[t*Je+2]&536870912}loadCell(t,r){return nf=t*Je,r.content=this._data[nf+0],r.fg=this._data[nf+1],r.bg=this._data[nf+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Je+0]=r.content,this._data[t*Je+1]=r.fg,this._data[t*Je+2]=r.bg}setCellFromCodepoint(t,r,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Je+0]=r|i<<22,this._data[t*Je+1]=s.fg,this._data[t*Je+2]=s.bg}addCodepointToCell(t,r,i){let s=this._data[t*Je+0];s&2097152?this._combined[t]+=wa(r):s&2097151?(this._combined[t]=wa(s&2097151)+wa(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*Je+0]=s}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let s=new Xi;for(let o=this.length-t-r-1;o>=0;--o)this.setCell(t+r+o,this.loadCell(t+o,s));for(let o=0;o<r;++o)this.setCell(t+o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let s=new Xi;for(let o=0;o<this.length-t-r;++o)this.setCell(t+o,this.loadCell(t+r+o,s));for(let o=this.length-r;o<this.length;++o)this.setCell(o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*N_<this._data.buffer.byteLength;let i=t*Je;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let u=0;u<s.length;u++){let d=parseInt(s[u],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let u=0;u<o.length;u++){let d=parseInt(o[u],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*N_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*N_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new wj(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303)return t+(this._data[t*Je+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303||this._data[t*Je+2]&50331648)return t+(this._data[t*Je+0]>>22);return 0}copyCellsFrom(t,r,i,s,o){let u=t._data;if(o)for(let m=s-1;m>=0;m--){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let h=parseInt(d[m],10);h>=r&&(this._combined[h-r+i]=t._combined[h])}}translateToString(t,r,i,s){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let o="";for(;r<i;){let u=this._data[r*Je+0],d=u&2097151,m=u&2097152?this._combined[r]:d?wa(d):Ca;if(o+=m,s)for(let h=0;h<m.length;++h)s.push(r);r+=u>>22||1}return s&&s.push(r),o}};function uK(e,t,r,i,s,o){let u=[];for(let d=0;d<e.length-1;d++){let m=d,h=e.get(++m);if(!h.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&h.isWrapped;)v.push(h),h=e.get(++m);if(!o&&i>=d&&i<m){d+=v.length-1;continue}let p=0,x=Zu(v,p,t),y=1,w=0;for(;y<v.length;){let E=Zu(v,y,t),S=E-w,N=r-x,k=Math.min(S,N);v[p].copyCellsFrom(v[y],w,x,k,!1),x+=k,x===r&&(p++,x=0),w+=k,w===E&&(y++,w=0),x===0&&p!==0&&v[p-1].getWidth(r-1)===2&&(v[p].copyCellsFrom(v[p-1],r-1,x++,1,!1),v[p-1].setCell(r-1,s))}v[p].replaceCells(x,r,s);let C=0;for(let E=v.length-1;E>0&&(E>p||v[E].getTrimmedLength()===0);E--)C++;C>0&&(u.push(d+v.length-C),u.push(C)),d+=v.length-1}return u}function dK(e,t){let r=[],i=0,s=t[i],o=0;for(let u=0;u<e.length;u++)if(s===u){let d=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:d}),u+=d-1,o+=d,s=t[++i]}else r.push(u);return{layout:r,countRemoved:o}}function hK(e,t){let r=[];for(let i=0;i<t.length;i++)r.push(e.get(t[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=t.length}function fK(e,t,r){let i=[],s=e.map((m,h)=>Zu(e,h,t)).reduce((m,h)=>m+h),o=0,u=0,d=0;for(;d<s;){if(s-d<r){i.push(s-d);break}o+=r;let m=Zu(e,u,t);o>m&&(o-=m,u++);let h=e[u].getWidth(o-1)===2;h&&o--;let v=h?r-1:r;i.push(v),d+=v}return i}function Zu(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,s=e[t+1].getWidth(0)===2;return i&&s?r-1:r}var Sj=class Cj{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Cj._nextId++,this._onDispose=this.register(new Se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),To(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Sj._nextId=1;var mK=Sj,gr={},po=gr.B;gr[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:"≥","{":"π","|":"≠","}":"£","~":"·"};gr.A={"#":"£"};gr.B=void 0;gr[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gr.C=gr[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gr.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gr.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gr.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gr.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gr.E=gr[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gr.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gr.H=gr[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gr["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var vE=4294967295,_E=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ar.clone(),this.savedCharset=po,this.markers=[],this._nullCell=Xi.fromCharData([0,UM,1,0]),this._whitespaceCell=Xi.fromCharData([0,Ca,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Kf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new gE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new qf),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new qf),this._whitespaceCell}getBlankLine(e,t){return new Au(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>vE?vE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ar);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new gE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(ar),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,r);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Au(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Au(e,r)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let u=this.lines.length-s;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=uK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ar),r);if(i.length>0){let s=dK(this.lines,i);hK(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(ar),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Au(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(ar),s=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),m.unshift(d);if(!r){let k=this.ybase+this.y;if(k>=u&&k<u+m.length)continue}let h=m[m.length-1].getTrimmedLength(),v=fK(m,this._cols,e),p=v.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+p):x=Math.max(0,this.lines.length-this.lines.maxLength+p);let y=[];for(let k=0;k<p;k++){let R=this.getBlankLine(ar,!0);y.push(R)}y.length>0&&(s.push({start:u+m.length+o,newLines:y}),o+=y.length),m.push(...y);let w=v.length-1,C=v[w];C===0&&(w--,C=v[w]);let E=m.length-p-1,S=h;for(;E>=0;){let k=Math.min(S,C);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[E],S-k,C-k,k,!0),C-=k,C===0&&(w--,C=v[w]),S-=k,S===0){E--;let R=Math.max(E,0);S=Zu(m,R,this._cols)}}for(let k=0;k<m.length;k++)v[k]<e&&m[k].setCell(v[k],i);let N=p-x;for(;N-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(s.length>0){let u=[],d=[];for(let C=0;C<this.lines.length;C++)d.push(this.lines.get(C));let m=this.lines.length,h=m-1,v=0,p=s[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let x=0;for(let C=Math.min(this.lines.maxLength-1,m+o-1);C>=0;C--)if(p&&p.start>h+x){for(let E=p.newLines.length-1;E>=0;E--)this.lines.set(C--,p.newLines[E]);C++,u.push({index:h+1,amount:p.newLines.length}),x+=p.newLines.length,p=s[++v]}else this.lines.set(C,d[h--]);let y=0;for(let C=u.length-1;C>=0;C--)u[C].index+=y,this.lines.onInsertEmitter.fire(u[C]),y+=u[C].amount;let w=Math.max(0,m+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,r=0,i){let s=this.lines.get(e);return s?s.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new mK(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},pK=class extends tt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Se),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 _E(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new _E(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Ej=2,Rj=1,cx=class extends tt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ej),this.rows=Math.max(e.rawOptions.rows||0,Rj),this.buffers=this._register(new pK(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(r.scrollTop===0){let u=r.lines.isFull;o===r.lines.length-1?u?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(o+1,0,i.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=o-s+1;r.lines.shiftElements(s+1,u-1,-1),r.lines.set(o,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};cx=Zt([Ne(0,ri)],cx);var Bl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Yf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},gK=["normal","bold","100","200","300","400","500","600","700","800","900"],vK=class extends tt{constructor(e){super(),this._onOptionChange=this._register(new Se),this.onOptionChange=this._onOptionChange.event;let t={...Bl};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(It(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Bl[e]),!_K(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=gK.includes(t)?t:Bl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function _K(e){return e==="block"||e==="underline"||e==="bar"}function Tu(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=t<=1?e[i]:e[i]&&Tu(e[i],t-1);return r}var xE=Object.freeze({insertMode:!1}),yE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ux=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Se),this.onData=this._onData.event,this._onUserInput=this._register(new Se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Tu(xE),this.decPrivateModes=Tu(yE)}reset(){this.modes=Tu(xE),this.decPrivateModes=Tu(yE)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};ux=Zt([Ne(0,ti),Ne(1,VM),Ne(2,ri)],ux);var bE={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function A_(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var T_=String.fromCharCode,wE={DEFAULT:e=>{let t=[A_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${T_(t[0])}${T_(t[1])}${T_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${A_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${A_(e,!0)};${e.x};${e.y}${t}`}},dx=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Se),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(bE))this.addProtocol(i,bE[i]);for(let i of Object.keys(wE))this.addEncoding(i,wE[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};dx=Zt([Ne(0,ti),Ne(1,Ho),Ne(2,ri)],dx);var M_=[[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]],xK=[[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]],mr;function yK(e,t){let r=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>t[s][1])r=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var bK=class{constructor(){if(this.version="6",!mr){mr=new Uint8Array(65536),mr.fill(1),mr[0]=0,mr.fill(0,1,32),mr.fill(0,127,160),mr.fill(2,4352,4448),mr[9001]=2,mr[9002]=2,mr.fill(2,11904,42192),mr[12351]=1,mr.fill(2,44032,55204),mr.fill(2,63744,64256),mr.fill(2,65040,65050),mr.fill(2,65072,65136),mr.fill(2,65280,65377),mr.fill(2,65504,65511);for(let e=0;e<M_.length;++e)mr.fill(0,M_[e][0],M_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?mr[e]:yK(e,xK)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let s=_o.extractWidth(t);s===0?i=!1:s>r&&(r=s)}return _o.createPropertyValue(0,r,i)}},_o=class Sf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Se,this.onChange=this._onChange.event;let t=new bK;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,s=t.length;for(let o=0;o<s;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=s)return r+this.wcwidth(u);let h=t.charCodeAt(o);56320<=h&&h<=57343?u=(u-55296)*1024+h-56320+65536:r+=this.wcwidth(h)}let d=this.charProperties(u,i),m=Sf.extractWidth(d);Sf.extractShouldJoin(d)&&(m-=Sf.extractWidth(i)),r+=m,i=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},wK=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function SE(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var gu=2147483647,SK=256,kj=class hx{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>SK)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new hx;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let o=0;o<s.length;++o)r.addSubParam(s[o]);else r.addParam(s)}return r}clone(){let t=new hx(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>gu?gu:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>gu?gu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(t[r]=this._subParams.slice(i,s))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+t,gu):t}},vu=[],CK=class{constructor(){this._state=0,this._active=vu,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vu}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=vu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vu,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Om(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=vu,this._id=-1,this._state=0}}},Ni=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Om(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},_u=[],EK=class{constructor(){this._handlers=Object.create(null),this._active=_u,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_u}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,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=_u,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||_u,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Om(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=_u,this._ident=0}},Mu=new kj;Mu.addParam(0);var CE=class{constructor(e){this._handler=e,this._data="",this._params=Mu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Mu,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Om(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=Mu,this._data="",this._hitLimit=!1,r));return this._params=Mu,this._data="",this._hitLimit=!1,t}},RK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=r<<4|i}},Vi=160,kK=(function(){let e=new RK(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Vi,0,2,0),e.add(Vi,8,5,8),e.add(Vi,6,0,6),e.add(Vi,11,0,11),e.add(Vi,13,13,13),e})(),NK=class extends tt{constructor(e=kK){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new kj,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(It(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new CK),this._dcsParser=this._register(new EK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let o=e.intermediates.charCodeAt(s);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,r,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,r){let i=0,s=0,o=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],u=this._oscParser.end(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],s=this._transitions.table[this.currentState<<8|(i<160?i:Vi)],s>>4){case 2:for(let x=d+1;;++x){if(x>=t||(i=e[x])<32||i>126&&i<Vi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Vi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Vi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Vi){this._printHandler(e,d,x),d=x-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|i],h=m?m.length-1:-1;for(;h>=0&&(u=m[h](this._params),u!==!0);h--)if(u instanceof Promise)return this._preserveStack(3,m,h,s,d),u;h<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let v=this._escHandlers[this._collect<<8|i],p=v?v.length-1:-1;for(;p>=0&&(u=v[p](),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(4,v,p,s,d),u;p<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let x=d+1;;++x)if(x>=t||(i=e[x])===24||i===26||i===27||i>127&&i<Vi){this._dcsParser.put(e,d,x),d=x-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,s,d),u;i===27&&(s|=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 x=d+1;;x++)if(x>=t||(i=e[x])<32||i>127&&i<Vi){this._oscParser.put(e,d,x),d=x-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,s,d),u;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},AK=/^([\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})$/,TK=/^[\da-f]+$/;function EE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=AK.exec(t);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),TK.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let o=parseInt(t.slice(r*s,r*s+r),16);i[s]=r===1?o<<4:r===2?o:r===3?o>>4:o>>8}return i}}function j_(e,t){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function MK(e,t=16){let[r,i,s]=e;return`rgb:${j_(r,t)}/${j_(i,t)}/${j_(s,t)}`}var jK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},_a=131072,RE=10;function kE(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var NE=5e3,AE=0,DK=class extends tt{constructor(e,t,r,i,s,o,u,d,m=new NK){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new QV,this._utf8Decoder=new JV,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ar.clone(),this._eraseAttrDataInternal=ar.clone(),this._onRequestBell=this._register(new Se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Se),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 fx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:v.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,v,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:v,data:p})}),this._parser.setDcsHandlerFallback((h,v,p)=>{v==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:v,payload:p})}),this._parser.setPrintHandler((h,v,p)=>this.print(h,v,p)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ge.BEL,()=>this.bell()),this._parser.setExecuteHandler(ge.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ge.BS,()=>this.backspace()),this._parser.setExecuteHandler(ge.HT,()=>this.tab()),this._parser.setExecuteHandler(ge.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ge.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(bf.IND,()=>this.index()),this._parser.setExecuteHandler(bf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ni(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ni(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ni(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ni(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ni(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ni(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ni(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ni(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ni(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ni(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ni(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ni(h=>this.restoreCursorColor(h))),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(let h in gr)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new CE((h,v)=>this.requestStatusString(h,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),NE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${NE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,o=0,u=this._parseStack.paused;if(u){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>_a&&(o=this._parseStack.position+_a)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<_a&&(this._parseBuffer=new Uint32Array(Math.min(e.length,_a))),u||this._dirtyRowTracker.clearRange(),e.length>_a)for(let h=o;h<e.length;h+=_a){let v=h+_a<e.length?h+_a:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(h,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,s,p,h),this._logSlowResolvingAsync(r),r}else if(!u){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,s,h,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let i,s,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,v=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let x=this._parser.precedingJoinState;for(let y=t;y<r;++y){if(i=e[y],i<127&&o){let S=o[String.fromCharCode(i)];S&&(i=S.charCodeAt(0))}let w=this._unicodeService.charProperties(i,x);s=_o.extractWidth(w);let C=_o.extractShouldJoin(w),E=C?_o.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(wa(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-E>d){if(m){let S=p,N=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&p instanceof Au&&p.copyCellsFrom(S,N,0,E,!1);N<d;)S.setCellFromCodepoint(N++,0,1,v)}else if(this._activeBuffer.x=d-1,s===2)continue}if(C&&this._activeBuffer.x){let S=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-S,i,s);for(let N=s-E;--N>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(h&&(p.insertCells(this._activeBuffer.x,s-E,this._activeBuffer.getNullCell(v)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,v)),p.setCellFromCodepoint(this._activeBuffer.x++,i,s,v),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=x,this._activeBuffer.x<d&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>kE(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new CE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ni(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(ar));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,i=_o.extractWidth(t),s=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),u=new Uint32Array(o.length*r),d=0;for(let h=0;h<o.length;){let v=o.codePointAt(h)||0;u[d++]=v,h+=v>65535?2:1}let m=d;for(let h=1;h<r;++h)u.copyWithin(m,0,d),m+=d;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ge.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ge.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ge.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ge.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ge.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,po),this._charsetService.setgCharset(1,po),this._charsetService.setgCharset(2,po),this._charsetService.setgCharset(3,po);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:h,alt:v}=d,p=this._optionsService.rawOptions,x=(C,E)=>(u.triggerDataEvent(`${ge.ESC}[${t?"":"?"}${C};${E}$y`),!0),y=C=>C?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,y(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,y(p.convertEol)):x(w,0):w===1?x(w,y(i.applicationCursorKeys)):w===3?x(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?x(w,y(i.origin)):w===7?x(w,y(i.wraparound)):w===8?x(w,3):w===9?x(w,y(s==="X10")):w===12?x(w,y(p.cursorBlink)):w===25?x(w,y(!u.isCursorHidden)):w===45?x(w,y(i.reverseWraparound)):w===66?x(w,y(i.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,y(s==="VT200")):w===1002?x(w,y(s==="DRAG")):w===1003?x(w,y(s==="ANY")):w===1004?x(w,y(i.sendFocus)):w===1005?x(w,4):w===1006?x(w,y(o==="SGR")):w===1015?x(w,4):w===1016?x(w,y(o==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,y(h===v)):w===2004?x(w,y(i.bracketedPasteMode)):w===2026?x(w,y(i.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,r,i,s){return t===2?(e|=50331648,e&=-16777216,e|=md.fromColorRGB([r,i,s])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],s=0,o=0;do{if(i[o+s]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),d=0;do i[1]===5&&(s=1),i[o+d+1+s]=u[d];while(++d<u.length&&d+o+1+s<i.length);break}if(i[1]===5&&o+s>=2||i[1]===2&&o+s>=5)break;i[1]&&(s=1)}while(++o+t<e.length&&o+s<i.length);for(let u=2;u<i.length;++u)i[u]===-1&&(i[u]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ar.fg,e.bg=ar.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let s=0;s<t;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=ar.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=ar.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=ar.fg&16777215,i.bg&=-67108864,i.bg|=ar.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ge.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ar.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!kE(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ge.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>RE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>RE&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(TE(o))if(s==="?")t.push({type:0,index:o});else{let u=EE(s);u&&t.push({type:1,index:o,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(o=>o.startsWith("id="));return s!==-1&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=EE(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);TE(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,po),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(jK[e[0]],gr[e[1]]||po),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=ar.clone(),this._eraseAttrDataInternal=ar.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Xi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=u=>(this._coreService.triggerDataEvent(`${ge.ESC}${u}${ge.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},fx=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(AE=e,e=t,t=AE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};fx=Zt([Ne(0,ti)],fx);function TE(e){return 0<=e&&e<256}var LK=5e7,ME=12,OK=50,BK=class extends tt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>LK)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,t);if(s){let u=d=>performance.now()-r>=ME?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);s.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(u);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=ME)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>OK&&(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()}},mx=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let o=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mx=Zt([Ne(0,ti)],mx);var jE=!1,PK=class extends tt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ql),this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onData=this._register(new Se),this.onData=this._onData.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Se),this._instantiationService=new oK,this.optionsService=this._register(new vK(e)),this._instantiationService.setService(ri,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(cx)),this._instantiationService.setService(ti,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(lx)),this._instantiationService.setService(VM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ux)),this._instantiationService.setService(Ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(dx)),this._instantiationService.setService(qM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(_o)),this._instantiationService.setService(iG,this.unicodeService),this._charsetService=this._instantiationService.createInstance(wK),this._instantiationService.setService(rG,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mx),this._instantiationService.setService(GM,this._oscLinkService),this._inputHandler=this._register(new DK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(zr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(zr.forward(this._bufferService.onResize,this._onResize)),this._register(zr.forward(this.coreService.onData,this._onData)),this._register(zr.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new BK((t,r)=>this._inputHandler.parse(t,r))),this._register(zr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!jE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),jE=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Ej),t=Math.max(t,Rj),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(SE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(SE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=It(()=>{for(let t of e)t.dispose()})}}},IK={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:["'",'"']};function zK(e,t,r,i){var u;let s={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":ge.DEL,e.altKey&&(s.key=ge.ESC+s.key);break;case 9:if(e.shiftKey){s.key=ge.ESC+"[Z";break}s.key=ge.HT,s.cancel=!0;break;case 13:s.key=e.altKey?ge.ESC+ge.CR:ge.CR,s.cancel=!0;break;case 27:s.key=ge.ESC,e.altKey&&(s.key=ge.ESC+ge.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"D":t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"C":t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"A":t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"B":t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=ge.ESC+"[2~");break;case 46:o?s.key=ge.ESC+"[3;"+(o+1)+"~":s.key=ge.ESC+"[3~";break;case 36:o?s.key=ge.ESC+"[1;"+(o+1)+"H":t?s.key=ge.ESC+"OH":s.key=ge.ESC+"[H";break;case 35:o?s.key=ge.ESC+"[1;"+(o+1)+"F":t?s.key=ge.ESC+"OF":s.key=ge.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=ge.ESC+"[5;"+(o+1)+"~":s.key=ge.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=ge.ESC+"[6;"+(o+1)+"~":s.key=ge.ESC+"[6~";break;case 112:o?s.key=ge.ESC+"[1;"+(o+1)+"P":s.key=ge.ESC+"OP";break;case 113:o?s.key=ge.ESC+"[1;"+(o+1)+"Q":s.key=ge.ESC+"OQ";break;case 114:o?s.key=ge.ESC+"[1;"+(o+1)+"R":s.key=ge.ESC+"OR";break;case 115:o?s.key=ge.ESC+"[1;"+(o+1)+"S":s.key=ge.ESC+"OS";break;case 116:o?s.key=ge.ESC+"[15;"+(o+1)+"~":s.key=ge.ESC+"[15~";break;case 117:o?s.key=ge.ESC+"[17;"+(o+1)+"~":s.key=ge.ESC+"[17~";break;case 118:o?s.key=ge.ESC+"[18;"+(o+1)+"~":s.key=ge.ESC+"[18~";break;case 119:o?s.key=ge.ESC+"[19;"+(o+1)+"~":s.key=ge.ESC+"[19~";break;case 120:o?s.key=ge.ESC+"[20;"+(o+1)+"~":s.key=ge.ESC+"[20~";break;case 121:o?s.key=ge.ESC+"[21;"+(o+1)+"~":s.key=ge.ESC+"[21~";break;case 122:o?s.key=ge.ESC+"[23;"+(o+1)+"~":s.key=ge.ESC+"[23~";break;case 123:o?s.key=ge.ESC+"[24;"+(o+1)+"~":s.key=ge.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=ge.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=ge.DEL:e.keyCode===219?s.key=ge.ESC:e.keyCode===220?s.key=ge.FS:e.keyCode===221&&(s.key=ge.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let d=(u=IK[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)s.key=ge.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(m);e.shiftKey&&(h=h.toUpperCase()),s.key=ge.ESC+h}else if(e.keyCode===32)s.key=ge.ESC+(e.ctrlKey?ge.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),s.key=ge.ESC+m,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=ge.US),e.key==="@"&&(s.key=ge.NUL));break}return s}var er=0,$K=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Kf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Kf,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,o)=>this._getKey(s)-this._getKey(o)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[s]=e[t],t++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(er=this._search(t),er===-1)||this._getKey(this._array[er])!==t)return!1;do if(this._array[er]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(er),!0;while(++er<this._array.length&&this._getKey(this._array[er])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(er=this._search(e),!(er<0||er>=this._array.length)&&this._getKey(this._array[er])===e))do yield this._array[er];while(++er<this._array.length&&this._getKey(this._array[er])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(er=this._search(e),!(er<0||er>=this._array.length)&&this._getKey(this._array[er])===e))do t(this._array[er]);while(++er<this._array.length&&this._getKey(this._array[er])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},D_=0,DE=0,UK=class extends tt{constructor(){super(),this._decorations=new $K(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(It(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new HK(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let i=0,s=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,s=i+(o.options.width??1),e>=i&&e<s&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,s=>{D_=s.options.x??0,DE=D_+(s.options.width??1),e>=D_&&e<DE&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},HK=class extends ka{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=$t.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=$t.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},FK=1e3,WK=class{constructor(e,t=FK){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,o=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},LE=20,Xf=class extends tt{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new WK(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
663
+ `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(We(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(It(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<LE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
664
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===LE+1&&(this._liveRegion.textContent+=L0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=t;s++){let o=r.lines.get(r.ydisp+s),u=[],d=(o==null?void 0:o.translateToString(!0,void 0,void 0,u))||"",m=(r.ydisp+s+1).toString(),h=this._rowElements[s];h&&(d.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=d,this._rowColumns.set(h,u)),h.setAttribute("aria-posinset",m),h.setAttribute("aria-setsize",i),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===o||e.relatedTarget!==i)return;let u,d;if(t===0?(u=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(u=this._rowElements.shift(),d=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((d=i.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:m,offset:h})=>{let v=m instanceof Text?m.parentNode:m,p=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let x=this._rowColumns.get(v);if(!x)return console.warn("columns is null. Race condition?"),null;let y=h<x.length?x[h]:x.slice(-1)[0]+1;return y>=this._terminal.cols&&(++p,y=0),{row:p,column:y}},o=s(t),u=s(r);if(!(!o||!u)){if(o.row>u.row||o.row===u.row&&o.column>=u.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(u.row-o.row)*this._terminal.cols-o.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,o;e.style.transform="";let t=e.getBoundingClientRect().width,r=(o=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:o[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Xf=Zt([Ne(1,Iy),Ne(2,$s),Ne(3,Us)],Xf);var px=class extends tt{constructor(e,t,r,i,s){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(It(()=>{var o;To(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(We(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(We(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(We(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(We(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(o=>{o==null||o.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[o,u]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(o)&&(r=this._checkLinkProviderResult(o,e,r)):u.provideLinks(e.y,d=>{var h,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(p=>({link:p}));(h=this._activeProviderReplies)==null||h.set(o,m),r=this._checkLinkProviderResult(o,e,r),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let s=t.get(i);if(s)for(let o=0;o<s.length;o++){let u=s[o],d=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let h=d;h<=m;h++){if(r.has(h)){s.splice(o--,1);break}r.add(h)}}}}_checkLinkProviderResult(e,t,r){var o;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(s=!0);if(!s&&i){let u=i.find(d=>this._linkAtPosition(d.link,t));u&&(r=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let u=0;u<this._activeProviderReplies.size;u++){let d=(o=this._activeProviderReplies.get(u))==null?void 0:o.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&qK(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,To(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,o;(i=this._currentLink)!=null&&i.state&&((o=(s=this._currentLink)==null?void 0:s.state)==null?void 0:o.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return r<=s&&s<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,s){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};px=Zt([Ne(1,zy),Ne(2,Us),Ne(3,ti),Ne(4,KM)],px);function qK(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var VK=class extends PK{constructor(e={}){super(e),this._linkifier=this._register(new Ql),this.browser=mj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ql),this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Se),this.onKey=this._onKey.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Se),this.onBell=this._onBell.event,this._onFocus=this._register(new Se),this._onBlur=this._register(new Se),this._onA11yCharEmitter=this._register(new Se),this._onA11yTabEmitter=this._register(new Se),this._onWillOpen=this._register(new Se),this._setup(),this._decorationService=this._instantiationService.createInstance(UK),this._instantiationService.setService(pd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(OY),this._instantiationService.setService(KM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(B0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(zr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(zr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(zr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(zr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(It(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Dt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ge.ESC}]${i};${MK(s)}${hj.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=lr.toColor(...t.color));else{let o=r;this._themeService.modifyColors(u=>u[o]=lr.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Xf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,u=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=u+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(We(this.element,"copy",t=>{this.hasSelection()&&XV(t,this._selectionService)}));let e=t=>ZV(t,this.textarea,this.coreService,this.optionsService);this._register(We(this.textarea,"paste",e)),this._register(We(this.element,"paste",e)),pj?this._register(We(this.element,"mousedown",t=>{t.button===2&&W5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(We(this.element,"contextmenu",t=>{W5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Gy&&this._register(We(this.element,"auxclick",t=>{t.button===1&&$M(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(We(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(We(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(We(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(We(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(We(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(We(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(We(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(We(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",D0.get()),_j||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(DY,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($s,this._coreBrowserService),this._register(We(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(We(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ix,this._document,this._helperContainer),this._instantiationService.setService(Bm,this._charSizeService),this._themeService=this._instantiationService.createInstance(ox),this._instantiationService.setService(cc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Gf),this._instantiationService.setService(YM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sx,this.rows,this.screenElement)),this._instantiationService.setService(Us,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ex,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(nx),this._instantiationService.setService(zy,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(px,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(Q0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ax,this.element,this.screenElement,i)),this._instantiationService.setService(sG,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(zr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(J0,this.screenElement)),this._register(We(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(Xf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Vf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Vf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(rx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(o){var h,v,p,x,y;let u=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!u)return!1;let d,m;switch(o.overrideType||o.type){case"mousemove":m=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":m=0,d=o.button<3?o.button:3;break;case"mousedown":m=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(x=(p=(v=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:v.device)==null?void 0:p.cell)==null?void 0:x.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;m=w<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:d,action:m,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(We(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(We(t,"wheel",o=>{var u,d,m,h,v;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(m=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:h.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(o,!0);let p=ge.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){zM(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=zK(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ge.ETX||r.key===ge.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(GK(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ar));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ge.ESC+"[I"):this.coreService.triggerDataEvent(ge.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function GK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var YK=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},KK=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Xi)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},OE=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new KK(t)}getNullCell(){return new Xi}},XK=class extends tt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Se),this.onBufferChange=this._onBufferChange.event,this._normal=new OE(this._core.buffers.normal,"normal"),this._alternate=new OE(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)}},ZK=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,i)=>t(r,i.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},QK=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},JK=["cols","rows"],Un=0,eX=class extends tt{constructor(e){super(),this._core=this._register(new VK(e)),this._addonManager=this._register(new YK),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(JK.includes(e))throw new Error(`Option "${e}" 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 ZK(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new QK(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 XK(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
665
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return D0.get()},set promptLabel(e){D0.set(e)},get tooMuchOutput(){return L0.get()},set tooMuchOutput(e){L0.set(e)}}}_verifyIntegers(...e){for(Un of e)if(Un===1/0||isNaN(Un)||Un%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Un of e)if(Un&&(Un===1/0||isNaN(Un)||Un%1!==0||Un<0))throw new Error("This API only accepts positive integers")}};function BE(e,t){if(typeof document>"u")return t;try{const r=document.createElement("span");r.style.color=`var(${e})`,r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);const i=getComputedStyle(r).color;return r.remove(),i||t}catch{return t}}function PE(){const e=BE("--card","#0b0b12"),t=BE("--foreground","#e5e5ef"),r=typeof document<"u"&&document.documentElement.classList.contains("dark");return{background:e,foreground:t,cursor:"#a855f7",cursorAccent:e,selectionBackground:"#9333ea55",...r?{}:{black:t,white:"#3f3f46",brightWhite:t,brightBlack:"#a1a1aa"}}}function tX(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function rX(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return r.t==="opened"?{kind:"opened"}:r.t==="error"?{kind:"error",message:typeof r.message=="string"&&r.message.trim()?r.message:"Terminal bridge error"}:null}function iX(e){return e===1001||e===1006||e===1012||e===1013}function nX(e){if(typeof e=="object"&&e!==null){const r=e.status;if(typeof r=="number"&&r>=500)return!0}const t=e instanceof Error?e.message:String(e);return/failed to fetch|fetch failed|load failed|network\s*error/i.test(t)}const sX="\x1B[13;2u";function aX(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?sX:null}const IE=new TextEncoder,oX=750,lX=2048;function cX(e,t){return t<oX&&e<=lX}function uX(e){let t;try{t=new qV}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function dX(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class hX{constructor(t,r,i){Fr(this,"term");Fr(this,"fit");Fr(this,"webgl");Fr(this,"listenerCtl");Fr(this,"resizeObserver");Fr(this,"ws",null);Fr(this,"dataDispose",null);Fr(this,"lastUserInputAt",0);Fr(this,"disposed",!1);Fr(this,"connectedOnce",!1);Fr(this,"connectionGeneration",0);Fr(this,"layoutVisible",!1);this.url=r,this.onState=i,this.term=new eX({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:PE(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0}),this.fit=new nq,this.term.loadAddon(this.fit),this.term.loadAddon(new uq(tX)),this.term.open(t),this.webgl=uX(this.term),this.listenerCtl=new AbortController;const{signal:s}=this.listenerCtl;t.addEventListener("copy",o=>dX(o,this.term.getSelection()),{capture:!0,signal:s}),this.onState({kind:"connecting"}),this.resizeObserver=new ResizeObserver(o=>{var m;if(this.disposed)return;const u=(m=o[0])==null?void 0:m.contentRect,d=!!u&&u.width>0&&u.height>0;if(this.layoutVisible=d,!this.connectedOnce&&!this.ws){d&&this.connect();return}d&&this.sendResize()}),this.resizeObserver.observe(t)}async connect(){var o;if(this.disposed)return;const t=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let r;try{if(r=typeof this.url=="function"?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||t!==this.connectionGeneration)return;const u=new URL(r);u.searchParams.set("cols",String(this.term.cols)),u.searchParams.set("rows",String(this.term.rows)),r=u.toString()}catch(u){if(this.disposed||t!==this.connectionGeneration)return;nX(u)?this.onState({kind:"closed",code:1006,reason:"Terminal connection temporarily unavailable"}):this.onState({kind:"error",message:u instanceof Error?u.message:"Could not prepare terminal connection"});return}let i;try{i=new WebSocket(r)}catch(u){if(this.disposed||t!==this.connectionGeneration)return;this.onState({kind:"error",message:u instanceof Error?u.message:"Could not open terminal connection"});return}i.binaryType="arraybuffer",this.ws=i;let s=null;i.addEventListener("open",()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),i.addEventListener("message",u=>{if(u.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(u.data));return}if(typeof u.data!="string")return;const d=rX(u.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(s=d.message,this.onState({kind:"error",message:d.message}))},{signal:this.listenerCtl.signal}),i.addEventListener("close",u=>{var d;this.ws===i&&(this.ws=null,(d=this.dataDispose)==null||d.dispose(),this.dataDispose=null,!(s!==null&&u.code===4500)&&this.onState({kind:"closed",reason:u.reason||`code ${u.code}`,code:u.code}))},{signal:this.listenerCtl.signal}),i.addEventListener("error",()=>{this.ws===i&&this.onState({kind:"error",message:"Terminal WebSocket error"})},{signal:this.listenerCtl.signal}),(o=this.dataDispose)==null||o.dispose(),this.dataDispose=this.term.onData(u=>{this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(IE.encode(u))}),this.term.attachCustomKeyEventHandler(u=>{const d=aX(u);return d===null?!0:(u.type==="keydown"&&(u.preventDefault(),this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(IE.encode(d))),!1)})}setTheme(){this.term.options.theme=PE()}reconnect({silent:t=!1}={}){var i;if(this.disposed)return;const r=this.ws;this.ws=null,(i=this.dataDispose)==null||i.dispose(),this.dataDispose=null;try{r==null||r.close()}catch{}this.onState({kind:t?"probing":"connecting"}),this.connect()}dispose(){var r,i;if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),(r=this.dataDispose)==null||r.dispose();const t=this.ws;this.ws=null;try{t==null||t.close()}catch{}(i=this.webgl)==null||i.dispose(),this.term.dispose()}writeOutput(t){if(cX(t.length,performance.now()-this.lastUserInputAt)){const r=this.term._core;if(typeof(r==null?void 0:r.writeSync)=="function")try{r.writeSync(t,1);return}catch{}}this.term.write(t)}sendResize(){if(!(!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:"resize",cols:this.term.cols,rows:this.term.rows}))}}}const zE=[500,1e3,2e3,4e3,8e3],fX=3e4,mX=15e3;function pX({sessionId:e,runtimeSelector:t,active:r,role:i="owner",setup:s}){const[o,u]=g.useState({kind:"connecting"}),[d,m]=g.useState(0),[h,v]=g.useState(!1),[p,x]=g.useState(!1),[y,w]=g.useState(null),C=g.useRef(0),E=g.useRef(null),S=g.useRef(null),N=`${t}\0${e}`,k=g.useRef(N);k.current=N;const{theme:R}=Ly(),M=g.useCallback(W=>u(W),[]);g.useEffect(()=>{var W;(W=S.current)==null||W.setTheme()},[R]),g.useEffect(()=>{w(null),x(!1)},[N]);const L=g.useCallback(W=>{if(W===null)return;M({kind:"connecting"});let G=null,q=!1;return queueMicrotask(()=>{q||(G=new hX(W,({cols:B,rows:j})=>U9(t,e,{role:i,cols:B,rows:j,refreshCapability:!0}),M),S.current=G)}),()=>{q=!0,G==null||G.dispose(),S.current=null}},[e,t,i,M]);g.useEffect(()=>{if(o.kind==="connected"){E.current=Date.now(),v(!1);return}if(o.kind!=="closed")return;if(!r){v(!1);return}if(!iX(o.code)){v(!1);return}if(E.current!==null&&Date.now()-E.current>=fX&&(C.current=0),E.current=null,C.current>=zE.length){v(!1);return}const W=zE[C.current];C.current+=1,v(!0);let G=!1;const q=()=>{G||(G=!0,S.current?S.current.reconnect():m(O=>O+1))},B=window.setTimeout(q,W),j=()=>{document.visibilityState==="visible"&&q()};return document.addEventListener("visibilitychange",j),()=>{window.clearTimeout(B),document.removeEventListener("visibilitychange",j)}},[r,o]);const z=g.useCallback(()=>{C.current=0,E.current=null,v(!1),S.current?S.current.reconnect():m(W=>W+1)},[]),D=g.useCallback(async()=>{if(p)return;const W=N,G=new AbortController,q=window.setTimeout(()=>G.abort(),mX);x(!0),w(null);try{if(await be.startSessionTerminal(t,e,G.signal),k.current!==W)return;z()}catch(B){if(k.current!==W)return;w(G.signal.aborted?"Terminal start timed out. Try again.":B instanceof Error?B.message:"Could not start terminal")}finally{window.clearTimeout(q),k.current===W&&x(!1)}},[z,t,e,p,N]);return l.jsxs("div",{"data-state":o.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[l.jsx("div",{ref:L,className:"h-full w-full overflow-hidden"},d),o.kind!=="connected"&&l.jsx(_X,{state:o,reconnectPending:h,startingTerminal:p,startError:y,onRetry:z,onStartTerminal:()=>void D(),setup:s})]}),l.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:l.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:vX(gX())})})]})}function gX(){if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)??navigator.platform??"";return/mac/i.test(t)}function vX(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function _X({state:e,reconnectPending:t,startingTerminal:r,startError:i,onRetry:s,onStartTerminal:o,setup:u}){return l.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]",children:[e.kind==="connecting"&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?l.jsx(xX,{starting:r,error:i,onStart:o,setup:u}):l.jsx($E,{message:e.reason||"Terminal connection closed",onRetry:s})),e.kind==="probing"&&l.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[l.jsx(Ge,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&l.jsx($E,{message:e.message,onRetry:s})]})}function xX({starting:e,error:t,onStart:r,setup:i}){const s=(i==null?void 0:i.target)??"Provider",o=(i==null?void 0:i.kind)==="delivery_unknown"?"Task delivery needs confirmation":(i==null?void 0:i.kind)==="required"?`${s} needs setup`:"Terminal is not running",u=(i==null?void 0:i.kind)==="delivery_unknown"?"Rynx could not confirm whether the queued task was accepted. Open the terminal and check its history before retrying.":(i==null?void 0:i.kind)==="required"?i.taskQueued?`Complete login or first-run setup. The queued task will start automatically when ${s} is ready.`:i.reason??`Complete ${s} login or first-run setup before starting this Session.`:"Start it when you need terminal access for this Session.",d=(i==null?void 0:i.kind)==="required"?`Open ${s} setup`:"Start terminal";return l.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:o}),l.jsx("span",{className:"text-[var(--muted-foreground)]",children:u})]}),t&&l.jsx("span",{className:"text-[var(--destructive)]",children:t}),l.jsxs(he,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?l.jsx(Ge,{className:"animate-spin"}):l.jsx(OR,{}),e?"Opening…":d]})]})}function $E({message:e,onRetry:t}){return l.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[l.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),l.jsxs(he,{variant:"outline",size:"sm",onClick:t,children:[l.jsx(Nt,{})," Retry"]})]})}var zm="Collapsible",[yX]=Sn(zm),[bX,Yy]=yX(zm),Nj=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:u,...d}=e,[m,h]=Eo({prop:i,defaultProp:s??!1,onChange:u,caller:zm});return l.jsx(bX,{scope:r,disabled:o,contentId:vn(),open:m,onOpenToggle:g.useCallback(()=>h(v=>!v),[h]),children:l.jsx(Ve.div,{"data-state":Xy(m),"data-disabled":o?"":void 0,...d,ref:t})})});Nj.displayName=zm;var Aj="CollapsibleTrigger",Tj=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,s=Yy(Aj,r);return l.jsx(Ve.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Xy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:t,onClick:Le(e.onClick,s.onOpenToggle)})});Tj.displayName=Aj;var Ky="CollapsibleContent",Mj=g.forwardRef((e,t)=>{const{forceMount:r,...i}=e,s=Yy(Ky,e.__scopeCollapsible);return l.jsx(Cn,{present:r||s.open,children:({present:o})=>l.jsx(wX,{...i,ref:t,present:o})})});Mj.displayName=Ky;var wX=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=e,u=Yy(Ky,r),[d,m]=g.useState(i),h=g.useRef(null),v=it(t,h),p=g.useRef(0),x=p.current,y=g.useRef(0),w=y.current,C=u.open||d,E=g.useRef(C),S=g.useRef(void 0);return g.useEffect(()=>{const N=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(N)},[]),Xt(()=>{const N=h.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();p.current=k.height,y.current=k.width,E.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),m(i)}},[u.open,i]),l.jsx(Ve.div,{"data-state":Xy(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!C,...o,ref:v,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:C&&s})});function Xy(e){return e?"open":"closed"}var SX=Nj,CX=Tj,EX=Mj;const $m=SX,Um=CX,Hm=EX;function RX({status:e}){return e==="completed"?l.jsx(Ba,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?l.jsx(Ge,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):l.jsx(dO,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function kX({todos:e}){const[t,r]=g.useState(!0);if(e.length===0)return null;const i=e.filter(s=>s.status==="completed").length;return l.jsxs($m,{open:t,onOpenChange:r,className:"mx-auto mt-2 w-[calc(100%-2rem)] max-w-3xl rounded-md border border-[var(--border)] bg-[var(--muted)]/30",children:[l.jsxs(Um,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[l.jsx(jo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx("span",{className:"label-caps text-[var(--muted-foreground)]",children:"Tasks"}),l.jsxs("span",{className:"font-mono text-[var(--muted-foreground)]",children:[i,"/",e.length]})]}),l.jsx(Hm,{className:"overflow-hidden px-3 pb-2",children:l.jsx("ul",{className:"space-y-1",children:e.map(s=>l.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[l.jsx(RX,{status:s.status}),l.jsx("span",{className:qe("truncate",s.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:s.subject})]},s.id))})})]})}function UE(e,t,r={},i={},s=!0){const o={},u={};for(const d of e){if(d.type==="text"){const y=typeof t[d.id]=="string"?t[d.id]:"";s&&d.required&&!y.trim()?u[d.id]=`${d.label} is required`:y.length>0&&(o[d.id]=y);continue}const m=new Set(d.options.map(y=>y.value)),h=d.allowOther===!0&&i[d.id]===!0,v=h?(r[d.id]??"").trim():"";if(d.multiple){const y=Array.isArray(t[d.id])?t[d.id]:[],w=d.options.map(C=>C.value).filter(C=>y.includes(C));v&&!w.includes(v)&&w.push(v),s&&h&&!v?u[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&w.length===0?u[d.id]=`${d.label} is required`:w.length>0&&(o[d.id]=w);continue}const p=typeof t[d.id]=="string"?t[d.id]:"",x=h?v:m.has(p)?p:"";s&&h&&!v?u[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&!x?u[d.id]=`${d.label} is required`:x&&(o[d.id]=x)}return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:o}}function NX({sessionId:e,item:t,canResolve:r=!0}){var j;const{runtimeSelector:i}=ac(),s=g.useId().replaceAll(":",""),[o,u]=g.useState({}),[d,m]=g.useState({}),[h,v]=g.useState({}),[p,x]=g.useState({}),[y,w]=g.useState(()=>{var O;return(O=t.request.fields[0])==null?void 0:O.id}),[C,E]=g.useState(),[S,N]=g.useState(),k=t.status==="pending";function R(O){x($=>{if(!$[O])return $;const T={...$};return delete T[O],T})}function M(O,$){u(T=>({...T,[O]:$})),R(O)}function L(O,$){v(T=>({...T,[O]:$})),R(O)}function z(O){const $=t.request.fields,T=Math.max($.findIndex(H=>H.id===y),0),U=$.findIndex(H=>H.id===O);if(!(U<0)){if(U>T){const H=$[T];if(H){const F=UE([H],o,d,h);if(!F.ok){x(V=>({...V,...F.errors}));return}R(H.id)}}w(O)}}async function D(O){if(!r)return;const $=UE(t.request.fields,o,d,h,O.requiresAnswers);if(!$.ok){x($.errors);const T=t.request.fields.find(U=>$.errors[U.id]);T&&w(T.id);return}x({}),E(void 0),N(O.id);try{await F9(e,t.id,{actionId:O.id,...Object.keys($.answers).length>0?{answers:$.answers}:{}},i)}catch(T){N(void 0),E(T instanceof Error?T.message:String(T))}}const W=t.request.kind==="permission"?PB:t.request.kind==="form"?FO:iO,G=Math.max(t.request.fields.findIndex(O=>O.id===y),0),q=t.request.fields.length===0||G===t.request.fields.length-1,B=t.request.actions.filter(O=>!O.requiresAnswers||q);return l.jsxs("section",{"aria-labelledby":`${s}-title`,"aria-busy":S!==void 0,className:qe("min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm",t.request.kind==="permission"?"border-[var(--warning)]/40 bg-[var(--warning)]/5":"border-[var(--primary)]/30 bg-[var(--primary)]/5"),children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(W,{"aria-hidden":"true",className:qe("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{id:`${s}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&l.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),l.jsx(AX,{item:t}),k&&!r?l.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):k?l.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[l.jsx(r$,{idPrefix:s,fields:t.request.fields,activeFieldId:y,answers:o,otherValues:d,otherSelections:h,errors:p,disabled:S!==void 0,onNavigate:z,onAnswerChange:M,onOtherSelectionChange:L,onOtherValueChange:(O,$)=>{m(T=>({...T,[O]:$})),R(O)}}),C&&l.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",C]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[B.map(O=>l.jsxs(he,{type:"button",size:"sm",variant:MX(O),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:S!==void 0,title:O.description,"aria-label":O.description?`${O.label}. ${O.description}`:void 0,onClick:()=>void D(O),children:[S===O.id&&l.jsx(Ge,{"aria-hidden":"true",className:"animate-spin"}),O.label]},O.id)),S&&l.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(j=t.request.actions.find(O=>O.id===S))==null?void 0:j.label,"…"]})]})]}):l.jsx(TX,{item:t})]})}function AX({item:e}){const t=e.request.context;return t?l.jsxs("div",{className:"mt-3 grid min-w-0 gap-1.5",children:[t.summary&&l.jsx("p",{className:"break-words leading-relaxed text-[var(--muted-foreground)]",children:t.summary}),t.toolName&&l.jsxs("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["tool · ",t.toolName]}),t.command&&l.jsx(HE,{value:t.command}),t.cwd&&l.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]",children:t.cwd}),t.diff&&l.jsx(HE,{value:t.diff,tall:!0})]}):null}function HE({value:e,tall:t=!1}){return l.jsx("pre",{className:qe("min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed",t?"max-h-56":"max-h-32"),children:l.jsx("code",{className:"block min-w-0",children:e})})}function TX({item:e}){var i;if(e.status!=="resolved"){const s=e.status==="expired"?"Expired":e.status==="inactive"?"No longer active":"Cancelled";return l.jsxs("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:[s,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(s=>{var o;return s.id===((o=e.resolution)==null?void 0:o.actionId)}),r=e.request.fields.flatMap(s=>{var d,m;const o=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[s.id];if(o===void 0)return[];const u=s.type==="text"&&s.secret?"••••••••":Array.isArray(o)?o.join(", "):o;return[{id:s.id,label:s.label,value:u}]});return l.jsxs("div",{"aria-live":"polite",className:"mt-3 grid gap-1.5 text-[var(--muted-foreground)]",children:[l.jsxs("div",{children:["Resolved · ",(t==null?void 0:t.label)??((i=e.resolution)==null?void 0:i.actionId)??"answered"]}),r.map(s=>l.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[l.jsx("span",{children:s.label}),l.jsx("span",{className:"break-words text-[var(--foreground)]",children:s.value})]},s.id))]})}function MX(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function jX({item:e}){const t=e.rotateKind==="fork"?TO:xO;return l.jsxs("div",{className:"my-2 flex items-center gap-2 text-[10px] text-[var(--muted-foreground)]",children:[l.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"}),l.jsx(t,{className:"size-3 shrink-0 text-[var(--primary)]"}),l.jsx("span",{className:"label-caps",children:e.label}),l.jsx("span",{className:"font-mono opacity-70",children:e.newSessionId.slice(0,12)}),l.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"})]})}function DX({item:e}){return e.code==="response_stopped"?l.jsxs("div",{className:"my-1 flex items-center gap-2 px-1 py-1 text-xs text-[var(--muted-foreground)]",children:[l.jsx(oO,{className:"size-3.5 shrink-0"}),l.jsx("span",{children:"Response stopped"})]}):l.jsxs("div",{className:"my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm",children:[l.jsx(Ea,{className:"size-4 shrink-0 text-[var(--destructive)]"}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"label-caps text-[10px] text-[var(--destructive)]",children:[e.source," error · ",e.code]}),l.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80",children:e.message})]})]})}const LX="modulepreload",OX=function(e){return"/"+e},FE={},BX=function(t,r,i){let s=Promise.resolve();if(r&&r.length>0){let u=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(r.map(h=>{if(h=OX(h),h in FE)return;FE[h]=!0;const v=h.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":LX,v||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),v)return new Promise((y,w)=>{x.addEventListener("load",y),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},PX=g.lazy(()=>BX(()=>import("./mermaid-GHXKKRXX-DE-Ovg9T.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),IX=qe("min-w-0 text-sm leading-relaxed break-words","[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5","[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs","[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2","[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2");function jj({children:e,className:t}){return l.jsx(g.Suspense,{fallback:l.jsx("div",{className:qe("whitespace-pre-wrap break-words text-sm",t),children:e}),children:l.jsx(PX,{shikiTheme:["github-light","github-dark"],className:qe(IX,t),children:e})})}function zX({item:e,sessionId:t,runtimeSelector:r}){const[i,s]=g.useState(null),[o,u]=g.useState(()=>new Set),d=e.images??[],m=d.find(h=>h.resourceId===i);return g.useEffect(()=>{if(!i)return;const h=v=>{v.key==="Escape"&&s(null)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[i]),e.role==="user"?l.jsx("div",{className:"flex justify-end",children:l.jsxs("div",{className:"max-w-[85%] rounded-md rounded-br-sm bg-[var(--primary)]/10 p-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35",children:[d.length>0&&l.jsx("div",{className:`grid gap-1.5 ${d.length===1?"grid-cols-1":"grid-cols-2"}`,children:d.map(h=>{const v=be.sessionResourceContentUrl(r,t,h),p=o.has(h.resourceId);return l.jsx("button",{type:"button",className:"group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36",onClick:()=>{p||s(h.resourceId)},"aria-label":`Open ${h.filename??"attached image"}`,children:p?l.jsxs("span",{className:"flex size-full items-center justify-center gap-2 px-3 text-xs",children:[l.jsx(DO,{className:"size-4"}),"Image unavailable"]}):l.jsx("img",{src:v,alt:h.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>u(x=>new Set(x).add(h.resourceId))})},h.resourceId)})}),e.text&&l.jsx("div",{className:`whitespace-pre-wrap break-words px-1 ${d.length?"pt-2":""}`,children:e.text}),m&&l.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":m.filename??"Image preview",className:"fixed inset-0 z-50 grid min-h-0 min-w-0 place-items-center overflow-hidden bg-black/80 p-4",onClick:()=>s(null),children:[l.jsx("button",{type:"button",className:"absolute right-4 top-4 grid size-9 place-items-center rounded-full bg-black/60 text-white","aria-label":"Close image preview",onClick:()=>s(null),children:l.jsx(Na,{className:"size-5"})}),l.jsx("img",{src:be.sessionResourceContentUrl(r,t,m),alt:m.filename??"Attached image",className:"block h-auto max-h-[calc(100dvh-2rem)] min-h-0 w-auto max-w-[calc(100vw-2rem)] min-w-0 rounded-md object-contain shadow-2xl",onClick:h=>h.stopPropagation()})]})]})}):l.jsx("div",{className:"flex justify-start",children:l.jsxs("div",{className:"min-w-0 max-w-[90%] rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&l.jsx(jj,{className:"[&>:first-child]:mt-0 [&>:last-child]:mb-0",children:e.text}),e.streaming&&l.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-[var(--primary)] align-middle"}),e.interrupted&&l.jsx("span",{className:"label-caps ml-2 align-middle text-[10px] text-[var(--warning)]",children:"Response stopped"})]})})}function $X({item:e}){const t=e.summary.filter(Boolean).join(`
666
+
667
+ `).trim(),[r,i]=g.useState(e.streaming??!1);return g.useEffect(()=>{i(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:l.jsxs($m,{open:r,onOpenChange:i,className:"my-0.5",children:[l.jsxs(Um,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:qe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),l.jsx(zR,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:qe("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),l.jsx(Hm,{className:"overflow-hidden pl-7",children:l.jsx("div",{className:"mt-1 border-l-2 border-[var(--border)] pl-3 text-[var(--muted-foreground)]",children:t?l.jsx(jj,{children:t}):l.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const WE=12e3;function qE(e){return e.length<=WE?{text:e,truncated:!1}:{text:e.slice(0,WE),truncated:!0}}function UX({item:e}){const[t,r]=g.useState(!1),i=e.stdout?qE(e.stdout):null,s=e.stderr?qE(e.stderr):null,o=!!(i||s);return l.jsxs($m,{open:t,onOpenChange:r,className:"my-0.5",children:[l.jsxs(Um,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx(Lx,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),l.jsxs("span",{className:"truncate font-mono",children:[l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"$ "}),e.command]})]}),l.jsxs(Hm,{className:"overflow-hidden pl-7",children:[i&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[l.jsx("code",{children:i.text}),i.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),s&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]",children:[l.jsx("code",{children:s.text}),s.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),!o&&l.jsx("div",{className:"mt-1 text-[11px] text-[var(--muted-foreground)]",children:"(no output)"})]})]})}const VE=80,GE=12e3;function HX(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function FX(e){try{const t=JSON.parse(e);for(const i of["command","cmd","path","file","file_path","query","url","pattern","description"]){const s=t[i];if(typeof s=="string"&&s)return s}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function WX(e){let t=e,r=!1;const i=t.split(`
668
+ `);return i.length>VE&&(t=i.slice(0,VE).join(`
669
+ `),r=!0),t.length>GE&&(t=t.slice(0,GE),r=!0),{text:t,truncated:r}}function qX({status:e}){return e==="in_progress"?l.jsx(Ge,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?l.jsx(cO,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?l.jsx(sO,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):l.jsx(Ba,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function VX({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){const[s,o]=g.useState(!1),u=FX(e.arguments),d=e.output?WX(e.output):null,m=!!e.arguments&&e.arguments!=="{}",h=e.children??[];return l.jsxs($m,{open:s,onOpenChange:o,className:"my-0.5",children:[l.jsxs(Um,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",s&&"rotate-90")}),l.jsx(qX,{status:e.status}),l.jsx("span",{className:"shrink-0 font-mono font-medium",children:e.name}),u&&l.jsx("span",{className:"truncate text-[var(--muted-foreground)]",children:u})]}),l.jsxs(Hm,{className:"overflow-hidden pl-7",children:[m&&l.jsx("pre",{className:"mt-1 overflow-auto rounded-md bg-[var(--muted)] p-2 text-[11px] leading-relaxed",children:l.jsx("code",{children:HX(e.arguments)})}),d&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[l.jsx("code",{children:d.text}),d.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),e.exitCode!=null&&e.exitCode!==0&&l.jsxs("div",{className:"mt-1 text-[11px] text-[var(--destructive)]",children:["exit code ",e.exitCode]}),h.length>0&&l.jsxs("div",{className:"mt-1 border-l border-[var(--primary)]/30 pl-2",children:[l.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]",children:[l.jsx(r6,{className:"size-3 shrink-0 text-[var(--primary)]"}),l.jsxs("span",{className:"font-mono",children:[h.length," sub-agent step",h.length===1?"":"s"]})]}),h.map(v=>l.jsx(Dj,{item:v,sessionId:t,runtimeSelector:r,canResolveInteractions:i},v.id))]})]})]})}function Dj({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){switch(e.kind){case"message":return e.isMeta?null:l.jsx(zX,{item:e,sessionId:t,runtimeSelector:r});case"tool":return l.jsx(VX,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i});case"reasoning":return l.jsx($X,{item:e});case"terminal_command":return l.jsx(UX,{item:e});case"divider":return l.jsx(jX,{item:e});case"error":return l.jsx(DX,{item:e});case"interaction":return l.jsx(NX,{sessionId:t,item:e,canResolve:i})}}function GX(){return l.jsx("div",{className:"flex items-center gap-1.5 py-2 pl-1",children:[0,1,2].map(e=>l.jsx("span",{className:"size-1.5 rounded-full bg-[var(--primary)]",style:{animation:"typing-dot 1.3s ease-in-out infinite",animationDelay:`${e*.18}s`}},e))})}function YX(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function KX({message:e}){const t=g.useRef(Date.now()),[r,i]=g.useState(0);return g.useEffect(()=>{const s=()=>i(Math.floor((Date.now()-t.current)/1e3));s();const o=window.setInterval(s,1e3);return()=>window.clearInterval(o)},[]),l.jsxs("div",{role:"status","aria-live":"polite",className:"flex gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--card))] px-3 py-2.5",children:[l.jsx(Ge,{className:"mt-0.5 size-4 shrink-0 animate-spin text-[var(--warning)]","aria-hidden":"true"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[l.jsx("span",{className:"text-sm font-medium text-[var(--foreground)]",children:"Queued for capacity"}),l.jsxs("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["Waiting ",YX(r)]})]}),l.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-[var(--muted-foreground)]",children:e}),l.jsx("p",{className:"mt-1 font-mono text-[10px] text-[var(--muted-foreground)]",children:"Use Stop below to interrupt."})]})]})}function XX({items:e,historyLoaded:t,running:r,waitingForInteraction:i,queueStatus:s,sessionId:o,runtimeSelector:u}){const d=g.useRef(null),[m,h]=g.useState(!0),v=e[e.length-1],p=(v==null?void 0:v.kind)==="message"&&v.role==="assistant"&&!!v.streaming,x=r&&!p&&!i&&!s;return g.useEffect(()=>{m&&d.current&&(d.current.scrollTop=d.current.scrollHeight)},[e,r,s,m]),l.jsx(yn,{className:"min-w-0 flex-1",viewportRef:d,viewportProps:{onScroll:y=>{const w=y.currentTarget;h(w.scrollHeight-w.scrollTop-w.clientHeight<40)},"aria-busy":!t},children:l.jsx("div",{className:"mx-auto w-full max-w-3xl space-y-3 px-4 py-3",children:!t&&e.length===0&&!s?l.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ge,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),l.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r&&!s?l.jsx("p",{className:"py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Send a message to start a turn."}):l.jsxs(l.Fragment,{children:[e.map(y=>l.jsx(Dj,{item:y,sessionId:o,runtimeSelector:u,canResolveInteractions:!0},y.id)),s&&l.jsx(KX,{message:s}),x&&l.jsx(GX,{})]})})})}const ZX=2500,xu=new Map;function QX({sessionId:e,runtimeSelector:t,active:r,polling:i=r}){const s=`${t}
670
+ ${e}`,o=g.useRef(s);o.current=s;const u=g.useRef(r);u.current=r;const d=g.useRef(0),m=g.useRef(0),h=g.useRef(!1),v=g.useRef(null),p=g.useRef(null),[x,y]=g.useState(()=>xu.get(s)??null),[w,C]=g.useState(()=>!xu.has(s)),[E,S]=g.useState(null),[N,k]=g.useState(null),R=g.useCallback(B=>{p.current=B,k(B)},[]),M=g.useCallback(B=>{v.current=B,xu.set(s,B),y(B)},[s]),L=g.useCallback(async B=>{if(!u.current||h.current)return;const j=s,O=d.current,$=m.current;B&&C(!0);try{const T=await be.getRuntimeBrowserState(t,e);return!u.current||d.current!==O||m.current!==$||o.current!==j||h.current?void 0:(M(T),B&&R(null),T)}catch(T){if(!u.current||d.current!==O||m.current!==$||o.current!==j)return;B&&R(qh(T));return}finally{u.current&&d.current===O&&m.current===$&&o.current===j&&B&&C(!1)}},[s,t,e,M,R]);g.useEffect(()=>{const B=++d.current,j=xu.has(s);return M(xu.get(s)??null),R(null),C(!j),S(null),h.current=!1,L(!j),()=>{d.current===B&&(d.current+=1)}},[s,r,L,M,R]),g.useEffect(()=>{if(!i)return;const B=window.setInterval(()=>void L(!1),ZX);return()=>window.clearInterval(B)},[r,L,i]);const z=g.useCallback(async(B,j)=>{if(!u.current||h.current)return;const O=s,$=d.current;m.current+=1,h.current=!0,S(B),R(null);try{const T=await j();return u.current&&d.current===$&&o.current===O?(M(T),T):void 0}catch(T){u.current&&d.current===$&&o.current===O&&R(qh(T));return}finally{u.current&&d.current===$&&o.current===O&&(h.current=!1,S(null),C(!1))}},[s,M,R]),D=g.useCallback((B,j)=>{const O=v.current;return O?z(B,()=>j(O.browserGeneration)):Promise.resolve(void 0)},[z]),W=g.useCallback(B=>z("Starting browser",()=>be.openRuntimeBrowser(t,e,B)),[t,e,z]),G=g.useCallback(async()=>{const B=v.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Closing browser"),R(null);try{await be.closeRuntimeBrowser(t,e,B.browserGeneration),u.current&&d.current===O&&o.current===j&&M(null)}catch($){u.current&&d.current===O&&o.current===j&&R(qh($))}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null))}},[s,t,e,M,R]),q=g.useCallback(async()=>{const B=v.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Opening in Desktop"),R(null);try{const $=await hW(B,{close:T=>be.closeRuntimeBrowser(t,e,T).then(()=>{}),open:T=>be.openRuntimeBrowser(t,e,T),createPage:(T,U)=>be.createRuntimeBrowserPage(t,e,T,U),activatePage:(T,U)=>be.activateRuntimeBrowserPage(t,e,T,U),onProgress:T=>{u.current&&d.current===O&&o.current===j&&(M(T),S("Restoring browser tabs"))}});return u.current&&d.current===O&&o.current===j?(M($),($.executionBackend!=="embedded-electron"||!$.capabilities.includes(Dy))&&R("Desktop Browser Host is unavailable; using streamed browser"),$):void 0}catch($){const T=await be.getRuntimeBrowserState(t,e).catch(()=>{});u.current&&d.current===O&&o.current===j&&(T!==void 0&&M(T),R(qh($)));return}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null),C(!1))}},[s,t,e,M,R]);return{browser:x,loading:w,pendingAction:E,error:N,currentError:()=>p.current,disabled:E!==null||(x==null?void 0:x.status)!=="ready",createDisabled:E!==null,load:L,openBrowser:W,closeBrowser:G,recreateForDesktop:q,createPage:()=>D("Creating page",B=>be.createRuntimeBrowserPage(t,e,B)),closePage:B=>D("Closing page",j=>be.closeRuntimeBrowserPage(t,e,j,B)),activatePage:B=>D("Switching page",j=>be.activateRuntimeBrowserPage(t,e,j,B)),navigatePage:(B,j)=>D("Navigating",O=>be.navigateRuntimeBrowserPage(t,e,O,B,j)),backPage:B=>D("Going back",j=>be.backRuntimeBrowserPage(t,e,j,B)),forwardPage:B=>D("Going forward",j=>be.forwardRuntimeBrowserPage(t,e,j,B)),reloadPage:B=>D("Reloading page",j=>be.reloadRuntimeBrowserPage(t,e,j,B))}}const JX=2500,yu=new Map;function eZ({sessionId:e,runtimeSelector:t,active:r,polling:i=r,devicesActive:s=!1}){const o=`${t}
671
+ ${e}`,[u,d]=g.useState(()=>yu.get(o)??null),[m,h]=g.useState([]),[v,p]=g.useState(()=>!yu.has(o)),[x,y]=g.useState(!1),[w,C]=g.useState(!1),[E,S]=g.useState(null),N=g.useRef(0),k=g.useRef(0),R=g.useRef(!1),M=g.useRef(!1),L=g.useRef(!1),z=g.useRef(null);z.current=u;const D=g.useCallback($=>{z.current=$,yu.set(o,$),d($)},[o]),W=g.useCallback(async()=>{if(R.current)return;const $=N.current,T=k.current;M.current||p(!0);try{const U=await be.getSessionEmulator(t,e);if(N.current!==$||k.current!==T||R.current)return;D(U),S(null)}catch(U){if(N.current!==$||k.current!==T||R.current)return;S(L_(U))}finally{N.current===$&&k.current===T&&!R.current&&(M.current=!0,p(!1))}},[t,e,D]),G=g.useCallback(async()=>{if(R.current)return;const $=N.current,T=k.current;y(!0);try{const U=await be.listSessionEmulatorDevices(t,e);if(N.current!==$||k.current!==T||R.current)return;h(U),S(null)}catch(U){if(N.current!==$||k.current!==T||R.current)return;S(L_(U))}finally{N.current===$&&k.current===T&&!R.current&&(L.current=!0,y(!1))}},[t,e]);g.useEffect(()=>{N.current+=1;const $=yu.has(o);D(yu.get(o)??null),h([]),S(null),p(!$),y(!1),C(!1),R.current=!1,M.current=$,L.current=!1,W()},[r,W,o,D]),g.useEffect(()=>{if(!i)return;const $=window.setInterval(()=>void W(),JX);return()=>window.clearInterval($)},[r,i,W]),g.useEffect(()=>{!s||v||w||u||L.current||G()},[r,u,s,v,w,G]);const q=g.useCallback(async($,T)=>{const U=N.current,H=++k.current;R.current=!0,C(!0),S(null);try{const F=await $();return N.current!==U||k.current!==H?null:(T==null||T(F),F)}catch(F){throw N.current===U&&k.current===H&&S(L_(F)),F}finally{N.current===U&&k.current===H&&(R.current=!1,C(!1))}},[]),B=g.useCallback($=>q(()=>be.attachSessionEmulator(t,e,$),T=>D(T)),[q,t,e]),j=g.useCallback(async()=>{const $=z.current;return $?await q(()=>be.detachSessionEmulator(t,e,$.bindingId),()=>D(null))!==null:!1},[q,t,e]),O=g.useCallback(async $=>{const T=z.current;if(!T)throw new Error("This Session has no Emulator attached");await q(()=>$(T))},[q]);return{binding:u,devices:m,loading:v,devicesLoading:x,mutating:w,error:E,reload:W,reloadDevices:G,attach:B,detach:j,tap:($,T)=>O(U=>be.tapSessionEmulator(t,e,U.bindingId,$,T)),gesture:$=>O(T=>be.gestureSessionEmulator(t,e,T.bindingId,$)),button:$=>O(T=>be.buttonSessionEmulator(t,e,T.bindingId,$))}}function L_(e){return e instanceof Error?e:new Error(String(e))}const Lj="rynx.session-resource-dock-width";function tZ({session:e,runtimeSelector:t,leadingControls:r,initialDraft:i,terminalSetup:s}){var _i,ns,ss,Tn,xi,Ue;const[o,u]=D4(),d=o.get("view"),m=d==="terminal"?"terminal":"chat",h=TF(o.get("surface")),v=o.get("panel")==="resources",p=d==="browser"||h!==null||v,x=(h==null?void 0:h.type)==="browser"?h.pageId:null,y=g.useRef(null),w=g.useRef(null),C=g.useRef("browser"),E=g.useRef(null),S=g.useRef(0),N=g.useRef(null),[k]=g.useState(rZ),R=g.useRef(k),M=g.useRef(null),L=g.useRef(null),z=g.useRef(null),D=g.useRef(null),W=g.useRef(null),G=g.useRef(null),q=g.useRef(!1),[B,j]=g.useState(!1),[O,$]=g.useState(!1),[T,U]=g.useState(null),[H,F]=g.useState(Cu),[V,I]=g.useState(!1),[Y,X]=g.useState(!1),[ee,re]=g.useState([]),{state:oe,pendingSend:Z,current:ce,send:ne,stop:we}=IF(e.id,{runtimeSelector:t,allowSend:!0}),xe=QX({sessionId:e.id,runtimeSelector:t,active:!0,polling:p}),ye=eZ({sessionId:e.id,runtimeSelector:t,active:!0,polling:p,devicesActive:(h==null?void 0:h.type)==="emulator"}),J=g.useMemo(()=>MF(xe.browser,x,y.current),[xe.browser,x]),ie=OF(Z,oe.runStatus==="running"||oe.waitingForInteraction,ce,e.status==="running"),Re=e.agent??(e.provider?qu(e.provider):void 0),ve=(_i=kF(oe))==null?void 0:_i.model,Ae=g.useMemo(()=>NF(oe.items),[oe.items]),Ie=((ns=xe.browser)==null?void 0:ns.pages)??[],Oe=(h==null?void 0:h.type)==="emulator"||B,ze=xe.loading||ye.loading,rt=Ie.length>0||Oe,Be=g.useMemo(()=>[...Ie.map(me=>Hn(me.pageId)),...Oe?[Fn()]:[]],[Ie,Oe]),dt=g.useMemo(()=>Z2(ee,Be),[Be,ee]);g.useEffect(()=>{re(me=>{const ke=Z2(me,Be);return iZ(me,ke)?me:ke})},[Be]),g.useEffect(()=>{const me=N.current;if(!me)return;const ke=()=>{const bt=me.getBoundingClientRect().width,Ze=Wh(bt,Number.POSITIVE_INFINITY);F(Ze);const Ft=R.current,ii=Wh(bt,Ft??bt*X2);Ft!==null&&me.style.setProperty("--session-resource-dock-width",`${ii}px`),M.current=ii,U(ii)};ke();const Fe=new ResizeObserver(ke);return Fe.observe(me),()=>Fe.disconnect()},[]),g.useEffect(()=>()=>{var me;z.current!==null&&window.cancelAnimationFrame(z.current),(me=W.current)==null||me.call(W),YE(G)},[]),g.useEffect(()=>{y.current=null,w.current=null,C.current="browser",E.current=null,j(!1),X(!1),re([]),S.current+=1},[t,e.id]);const He=(me,ke=!0)=>{ke&&(S.current+=1);const Fe=new URLSearchParams(o);me?(Fe.set("surface",me),Fe.delete("panel")):(Fe.delete("surface"),Fe.set("panel","resources")),Fe.get("view")==="browser"&&Fe.set("view","chat"),u(Fe,{replace:!0})},Ot=()=>{S.current+=1,X(!1);const me=new URLSearchParams(o);me.delete("surface"),me.delete("panel"),me.get("view")==="browser"&&me.set("view","chat"),u(me,{replace:!0})},Ht=()=>{if(C.current==="emulator"&&B){He(Fn(E.current));return}if(y.current){He(Hn(y.current));return}if(B){He(Fn(E.current));return}He(null)};g.useEffect(()=>{h&&(C.current=h.type,h.type==="emulator"&&j(!0))},[h==null?void 0:h.type]),g.useEffect(()=>{var ke;const me=((ke=ye.binding)==null?void 0:ke.bindingId)??null;me&&(E.current&&me!==E.current?j(!0):E.current||j(!0),E.current=me)},[(ss=ye.binding)==null?void 0:ss.bindingId]),g.useEffect(()=>{if(d!=="browser")return;const me=new URLSearchParams(o);me.set("view","chat"),me.set("surface",Hn(J)),me.delete("panel"),u(me,{replace:!0})},[d,o,J,u]),g.useEffect(()=>{if((h==null?void 0:h.type)!=="browser")return;J&&(y.current=J);const me=Hn(J);if(o.get("surface")===me)return;const ke=new URLSearchParams(o);ke.set("surface",me),u(ke,{replace:!0})},[h==null?void 0:h.type,o,J,u]),g.useEffect(()=>{const me=Ie.map(Fe=>Fe.pageId),ke=jF(w.current,xe.browser);w.current=me,!(!ke||(h==null?void 0:h.type)!=="browser")&&(y.current=ke,He(Hn(ke),!1))},[Ie,xe.browser,h==null?void 0:h.type]),g.useEffect(()=>{var Fe;if((h==null?void 0:h.type)!=="emulator")return;const me=Fn((Fe=ye.binding)==null?void 0:Fe.bindingId);if(o.get("surface")===me)return;const ke=new URLSearchParams(o);ke.set("surface",me),u(ke,{replace:!0})},[(Tn=ye.binding)==null?void 0:Tn.bindingId,h==null?void 0:h.type,o,u]),g.useEffect(()=>{var me,ke;if(!(!p||ze)){if(!rt){h&&He(null,!1);return}(h==null?void 0:h.type)==="browser"&&J||(h==null?void 0:h.type)==="emulator"&&Oe||(C.current==="emulator"&&Oe?He(Fn((me=ye.binding)==null?void 0:me.bindingId),!1):J?He(Hn(J),!1):Oe&&He(Fn((ke=ye.binding)==null?void 0:ke.bindingId),!1))}},[(xi=ye.binding)==null?void 0:xi.bindingId,Oe,rt,h==null?void 0:h.type,p,ze,J]);const gi=async()=>{var ke,Fe;if(q.current)return;q.current=!0,$(!0);const me=S.current;try{const bt=((ke=xe.browser)==null?void 0:ke.status)==="ready"?await xe.createPage():await xe.openBrowser(),Ze=(bt==null?void 0:bt.activePageId)??((Fe=bt==null?void 0:bt.pages.at(-1))==null?void 0:Fe.pageId);if(!bt){_e.error(`Could not create Browser tab: ${xe.currentError()??"Browser is unavailable"}`);return}Ze&&S.current===me&&He(Hn(Ze),!1)}finally{q.current=!1,$(!1)}},Bt=me=>{const ke=N.current;if(!ke)return null;const Fe=Wh(ke.getBoundingClientRect().width,me);return ke.style.setProperty("--session-resource-dock-width",`${Fe}px`),M.current=Fe,Fe},vt=me=>{const ke=N.current;return ke?Bt(ke.getBoundingClientRect().right-me):null},ur=me=>{if(me!==null){R.current=me,U(me);try{window.localStorage.setItem(Lj,String(Math.round(me)))}catch{}}},At=me=>{D.current=me,z.current===null&&(z.current=window.requestAnimationFrame(()=>{z.current=null;const ke=D.current;D.current=null,ke!==null&&vt(ke)}))},an=(me,ke,Fe)=>{var Ze;if(L.current!==ke)return;z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),D.current=null;const bt=Fe===void 0?M.current:vt(Fe);ur(bt),L.current=null,(Ze=W.current)==null||Ze.call(W),W.current=null,me.hasPointerCapture(ke)&&me.releasePointerCapture(ke),YE(G),I(!1)},is=me=>{var ii;if(me.button!==0)return;me.preventDefault(),(ii=W.current)==null||ii.call(W),L.current=me.pointerId;const ke=me.currentTarget;ke.setPointerCapture(me.pointerId);const Fe=Wt=>{L.current===Wt.pointerId&&At(Wt.clientX)},bt=Wt=>{an(ke,Wt.pointerId,Wt.clientX)},Ze=Wt=>{an(ke,Wt.pointerId)};window.addEventListener("pointermove",Fe,!0),window.addEventListener("pointerup",bt,!0),window.addEventListener("pointercancel",Ze,!0),W.current=()=>{window.removeEventListener("pointermove",Fe,!0),window.removeEventListener("pointerup",bt,!0),window.removeEventListener("pointercancel",Ze,!0)};const Ft=document.documentElement.style;G.current={cursor:Ft.cursor,userSelect:Ft.userSelect},Ft.cursor="col-resize",Ft.userSelect="none",I(!0),vt(me.clientX)},Ar=me=>{const ke=N.current;if(!ke)return;const Fe=M.current??Wh(ke.getBoundingClientRect().width,ke.getBoundingClientRect().width*X2),bt=me.shiftKey?32:16;let Ze=null;me.key==="ArrowLeft"&&(Ze=Fe+bt),me.key==="ArrowRight"&&(Ze=Fe-bt),me.key==="Home"&&(Ze=0),me.key==="End"&&(Ze=Number.POSITIVE_INFINITY),Ze!==null&&(me.preventDefault(),ur(Bt(Ze)))},vi=me=>{S.current+=1;const ke=new URLSearchParams(o);ke.set("view",me),u(ke,{replace:!0})},vr=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":m==="chat"?"Open terminal":"Open chat",title:m==="chat"?"Open terminal":"Open chat",onClick:()=>vi(m==="chat"?"terminal":"chat"),children:m==="chat"?l.jsx(XB,{}):l.jsx(YO,{})}),Wa=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":p?"Hide Session resources":"Show Session resources",title:p?"Hide Session resources":"Show Session resources",onClick:p?Ot:Ht,children:p?l.jsx(cB,{}):l.jsx(dB,{})}),Hs=l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"hidden size-8 shrink-0 lg:inline-flex","aria-label":Y?"Restore split view":"Expand resource pane","aria-pressed":Y,title:Y?"Restore split view":"Expand resource pane",onClick:()=>X(me=>!me),children:Y?l.jsx(UB,{}):l.jsx(bO,{})});return l.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:l.jsxs("div",{ref:N,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[l.jsxs("section",{"aria-hidden":Y,className:qe("min-h-0 min-w-0 flex-1 flex-col overflow-hidden",Y?"hidden":"flex"),children:[l.jsxs("header",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r,l.jsx("h2",{className:"min-w-0 truncate text-sm font-medium",children:e.title??Re??"session"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[vr,!p&&Wa]})]}),l.jsxs(QT,{value:m,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[l.jsxs(Vu,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[l.jsx(kX,{todos:oe.todos}),l.jsx(XX,{items:Ae,historyLoaded:oe.historyLoaded,running:ie,waitingForInteraction:oe.waitingForInteraction,queueStatus:oe.statusKind==="queue"?oe.note:void 0,sessionId:e.id,runtimeSelector:t}),l.jsx(FW,{initialDraft:i,model:ve,running:ie,sessionId:e.id,runtimeSelector:t,onSend:ne,onStop:we})]}),l.jsx(Vu,{value:"terminal",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:l.jsx(pX,{sessionId:e.id,runtimeSelector:t,active:m==="terminal",setup:s})})]})]}),p&&l.jsxs(l.Fragment,{children:[!Y&&l.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(Cu,H),"aria-valuemax":H,"aria-valuenow":Math.round(T??Cu),"aria-valuetext":`${Math.round(T??Cu)} pixels wide`,tabIndex:0,title:"Drag to resize Session resources",className:"group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block",onPointerDown:is,onKeyDown:Ar,children:l.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${V?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),l.jsxs("aside",{className:qe("flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)]",Y?"h-full w-full":"absolute inset-0 z-20 lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]"),"aria-label":"Session resources",children:[rt&&l.jsx(qW,{pages:Ie,order:dt,selectedPageId:(h==null?void 0:h.type)==="browser"?J:null,selectionDisabled:xe.pendingAction!==null,mutationDisabled:xe.disabled,createDisabled:xe.createDisabled||O,createPending:O,emulatorAttached:!!ye.binding,emulator:Oe?{selected:(h==null?void 0:h.type)==="emulator",label:((Ue=ye.binding)==null?void 0:Ue.deviceName)??"Emulator",busy:ye.loading||ye.mutating}:null,onSelectPage:me=>{var ke;y.current=me,He(Hn(me)),((ke=xe.browser)==null?void 0:ke.status)==="ready"&&xe.activatePage(me)},onClosePage:me=>{S.current+=1,y.current===me&&(y.current=null),xe.closePage(me)},onCreatePage:()=>void gi(),onSelectEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))},onCloseEmulator:()=>{j(!1),C.current="browser",He(J?Hn(J):null)},onAddEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))},headerLeadingAction:Y?r:void 0,leadingAction:Hs,trailingAction:Wa}),!rt&&l.jsxs(l.Fragment,{children:[Y&&r&&l.jsx("div",{className:"absolute left-3 top-1.5 z-10 flex h-8 items-center",children:r}),l.jsxs("div",{className:"absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4",children:[Hs,Wa]})]}),rt?(h==null?void 0:h.type)==="emulator"?l.jsx(ZW,{sessionId:e.id,runtimeSelector:t,controller:ye}):(h==null?void 0:h.type)==="browser"?l.jsx(TW,{sessionId:e.id,runtimeSelector:t,pageId:J,browserResource:xe}):l.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[l.jsx(Ge,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),l.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):l.jsx(nZ,{browserBusy:xe.createDisabled||O,emulatorBusy:ye.mutating,onOpenBrowser:()=>void gi(),onOpenEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))}})]})]})]})})}function rZ(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(Lj));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function YE(e){const t=e.current;!t||typeof document>"u"||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function iZ(e,t){return e.length===t.length&&e.every((r,i)=>r===t[i])}function nZ({browserBusy:e,emulatorBusy:t,onOpenBrowser:r,onOpenEmulator:i}){return l.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:l.jsxs("div",{className:"w-full max-w-64 space-y-1","aria-label":"Session resource choices",children:[l.jsxs("button",{type:"button",disabled:e,onClick:r,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[e?l.jsx(Ge,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Pu,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Browser"})]}),l.jsxs("button",{type:"button",disabled:t,onClick:i,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[t?l.jsx(Ge,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Kl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Emulator"})]})]})})}const sZ=400,aZ=160;function oZ({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:i,loading:s,selectedId:o,onCollapsedChange:u,onSelect:d,onNew:m,onRetry:h,onDeleted:v}){const[p,x]=g.useState(""),y=p.trim().toLocaleLowerCase(),w=g.useMemo(()=>y?e.filter(E=>[E.title,E.id,E.provider,E.provider?qu(E.provider):void 0,E.agent,E.source].some(S=>S==null?void 0:S.toLocaleLowerCase().includes(y))):e,[y,e]);async function C(E){try{await be.closeSession(E,t)}catch(S){_e.error(`Delete session failed: ${S instanceof Error?S.message:String(S)}`);return}v(E)}return l.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[l.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[l.jsxs(Sa,{to:xo(t),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[l.jsx("img",{src:$f,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),l.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]}),l.jsx(he,{variant:"ghost",size:"icon-sm",className:"app-no-drag ml-auto hidden md:inline-flex",onClick:()=>u(!0),title:"Collapse session list","aria-label":"Collapse session list","aria-expanded":"true",children:l.jsx(aB,{className:"size-3.5"})})]}),l.jsxs("div",{className:"app-no-drag flex items-center gap-2",children:[l.jsxs("label",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsx(AB,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(yt,{value:p,onChange:E=>x(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),l.jsx(he,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:l.jsx(Qi,{})})]})]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[l.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:i}),l.jsx(he,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:h,children:"Retry"})]}),l.jsx(yn,{className:"min-h-0 flex-1",children:s&&e.length===0?l.jsx(cZ,{}):e.length===0?l.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),l.jsxs(he,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[l.jsx(Qi,{})," New session"]})]}):w.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",p.trim(),"”."]}):l.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:w.map(E=>l.jsx(lZ,{session:E,runtimeLabel:r,selected:o===E.id,onSelect:()=>d(E.id),onDelete:()=>C(E.id)},E.id))})})]})}function lZ({session:e,runtimeLabel:t,selected:r,onSelect:i,onDelete:s}){const[o,u]=g.useState(!1),[d,m]=g.useState(!1),[h,v]=g.useState(!1),p=g.useRef(null),x=g.useRef(null),y=uZ(e.updatedAt??e.createdAt),w=e.agent??(e.provider?qu(e.provider):void 0)??e.source,C=e.title??w??"Untitled session";g.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current),x.current!==null&&window.clearTimeout(x.current)},[]);const E=()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},S=()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null)},N=()=>{E(),S(),!h&&m(!0)},k=()=>{S(),!(h||d||p.current!==null)&&(p.current=window.setTimeout(()=>{p.current=null,m(!0)},sZ))},R=()=>{E(),S(),m(!1)},M=()=>{E(),S(),d&&(x.current=window.setTimeout(()=>{x.current=null,m(!1)},aZ))};return l.jsxs("li",{className:qe("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:k,onMouseLeave:M,children:[l.jsxs(K_,{modal:!1,open:d,onOpenChange:L=>{L?N():R()},children:[l.jsx(Bf,{asChild:!0,children:l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),l.jsxs(Pf,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${C}`,onMouseEnter:N,onMouseLeave:M,onOpenAutoFocus:L=>L.preventDefault(),onCloseAutoFocus:L=>L.preventDefault(),children:[l.jsxs("div",{className:"mb-2.5 flex min-w-0 items-center justify-between gap-3",children:[l.jsx("p",{className:"min-w-0 truncate text-xs font-medium",children:C}),l.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:y})]}),l.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${w}`,children:[l.jsx(Rx,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 truncate",children:w})]}),l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[l.jsx(kx,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 truncate",children:e.source})]}),l.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":`Session: ${e.id}`,children:[l.jsx(RO,{"aria-hidden":"true",className:"mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 select-text break-all",children:e.id})]})]})]})]}),l.jsx("button",{type:"button",className:"min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-current":r?"page":void 0,onClick:i,onFocus:N,onBlur:M,children:l.jsx("span",{className:"block truncate text-sm font-medium",children:C})}),l.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:R,onMouseLeave:k,children:[e.status==="running"&&l.jsx("span",{role:"status","aria-label":"Running",title:"Running",className:"pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0",children:l.jsx(Ge,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),l.jsxs(K_,{open:h,onOpenChange:L=>{v(L),L&&R()},children:[l.jsx(Bf,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"icon",className:"absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",title:`Session actions for ${C}`,"aria-label":`Session actions for ${C}`,children:l.jsx(vO,{})})}),l.jsx(Pf,{align:"end",children:l.jsxs(If,{variant:"destructive",onSelect:()=>u(!0),children:[l.jsx(Pa,{}),"Delete session"]})})]}),l.jsx(Rn,{open:o,onOpenChange:u,children:l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(en,{children:"Delete this session?"}),l.jsxs(tn,{children:["“",C,"” will be deleted from ",t,". This cannot be undone."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void s(),children:"Delete"})]})]})})]})]})}function cZ(){return l.jsx("div",{"aria-label":"Loading sessions",className:"space-y-0.5 px-1.5 py-1.5",children:Array.from({length:6},(e,t)=>l.jsx("div",{className:"grid min-h-9 content-center rounded-md px-2.5",children:l.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--muted)]"})},t))})}function uZ(e){const t=Date.parse(e);if(!Number.isFinite(t))return"unknown";const r=Math.max(0,Math.round((Date.now()-t)/1e3));return r<60?"now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}function dZ({runtimeLabel:e,options:t,selection:r,loading:i,submitting:s,error:o,listCollapsed:u,onShowSessions:d,onRetryOptions:m,onSelectionChange:h,onSubmit:v}){const[p,x]=g.useState(""),y=g.useRef(null),w=g.useRef(!1),C=g.useRef(void 0),E=sM({policy:R0,onChange:()=>{C.current=void 0}}),S=v0(r,t),N=!!((p.trim()||E.images.length>0)&&r&&!i&&!s&&!E.hasPending&&!E.hasFailed);async function k(){const R=p.trim();if(!R&&E.images.length===0||!r||i||s||E.hasPending||E.hasFailed)return;const M=E.images.length>0?C.current??Gu("msg"):void 0;M&&(C.current=M),await v({text:R,images:E.readyUploads,...M?{clientMessageId:M}:{}})&&(E.clear(),x(""),C.current=void 0)}return l.jsxs("main",{className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]",children:[u&&l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex",onClick:d,title:"Show session list","aria-label":"Show session list",children:l.jsx(LR,{className:"size-3.5"})}),l.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),l.jsx(yn,{className:"h-full",viewportClassName:"[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col",children:l.jsxs("div",{className:"mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12",children:[l.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:l.jsxs(he,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:d,children:[l.jsx(Yl,{})," Sessions"]})}),l.jsxs("div",{className:"mb-7",children:[l.jsx("p",{className:"label-caps mb-3 text-[10px] text-[var(--primary)]",children:"New session"}),l.jsx("h1",{className:"text-3xl font-semibold tracking-[-0.035em] sm:text-4xl",children:"What should we work on?"}),l.jsxs("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-[var(--muted-foreground)] sm:text-base",children:["Describe the outcome you want. The session and terminal will run on"," ",l.jsx("span",{className:"font-medium text-[var(--foreground)]",children:e}),"."]})]}),l.jsxs("form",{ref:y,onSubmit:R=>{R.preventDefault(),k()},children:[l.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]","aria-busy":s,children:[l.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),l.jsx(aM,{images:E.images,disabled:s,onRemove:E.remove,className:"px-5 pt-4"}),l.jsx(Sm,{id:"session-initial-prompt",value:p,disabled:s,rows:7,className:"min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base",placeholder:"Fix a bug, build a feature, or investigate the codebase…",onChange:R=>{C.current=void 0,x(R.target.value)},onPaste:E.onPaste,onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onKeyDown:R=>{var M;R.key!=="Enter"||R.shiftKey||w.current||R.nativeEvent.isComposing||R.keyCode===229||(R.preventDefault(),(M=y.current)==null||M.requestSubmit())}}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4",children:[l.jsx(oM,{policy:R0,imageCount:E.images.length,disabled:s,onFiles:E.addFiles}),l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-[var(--muted-foreground)]",children:[l.jsx(ed,{className:"size-3.5 shrink-0","aria-hidden":"true"}),l.jsx("span",{className:"truncate",children:e})]}),l.jsx("label",{htmlFor:"session-launch-target",className:"sr-only",children:"Run with"}),l.jsxs(Am,{value:r?KT(r):void 0,disabled:i||s,onValueChange:R=>{const M=XT(R);M&&h(M)},children:[l.jsx(dd,{id:"session-launch-target",className:"h-11 w-[min(100%,17rem)] bg-[var(--background)] md:h-9 md:w-56","aria-label":"Run with",children:l.jsx(ud,{placeholder:i?"Loading…":"Choose how to run",children:S&&l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate",children:S.name}),l.jsx(O_,{status:r_(S)})]})})}),l.jsxs(hd,{align:"end",children:[t.providers.length>0&&l.jsxs(a0,{children:[l.jsx(o0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers"}),t.providers.map(R=>l.jsx(Xn,{value:`provider:${R.id}`,textValue:R.name,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(O_,{status:r_(R)}),l.jsx("span",{children:R.name})]})},`provider:${R.id}`))]}),t.agents.length>0&&l.jsxs(a0,{children:[l.jsx(o0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),t.agents.map(R=>l.jsx(Xn,{value:`agent:${R.id}`,textValue:R.name??R.id,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(O_,{status:r_(R)}),l.jsx("span",{children:R.name??R.id})]})},`agent:${R.id}`))]})]})]}),l.jsx(he,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!N,"aria-label":s?"Starting session":"Start session",children:s?l.jsx(Ge,{className:"animate-spin"}):l.jsx(IR,{})})]})]}),l.jsxs("div",{className:"mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]",children:[l.jsxs("span",{className:"flex items-center gap-2",role:o?"alert":"status","aria-live":o?"assertive":"polite",children:[l.jsx("span",{children:o??(S&&!S.ready?`${S.reason??`${S.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:"A session is created only when you start.")}),o&&t.providers.length===0&&t.agents.length===0&&!i&&l.jsx(he,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:m,children:"Retry"})]}),l.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function O_({status:e}){const t=e==="ready"?"Ready":e==="needs_setup"?"Needs setup":"Readiness not reported",r=e==="ready"?"bg-[var(--success)]":e==="needs_setup"?"bg-[var(--warning)]":"bg-[var(--muted-foreground)]/55";return l.jsxs("span",{className:"inline-flex size-3.5 shrink-0 items-center justify-center",title:t,children:[l.jsx("span",{className:`size-2 rounded-full ${r}`,"aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:t})]})}function B_(){const e=Oa(),{sessionId:t}=xR(),{runtimeSelector:r,selectedRuntime:i}=ac(),[s,o]=g.useState([]),[u,d]=g.useState({providers:[],agents:[]}),[m,h]=g.useState(null),[v,p]=g.useState(!0),[x,y]=g.useState(),[w,C]=g.useState(),[E,S]=g.useState(!0),[N,k]=g.useState(!1),[R,M]=g.useState(!1),[L,z]=g.useState(!1),[D,W]=g.useState(),G=g.useRef(!1),q=g.useRef(0),B=g.useRef(0),j=g.useRef(0),O=g.useRef(),$=g.useRef(r),T=g.useRef(r),U=g.useRef({selector:r});U.current.selector!==r&&(U.current={selector:r});const H=U.current,F=t??null,V=g.useRef(F);g.useEffect(()=>()=>{j.current+=1},[]),g.useEffect(()=>{V.current!==F&&(V.current=F,j.current+=1)},[F]);const I=g.useCallback(async(ne=!1)=>{const we=++q.current;ne&&S(!0);try{const xe=await be.listSessions(r);if(q.current!==we)return;$.current=r,o(xe),C(void 0)}catch(xe){if(q.current!==we)return;C(`Could not load sessions: ${xe.message}`)}finally{q.current===we&&S(!1)}},[r]);g.useEffect(()=>{T.current!==r&&(T.current=r,O.current=void 0,q.current+=1,o([]),C(void 0),S(!0))},[r]),g.useEffect(()=>{I(!0);const ne=setInterval(()=>void I(),4e3);return()=>clearInterval(ne)},[I]);const Y=g.useCallback(async()=>{const ne=++B.current;p(!0),y(void 0);try{let we;try{we=await be.listSessionLaunchOptions(r)}catch(ye){if(!(ye instanceof yo)||ye.code!=="incompatible"&&ye.code!=="method_not_found")throw ye;we=vF(await be.listSessionAgentOptions(r))}if(B.current!==ne)return;const xe=fF(r,typeof window>"u"?void 0:window.localStorage);d(we),h(hF(we,xe))}catch(we){if(B.current!==ne)return;d({providers:[],agents:[]}),h(null),y(`Could not load launch options: ${we.message}`)}finally{B.current===ne&&p(!1)}},[r]);g.useEffect(()=>(d({providers:[],agents:[]}),h(null),p(!0),y(void 0),M(!1),W(void 0),Y(),()=>{B.current+=1}),[Y]);const X=g.useCallback(async ne=>{var Oe;if(G.current)return!1;const we=ne.text,xe=m;if(!xe)return y("Choose a provider or Agent before starting."),!1;const ye=v0(xe,u);if(!ye)return y("Choose a provider or Agent before starting."),!1;const J=!ye.ready&&ye.readiness!=="unverified";if(J&&ne.images.length>0)return y(`${ye.name} must finish login or first-run setup before starting with images.`),!1;const ie=U.current,Re=i.displayName,ve=++j.current,Ae=gF(we||((Oe=ne.images[0])==null?void 0:Oe.file.name)||"Image");let Ie;G.current=!0,z(!0),y(void 0);try{const ze=O.current,Be=ze&&ze.selector===ie.selector&&ze.selection.kind===xe.kind&&ze.selection.id===xe.id?ze.sessionId:(await be.createSession(pF(xe,Ae),ie.selector)).sessionId;Ie=Be,O.current={selector:ie.selector,selection:xe,sessionId:Be};let dt,He=!1,Ot=!1;if(J)try{await be.enqueueSessionMessage(ie.selector,Be,we),He=!0}catch(vt){dt=vt}else try{if(ne.images.length===0)Ot=!0,await be.sendSessionMessage(Be,we,()=>{},void 0,ie.selector);else{if(!(await be.getSessionResourcePolicy(ie.selector,Be)).enabled)throw new yo("Session image resources are unavailable on this Runtime",409,"failed_precondition","not_started");const ur=await Promise.all(ne.images.map(At=>be.uploadSessionResource(ie.selector,Be,At.file,At.clientUploadId)));Ot=!0,await be.sendSessionMessage(Be,{content:[...ur.map(At=>({type:"input_image",resourceId:At.resourceId,mediaType:At.mediaType,...At.filename?{filename:At.filename}:{},...At.byteLength?{byteLength:At.byteLength}:{},...At.width?{width:At.width}:{},...At.height?{height:At.height}:{}})),...we?[{type:"input_text",text:we}]:[]],clientMessageId:ne.clientMessageId},()=>{},void 0,ie.selector)}}catch(vt){dt=vt}const Ht=!!(!He&&(ne.images.length>0&&!Ot&&dt||My(dt)));if(U.current!==ie)return O.current=void 0,dt?Ht?_e.error(`Session created on ${Re}, but the first message was not sent: ${dt.message}`):_e.warning(`Session created on ${Re}, but message delivery is unknown. Check its history before retrying.`):_e.success(`Session started on ${Re}; switch back to view it.`),!0;if(j.current!==ve)return O.current=void 0,dt?Ht?_e.error(`Session created on ${Re}, but the first message was not sent. Open it to retry.`):_e.warning(`Session created on ${Re}, but message delivery is unknown. Check its history before retrying.`):_e.success(`Session started on ${Re} in the background.`),!0;if(ne.images.length>0&&Ht)return y(`Session created, but the first image message was not sent: ${dt.message}. Retry will reuse this Session.`),I(),!1;const gi=new Date().toISOString(),Bt={id:Be,...xe.kind==="provider"?{provider:xe.id}:{agent:xe.id},title:Ae,status:Ht?"idle":"running",createdAt:gi,updatedAt:gi,source:"console",...He?{setupStatus:"waiting_for_provider"}:{}};return $.current=ie.selector,o(vt=>[Bt,...vt.filter(ur=>ur.id!==Be)]),W(Ht?{sessionId:Be,message:we}:void 0),M(!1),O.current=void 0,e(He?`${uf(ie.selector,Be)}?view=terminal`:uf(ie.selector,Be)),I(),He?_e.info(`${ye.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):dt&&(Ht?_e.error(`Session created, but the first message was not sent: ${dt.message}`):_e.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(ze){const rt=ze instanceof yo&&ze.outcome==="unknown",Be=Ie?`Session created, but its first message was not sent: ${ze.message}. Retry will reuse this Session.`:rt?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${ze.message}`;return U.current===ie&&j.current===ve?y(Be):rt?_e.warning(`Session creation on ${Re} may have succeeded. Check its Session list before retrying.`):_e.error(`Could not start Session on ${Re}: ${ze.message}`),!Ie&&rt?(O.current=void 0,!0):!1}finally{G.current=!1,z(!1)}},[u,m,e,I,i.displayName]),ee=$.current===r?s:[],re=ee.find(ne=>ne.id===F)??null,oe=re?v0(re.provider?{kind:"provider",id:re.provider}:re.agent?{kind:"agent",id:re.agent}:null,u):null,Z=(re==null?void 0:re.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(oe==null?void 0:oe.name)??(re.provider?qu(re.provider):re.agent)}:re&&(re.setupStatus==="waiting_for_provider"||(oe==null?void 0:oe.ready)===!1)?{kind:"required",target:(oe==null?void 0:oe.name)??(re.provider?qu(re.provider):re.agent),taskQueued:re.setupStatus==="waiting_for_provider",...oe!=null&&oe.reason?{reason:oe.reason}:{}}:void 0;g.useEffect(()=>{(D==null?void 0:D.sessionId)===(re==null?void 0:re.id)&&W(void 0)},[D,re==null?void 0:re.id]);const ce=re?l.jsxs("div",{className:qe("flex shrink-0 items-center gap-1",N&&"desktop-macos-titlebar-leading-inset"),children:[l.jsx(he,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{M(!0),e(xo(r),{replace:!0})},children:l.jsx(Yl,{})}),N&&l.jsx(he,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>k(!1),children:l.jsx(LR,{className:"size-3.5"})})]}):void 0;return l.jsxs("div",{className:qe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",N?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!N&&l.jsx("div",{className:qe("min-h-0 min-w-0 border-r border-[var(--border)]",(!R||re)&&"hidden md:block"),children:l.jsx(oZ,{sessions:ee,runtimeSelector:r,runtimeLabel:i.displayName,listError:w,loading:E,selectedId:F,onCollapsedChange:k,onSelect:ne=>{j.current+=1,O.current=void 0,M(!1),W(void 0),e(uf(r,ne))},onNew:()=>{j.current+=1,O.current=void 0,M(!1),W(void 0),e(xo(r))},onRetry:()=>void I(!0),onDeleted:ne=>{U.current===H&&(F===ne&&e(xo(r),{replace:!0}),I())}},r)}),re?l.jsx(tZ,{session:re,runtimeSelector:r,leadingControls:ce,initialDraft:(D==null?void 0:D.sessionId)===re.id?D.message:void 0,terminalSetup:Z},`${r}:${re.id}`):F&&E?l.jsx("div",{className:"grid min-h-0 min-w-0 place-items-center",role:"status","aria-live":"polite",children:l.jsxs("span",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ge,{className:"size-4 animate-spin"})," Loading session…"]})}):l.jsx("div",{className:qe("min-h-0 min-w-0",R&&!N&&"hidden md:block"),children:l.jsx(dZ,{runtimeLabel:i.displayName,options:u,selection:m,loading:v,submitting:L,error:x??w??(F?"Session not found. Start a new session or choose another from the list.":void 0),listCollapsed:N,onShowSessions:()=>{j.current+=1,k(!1),M(!0)},onRetryOptions:()=>{Y()},onSelectionChange:ne=>{O.current=void 0,h(ne),y(void 0),mF(r,typeof window>"u"?void 0:window.localStorage,ne)},onSubmit:X},r)})]})}function hZ({name:e,onClose:t}){const[r,i]=g.useState(null),[s,o]=g.useState("meta"),[u,d]=g.useState(null),[m,h]=g.useState(""),[v,p]=g.useState(!1),[x,y]=g.useState(new Set),w=C=>y(E=>{const S=new Set(E);return S.has(C)?S.delete(C):S.add(C),S});return g.useEffect(()=>{if(!e){i(null),d(null),h("");return}o("meta");let C=!1;return be.getSkill(e).then(E=>{var S;C||(i(E),y(new Set(fZ(E.files))),d(((S=E.files.find(N=>N.path==="SKILL.md")??E.files[0])==null?void 0:S.path)??null))}).catch(E=>_e.error(`Load skill failed: ${E.message}`)),()=>{C=!0}},[e]),g.useEffect(()=>{if(!e||!u){h("");return}let C=!1;return p(!0),be.readSkillFile(e,u).then(E=>!C&&h(E.content)).catch(E=>!C&&h(`⚠ ${E.message}`)).finally(()=>!C&&p(!1)),()=>{C=!0}},[e,u]),l.jsx(Oo,{open:e!=null,onOpenChange:C=>!C&&t(),children:l.jsxs($a,{className:"flex max-h-[85vh] max-w-3xl flex-col overflow-hidden",children:[l.jsx(Bo,{children:l.jsx(Ua,{className:"font-mono",children:e})}),l.jsxs(QT,{value:s,onValueChange:o,className:"flex min-h-0 flex-1 flex-col gap-3",children:[l.jsxs(JT,{className:"self-start",children:[l.jsx(_0,{value:"meta",children:"Meta"}),l.jsxs(_0,{value:"files",children:["Files",r?` (${r.files.length})`:""]})]}),l.jsx(Vu,{value:"meta",className:"mt-0 min-h-0 flex-1",children:l.jsx(yn,{className:"h-full",children:r===null?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):l.jsxs("div",{className:"grid gap-5 pr-1",children:[r.description&&l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"Description"}),l.jsx("p",{className:"text-sm leading-relaxed",children:r.description})]}),l.jsxs("dl",{className:"grid grid-cols-[5.5rem_1fr] items-baseline gap-x-5 gap-y-3",children:[(()=>{var E,S;const C=nM((E=r.ref)==null?void 0:E.install);return l.jsxs(l.Fragment,{children:[l.jsx(bu,{label:"Source",children:C.source?/^https?:\/\//.test(C.source)?l.jsx("a",{href:C.source,target:"_blank",rel:"noreferrer",className:"break-all font-mono text-xs text-[var(--primary)] hover:underline",children:C.source}):l.jsx("span",{className:"break-all font-mono text-xs",children:C.source}):l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"— no receipt"})}),C.version&&l.jsx(bu,{label:"Version",children:l.jsx("span",{className:"font-mono text-xs",children:C.version})}),((S=r.ref)==null?void 0:S.contentHash)&&l.jsx(bu,{label:"Content",children:l.jsx("span",{className:"break-all font-mono text-xs",children:r.ref.contentHash})})]})})(),l.jsx(bu,{label:"Files",children:r.files.length}),l.jsx(bu,{label:"Size",children:Oj(r.totalSize)})]})]})})}),l.jsx(Vu,{value:"files",className:"mt-0 flex min-h-0 flex-1 flex-col",children:l.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[14rem_1fr] gap-3",children:[l.jsx(yn,{className:"min-h-0 rounded-md border border-[var(--border)]",children:l.jsx("div",{className:"p-1",children:r===null?l.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"Loading…"}):r.files.length===0?l.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"No files."}):l.jsx(Pj,{nodes:mZ(r.files),depth:0,active:u,onSelect:d,collapsed:x,onToggle:w})})}),l.jsx("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:v?"Loading…":m})]})})]})]})})}function bu({label:e,children:t}){return l.jsxs(l.Fragment,{children:[l.jsx("dt",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),l.jsx("dd",{className:"min-w-0 break-words text-sm",children:t})]})}function Oj(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:"—"}function fZ(e){const t=new Set;for(const r of e){const i=r.path.split("/");for(let s=0;s<i.length-1;s++)t.add(i.slice(0,s+1).join("/"))}return[...t]}function mZ(e){const t={children:[]};for(const r of e){const i=r.path.split("/");let s=t;i.forEach((o,u)=>{const d=u===i.length-1;let m=s.children.find(h=>h.name===o);m||(m={name:o,path:i.slice(0,u+1).join("/"),isDir:!d,children:[]},d&&(m.size=r.size),s.children.push(m)),s=m})}return Bj(t),t.children}function Bj(e){e.children.sort((t,r)=>t.isDir===r.isDir?t.name.localeCompare(r.name):t.isDir?-1:1),e.children.forEach(Bj)}function Pj({nodes:e,depth:t,active:r,onSelect:i,collapsed:s,onToggle:o}){const u=d=>({paddingLeft:d*14+8});return l.jsx(l.Fragment,{children:e.map(d=>d.isDir?l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>o(d.path),style:u(t),className:"flex w-full items-center gap-1.5 rounded-sm py-1 pr-2 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:qe("size-3 shrink-0 transition-transform",!s.has(d.path)&&"rotate-90")}),l.jsx(NO,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:"truncate font-mono",children:d.name})]}),!s.has(d.path)&&l.jsx(Pj,{nodes:d.children,depth:t+1,active:r,onSelect:i,collapsed:s,onToggle:o})]},d.path):l.jsxs("button",{type:"button",onClick:()=>i(d.path),style:u(t),className:qe("flex w-full items-center justify-between gap-2 rounded-sm py-1 pr-2 text-left",r===d.path?"bg-[var(--muted)]":"hover:bg-[var(--muted)]/50"),children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx(CO,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate font-mono text-xs",children:d.name})]}),l.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:Oj(d.size??0)})]},d.path))})}function pZ(){const[e,t]=g.useState(null),[r,i]=g.useState(null);async function s(){try{t(await be.listSkills())}catch(o){t([]),_e.error(`Failed to load skills: ${o.message}`)}}return g.useEffect(()=>{s()},[]),l.jsxs(Ur,{children:[l.jsxs(Jr,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Gr,{children:["Skills ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(e==null?void 0:e.length)??0})]}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Global catalog (",l.jsx("code",{children:"~/.rynx/skills"}),"), installed via ",l.jsx("code",{children:"npx skills"}),". Agents pick a subset in their Skills section."]})]}),l.jsx("div",{className:"shrink-0",children:l.jsx(zT,{onInstalled:t})})]}),l.jsx(Yr,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Skill"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e===null&&l.jsx("tr",{children:l.jsx("td",{colSpan:2,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"Loading…"})}),(e==null?void 0:e.length)===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:2,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"No skills installed yet. Install one from a skills.sh source above."})}),e==null?void 0:e.map(o=>l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsx("td",{className:"px-5 py-3",children:l.jsxs("button",{type:"button",onClick:()=>i(o.name),className:"block text-left hover:underline",children:[l.jsx("div",{className:"font-mono font-medium",children:o.name}),l.jsx("div",{className:"text-xs text-[var(--muted-foreground)]",children:o.description}),(()=>{var d;const u=nM((d=o.ref)==null?void 0:d.install);return u.source?l.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:[u.source,u.version?`@${u.version}`:""]}):null})()]})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>i(o.name),children:"View"}),l.jsx(gZ,{name:o.name,onDeleted:s})]})})]},o.name))]})]})}),l.jsx(hZ,{name:r,onClose:()=>i(null)})]})}function gZ({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Remove skill "',e,'"?']}),l.jsx(tn,{children:"Deletes it from the global catalog. Agents that reference it will no longer resolve it."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:async()=>{try{await be.deleteSkill(e),_e.success(`Skill "${e}" removed`),await t()}catch(r){_e.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function vZ(){const e=oc(),[t,r]=g.useState(null),[i,s]=g.useState(null),[o,u]=g.useState("refresh"),d=g.useCallback(async(y=!1)=>{if(e){u("refresh"),s(null);try{r(await e.getStatus(y))}catch(w){s(w.message)}finally{u(null)}}},[e]);g.useEffect(()=>{d()},[d]);async function m(y){if(e){u("install"),s(null);try{r(await e.installCli(y)),_e.success("Terminal command installed")}catch(w){const C=w.message;s(C),_e.error(`Could not install the Terminal command: ${C}`);try{r(await e.getStatus(!0))}catch{}}finally{u(null)}}}async function h(y){if(e){u("remove"),s(null);try{r(await e.removeCli(y)),_e.success("Terminal command removed")}catch(w){const C=w.message;s(C),_e.error(`Could not remove the Terminal command: ${C}`);try{r(await e.getStatus(!0))}catch{}}finally{u(null)}}}const v=t==null?void 0:t.globalCli,p=(v==null?void 0:v.state)==="installed",x=(v==null?void 0:v.state)==="installed"&&v.canInstall&&!!(v.path&&v.target&&v.path!==v.target);return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Terminal command"}),l.jsxs("p",{className:"text-sm text-[var(--muted-foreground)]",children:["Install or remove the ",l.jsx("code",{className:"font-mono",children:"rynx"})," command used in Terminal."]})]}),l.jsxs(Ur,{"aria-busy":o!==null,children:[l.jsxs(Jr,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Gr,{children:"Shell access"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Removing the command does not uninstall Rynx or delete its data."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void d(!0),children:[l.jsx(Nt,{className:o==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(Yr,{className:"grid gap-3",children:[v?l.jsxs("div",{className:"grid gap-4 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[l.jsx("span",{className:p?"grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:p?l.jsx(Ba,{className:"size-5"}):l.jsx(Tx,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"font-mono text-sm font-medium",children:"rynx"}),l.jsx(gt,{variant:p?"success":"warning",children:_Z(v.state)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:xZ(v)}),v.path&&l.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]",children:v.path}),x&&v.target&&l.jsxs("p",{className:"mt-1 break-all text-[11px] text-[var(--muted-foreground)]",children:["Recommended: ",l.jsx("code",{className:"font-mono",children:v.target})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2 sm:justify-self-end",children:[v.canInstall&&l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>v.path&&void m(v.path),children:[o==="install"&&l.jsx(Ge,{className:"animate-spin"}),x?"Move command":v.state==="stale"?"Repair command":"Install command"]}),v.canRemove&&l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,children:[l.jsx(Pa,{}),"Remove command"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(en,{children:"Remove the Terminal command?"}),l.jsx(tn,{children:"This removes only the shell command link that points to this Rynx app. The app, Runtime, settings, and workspace data remain installed."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>v.path&&void h(v.path),children:"Remove command"})]})]})]})]})]}):l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o==="refresh"&&l.jsx(Ge,{className:"size-4 animate-spin"}),o==="refresh"?"Checking command…":"Command status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(tc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function _Z(e){switch(e){case"installed":return"Installed";case"missing":return"Not installed";case"stale":return"Needs repair";case"foreign":return"Managed externally";case"unwritable":case"error":return"Unavailable"}}function xZ(e){switch(e.state){case"installed":return e.canInstall?"The command is ready. You can move it to the recommended location.":"The command is ready to use from Terminal.";case"missing":return"Install the command to use Rynx from Terminal.";case"stale":return"Update the command registration to use this Rynx app.";case"foreign":return"Another program owns the active command. Rynx will not replace or remove it.";case"unwritable":return"Rynx could not find a supported location for the command.";case"error":return"Rynx could not check the command."}}function yZ(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function bZ(){const e=oc();return e?l.jsxs(l.Fragment,{children:[l.jsx(eU,{bridge:e,children:l.jsx(KE,{desktopIntegrationAvailable:!0})}),l.jsx(sU,{bridge:e})]}):l.jsx(KE,{desktopIntegrationAvailable:!1})}function KE({desktopIntegrationAvailable:e}){const{theme:t,toggle:r}=Ly(),i=Hr(),s=I9(i.pathname,e),o=g.useRef(null),[u,d]=g.useState([]),[m,h]=g.useState([]),[v,p]=g.useState([]),[x,y]=g.useState([]),[w,C]=g.useState(!1),E=g.useCallback(async()=>{try{d(await be.listAgents())}catch(R){_e.error(`Failed to load agents: ${R.message}`)}},[]),S=g.useCallback(async()=>{const R=await Promise.allSettled([be.channelTypes(),be.listChannels(),be.listInstances(),be.listAgents()]);R[0].status==="fulfilled"&&h(R[0].value),R[1].status==="fulfilled"&&p(R[1].value),R[2].status==="fulfilled"&&y(R[2].value),R[3].status==="fulfilled"&&d(R[3].value)},[]);g.useEffect(()=>{s&&s!=="emulator"&&S()},[S,s]),g.useEffect(()=>{let R=!0;const M=async()=>{try{const z=await be.meta();R&&C(yZ(z))}catch{}};M();const L=window.setInterval(()=>void M(),15e3);return()=>{R=!1,window.clearInterval(L)}},[]),g.useEffect(()=>{const R=window.requestAnimationFrame(()=>{var M;return(M=o.current)==null?void 0:M.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(R)},[i.pathname]);const N=qL([{path:"/",element:l.jsx(go,{replace:!0,to:mt.sessions})},{path:Hu,element:l.jsx(go,{replace:!0,to:d0})},{path:mt.overview,element:l.jsx(VH,{instances:x,channels:v,agents:u})},{path:mt.runtimes,element:l.jsx(iF,{})},{path:mt.providers,element:l.jsx(YH,{})},{path:mt.instances,element:l.jsx(UH,{instances:x,channels:v,agents:u,onChange:S})},{path:mt.channels,element:l.jsx(lH,{channels:v,channelTypes:m,onChange:S})},{path:mt.agents,element:l.jsx(RU,{agents:u,onChange:E})},{path:mt.skills,element:l.jsx(pZ,{})},{path:D9,element:l.jsx(B_,{})},{path:L9,element:l.jsx(B_,{})},{path:mt.sessions,element:l.jsx(B_,{})},{path:`${mt.sessions}/:sessionId`,element:l.jsx(wZ,{})},{path:mt.emulator,element:l.jsx($H,{})},{path:mt.logs,element:l.jsx(WH,{})},...e?[{path:mt.daemon,element:l.jsx(vH,{})},{path:mt.updates,element:l.jsx(AU,{})},{path:mt.command,element:l.jsx(vZ,{})},{path:mt.computer,element:l.jsx(gH,{})},{path:mt.inspection,element:l.jsx(dH,{})}]:CT.map(R=>({path:mt[R],element:l.jsx(go,{replace:!0,to:d0})})),...Object.entries(B9).map(([R,M])=>({path:M,element:l.jsx(go,{replace:!0,to:mt[R]})})),{path:"*",element:l.jsx(go,{replace:!0,to:mt.sessions})}]),k=s?l.jsx(oU,{activeView:s,desktopIntegrationAvailable:e,children:N}):N;return l.jsx(J9,{theme:t,onToggleTheme:r,children:l.jsxs("div",{ref:o,id:"main-content",tabIndex:-1,className:"flex h-full min-h-0 flex-col overflow-hidden focus:outline-none",children:[w&&l.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e?l.jsxs("span",{children:["The local Runtime is running an older build. Restart it from"," ",l.jsx("strong",{children:"Settings → Daemon"}),", then reload this page."]}):l.jsxs("span",{children:["The resident daemon is running an older build. Run"," ",l.jsx("code",{className:"font-mono font-semibold",children:"rynx restart"}),", then reload this page."]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:k})]})})}function wZ(){const{sessionId:e}=xR(),t=Hr();if(!e)return l.jsx(go,{replace:!0,to:mt.sessions});const r=kT(t.search)??"local";return l.jsx(go,{replace:!0,to:uf(r,e)})}function SZ(e){const{theme:t}=Ly();return l.jsx(M6,{theme:t,...e})}var rR;((rR=window.rynxDesktopIntegration)==null?void 0:rR.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");aL.createRoot(document.getElementById("root")).render(l.jsx(g.StrictMode,{children:l.jsx(A4,{children:l.jsx(K9,{children:l.jsxs(Z9,{children:[l.jsx(bZ,{}),l.jsx(SZ,{richColors:!0,position:"top-right"})]})})})}));export{BX as _,Ia as a,Hx as c,gx as g,l as j,g as r,zk as t};