@rynx-ai/server 0.1.10 → 0.1.11-beta.2

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.
@@ -0,0 +1,689 @@
1
+ var uD=Object.defineProperty;var dD=(e,t,r)=>t in e?uD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var si=(e,t,r)=>dD(e,typeof t!="symbol"?t+"":t,r);function hD(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in e)){const o=Object.getOwnPropertyDescriptor(i,n);o&&Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>i[n]})}}}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 n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const o of n)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(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();function hE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var av={exports:{}},su={};/**
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 yS;function fD(){if(yS)return su;yS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,n,o){var u=null;if(o!==void 0&&(u=""+o),n.key!==void 0&&(u=""+n.key),"key"in n){o={};for(var d in n)d!=="key"&&(o[d]=n[d])}else o=n;return n=o.ref,{$$typeof:e,type:i,key:u,ref:n!==void 0?n:null,props:o}}return su.Fragment=t,su.jsx=r,su.jsxs=r,su}var bS;function mD(){return bS||(bS=1,av.exports=fD()),av.exports}var l=mD(),ov={exports:{}},Ke={};/**
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 pD(){if(wS)return Ke;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"),n=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"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function b(T){return T===null||typeof T!="object"?null:(T=y&&T[y]||T["@@iterator"],typeof T=="function"?T:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function S(T,V,K){this.props=T,this.context=V,this.refs=E,this.updater=K||w}S.prototype.isReactComponent={},S.prototype.setState=function(T,V){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,V,"setState")},S.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function k(){}k.prototype=S.prototype;function j(T,V,K){this.props=T,this.context=V,this.refs=E,this.updater=K||w}var N=j.prototype=new k;N.constructor=j,C(N,S.prototype),N.isPureReactComponent=!0;var M=Array.isArray;function D(){}var H={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function G(T,V,K){var J=K.ref;return{$$typeof:e,type:T,key:V,ref:J!==void 0?J:null,props:K}}function Z(T,V){return G(T.type,V,T.props)}function q(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function P(T){var V={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(K){return V[K]})}var B=/\/+/g;function z(T,V){return typeof T=="object"&&T!==null&&T.key!=null?P(""+T.key):V.toString(36)}function I(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(D,D):(T.status="pending",T.then(function(V){T.status==="pending"&&(T.status="fulfilled",T.value=V)},function(V){T.status==="pending"&&(T.status="rejected",T.reason=V)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function A(T,V,K,J,oe){var ce=typeof T;(ce==="undefined"||ce==="boolean")&&(T=null);var Y=!1;if(T===null)Y=!0;else switch(ce){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(T.$$typeof){case e:case t:Y=!0;break;case v:return Y=T._init,A(Y(T._payload),V,K,J,oe)}}if(Y)return oe=oe(T),Y=J===""?"."+z(T,0):J,M(oe)?(K="",Y!=null&&(K=Y.replace(B,"$&/")+"/"),A(oe,V,K,"",function(Ae){return Ae})):oe!=null&&(q(oe)&&(oe=Z(oe,K+(oe.key==null||T&&T.key===oe.key?"":(""+oe.key).replace(B,"$&/")+"/")+Y)),V.push(oe)),1;Y=0;var ne=J===""?".":J+":";if(M(T))for(var de=0;de<T.length;de++)J=T[de],ce=ne+z(J,de),Y+=A(J,V,K,ce,oe);else if(de=b(T),typeof de=="function")for(T=de.call(T),de=0;!(J=T.next()).done;)J=J.value,ce=ne+z(J,de++),Y+=A(J,V,K,ce,oe);else if(ce==="object"){if(typeof T.then=="function")return A(I(T),V,K,J,oe);throw V=String(T),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Y}function $(T,V,K){if(T==null)return T;var J=[],oe=0;return A(T,J,"","",function(ce){return V.call(K,ce,oe++)}),J}function U(T){if(T._status===-1){var V=T._result;V=V(),V.then(function(K){(T._status===0||T._status===-1)&&(T._status=1,T._result=K)},function(K){(T._status===0||T._status===-1)&&(T._status=2,T._result=K)}),T._status===-1&&(T._status=0,T._result=V)}if(T._status===1)return T._result.default;throw T._result}var F=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},W={map:$,forEach:function(T,V,K){$(T,function(){V.apply(this,arguments)},K)},count:function(T){var V=0;return $(T,function(){V++}),V},toArray:function(T){return $(T,function(V){return V})||[]},only:function(T){if(!q(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ke.Activity=p,Ke.Children=W,Ke.Component=S,Ke.Fragment=r,Ke.Profiler=n,Ke.PureComponent=j,Ke.StrictMode=i,Ke.Suspense=m,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(T){return H.H.useMemoCache(T)}},Ke.cache=function(T){return function(){return T.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(T,V,K){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var J=C({},T.props),oe=T.key;if(V!=null)for(ce in V.key!==void 0&&(oe=""+V.key),V)!L.call(V,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&V.ref===void 0||(J[ce]=V[ce]);var ce=arguments.length-2;if(ce===1)J.children=K;else if(1<ce){for(var Y=Array(ce),ne=0;ne<ce;ne++)Y[ne]=arguments[ne+2];J.children=Y}return G(T.type,oe,J)},Ke.createContext=function(T){return T={$$typeof:u,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:o,_context:T},T},Ke.createElement=function(T,V,K){var J,oe={},ce=null;if(V!=null)for(J in V.key!==void 0&&(ce=""+V.key),V)L.call(V,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(oe[J]=V[J]);var Y=arguments.length-2;if(Y===1)oe.children=K;else if(1<Y){for(var ne=Array(Y),de=0;de<Y;de++)ne[de]=arguments[de+2];oe.children=ne}if(T&&T.defaultProps)for(J in Y=T.defaultProps,Y)oe[J]===void 0&&(oe[J]=Y[J]);return G(T,ce,oe)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(T){return{$$typeof:d,render:T}},Ke.isValidElement=q,Ke.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:U}},Ke.memo=function(T,V){return{$$typeof:f,type:T,compare:V===void 0?null:V}},Ke.startTransition=function(T){var V=H.T,K={};H.T=K;try{var J=T(),oe=H.S;oe!==null&&oe(K,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(D,F)}catch(ce){F(ce)}finally{V!==null&&K.types!==null&&(V.types=K.types),H.T=V}},Ke.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},Ke.use=function(T){return H.H.use(T)},Ke.useActionState=function(T,V,K){return H.H.useActionState(T,V,K)},Ke.useCallback=function(T,V){return H.H.useCallback(T,V)},Ke.useContext=function(T){return H.H.useContext(T)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(T,V){return H.H.useDeferredValue(T,V)},Ke.useEffect=function(T,V){return H.H.useEffect(T,V)},Ke.useEffectEvent=function(T){return H.H.useEffectEvent(T)},Ke.useId=function(){return H.H.useId()},Ke.useImperativeHandle=function(T,V,K){return H.H.useImperativeHandle(T,V,K)},Ke.useInsertionEffect=function(T,V){return H.H.useInsertionEffect(T,V)},Ke.useLayoutEffect=function(T,V){return H.H.useLayoutEffect(T,V)},Ke.useMemo=function(T,V){return H.H.useMemo(T,V)},Ke.useOptimistic=function(T,V){return H.H.useOptimistic(T,V)},Ke.useReducer=function(T,V,K){return H.H.useReducer(T,V,K)},Ke.useRef=function(T){return H.H.useRef(T)},Ke.useState=function(T){return H.H.useState(T)},Ke.useSyncExternalStore=function(T,V,K){return H.H.useSyncExternalStore(T,V,K)},Ke.useTransition=function(){return H.H.useTransition()},Ke.version="19.2.7",Ke}var SS;function Qx(){return SS||(SS=1,ov.exports=pD()),ov.exports}var g=Qx();const we=hE(g),Ha=hD({__proto__:null,default:we},[g]);var lv={exports:{}},nu={},cv={exports:{}},uv={};/**
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 CS;function gD(){return CS||(CS=1,(function(e){function t(A,$){var U=A.length;A.push($);e:for(;0<U;){var F=U-1>>>1,W=A[F];if(0<n(W,$))A[F]=$,A[U]=W,U=F;else break e}}function r(A){return A.length===0?null:A[0]}function i(A){if(A.length===0)return null;var $=A[0],U=A.pop();if(U!==$){A[0]=U;e:for(var F=0,W=A.length,T=W>>>1;F<T;){var V=2*(F+1)-1,K=A[V],J=V+1,oe=A[J];if(0>n(K,U))J<W&&0>n(oe,K)?(A[F]=oe,A[J]=U,F=J):(A[F]=K,A[V]=U,F=V);else if(J<W&&0>n(oe,U))A[F]=oe,A[J]=U,F=J;else break e}}return $}function n(A,$){var U=A.sortIndex-$.sortIndex;return U!==0?U:A.id-$.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=[],f=[],v=1,p=null,y=3,b=!1,w=!1,C=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function N(A){for(var $=r(f);$!==null;){if($.callback===null)i(f);else if($.startTime<=A)i(f),$.sortIndex=$.expirationTime,t(m,$);else break;$=r(f)}}function M(A){if(C=!1,N(A),!w)if(r(m)!==null)w=!0,D||(D=!0,P());else{var $=r(f);$!==null&&I(M,$.startTime-A)}}var D=!1,H=-1,L=5,G=-1;function Z(){return E?!0:!(e.unstable_now()-G<L)}function q(){if(E=!1,D){var A=e.unstable_now();G=A;var $=!0;try{e:{w=!1,C&&(C=!1,k(H),H=-1),b=!0;var U=y;try{t:{for(N(A),p=r(m);p!==null&&!(p.expirationTime>A&&Z());){var F=p.callback;if(typeof F=="function"){p.callback=null,y=p.priorityLevel;var W=F(p.expirationTime<=A);if(A=e.unstable_now(),typeof W=="function"){p.callback=W,N(A),$=!0;break t}p===r(m)&&i(m),N(A)}else i(m);p=r(m)}if(p!==null)$=!0;else{var T=r(f);T!==null&&I(M,T.startTime-A),$=!1}}break e}finally{p=null,y=U,b=!1}$=void 0}}finally{$?P():D=!1}}}var P;if(typeof j=="function")P=function(){j(q)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,z=B.port2;B.port1.onmessage=q,P=function(){z.postMessage(null)}}else P=function(){S(q,0)};function I(A,$){H=S(function(){A(e.unstable_now())},$)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(A){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var U=y;y=$;try{return A()}finally{y=U}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(A,$){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var U=y;y=A;try{return $()}finally{y=U}},e.unstable_scheduleCallback=function(A,$,U){var F=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?F+U:F):U=F,A){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=U+W,A={id:v++,callback:$,priorityLevel:A,startTime:U,expirationTime:W,sortIndex:-1},U>F?(A.sortIndex=U,t(f,A),r(m)===null&&A===r(f)&&(C?(k(H),H=-1):C=!0,I(M,U-F))):(A.sortIndex=W,t(m,A),w||b||(w=!0,D||(D=!0,P()))),A},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(A){var $=y;return function(){var U=y;y=$;try{return A.apply(this,arguments)}finally{y=U}}}})(uv)),uv}var ES;function vD(){return ES||(ES=1,cv.exports=gD()),cv.exports}var dv={exports:{}},ni={};/**
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 kS;function _D(){if(kS)return ni;kS=1;var e=Qx();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)f+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+f+" 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},n=Symbol.for("react.portal");function o(m,f,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:n,key:p==null?null:""+p,children:m,containerInfo:f,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return ni.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ni.createPortal=function(m,f){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(m,f,null,v)},ni.flushSync=function(m){var f=u.T,v=i.p;try{if(u.T=null,i.p=2,m)return m()}finally{u.T=f,i.p=v,i.d.f()}},ni.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(m,f))},ni.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},ni.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var v=f.as,p=d(v,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;v==="style"?i.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:p,integrity:y,fetchPriority:b}):v==="script"&&i.d.X(m,{crossOrigin:p,integrity:y,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},ni.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var v=d(f.as,f.crossOrigin);i.d.M(m,{crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(m)},ni.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var v=f.as,p=d(v,f.crossOrigin);i.d.L(m,v,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},ni.preloadModule=function(m,f){if(typeof m=="string")if(f){var v=d(f.as,f.crossOrigin);i.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(m)},ni.requestFormReset=function(m){i.d.r(m)},ni.unstable_batchedUpdates=function(m,f){return m(f)},ni.useFormState=function(m,f,v){return u.H.useFormState(m,f,v)},ni.useFormStatus=function(){return u.H.useHostTransitionStatus()},ni.version="19.2.7",ni}var RS;function fE(){if(RS)return dv.exports;RS=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(),dv.exports=_D(),dv.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 NS;function xD(){if(NS)return nu;NS=1;var e=vD(),t=Qx(),r=fE();function i(s){var a="https://react.dev/errors/"+s;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 #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,c=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(c=a.return),s=a.return;while(s)}return a.tag===3?c:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function m(s){if(o(s)!==s)throw Error(i(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var c=s,h=a;;){var _=c.return;if(_===null)break;var x=_.alternate;if(x===null){if(h=_.return,h!==null){c=h;continue}break}if(_.child===x.child){for(x=_.child;x;){if(x===c)return m(_),s;if(x===h)return m(_),a;x=x.sibling}throw Error(i(188))}if(c.return!==h.return)c=_,h=x;else{for(var R=!1,O=_.child;O;){if(O===c){R=!0,c=_,h=x;break}if(O===h){R=!0,h=_,c=x;break}O=O.sibling}if(!R){for(O=x.child;O;){if(O===c){R=!0,c=x,h=_;break}if(O===h){R=!0,h=x,c=_;break}O=O.sibling}if(!R)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:a}function v(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=v(s),a!==null)return a;s=s.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),b=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"),k=Symbol.for("react.consumer"),j=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function P(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function z(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case G:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case j:return s.displayName||"Context";case k:return(s._context.displayName||"Context")+".Consumer";case N:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case H:return a=s.displayName||null,a!==null?a:z(s.type)||"Memo";case L:a=s._payload,s=s._init;try{return z(s(a))}catch{}}return null}var I=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},F=[],W=-1;function T(s){return{current:s}}function V(s){0>W||(s.current=F[W],F[W]=null,W--)}function K(s,a){W++,F[W]=s.current,s.current=a}var J=T(null),oe=T(null),ce=T(null),Y=T(null);function ne(s,a){switch(K(ce,a),K(oe,s),K(J,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Fw(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Fw(a),s=qw(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}V(J),K(J,s)}function de(){V(J),V(oe),V(ce)}function Ae(s){s.memoizedState!==null&&K(Y,s);var a=J.current,c=qw(a,s.type);a!==c&&(K(oe,s),K(J,c))}function ke(s){oe.current===s&&(V(J),V(oe)),Y.current===s&&(V(Y),eu._currentValue=U)}var Ee,re;function te(s){if(Ee===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Ee=a&&a[1]||"",re=-1<c.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Ee+s+re}var Ce=!1;function me(s,a){if(!s||Ce)return"";Ce=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={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(le){var ae=le}Reflect.construct(s,[],pe)}else{try{pe.call()}catch(le){ae=le}s.call(pe.prototype)}}else{try{throw Error()}catch(le){ae=le}(pe=s())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(le){if(le&&ae&&typeof le.stack=="string")return[le.stack,ae.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=h.DetermineComponentFrameRoot(),R=x[0],O=x[1];if(R&&O){var X=R.split(`
44
+ `),se=O.split(`
45
+ `);for(_=h=0;h<X.length&&!X[h].includes("DetermineComponentFrameRoot");)h++;for(;_<se.length&&!se[_].includes("DetermineComponentFrameRoot");)_++;if(h===X.length||_===se.length)for(h=X.length-1,_=se.length-1;1<=h&&0<=_&&X[h]!==se[_];)_--;for(;1<=h&&0<=_;h--,_--)if(X[h]!==se[_]){if(h!==1||_!==1)do if(h--,_--,0>_||X[h]!==se[_]){var he=`
46
+ `+X[h].replace(" at new "," at ");return s.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",s.displayName)),he}while(1<=h&&0<=_);break}}}finally{Ce=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?te(c):""}function je(s,a){switch(s.tag){case 26:case 27:case 5:return te(s.type);case 16:return te("Lazy");case 13:return s.child!==a&&a!==null?te("Suspense Fallback"):te("Suspense");case 19:return te("SuspenseList");case 0:case 15:return me(s.type,!1);case 11:return me(s.type.render,!1);case 1:return me(s.type,!0);case 31:return te("Activity");default:return""}}function We(s){try{var a="",c=null;do a+=je(s,c),c=s,s=s.return;while(s);return a}catch(h){return`
47
+ Error generating stack: `+h.message+`
48
+ `+h.stack}}var Te=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,Se=e.unstable_cancelCallback,Ue=e.unstable_shouldYield,Gt=e.unstable_requestPaint,wt=e.unstable_now,Re=e.unstable_getCurrentPriorityLevel,Ve=e.unstable_ImmediatePriority,gt=e.unstable_UserBlockingPriority,mt=e.unstable_NormalPriority,kt=e.unstable_LowPriority,ut=e.unstable_IdlePriority,nr=e.log,qr=e.unstable_setDisableYieldValue,ii=null,ar=null;function St(s){if(typeof nr=="function"&&qr(s),ar&&typeof ar.setStrictMode=="function")try{ar.setStrictMode(ii,s)}catch{}}var or=Math.clz32?Math.clz32:yt,Ar=Math.log,Ai=Math.LN2;function yt(s){return s>>>=0,s===0?32:31-(Ar(s)/Ai|0)|0}var lr=256,ci=262144,Yi=4194304;function mr(s){var a=s&42;if(a!==0)return a;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function He(s,a,c){var h=s.pendingLanes;if(h===0)return 0;var _=0,x=s.suspendedLanes,R=s.pingedLanes;s=s.warmLanes;var O=h&134217727;return O!==0?(h=O&~x,h!==0?_=mr(h):(R&=O,R!==0?_=mr(R):c||(c=O&~s,c!==0&&(_=mr(c))))):(O=h&~x,O!==0?_=mr(O):R!==0?_=mr(R):c||(c=h&~s,c!==0&&(_=mr(c)))),_===0?0:a!==0&&a!==_&&(a&x)===0&&(x=_&-_,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:_}function Tt(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function Ct(s,a){switch(s){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 It(){var s=Yi;return Yi<<=1,(Yi&62914560)===0&&(Yi=4194304),s}function Rt(s){for(var a=[],c=0;31>c;c++)a.push(s);return a}function Mt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function cr(s,a,c,h,_,x){var R=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var O=s.entanglements,X=s.expirationTimes,se=s.hiddenUpdates;for(c=R&~c;0<c;){var he=31-or(c),pe=1<<he;O[he]=0,X[he]=-1;var ae=se[he];if(ae!==null)for(se[he]=null,he=0;he<ae.length;he++){var le=ae[he];le!==null&&(le.lane&=-536870913)}c&=~pe}h!==0&&Ki(s,h,0),x!==0&&_===0&&s.tag!==0&&(s.suspendedLanes|=x&~(R&~a))}function Ki(s,a,c){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-or(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function Wr(s,a){var c=s.entangledLanes|=a;for(s=s.entanglements;c;){var h=31-or(c),_=1<<h;_&a|s[h]&a&&(s[h]|=a),c&=~_}}function Vr(s,a){var c=a&-a;return c=(c&42)!==0?1:pn(c),(c&(s.suspendedLanes|a))!==0?0:c}function pn(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function _i(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function _e(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:fS(s.type))}function Oe(s,a){var c=$.p;try{return $.p=s,a()}finally{$.p=c}}var Qe=Math.random().toString(36).slice(2),at="__reactFiber$"+Qe,vt="__reactProps$"+Qe,xi="__reactContainer$"+Qe,Hs="__reactEvents$"+Qe,gn="__reactListeners$"+Qe,eM="__reactHandles$"+Qe,Ay="__reactResources$"+Qe,pc="__reactMarker$"+Qe;function Qm(s){delete s[at],delete s[vt],delete s[Hs],delete s[gn],delete s[eM]}function Yo(s){var a=s[at];if(a)return a;for(var c=s.parentNode;c;){if(a=c[xi]||c[at]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(s=Zw(s);s!==null;){if(c=s[at])return c;s=Zw(s)}return a}s=c,c=s.parentNode}return null}function Ko(s){if(s=s[at]||s[xi]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function gc(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function Xo(s){var a=s[Ay];return a||(a=s[Ay]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Tr(s){s[pc]=!0}var Ty=new Set,My={};function Za(s,a){Zo(s,a),Zo(s+"Capture",a)}function Zo(s,a){for(My[s]=a,s=0;s<a.length;s++)Ty.add(a[s])}var tM=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]*$"),Dy={},Ly={};function rM(s){return Te.call(Ly,s)?!0:Te.call(Dy,s)?!1:tM.test(s)?Ly[s]=!0:(Dy[s]=!0,!1)}function xd(s,a,c){if(rM(a))if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+c)}}function yd(s,a,c){if(c===null)s.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+c)}}function vn(s,a,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(a,c,""+h)}}function Xi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Oy(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function iM(s,a,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var _=h.get,x=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return _.call(this)},set:function(R){c=""+R,x.call(this,R)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(R){c=""+R},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function Jm(s){if(!s._valueTracker){var a=Oy(s)?"checked":"value";s._valueTracker=iM(s,a,""+s[a])}}function By(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var c=a.getValue(),h="";return s&&(h=Oy(s)?s.checked?"true":"false":s.value),s=h,s!==c?(a.setValue(s),!0):!1}function bd(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var sM=/[\n"\\]/g;function Zi(s){return s.replace(sM,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function ep(s,a,c,h,_,x,R,O){s.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?s.type=R:s.removeAttribute("type"),a!=null?R==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Xi(a)):s.value!==""+Xi(a)&&(s.value=""+Xi(a)):R!=="submit"&&R!=="reset"||s.removeAttribute("value"),a!=null?tp(s,R,Xi(a)):c!=null?tp(s,R,Xi(c)):h!=null&&s.removeAttribute("value"),_==null&&x!=null&&(s.defaultChecked=!!x),_!=null&&(s.checked=_&&typeof _!="function"&&typeof _!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.name=""+Xi(O):s.removeAttribute("name")}function Py(s,a,c,h,_,x,R,O){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Jm(s);return}c=c!=null?""+Xi(c):"",a=a!=null?""+Xi(a):c,O||a===s.value||(s.value=a),s.defaultValue=a}h=h??_,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=O?s.checked:!!h,s.defaultChecked=!!h,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(s.name=R),Jm(s)}function tp(s,a,c){a==="number"&&bd(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function Qo(s,a,c,h){if(s=s.options,a){a={};for(var _=0;_<c.length;_++)a["$"+c[_]]=!0;for(c=0;c<s.length;c++)_=a.hasOwnProperty("$"+s[c].value),s[c].selected!==_&&(s[c].selected=_),_&&h&&(s[c].defaultSelected=!0)}else{for(c=""+Xi(c),a=null,_=0;_<s.length;_++){if(s[_].value===c){s[_].selected=!0,h&&(s[_].defaultSelected=!0);return}a!==null||s[_].disabled||(a=s[_])}a!==null&&(a.selected=!0)}}function zy(s,a,c){if(a!=null&&(a=""+Xi(a),a!==s.value&&(s.value=a),c==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=c!=null?""+Xi(c):""}function Iy(s,a,c,h){if(a==null){if(h!=null){if(c!=null)throw Error(i(92));if(I(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),a=c}c=Xi(a),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),Jm(s)}function Jo(s,a){if(a){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=a;return}}s.textContent=a}var nM=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 $y(s,a,c){var h=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":h?s.setProperty(a,c):typeof c!="number"||c===0||nM.has(a)?a==="float"?s.cssFloat=c:s[a]=(""+c).trim():s[a]=c+"px"}function Uy(s,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var _ in a)h=a[_],a.hasOwnProperty(_)&&c[_]!==h&&$y(s,_,h)}else for(var x in a)a.hasOwnProperty(x)&&$y(s,x,a[x])}function rp(s){if(s.indexOf("-")===-1)return!1;switch(s){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 aM=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"]]),oM=/^[\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 wd(s){return oM.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function _n(){}var ip=null;function sp(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var el=null,tl=null;function Hy(s){var a=Ko(s);if(a&&(s=a.stateNode)){var c=s[vt]||null;e:switch(s=a.stateNode,a.type){case"input":if(ep(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Zi(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var h=c[a];if(h!==s&&h.form===s.form){var _=h[vt]||null;if(!_)throw Error(i(90));ep(h,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<c.length;a++)h=c[a],h.form===s.form&&By(h)}break e;case"textarea":zy(s,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Qo(s,!!c.multiple,a,!1)}}}var np=!1;function Fy(s,a,c){if(np)return s(a,c);np=!0;try{var h=s(a);return h}finally{if(np=!1,(el!==null||tl!==null)&&(ch(),el&&(a=el,s=tl,tl=el=null,Hy(a),s)))for(a=0;a<s.length;a++)Hy(s[a])}}function vc(s,a){var c=s.stateNode;if(c===null)return null;var h=c[vt]||null;if(h===null)return null;c=h[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":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ap=!1;if(xn)try{var _c={};Object.defineProperty(_c,"passive",{get:function(){ap=!0}}),window.addEventListener("test",_c,_c),window.removeEventListener("test",_c,_c)}catch{ap=!1}var Jn=null,op=null,Sd=null;function qy(){if(Sd)return Sd;var s,a=op,c=a.length,h,_="value"in Jn?Jn.value:Jn.textContent,x=_.length;for(s=0;s<c&&a[s]===_[s];s++);var R=c-s;for(h=1;h<=R&&a[c-h]===_[x-h];h++);return Sd=_.slice(s,1<h?1-h:void 0)}function Cd(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Ed(){return!0}function Wy(){return!1}function yi(s){function a(c,h,_,x,R){this._reactName=c,this._targetInst=_,this.type=h,this.nativeEvent=x,this.target=R,this.currentTarget=null;for(var O in s)s.hasOwnProperty(O)&&(c=s[O],this[O]=c?c(x):x[O]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ed:Wy,this.isPropagationStopped=Wy,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=Ed)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ed)},persist:function(){},isPersistent:Ed}),a}var Qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kd=yi(Qa),xc=p({},Qa,{view:0,detail:0}),lM=yi(xc),lp,cp,yc,Rd=p({},xc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dp,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==yc&&(yc&&s.type==="mousemove"?(lp=s.screenX-yc.screenX,cp=s.screenY-yc.screenY):cp=lp=0,yc=s),lp)},movementY:function(s){return"movementY"in s?s.movementY:cp}}),Vy=yi(Rd),cM=p({},Rd,{dataTransfer:0}),uM=yi(cM),dM=p({},xc,{relatedTarget:0}),up=yi(dM),hM=p({},Qa,{animationName:0,elapsedTime:0,pseudoElement:0}),fM=yi(hM),mM=p({},Qa,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),pM=yi(mM),gM=p({},Qa,{data:0}),Gy=yi(gM),vM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_M={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"},xM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yM(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=xM[s])?!!a[s]:!1}function dp(){return yM}var bM=p({},xc,{key:function(s){if(s.key){var a=vM[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Cd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?_M[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dp,charCode:function(s){return s.type==="keypress"?Cd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Cd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),wM=yi(bM),SM=p({},Rd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yy=yi(SM),CM=p({},xc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dp}),EM=yi(CM),kM=p({},Qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),RM=yi(kM),NM=p({},Rd,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),jM=yi(NM),AM=p({},Qa,{newState:0,oldState:0}),TM=yi(AM),MM=[9,13,27,32],hp=xn&&"CompositionEvent"in window,bc=null;xn&&"documentMode"in document&&(bc=document.documentMode);var DM=xn&&"TextEvent"in window&&!bc,Ky=xn&&(!hp||bc&&8<bc&&11>=bc),Xy=" ",Zy=!1;function Qy(s,a){switch(s){case"keyup":return MM.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jy(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var rl=!1;function LM(s,a){switch(s){case"compositionend":return Jy(a);case"keypress":return a.which!==32?null:(Zy=!0,Xy);case"textInput":return s=a.data,s===Xy&&Zy?null:s;default:return null}}function OM(s,a){if(rl)return s==="compositionend"||!hp&&Qy(s,a)?(s=qy(),Sd=op=Jn=null,rl=!1,s):null;switch(s){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 Ky&&a.locale!=="ko"?null:a.data;default:return null}}var BM={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 eb(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!BM[s.type]:a==="textarea"}function tb(s,a,c,h){el?tl?tl.push(h):tl=[h]:el=h,a=gh(a,"onChange"),0<a.length&&(c=new kd("onChange","change",null,c,h),s.push({event:c,listeners:a}))}var wc=null,Sc=null;function PM(s){Pw(s,0)}function Nd(s){var a=gc(s);if(By(a))return s}function rb(s,a){if(s==="change")return a}var ib=!1;if(xn){var fp;if(xn){var mp="oninput"in document;if(!mp){var sb=document.createElement("div");sb.setAttribute("oninput","return;"),mp=typeof sb.oninput=="function"}fp=mp}else fp=!1;ib=fp&&(!document.documentMode||9<document.documentMode)}function nb(){wc&&(wc.detachEvent("onpropertychange",ab),Sc=wc=null)}function ab(s){if(s.propertyName==="value"&&Nd(Sc)){var a=[];tb(a,Sc,s,sp(s)),Fy(PM,a)}}function zM(s,a,c){s==="focusin"?(nb(),wc=a,Sc=c,wc.attachEvent("onpropertychange",ab)):s==="focusout"&&nb()}function IM(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Nd(Sc)}function $M(s,a){if(s==="click")return Nd(a)}function UM(s,a){if(s==="input"||s==="change")return Nd(a)}function HM(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var Ti=typeof Object.is=="function"?Object.is:HM;function Cc(s,a){if(Ti(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var c=Object.keys(s),h=Object.keys(a);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var _=c[h];if(!Te.call(a,_)||!Ti(s[_],a[_]))return!1}return!0}function ob(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function lb(s,a){var c=ob(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=a&&h>=a)return{node:c,offset:a-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=ob(c)}}function cb(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?cb(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function ub(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=bd(s.document);a instanceof s.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)s=a.contentWindow;else break;a=bd(s.document)}return a}function pp(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var FM=xn&&"documentMode"in document&&11>=document.documentMode,il=null,gp=null,Ec=null,vp=!1;function db(s,a,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;vp||il==null||il!==bd(h)||(h=il,"selectionStart"in h&&pp(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ec&&Cc(Ec,h)||(Ec=h,h=gh(gp,"onSelect"),0<h.length&&(a=new kd("onSelect","select",null,a,c),s.push({event:a,listeners:h}),a.target=il)))}function Ja(s,a){var c={};return c[s.toLowerCase()]=a.toLowerCase(),c["Webkit"+s]="webkit"+a,c["Moz"+s]="moz"+a,c}var sl={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionrun:Ja("Transition","TransitionRun"),transitionstart:Ja("Transition","TransitionStart"),transitioncancel:Ja("Transition","TransitionCancel"),transitionend:Ja("Transition","TransitionEnd")},_p={},hb={};xn&&(hb=document.createElement("div").style,"AnimationEvent"in window||(delete sl.animationend.animation,delete sl.animationiteration.animation,delete sl.animationstart.animation),"TransitionEvent"in window||delete sl.transitionend.transition);function eo(s){if(_p[s])return _p[s];if(!sl[s])return s;var a=sl[s],c;for(c in a)if(a.hasOwnProperty(c)&&c in hb)return _p[s]=a[c];return s}var fb=eo("animationend"),mb=eo("animationiteration"),pb=eo("animationstart"),qM=eo("transitionrun"),WM=eo("transitionstart"),VM=eo("transitioncancel"),gb=eo("transitionend"),vb=new Map,xp="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(" ");xp.push("scrollEnd");function Cs(s,a){vb.set(s,a),Za(a,[s])}var jd=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Qi=[],nl=0,yp=0;function Ad(){for(var s=nl,a=yp=nl=0;a<s;){var c=Qi[a];Qi[a++]=null;var h=Qi[a];Qi[a++]=null;var _=Qi[a];Qi[a++]=null;var x=Qi[a];if(Qi[a++]=null,h!==null&&_!==null){var R=h.pending;R===null?_.next=_:(_.next=R.next,R.next=_),h.pending=_}x!==0&&_b(c,_,x)}}function Td(s,a,c,h){Qi[nl++]=s,Qi[nl++]=a,Qi[nl++]=c,Qi[nl++]=h,yp|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function bp(s,a,c,h){return Td(s,a,c,h),Md(s)}function to(s,a){return Td(s,null,null,a),Md(s)}function _b(s,a,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var _=!1,x=s.return;x!==null;)x.childLanes|=c,h=x.alternate,h!==null&&(h.childLanes|=c),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(_=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,_&&a!==null&&(_=31-or(c),s=x.hiddenUpdates,h=s[_],h===null?s[_]=[a]:h.push(a),a.lane=c|536870912),x):null}function Md(s){if(50<Gc)throw Gc=0,Ag=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var al={};function GM(s,a,c,h){this.tag=s,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(s,a,c,h){return new GM(s,a,c,h)}function wp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function yn(s,a){var c=s.alternate;return c===null?(c=Mi(s.tag,a,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=a,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,a=s.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function xb(s,a){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,a=c.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Dd(s,a,c,h,_,x){var R=0;if(h=s,typeof s=="function")wp(s)&&(R=1);else if(typeof s=="string")R=Q3(s,c,J.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case G:return s=Mi(31,c,a,_),s.elementType=G,s.lanes=x,s;case C:return ro(c.children,_,x,a);case E:R=8,_|=24;break;case S:return s=Mi(12,c,a,_|2),s.elementType=S,s.lanes=x,s;case M:return s=Mi(13,c,a,_),s.elementType=M,s.lanes=x,s;case D:return s=Mi(19,c,a,_),s.elementType=D,s.lanes=x,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case j:R=10;break e;case k:R=9;break e;case N:R=11;break e;case H:R=14;break e;case L:R=16,h=null;break e}R=29,c=Error(i(130,s===null?"null":typeof s,"")),h=null}return a=Mi(R,c,a,_),a.elementType=s,a.type=h,a.lanes=x,a}function ro(s,a,c,h){return s=Mi(7,s,h,a),s.lanes=c,s}function Sp(s,a,c){return s=Mi(6,s,null,a),s.lanes=c,s}function yb(s){var a=Mi(18,null,null,0);return a.stateNode=s,a}function Cp(s,a,c){return a=Mi(4,s.children!==null?s.children:[],s.key,a),a.lanes=c,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var bb=new WeakMap;function Ji(s,a){if(typeof s=="object"&&s!==null){var c=bb.get(s);return c!==void 0?c:(a={value:s,source:a,stack:We(a)},bb.set(s,a),a)}return{value:s,source:a,stack:We(a)}}var ol=[],ll=0,Ld=null,kc=0,es=[],ts=0,ea=null,Fs=1,qs="";function bn(s,a){ol[ll++]=kc,ol[ll++]=Ld,Ld=s,kc=a}function wb(s,a,c){es[ts++]=Fs,es[ts++]=qs,es[ts++]=ea,ea=s;var h=Fs;s=qs;var _=32-or(h)-1;h&=~(1<<_),c+=1;var x=32-or(a)+_;if(30<x){var R=_-_%5;x=(h&(1<<R)-1).toString(32),h>>=R,_-=R,Fs=1<<32-or(a)+_|c<<_|h,qs=x+s}else Fs=1<<x|c<<_|h,qs=s}function Ep(s){s.return!==null&&(bn(s,1),wb(s,1,0))}function kp(s){for(;s===Ld;)Ld=ol[--ll],ol[ll]=null,kc=ol[--ll],ol[ll]=null;for(;s===ea;)ea=es[--ts],es[ts]=null,qs=es[--ts],es[ts]=null,Fs=es[--ts],es[ts]=null}function Sb(s,a){es[ts++]=Fs,es[ts++]=qs,es[ts++]=ea,Fs=a.id,qs=a.overflow,ea=s}var Gr=null,$t=null,ft=!1,ta=null,rs=!1,Rp=Error(i(519));function ra(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rc(Ji(a,s)),Rp}function Cb(s){var a=s.stateNode,c=s.type,h=s.memoizedProps;switch(a[at]=s,a[vt]=h,c){case"dialog":lt("cancel",a),lt("close",a);break;case"iframe":case"object":case"embed":lt("load",a);break;case"video":case"audio":for(c=0;c<Kc.length;c++)lt(Kc[c],a);break;case"source":lt("error",a);break;case"img":case"image":case"link":lt("error",a),lt("load",a);break;case"details":lt("toggle",a);break;case"input":lt("invalid",a),Py(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":lt("invalid",a);break;case"textarea":lt("invalid",a),Iy(a,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||h.suppressHydrationWarning===!0||Uw(a.textContent,c)?(h.popover!=null&&(lt("beforetoggle",a),lt("toggle",a)),h.onScroll!=null&&lt("scroll",a),h.onScrollEnd!=null&&lt("scrollend",a),h.onClick!=null&&(a.onclick=_n),a=!0):a=!1,a||ra(s,!0)}function Eb(s){for(Gr=s.return;Gr;)switch(Gr.tag){case 5:case 31:case 13:rs=!1;return;case 27:case 3:rs=!0;return;default:Gr=Gr.return}}function cl(s){if(s!==Gr)return!1;if(!ft)return Eb(s),ft=!0,!1;var a=s.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Wg(s.type,s.memoizedProps)),c=!c),c&&$t&&ra(s),Eb(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));$t=Xw(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));$t=Xw(s)}else a===27?(a=$t,ga(s.type)?(s=Xg,Xg=null,$t=s):$t=a):$t=Gr?ss(s.stateNode.nextSibling):null;return!0}function io(){$t=Gr=null,ft=!1}function Np(){var s=ta;return s!==null&&(Ci===null?Ci=s:Ci.push.apply(Ci,s),ta=null),s}function Rc(s){ta===null?ta=[s]:ta.push(s)}var jp=T(null),so=null,wn=null;function ia(s,a,c){K(jp,a._currentValue),a._currentValue=c}function Sn(s){s._currentValue=jp.current,V(jp)}function Ap(s,a,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),s===c)break;s=s.return}}function Tp(s,a,c,h){var _=s.child;for(_!==null&&(_.return=s);_!==null;){var x=_.dependencies;if(x!==null){var R=_.child;x=x.firstContext;e:for(;x!==null;){var O=x;x=_;for(var X=0;X<a.length;X++)if(O.context===a[X]){x.lanes|=c,O=x.alternate,O!==null&&(O.lanes|=c),Ap(x.return,c,s),h||(R=null);break e}x=O.next}}else if(_.tag===18){if(R=_.return,R===null)throw Error(i(341));R.lanes|=c,x=R.alternate,x!==null&&(x.lanes|=c),Ap(R,c,s),R=null}else R=_.child;if(R!==null)R.return=_;else for(R=_;R!==null;){if(R===s){R=null;break}if(_=R.sibling,_!==null){_.return=R.return,R=_;break}R=R.return}_=R}}function ul(s,a,c,h){s=null;for(var _=a,x=!1;_!==null;){if(!x){if((_.flags&524288)!==0)x=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var R=_.alternate;if(R===null)throw Error(i(387));if(R=R.memoizedProps,R!==null){var O=_.type;Ti(_.pendingProps.value,R.value)||(s!==null?s.push(O):s=[O])}}else if(_===Y.current){if(R=_.alternate,R===null)throw Error(i(387));R.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(s!==null?s.push(eu):s=[eu])}_=_.return}s!==null&&Tp(a,s,c,h),a.flags|=262144}function Od(s){for(s=s.firstContext;s!==null;){if(!Ti(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function no(s){so=s,wn=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Yr(s){return kb(so,s)}function Bd(s,a){return so===null&&no(s),kb(s,a)}function kb(s,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},wn===null){if(s===null)throw Error(i(308));wn=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else wn=wn.next=a;return c}var YM=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){a.aborted=!0,s.forEach(function(c){return c()})}},KM=e.unstable_scheduleCallback,XM=e.unstable_NormalPriority,pr={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mp(){return{controller:new YM,data:new Map,refCount:0}}function Nc(s){s.refCount--,s.refCount===0&&KM(XM,function(){s.controller.abort()})}var jc=null,Dp=0,dl=0,hl=null;function ZM(s,a){if(jc===null){var c=jc=[];Dp=0,dl=Bg(),hl={status:"pending",value:void 0,then:function(h){c.push(h)}}}return Dp++,a.then(Rb,Rb),a}function Rb(){if(--Dp===0&&jc!==null){hl!==null&&(hl.status="fulfilled");var s=jc;jc=null,dl=0,hl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function QM(s,a){var c=[],h={status:"pending",value:null,reason:null,then:function(_){c.push(_)}};return s.then(function(){h.status="fulfilled",h.value=a;for(var _=0;_<c.length;_++)(0,c[_])(a)},function(_){for(h.status="rejected",h.reason=_,_=0;_<c.length;_++)(0,c[_])(void 0)}),h}var Nb=A.S;A.S=function(s,a){dw=wt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&ZM(s,a),Nb!==null&&Nb(s,a)};var ao=T(null);function Lp(){var s=ao.current;return s!==null?s:zt.pooledCache}function Pd(s,a){a===null?K(ao,ao.current):K(ao,a.pool)}function jb(){var s=Lp();return s===null?null:{parent:pr._currentValue,pool:s}}var fl=Error(i(460)),Op=Error(i(474)),zd=Error(i(542)),Id={then:function(){}};function Ab(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Tb(s,a,c){switch(c=s[c],c===void 0?s.push(a):c!==a&&(a.then(_n,_n),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Db(s),s;default:if(typeof a.status=="string")a.then(_n,_n);else{if(s=zt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=h}},function(h){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Db(s),s}throw lo=a,fl}}function oo(s){try{var a=s._init;return a(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(lo=c,fl):c}}var lo=null;function Mb(){if(lo===null)throw Error(i(459));var s=lo;return lo=null,s}function Db(s){if(s===fl||s===zd)throw Error(i(483))}var ml=null,Ac=0;function $d(s){var a=Ac;return Ac+=1,ml===null&&(ml=[]),Tb(ml,s,a)}function Tc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Ud(s,a){throw a.$$typeof===y?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function Lb(s){function a(ee,Q){if(s){var ie=ee.deletions;ie===null?(ee.deletions=[Q],ee.flags|=16):ie.push(Q)}}function c(ee,Q){if(!s)return null;for(;Q!==null;)a(ee,Q),Q=Q.sibling;return null}function h(ee){for(var Q=new Map;ee!==null;)ee.key!==null?Q.set(ee.key,ee):Q.set(ee.index,ee),ee=ee.sibling;return Q}function _(ee,Q){return ee=yn(ee,Q),ee.index=0,ee.sibling=null,ee}function x(ee,Q,ie){return ee.index=ie,s?(ie=ee.alternate,ie!==null?(ie=ie.index,ie<Q?(ee.flags|=67108866,Q):ie):(ee.flags|=67108866,Q)):(ee.flags|=1048576,Q)}function R(ee){return s&&ee.alternate===null&&(ee.flags|=67108866),ee}function O(ee,Q,ie,fe){return Q===null||Q.tag!==6?(Q=Sp(ie,ee.mode,fe),Q.return=ee,Q):(Q=_(Q,ie),Q.return=ee,Q)}function X(ee,Q,ie,fe){var Ie=ie.type;return Ie===C?he(ee,Q,ie.props.children,fe,ie.key):Q!==null&&(Q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===L&&oo(Ie)===Q.type)?(Q=_(Q,ie.props),Tc(Q,ie),Q.return=ee,Q):(Q=Dd(ie.type,ie.key,ie.props,null,ee.mode,fe),Tc(Q,ie),Q.return=ee,Q)}function se(ee,Q,ie,fe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ie.containerInfo||Q.stateNode.implementation!==ie.implementation?(Q=Cp(ie,ee.mode,fe),Q.return=ee,Q):(Q=_(Q,ie.children||[]),Q.return=ee,Q)}function he(ee,Q,ie,fe,Ie){return Q===null||Q.tag!==7?(Q=ro(ie,ee.mode,fe,Ie),Q.return=ee,Q):(Q=_(Q,ie),Q.return=ee,Q)}function pe(ee,Q,ie){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Sp(""+Q,ee.mode,ie),Q.return=ee,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return ie=Dd(Q.type,Q.key,Q.props,null,ee.mode,ie),Tc(ie,Q),ie.return=ee,ie;case w:return Q=Cp(Q,ee.mode,ie),Q.return=ee,Q;case L:return Q=oo(Q),pe(ee,Q,ie)}if(I(Q)||P(Q))return Q=ro(Q,ee.mode,ie,null),Q.return=ee,Q;if(typeof Q.then=="function")return pe(ee,$d(Q),ie);if(Q.$$typeof===j)return pe(ee,Bd(ee,Q),ie);Ud(ee,Q)}return null}function ae(ee,Q,ie,fe){var Ie=Q!==null?Q.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Ie!==null?null:O(ee,Q,""+ie,fe);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case b:return ie.key===Ie?X(ee,Q,ie,fe):null;case w:return ie.key===Ie?se(ee,Q,ie,fe):null;case L:return ie=oo(ie),ae(ee,Q,ie,fe)}if(I(ie)||P(ie))return Ie!==null?null:he(ee,Q,ie,fe,null);if(typeof ie.then=="function")return ae(ee,Q,$d(ie),fe);if(ie.$$typeof===j)return ae(ee,Q,Bd(ee,ie),fe);Ud(ee,ie)}return null}function le(ee,Q,ie,fe,Ie){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return ee=ee.get(ie)||null,O(Q,ee,""+fe,Ie);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return ee=ee.get(fe.key===null?ie:fe.key)||null,X(Q,ee,fe,Ie);case w:return ee=ee.get(fe.key===null?ie:fe.key)||null,se(Q,ee,fe,Ie);case L:return fe=oo(fe),le(ee,Q,ie,fe,Ie)}if(I(fe)||P(fe))return ee=ee.get(ie)||null,he(Q,ee,fe,Ie,null);if(typeof fe.then=="function")return le(ee,Q,ie,$d(fe),Ie);if(fe.$$typeof===j)return le(ee,Q,ie,Bd(Q,fe),Ie);Ud(Q,fe)}return null}function Le(ee,Q,ie,fe){for(var Ie=null,_t=null,Be=Q,Ze=Q=0,ht=null;Be!==null&&Ze<ie.length;Ze++){Be.index>Ze?(ht=Be,Be=null):ht=Be.sibling;var xt=ae(ee,Be,ie[Ze],fe);if(xt===null){Be===null&&(Be=ht);break}s&&Be&&xt.alternate===null&&a(ee,Be),Q=x(xt,Q,Ze),_t===null?Ie=xt:_t.sibling=xt,_t=xt,Be=ht}if(Ze===ie.length)return c(ee,Be),ft&&bn(ee,Ze),Ie;if(Be===null){for(;Ze<ie.length;Ze++)Be=pe(ee,ie[Ze],fe),Be!==null&&(Q=x(Be,Q,Ze),_t===null?Ie=Be:_t.sibling=Be,_t=Be);return ft&&bn(ee,Ze),Ie}for(Be=h(Be);Ze<ie.length;Ze++)ht=le(Be,ee,Ze,ie[Ze],fe),ht!==null&&(s&&ht.alternate!==null&&Be.delete(ht.key===null?Ze:ht.key),Q=x(ht,Q,Ze),_t===null?Ie=ht:_t.sibling=ht,_t=ht);return s&&Be.forEach(function(ba){return a(ee,ba)}),ft&&bn(ee,Ze),Ie}function Fe(ee,Q,ie,fe){if(ie==null)throw Error(i(151));for(var Ie=null,_t=null,Be=Q,Ze=Q=0,ht=null,xt=ie.next();Be!==null&&!xt.done;Ze++,xt=ie.next()){Be.index>Ze?(ht=Be,Be=null):ht=Be.sibling;var ba=ae(ee,Be,xt.value,fe);if(ba===null){Be===null&&(Be=ht);break}s&&Be&&ba.alternate===null&&a(ee,Be),Q=x(ba,Q,Ze),_t===null?Ie=ba:_t.sibling=ba,_t=ba,Be=ht}if(xt.done)return c(ee,Be),ft&&bn(ee,Ze),Ie;if(Be===null){for(;!xt.done;Ze++,xt=ie.next())xt=pe(ee,xt.value,fe),xt!==null&&(Q=x(xt,Q,Ze),_t===null?Ie=xt:_t.sibling=xt,_t=xt);return ft&&bn(ee,Ze),Ie}for(Be=h(Be);!xt.done;Ze++,xt=ie.next())xt=le(Be,ee,Ze,xt.value,fe),xt!==null&&(s&&xt.alternate!==null&&Be.delete(xt.key===null?Ze:xt.key),Q=x(xt,Q,Ze),_t===null?Ie=xt:_t.sibling=xt,_t=xt);return s&&Be.forEach(function(cD){return a(ee,cD)}),ft&&bn(ee,Ze),Ie}function Ot(ee,Q,ie,fe){if(typeof ie=="object"&&ie!==null&&ie.type===C&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case b:e:{for(var Ie=ie.key;Q!==null;){if(Q.key===Ie){if(Ie=ie.type,Ie===C){if(Q.tag===7){c(ee,Q.sibling),fe=_(Q,ie.props.children),fe.return=ee,ee=fe;break e}}else if(Q.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===L&&oo(Ie)===Q.type){c(ee,Q.sibling),fe=_(Q,ie.props),Tc(fe,ie),fe.return=ee,ee=fe;break e}c(ee,Q);break}else a(ee,Q);Q=Q.sibling}ie.type===C?(fe=ro(ie.props.children,ee.mode,fe,ie.key),fe.return=ee,ee=fe):(fe=Dd(ie.type,ie.key,ie.props,null,ee.mode,fe),Tc(fe,ie),fe.return=ee,ee=fe)}return R(ee);case w:e:{for(Ie=ie.key;Q!==null;){if(Q.key===Ie)if(Q.tag===4&&Q.stateNode.containerInfo===ie.containerInfo&&Q.stateNode.implementation===ie.implementation){c(ee,Q.sibling),fe=_(Q,ie.children||[]),fe.return=ee,ee=fe;break e}else{c(ee,Q);break}else a(ee,Q);Q=Q.sibling}fe=Cp(ie,ee.mode,fe),fe.return=ee,ee=fe}return R(ee);case L:return ie=oo(ie),Ot(ee,Q,ie,fe)}if(I(ie))return Le(ee,Q,ie,fe);if(P(ie)){if(Ie=P(ie),typeof Ie!="function")throw Error(i(150));return ie=Ie.call(ie),Fe(ee,Q,ie,fe)}if(typeof ie.then=="function")return Ot(ee,Q,$d(ie),fe);if(ie.$$typeof===j)return Ot(ee,Q,Bd(ee,ie),fe);Ud(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,Q!==null&&Q.tag===6?(c(ee,Q.sibling),fe=_(Q,ie),fe.return=ee,ee=fe):(c(ee,Q),fe=Sp(ie,ee.mode,fe),fe.return=ee,ee=fe),R(ee)):c(ee,Q)}return function(ee,Q,ie,fe){try{Ac=0;var Ie=Ot(ee,Q,ie,fe);return ml=null,Ie}catch(Be){if(Be===fl||Be===zd)throw Be;var _t=Mi(29,Be,null,ee.mode);return _t.lanes=fe,_t.return=ee,_t}finally{}}}var co=Lb(!0),Ob=Lb(!1),sa=!1;function Bp(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pp(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function na(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function aa(s,a,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(bt&2)!==0){var _=h.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),h.pending=a,a=Md(s),_b(s,null,c),a}return Td(s,h,a,c),Md(s)}function Mc(s,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var h=a.lanes;h&=s.pendingLanes,c|=h,a.lanes=c,Wr(s,c)}}function zp(s,a){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var _=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var R={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?_=x=R:x=x.next=R,c=c.next}while(c!==null);x===null?_=x=a:x=x.next=a}else _=x=a;c={baseState:h.baseState,firstBaseUpdate:_,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=a:s.next=a,c.lastBaseUpdate=a}var Ip=!1;function Dc(){if(Ip){var s=hl;if(s!==null)throw s}}function Lc(s,a,c,h){Ip=!1;var _=s.updateQueue;sa=!1;var x=_.firstBaseUpdate,R=_.lastBaseUpdate,O=_.shared.pending;if(O!==null){_.shared.pending=null;var X=O,se=X.next;X.next=null,R===null?x=se:R.next=se,R=X;var he=s.alternate;he!==null&&(he=he.updateQueue,O=he.lastBaseUpdate,O!==R&&(O===null?he.firstBaseUpdate=se:O.next=se,he.lastBaseUpdate=X))}if(x!==null){var pe=_.baseState;R=0,he=se=X=null,O=x;do{var ae=O.lane&-536870913,le=ae!==O.lane;if(le?(dt&ae)===ae:(h&ae)===ae){ae!==0&&ae===dl&&(Ip=!0),he!==null&&(he=he.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Le=s,Fe=O;ae=a;var Ot=c;switch(Fe.tag){case 1:if(Le=Fe.payload,typeof Le=="function"){pe=Le.call(Ot,pe,ae);break e}pe=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Fe.payload,ae=typeof Le=="function"?Le.call(Ot,pe,ae):Le,ae==null)break e;pe=p({},pe,ae);break e;case 2:sa=!0}}ae=O.callback,ae!==null&&(s.flags|=64,le&&(s.flags|=8192),le=_.callbacks,le===null?_.callbacks=[ae]:le.push(ae))}else le={lane:ae,tag:O.tag,payload:O.payload,callback:O.callback,next:null},he===null?(se=he=le,X=pe):he=he.next=le,R|=ae;if(O=O.next,O===null){if(O=_.shared.pending,O===null)break;le=O,O=le.next,le.next=null,_.lastBaseUpdate=le,_.shared.pending=null}}while(!0);he===null&&(X=pe),_.baseState=X,_.firstBaseUpdate=se,_.lastBaseUpdate=he,x===null&&(_.shared.lanes=0),da|=R,s.lanes=R,s.memoizedState=pe}}function Bb(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function Pb(s,a){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Bb(c[s],a)}var pl=T(null),Hd=T(0);function zb(s,a){s=Mn,K(Hd,s),K(pl,a),Mn=s|a.baseLanes}function $p(){K(Hd,Mn),K(pl,pl.current)}function Up(){Mn=Hd.current,V(pl),V(Hd)}var Di=T(null),is=null;function oa(s){var a=s.alternate;K(ur,ur.current&1),K(Di,s),is===null&&(a===null||pl.current!==null||a.memoizedState!==null)&&(is=s)}function Hp(s){K(ur,ur.current),K(Di,s),is===null&&(is=s)}function Ib(s){s.tag===22?(K(ur,ur.current),K(Di,s),is===null&&(is=s)):la()}function la(){K(ur,ur.current),K(Di,Di.current)}function Li(s){V(Di),is===s&&(is=null),V(ur)}var ur=T(0);function Fd(s){for(var a=s;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Yg(c)||Kg(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===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Cn=0,Xe=null,Dt=null,gr=null,qd=!1,gl=!1,uo=!1,Wd=0,Oc=0,vl=null,JM=0;function Zt(){throw Error(i(321))}function Fp(s,a){if(a===null)return!1;for(var c=0;c<a.length&&c<s.length;c++)if(!Ti(s[c],a[c]))return!1;return!0}function qp(s,a,c,h,_,x){return Cn=x,Xe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=s===null||s.memoizedState===null?w1:ng,uo=!1,x=c(h,_),uo=!1,gl&&(x=Ub(a,c,h,_)),$b(s),x}function $b(s){A.H=zc;var a=Dt!==null&&Dt.next!==null;if(Cn=0,gr=Dt=Xe=null,qd=!1,Oc=0,vl=null,a)throw Error(i(300));s===null||vr||(s=s.dependencies,s!==null&&Od(s)&&(vr=!0))}function Ub(s,a,c,h){Xe=s;var _=0;do{if(gl&&(vl=null),Oc=0,gl=!1,25<=_)throw Error(i(301));if(_+=1,gr=Dt=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}A.H=S1,x=a(c,h)}while(gl);return x}function e3(){var s=A.H,a=s.useState()[0];return a=typeof a.then=="function"?Bc(a):a,s=s.useState()[0],(Dt!==null?Dt.memoizedState:null)!==s&&(Xe.flags|=1024),a}function Wp(){var s=Wd!==0;return Wd=0,s}function Vp(s,a,c){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~c}function Gp(s){if(qd){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}qd=!1}Cn=0,gr=Dt=Xe=null,gl=!1,Oc=Wd=0,vl=null}function ui(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gr===null?Xe.memoizedState=gr=s:gr=gr.next=s,gr}function dr(){if(Dt===null){var s=Xe.alternate;s=s!==null?s.memoizedState:null}else s=Dt.next;var a=gr===null?Xe.memoizedState:gr.next;if(a!==null)gr=a,Dt=s;else{if(s===null)throw Xe.alternate===null?Error(i(467)):Error(i(310));Dt=s,s={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},gr===null?Xe.memoizedState=gr=s:gr=gr.next=s}return gr}function Vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bc(s){var a=Oc;return Oc+=1,vl===null&&(vl=[]),s=Tb(vl,s,a),a=Xe,(gr===null?a.memoizedState:gr.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?w1:ng),s}function Gd(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Bc(s);if(s.$$typeof===j)return Yr(s)}throw Error(i(438,String(s)))}function Yp(s){var a=null,c=Xe.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var h=Xe.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Vd(),Xe.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(s),h=0;h<s;h++)c[h]=Z;return a.index++,c}function En(s,a){return typeof a=="function"?a(s):a}function Yd(s){var a=dr();return Kp(a,Dt,s)}function Kp(s,a,c){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var _=s.baseQueue,x=h.pending;if(x!==null){if(_!==null){var R=_.next;_.next=x.next,x.next=R}a.baseQueue=_=x,h.pending=null}if(x=s.baseState,_===null)s.memoizedState=x;else{a=_.next;var O=R=null,X=null,se=a,he=!1;do{var pe=se.lane&-536870913;if(pe!==se.lane?(dt&pe)===pe:(Cn&pe)===pe){var ae=se.revertLane;if(ae===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),pe===dl&&(he=!0);else if((Cn&ae)===ae){se=se.next,ae===dl&&(he=!0);continue}else pe={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},X===null?(O=X=pe,R=x):X=X.next=pe,Xe.lanes|=ae,da|=ae;pe=se.action,uo&&c(x,pe),x=se.hasEagerState?se.eagerState:c(x,pe)}else ae={lane:pe,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},X===null?(O=X=ae,R=x):X=X.next=ae,Xe.lanes|=pe,da|=pe;se=se.next}while(se!==null&&se!==a);if(X===null?R=x:X.next=O,!Ti(x,s.memoizedState)&&(vr=!0,he&&(c=hl,c!==null)))throw c;s.memoizedState=x,s.baseState=R,s.baseQueue=X,h.lastRenderedState=x}return _===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function Xp(s){var a=dr(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var h=c.dispatch,_=c.pending,x=a.memoizedState;if(_!==null){c.pending=null;var R=_=_.next;do x=s(x,R.action),R=R.next;while(R!==_);Ti(x,a.memoizedState)||(vr=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,h]}function Hb(s,a,c){var h=Xe,_=dr(),x=ft;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=a();var R=!Ti((Dt||_).memoizedState,c);if(R&&(_.memoizedState=c,vr=!0),_=_.queue,Jp(Wb.bind(null,h,_,s),[s]),_.getSnapshot!==a||R||gr!==null&&gr.memoizedState.tag&1){if(h.flags|=2048,_l(9,{destroy:void 0},qb.bind(null,h,_,c,a),null),zt===null)throw Error(i(349));x||(Cn&127)!==0||Fb(h,a,c)}return c}function Fb(s,a,c){s.flags|=16384,s={getSnapshot:a,value:c},a=Xe.updateQueue,a===null?(a=Vd(),Xe.updateQueue=a,a.stores=[s]):(c=a.stores,c===null?a.stores=[s]:c.push(s))}function qb(s,a,c,h){a.value=c,a.getSnapshot=h,Vb(a)&&Gb(s)}function Wb(s,a,c){return c(function(){Vb(a)&&Gb(s)})}function Vb(s){var a=s.getSnapshot;s=s.value;try{var c=a();return!Ti(s,c)}catch{return!0}}function Gb(s){var a=to(s,2);a!==null&&Ei(a,s,2)}function Zp(s){var a=ui();if(typeof s=="function"){var c=s;if(s=c(),uo){St(!0);try{c()}finally{St(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:s},a}function Yb(s,a,c,h){return s.baseState=c,Kp(s,Dt,typeof h=="function"?h:En)}function t3(s,a,c,h,_){if(Zd(s))throw Error(i(485));if(s=a.action,s!==null){var x={payload:_,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){x.listeners.push(R)}};A.T!==null?c(!0):x.isTransition=!1,h(x),c=a.pending,c===null?(x.next=a.pending=x,Kb(a,x)):(x.next=c.next,a.pending=c.next=x)}}function Kb(s,a){var c=a.action,h=a.payload,_=s.state;if(a.isTransition){var x=A.T,R={};A.T=R;try{var O=c(_,h),X=A.S;X!==null&&X(R,O),Xb(s,a,O)}catch(se){Qp(s,a,se)}finally{x!==null&&R.types!==null&&(x.types=R.types),A.T=x}}else try{x=c(_,h),Xb(s,a,x)}catch(se){Qp(s,a,se)}}function Xb(s,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){Zb(s,a,h)},function(h){return Qp(s,a,h)}):Zb(s,a,c)}function Zb(s,a,c){a.status="fulfilled",a.value=c,Qb(a),s.state=c,a=s.pending,a!==null&&(c=a.next,c===a?s.pending=null:(c=c.next,a.next=c,Kb(s,c)))}function Qp(s,a,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=c,Qb(a),a=a.next;while(a!==h)}s.action=null}function Qb(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function Jb(s,a){return a}function e1(s,a){if(ft){var c=zt.formState;if(c!==null){e:{var h=Xe;if(ft){if($t){t:{for(var _=$t,x=rs;_.nodeType!==8;){if(!x){_=null;break t}if(_=ss(_.nextSibling),_===null){_=null;break t}}x=_.data,_=x==="F!"||x==="F"?_:null}if(_){$t=ss(_.nextSibling),h=_.data==="F!";break e}}ra(h)}h=!1}h&&(a=c[0])}}return c=ui(),c.memoizedState=c.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jb,lastRenderedState:a},c.queue=h,c=x1.bind(null,Xe,h),h.dispatch=c,h=Zp(!1),x=sg.bind(null,Xe,!1,h.queue),h=ui(),_={state:a,dispatch:null,action:s,pending:null},h.queue=_,c=t3.bind(null,Xe,_,x,c),_.dispatch=c,h.memoizedState=s,[a,c,!1]}function t1(s){var a=dr();return r1(a,Dt,s)}function r1(s,a,c){if(a=Kp(s,a,Jb)[0],s=Yd(En)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Bc(a)}catch(R){throw R===fl?zd:R}else h=a;a=dr();var _=a.queue,x=_.dispatch;return c!==a.memoizedState&&(Xe.flags|=2048,_l(9,{destroy:void 0},r3.bind(null,_,c),null)),[h,x,s]}function r3(s,a){s.action=a}function i1(s){var a=dr(),c=Dt;if(c!==null)return r1(a,c,s);dr(),a=a.memoizedState,c=dr();var h=c.queue.dispatch;return c.memoizedState=s,[a,h,!1]}function _l(s,a,c,h){return s={tag:s,create:c,deps:h,inst:a,next:null},a=Xe.updateQueue,a===null&&(a=Vd(),Xe.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,a.lastEffect=s),s}function s1(){return dr().memoizedState}function Kd(s,a,c,h){var _=ui();Xe.flags|=s,_.memoizedState=_l(1|a,{destroy:void 0},c,h===void 0?null:h)}function Xd(s,a,c,h){var _=dr();h=h===void 0?null:h;var x=_.memoizedState.inst;Dt!==null&&h!==null&&Fp(h,Dt.memoizedState.deps)?_.memoizedState=_l(a,x,c,h):(Xe.flags|=s,_.memoizedState=_l(1|a,x,c,h))}function n1(s,a){Kd(8390656,8,s,a)}function Jp(s,a){Xd(2048,8,s,a)}function i3(s){Xe.flags|=4;var a=Xe.updateQueue;if(a===null)a=Vd(),Xe.updateQueue=a,a.events=[s];else{var c=a.events;c===null?a.events=[s]:c.push(s)}}function a1(s){var a=dr().memoizedState;return i3({ref:a,nextImpl:s}),function(){if((bt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function o1(s,a){return Xd(4,2,s,a)}function l1(s,a){return Xd(4,4,s,a)}function c1(s,a){if(typeof a=="function"){s=s();var c=a(s);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function u1(s,a,c){c=c!=null?c.concat([s]):null,Xd(4,4,c1.bind(null,a,s),c)}function eg(){}function d1(s,a){var c=dr();a=a===void 0?null:a;var h=c.memoizedState;return a!==null&&Fp(a,h[1])?h[0]:(c.memoizedState=[s,a],s)}function h1(s,a){var c=dr();a=a===void 0?null:a;var h=c.memoizedState;if(a!==null&&Fp(a,h[1]))return h[0];if(h=s(),uo){St(!0);try{s()}finally{St(!1)}}return c.memoizedState=[h,a],h}function tg(s,a,c){return c===void 0||(Cn&1073741824)!==0&&(dt&261930)===0?s.memoizedState=a:(s.memoizedState=c,s=fw(),Xe.lanes|=s,da|=s,c)}function f1(s,a,c,h){return Ti(c,a)?c:pl.current!==null?(s=tg(s,c,h),Ti(s,a)||(vr=!0),s):(Cn&42)===0||(Cn&1073741824)!==0&&(dt&261930)===0?(vr=!0,s.memoizedState=c):(s=fw(),Xe.lanes|=s,da|=s,a)}function m1(s,a,c,h,_){var x=$.p;$.p=x!==0&&8>x?x:8;var R=A.T,O={};A.T=O,sg(s,!1,a,c);try{var X=_(),se=A.S;if(se!==null&&se(O,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var he=QM(X,h);Pc(s,a,he,Pi(s))}else Pc(s,a,h,Pi(s))}catch(pe){Pc(s,a,{then:function(){},status:"rejected",reason:pe},Pi())}finally{$.p=x,R!==null&&O.types!==null&&(R.types=O.types),A.T=R}}function s3(){}function rg(s,a,c,h){if(s.tag!==5)throw Error(i(476));var _=p1(s).queue;m1(s,_,a,U,c===null?s3:function(){return g1(s),c(h)})}function p1(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:c},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function g1(s){var a=p1(s);a.next===null&&(a=s.alternate.memoizedState),Pc(s,a.next.queue,{},Pi())}function ig(){return Yr(eu)}function v1(){return dr().memoizedState}function _1(){return dr().memoizedState}function n3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var c=Pi();s=na(c);var h=aa(a,s,c);h!==null&&(Ei(h,a,c),Mc(h,a,c)),a={cache:Mp()},s.payload=a;return}a=a.return}}function a3(s,a,c){var h=Pi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Zd(s)?y1(a,c):(c=bp(s,a,c,h),c!==null&&(Ei(c,s,h),b1(c,a,h)))}function x1(s,a,c){var h=Pi();Pc(s,a,c,h)}function Pc(s,a,c,h){var _={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Zd(s))y1(a,_);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var R=a.lastRenderedState,O=x(R,c);if(_.hasEagerState=!0,_.eagerState=O,Ti(O,R))return Td(s,a,_,0),zt===null&&Ad(),!1}catch{}finally{}if(c=bp(s,a,_,h),c!==null)return Ei(c,s,h),b1(c,a,h),!0}return!1}function sg(s,a,c,h){if(h={lane:2,revertLane:Bg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Zd(s)){if(a)throw Error(i(479))}else a=bp(s,c,h,2),a!==null&&Ei(a,s,2)}function Zd(s){var a=s.alternate;return s===Xe||a!==null&&a===Xe}function y1(s,a){gl=qd=!0;var c=s.pending;c===null?a.next=a:(a.next=c.next,c.next=a),s.pending=a}function b1(s,a,c){if((c&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,c|=h,a.lanes=c,Wr(s,c)}}var zc={readContext:Yr,use:Gd,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};zc.useEffectEvent=Zt;var w1={readContext:Yr,use:Gd,useCallback:function(s,a){return ui().memoizedState=[s,a===void 0?null:a],s},useContext:Yr,useEffect:n1,useImperativeHandle:function(s,a,c){c=c!=null?c.concat([s]):null,Kd(4194308,4,c1.bind(null,a,s),c)},useLayoutEffect:function(s,a){return Kd(4194308,4,s,a)},useInsertionEffect:function(s,a){Kd(4,2,s,a)},useMemo:function(s,a){var c=ui();a=a===void 0?null:a;var h=s();if(uo){St(!0);try{s()}finally{St(!1)}}return c.memoizedState=[h,a],h},useReducer:function(s,a,c){var h=ui();if(c!==void 0){var _=c(a);if(uo){St(!0);try{c(a)}finally{St(!1)}}}else _=a;return h.memoizedState=h.baseState=_,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:_},h.queue=s,s=s.dispatch=a3.bind(null,Xe,s),[h.memoizedState,s]},useRef:function(s){var a=ui();return s={current:s},a.memoizedState=s},useState:function(s){s=Zp(s);var a=s.queue,c=x1.bind(null,Xe,a);return a.dispatch=c,[s.memoizedState,c]},useDebugValue:eg,useDeferredValue:function(s,a){var c=ui();return tg(c,s,a)},useTransition:function(){var s=Zp(!1);return s=m1.bind(null,Xe,s.queue,!0,!1),ui().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,c){var h=Xe,_=ui();if(ft){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),zt===null)throw Error(i(349));(dt&127)!==0||Fb(h,a,c)}_.memoizedState=c;var x={value:c,getSnapshot:a};return _.queue=x,n1(Wb.bind(null,h,x,s),[s]),h.flags|=2048,_l(9,{destroy:void 0},qb.bind(null,h,x,c,a),null),c},useId:function(){var s=ui(),a=zt.identifierPrefix;if(ft){var c=qs,h=Fs;c=(h&~(1<<32-or(h)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Wd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=JM++,a="_"+a+"r_"+c.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:ig,useFormState:e1,useActionState:e1,useOptimistic:function(s){var a=ui();a.memoizedState=a.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=sg.bind(null,Xe,!0,c),c.dispatch=a,[s,a]},useMemoCache:Yp,useCacheRefresh:function(){return ui().memoizedState=n3.bind(null,Xe)},useEffectEvent:function(s){var a=ui(),c={impl:s};return a.memoizedState=c,function(){if((bt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},ng={readContext:Yr,use:Gd,useCallback:d1,useContext:Yr,useEffect:Jp,useImperativeHandle:u1,useInsertionEffect:o1,useLayoutEffect:l1,useMemo:h1,useReducer:Yd,useRef:s1,useState:function(){return Yd(En)},useDebugValue:eg,useDeferredValue:function(s,a){var c=dr();return f1(c,Dt.memoizedState,s,a)},useTransition:function(){var s=Yd(En)[0],a=dr().memoizedState;return[typeof s=="boolean"?s:Bc(s),a]},useSyncExternalStore:Hb,useId:v1,useHostTransitionStatus:ig,useFormState:t1,useActionState:t1,useOptimistic:function(s,a){var c=dr();return Yb(c,Dt,s,a)},useMemoCache:Yp,useCacheRefresh:_1};ng.useEffectEvent=a1;var S1={readContext:Yr,use:Gd,useCallback:d1,useContext:Yr,useEffect:Jp,useImperativeHandle:u1,useInsertionEffect:o1,useLayoutEffect:l1,useMemo:h1,useReducer:Xp,useRef:s1,useState:function(){return Xp(En)},useDebugValue:eg,useDeferredValue:function(s,a){var c=dr();return Dt===null?tg(c,s,a):f1(c,Dt.memoizedState,s,a)},useTransition:function(){var s=Xp(En)[0],a=dr().memoizedState;return[typeof s=="boolean"?s:Bc(s),a]},useSyncExternalStore:Hb,useId:v1,useHostTransitionStatus:ig,useFormState:i1,useActionState:i1,useOptimistic:function(s,a){var c=dr();return Dt!==null?Yb(c,Dt,s,a):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:Yp,useCacheRefresh:_1};S1.useEffectEvent=a1;function ag(s,a,c,h){a=s.memoizedState,c=c(h,a),c=c==null?a:p({},a,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var og={enqueueSetState:function(s,a,c){s=s._reactInternals;var h=Pi(),_=na(h);_.payload=a,c!=null&&(_.callback=c),a=aa(s,_,h),a!==null&&(Ei(a,s,h),Mc(a,s,h))},enqueueReplaceState:function(s,a,c){s=s._reactInternals;var h=Pi(),_=na(h);_.tag=1,_.payload=a,c!=null&&(_.callback=c),a=aa(s,_,h),a!==null&&(Ei(a,s,h),Mc(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var c=Pi(),h=na(c);h.tag=2,a!=null&&(h.callback=a),a=aa(s,h,c),a!==null&&(Ei(a,s,c),Mc(a,s,c))}};function C1(s,a,c,h,_,x,R){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,x,R):a.prototype&&a.prototype.isPureReactComponent?!Cc(c,h)||!Cc(_,x):!0}function E1(s,a,c,h){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,h),a.state!==s&&og.enqueueReplaceState(a,a.state,null)}function ho(s,a){var c=a;if("ref"in a){c={};for(var h in a)h!=="ref"&&(c[h]=a[h])}if(s=s.defaultProps){c===a&&(c=p({},c));for(var _ in s)c[_]===void 0&&(c[_]=s[_])}return c}function k1(s){jd(s)}function R1(s){console.error(s)}function N1(s){jd(s)}function Qd(s,a){try{var c=s.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function j1(s,a,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function lg(s,a,c){return c=na(c),c.tag=3,c.payload={element:null},c.callback=function(){Qd(s,a)},c}function A1(s){return s=na(s),s.tag=3,s}function T1(s,a,c,h){var _=c.type.getDerivedStateFromError;if(typeof _=="function"){var x=h.value;s.payload=function(){return _(x)},s.callback=function(){j1(a,c,h)}}var R=c.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(s.callback=function(){j1(a,c,h),typeof _!="function"&&(ha===null?ha=new Set([this]):ha.add(this));var O=h.stack;this.componentDidCatch(h.value,{componentStack:O!==null?O:""})})}function o3(s,a,c,h,_){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=c.alternate,a!==null&&ul(a,c,_,!0),c=Di.current,c!==null){switch(c.tag){case 31:case 13:return is===null?uh():c.alternate===null&&Qt===0&&(Qt=3),c.flags&=-257,c.flags|=65536,c.lanes=_,h===Id?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([h]):a.add(h),Dg(s,h,_)),!1;case 22:return c.flags|=65536,h===Id?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([h]):c.add(h)),Dg(s,h,_)),!1}throw Error(i(435,c.tag))}return Dg(s,h,_),uh(),!1}if(ft)return a=Di.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,h!==Rp&&(s=Error(i(422),{cause:h}),Rc(Ji(s,c)))):(h!==Rp&&(a=Error(i(423),{cause:h}),Rc(Ji(a,c))),s=s.current.alternate,s.flags|=65536,_&=-_,s.lanes|=_,h=Ji(h,c),_=lg(s.stateNode,h,_),zp(s,_),Qt!==4&&(Qt=2)),!1;var x=Error(i(520),{cause:h});if(x=Ji(x,c),Vc===null?Vc=[x]:Vc.push(x),Qt!==4&&(Qt=2),a===null)return!0;h=Ji(h,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,s=_&-_,c.lanes|=s,s=lg(c.stateNode,h,s),zp(c,s),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ha===null||!ha.has(x))))return c.flags|=65536,_&=-_,c.lanes|=_,_=A1(_),T1(_,s,c,h),zp(c,_),!1}c=c.return}while(c!==null);return!1}var cg=Error(i(461)),vr=!1;function Kr(s,a,c,h){a.child=s===null?Ob(a,null,c,h):co(a,s.child,c,h)}function M1(s,a,c,h,_){c=c.render;var x=a.ref;if("ref"in h){var R={};for(var O in h)O!=="ref"&&(R[O]=h[O])}else R=h;return no(a),h=qp(s,a,c,R,x,_),O=Wp(),s!==null&&!vr?(Vp(s,a,_),kn(s,a,_)):(ft&&O&&Ep(a),a.flags|=1,Kr(s,a,h,_),a.child)}function D1(s,a,c,h,_){if(s===null){var x=c.type;return typeof x=="function"&&!wp(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,L1(s,a,x,h,_)):(s=Dd(c.type,null,h,a,a.mode,_),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,!vg(s,_)){var R=x.memoizedProps;if(c=c.compare,c=c!==null?c:Cc,c(R,h)&&s.ref===a.ref)return kn(s,a,_)}return a.flags|=1,s=yn(x,h),s.ref=a.ref,s.return=a,a.child=s}function L1(s,a,c,h,_){if(s!==null){var x=s.memoizedProps;if(Cc(x,h)&&s.ref===a.ref)if(vr=!1,a.pendingProps=h=x,vg(s,_))(s.flags&131072)!==0&&(vr=!0);else return a.lanes=s.lanes,kn(s,a,_)}return ug(s,a,c,h,_)}function O1(s,a,c,h){var _=h.children,x=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|c:c,s!==null){for(h=a.child=s.child,_=0;h!==null;)_=_|h.lanes|h.childLanes,h=h.sibling;h=_&~x}else h=0,a.child=null;return B1(s,a,x,c,h)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Pd(a,x!==null?x.cachePool:null),x!==null?zb(a,x):$p(),Ib(a);else return h=a.lanes=536870912,B1(s,a,x!==null?x.baseLanes|c:c,c,h)}else x!==null?(Pd(a,x.cachePool),zb(a,x),la(),a.memoizedState=null):(s!==null&&Pd(a,null),$p(),la());return Kr(s,a,_,c),a.child}function Ic(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function B1(s,a,c,h,_){var x=Lp();return x=x===null?null:{parent:pr._currentValue,pool:x},a.memoizedState={baseLanes:c,cachePool:x},s!==null&&Pd(a,null),$p(),Ib(a),s!==null&&ul(s,a,h,!0),a.childLanes=_,null}function Jd(s,a){return a=th({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function P1(s,a,c){return co(a,s.child,null,c),s=Jd(a,a.pendingProps),s.flags|=2,Li(a),a.memoizedState=null,s}function l3(s,a,c){var h=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(ft){if(h.mode==="hidden")return s=Jd(a,h),a.lanes=536870912,Ic(null,s);if(Hp(a),(s=$t)?(s=Kw(s,rs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ea!==null?{id:Fs,overflow:qs}:null,retryLane:536870912,hydrationErrors:null},c=yb(s),c.return=a,a.child=c,Gr=a,$t=null)):s=null,s===null)throw ra(a);return a.lanes=536870912,null}return Jd(a,h)}var x=s.memoizedState;if(x!==null){var R=x.dehydrated;if(Hp(a),_)if(a.flags&256)a.flags&=-257,a=P1(s,a,c);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(vr||ul(s,a,c,!1),_=(c&s.childLanes)!==0,vr||_){if(h=zt,h!==null&&(R=Vr(h,c),R!==0&&R!==x.retryLane))throw x.retryLane=R,to(s,R),Ei(h,s,R),cg;uh(),a=P1(s,a,c)}else s=x.treeContext,$t=ss(R.nextSibling),Gr=a,ft=!0,ta=null,rs=!1,s!==null&&Sb(a,s),a=Jd(a,h),a.flags|=4096;return a}return s=yn(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function eh(s,a){var c=a.ref;if(c===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(a.flags|=4194816)}}function ug(s,a,c,h,_){return no(a),c=qp(s,a,c,h,void 0,_),h=Wp(),s!==null&&!vr?(Vp(s,a,_),kn(s,a,_)):(ft&&h&&Ep(a),a.flags|=1,Kr(s,a,c,_),a.child)}function z1(s,a,c,h,_,x){return no(a),a.updateQueue=null,c=Ub(a,h,c,_),$b(s),h=Wp(),s!==null&&!vr?(Vp(s,a,x),kn(s,a,x)):(ft&&h&&Ep(a),a.flags|=1,Kr(s,a,c,x),a.child)}function I1(s,a,c,h,_){if(no(a),a.stateNode===null){var x=al,R=c.contextType;typeof R=="object"&&R!==null&&(x=Yr(R)),x=new c(h,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=og,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=h,x.state=a.memoizedState,x.refs={},Bp(a),R=c.contextType,x.context=typeof R=="object"&&R!==null?Yr(R):al,x.state=a.memoizedState,R=c.getDerivedStateFromProps,typeof R=="function"&&(ag(a,c,R,h),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(R=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),R!==x.state&&og.enqueueReplaceState(x,x.state,null),Lc(a,h,x,_),Dc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){x=a.stateNode;var O=a.memoizedProps,X=ho(c,O);x.props=X;var se=x.context,he=c.contextType;R=al,typeof he=="object"&&he!==null&&(R=Yr(he));var pe=c.getDerivedStateFromProps;he=typeof pe=="function"||typeof x.getSnapshotBeforeUpdate=="function",O=a.pendingProps!==O,he||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(O||se!==R)&&E1(a,x,h,R),sa=!1;var ae=a.memoizedState;x.state=ae,Lc(a,h,x,_),Dc(),se=a.memoizedState,O||ae!==se||sa?(typeof pe=="function"&&(ag(a,c,pe,h),se=a.memoizedState),(X=sa||C1(a,c,X,h,ae,se,R))?(he||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=se),x.props=h,x.state=se,x.context=R,h=X):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{x=a.stateNode,Pp(s,a),R=a.memoizedProps,he=ho(c,R),x.props=he,pe=a.pendingProps,ae=x.context,se=c.contextType,X=al,typeof se=="object"&&se!==null&&(X=Yr(se)),O=c.getDerivedStateFromProps,(se=typeof O=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(R!==pe||ae!==X)&&E1(a,x,h,X),sa=!1,ae=a.memoizedState,x.state=ae,Lc(a,h,x,_),Dc();var le=a.memoizedState;R!==pe||ae!==le||sa||s!==null&&s.dependencies!==null&&Od(s.dependencies)?(typeof O=="function"&&(ag(a,c,O,h),le=a.memoizedState),(he=sa||C1(a,c,he,h,ae,le,X)||s!==null&&s.dependencies!==null&&Od(s.dependencies))?(se||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(h,le,X),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(h,le,X)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||R===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=le),x.props=h,x.state=le,x.context=X,h=he):(typeof x.componentDidUpdate!="function"||R===s.memoizedProps&&ae===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&ae===s.memoizedState||(a.flags|=1024),h=!1)}return x=h,eh(s,a),h=(a.flags&128)!==0,x||h?(x=a.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,s!==null&&h?(a.child=co(a,s.child,null,_),a.child=co(a,null,c,_)):Kr(s,a,c,_),a.memoizedState=x.state,s=a.child):s=kn(s,a,_),s}function $1(s,a,c,h){return io(),a.flags|=256,Kr(s,a,c,h),a.child}var dg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hg(s){return{baseLanes:s,cachePool:jb()}}function fg(s,a,c){return s=s!==null?s.childLanes&~c:0,a&&(s|=Bi),s}function U1(s,a,c){var h=a.pendingProps,_=!1,x=(a.flags&128)!==0,R;if((R=x)||(R=s!==null&&s.memoizedState===null?!1:(ur.current&2)!==0),R&&(_=!0,a.flags&=-129),R=(a.flags&32)!==0,a.flags&=-33,s===null){if(ft){if(_?oa(a):la(),(s=$t)?(s=Kw(s,rs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:ea!==null?{id:Fs,overflow:qs}:null,retryLane:536870912,hydrationErrors:null},c=yb(s),c.return=a,a.child=c,Gr=a,$t=null)):s=null,s===null)throw ra(a);return Kg(s)?a.lanes=32:a.lanes=536870912,null}var O=h.children;return h=h.fallback,_?(la(),_=a.mode,O=th({mode:"hidden",children:O},_),h=ro(h,_,c,null),O.return=a,h.return=a,O.sibling=h,a.child=O,h=a.child,h.memoizedState=hg(c),h.childLanes=fg(s,R,c),a.memoizedState=dg,Ic(null,h)):(oa(a),mg(a,O))}var X=s.memoizedState;if(X!==null&&(O=X.dehydrated,O!==null)){if(x)a.flags&256?(oa(a),a.flags&=-257,a=pg(s,a,c)):a.memoizedState!==null?(la(),a.child=s.child,a.flags|=128,a=null):(la(),O=h.fallback,_=a.mode,h=th({mode:"visible",children:h.children},_),O=ro(O,_,c,null),O.flags|=2,h.return=a,O.return=a,h.sibling=O,a.child=h,co(a,s.child,null,c),h=a.child,h.memoizedState=hg(c),h.childLanes=fg(s,R,c),a.memoizedState=dg,a=Ic(null,h));else if(oa(a),Kg(O)){if(R=O.nextSibling&&O.nextSibling.dataset,R)var se=R.dgst;R=se,h=Error(i(419)),h.stack="",h.digest=R,Rc({value:h,source:null,stack:null}),a=pg(s,a,c)}else if(vr||ul(s,a,c,!1),R=(c&s.childLanes)!==0,vr||R){if(R=zt,R!==null&&(h=Vr(R,c),h!==0&&h!==X.retryLane))throw X.retryLane=h,to(s,h),Ei(R,s,h),cg;Yg(O)||uh(),a=pg(s,a,c)}else Yg(O)?(a.flags|=192,a.child=s.child,a=null):(s=X.treeContext,$t=ss(O.nextSibling),Gr=a,ft=!0,ta=null,rs=!1,s!==null&&Sb(a,s),a=mg(a,h.children),a.flags|=4096);return a}return _?(la(),O=h.fallback,_=a.mode,X=s.child,se=X.sibling,h=yn(X,{mode:"hidden",children:h.children}),h.subtreeFlags=X.subtreeFlags&65011712,se!==null?O=yn(se,O):(O=ro(O,_,c,null),O.flags|=2),O.return=a,h.return=a,h.sibling=O,a.child=h,Ic(null,h),h=a.child,O=s.child.memoizedState,O===null?O=hg(c):(_=O.cachePool,_!==null?(X=pr._currentValue,_=_.parent!==X?{parent:X,pool:X}:_):_=jb(),O={baseLanes:O.baseLanes|c,cachePool:_}),h.memoizedState=O,h.childLanes=fg(s,R,c),a.memoizedState=dg,Ic(s.child,h)):(oa(a),c=s.child,s=c.sibling,c=yn(c,{mode:"visible",children:h.children}),c.return=a,c.sibling=null,s!==null&&(R=a.deletions,R===null?(a.deletions=[s],a.flags|=16):R.push(s)),a.child=c,a.memoizedState=null,c)}function mg(s,a){return a=th({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function th(s,a){return s=Mi(22,s,null,a),s.lanes=0,s}function pg(s,a,c){return co(a,s.child,null,c),s=mg(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function H1(s,a,c){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),Ap(s.return,a,c)}function gg(s,a,c,h,_,x){var R=s.memoizedState;R===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:_,treeForkCount:x}:(R.isBackwards=a,R.rendering=null,R.renderingStartTime=0,R.last=h,R.tail=c,R.tailMode=_,R.treeForkCount=x)}function F1(s,a,c){var h=a.pendingProps,_=h.revealOrder,x=h.tail;h=h.children;var R=ur.current,O=(R&2)!==0;if(O?(R=R&1|2,a.flags|=128):R&=1,K(ur,R),Kr(s,a,h,c),h=ft?kc:0,!O&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&H1(s,c,a);else if(s.tag===19)H1(s,c,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(_){case"forwards":for(c=a.child,_=null;c!==null;)s=c.alternate,s!==null&&Fd(s)===null&&(_=c),c=c.sibling;c=_,c===null?(_=a.child,a.child=null):(_=c.sibling,c.sibling=null),gg(a,!1,_,c,x,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,_=a.child,a.child=null;_!==null;){if(s=_.alternate,s!==null&&Fd(s)===null){a.child=_;break}s=_.sibling,_.sibling=c,c=_,_=s}gg(a,!0,c,null,x,h);break;case"together":gg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function kn(s,a,c){if(s!==null&&(a.dependencies=s.dependencies),da|=a.lanes,(c&a.childLanes)===0)if(s!==null){if(ul(s,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,c=yn(s,s.pendingProps),a.child=c,c.return=a;s.sibling!==null;)s=s.sibling,c=c.sibling=yn(s,s.pendingProps),c.return=a;c.sibling=null}return a.child}function vg(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Od(s)))}function c3(s,a,c){switch(a.tag){case 3:ne(a,a.stateNode.containerInfo),ia(a,pr,s.memoizedState.cache),io();break;case 27:case 5:Ae(a);break;case 4:ne(a,a.stateNode.containerInfo);break;case 10:ia(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Hp(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(oa(a),a.flags|=128,null):(c&a.child.childLanes)!==0?U1(s,a,c):(oa(a),s=kn(s,a,c),s!==null?s.sibling:null);oa(a);break;case 19:var _=(s.flags&128)!==0;if(h=(c&a.childLanes)!==0,h||(ul(s,a,c,!1),h=(c&a.childLanes)!==0),_){if(h)return F1(s,a,c);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),K(ur,ur.current),h)break;return null;case 22:return a.lanes=0,O1(s,a,c,a.pendingProps);case 24:ia(a,pr,s.memoizedState.cache)}return kn(s,a,c)}function q1(s,a,c){if(s!==null)if(s.memoizedProps!==a.pendingProps)vr=!0;else{if(!vg(s,c)&&(a.flags&128)===0)return vr=!1,c3(s,a,c);vr=(s.flags&131072)!==0}else vr=!1,ft&&(a.flags&1048576)!==0&&wb(a,kc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=oo(a.elementType),a.type=s,typeof s=="function")wp(s)?(h=ho(s,h),a.tag=1,a=I1(null,a,s,h,c)):(a.tag=0,a=ug(null,a,s,h,c));else{if(s!=null){var _=s.$$typeof;if(_===N){a.tag=11,a=M1(null,a,s,h,c);break e}else if(_===H){a.tag=14,a=D1(null,a,s,h,c);break e}}throw a=z(s)||s,Error(i(306,a,""))}}return a;case 0:return ug(s,a,a.type,a.pendingProps,c);case 1:return h=a.type,_=ho(h,a.pendingProps),I1(s,a,h,_,c);case 3:e:{if(ne(a,a.stateNode.containerInfo),s===null)throw Error(i(387));h=a.pendingProps;var x=a.memoizedState;_=x.element,Pp(s,a),Lc(a,h,null,c);var R=a.memoizedState;if(h=R.cache,ia(a,pr,h),h!==x.cache&&Tp(a,[pr],c,!0),Dc(),h=R.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:R.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=$1(s,a,h,c);break e}else if(h!==_){_=Ji(Error(i(424)),a),Rc(_),a=$1(s,a,h,c);break e}else{switch(s=a.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for($t=ss(s.firstChild),Gr=a,ft=!0,ta=null,rs=!0,c=Ob(a,null,h,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(io(),h===_){a=kn(s,a,c);break e}Kr(s,a,h,c)}a=a.child}return a;case 26:return eh(s,a),s===null?(c=tS(a.type,null,a.pendingProps,null))?a.memoizedState=c:ft||(c=a.type,s=a.pendingProps,h=vh(ce.current).createElement(c),h[at]=a,h[vt]=s,Xr(h,c,s),Tr(h),a.stateNode=h):a.memoizedState=tS(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return Ae(a),s===null&&ft&&(h=a.stateNode=Qw(a.type,a.pendingProps,ce.current),Gr=a,rs=!0,_=$t,ga(a.type)?(Xg=_,$t=ss(h.firstChild)):$t=_),Kr(s,a,a.pendingProps.children,c),eh(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&ft&&((_=h=$t)&&(h=I3(h,a.type,a.pendingProps,rs),h!==null?(a.stateNode=h,Gr=a,$t=ss(h.firstChild),rs=!1,_=!0):_=!1),_||ra(a)),Ae(a),_=a.type,x=a.pendingProps,R=s!==null?s.memoizedProps:null,h=x.children,Wg(_,x)?h=null:R!==null&&Wg(_,R)&&(a.flags|=32),a.memoizedState!==null&&(_=qp(s,a,e3,null,null,c),eu._currentValue=_),eh(s,a),Kr(s,a,h,c),a.child;case 6:return s===null&&ft&&((s=c=$t)&&(c=$3(c,a.pendingProps,rs),c!==null?(a.stateNode=c,Gr=a,$t=null,s=!0):s=!1),s||ra(a)),null;case 13:return U1(s,a,c);case 4:return ne(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=co(a,null,h,c):Kr(s,a,h,c),a.child;case 11:return M1(s,a,a.type,a.pendingProps,c);case 7:return Kr(s,a,a.pendingProps,c),a.child;case 8:return Kr(s,a,a.pendingProps.children,c),a.child;case 12:return Kr(s,a,a.pendingProps.children,c),a.child;case 10:return h=a.pendingProps,ia(a,a.type,h.value),Kr(s,a,h.children,c),a.child;case 9:return _=a.type._context,h=a.pendingProps.children,no(a),_=Yr(_),h=h(_),a.flags|=1,Kr(s,a,h,c),a.child;case 14:return D1(s,a,a.type,a.pendingProps,c);case 15:return L1(s,a,a.type,a.pendingProps,c);case 19:return F1(s,a,c);case 31:return l3(s,a,c);case 22:return O1(s,a,c,a.pendingProps);case 24:return no(a),h=Yr(pr),s===null?(_=Lp(),_===null&&(_=zt,x=Mp(),_.pooledCache=x,x.refCount++,x!==null&&(_.pooledCacheLanes|=c),_=x),a.memoizedState={parent:h,cache:_},Bp(a),ia(a,pr,_)):((s.lanes&c)!==0&&(Pp(s,a),Lc(a,null,null,c),Dc()),_=s.memoizedState,x=a.memoizedState,_.parent!==h?(_={parent:h,cache:h},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),ia(a,pr,h)):(h=x.cache,ia(a,pr,h),h!==_.cache&&Tp(a,[pr],c,!0))),Kr(s,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Rn(s){s.flags|=4}function _g(s,a,c,h,_){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(_&335544128)===_)if(s.stateNode.complete)s.flags|=8192;else if(vw())s.flags|=8192;else throw lo=Id,Op}else s.flags&=-16777217}function W1(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!aS(a))if(vw())s.flags|=8192;else throw lo=Id,Op}function rh(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?It():536870912,s.lanes|=a,wl|=a)}function $c(s,a){if(!ft)switch(s.tailMode){case"hidden":a=s.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function Ut(s){var a=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(a)for(var _=s.child;_!==null;)c|=_.lanes|_.childLanes,h|=_.subtreeFlags&65011712,h|=_.flags&65011712,_.return=s,_=_.sibling;else for(_=s.child;_!==null;)c|=_.lanes|_.childLanes,h|=_.subtreeFlags,h|=_.flags,_.return=s,_=_.sibling;return s.subtreeFlags|=h,s.childLanes=c,a}function u3(s,a,c){var h=a.pendingProps;switch(kp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(a),null;case 1:return Ut(a),null;case 3:return c=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Sn(pr),de(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(cl(a)?Rn(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Np())),Ut(a),null;case 26:var _=a.type,x=a.memoizedState;return s===null?(Rn(a),x!==null?(Ut(a),W1(a,x)):(Ut(a),_g(a,_,null,h,c))):x?x!==s.memoizedState?(Rn(a),Ut(a),W1(a,x)):(Ut(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Rn(a),Ut(a),_g(a,_,s,h,c)),null;case 27:if(ke(a),c=ce.current,_=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Rn(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Ut(a),null}s=J.current,cl(a)?Cb(a):(s=Qw(_,h,c),a.stateNode=s,Rn(a))}return Ut(a),null;case 5:if(ke(a),_=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Rn(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Ut(a),null}if(x=J.current,cl(a))Cb(a);else{var R=vh(ce.current);switch(x){case 1:x=R.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:x=R.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":x=R.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":x=R.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":x=R.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?R.createElement("select",{is:h.is}):R.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?R.createElement(_,{is:h.is}):R.createElement(_)}}x[at]=a,x[vt]=h;e:for(R=a.child;R!==null;){if(R.tag===5||R.tag===6)x.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===a)break e;for(;R.sibling===null;){if(R.return===null||R.return===a)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}a.stateNode=x;e:switch(Xr(x,_,h),_){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Rn(a)}}return Ut(a),_g(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,c),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Rn(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(s=ce.current,cl(a)){if(s=a.stateNode,c=a.memoizedProps,h=null,_=Gr,_!==null)switch(_.tag){case 27:case 5:h=_.memoizedProps}s[at]=a,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||Uw(s.nodeValue,c)),s||ra(a,!0)}else s=vh(s).createTextNode(h),s[at]=a,a.stateNode=s}return Ut(a),null;case 31:if(c=a.memoizedState,s===null||s.memoizedState!==null){if(h=cl(a),c!==null){if(s===null){if(!h)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[at]=a}else io(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),s=!1}else c=Np(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return a.flags&256?(Li(a),a):(Li(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Ut(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(_=cl(a),h!==null&&h.dehydrated!==null){if(s===null){if(!_)throw Error(i(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(i(317));_[at]=a}else io(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ut(a),_=!1}else _=Np(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Li(a),a):(Li(a),null)}return Li(a),(a.flags&128)!==0?(a.lanes=c,a):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=a.child,_=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(_=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==_&&(h.flags|=2048)),c!==s&&c&&(a.child.flags|=8192),rh(a,a.updateQueue),Ut(a),null);case 4:return de(),s===null&&$g(a.stateNode.containerInfo),Ut(a),null;case 10:return Sn(a.type),Ut(a),null;case 19:if(V(ur),h=a.memoizedState,h===null)return Ut(a),null;if(_=(a.flags&128)!==0,x=h.rendering,x===null)if(_)$c(h,!1);else{if(Qt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(x=Fd(s),x!==null){for(a.flags|=128,$c(h,!1),s=x.updateQueue,a.updateQueue=s,rh(a,s),a.subtreeFlags=0,s=c,c=a.child;c!==null;)xb(c,s),c=c.sibling;return K(ur,ur.current&1|2),ft&&bn(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&wt()>oh&&(a.flags|=128,_=!0,$c(h,!1),a.lanes=4194304)}else{if(!_)if(s=Fd(x),s!==null){if(a.flags|=128,_=!0,s=s.updateQueue,a.updateQueue=s,rh(a,s),$c(h,!0),h.tail===null&&h.tailMode==="hidden"&&!x.alternate&&!ft)return Ut(a),null}else 2*wt()-h.renderingStartTime>oh&&c!==536870912&&(a.flags|=128,_=!0,$c(h,!1),a.lanes=4194304);h.isBackwards?(x.sibling=a.child,a.child=x):(s=h.last,s!==null?s.sibling=x:a.child=x,h.last=x)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=wt(),s.sibling=null,c=ur.current,K(ur,_?c&1|2:c&1),ft&&bn(a,h.treeForkCount),s):(Ut(a),null);case 22:case 23:return Li(a),Up(),h=a.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(c&536870912)!==0&&(a.flags&128)===0&&(Ut(a),a.subtreeFlags&6&&(a.flags|=8192)):Ut(a),c=a.updateQueue,c!==null&&rh(a,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==c&&(a.flags|=2048),s!==null&&V(ao),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Sn(pr),Ut(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function d3(s,a){switch(kp(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Sn(pr),de(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if(Li(a),a.alternate===null)throw Error(i(340));io()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Li(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));io()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return V(ur),null;case 4:return de(),null;case 10:return Sn(a.type),null;case 22:case 23:return Li(a),Up(),s!==null&&V(ao),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Sn(pr),null;case 25:return null;default:return null}}function V1(s,a){switch(kp(a),a.tag){case 3:Sn(pr),de();break;case 26:case 27:case 5:ke(a);break;case 4:de();break;case 31:a.memoizedState!==null&&Li(a);break;case 13:Li(a);break;case 19:V(ur);break;case 10:Sn(a.type);break;case 22:case 23:Li(a),Up(),s!==null&&V(ao);break;case 24:Sn(pr)}}function Uc(s,a){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var _=h.next;c=_;do{if((c.tag&s)===s){h=void 0;var x=c.create,R=c.inst;h=x(),R.destroy=h}c=c.next}while(c!==_)}}catch(O){jt(a,a.return,O)}}function ca(s,a,c){try{var h=a.updateQueue,_=h!==null?h.lastEffect:null;if(_!==null){var x=_.next;h=x;do{if((h.tag&s)===s){var R=h.inst,O=R.destroy;if(O!==void 0){R.destroy=void 0,_=a;var X=c,se=O;try{se()}catch(he){jt(_,X,he)}}}h=h.next}while(h!==x)}}catch(he){jt(a,a.return,he)}}function G1(s){var a=s.updateQueue;if(a!==null){var c=s.stateNode;try{Pb(a,c)}catch(h){jt(s,s.return,h)}}}function Y1(s,a,c){c.props=ho(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){jt(s,a,h)}}function Hc(s,a){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(_){jt(s,a,_)}}function Ws(s,a){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(_){jt(s,a,_)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(_){jt(s,a,_)}else c.current=null}function K1(s){var a=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(_){jt(s,s.return,_)}}function xg(s,a,c){try{var h=s.stateNode;D3(h,s.type,c,a),h[vt]=a}catch(_){jt(s,s.return,_)}}function X1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&ga(s.type)||s.tag===4}function yg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||X1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&ga(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function bg(s,a,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(s),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=_n));else if(h!==4&&(h===27&&ga(s.type)&&(c=s.stateNode,a=null),s=s.child,s!==null))for(bg(s,a,c),s=s.sibling;s!==null;)bg(s,a,c),s=s.sibling}function ih(s,a,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?c.insertBefore(s,a):c.appendChild(s);else if(h!==4&&(h===27&&ga(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(ih(s,a,c),s=s.sibling;s!==null;)ih(s,a,c),s=s.sibling}function Z1(s){var a=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);Xr(a,h,c),a[at]=s,a[vt]=c}catch(x){jt(s,s.return,x)}}var Nn=!1,_r=!1,wg=!1,Q1=typeof WeakSet=="function"?WeakSet:Set,Mr=null;function h3(s,a){if(s=s.containerInfo,Fg=Ch,s=ub(s),pp(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var _=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var R=0,O=-1,X=-1,se=0,he=0,pe=s,ae=null;t:for(;;){for(var le;pe!==c||_!==0&&pe.nodeType!==3||(O=R+_),pe!==x||h!==0&&pe.nodeType!==3||(X=R+h),pe.nodeType===3&&(R+=pe.nodeValue.length),(le=pe.firstChild)!==null;)ae=pe,pe=le;for(;;){if(pe===s)break t;if(ae===c&&++se===_&&(O=R),ae===x&&++he===h&&(X=R),(le=pe.nextSibling)!==null)break;pe=ae,ae=pe.parentNode}pe=le}c=O===-1||X===-1?null:{start:O,end:X}}else c=null}c=c||{start:0,end:0}}else c=null;for(qg={focusedElem:s,selectionRange:c},Ch=!1,Mr=a;Mr!==null;)if(a=Mr,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Mr=s;else for(;Mr!==null;){switch(a=Mr,x=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)_=s[c],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&x!==null){s=void 0,c=a,_=x.memoizedProps,x=x.memoizedState,h=c.stateNode;try{var Le=ho(c.type,_);s=h.getSnapshotBeforeUpdate(Le,x),h.__reactInternalSnapshotBeforeUpdate=s}catch(Fe){jt(c,c.return,Fe)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,c=s.nodeType,c===9)Gg(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Gg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,Mr=s;break}Mr=a.return}}function J1(s,a,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:An(s,c),h&4&&Uc(5,c);break;case 1:if(An(s,c),h&4)if(s=c.stateNode,a===null)try{s.componentDidMount()}catch(R){jt(c,c.return,R)}else{var _=ho(c.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(_,a,s.__reactInternalSnapshotBeforeUpdate)}catch(R){jt(c,c.return,R)}}h&64&&G1(c),h&512&&Hc(c,c.return);break;case 3:if(An(s,c),h&64&&(s=c.updateQueue,s!==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{Pb(s,a)}catch(R){jt(c,c.return,R)}}break;case 27:a===null&&h&4&&Z1(c);case 26:case 5:An(s,c),a===null&&h&4&&K1(c),h&512&&Hc(c,c.return);break;case 12:An(s,c);break;case 31:An(s,c),h&4&&rw(s,c);break;case 13:An(s,c),h&4&&iw(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=b3.bind(null,c),U3(s,c))));break;case 22:if(h=c.memoizedState!==null||Nn,!h){a=a!==null&&a.memoizedState!==null||_r,_=Nn;var x=_r;Nn=h,(_r=a)&&!x?Tn(s,c,(c.subtreeFlags&8772)!==0):An(s,c),Nn=_,_r=x}break;case 30:break;default:An(s,c)}}function ew(s){var a=s.alternate;a!==null&&(s.alternate=null,ew(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Qm(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Wt=null,bi=!1;function jn(s,a,c){for(c=c.child;c!==null;)tw(s,a,c),c=c.sibling}function tw(s,a,c){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(ii,c)}catch{}switch(c.tag){case 26:_r||Ws(c,a),jn(s,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:_r||Ws(c,a);var h=Wt,_=bi;ga(c.type)&&(Wt=c.stateNode,bi=!1),jn(s,a,c),Zc(c.stateNode),Wt=h,bi=_;break;case 5:_r||Ws(c,a);case 6:if(h=Wt,_=bi,Wt=null,jn(s,a,c),Wt=h,bi=_,Wt!==null)if(bi)try{(Wt.nodeType===9?Wt.body:Wt.nodeName==="HTML"?Wt.ownerDocument.body:Wt).removeChild(c.stateNode)}catch(x){jt(c,a,x)}else try{Wt.removeChild(c.stateNode)}catch(x){jt(c,a,x)}break;case 18:Wt!==null&&(bi?(s=Wt,Gw(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Al(s)):Gw(Wt,c.stateNode));break;case 4:h=Wt,_=bi,Wt=c.stateNode.containerInfo,bi=!0,jn(s,a,c),Wt=h,bi=_;break;case 0:case 11:case 14:case 15:ca(2,c,a),_r||ca(4,c,a),jn(s,a,c);break;case 1:_r||(Ws(c,a),h=c.stateNode,typeof h.componentWillUnmount=="function"&&Y1(c,a,h)),jn(s,a,c);break;case 21:jn(s,a,c);break;case 22:_r=(h=_r)||c.memoizedState!==null,jn(s,a,c),_r=h;break;default:jn(s,a,c)}}function rw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Al(s)}catch(c){jt(a,a.return,c)}}}function iw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Al(s)}catch(c){jt(a,a.return,c)}}function f3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new Q1),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new Q1),a;default:throw Error(i(435,s.tag))}}function sh(s,a){var c=f3(s);a.forEach(function(h){if(!c.has(h)){c.add(h);var _=w3.bind(null,s,h);h.then(_,_)}})}function wi(s,a){var c=a.deletions;if(c!==null)for(var h=0;h<c.length;h++){var _=c[h],x=s,R=a,O=R;e:for(;O!==null;){switch(O.tag){case 27:if(ga(O.type)){Wt=O.stateNode,bi=!1;break e}break;case 5:Wt=O.stateNode,bi=!1;break e;case 3:case 4:Wt=O.stateNode.containerInfo,bi=!0;break e}O=O.return}if(Wt===null)throw Error(i(160));tw(x,R,_),Wt=null,bi=!1,x=_.alternate,x!==null&&(x.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)sw(a,s),a=a.sibling}var Es=null;function sw(s,a){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:wi(a,s),Si(s),h&4&&(ca(3,s,s.return),Uc(3,s),ca(5,s,s.return));break;case 1:wi(a,s),Si(s),h&512&&(_r||c===null||Ws(c,c.return)),h&64&&Nn&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var _=Es;if(wi(a,s),Si(s),h&512&&(_r||c===null||Ws(c,c.return)),h&4){var x=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,_=_.ownerDocument||_;t:switch(h){case"title":x=_.getElementsByTagName("title")[0],(!x||x[pc]||x[at]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=_.createElement(h),_.head.insertBefore(x,_.querySelector("head > title"))),Xr(x,h,c),x[at]=s,Tr(x),h=x;break e;case"link":var R=sS("link","href",_).get(h+(c.href||""));if(R){for(var O=0;O<R.length;O++)if(x=R[O],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){R.splice(O,1);break t}}x=_.createElement(h),Xr(x,h,c),_.head.appendChild(x);break;case"meta":if(R=sS("meta","content",_).get(h+(c.content||""))){for(O=0;O<R.length;O++)if(x=R[O],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){R.splice(O,1);break t}}x=_.createElement(h),Xr(x,h,c),_.head.appendChild(x);break;default:throw Error(i(468,h))}x[at]=s,Tr(x),h=x}s.stateNode=h}else nS(_,s.type,s.stateNode);else s.stateNode=iS(_,h,s.memoizedProps);else x!==h?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,h===null?nS(_,s.type,s.stateNode):iS(_,h,s.memoizedProps)):h===null&&s.stateNode!==null&&xg(s,s.memoizedProps,c.memoizedProps)}break;case 27:wi(a,s),Si(s),h&512&&(_r||c===null||Ws(c,c.return)),c!==null&&h&4&&xg(s,s.memoizedProps,c.memoizedProps);break;case 5:if(wi(a,s),Si(s),h&512&&(_r||c===null||Ws(c,c.return)),s.flags&32){_=s.stateNode;try{Jo(_,"")}catch(Le){jt(s,s.return,Le)}}h&4&&s.stateNode!=null&&(_=s.memoizedProps,xg(s,_,c!==null?c.memoizedProps:_)),h&1024&&(wg=!0);break;case 6:if(wi(a,s),Si(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Le){jt(s,s.return,Le)}}break;case 3:if(yh=null,_=Es,Es=_h(a.containerInfo),wi(a,s),Es=_,Si(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{Al(a.containerInfo)}catch(Le){jt(s,s.return,Le)}wg&&(wg=!1,nw(s));break;case 4:h=Es,Es=_h(s.stateNode.containerInfo),wi(a,s),Si(s),Es=h;break;case 12:wi(a,s),Si(s);break;case 31:wi(a,s),Si(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,sh(s,h)));break;case 13:wi(a,s),Si(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ah=wt()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,sh(s,h)));break;case 22:_=s.memoizedState!==null;var X=c!==null&&c.memoizedState!==null,se=Nn,he=_r;if(Nn=se||_,_r=he||X,wi(a,s),_r=he,Nn=se,Si(s),h&8192)e:for(a=s.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(c===null||X||Nn||_r||fo(s)),c=null,a=s;;){if(a.tag===5||a.tag===26){if(c===null){X=c=a;try{if(x=X.stateNode,_)R=x.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{O=X.stateNode;var pe=X.memoizedProps.style,ae=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;O.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Le){jt(X,X.return,Le)}}}else if(a.tag===6){if(c===null){X=a;try{X.stateNode.nodeValue=_?"":X.memoizedProps}catch(Le){jt(X,X.return,Le)}}}else if(a.tag===18){if(c===null){X=a;try{var le=X.stateNode;_?Yw(le,!0):Yw(X.stateNode,!1)}catch(Le){jt(X,X.return,Le)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,sh(s,c))));break;case 19:wi(a,s),Si(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,sh(s,h)));break;case 30:break;case 21:break;default:wi(a,s),Si(s)}}function Si(s){var a=s.flags;if(a&2){try{for(var c,h=s.return;h!==null;){if(X1(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var _=c.stateNode,x=yg(s);ih(s,x,_);break;case 5:var R=c.stateNode;c.flags&32&&(Jo(R,""),c.flags&=-33);var O=yg(s);ih(s,O,R);break;case 3:case 4:var X=c.stateNode.containerInfo,se=yg(s);bg(s,se,X);break;default:throw Error(i(161))}}catch(he){jt(s,s.return,he)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function nw(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;nw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function An(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)J1(s,a.alternate,a),a=a.sibling}function fo(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ca(4,a,a.return),fo(a);break;case 1:Ws(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Y1(a,a.return,c),fo(a);break;case 27:Zc(a.stateNode);case 26:case 5:Ws(a,a.return),fo(a);break;case 22:a.memoizedState===null&&fo(a);break;case 30:fo(a);break;default:fo(a)}s=s.sibling}}function Tn(s,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,_=s,x=a,R=x.flags;switch(x.tag){case 0:case 11:case 15:Tn(_,x,c),Uc(4,x);break;case 1:if(Tn(_,x,c),h=x,_=h.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(se){jt(h,h.return,se)}if(h=x,_=h.updateQueue,_!==null){var O=h.stateNode;try{var X=_.shared.hiddenCallbacks;if(X!==null)for(_.shared.hiddenCallbacks=null,_=0;_<X.length;_++)Bb(X[_],O)}catch(se){jt(h,h.return,se)}}c&&R&64&&G1(x),Hc(x,x.return);break;case 27:Z1(x);case 26:case 5:Tn(_,x,c),c&&h===null&&R&4&&K1(x),Hc(x,x.return);break;case 12:Tn(_,x,c);break;case 31:Tn(_,x,c),c&&R&4&&rw(_,x);break;case 13:Tn(_,x,c),c&&R&4&&iw(_,x);break;case 22:x.memoizedState===null&&Tn(_,x,c),Hc(x,x.return);break;case 30:break;default:Tn(_,x,c)}a=a.sibling}}function Sg(s,a){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&Nc(c))}function Cg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nc(s))}function ks(s,a,c,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)aw(s,a,c,h),a=a.sibling}function aw(s,a,c,h){var _=a.flags;switch(a.tag){case 0:case 11:case 15:ks(s,a,c,h),_&2048&&Uc(9,a);break;case 1:ks(s,a,c,h);break;case 3:ks(s,a,c,h),_&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Nc(s)));break;case 12:if(_&2048){ks(s,a,c,h),s=a.stateNode;try{var x=a.memoizedProps,R=x.id,O=x.onPostCommit;typeof O=="function"&&O(R,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(X){jt(a,a.return,X)}}else ks(s,a,c,h);break;case 31:ks(s,a,c,h);break;case 13:ks(s,a,c,h);break;case 23:break;case 22:x=a.stateNode,R=a.alternate,a.memoizedState!==null?x._visibility&2?ks(s,a,c,h):Fc(s,a):x._visibility&2?ks(s,a,c,h):(x._visibility|=2,xl(s,a,c,h,(a.subtreeFlags&10256)!==0||!1)),_&2048&&Sg(R,a);break;case 24:ks(s,a,c,h),_&2048&&Cg(a.alternate,a);break;default:ks(s,a,c,h)}}function xl(s,a,c,h,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=s,R=a,O=c,X=h,se=R.flags;switch(R.tag){case 0:case 11:case 15:xl(x,R,O,X,_),Uc(8,R);break;case 23:break;case 22:var he=R.stateNode;R.memoizedState!==null?he._visibility&2?xl(x,R,O,X,_):Fc(x,R):(he._visibility|=2,xl(x,R,O,X,_)),_&&se&2048&&Sg(R.alternate,R);break;case 24:xl(x,R,O,X,_),_&&se&2048&&Cg(R.alternate,R);break;default:xl(x,R,O,X,_)}a=a.sibling}}function Fc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=s,h=a,_=h.flags;switch(h.tag){case 22:Fc(c,h),_&2048&&Sg(h.alternate,h);break;case 24:Fc(c,h),_&2048&&Cg(h.alternate,h);break;default:Fc(c,h)}a=a.sibling}}var qc=8192;function yl(s,a,c){if(s.subtreeFlags&qc)for(s=s.child;s!==null;)ow(s,a,c),s=s.sibling}function ow(s,a,c){switch(s.tag){case 26:yl(s,a,c),s.flags&qc&&s.memoizedState!==null&&J3(c,Es,s.memoizedState,s.memoizedProps);break;case 5:yl(s,a,c);break;case 3:case 4:var h=Es;Es=_h(s.stateNode.containerInfo),yl(s,a,c),Es=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=qc,qc=16777216,yl(s,a,c),qc=h):yl(s,a,c));break;default:yl(s,a,c)}}function lw(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Wc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];Mr=h,uw(h,s)}lw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)cw(s),s=s.sibling}function cw(s){switch(s.tag){case 0:case 11:case 15:Wc(s),s.flags&2048&&ca(9,s,s.return);break;case 3:Wc(s);break;case 12:Wc(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,nh(s)):Wc(s);break;default:Wc(s)}}function nh(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];Mr=h,uw(h,s)}lw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ca(8,a,a.return),nh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,nh(a));break;default:nh(a)}s=s.sibling}}function uw(s,a){for(;Mr!==null;){var c=Mr;switch(c.tag){case 0:case 11:case 15:ca(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Nc(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,Mr=h;else e:for(c=s;Mr!==null;){h=Mr;var _=h.sibling,x=h.return;if(ew(h),h===c){Mr=null;break e}if(_!==null){_.return=x,Mr=_;break e}Mr=x}}}var m3={getCacheForType:function(s){var a=Yr(pr),c=a.data.get(s);return c===void 0&&(c=s(),a.data.set(s,c)),c},cacheSignal:function(){return Yr(pr).controller.signal}},p3=typeof WeakMap=="function"?WeakMap:Map,bt=0,zt=null,ot=null,dt=0,Nt=0,Oi=null,ua=!1,bl=!1,Eg=!1,Mn=0,Qt=0,da=0,mo=0,kg=0,Bi=0,wl=0,Vc=null,Ci=null,Rg=!1,ah=0,dw=0,oh=1/0,lh=null,ha=null,Sr=0,fa=null,Sl=null,Dn=0,Ng=0,jg=null,hw=null,Gc=0,Ag=null;function Pi(){return(bt&2)!==0&&dt!==0?dt&-dt:A.T!==null?Bg():_e()}function fw(){if(Bi===0)if((dt&536870912)===0||ft){var s=ci;ci<<=1,(ci&3932160)===0&&(ci=262144),Bi=s}else Bi=536870912;return s=Di.current,s!==null&&(s.flags|=32),Bi}function Ei(s,a,c){(s===zt&&(Nt===2||Nt===9)||s.cancelPendingCommit!==null)&&(Cl(s,0),ma(s,dt,Bi,!1)),Mt(s,c),((bt&2)===0||s!==zt)&&(s===zt&&((bt&2)===0&&(mo|=c),Qt===4&&ma(s,dt,Bi,!1)),Vs(s))}function mw(s,a,c){if((bt&6)!==0)throw Error(i(327));var h=!c&&(a&127)===0&&(a&s.expiredLanes)===0||Tt(s,a),_=h?_3(s,a):Mg(s,a,!0),x=h;do{if(_===0){bl&&!h&&ma(s,a,0,!1);break}else{if(c=s.current.alternate,x&&!g3(c)){_=Mg(s,a,!1),x=!1;continue}if(_===2){if(x=a,s.errorRecoveryDisabledLanes&x)var R=0;else R=s.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){a=R;e:{var O=s;_=Vc;var X=O.current.memoizedState.isDehydrated;if(X&&(Cl(O,R).flags|=256),R=Mg(O,R,!1),R!==2){if(Eg&&!X){O.errorRecoveryDisabledLanes|=x,mo|=x,_=4;break e}x=Ci,Ci=_,x!==null&&(Ci===null?Ci=x:Ci.push.apply(Ci,x))}_=R}if(x=!1,_!==2)continue}}if(_===1){Cl(s,0),ma(s,a,0,!0);break}e:{switch(h=s,x=_,x){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:ma(h,a,Bi,!ua);break e;case 2:Ci=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(_=ah+300-wt(),10<_)){if(ma(h,a,Bi,!ua),He(h,0,!0)!==0)break e;Dn=a,h.timeoutHandle=Ww(pw.bind(null,h,c,Ci,lh,Rg,a,Bi,mo,wl,ua,x,"Throttled",-0,0),_);break e}pw(h,c,Ci,lh,Rg,a,Bi,mo,wl,ua,x,null,-0,0)}}break}while(!0);Vs(s)}function pw(s,a,c,h,_,x,R,O,X,se,he,pe,ae,le){if(s.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:_n},ow(a,x,pe);var Le=(x&62914560)===x?ah-wt():(x&4194048)===x?dw-wt():0;if(Le=eD(pe,Le),Le!==null){Dn=x,s.cancelPendingCommit=Le(Sw.bind(null,s,a,x,c,h,_,R,O,X,he,pe,null,ae,le)),ma(s,x,R,!se);return}}Sw(s,a,x,c,h,_,R,O,X)}function g3(s){for(var a=s;;){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 h=0;h<c.length;h++){var _=c[h],x=_.getSnapshot;_=_.value;try{if(!Ti(x(),_))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ma(s,a,c,h){a&=~kg,a&=~mo,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var _=a;0<_;){var x=31-or(_),R=1<<x;h[x]=-1,_&=~R}c!==0&&Ki(s,c,a)}function ch(){return(bt&6)===0?(Yc(0),!1):!0}function Tg(){if(ot!==null){if(Nt===0)var s=ot.return;else s=ot,wn=so=null,Gp(s),ml=null,Ac=0,s=ot;for(;s!==null;)V1(s.alternate,s),s=s.return;ot=null}}function Cl(s,a){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,B3(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Dn=0,Tg(),zt=s,ot=c=yn(s.current,null),dt=a,Nt=0,Oi=null,ua=!1,bl=Tt(s,a),Eg=!1,wl=Bi=kg=mo=da=Qt=0,Ci=Vc=null,Rg=!1,(a&8)!==0&&(a|=a&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=a;0<h;){var _=31-or(h),x=1<<_;a|=s[_],h&=~x}return Mn=a,Ad(),c}function gw(s,a){Xe=null,A.H=zc,a===fl||a===zd?(a=Mb(),Nt=3):a===Op?(a=Mb(),Nt=4):Nt=a===cg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Oi=a,ot===null&&(Qt=1,Qd(s,Ji(a,s.current)))}function vw(){var s=Di.current;return s===null?!0:(dt&4194048)===dt?is===null:(dt&62914560)===dt||(dt&536870912)!==0?s===is:!1}function _w(){var s=A.H;return A.H=zc,s===null?zc:s}function xw(){var s=A.A;return A.A=m3,s}function uh(){Qt=4,ua||(dt&4194048)!==dt&&Di.current!==null||(bl=!0),(da&134217727)===0&&(mo&134217727)===0||zt===null||ma(zt,dt,Bi,!1)}function Mg(s,a,c){var h=bt;bt|=2;var _=_w(),x=xw();(zt!==s||dt!==a)&&(lh=null,Cl(s,a)),a=!1;var R=Qt;e:do try{if(Nt!==0&&ot!==null){var O=ot,X=Oi;switch(Nt){case 8:Tg(),R=6;break e;case 3:case 2:case 9:case 6:Di.current===null&&(a=!0);var se=Nt;if(Nt=0,Oi=null,El(s,O,X,se),c&&bl){R=0;break e}break;default:se=Nt,Nt=0,Oi=null,El(s,O,X,se)}}v3(),R=Qt;break}catch(he){gw(s,he)}while(!0);return a&&s.shellSuspendCounter++,wn=so=null,bt=h,A.H=_,A.A=x,ot===null&&(zt=null,dt=0,Ad()),R}function v3(){for(;ot!==null;)yw(ot)}function _3(s,a){var c=bt;bt|=2;var h=_w(),_=xw();zt!==s||dt!==a?(lh=null,oh=wt()+500,Cl(s,a)):bl=Tt(s,a);e:do try{if(Nt!==0&&ot!==null){a=ot;var x=Oi;t:switch(Nt){case 1:Nt=0,Oi=null,El(s,a,x,1);break;case 2:case 9:if(Ab(x)){Nt=0,Oi=null,bw(a);break}a=function(){Nt!==2&&Nt!==9||zt!==s||(Nt=7),Vs(s)},x.then(a,a);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:Ab(x)?(Nt=0,Oi=null,bw(a)):(Nt=0,Oi=null,El(s,a,x,7));break;case 5:var R=null;switch(ot.tag){case 26:R=ot.memoizedState;case 5:case 27:var O=ot;if(R?aS(R):O.stateNode.complete){Nt=0,Oi=null;var X=O.sibling;if(X!==null)ot=X;else{var se=O.return;se!==null?(ot=se,dh(se)):ot=null}break t}}Nt=0,Oi=null,El(s,a,x,5);break;case 6:Nt=0,Oi=null,El(s,a,x,6);break;case 8:Tg(),Qt=6;break e;default:throw Error(i(462))}}x3();break}catch(he){gw(s,he)}while(!0);return wn=so=null,A.H=h,A.A=_,bt=c,ot!==null?0:(zt=null,dt=0,Ad(),Qt)}function x3(){for(;ot!==null&&!Ue();)yw(ot)}function yw(s){var a=q1(s.alternate,s,Mn);s.memoizedProps=s.pendingProps,a===null?dh(s):ot=a}function bw(s){var a=s,c=a.alternate;switch(a.tag){case 15:case 0:a=z1(c,a,a.pendingProps,a.type,void 0,dt);break;case 11:a=z1(c,a,a.pendingProps,a.type.render,a.ref,dt);break;case 5:Gp(a);default:V1(c,a),a=ot=xb(a,Mn),a=q1(c,a,Mn)}s.memoizedProps=s.pendingProps,a===null?dh(s):ot=a}function El(s,a,c,h){wn=so=null,Gp(a),ml=null,Ac=0;var _=a.return;try{if(o3(s,_,a,c,dt)){Qt=1,Qd(s,Ji(c,s.current)),ot=null;return}}catch(x){if(_!==null)throw ot=_,x;Qt=1,Qd(s,Ji(c,s.current)),ot=null;return}a.flags&32768?(ft||h===1?s=!0:bl||(dt&536870912)!==0?s=!1:(ua=s=!0,(h===2||h===9||h===3||h===6)&&(h=Di.current,h!==null&&h.tag===13&&(h.flags|=16384))),ww(a,s)):dh(a)}function dh(s){var a=s;do{if((a.flags&32768)!==0){ww(a,ua);return}s=a.return;var c=u3(a.alternate,a,Mn);if(c!==null){ot=c;return}if(a=a.sibling,a!==null){ot=a;return}ot=a=s}while(a!==null);Qt===0&&(Qt=5)}function ww(s,a){do{var c=d3(s.alternate,s);if(c!==null){c.flags&=32767,ot=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(s=s.sibling,s!==null)){ot=s;return}ot=s=c}while(s!==null);Qt=6,ot=null}function Sw(s,a,c,h,_,x,R,O,X){s.cancelPendingCommit=null;do hh();while(Sr!==0);if((bt&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(x=a.lanes|a.childLanes,x|=yp,cr(s,c,x,R,O,X),s===zt&&(ot=zt=null,dt=0),Sl=a,fa=s,Dn=c,Ng=x,jg=_,hw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,S3(mt,function(){return Nw(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=A.T,A.T=null,_=$.p,$.p=2,R=bt,bt|=4;try{h3(s,a,c)}finally{bt=R,$.p=_,A.T=h}}Sr=1,Cw(),Ew(),kw()}}function Cw(){if(Sr===1){Sr=0;var s=fa,a=Sl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=A.T,A.T=null;var h=$.p;$.p=2;var _=bt;bt|=4;try{sw(a,s);var x=qg,R=ub(s.containerInfo),O=x.focusedElem,X=x.selectionRange;if(R!==O&&O&&O.ownerDocument&&cb(O.ownerDocument.documentElement,O)){if(X!==null&&pp(O)){var se=X.start,he=X.end;if(he===void 0&&(he=se),"selectionStart"in O)O.selectionStart=se,O.selectionEnd=Math.min(he,O.value.length);else{var pe=O.ownerDocument||document,ae=pe&&pe.defaultView||window;if(ae.getSelection){var le=ae.getSelection(),Le=O.textContent.length,Fe=Math.min(X.start,Le),Ot=X.end===void 0?Fe:Math.min(X.end,Le);!le.extend&&Fe>Ot&&(R=Ot,Ot=Fe,Fe=R);var ee=lb(O,Fe),Q=lb(O,Ot);if(ee&&Q&&(le.rangeCount!==1||le.anchorNode!==ee.node||le.anchorOffset!==ee.offset||le.focusNode!==Q.node||le.focusOffset!==Q.offset)){var ie=pe.createRange();ie.setStart(ee.node,ee.offset),le.removeAllRanges(),Fe>Ot?(le.addRange(ie),le.extend(Q.node,Q.offset)):(ie.setEnd(Q.node,Q.offset),le.addRange(ie))}}}}for(pe=[],le=O;le=le.parentNode;)le.nodeType===1&&pe.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<pe.length;O++){var fe=pe[O];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Ch=!!Fg,qg=Fg=null}finally{bt=_,$.p=h,A.T=c}}s.current=a,Sr=2}}function Ew(){if(Sr===2){Sr=0;var s=fa,a=Sl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=A.T,A.T=null;var h=$.p;$.p=2;var _=bt;bt|=4;try{J1(s,a.alternate,a)}finally{bt=_,$.p=h,A.T=c}}Sr=3}}function kw(){if(Sr===4||Sr===3){Sr=0,Gt();var s=fa,a=Sl,c=Dn,h=hw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Sr=5:(Sr=0,Sl=fa=null,Rw(s,s.pendingLanes));var _=s.pendingLanes;if(_===0&&(ha=null),_i(c),a=a.stateNode,ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(ii,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=A.T,_=$.p,$.p=2,A.T=null;try{for(var x=s.onRecoverableError,R=0;R<h.length;R++){var O=h[R];x(O.value,{componentStack:O.stack})}}finally{A.T=a,$.p=_}}(Dn&3)!==0&&hh(),Vs(s),_=s.pendingLanes,(c&261930)!==0&&(_&42)!==0?s===Ag?Gc++:(Gc=0,Ag=s):Gc=0,Yc(0)}}function Rw(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Nc(a)))}function hh(){return Cw(),Ew(),kw(),Nw()}function Nw(){if(Sr!==5)return!1;var s=fa,a=Ng;Ng=0;var c=_i(Dn),h=A.T,_=$.p;try{$.p=32>c?32:c,A.T=null,c=jg,jg=null;var x=fa,R=Dn;if(Sr=0,Sl=fa=null,Dn=0,(bt&6)!==0)throw Error(i(331));var O=bt;if(bt|=4,cw(x.current),aw(x,x.current,R,c),bt=O,Yc(0,!1),ar&&typeof ar.onPostCommitFiberRoot=="function")try{ar.onPostCommitFiberRoot(ii,x)}catch{}return!0}finally{$.p=_,A.T=h,Rw(s,a)}}function jw(s,a,c){a=Ji(c,a),a=lg(s.stateNode,a,2),s=aa(s,a,2),s!==null&&(Mt(s,2),Vs(s))}function jt(s,a,c){if(s.tag===3)jw(s,s,c);else for(;a!==null;){if(a.tag===3){jw(a,s,c);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(ha===null||!ha.has(h))){s=Ji(c,s),c=A1(2),h=aa(a,c,2),h!==null&&(T1(c,h,a,s),Mt(h,2),Vs(h));break}}a=a.return}}function Dg(s,a,c){var h=s.pingCache;if(h===null){h=s.pingCache=new p3;var _=new Set;h.set(a,_)}else _=h.get(a),_===void 0&&(_=new Set,h.set(a,_));_.has(c)||(Eg=!0,_.add(c),s=y3.bind(null,s,a,c),a.then(s,s))}function y3(s,a,c){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,zt===s&&(dt&c)===c&&(Qt===4||Qt===3&&(dt&62914560)===dt&&300>wt()-ah?(bt&2)===0&&Cl(s,0):kg|=c,wl===dt&&(wl=0)),Vs(s)}function Aw(s,a){a===0&&(a=It()),s=to(s,a),s!==null&&(Mt(s,a),Vs(s))}function b3(s){var a=s.memoizedState,c=0;a!==null&&(c=a.retryLane),Aw(s,c)}function w3(s,a){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,_=s.memoizedState;_!==null&&(c=_.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),Aw(s,c)}function S3(s,a){return ze(s,a)}var fh=null,kl=null,Lg=!1,mh=!1,Og=!1,pa=0;function Vs(s){s!==kl&&s.next===null&&(kl===null?fh=kl=s:kl=kl.next=s),mh=!0,Lg||(Lg=!0,E3())}function Yc(s,a){if(!Og&&mh){Og=!0;do for(var c=!1,h=fh;h!==null;){if(s!==0){var _=h.pendingLanes;if(_===0)var x=0;else{var R=h.suspendedLanes,O=h.pingedLanes;x=(1<<31-or(42|s)+1)-1,x&=_&~(R&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Lw(h,x))}else x=dt,x=He(h,h===zt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||Tt(h,x)||(c=!0,Lw(h,x));h=h.next}while(c);Og=!1}}function C3(){Tw()}function Tw(){mh=Lg=!1;var s=0;pa!==0&&O3()&&(s=pa);for(var a=wt(),c=null,h=fh;h!==null;){var _=h.next,x=Mw(h,a);x===0?(h.next=null,c===null?fh=_:c.next=_,_===null&&(kl=c)):(c=h,(s!==0||(x&3)!==0)&&(mh=!0)),h=_}Sr!==0&&Sr!==5||Yc(s),pa!==0&&(pa=0)}function Mw(s,a){for(var c=s.suspendedLanes,h=s.pingedLanes,_=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var R=31-or(x),O=1<<R,X=_[R];X===-1?((O&c)===0||(O&h)!==0)&&(_[R]=Ct(O,a)):X<=a&&(s.expiredLanes|=O),x&=~O}if(a=zt,c=dt,c=He(s,s===a?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===a&&(Nt===2||Nt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&Se(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Tt(s,c)){if(a=c&-c,a===s.callbackPriority)return a;switch(h!==null&&Se(h),_i(c)){case 2:case 8:c=gt;break;case 32:c=mt;break;case 268435456:c=ut;break;default:c=mt}return h=Dw.bind(null,s),c=ze(c,h),s.callbackPriority=a,s.callbackNode=c,a}return h!==null&&h!==null&&Se(h),s.callbackPriority=2,s.callbackNode=null,2}function Dw(s,a){if(Sr!==0&&Sr!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(hh()&&s.callbackNode!==c)return null;var h=dt;return h=He(s,s===zt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(mw(s,h,a),Mw(s,wt()),s.callbackNode!=null&&s.callbackNode===c?Dw.bind(null,s):null)}function Lw(s,a){if(hh())return null;mw(s,a,!0)}function E3(){P3(function(){(bt&6)!==0?ze(Ve,C3):Tw()})}function Bg(){if(pa===0){var s=dl;s===0&&(s=lr,lr<<=1,(lr&261888)===0&&(lr=256)),pa=s}return pa}function Ow(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:wd(""+s)}function Bw(s,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,s.id&&c.setAttribute("form",s.id),a.parentNode.insertBefore(c,a),s=new FormData(s),c.parentNode.removeChild(c),s}function k3(s,a,c,h,_){if(a==="submit"&&c&&c.stateNode===_){var x=Ow((_[vt]||null).action),R=h.submitter;R&&(a=(a=R[vt]||null)?Ow(a.formAction):R.getAttribute("formAction"),a!==null&&(x=a,R=null));var O=new kd("action","action",null,h,_);s.push({event:O,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(pa!==0){var X=R?Bw(_,R):new FormData(_);rg(c,{pending:!0,data:X,method:_.method,action:x},null,X)}}else typeof x=="function"&&(O.preventDefault(),X=R?Bw(_,R):new FormData(_),rg(c,{pending:!0,data:X,method:_.method,action:x},x,X))},currentTarget:_}]})}}for(var Pg=0;Pg<xp.length;Pg++){var zg=xp[Pg],R3=zg.toLowerCase(),N3=zg[0].toUpperCase()+zg.slice(1);Cs(R3,"on"+N3)}Cs(fb,"onAnimationEnd"),Cs(mb,"onAnimationIteration"),Cs(pb,"onAnimationStart"),Cs("dblclick","onDoubleClick"),Cs("focusin","onFocus"),Cs("focusout","onBlur"),Cs(qM,"onTransitionRun"),Cs(WM,"onTransitionStart"),Cs(VM,"onTransitionCancel"),Cs(gb,"onTransitionEnd"),Zo("onMouseEnter",["mouseout","mouseover"]),Zo("onMouseLeave",["mouseout","mouseover"]),Zo("onPointerEnter",["pointerout","pointerover"]),Zo("onPointerLeave",["pointerout","pointerover"]),Za("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Za("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Za("onBeforeInput",["compositionend","keypress","textInput","paste"]),Za("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kc="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(" "),j3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kc));function Pw(s,a){a=(a&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],_=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var R=h.length-1;0<=R;R--){var O=h[R],X=O.instance,se=O.currentTarget;if(O=O.listener,X!==x&&_.isPropagationStopped())break e;x=O,_.currentTarget=se;try{x(_)}catch(he){jd(he)}_.currentTarget=null,x=X}else for(R=0;R<h.length;R++){if(O=h[R],X=O.instance,se=O.currentTarget,O=O.listener,X!==x&&_.isPropagationStopped())break e;x=O,_.currentTarget=se;try{x(_)}catch(he){jd(he)}_.currentTarget=null,x=X}}}}function lt(s,a){var c=a[Hs];c===void 0&&(c=a[Hs]=new Set);var h=s+"__bubble";c.has(h)||(zw(a,s,2,!1),c.add(h))}function Ig(s,a,c){var h=0;a&&(h|=4),zw(c,s,h,a)}var ph="_reactListening"+Math.random().toString(36).slice(2);function $g(s){if(!s[ph]){s[ph]=!0,Ty.forEach(function(c){c!=="selectionchange"&&(j3.has(c)||Ig(c,!1,s),Ig(c,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[ph]||(a[ph]=!0,Ig("selectionchange",!1,a))}}function zw(s,a,c,h){switch(fS(a)){case 2:var _=iD;break;case 8:_=sD;break;default:_=tv}c=_.bind(null,a,c,s),_=void 0,!ap||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),h?_!==void 0?s.addEventListener(a,c,{capture:!0,passive:_}):s.addEventListener(a,c,!0):_!==void 0?s.addEventListener(a,c,{passive:_}):s.addEventListener(a,c,!1)}function Ug(s,a,c,h,_){var x=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var O=h.stateNode.containerInfo;if(O===_)break;if(R===4)for(R=h.return;R!==null;){var X=R.tag;if((X===3||X===4)&&R.stateNode.containerInfo===_)return;R=R.return}for(;O!==null;){if(R=Yo(O),R===null)return;if(X=R.tag,X===5||X===6||X===26||X===27){h=x=R;continue e}O=O.parentNode}}h=h.return}Fy(function(){var se=x,he=sp(c),pe=[];e:{var ae=vb.get(s);if(ae!==void 0){var le=kd,Le=s;switch(s){case"keypress":if(Cd(c)===0)break e;case"keydown":case"keyup":le=wM;break;case"focusin":Le="focus",le=up;break;case"focusout":Le="blur",le=up;break;case"beforeblur":case"afterblur":le=up;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":le=Vy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=uM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=EM;break;case fb:case mb:case pb:le=fM;break;case gb:le=RM;break;case"scroll":case"scrollend":le=lM;break;case"wheel":le=jM;break;case"copy":case"cut":case"paste":le=pM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Yy;break;case"toggle":case"beforetoggle":le=TM}var Fe=(a&4)!==0,Ot=!Fe&&(s==="scroll"||s==="scrollend"),ee=Fe?ae!==null?ae+"Capture":null:ae;Fe=[];for(var Q=se,ie;Q!==null;){var fe=Q;if(ie=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ie===null||ee===null||(fe=vc(Q,ee),fe!=null&&Fe.push(Xc(Q,fe,ie))),Ot)break;Q=Q.return}0<Fe.length&&(ae=new le(ae,Le,null,c,he),pe.push({event:ae,listeners:Fe}))}}if((a&7)===0){e:{if(ae=s==="mouseover"||s==="pointerover",le=s==="mouseout"||s==="pointerout",ae&&c!==ip&&(Le=c.relatedTarget||c.fromElement)&&(Yo(Le)||Le[xi]))break e;if((le||ae)&&(ae=he.window===he?he:(ae=he.ownerDocument)?ae.defaultView||ae.parentWindow:window,le?(Le=c.relatedTarget||c.toElement,le=se,Le=Le?Yo(Le):null,Le!==null&&(Ot=o(Le),Fe=Le.tag,Le!==Ot||Fe!==5&&Fe!==27&&Fe!==6)&&(Le=null)):(le=null,Le=se),le!==Le)){if(Fe=Vy,fe="onMouseLeave",ee="onMouseEnter",Q="mouse",(s==="pointerout"||s==="pointerover")&&(Fe=Yy,fe="onPointerLeave",ee="onPointerEnter",Q="pointer"),Ot=le==null?ae:gc(le),ie=Le==null?ae:gc(Le),ae=new Fe(fe,Q+"leave",le,c,he),ae.target=Ot,ae.relatedTarget=ie,fe=null,Yo(he)===se&&(Fe=new Fe(ee,Q+"enter",Le,c,he),Fe.target=ie,Fe.relatedTarget=Ot,fe=Fe),Ot=fe,le&&Le)t:{for(Fe=A3,ee=le,Q=Le,ie=0,fe=ee;fe;fe=Fe(fe))ie++;fe=0;for(var Ie=Q;Ie;Ie=Fe(Ie))fe++;for(;0<ie-fe;)ee=Fe(ee),ie--;for(;0<fe-ie;)Q=Fe(Q),fe--;for(;ie--;){if(ee===Q||Q!==null&&ee===Q.alternate){Fe=ee;break t}ee=Fe(ee),Q=Fe(Q)}Fe=null}else Fe=null;le!==null&&Iw(pe,ae,le,Fe,!1),Le!==null&&Ot!==null&&Iw(pe,Ot,Le,Fe,!0)}}e:{if(ae=se?gc(se):window,le=ae.nodeName&&ae.nodeName.toLowerCase(),le==="select"||le==="input"&&ae.type==="file")var _t=rb;else if(eb(ae))if(ib)_t=UM;else{_t=IM;var Be=zM}else le=ae.nodeName,!le||le.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?se&&rp(se.elementType)&&(_t=rb):_t=$M;if(_t&&(_t=_t(s,se))){tb(pe,_t,c,he);break e}Be&&Be(s,ae,se),s==="focusout"&&se&&ae.type==="number"&&se.memoizedProps.value!=null&&tp(ae,"number",ae.value)}switch(Be=se?gc(se):window,s){case"focusin":(eb(Be)||Be.contentEditable==="true")&&(il=Be,gp=se,Ec=null);break;case"focusout":Ec=gp=il=null;break;case"mousedown":vp=!0;break;case"contextmenu":case"mouseup":case"dragend":vp=!1,db(pe,c,he);break;case"selectionchange":if(FM)break;case"keydown":case"keyup":db(pe,c,he)}var Ze;if(hp)e:{switch(s){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else rl?Qy(s,c)&&(ht="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(ht="onCompositionStart");ht&&(Ky&&c.locale!=="ko"&&(rl||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&rl&&(Ze=qy()):(Jn=he,op="value"in Jn?Jn.value:Jn.textContent,rl=!0)),Be=gh(se,ht),0<Be.length&&(ht=new Gy(ht,s,null,c,he),pe.push({event:ht,listeners:Be}),Ze?ht.data=Ze:(Ze=Jy(c),Ze!==null&&(ht.data=Ze)))),(Ze=DM?LM(s,c):OM(s,c))&&(ht=gh(se,"onBeforeInput"),0<ht.length&&(Be=new Gy("onBeforeInput","beforeinput",null,c,he),pe.push({event:Be,listeners:ht}),Be.data=Ze)),k3(pe,s,se,c,he)}Pw(pe,a)})}function Xc(s,a,c){return{instance:s,listener:a,currentTarget:c}}function gh(s,a){for(var c=a+"Capture",h=[];s!==null;){var _=s,x=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||x===null||(_=vc(s,c),_!=null&&h.unshift(Xc(s,_,x)),_=vc(s,a),_!=null&&h.push(Xc(s,_,x))),s.tag===3)return h;s=s.return}return[]}function A3(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Iw(s,a,c,h,_){for(var x=a._reactName,R=[];c!==null&&c!==h;){var O=c,X=O.alternate,se=O.stateNode;if(O=O.tag,X!==null&&X===h)break;O!==5&&O!==26&&O!==27||se===null||(X=se,_?(se=vc(c,x),se!=null&&R.unshift(Xc(c,se,X))):_||(se=vc(c,x),se!=null&&R.push(Xc(c,se,X)))),c=c.return}R.length!==0&&s.push({event:a,listeners:R})}var T3=/\r\n?/g,M3=/\u0000|\uFFFD/g;function $w(s){return(typeof s=="string"?s:""+s).replace(T3,`
49
+ `).replace(M3,"")}function Uw(s,a){return a=$w(a),$w(s)===a}function Lt(s,a,c,h,_,x){switch(c){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Jo(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Jo(s,""+h);break;case"className":yd(s,"class",h);break;case"tabIndex":yd(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":yd(s,c,h);break;case"style":Uy(s,h,x);break;case"data":if(a!=="object"){yd(s,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=wd(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){s.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 x=="function"&&(c==="formAction"?(a!=="input"&&Lt(s,a,"name",_.name,_,null),Lt(s,a,"formEncType",_.formEncType,_,null),Lt(s,a,"formMethod",_.formMethod,_,null),Lt(s,a,"formTarget",_.formTarget,_,null)):(Lt(s,a,"encType",_.encType,_,null),Lt(s,a,"method",_.method,_,null),Lt(s,a,"target",_.target,_,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=wd(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=_n);break;case"onScroll":h!=null&&lt("scroll",s);break;case"onScrollEnd":h!=null&&lt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(_.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=wd(""+h),s.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":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.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":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":lt("beforetoggle",s),lt("toggle",s),xd(s,"popover",h);break;case"xlinkActuate":vn(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":vn(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":vn(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":vn(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":vn(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":vn(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":vn(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":vn(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":vn(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":xd(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=aM.get(c)||c,xd(s,c,h))}}function Hg(s,a,c,h,_,x){switch(c){case"style":Uy(s,h,x);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(_.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof h=="string"?Jo(s,h):(typeof h=="number"||typeof h=="bigint")&&Jo(s,""+h);break;case"onScroll":h!=null&&lt("scroll",s);break;case"onScrollEnd":h!=null&&lt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=_n);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!My.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(_=c.endsWith("Capture"),a=c.slice(2,_?c.length-7:void 0),x=s[vt]||null,x=x!=null?x[c]:null,typeof x=="function"&&s.removeEventListener(a,x,_),typeof h=="function")){typeof x!="function"&&x!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(a,h,_);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):xd(s,c,h)}}}function Xr(s,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",s),lt("load",s);var h=!1,_=!1,x;for(x in c)if(c.hasOwnProperty(x)){var R=c[x];if(R!=null)switch(x){case"src":h=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Lt(s,a,x,R,c,null)}}_&&Lt(s,a,"srcSet",c.srcSet,c,null),h&&Lt(s,a,"src",c.src,c,null);return;case"input":lt("invalid",s);var O=x=R=_=null,X=null,se=null;for(h in c)if(c.hasOwnProperty(h)){var he=c[h];if(he!=null)switch(h){case"name":_=he;break;case"type":R=he;break;case"checked":X=he;break;case"defaultChecked":se=he;break;case"value":x=he;break;case"defaultValue":O=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(i(137,a));break;default:Lt(s,a,h,he,c,null)}}Py(s,x,O,X,se,R,_,!1);return;case"select":lt("invalid",s),h=R=x=null;for(_ in c)if(c.hasOwnProperty(_)&&(O=c[_],O!=null))switch(_){case"value":x=O;break;case"defaultValue":R=O;break;case"multiple":h=O;default:Lt(s,a,_,O,c,null)}a=x,c=R,s.multiple=!!h,a!=null?Qo(s,!!h,a,!1):c!=null&&Qo(s,!!h,c,!0);return;case"textarea":lt("invalid",s),x=_=h=null;for(R in c)if(c.hasOwnProperty(R)&&(O=c[R],O!=null))switch(R){case"value":h=O;break;case"defaultValue":_=O;break;case"children":x=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:Lt(s,a,R,O,c,null)}Iy(s,h,_,x);return;case"option":for(X in c)if(c.hasOwnProperty(X)&&(h=c[X],h!=null))switch(X){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Lt(s,a,X,h,c,null)}return;case"dialog":lt("beforetoggle",s),lt("toggle",s),lt("cancel",s),lt("close",s);break;case"iframe":case"object":lt("load",s);break;case"video":case"audio":for(h=0;h<Kc.length;h++)lt(Kc[h],s);break;case"image":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"embed":case"source":case"link":lt("error",s),lt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in c)if(c.hasOwnProperty(se)&&(h=c[se],h!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:Lt(s,a,se,h,c,null)}return;default:if(rp(a)){for(he in c)c.hasOwnProperty(he)&&(h=c[he],h!==void 0&&Hg(s,a,he,h,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(h=c[O],h!=null&&Lt(s,a,O,h,c,null))}function D3(s,a,c,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,x=null,R=null,O=null,X=null,se=null,he=null;for(le in c){var pe=c[le];if(c.hasOwnProperty(le)&&pe!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":X=pe;default:h.hasOwnProperty(le)||Lt(s,a,le,null,h,pe)}}for(var ae in h){var le=h[ae];if(pe=c[ae],h.hasOwnProperty(ae)&&(le!=null||pe!=null))switch(ae){case"type":x=le;break;case"name":_=le;break;case"checked":se=le;break;case"defaultChecked":he=le;break;case"value":R=le;break;case"defaultValue":O=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,a));break;default:le!==pe&&Lt(s,a,ae,le,h,pe)}}ep(s,R,O,X,se,he,x,_);return;case"select":le=R=O=ae=null;for(x in c)if(X=c[x],c.hasOwnProperty(x)&&X!=null)switch(x){case"value":break;case"multiple":le=X;default:h.hasOwnProperty(x)||Lt(s,a,x,null,h,X)}for(_ in h)if(x=h[_],X=c[_],h.hasOwnProperty(_)&&(x!=null||X!=null))switch(_){case"value":ae=x;break;case"defaultValue":O=x;break;case"multiple":R=x;default:x!==X&&Lt(s,a,_,x,h,X)}a=O,c=R,h=le,ae!=null?Qo(s,!!c,ae,!1):!!h!=!!c&&(a!=null?Qo(s,!!c,a,!0):Qo(s,!!c,c?[]:"",!1));return;case"textarea":le=ae=null;for(O in c)if(_=c[O],c.hasOwnProperty(O)&&_!=null&&!h.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Lt(s,a,O,null,h,_)}for(R in h)if(_=h[R],x=c[R],h.hasOwnProperty(R)&&(_!=null||x!=null))switch(R){case"value":ae=_;break;case"defaultValue":le=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:_!==x&&Lt(s,a,R,_,h,x)}zy(s,ae,le);return;case"option":for(var Le in c)if(ae=c[Le],c.hasOwnProperty(Le)&&ae!=null&&!h.hasOwnProperty(Le))switch(Le){case"selected":s.selected=!1;break;default:Lt(s,a,Le,null,h,ae)}for(X in h)if(ae=h[X],le=c[X],h.hasOwnProperty(X)&&ae!==le&&(ae!=null||le!=null))switch(X){case"selected":s.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:Lt(s,a,X,ae,h,le)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Fe in c)ae=c[Fe],c.hasOwnProperty(Fe)&&ae!=null&&!h.hasOwnProperty(Fe)&&Lt(s,a,Fe,null,h,ae);for(se in h)if(ae=h[se],le=c[se],h.hasOwnProperty(se)&&ae!==le&&(ae!=null||le!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,a));break;default:Lt(s,a,se,ae,h,le)}return;default:if(rp(a)){for(var Ot in c)ae=c[Ot],c.hasOwnProperty(Ot)&&ae!==void 0&&!h.hasOwnProperty(Ot)&&Hg(s,a,Ot,void 0,h,ae);for(he in h)ae=h[he],le=c[he],!h.hasOwnProperty(he)||ae===le||ae===void 0&&le===void 0||Hg(s,a,he,ae,h,le);return}}for(var ee in c)ae=c[ee],c.hasOwnProperty(ee)&&ae!=null&&!h.hasOwnProperty(ee)&&Lt(s,a,ee,null,h,ae);for(pe in h)ae=h[pe],le=c[pe],!h.hasOwnProperty(pe)||ae===le||ae==null&&le==null||Lt(s,a,pe,ae,h,le)}function Hw(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function L3(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var _=c[h],x=_.transferSize,R=_.initiatorType,O=_.duration;if(x&&O&&Hw(R)){for(R=0,O=_.responseEnd,h+=1;h<c.length;h++){var X=c[h],se=X.startTime;if(se>O)break;var he=X.transferSize,pe=X.initiatorType;he&&Hw(pe)&&(X=X.responseEnd,R+=he*(X<O?1:(O-se)/(X-se)))}if(--h,a+=8*(x+R)/(_.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Fg=null,qg=null;function vh(s){return s.nodeType===9?s:s.ownerDocument}function Fw(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qw(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Wg(s,a){return s==="textarea"||s==="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 Vg=null;function O3(){var s=window.event;return s&&s.type==="popstate"?s===Vg?!1:(Vg=s,!0):(Vg=null,!1)}var Ww=typeof setTimeout=="function"?setTimeout:void 0,B3=typeof clearTimeout=="function"?clearTimeout:void 0,Vw=typeof Promise=="function"?Promise:void 0,P3=typeof queueMicrotask=="function"?queueMicrotask:typeof Vw<"u"?function(s){return Vw.resolve(null).then(s).catch(z3)}:Ww;function z3(s){setTimeout(function(){throw s})}function ga(s){return s==="head"}function Gw(s,a){var c=a,h=0;do{var _=c.nextSibling;if(s.removeChild(c),_&&_.nodeType===8)if(c=_.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(_),Al(a);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Zc(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Zc(c);for(var x=c.firstChild;x;){var R=x.nextSibling,O=x.nodeName;x[pc]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=R}}else c==="body"&&Zc(s.ownerDocument.body);c=_}while(c);Al(a)}function Yw(s,a){var c=s;s=0;do{var h=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||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function Gg(s){var a=s.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":Gg(c),Qm(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function I3(s,a,c,h){for(;s.nodeType===1;){var _=c;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[pc])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(x=s.getAttribute("rel"),x==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(x!==_.rel||s.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||s.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||s.getAttribute("title")!==(_.title==null?null:_.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(x=s.getAttribute("src"),(x!==(_.src==null?null:_.src)||s.getAttribute("type")!==(_.type==null?null:_.type)||s.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&x&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var x=_.name==null?null:""+_.name;if(_.type==="hidden"&&s.getAttribute("name")===x)return s}else return s;if(s=ss(s.nextSibling),s===null)break}return null}function $3(s,a,c){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=ss(s.nextSibling),s===null))return null;return s}function Kw(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ss(s.nextSibling),s===null))return null;return s}function Yg(s){return s.data==="$?"||s.data==="$~"}function Kg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function U3(s,a){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||c.readyState!=="loading")a();else{var h=function(){a(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function ss(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var Xg=null;function Xw(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(a===0)return ss(s.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}s=s.nextSibling}return null}function Zw(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return s;a--}else c!=="/$"&&c!=="/&"||a++}s=s.previousSibling}return null}function Qw(s,a,c){switch(a=vh(c),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Zc(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Qm(s)}var ns=new Map,Jw=new Set;function _h(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Ln=$.d;$.d={f:H3,r:F3,D:q3,C:W3,L:V3,m:G3,X:K3,S:Y3,M:X3};function H3(){var s=Ln.f(),a=ch();return s||a}function F3(s){var a=Ko(s);a!==null&&a.tag===5&&a.type==="form"?g1(a):Ln.r(s)}var Rl=typeof document>"u"?null:document;function eS(s,a,c){var h=Rl;if(h&&typeof a=="string"&&a){var _=Zi(a);_='link[rel="'+s+'"][href="'+_+'"]',typeof c=="string"&&(_+='[crossorigin="'+c+'"]'),Jw.has(_)||(Jw.add(_),s={rel:s,crossOrigin:c,href:a},h.querySelector(_)===null&&(a=h.createElement("link"),Xr(a,"link",s),Tr(a),h.head.appendChild(a)))}}function q3(s){Ln.D(s),eS("dns-prefetch",s,null)}function W3(s,a){Ln.C(s,a),eS("preconnect",s,a)}function V3(s,a,c){Ln.L(s,a,c);var h=Rl;if(h&&s&&a){var _='link[rel="preload"][as="'+Zi(a)+'"]';a==="image"&&c&&c.imageSrcSet?(_+='[imagesrcset="'+Zi(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(_+='[imagesizes="'+Zi(c.imageSizes)+'"]')):_+='[href="'+Zi(s)+'"]';var x=_;switch(a){case"style":x=Nl(s);break;case"script":x=jl(s)}ns.has(x)||(s=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:s,as:a},c),ns.set(x,s),h.querySelector(_)!==null||a==="style"&&h.querySelector(Qc(x))||a==="script"&&h.querySelector(Jc(x))||(a=h.createElement("link"),Xr(a,"link",s),Tr(a),h.head.appendChild(a)))}}function G3(s,a){Ln.m(s,a);var c=Rl;if(c&&s){var h=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+Zi(h)+'"][href="'+Zi(s)+'"]',x=_;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=jl(s)}if(!ns.has(x)&&(s=p({rel:"modulepreload",href:s},a),ns.set(x,s),c.querySelector(_)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Jc(x)))return}h=c.createElement("link"),Xr(h,"link",s),Tr(h),c.head.appendChild(h)}}}function Y3(s,a,c){Ln.S(s,a,c);var h=Rl;if(h&&s){var _=Xo(h).hoistableStyles,x=Nl(s);a=a||"default";var R=_.get(x);if(!R){var O={loading:0,preload:null};if(R=h.querySelector(Qc(x)))O.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":a},c),(c=ns.get(x))&&Zg(s,c);var X=R=h.createElement("link");Tr(X),Xr(X,"link",s),X._p=new Promise(function(se,he){X.onload=se,X.onerror=he}),X.addEventListener("load",function(){O.loading|=1}),X.addEventListener("error",function(){O.loading|=2}),O.loading|=4,xh(R,a,h)}R={type:"stylesheet",instance:R,count:1,state:O},_.set(x,R)}}}function K3(s,a){Ln.X(s,a);var c=Rl;if(c&&s){var h=Xo(c).hoistableScripts,_=jl(s),x=h.get(_);x||(x=c.querySelector(Jc(_)),x||(s=p({src:s,async:!0},a),(a=ns.get(_))&&Qg(s,a),x=c.createElement("script"),Tr(x),Xr(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(_,x))}}function X3(s,a){Ln.M(s,a);var c=Rl;if(c&&s){var h=Xo(c).hoistableScripts,_=jl(s),x=h.get(_);x||(x=c.querySelector(Jc(_)),x||(s=p({src:s,async:!0,type:"module"},a),(a=ns.get(_))&&Qg(s,a),x=c.createElement("script"),Tr(x),Xr(x,"link",s),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(_,x))}}function tS(s,a,c,h){var _=(_=ce.current)?_h(_):null;if(!_)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Nl(c.href),c=Xo(_).hoistableStyles,h=c.get(a),h||(h={type:"style",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Nl(c.href);var x=Xo(_).hoistableStyles,R=x.get(s);if(R||(_=_.ownerDocument||_,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,R),(x=_.querySelector(Qc(s)))&&!x._p&&(R.instance=x,R.state.loading=5),ns.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ns.set(s,c),x||Z3(_,s,c,R.state))),a&&h===null)throw Error(i(528,""));return R}if(a&&h!==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=jl(c),c=Xo(_).hoistableScripts,h=c.get(a),h||(h={type:"script",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Nl(s){return'href="'+Zi(s)+'"'}function Qc(s){return'link[rel="stylesheet"]['+s+"]"}function rS(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function Z3(s,a,c,h){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=s.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Xr(a,"link",c),Tr(a),s.head.appendChild(a))}function jl(s){return'[src="'+Zi(s)+'"]'}function Jc(s){return"script[async]"+s}function iS(s,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Zi(c.href)+'"]');if(h)return a.instance=h,Tr(h),h;var _=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Tr(h),Xr(h,"style",_),xh(h,c.precedence,s),a.instance=h;case"stylesheet":_=Nl(c.href);var x=s.querySelector(Qc(_));if(x)return a.state.loading|=4,a.instance=x,Tr(x),x;h=rS(c),(_=ns.get(_))&&Zg(h,_),x=(s.ownerDocument||s).createElement("link"),Tr(x);var R=x;return R._p=new Promise(function(O,X){R.onload=O,R.onerror=X}),Xr(x,"link",h),a.state.loading|=4,xh(x,c.precedence,s),a.instance=x;case"script":return x=jl(c.src),(_=s.querySelector(Jc(x)))?(a.instance=_,Tr(_),_):(h=c,(_=ns.get(x))&&(h=p({},c),Qg(h,_)),s=s.ownerDocument||s,_=s.createElement("script"),Tr(_),Xr(_,"link",h),s.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,xh(h,c.precedence,s));return a.instance}function xh(s,a,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=h.length?h[h.length-1]:null,x=_,R=0;R<h.length;R++){var O=h[R];if(O.dataset.precedence===a)x=O;else if(x!==_)break}x?x.parentNode.insertBefore(s,x.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(s,a.firstChild))}function Zg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function Qg(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var yh=null;function sS(s,a,c){if(yh===null){var h=new Map,_=yh=new Map;_.set(c,h)}else _=yh,h=_.get(c),h||(h=new Map,_.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),_=0;_<c.length;_++){var x=c[_];if(!(x[pc]||x[at]||s==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var R=x.getAttribute(a)||"";R=s+R;var O=h.get(R);O?O.push(x):h.set(R,[x])}}return h}function nS(s,a,c){s=s.ownerDocument||s,s.head.insertBefore(c,a==="title"?s.querySelector("head > title"):null)}function Q3(s,a,c){if(c===1||a.itemProp!=null)return!1;switch(s){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 s=a.disabled,typeof a.precedence=="string"&&s==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 aS(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function J3(s,a,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var _=Nl(h.href),x=a.querySelector(Qc(_));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=bh.bind(s),a.then(s,s)),c.state.loading|=4,c.instance=x,Tr(x);return}x=a.ownerDocument||a,h=rS(h),(_=ns.get(_))&&Zg(h,_),x=x.createElement("link"),Tr(x);var R=x;R._p=new Promise(function(O,X){R.onload=O,R.onerror=X}),Xr(x,"link",h),c.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=bh.bind(s),a.addEventListener("load",c),a.addEventListener("error",c))}}var Jg=0;function eD(s,a){return s.stylesheets&&s.count===0&&Sh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&Sh(s,s.stylesheets),s.unsuspend){var x=s.unsuspend;s.unsuspend=null,x()}},6e4+a);0<s.imgBytes&&Jg===0&&(Jg=62500*L3());var _=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Sh(s,s.stylesheets),s.unsuspend)){var x=s.unsuspend;s.unsuspend=null,x()}},(s.imgBytes>Jg?50:800)+a);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(_)}}:null}function bh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var wh=null;function Sh(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,wh=new Map,a.forEach(tD,s),wh=null,bh.call(s))}function tD(s,a){if(!(a.state.loading&4)){var c=wh.get(s);if(c)var h=c.get(null);else{c=new Map,wh.set(s,c);for(var _=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<_.length;x++){var R=_[x];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(c.set(R.dataset.precedence,R),h=R)}h&&c.set(null,h)}_=a.instance,R=_.getAttribute("data-precedence"),x=c.get(R)||h,x===h&&c.set(null,_),c.set(R,_),this.count++,h=bh.bind(this),_.addEventListener("load",h),_.addEventListener("error",h),x?x.parentNode.insertBefore(_,x.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(_,s.firstChild)),a.state.loading|=4}}var eu={$$typeof:j,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function rD(s,a,c,h,_,x,R,O,X){this.tag=1,this.containerInfo=s,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=Rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.hiddenUpdates=Rt(null),this.identifierPrefix=h,this.onUncaughtError=_,this.onCaughtError=x,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function oS(s,a,c,h,_,x,R,O,X,se,he,pe){return s=new rD(s,a,c,R,X,se,he,pe,O),a=1,x===!0&&(a|=24),x=Mi(3,null,null,a),s.current=x,x.stateNode=s,a=Mp(),a.refCount++,s.pooledCache=a,a.refCount++,x.memoizedState={element:h,isDehydrated:c,cache:a},Bp(x),s}function lS(s){return s?(s=al,s):al}function cS(s,a,c,h,_,x){_=lS(_),h.context===null?h.context=_:h.pendingContext=_,h=na(a),h.payload={element:c},x=x===void 0?null:x,x!==null&&(h.callback=x),c=aa(s,h,a),c!==null&&(Ei(c,s,a),Mc(c,s,a))}function uS(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<a?c:a}}function ev(s,a){uS(s,a),(s=s.alternate)&&uS(s,a)}function dS(s){if(s.tag===13||s.tag===31){var a=to(s,67108864);a!==null&&Ei(a,s,67108864),ev(s,67108864)}}function hS(s){if(s.tag===13||s.tag===31){var a=Pi();a=pn(a);var c=to(s,a);c!==null&&Ei(c,s,a),ev(s,a)}}var Ch=!0;function iD(s,a,c,h){var _=A.T;A.T=null;var x=$.p;try{$.p=2,tv(s,a,c,h)}finally{$.p=x,A.T=_}}function sD(s,a,c,h){var _=A.T;A.T=null;var x=$.p;try{$.p=8,tv(s,a,c,h)}finally{$.p=x,A.T=_}}function tv(s,a,c,h){if(Ch){var _=rv(h);if(_===null)Ug(s,a,h,Eh,c),mS(s,h);else if(aD(_,s,a,c,h))h.stopPropagation();else if(mS(s,h),a&4&&-1<nD.indexOf(s)){for(;_!==null;){var x=Ko(_);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var R=mr(x.pendingLanes);if(R!==0){var O=x;for(O.pendingLanes|=2,O.entangledLanes|=2;R;){var X=1<<31-or(R);O.entanglements[1]|=X,R&=~X}Vs(x),(bt&6)===0&&(oh=wt()+500,Yc(0))}}break;case 31:case 13:O=to(x,2),O!==null&&Ei(O,x,2),ch(),ev(x,2)}if(x=rv(h),x===null&&Ug(s,a,h,Eh,c),x===_)break;_=x}_!==null&&h.stopPropagation()}else Ug(s,a,h,null,c)}}function rv(s){return s=sp(s),iv(s)}var Eh=null;function iv(s){if(Eh=null,s=Yo(s),s!==null){var a=o(s);if(a===null)s=null;else{var c=a.tag;if(c===13){if(s=u(a),s!==null)return s;s=null}else if(c===31){if(s=d(a),s!==null)return s;s=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Eh=s,null}function fS(s){switch(s){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(Re()){case Ve:return 2;case gt:return 8;case mt:case kt:return 32;case ut:return 268435456;default:return 32}default:return 32}}var sv=!1,va=null,_a=null,xa=null,tu=new Map,ru=new Map,ya=[],nD="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 mS(s,a){switch(s){case"focusin":case"focusout":va=null;break;case"dragenter":case"dragleave":_a=null;break;case"mouseover":case"mouseout":xa=null;break;case"pointerover":case"pointerout":tu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ru.delete(a.pointerId)}}function iu(s,a,c,h,_,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:c,eventSystemFlags:h,nativeEvent:x,targetContainers:[_]},a!==null&&(a=Ko(a),a!==null&&dS(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),s)}function aD(s,a,c,h,_){switch(a){case"focusin":return va=iu(va,s,a,c,h,_),!0;case"dragenter":return _a=iu(_a,s,a,c,h,_),!0;case"mouseover":return xa=iu(xa,s,a,c,h,_),!0;case"pointerover":var x=_.pointerId;return tu.set(x,iu(tu.get(x)||null,s,a,c,h,_)),!0;case"gotpointercapture":return x=_.pointerId,ru.set(x,iu(ru.get(x)||null,s,a,c,h,_)),!0}return!1}function pS(s){var a=Yo(s.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){s.blockedOn=a,Oe(s.priority,function(){hS(c)});return}}else if(a===31){if(a=d(c),a!==null){s.blockedOn=a,Oe(s.priority,function(){hS(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function kh(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var c=rv(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);ip=h,c.target.dispatchEvent(h),ip=null}else return a=Ko(c),a!==null&&dS(a),s.blockedOn=c,!1;a.shift()}return!0}function gS(s,a,c){kh(s)&&c.delete(a)}function oD(){sv=!1,va!==null&&kh(va)&&(va=null),_a!==null&&kh(_a)&&(_a=null),xa!==null&&kh(xa)&&(xa=null),tu.forEach(gS),ru.forEach(gS)}function Rh(s,a){s.blockedOn===a&&(s.blockedOn=null,sv||(sv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,oD)))}var Nh=null;function vS(s){Nh!==s&&(Nh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Nh===s&&(Nh=null);for(var a=0;a<s.length;a+=3){var c=s[a],h=s[a+1],_=s[a+2];if(typeof h!="function"){if(iv(h||c)===null)continue;break}var x=Ko(c);x!==null&&(s.splice(a,3),a-=3,rg(x,{pending:!0,data:_,method:c.method,action:h},h,_))}}))}function Al(s){function a(X){return Rh(X,s)}va!==null&&Rh(va,s),_a!==null&&Rh(_a,s),xa!==null&&Rh(xa,s),tu.forEach(a),ru.forEach(a);for(var c=0;c<ya.length;c++){var h=ya[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<ya.length&&(c=ya[0],c.blockedOn===null);)pS(c),c.blockedOn===null&&ya.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var _=c[h],x=c[h+1],R=_[vt]||null;if(typeof x=="function")R||vS(c);else if(R){var O=null;if(x&&x.hasAttribute("formAction")){if(_=x,R=x[vt]||null)O=R.formAction;else if(iv(_)!==null)continue}else O=R.action;typeof O=="function"?c[h+1]=O:(c.splice(h,3),h-=3),vS(c)}}}function _S(){function s(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(R){return _=R})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),h||setTimeout(c,20)}function c(){if(!h&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,_=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function nv(s){this._internalRoot=s}jh.prototype.render=nv.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,h=Pi();cS(c,h,s,a,null,null)},jh.prototype.unmount=nv.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;cS(s.current,2,null,s,null,null),ch(),a[xi]=null}};function jh(s){this._internalRoot=s}jh.prototype.unstable_scheduleHydration=function(s){if(s){var a=_e();s={blockedOn:null,target:s,priority:a};for(var c=0;c<ya.length&&a!==0&&a<ya[c].priority;c++);ya.splice(c,0,s),c===0&&pS(s)}};var xS=t.version;if(xS!=="19.2.7")throw Error(i(527,xS,"19.2.7"));$.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=f(a),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var lD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ah=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ah.isDisabled&&Ah.supportsFiber)try{ii=Ah.inject(lD),ar=Ah}catch{}}return nu.createRoot=function(s,a){if(!n(s))throw Error(i(299));var c=!1,h="",_=k1,x=R1,R=N1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(R=a.onRecoverableError)),a=oS(s,1,!1,null,null,c,h,null,_,x,R,_S),s[xi]=a.current,$g(s),new nv(a)},nu.hydrateRoot=function(s,a,c){if(!n(s))throw Error(i(299));var h=!1,_="",x=k1,R=R1,O=N1,X=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(R=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(X=c.formState)),a=oS(s,1,!0,a,c??null,h,_,X,x,R,O,_S),a.context=lS(null),c=a.current,h=Pi(),h=pn(h),_=na(h),_.callback=null,aa(c,_,h),c=h,a.current.lanes=c,Mt(a,c),Vs(a),s[xi]=a.current,$g(s),new jh(a)},nu.version="19.2.7",nu}var jS;function yD(){if(jS)return lv.exports;jS=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(),lv.exports=xD(),lv.exports}var bD=yD();/**
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 Jx=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,mE=/^[\\/]{2}/;function wD(e,t){return t+e.replace(/\\/g,"/")}var AS="popstate";function TS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function SD(e={}){function t(i,n){var f;let o=(f=n.state)==null?void 0:f.masked,{pathname:u,search:d,hash:m}=o||i.location;return x_("",{pathname:u,search:d,hash:m},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,n){return typeof n=="string"?n:Iu(n)}return ED(t,r,null,e)}function wr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function gs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function CD(){return Math.random().toString(36).substring(2,10)}function MS(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 x_(e,t,r=null,i,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?sd(t):t,state:r,key:t&&t.key||i||CD(),mask:n}}function Iu({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 sd(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 ED(e,t,r,i={}){let{window:n=document.defaultView,v5Compat:o=!1}=i,u=n.history,d="POP",m=null,f=v();f==null&&(f=0,u.replaceState({...u.state,idx:f},""));function v(){return(u.state||{idx:null}).idx}function p(){d="POP";let E=v(),S=E==null?null:E-f;f=E,m&&m({action:d,location:C.location,delta:S})}function y(E,S){d="PUSH";let k=TS(E)?E:x_(C.location,E,S);f=v()+1;let j=MS(k,f),N=C.createHref(k.mask||k);try{u.pushState(j,"",N)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;n.location.assign(N)}o&&m&&m({action:d,location:C.location,delta:1})}function b(E,S){d="REPLACE";let k=TS(E)?E:x_(C.location,E,S);f=v();let j=MS(k,f),N=C.createHref(k.mask||k);u.replaceState(j,"",N),o&&m&&m({action:d,location:C.location,delta:0})}function w(E){return kD(n,E)}let C={get action(){return d},get location(){return e(n,u)},listen(E){if(m)throw new Error("A history only accepts one active listener");return n.addEventListener(AS,p),m=E,()=>{n.removeEventListener(AS,p),m=null}},createHref(E){return t(n,E)},createURL:w,encodeLocation(E){let S=w(E);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:b,go(E){return u.go(E)}};return C}function kD(e,t,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),wr(i,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:Iu(t);return n=n.replace(/ $/,"%20"),!r&&mE.test(n)&&(n=i+n),new URL(n,i)}function pE(e,t,r="/"){return RD(e,t,r,!1)}function RD(e,t,r,i,n){let o=typeof t=="string"?sd(t):t,u=qn(o.pathname||"/",r);if(u==null)return null;let d=ND(e),m=null,f=ID(u);for(let v=0;m==null&&v<d.length;++v)m=zD(d[v],f,i);return m}function ND(e){let t=gE(e);return jD(t),t}function gE(e,t=[],r=[],i="",n=!1){let o=(u,d,m=n,f)=>{let v={relativePath:f===void 0?u.path||"":f,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(i)&&m)return;wr(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=Ts([i,v.relativePath]),y=r.concat(v);u.children&&u.children.length>0&&(wr(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),gE(u.children,t,y,p,m)),!(u.path==null&&!u.index)&&t.push({path:p,score:BD(p,u.index),routesMeta:y.map((b,w)=>{let[C,E]=xE(b.relativePath,b.caseSensitive,w===y.length-1);return{...b,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 f of vE(u.path))o(u,d,!0,f)}),t}function vE(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(i.length===0)return n?[o,""]:[o];let u=vE(i.join("/")),d=[];return d.push(...u.map(m=>m===""?o:[o,m].join("/"))),n&&d.push(...u),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function jD(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:PD(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var AD=/^:[\w-]+$/,TD=3,MD=2,DD=1,LD=10,OD=-2,DS=e=>e==="*";function BD(e,t){let r=e.split("/"),i=r.length;return r.some(DS)&&(i+=OD),t&&(i+=MD),r.filter(n=>!DS(n)).reduce((n,o)=>n+(AD.test(o)?TD:o===""?DD:LD),i)}function PD(e,t){return e.length===t.length&&e.slice(0,-1).every((i,n)=>i===t[n])?e[e.length-1]-t[t.length-1]:0}function zD(e,t,r=!1){let{routesMeta:i}=e,n={},o="/",u=[];for(let d=0;d<i.length;++d){let m=i[d],f=d===i.length-1,v=o==="/"?t:t.slice(o.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:f},y=m.matcher&&m.compiledParams?_E(p,v,m.matcher,m.compiledParams):Af(p,v),b=m.route;if(!y&&f&&r&&!i[i.length-1].route.index&&(y=Af({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!y)return null;Object.assign(n,y.params),u.push({params:n,pathname:Ts([o,y.pathname]),pathnameBase:HD(Ts([o,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(o=Ts([o,y.pathnameBase]))}return u}function Af(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=xE(e.path,e.caseSensitive,e.end);return _E(e,t,r,i)}function _E(e,t,r,i){let n=t.match(r);if(!n)return null;let o=n[0],u=o.replace(/(.)\/+$/,"$1"),d=n.slice(1);return{params:i.reduce((f,{paramName:v,isOptional:p},y)=>{if(v==="*"){let w=d[y]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=d[y];return p&&!b?f[v]=void 0:f[v]=(b||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:u,pattern:e}}function xE(e,t=!1,r=!0){gs(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=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,f,v)=>{if(i.push({paramName:d,isOptional:m!=null}),m){let p=v.charAt(f+u.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),i]}function ID(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return gs(!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 qn(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 $D(e,t="/"){let{pathname:r,search:i="",hash:n=""}=typeof e=="string"?sd(e):e,o;return r?(r=yE(r),r.startsWith("/")?o=LS(r.substring(1),"/"):o=LS(r,t)):o=t,{pathname:o,search:FD(i),hash:qD(n)}}function LS(e,t){let r=Tf(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function hv(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 UD(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function e0(e){let t=UD(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function im(e,t,r,i=!1){let n;typeof e=="string"?n=sd(e):(n={...e},wr(!n.pathname||!n.pathname.includes("?"),hv("?","pathname","search",n)),wr(!n.pathname||!n.pathname.includes("#"),hv("#","pathname","hash",n)),wr(!n.search||!n.search.includes("#"),hv("#","search","hash",n)));let o=e===""||n.pathname==="",u=o?"/":n.pathname,d;if(u==null)d=r;else{let p=t.length-1;if(!i&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),p-=1;n.pathname=y.join("/")}d=p>=0?t[p]:"/"}let m=$D(n,d),f=u&&u!=="/"&&u.endsWith("/"),v=(o||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||v)&&(m.pathname+="/"),m}var yE=e=>e.replace(/[\\/]{2,}/g,"/"),Ts=e=>yE(e.join("/")),Tf=e=>e.replace(/\/+$/,""),HD=e=>Tf(e).replace(/^\/*/,"/"),FD=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qD=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,WD=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 VD(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function GD(e){let t=e.map(r=>r.route.path).filter(Boolean);return Ts(t)||"/"}var bE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wE(e,t){let r=e;if(typeof r!="string"||!Jx.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,n=!1;if(bE)try{let o=new URL(window.location.href),u=mE.test(r)?new URL(wD(r,o.protocol)):new URL(r),d=qn(u.pathname,t);u.origin===o.origin&&d!=null?r=d+u.search+u.hash:n=!0}catch{gs(!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:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var SE=["POST","PUT","PATCH","DELETE"];new Set(SE);var YD=["GET",...SE];new Set(YD);var KD=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function XD(e){try{return KD.includes(new URL(e).protocol)}catch{return!1}}var ic=g.createContext(null);ic.displayName="DataRouter";var sm=g.createContext(null);sm.displayName="DataRouterState";var CE=g.createContext(!1);function ZD(){return g.useContext(CE)}var EE=g.createContext({isTransitioning:!1});EE.displayName="ViewTransition";var QD=g.createContext(new Map);QD.displayName="Fetchers";var JD=g.createContext(null);JD.displayName="Await";var Fi=g.createContext(null);Fi.displayName="Navigation";var nm=g.createContext(null);nm.displayName="Location";var Ps=g.createContext({outlet:null,matches:[],isDataRoute:!1});Ps.displayName="Route";var t0=g.createContext(null);t0.displayName="RouteError";var kE="REACT_ROUTER_ERROR",eL="REDIRECT",tL="ROUTE_ERROR_RESPONSE";function rL(e){if(e.startsWith(`${kE}:${eL}:{`))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 iL(e){if(e.startsWith(`${kE}:${tL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new WD(t.status,t.statusText,t.data)}catch{}}function sL(e,{relative:t}={}){wr(sc(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=g.useContext(Fi),{hash:n,pathname:o,search:u}=nd(e,{relative:t}),d=o;return r!=="/"&&(d=o==="/"?r:Ts([r,o])),i.createHref({pathname:d,search:u,hash:n})}function sc(){return g.useContext(nm)!=null}function Hr(){return wr(sc(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(nm).location}var RE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function NE(e){g.useContext(Fi).static||g.useLayoutEffect(e)}function Fa(){let{isDataRoute:e}=g.useContext(Ps);return e?vL():nL()}function nL(){wr(sc(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(ic),{basename:t,navigator:r}=g.useContext(Fi),{matches:i}=g.useContext(Ps),{pathname:n}=Hr(),o=JSON.stringify(e0(i)),u=g.useRef(!1);return NE(()=>{u.current=!0}),g.useCallback((m,f={})=>{if(gs(u.current,RE),!u.current)return;if(typeof m=="number"){r.go(m);return}let v=im(m,JSON.parse(o),n,f.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:Ts([t,v.pathname])),(f.replace?r.replace:r.push)(v,f.state,f)},[t,r,o,n,e])}g.createContext(null);function jE(){let{matches:e}=g.useContext(Ps),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function nd(e,{relative:t}={}){let{matches:r}=g.useContext(Ps),{pathname:i}=Hr(),n=JSON.stringify(e0(r));return g.useMemo(()=>im(e,JSON.parse(n),i,t==="path"),[e,n,i,t])}function aL(e,t){return AE(e)}function AE(e,t,r){wr(sc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Fi),{matches:n}=g.useContext(Ps),o=n[n.length-1],u=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",f=o&&o.route;{let E=f&&f.path||"";ME(d,!f||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 y=p.pathname||"/",b=y;if(m!=="/"){let E=m.replace(/^\//,"").split("/");b="/"+y.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})):pE(e,{pathname:b});return gs(f||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),gs(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.`),dL(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:Ts([m,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:Ts([m,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),n,r)}function oL(){let e=gL(),t=VD(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)",n={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:n},r):null,u)}var lL=g.createElement(oL,null),TE=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=iL(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(Ps.Provider,{value:this.props.routeContext},g.createElement(t0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(cL,{error:e},t):t}};TE.contextType=CE;var fv=new WeakMap;function cL({children:e,error:t}){let{basename:r}=g.useContext(Fi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=rL(t.digest);if(i){let n=fv.get(t);if(n)throw n;let o=wE(i.location,r),u=o.absoluteURL||o.to;if(XD(u))throw new Error("Invalid redirect location");if(bE&&!fv.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 fv.set(t,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function uL({routeContext:e,match:t,children:r}){let i=g.useContext(ic);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(Ps.Provider,{value:e},r)}function dL(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 n=e,o=i==null?void 0:i.errors;if(o!=null){let v=n.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);wr(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,v+1))}let u=!1,d=-1;if(r&&i){u=i.renderFallback;for(let v=0;v<n.length;v++){let p=n[v];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=v),p.route.id){let{loaderData:y,errors:b}=i,w=p.route.loader&&!y.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(u=!0),d>=0?n=n.slice(0,d+1):n=[n[0]];break}}}}let m=r==null?void 0:r.onError,f=i&&m?(v,p)=>{var y,b;m(v,{location:i.location,params:((b=(y=i.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:GD(i.matches),errorInfo:p})}:void 0;return n.reduceRight((v,p,y)=>{let b,w=!1,C=null,E=null;i&&(b=o&&p.route.id?o[p.route.id]:void 0,C=p.route.errorElement||lL,u&&(d<0&&y===0?(ME("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===y&&(w=!0,E=p.route.hydrateFallbackElement||null)));let S=t.concat(n.slice(0,y+1)),k=()=>{let j;return b?j=C:w?j=E:p.route.Component?j=g.createElement(p.route.Component,null):p.route.element?j=p.route.element:j=v,g.createElement(uL,{match:p,routeContext:{outlet:v,matches:S,isDataRoute:i!=null},children:j})};return i&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?g.createElement(TE,{location:i.location,revalidation:i.revalidation,component:C,error:b,children:k(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:f}):k()},null)}function r0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hL(e){let t=g.useContext(ic);return wr(t,r0(e)),t}function fL(e){let t=g.useContext(sm);return wr(t,r0(e)),t}function mL(e){let t=g.useContext(Ps);return wr(t,r0(e)),t}function i0(e){let t=mL(e),r=t.matches[t.matches.length-1];return wr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function pL(){return i0("useRouteId")}function gL(){var i;let e=g.useContext(t0),t=fL("useRouteError"),r=i0("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function vL(){let{router:e}=hL("useNavigate"),t=i0("useNavigate"),r=g.useRef(!1);return NE(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{gs(r.current,RE),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var OS={};function ME(e,t,r){!t&&!OS[e]&&(OS[e]=!0,gs(!1,r))}g.memo(_L);function _L({routes:e,manifest:t,future:r,state:i,isStatic:n,onError:o}){return AE(e,void 0,{manifest:t,state:i,isStatic:n,onError:o})}function Ta({to:e,replace:t,state:r,relative:i}){wr(sc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n}=g.useContext(Fi);gs(!n,"<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(Ps),{pathname:u}=Hr(),d=Fa(),m=im(e,e0(o),u,i==="path"),f=JSON.stringify(m);return g.useEffect(()=>{d(JSON.parse(f),{replace:t,state:r,relative:i})},[d,f,i,t,r]),null}function xL({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:n,static:o=!1,useTransitions:u}){wr(!sc(),"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:n,static:o,useTransitions:u,future:{}}),[d,n,o,u]);typeof r=="string"&&(r=sd(r));let{pathname:f="/",search:v="",hash:p="",state:y=null,key:b="default",mask:w}=r,C=g.useMemo(()=>{let E=qn(f,d);return E==null?null:{location:{pathname:E,search:v,hash:p,state:y,key:b,mask:w},navigationType:i}},[d,f,v,p,y,b,i,w]);return gs(C!=null,`<Router basename="${d}"> is not able to match the URL "${f}${v}${p}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:g.createElement(Fi.Provider,{value:m},g.createElement(nm.Provider,{children:t,value:C}))}var lf="get",cf="application/x-www-form-urlencoded";function am(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function yL(e){return am(e)&&e.tagName.toLowerCase()==="button"}function bL(e){return am(e)&&e.tagName.toLowerCase()==="form"}function wL(e){return am(e)&&e.tagName.toLowerCase()==="input"}function SL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CL(e,t){return e.button===0&&(!t||t==="_self")&&!SL(e)}function y_(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(n=>[r,n]):[[r,i]])},[]))}function EL(e,t){let r=y_(e);return t&&t.forEach((i,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var Th=null;function kL(){if(Th===null)try{new FormData(document.createElement("form"),0),Th=!1}catch{Th=!0}return Th}var RL=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mv(e){return e!=null&&!RL.has(e)?(gs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cf}"`),null):e}function NL(e,t){let r,i,n,o,u;if(bL(e)){let d=e.getAttribute("action");i=d?qn(d,t):null,r=e.getAttribute("method")||lf,n=mv(e.getAttribute("enctype"))||cf,o=new FormData(e)}else if(yL(e)||wL(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?qn(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||lf,n=mv(e.getAttribute("formenctype"))||mv(d.getAttribute("enctype"))||cf,o=new FormData(d,e),!kL()){let{name:f,type:v,value:p}=e;if(v==="image"){let y=f?`${f}.`:"";o.append(`${y}x`,"0"),o.append(`${y}y`,"0")}else f&&o.append(f,p)}}else{if(am(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=lf,i=null,n=cf,u=e}return o&&n==="text/plain"&&(u=o,o=void 0),{action:i,method:r.toLowerCase(),encType:n,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function s0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function DE(e,t,r,i){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${i}`:n.pathname=`${n.pathname}.${i}`:n.pathname==="/"?n.pathname=`_root.${i}`:t&&qn(n.pathname,t)==="/"?n.pathname=`${Tf(t)}/_root.${i}`:n.pathname=`${Tf(n.pathname)}.${i}`,n}async function jL(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 AL(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 TL(e,t,r){let i=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let u=await jL(o,r);return u.links?u.links():[]}return[]}));return OL(i.flat(1).filter(AL).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function BS(e,t,r,i,n,o){let u=(m,f)=>r[f]?m.route.id!==r[f].route.id:!0,d=(m,f)=>{var v;return r[f].pathname!==m.pathname||((v=r[f].route.path)==null?void 0:v.endsWith("*"))&&r[f].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,f)=>u(m,f)||d(m,f)):o==="data"?t.filter((m,f)=>{var p;let v=i.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,f)||d(m,f))return!0;if(m.route.shouldRevalidate){let y=m.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.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 y=="boolean")return y}return!0}):[]}function ML(e,t,{includeHydrateFallback:r}={}){return DL(e.map(i=>{let n=t.routes[i.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function DL(e){return[...new Set(e)]}function LL(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function OL(e,t){let r=new Set;return new Set(t),e.reduce((i,n)=>{let o=JSON.stringify(LL(n));return r.has(o)||(r.add(o),i.push({key:o,link:n})),i},[])}function n0(){let e=g.useContext(ic);return s0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function BL(){let e=g.useContext(sm);return s0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var a0=g.createContext(void 0);a0.displayName="FrameworkContext";function om(){let e=g.useContext(a0);return s0(e,"You must render this element inside a <HydratedRouter> element"),e}function PL(e,t){let r=g.useContext(a0),[i,n]=g.useState(!1),[o,u]=g.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:f,onMouseLeave:v,onTouchStart:p}=t,y=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=S=>{S.forEach(k=>{u(k.isIntersecting)})},E=new IntersectionObserver(C,{threshold:.5});return y.current&&E.observe(y.current),()=>{E.disconnect()}}},[e]),g.useEffect(()=>{if(i){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[i]);let b=()=>{n(!0)},w=()=>{n(!1),u(!1)};return r?e!=="intent"?[o,y,{}]:[o,y,{onFocus:au(d,b),onBlur:au(m,w),onMouseEnter:au(f,b),onMouseLeave:au(v,w),onTouchStart:au(p,b)}]:[!1,y,{}]}function au(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function zL({page:e,...t}){let r=ZD(),{nonce:i}=om(),{router:n}=n0(),o=g.useMemo(()=>pE(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?g.createElement($L,{page:e,matches:o,...t}):g.createElement(UL,{page:e,matches:o,...t})):null}function IL(e){let{manifest:t,routeModules:r}=om(),[i,n]=g.useState([]);return g.useEffect(()=>{let o=!1;return TL(e,t,r).then(u=>{o||n(u)}),()=>{o=!0}},[e,t,r]),i}function $L({page:e,matches:t,...r}){let i=Hr(),{future:n}=om(),{basename:o}=n0(),u=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=DE(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,f=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?m=!0:f.push(v.route.id);return m&&f.length>0&&d.searchParams.set("_routes",f.join(",")),[d.pathname+d.search]},[o,n.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 UL({page:e,matches:t,...r}){let i=Hr(),{future:n,manifest:o,routeModules:u}=om(),{basename:d}=n0(),{loaderData:m,matches:f}=BL(),v=g.useMemo(()=>BS(e,t,f,o,i,"data"),[e,t,f,o,i]),p=g.useMemo(()=>BS(e,t,f,o,i,"assets"),[e,t,f,o,i]),y=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,E=!1;if(t.forEach(k=>{var N;let j=o.routes[k.route.id];!j||!j.hasLoader||(!v.some(M=>M.route.id===k.route.id)&&k.route.id in m&&((N=u[k.route.id])!=null&&N.shouldRevalidate)||j.hasClientLoader?E=!0:C.add(k.route.id))}),C.size===0)return[];let S=DE(e,d,n.v8_trailingSlashAwareDataRequests,"data");return E&&C.size>0&&S.searchParams.set("_routes",t.filter(k=>C.has(k.route.id)).map(k=>k.route.id).join(",")),[S.pathname+S.search]},[d,n.v8_trailingSlashAwareDataRequests,m,i,o,v,t,e,u]),b=g.useMemo(()=>ML(p,o),[p,o]),w=IL(p);return g.createElement(g.Fragment,null,y.map(C=>g.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),b.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 HL(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var FL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{FL&&(window.__reactRouterVersion="7.18.1")}catch{}function qL({basename:e,children:t,useTransitions:r,window:i}){let n=g.useRef();n.current==null&&(n.current=SD({window:i,v5Compat:!0}));let o=n.current,[u,d]=g.useState({action:o.action,location:o.location}),m=g.useCallback(f=>{r===!1?d(f):g.startTransition(()=>d(f))},[r]);return g.useLayoutEffect(()=>o.listen(m),[o,m]),g.createElement(xL,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:r})}var LE=g.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:n,reloadDocument:o,replace:u,mask:d,state:m,target:f,to:v,preventScrollReset:p,viewTransition:y,defaultShouldRevalidate:b,...w},C){let{basename:E,navigator:S,useTransitions:k}=g.useContext(Fi),j=typeof v=="string"&&Jx.test(v),N=wE(v,E);v=N.to;let M=sL(v,{relative:n}),D=Hr(),H=null;if(d){let I=im(d,[],D.mask?D.mask.pathname:"/",!0);E!=="/"&&(I.pathname=I.pathname==="/"?E:Ts([E,I.pathname])),H=S.createHref(I)}let[L,G,Z]=PL(i,w),q=GL(v,{replace:u,mask:d,state:m,target:f,preventScrollReset:p,relative:n,viewTransition:y,defaultShouldRevalidate:b,useTransitions:k});function P(I){t&&t(I),I.defaultPrevented||q(I)}let B=!(N.isExternal||o),z=g.createElement("a",{...w,...Z,href:(B?H:void 0)||N.absoluteURL||M,onClick:B?P:t,ref:HL(C,G),target:f,"data-discover":!j&&r==="render"?"true":void 0});return L&&!j?g.createElement(g.Fragment,null,z,g.createElement(zL,{page:M})):z});LE.displayName="Link";var Da=g.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:n=!1,style:o,to:u,viewTransition:d,children:m,...f},v){let p=nd(u,{relative:f.relative}),y=Hr(),b=g.useContext(sm),{navigator:w,basename:C}=g.useContext(Fi),E=b!=null&&JL(p)&&d===!0,S=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,k=y.pathname,j=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;r||(k=k.toLowerCase(),j=j?j.toLowerCase():null,S=S.toLowerCase()),j&&C&&(j=qn(j,C)||j);const N=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=k===S||!n&&k.startsWith(S)&&k.charAt(N)==="/",D=j!=null&&(j===S||!n&&j.startsWith(S)&&j.charAt(S.length)==="/"),H={isActive:M,isPending:D,isTransitioning:E},L=M?t:void 0,G;typeof i=="function"?G=i(H):G=[i,M?"active":null,D?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let Z=typeof o=="function"?o(H):o;return g.createElement(LE,{...f,"aria-current":L,className:G,ref:v,style:Z,to:u,viewTransition:d},typeof m=="function"?m(H):m)});Da.displayName="NavLink";var WL=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:n,state:o,method:u=lf,action:d,onSubmit:m,relative:f,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:y,...b},w)=>{let{useTransitions:C}=g.useContext(Fi),E=ZL(),S=QL(d,{relative:f}),k=u.toLowerCase()==="get"?"get":"post",j=typeof d=="string"&&Jx.test(d),N=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let D=M.nativeEvent.submitter,H=(D==null?void 0:D.getAttribute("formmethod"))||u,L=()=>E(D||M.currentTarget,{fetcherKey:t,method:H,navigate:r,replace:n,state:o,relative:f,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:y});C&&r!==!1?g.startTransition(()=>L()):L()};return g.createElement("form",{ref:w,method:k,action:S,onSubmit:i?m:N,...b,"data-discover":!j&&e==="render"?"true":void 0})});WL.displayName="Form";function VL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OE(e){let t=g.useContext(ic);return wr(t,VL(e)),t}function GL(e,{target:t,replace:r,mask:i,state:n,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:f}={}){let v=Fa(),p=Hr(),y=nd(e,{relative:u});return g.useCallback(b=>{if(CL(b,t)){b.preventDefault();let w=r!==void 0?r:Iu(p)===Iu(y),C=()=>v(e,{replace:w,mask:i,state:n,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m});f?g.startTransition(()=>C()):C()}},[p,v,y,r,i,n,t,e,o,u,d,m,f])}function YL(e){gs(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(y_(e)),r=g.useRef(!1),i=Hr(),n=g.useMemo(()=>EL(i.search,r.current?null:t.current),[i.search]),o=Fa(),u=g.useCallback((d,m)=>{const f=y_(typeof d=="function"?d(new URLSearchParams(n)):d);r.current=!0,o("?"+f,m)},[o,n]);return[n,u]}var KL=0,XL=()=>`__${String(++KL)}__`;function ZL(){let{router:e}=OE("useSubmit"),{basename:t}=g.useContext(Fi),r=pL(),i=e.fetch,n=e.navigate;return g.useCallback(async(o,u={})=>{let{action:d,method:m,encType:f,formData:v,body:p}=NL(o,t);if(u.navigate===!1){let y=u.fetcherKey||XL();await i(y,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||f,flushSync:u.flushSync})}else await n(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||f,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,n,t,r])}function QL(e,{relative:t}={}){let{basename:r}=g.useContext(Fi),i=g.useContext(Ps);wr(i,"useFormAction must be used inside a RouteContext");let[n]=i.matches.slice(-1),o={...nd(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===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Ts([r,o.pathname])),Iu(o)}function JL(e,{relative:t}={}){let r=g.useContext(EE);wr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=OE("useViewTransitionState"),n=nd(e,{relative:t});if(!r.isTransitioning)return!1;let o=qn(r.currentLocation.pathname,i)||r.currentLocation.pathname,u=qn(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Af(n.pathname,u)!=null||Af(n.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 e4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BE=(...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 t4={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 r4=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:n="",children:o,iconNode:u,...d},m)=>g.createElement("svg",{ref:m,...t4,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:BE("lucide",n),...d},[...u.map(([f,v])=>g.createElement(f,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 ye=(e,t)=>{const r=g.forwardRef(({className:i,...n},o)=>g.createElement(r4,{ref:o,iconNode:t,className:BE(`lucide-${e4(e)}`,i),...n}));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 i4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jo=ye("ArrowLeft",i4);/**
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 s4=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],PE=ye("ArrowRight",s4);/**
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 n4=[["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"}]],o0=ye("Bot",n4);/**
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 a4=[["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"}]],o4=ye("Cable",a4);/**
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 l4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zs=ye("Check",l4);/**
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 c4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],l0=ye("ChevronDown",c4);/**
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 u4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],zE=ye("ChevronLeft",u4);/**
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 d4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Po=ye("ChevronRight",d4);/**
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 h4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],f4=ye("ChevronUp",h4);/**
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 m4=[["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"}]],nc=ye("CircleAlert",m4);/**
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 p4=[["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"}]],Ou=ye("CircleArrowUp",p4);/**
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 g4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c0=ye("CircleCheck",g4);/**
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 v4=[["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"}]],_4=ye("CircleHelp",v4);/**
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 x4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],y4=ye("CircleSlash",x4);/**
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 b4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],w4=ye("CircleStop",b4);/**
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 S4=[["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"}]],C4=ye("CircleX",S4);/**
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 E4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],k4=ye("Circle",E4);/**
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 R4=[["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"}]],u0=ye("Command",R4);/**
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 N4=[["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"}]],d0=ye("Copy",N4);/**
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 j4=[["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"}]],ad=ye("Download",j4);/**
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 A4=[["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"}]],$u=ye("Earth",A4);/**
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 T4=[["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"}]],M4=ye("Ellipsis",T4);/**
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 D4=[["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"}]],L4=ye("Eraser",D4);/**
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 O4=[["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"}]],B4=ye("Expand",O4);/**
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 P4=[["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"}]],b_=ye("ExternalLink",P4);/**
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 z4=[["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"}]],I4=ye("FileText",z4);/**
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 $4=[["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"}]],U4=ye("Fingerprint",$4);/**
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 H4=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],F4=ye("FolderKanban",H4);/**
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 q4=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],w_=ye("FolderOpen",q4);/**
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 W4=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],PS=ye("FolderPlus",W4);/**
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 V4=[["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"}]],Uu=ye("Folder",V4);/**
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 G4=[["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"}]],Y4=ye("GitBranch",G4);/**
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 K4=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],X4=ye("GitFork",K4);/**
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 Z4=[["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"}]],IE=ye("House",Z4);/**
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 Q4=[["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"}]],J4=ye("ImageOff",Q4);/**
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 eO=[["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"}]],tO=ye("Image",eO);/**
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 rO=[["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"}]],iO=ye("KeyRound",rO);/**
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 sO=[["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"}]],$E=ye("Laptop",sO);/**
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 nO=[["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"}]],aO=ye("LayoutDashboard",nO);/**
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 oO=[["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"}]],lO=ye("Link2",oO);/**
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 cO=[["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"}]],uO=ye("ListChecks",cO);/**
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 dO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$e=ye("LoaderCircle",dO);/**
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 hO=[["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"}]],fO=ye("MapPin",hO);/**
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 mO=[["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"}]],pO=ye("MessageSquare",mO);/**
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 gO=[["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"}]],S_=ye("MonitorSmartphone",gO);/**
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 vO=[["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"}]],_O=ye("MonitorUp",vO);/**
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 xO=[["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"}]],UE=ye("Monitor",xO);/**
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 yO=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],bO=ye("Moon",yO);/**
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 wO=[["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"}]],SO=ye("MousePointerBan",wO);/**
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 CO=[["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"}]],EO=ye("MousePointerClick",CO);/**
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 kO=[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]],zS=ye("PackageSearch",kO);/**
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 RO=[["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"}]],NO=ye("PanelLeftClose",RO);/**
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 jO=[["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"}]],HE=ye("PanelLeftOpen",jO);/**
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 AO=[["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"}]],TO=ye("PanelRightClose",AO);/**
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 MO=[["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"}]],DO=ye("PanelRightOpen",MO);/**
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 LO=[["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"}]],OO=ye("Paperclip",LO);/**
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 BO=[["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"}]],FE=ye("Pencil",BO);/**
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 PO=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],zO=ye("Play",PO);/**
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 IO=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ri=ye("Plus",IO);/**
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 $O=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],C_=ye("Power",$O);/**
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 UO=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],lm=ye("Puzzle",UO);/**
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 HO=[["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"}]],Et=ye("RefreshCw",HO);/**
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 FO=[["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"}]],qO=ye("RotateCw",FO);/**
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 WO=[["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"}]],VO=ye("ScanEye",WO);/**
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 GO=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],qE=ye("Search",GO);/**
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 YO=[["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"}]],WE=ye("Send",YO);/**
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 KO=[["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"}]],cm=ye("Server",KO);/**
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 XO=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ZO=ye("Settings2",XO);/**
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 QO=[["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"}]],JO=ye("Settings",QO);/**
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 e6=[["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"}]],t6=ye("Share2",e6);/**
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 r6=[["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"}]],i6=ye("ShieldAlert",r6);/**
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 s6=[["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"}]],Mf=ye("ShieldCheck",s6);/**
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 n6=[["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"}]],h0=ye("ShieldOff",n6);/**
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 a6=[["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"}]],o6=ye("Shrink",a6);/**
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 l6=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Xl=ye("Smartphone",l6);/**
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 c6=[["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"}]],VE=ye("Sparkles",c6);/**
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 u6=[["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"}]],GE=ye("SquareTerminal",u6);/**
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 d6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],h6=ye("Square",d6);/**
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 f6=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],YE=ye("Star",f6);/**
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 m6=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],Df=ye("Store",m6);/**
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 p6=[["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"}]],g6=ye("Sun",p6);/**
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 v6=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],_6=ye("Terminal",v6);/**
491
+ * @license lucide-react v0.475.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const x6=[["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"}]],qa=ye("Trash2",x6);/**
496
+ * @license lucide-react v0.475.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const y6=[["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"}]],Ms=ye("TriangleAlert",y6);/**
501
+ * @license lucide-react v0.475.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const b6=[["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"}]],w6=ye("Unlink",b6);/**
506
+ * @license lucide-react v0.475.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const S6=[["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"}]],C6=ye("Workflow",S6);/**
511
+ * @license lucide-react v0.475.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const E6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],cn=ye("X",E6);var Wa=fE();const k6=hE(Wa);function R6(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 N6=e=>{switch(e){case"success":return T6;case"info":return D6;case"warning":return M6;case"error":return L6;default:return null}},j6=Array(12).fill(0),A6=({visible:e,className:t})=>we.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},we.createElement("div",{className:"sonner-spinner"},j6.map((r,i)=>we.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),T6=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),M6=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},we.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=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),L6=we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},we.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"})),O6=we.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"},we.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),we.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),B6=()=>{const[e,t]=we.useState(document.hidden);return we.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let E_=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,...n}=t,o=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:E_++,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,...n,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 n=Promise.resolve(t instanceof Function?t():t);let o=i!==void 0,u;const d=n.then(async f=>{if(u=["resolve",f],we.isValidElement(f))o=!1,this.create({id:i,type:"default",message:f});else if(I6(f)&&!f.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${f.status}`):r.error,y=typeof r.description=="function"?await r.description(`HTTP error! status: ${f.status}`):r.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:y,...w})}else if(f instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(f):r.error,y=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:y,...w})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(f):r.success,y=typeof r.description=="function"?await r.description(f):r.description,w=typeof p=="object"&&!we.isValidElement(p)?p:{message:p};this.create({id:i,type:"success",description:y,...w})}}).catch(async f=>{if(u=["reject",f],r.error!==void 0){o=!1;const v=typeof r.error=="function"?await r.error(f):r.error,p=typeof r.description=="function"?await r.description(f):r.description,b=typeof v=="object"&&!we.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:p,...b})}}).finally(()=>{o&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((f,v)=>d.then(()=>u[0]==="reject"?v(u[1]):f(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)||E_++;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 Ni=new P6,z6=(e,t)=>{const r=(t==null?void 0:t.id)||E_++;return Ni.addToast({title:e,...t,id:r}),r},I6=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",$6=z6,U6=()=>Ni.toasts,H6=()=>Ni.getActiveToasts(),ve=Object.assign($6,{success:Ni.success,info:Ni.info,warning:Ni.warning,error:Ni.error,custom:Ni.custom,message:Ni.message,promise:Ni.promise,dismiss:Ni.dismiss,loading:Ni.loading},{getHistory:U6,getToasts:H6});R6("[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 F6=3,q6="24px",W6="16px",IS=4e3,V6=356,G6=14,Y6=45,K6=200;function Gs(...e){return e.filter(Boolean).join(" ")}function X6(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const Z6=e=>{var t,r,i,n,o,u,d,m,f;const{invert:v,toast:p,unstyled:y,interacting:b,setHeights:w,visibleToasts:C,heights:E,index:S,toasts:k,expanded:j,removeToast:N,defaultRichColors:M,closeButton:D,style:H,cancelButtonStyle:L,actionButtonStyle:G,className:Z="",descriptionClassName:q="",duration:P,position:B,gap:z,expandByDefault:I,classNames:A,icons:$,closeButtonAriaLabel:U="Close toast"}=e,[F,W]=we.useState(null),[T,V]=we.useState(null),[K,J]=we.useState(!1),[oe,ce]=we.useState(!1),[Y,ne]=we.useState(!1),[de,Ae]=we.useState(!1),[ke,Ee]=we.useState(!1),[re,te]=we.useState(0),[Ce,me]=we.useState(0),je=we.useRef(p.duration||P||IS),We=we.useRef(null),Te=we.useRef(null),ze=S===0,Se=S+1<=C,Ue=p.type,Gt=p.dismissible!==!1,wt=p.className||"",Re=p.descriptionClassName||"",Ve=we.useMemo(()=>E.findIndex(He=>He.toastId===p.id)||0,[E,p.id]),gt=we.useMemo(()=>{var He;return(He=p.closeButton)!=null?He:D},[p.closeButton,D]),mt=we.useMemo(()=>p.duration||P||IS,[p.duration,P]),kt=we.useRef(0),ut=we.useRef(0),nr=we.useRef(0),qr=we.useRef(null),[ii,ar]=B.split("-"),St=we.useMemo(()=>E.reduce((He,Tt,Ct)=>Ct>=Ve?He:He+Tt.height,0),[E,Ve]),or=B6(),Ar=p.invert||v,Ai=Ue==="loading";ut.current=we.useMemo(()=>Ve*z+St,[Ve,St]),we.useEffect(()=>{je.current=mt},[mt]),we.useEffect(()=>{J(!0)},[]),we.useEffect(()=>{const He=Te.current;if(He){const Tt=He.getBoundingClientRect().height;return me(Tt),w(Ct=>[{toastId:p.id,height:Tt,position:p.position},...Ct]),()=>w(Ct=>Ct.filter(It=>It.toastId!==p.id))}},[w,p.id]),we.useLayoutEffect(()=>{if(!K)return;const He=Te.current,Tt=He.style.height;He.style.height="auto";const Ct=He.getBoundingClientRect().height;He.style.height=Tt,me(Ct),w(It=>It.find(Mt=>Mt.toastId===p.id)?It.map(Mt=>Mt.toastId===p.id?{...Mt,height:Ct}:Mt):[{toastId:p.id,height:Ct,position:p.position},...It])},[K,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const yt=we.useCallback(()=>{ce(!0),te(ut.current),w(He=>He.filter(Tt=>Tt.toastId!==p.id)),setTimeout(()=>{N(p)},K6)},[p,N,w,ut]);we.useEffect(()=>{if(p.promise&&Ue==="loading"||p.duration===1/0||p.type==="loading")return;let He;return j||b||or?(()=>{if(nr.current<kt.current){const It=new Date().getTime()-kt.current;je.current=je.current-It}nr.current=new Date().getTime()})():(()=>{je.current!==1/0&&(kt.current=new Date().getTime(),He=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),yt()},je.current))})(),()=>clearTimeout(He)},[j,b,p,Ue,or,yt]),we.useEffect(()=>{p.delete&&(yt(),p.onDismiss==null||p.onDismiss.call(p,p))},[yt,p.delete]);function lr(){var He;if($!=null&&$.loading){var Tt;return we.createElement("div",{className:Gs(A==null?void 0:A.loader,p==null||(Tt=p.classNames)==null?void 0:Tt.loader,"sonner-loader"),"data-visible":Ue==="loading"},$.loading)}return we.createElement(A6,{className:Gs(A==null?void 0:A.loader,p==null||(He=p.classNames)==null?void 0:He.loader),visible:Ue==="loading"})}const ci=p.icon||($==null?void 0:$[Ue])||N6(Ue);var Yi,mr;return we.createElement("li",{tabIndex:0,ref:Te,className:Gs(Z,wt,A==null?void 0:A.toast,p==null||(t=p.classNames)==null?void 0:t.toast,A==null?void 0:A.default,A==null?void 0:A[Ue],p==null||(r=p.classNames)==null?void 0:r[Ue]),"data-sonner-toast":"","data-rich-colors":(Yi=p.richColors)!=null?Yi:M,"data-styled":!(p.jsx||p.unstyled||y),"data-mounted":K,"data-promise":!!p.promise,"data-swiped":ke,"data-removed":oe,"data-visible":Se,"data-y-position":ii,"data-x-position":ar,"data-index":S,"data-front":ze,"data-swiping":Y,"data-dismissible":Gt,"data-type":Ue,"data-invert":Ar,"data-swipe-out":de,"data-swipe-direction":T,"data-expanded":!!(j||I&&K),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":k.length-S,"--offset":`${oe?re:ut.current}px`,"--initial-height":I?"auto":`${Ce}px`,...H,...p.style},onDragEnd:()=>{ne(!1),W(null),qr.current=null},onPointerDown:He=>{He.button!==2&&(Ai||!Gt||(We.current=new Date,te(ut.current),He.target.setPointerCapture(He.pointerId),He.target.tagName!=="BUTTON"&&(ne(!0),qr.current={x:He.clientX,y:He.clientY})))},onPointerUp:()=>{var He,Tt,Ct;if(de||!Gt)return;qr.current=null;const It=Number(((He=Te.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Rt=Number(((Tt=Te.current)==null?void 0:Tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Mt=new Date().getTime()-((Ct=We.current)==null?void 0:Ct.getTime()),cr=F==="x"?It:Rt,Ki=Math.abs(cr)/Mt;if(Math.abs(cr)>=Y6||Ki>.11){te(ut.current),p.onDismiss==null||p.onDismiss.call(p,p),V(F==="x"?It>0?"right":"left":Rt>0?"down":"up"),yt(),Ae(!0);return}else{var Wr,Vr;(Wr=Te.current)==null||Wr.style.setProperty("--swipe-amount-x","0px"),(Vr=Te.current)==null||Vr.style.setProperty("--swipe-amount-y","0px")}Ee(!1),ne(!1),W(null)},onPointerMove:He=>{var Tt,Ct,It;if(!qr.current||!Gt||((Tt=window.getSelection())==null?void 0:Tt.toString().length)>0)return;const Mt=He.clientY-qr.current.y,cr=He.clientX-qr.current.x;var Ki;const Wr=(Ki=e.swipeDirections)!=null?Ki:X6(B);!F&&(Math.abs(cr)>1||Math.abs(Mt)>1)&&W(Math.abs(cr)>Math.abs(Mt)?"x":"y");let Vr={x:0,y:0};const pn=_i=>1/(1.5+Math.abs(_i)/20);if(F==="y"){if(Wr.includes("top")||Wr.includes("bottom"))if(Wr.includes("top")&&Mt<0||Wr.includes("bottom")&&Mt>0)Vr.y=Mt;else{const _i=Mt*pn(Mt);Vr.y=Math.abs(_i)<Math.abs(Mt)?_i:Mt}}else if(F==="x"&&(Wr.includes("left")||Wr.includes("right")))if(Wr.includes("left")&&cr<0||Wr.includes("right")&&cr>0)Vr.x=cr;else{const _i=cr*pn(cr);Vr.x=Math.abs(_i)<Math.abs(cr)?_i:cr}(Math.abs(Vr.x)>0||Math.abs(Vr.y)>0)&&Ee(!0),(Ct=Te.current)==null||Ct.style.setProperty("--swipe-amount-x",`${Vr.x}px`),(It=Te.current)==null||It.style.setProperty("--swipe-amount-y",`${Vr.y}px`)}},gt&&!p.jsx&&Ue!=="loading"?we.createElement("button",{"aria-label":U,"data-disabled":Ai,"data-close-button":!0,onClick:Ai||!Gt?()=>{}:()=>{yt(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Gs(A==null?void 0:A.closeButton,p==null||(i=p.classNames)==null?void 0:i.closeButton)},(mr=$==null?void 0:$.close)!=null?mr:O6):null,(Ue||p.icon||p.promise)&&p.icon!==null&&(($==null?void 0:$[Ue])!==null||p.icon)?we.createElement("div",{"data-icon":"",className:Gs(A==null?void 0:A.icon,p==null||(n=p.classNames)==null?void 0:n.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||lr():null,p.type!=="loading"?ci:null):null,we.createElement("div",{"data-content":"",className:Gs(A==null?void 0:A.content,p==null||(o=p.classNames)==null?void 0:o.content)},we.createElement("div",{"data-title":"",className:Gs(A==null?void 0:A.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?we.createElement("div",{"data-description":"",className:Gs(q,Re,A==null?void 0:A.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),we.isValidElement(p.cancel)?p.cancel:p.cancel&&Mh(p.cancel)?we.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||L,onClick:He=>{Mh(p.cancel)&&Gt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,He),yt())},className:Gs(A==null?void 0:A.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,we.isValidElement(p.action)?p.action:p.action&&Mh(p.action)?we.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||G,onClick:He=>{Mh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,He),!He.defaultPrevented&&yt())},className:Gs(A==null?void 0:A.actionButton,p==null||(f=p.classNames)==null?void 0:f.actionButton)},p.action.label):null)};function $S(){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 Q6(e,t){const r={};return[e,t].forEach((i,n)=>{const o=n===1,u=o?"--mobile-offset":"--offset",d=o?W6:q6;function m(f){["top","right","bottom","left"].forEach(v=>{r[`${u}-${v}`]=typeof f=="number"?`${f}px`:f})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(f=>{i[f]===void 0?r[`${u}-${f}`]=d:r[`${u}-${f}`]=typeof i[f]=="number"?`${i[f]}px`:i[f]}):m(d)}),r}const J6=we.forwardRef(function(t,r){const{id:i,invert:n,position:o="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:f,offset:v,mobileOffset:p,theme:y="light",richColors:b,duration:w,style:C,visibleToasts:E=F6,toastOptions:S,dir:k=$S(),gap:j=G6,icons:N,containerAriaLabel:M="Notifications"}=t,[D,H]=we.useState([]),L=we.useMemo(()=>i?D.filter(K=>K.toasterId===i):D.filter(K=>!K.toasterId),[D,i]),G=we.useMemo(()=>Array.from(new Set([o].concat(L.filter(K=>K.position).map(K=>K.position)))),[L,o]),[Z,q]=we.useState([]),[P,B]=we.useState(!1),[z,I]=we.useState(!1),[A,$]=we.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),U=we.useRef(null),F=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=we.useRef(null),T=we.useRef(!1),V=we.useCallback(K=>{H(J=>{var oe;return(oe=J.find(ce=>ce.id===K.id))!=null&&oe.delete||Ni.dismiss(K.id),J.filter(({id:ce})=>ce!==K.id)})},[]);return we.useEffect(()=>Ni.subscribe(K=>{if(K.dismiss){requestAnimationFrame(()=>{H(J=>J.map(oe=>oe.id===K.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{k6.flushSync(()=>{H(J=>{const oe=J.findIndex(ce=>ce.id===K.id);return oe!==-1?[...J.slice(0,oe),{...J[oe],...K},...J.slice(oe+1)]:[K,...J]})})})}),[D]),we.useEffect(()=>{if(y!=="system"){$(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),typeof window>"u")return;const K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:J})=>{$(J?"dark":"light")})}catch{K.addListener(({matches:oe})=>{try{$(oe?"dark":"light")}catch(ce){console.error(ce)}})}},[y]),we.useEffect(()=>{D.length<=1&&B(!1)},[D]),we.useEffect(()=>{const K=J=>{var oe;if(u.every(ne=>J[ne]||J.code===ne)){var Y;B(!0),(Y=U.current)==null||Y.focus()}J.code==="Escape"&&(document.activeElement===U.current||(oe=U.current)!=null&&oe.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[u]),we.useEffect(()=>{if(U.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,T.current=!1)}},[U.current]),we.createElement("section",{ref:r,"aria-label":`${M} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},G.map((K,J)=>{var oe;const[ce,Y]=K.split("-");return L.length?we.createElement("ol",{key:K,dir:k==="auto"?$S():k,tabIndex:-1,ref:U,className:f,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":ce,"data-x-position":Y,style:{"--front-toast-height":`${((oe=Z[0])==null?void 0:oe.height)||0}px`,"--width":`${V6}px`,"--gap":`${j}px`,...C,...Q6(v,p)},onBlur:ne=>{T.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(T.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||T.current||(T.current=!0,W.current=ne.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{z||B(!1)},onDragEnd:()=>B(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},L.filter(ne=>!ne.position&&J===0||ne.position===K).map((ne,de)=>{var Ae,ke;return we.createElement(Z6,{key:ne.id,icons:N,index:de,toast:ne,defaultRichColors:b,duration:(Ae=S==null?void 0:S.duration)!=null?Ae:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:n,visibleToasts:E,closeButton:(ke=S==null?void 0:S.closeButton)!=null?ke:m,interacting:z,position:K,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:V,toasts:L.filter(Ee=>Ee.position==ne.position),heights:Z.filter(Ee=>Ee.position==ne.position),setHeights:q,expandByDefault:d,gap:j,expanded:P,swipeDirections:t.swipeDirections})})):null}))});function Is(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 f=p=>{var S;const{scope:y,children:b,...w}=p,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})};f.displayName=o+"Provider";function v(p,y,b={}){var S;const{optional:w=!1}=b,C=((S=y==null?void 0:y[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[f,v]}const n=()=>{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 n.scopeName=e,[i,eB(n,...t)]}function eB(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(o){const u=i.reduce((d,{useScope:m,scopeName:f})=>{const p=m(o)[`__scope${f}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function US(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function tB(...e){return t=>{let r=!1;const i=e.map(n=>{const o=US(n,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n<i.length;n++){const o=i[n];typeof o=="function"?o():US(e[n],null)}}}}function nt(...e){return g.useCallback(tB(...e),e)}function Pe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)}}var rr=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},rB=Ha[" useId ".trim().toString()]||(()=>{}),iB=0;function Ds(e){const[t,r]=g.useState(rB());return rr(()=>{r(i=>i??String(iB++))},[e]),t?`radix-${t}`:""}var sB=Ha[" useInsertionEffect ".trim().toString()]||rr;function Ao({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[n,o,u]=nB({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n;{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 f=g.useCallback(v=>{var p;if(d){const y=aB(v)?v(e):v;y!==e&&((p=u.current)==null||p.call(u,y))}else o(v)},[d,e,o,u]);return[m,f]}function nB({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),n=g.useRef(r),o=g.useRef(t);return sB(()=>{o.current=t},[t]),g.useEffect(()=>{var u;n.current!==r&&((u=o.current)==null||u.call(o,r),n.current=r)},[r,n]),[r,i,o]}function aB(e){return typeof e=="function"}function To(e){const t=g.forwardRef((r,i)=>{let{children:n,...o}=r,u=null,d=!1;const m=[];HS(n)&&typeof Dh=="function"&&(n=Dh(n._payload)),g.Children.forEach(n,y=>{var b;if(hB(y)){d=!0;const w=y;let C="child"in w.props?w.props.child:w.props.children;HS(C)&&typeof Dh=="function"&&(C=Dh(C._payload)),u=cB(w,C),m.push((b=u==null?void 0:u.props)==null?void 0:b.children)}else m.push(y)}),u?u=g.cloneElement(u,void 0,m):!d&&g.Children.count(n)===1&&g.isValidElement(n)&&(u=n);const f=u?dB(u):void 0,v=nt(i,f);if(!u){if(n||n===0)throw new Error(d?gB(e):pB(e));return n}const p=uB(o,u.props??{});return u.type!==g.Fragment&&(p.ref=i?v:f),g.cloneElement(u,p)});return t.displayName=`${e}.Slot`,t}var oB=To("Slot"),lB=Symbol.for("radix.slottable"),cB=(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 uB(e,t){const r={...t};for(const i in t){const n=e[i],o=t[i];/^on[A-Z]/.test(i)?n&&o?r[i]=(...d)=>{const m=o(...d);return n(...d),m}:n&&(r[i]=n):i==="style"?r[i]={...n,...o}:i==="className"&&(r[i]=[n,o].filter(Boolean).join(" "))}return{...e,...r}}function dB(e){var i,n;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=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function hB(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lB}var fB=Symbol.for("react.lazy");function HS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===fB&&"_payload"in e&&mB(e._payload)}function mB(e){return typeof e=="object"&&e!==null&&"then"in e}var pB=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,gB=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Dh=Ha[" use ".trim().toString()],vB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ye=vB.reduce((e,t)=>{const r=To(`Primitive.${t}`),i=g.forwardRef((n,o)=>{const{asChild:u,...d}=n,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 KE(e,t){e&&Wa.flushSync(()=>e.dispatchEvent(t))}function Nr(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 _B="DismissableLayer",k_="dismissableLayer.update",xB="dismissableLayer.pointerDownOutside",yB="dismissableLayer.focusOutside",FS,f0=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),um=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...f}=e,v=g.useContext(f0),[p,y]=g.useState(null),b=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=g.useState({}),C=nt(t,y),E=Array.from(v.layers),[S]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),k=S?E.indexOf(S):-1,j=p?E.indexOf(p):-1,N=v.layersWithOutsidePointerEventsDisabled.size>0,M=j>=k,D=g.useRef(!1),H=EB(q=>{o==null||o(q),d==null||d(q),q.defaultPrevented||m==null||m()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:D,dismissableSurfaces:v.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(q=>{if(!(q instanceof Node))return!1;const P=[...v.branches].some(B=>B.contains(q));return M&&!P},[v.branches,M])}),L=kB(q=>{if(i&&D.current)return;const P=q.target;[...v.branches].some(z=>z.contains(P))||(u==null||u(q),d==null||d(q),q.defaultPrevented||m==null||m())},b),G=p?j===E.length-1:!1,Z=Nr(q=>{q.key==="Escape"&&(n==null||n(q),!q.defaultPrevented&&m&&(q.preventDefault(),m()))});return g.useEffect(()=>{if(G)return b.addEventListener("keydown",Z,{capture:!0}),()=>b.removeEventListener("keydown",Z,{capture:!0})},[b,G,Z]),g.useEffect(()=>{if(p)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(FS=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(p)),v.layers.add(p),qS(),()=>{r&&(v.layersWithOutsidePointerEventsDisabled.delete(p),v.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=FS))}},[p,b,r,v]),g.useEffect(()=>()=>{p&&(v.layers.delete(p),v.layersWithOutsidePointerEventsDisabled.delete(p),qS())},[p,v]),g.useEffect(()=>{const q=()=>w({});return document.addEventListener(k_,q),()=>document.removeEventListener(k_,q)},[]),l.jsx(Ye.div,{...f,ref:C,style:{pointerEvents:N?M?"auto":"none":void 0,...e.style},onFocusCapture:Pe(e.onFocusCapture,L.onFocusCapture),onBlurCapture:Pe(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Pe(e.onPointerDownCapture,H.onPointerDownCapture)})});um.displayName=_B;var bB="DismissableLayerBranch",wB=g.forwardRef((e,t)=>{const r=g.useContext(f0),i=g.useRef(null),n=nt(t,i);return g.useEffect(()=>{const o=i.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(Ye.div,{...e,ref:n})});wB.displayName=bB;function SB(){const e=g.useContext(f0),[t,r]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var CB=()=>!0;function EB(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:n,dismissableSurfaces:o,shouldHandlePointerDownOutside:u=CB}=t,d=Nr(e),m=g.useRef(!1),f=g.useRef(!1),v=g.useRef(new Map),p=g.useRef(()=>{});return g.useEffect(()=>{function y(){f.current=!1,n.current=!1,v.current.clear()}function b(){return Array.from(v.current.values()).some(Boolean)}function w(j){if(!f.current)return;const N=j.target;N instanceof Node&&[...o].some(D=>D.contains(N))||v.current.set(j.type,!0),j.type==="click"&&window.setTimeout(()=>{f.current&&p.current()},0)}function C(j){f.current&&v.current.set(j.type,!1)}const E=j=>{if(j.target&&!m.current){let N=function(){r.removeEventListener("click",p.current);const D=b();y(),D||XE(xB,d,M,{discrete:!0})};if(!u(j.target)){r.removeEventListener("click",p.current),y(),m.current=!1;return}const M={originalEvent:j};f.current=!0,n.current=i&&j.button===0,v.current.clear(),!i||j.button!==0?N():(r.removeEventListener("click",p.current),p.current=N,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),y();m.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const j of S)r.addEventListener(j,w,!0),r.addEventListener(j,C);const k=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(k),r.removeEventListener("pointerdown",E),r.removeEventListener("click",p.current);for(const j of S)r.removeEventListener(j,w,!0),r.removeEventListener(j,C)}},[r,d,i,n,o,u]),{onPointerDownCapture:()=>m.current=!0}}function kB(e,t=globalThis==null?void 0:globalThis.document){const r=Nr(e),i=g.useRef(!1);return g.useEffect(()=>{const n=o=>{o.target&&!i.current&&XE(yB,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function qS(){const e=new CustomEvent(k_);document.dispatchEvent(e)}function XE(e,t,r,{discrete:i}){const n=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),i?KE(n,o):n.dispatchEvent(o)}var pv="focusScope.autoFocusOnMount",gv="focusScope.autoFocusOnUnmount",WS={bubbles:!1,cancelable:!0},RB="FocusScope",dm=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...u}=e,[d,m]=g.useState(null),f=Nr(n),v=Nr(o),p=g.useRef(null),y=nt(t,m),b=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let C=function(j){if(b.paused||!d)return;const N=j.target;d.contains(N)?p.current=N:Na(p.current,{select:!0})},E=function(j){if(b.paused||!d)return;const N=j.relatedTarget;N!==null&&(d.contains(N)||Na(p.current,{select:!0}))},S=function(j){if(document.activeElement===document.body)for(const M of j)M.removedNodes.length>0&&Na(d)};document.addEventListener("focusin",C),document.addEventListener("focusout",E);const k=new MutationObserver(S);return d&&k.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",E),k.disconnect()}}},[i,d,b.paused]),g.useEffect(()=>{if(d){GS.add(b);const C=document.activeElement;if(!d.contains(C)){const S=new CustomEvent(pv,WS);d.addEventListener(pv,f),d.dispatchEvent(S),S.defaultPrevented||(NB(DB(ZE(d)),{select:!0}),document.activeElement===C&&Na(d))}return()=>{d.removeEventListener(pv,f),setTimeout(()=>{const S=new CustomEvent(gv,WS);d.addEventListener(gv,v),d.dispatchEvent(S),S.defaultPrevented||Na(C??document.body,{select:!0}),d.removeEventListener(gv,v),GS.remove(b)},0)}}},[d,f,v,b]);const w=g.useCallback(C=>{if(!r&&!i||b.paused)return;const E=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,S=document.activeElement;if(E&&S){const k=C.currentTarget,[j,N]=jB(k);j&&N?!C.shiftKey&&S===N?(C.preventDefault(),r&&Na(j,{select:!0})):C.shiftKey&&S===j&&(C.preventDefault(),r&&Na(N,{select:!0})):S===k&&C.preventDefault()}},[r,i,b.paused]);return l.jsx(Ye.div,{tabIndex:-1,...u,ref:y,onKeyDown:w})});dm.displayName=RB;function NB(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(Na(i,{select:t}),document.activeElement!==r)return}function jB(e){const t=ZE(e),r=VS(t,e),i=VS(t.reverse(),e);return[r,i]}function ZE(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const n=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||n?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function VS(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):AB(i,{upTo:t})))return i}function AB(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 TB(e){return e instanceof HTMLInputElement&&"select"in e}function Na(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&TB(e)&&t&&e.select()}}var GS=MB();function MB(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=YS(e,t),e.unshift(t)},remove(t){var r;e=YS(e,t),(r=e[0])==null||r.resume()}}}function YS(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function DB(e){return e.filter(t=>t.tagName!=="A")}var LB="Portal",hm=g.forwardRef((e,t)=>{var d;const{container:r,...i}=e,[n,o]=g.useState(!1);rr(()=>o(!0),[]);const u=r||n&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Wa.createPortal(l.jsx(Ye.div,{...i,ref:t}),u):null});hm.displayName=LB;function OB(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}var $s=e=>{const{present:t,children:r}=e,i=BB(t),n=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=PB(i.ref,zB(n));return typeof r=="function"||i.isPresent?g.cloneElement(n,{ref:o}):null};$s.displayName="Presence";function BB(e){const[t,r]=g.useState(),i=g.useRef(null),n=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=OB(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??ou(i.current),u.current=void 0):o.current="none"},[m]),rr(()=>{const v=i.current,p=n.current;if(p!==e){const b=o.current,w=ou(v);e?(u.current=w,f("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?f("UNMOUNT"):f(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,f]),rr(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,y=w=>{const E=ou(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(f("ANIMATION_END"),!n.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},b=w=>{w.target===t&&(o.current=ou(i.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=ou(p)}else i.current=null;r(v)},[])}}function KS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function PB(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let n=!1;const o=i.map(u=>{const d=KS(u,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():KS(i[u],null)}}},[])}function ou(e){return(e==null?void 0:e.animationName)||"none"}function zB(e){var i,n;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=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Lh=0,Ys=null;function m0(){g.useEffect(()=>{Ys||(Ys={start:XS(),end:XS()});const{start:e,end:t}=Ys;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Lh++,()=>{Lh===1&&(Ys==null||Ys.start.remove(),Ys==null||Ys.end.remove(),Ys=null),Lh=Math.max(0,Lh-1)}},[])}function XS(){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 sn=function(){return sn=Object.assign||function(t){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},sn.apply(this,arguments)};function QE(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 n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function IB(e,t,r){if(r||arguments.length===2)for(var i=0,n=t.length,o;i<n;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 uf="right-scroll-bar-position",df="width-before-scroll-bar",$B="with-scroll-bars-hidden",UB="--removed-body-scroll-bar-size";function vv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function HB(e,t){var r=g.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(i){var n=r.value;n!==i&&(r.value=i,r.callback(i,n))}}}})[0];return r.callback=t,r.facade}var FB=typeof window<"u"?g.useLayoutEffect:g.useEffect,ZS=new WeakMap;function qB(e,t){var r=HB(null,function(i){return e.forEach(function(n){return vv(n,i)})});return FB(function(){var i=ZS.get(r);if(i){var n=new Set(i),o=new Set(e),u=r.current;n.forEach(function(d){o.has(d)||vv(d,null)}),o.forEach(function(d){n.has(d)||vv(d,u)})}ZS.set(r,e)},[e]),r}function WB(e){return e}function VB(e,t){t===void 0&&(t=WB);var r=[],i=!1,n={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)},f=function(){return Promise.resolve().then(m)};f(),r={push:function(v){u.push(v),f()},filter:function(v){return u=u.filter(v),r}}}};return n}function GB(e){e===void 0&&(e={});var t=VB(null);return t.options=sn({async:!0,ssr:!1},e),t}var JE=function(e){var t=e.sideCar,r=QE(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,sn({},r))};JE.isSideCarExport=!0;function YB(e,t){return e.useMedium(t),JE}var ek=GB(),_v=function(){},fm=g.forwardRef(function(e,t){var r=g.useRef(null),i=g.useState({onScrollCapture:_v,onWheelCapture:_v,onTouchMoveCapture:_v}),n=i[0],o=i[1],u=e.forwardProps,d=e.children,m=e.className,f=e.removeScrollBar,v=e.enabled,p=e.shards,y=e.sideCar,b=e.noRelative,w=e.noIsolation,C=e.inert,E=e.allowPinchZoom,S=e.as,k=S===void 0?"div":S,j=e.gapMode,N=QE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=y,D=qB([r,t]),H=sn(sn({},N),n);return g.createElement(g.Fragment,null,v&&g.createElement(M,{sideCar:ek,removeScrollBar:f,shards:p,noRelative:b,noIsolation:w,inert:C,setCallbacks:o,allowPinchZoom:!!E,lockRef:r,gapMode:j}),u?g.cloneElement(g.Children.only(d),sn(sn({},H),{ref:D})):g.createElement(k,sn({},H,{className:m,ref:D}),d))});fm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fm.classNames={fullWidth:df,zeroRight:uf};var KB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function XB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KB();return t&&e.setAttribute("nonce",t),e}function ZB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function QB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var JB=function(){var e=0,t=null;return{add:function(r){e==0&&(t=XB())&&(ZB(t,r),QB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eP=function(){var e=JB();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},tk=function(){var e=eP(),t=function(r){var i=r.styles,n=r.dynamic;return e(i,n),null};return t},tP={left:0,top:0,right:0,gap:0},xv=function(e){return parseInt(e||"",10)||0},rP=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[xv(r),xv(i),xv(n)]},iP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return tP;var t=rP(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])}},sP=tk(),Gl="data-scroll-locked",nP=function(e,t,r,i){var n=e.left,o=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
516
+ .`.concat($B,` {
517
+ overflow: hidden `).concat(i,`;
518
+ padding-right: `).concat(d,"px ").concat(i,`;
519
+ }
520
+ body[`).concat(Gl,`] {
521
+ overflow: hidden `).concat(i,`;
522
+ overscroll-behavior: contain;
523
+ `).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&`
524
+ padding-left: `.concat(n,`px;
525
+ padding-top: `).concat(o,`px;
526
+ padding-right: `).concat(u,`px;
527
+ margin-left:0;
528
+ margin-top:0;
529
+ margin-right: `).concat(d,"px ").concat(i,`;
530
+ `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),`
531
+ }
532
+
533
+ .`).concat(uf,` {
534
+ right: `).concat(d,"px ").concat(i,`;
535
+ }
536
+
537
+ .`).concat(df,` {
538
+ margin-right: `).concat(d,"px ").concat(i,`;
539
+ }
540
+
541
+ .`).concat(uf," .").concat(uf,` {
542
+ right: 0 `).concat(i,`;
543
+ }
544
+
545
+ .`).concat(df," .").concat(df,` {
546
+ margin-right: 0 `).concat(i,`;
547
+ }
548
+
549
+ body[`).concat(Gl,`] {
550
+ `).concat(UB,": ").concat(d,`px;
551
+ }
552
+ `)},QS=function(){var e=parseInt(document.body.getAttribute(Gl)||"0",10);return isFinite(e)?e:0},aP=function(){g.useEffect(function(){return document.body.setAttribute(Gl,(QS()+1).toString()),function(){var e=QS()-1;e<=0?document.body.removeAttribute(Gl):document.body.setAttribute(Gl,e.toString())}},[])},oP=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,n=i===void 0?"margin":i;aP();var o=g.useMemo(function(){return iP(n)},[n]);return g.createElement(sP,{styles:nP(o,!t,n,r?"":"!important")})},R_=!1;if(typeof window<"u")try{var Oh=Object.defineProperty({},"passive",{get:function(){return R_=!0,!0}});window.addEventListener("test",Oh,Oh),window.removeEventListener("test",Oh,Oh)}catch{R_=!1}var Tl=R_?{passive:!1}:!1,lP=function(e){return e.tagName==="TEXTAREA"},rk=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!lP(e)&&r[t]==="visible")},cP=function(e){return rk(e,"overflowY")},uP=function(e){return rk(e,"overflowX")},JS=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var n=ik(e,i);if(n){var o=sk(e,i),u=o[1],d=o[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},dP=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},hP=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},ik=function(e,t){return e==="v"?cP(t):uP(t)},sk=function(e,t){return e==="v"?dP(t):hP(t)},fP=function(e,t){return e==="h"&&t==="rtl"?-1:1},mP=function(e,t,r,i,n){var o=fP(e,window.getComputedStyle(t).direction),u=o*i,d=r.target,m=t.contains(d),f=!1,v=u>0,p=0,y=0;do{if(!d)break;var b=sk(e,d),w=b[0],C=b[1],E=b[2],S=C-E-o*w;(w||S)&&ik(e,d)&&(p+=S,y+=w);var k=d.parentNode;d=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(v&&Math.abs(p)<1||!v&&Math.abs(y)<1)&&(f=!0),f},Bh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eC=function(e){return[e.deltaX,e.deltaY]},tC=function(e){return e&&"current"in e?e.current:e},pP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gP=function(e){return`
553
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
554
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
555
+ `)},vP=0,Ml=[];function _P(e){var t=g.useRef([]),r=g.useRef([0,0]),i=g.useRef(),n=g.useState(vP++)[0],o=g.useState(tk)[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(n));var C=IB([e.lockRef.current],(e.shards||[]).map(tC),!0).filter(Boolean);return C.forEach(function(E){return E.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),C.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(n))})}}},[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=Bh(C),k=r.current,j="deltaX"in C?C.deltaX:k[0]-S[0],N="deltaY"in C?C.deltaY:k[1]-S[1],M,D=C.target,H=Math.abs(j)>Math.abs(N)?"h":"v";if("touches"in C&&H==="h"&&D.type==="range")return!1;var L=window.getSelection(),G=L&&L.anchorNode,Z=G?G===D||G.contains(D):!1;if(Z)return!1;var q=JS(H,D);if(!q)return!0;if(q?M=H:(M=H==="v"?"h":"v",q=JS(H,D)),!q)return!1;if(!i.current&&"changedTouches"in C&&(j||N)&&(i.current=M),!M)return!0;var P=i.current||M;return mP(P,E,C,P==="h"?j:N)},[]),m=g.useCallback(function(C){var E=C;if(!(!Ml.length||Ml[Ml.length-1]!==o)){var S="deltaY"in E?eC(E):Bh(E),k=t.current.filter(function(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&pP(M.delta,S)})[0];if(k&&k.should){E.cancelable&&E.preventDefault();return}if(!k){var j=(u.current.shards||[]).map(tC).filter(Boolean).filter(function(M){return M.contains(E.target)}),N=j.length>0?d(E,j[0]):!u.current.noIsolation;N&&E.cancelable&&E.preventDefault()}}},[]),f=g.useCallback(function(C,E,S,k){var j={name:C,delta:E,target:S,should:k,shadowParent:xP(S)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(N){return N!==j})},1)},[]),v=g.useCallback(function(C){r.current=Bh(C),i.current=void 0},[]),p=g.useCallback(function(C){f(C.type,eC(C),C.target,d(C,e.lockRef.current))},[]),y=g.useCallback(function(C){f(C.type,Bh(C),C.target,d(C,e.lockRef.current))},[]);g.useEffect(function(){return Ml.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",m,Tl),document.addEventListener("touchmove",m,Tl),document.addEventListener("touchstart",v,Tl),function(){Ml=Ml.filter(function(C){return C!==o}),document.removeEventListener("wheel",m,Tl),document.removeEventListener("touchmove",m,Tl),document.removeEventListener("touchstart",v,Tl)}},[]);var b=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(o,{styles:gP(n)}):null,b?g.createElement(oP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yP=YB(ek,_P);var mm=g.forwardRef(function(e,t){return g.createElement(fm,sn({},e,{ref:t,sideCar:yP}))});mm.classNames=fm.classNames;var bP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Dl=new WeakMap,Ph=new WeakMap,zh={},yv=0,nk=function(e){return e&&(e.host||nk(e.parentNode))},wP=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=nk(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})},SP=function(e,t,r,i){var n=wP(t,Array.isArray(e)?e:[e]);zh[r]||(zh[r]=new WeakMap);var o=zh[r],u=[],d=new Set,m=new Set(n),f=function(p){!p||d.has(p)||(d.add(p),f(p.parentNode))};n.forEach(f);var v=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(y){if(d.has(y))v(y);else try{var b=y.getAttribute(i),w=b!==null&&b!=="false",C=(Dl.get(y)||0)+1,E=(o.get(y)||0)+1;Dl.set(y,C),o.set(y,E),u.push(y),C===1&&w&&Ph.set(y,!0),E===1&&y.setAttribute(r,"true"),w||y.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",y,S)}})};return v(t),d.clear(),yv++,function(){u.forEach(function(p){var y=Dl.get(p)-1,b=o.get(p)-1;Dl.set(p,y),o.set(p,b),y||(Ph.has(p)||p.removeAttribute(i),Ph.delete(p)),b||p.removeAttribute(r)}),yv--,yv||(Dl=new WeakMap,Dl=new WeakMap,Ph=new WeakMap,zh={})}},p0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),n=bP(e);return n?(i.push.apply(i,Array.from(n.querySelectorAll("[aria-live], script"))),SP(i,n,r,"aria-hidden")):function(){return null}},pm="Dialog",[ak,ok]=Is(pm),[CP,Us]=ak(pm),g0=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:n,onOpenChange:o,modal:u=!0}=e,d=g.useRef(null),m=g.useRef(null),[f,v]=Ao({prop:i,defaultProp:n??!1,onChange:o,caller:pm});return l.jsx(CP,{scope:t,triggerRef:d,contentRef:m,contentId:Ds(),titleId:Ds(),descriptionId:Ds(),open:f,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(p=>!p),[v]),modal:u,children:r})};g0.displayName=pm;var lk="DialogTrigger",gm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Us(lk,r),o=nt(t,n.triggerRef);return l.jsx(Ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.open?n.contentId:void 0,"data-state":x0(n.open),...i,ref:o,onClick:Pe(e.onClick,n.onOpenToggle)})});gm.displayName=lk;var v0="DialogPortal",[EP,ck]=ak(v0,{forceMount:void 0}),_0=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:n}=e,o=Us(v0,t);return l.jsx(EP,{scope:t,forceMount:r,children:g.Children.map(i,u=>l.jsx($s,{present:r||o.open,children:l.jsx(hm,{asChild:!0,container:n,children:u})}))})};_0.displayName=v0;var Lf="DialogOverlay",vm=g.forwardRef((e,t)=>{const r=ck(Lf,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,o=Us(Lf,e.__scopeDialog);return o.modal?l.jsx($s,{present:i||o.open,children:l.jsx(RP,{...n,ref:t})}):null});vm.displayName=Lf;var kP=To("DialogOverlay.RemoveScroll"),RP=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Us(Lf,r),o=SB(),u=nt(t,o);return l.jsx(mm,{as:kP,allowPinchZoom:!0,shards:[n.contentRef],children:l.jsx(Ye.div,{"data-state":x0(n.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Zl="DialogContent",_m=g.forwardRef((e,t)=>{const r=ck(Zl,e.__scopeDialog),{forceMount:i=r.forceMount,...n}=e,o=Us(Zl,e.__scopeDialog);return l.jsx($s,{present:i||o.open,children:o.modal?l.jsx(NP,{...n,ref:t}):l.jsx(jP,{...n,ref:t})})});_m.displayName=Zl;var NP=g.forwardRef((e,t)=>{const r=Us(Zl,e.__scopeDialog),i=g.useRef(null),n=nt(t,r.contentRef,i);return g.useEffect(()=>{const o=i.current;if(o)return p0(o)},[]),l.jsx(uk,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Pe(e.onCloseAutoFocus,o=>{var u;o.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&o.preventDefault()}),onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault())})}),jP=g.forwardRef((e,t)=>{const r=Us(Zl,e.__scopeDialog),i=g.useRef(!1),n=g.useRef(!1);return l.jsx(uk,{...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,n.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const u=o.target;((f=r.triggerRef.current)==null?void 0:f.contains(u))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&n.current&&o.preventDefault()}})}),uk=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:n,onCloseAutoFocus:o,...u}=e,d=Us(Zl,r);return m0(),l.jsx(l.Fragment,{children:l.jsx(dm,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:n,onUnmountAutoFocus:o,children:l.jsx(um,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":x0(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),dk="DialogTitle",xm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Us(dk,r);return l.jsx(Ye.h2,{id:n.titleId,...i,ref:t})});xm.displayName=dk;var hk="DialogDescription",ym=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Us(hk,r);return l.jsx(Ye.p,{id:n.descriptionId,...i,ref:t})});ym.displayName=hk;var fk="DialogClose",zo=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,n=Us(fk,r);return l.jsx(Ye.button,{type:"button",...i,ref:t,onClick:Pe(e.onClick,()=>n.onOpenChange(!1))})});zo.displayName=fk;function x0(e){return e?"open":"closed"}var mk="AlertDialog",[AP]=Is(mk,[ok]),Yn=ok(),pk=e=>{const{__scopeAlertDialog:t,...r}=e,i=Yn(t);return l.jsx(g0,{...i,...r,modal:!0})};pk.displayName=mk;var TP="AlertDialogTrigger",gk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,n=Yn(r);return l.jsx(gm,{...n,...i,ref:t})});gk.displayName=TP;var MP="AlertDialogPortal",vk=e=>{const{__scopeAlertDialog:t,...r}=e,i=Yn(t);return l.jsx(_0,{...i,...r})};vk.displayName=MP;var DP="AlertDialogOverlay",_k=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,n=Yn(r);return l.jsx(vm,{...n,...i,ref:t})});_k.displayName=DP;var xk="AlertDialogContent",[LP,OP]=AP(xk),yk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...n}=e,o=Yn(r),u=g.useRef(null),d=nt(t,u),m=g.useRef(null);return l.jsx(LP,{scope:r,cancelRef:m,children:l.jsx(_m,{role:"alertdialog",...o,...n,ref:d,onOpenAutoFocus:Pe(n.onOpenAutoFocus,f=>{var v;f.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:i})})});yk.displayName=xk;var BP="AlertDialogTitle",bk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,n=Yn(r);return l.jsx(xm,{...n,...i,ref:t})});bk.displayName=BP;var PP="AlertDialogDescription",wk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,n=Yn(r);return l.jsx(ym,{...n,...i,ref:t})});wk.displayName=PP;var zP="AlertDialogAction",Sk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,n=Yn(r);return l.jsx(zo,{...n,...i,ref:t})});Sk.displayName=zP;var Ck="AlertDialogCancel",Ek=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:n}=OP(Ck,r),o=Yn(r),u=nt(t,n);return l.jsx(zo,{...o,...i,ref:u})});Ek.displayName=Ck;var IP=pk,kk=gk,$P=vk,Rk=_k,Nk=yk,jk=Sk,Ak=Ek,Tk=bk,Mk=wk;function Dk(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=Dk(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function y0(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Dk(e))&&(i&&(i+=" "),i+=t);return i}const UP=(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},HP=(e,t)=>({classGroupId:e,validator:t}),Lk=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Of="-",rC=[],FP="arbitrary..",qP=e=>{const t=VP(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return WP(u);const d=u.split(Of),m=d[0]===""&&d.length>1?1:0;return Ok(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],f=r[u];return m?f?UP(f,m):m:f||rC}return r[u]||rC}}},Ok=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],o=r.nextPart.get(n);if(o){const f=Ok(e,t+1,o);if(f)return f}const u=r.validators;if(u===null)return;const d=t===0?e.join(Of):e.slice(t).join(Of),m=u.length;for(let f=0;f<m;f++){const v=u[f];if(v.validator(d))return v.classGroupId}},WP=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?FP+i:void 0})(),VP=e=>{const{theme:t,classGroups:r}=e;return GP(r,t)},GP=(e,t)=>{const r=Lk();for(const i in e){const n=e[i];b0(n,r,i,t)}return r},b0=(e,t,r,i)=>{const n=e.length;for(let o=0;o<n;o++){const u=e[o];YP(u,t,r,i)}},YP=(e,t,r,i)=>{if(typeof e=="string"){KP(e,t,r);return}if(typeof e=="function"){XP(e,t,r,i);return}ZP(e,t,r,i)},KP=(e,t,r)=>{const i=e===""?t:Bk(t,e);i.classGroupId=r},XP=(e,t,r,i)=>{if(QP(e)){b0(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(HP(r,e))},ZP=(e,t,r,i)=>{const n=Object.entries(e),o=n.length;for(let u=0;u<o;u++){const[d,m]=n[u];b0(m,Bk(t,d),r,i)}},Bk=(e,t)=>{let r=e;const i=t.split(Of),n=i.length;for(let o=0;o<n;o++){const u=i[o];let d=r.nextPart.get(u);d||(d=Lk(),r.nextPart.set(u,d)),r=d}return r},QP=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,JP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const n=(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 n(o,u),u},set(o,u){o in r?r[o]=u:n(o,u)}}},N_="!",iC=":",ez=[],sC=(e,t,r,i,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:n}),tz=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=n=>{const o=[];let u=0,d=0,m=0,f;const v=n.length;for(let C=0;C<v;C++){const E=n[C];if(u===0&&d===0){if(E===iC){o.push(n.slice(m,C)),m=C+1;continue}if(E==="/"){f=C;continue}}E==="["?u++:E==="]"?u--:E==="("?d++:E===")"&&d--}const p=o.length===0?n:n.slice(m);let y=p,b=!1;p.endsWith(N_)?(y=p.slice(0,-1),b=!0):p.startsWith(N_)&&(y=p.slice(1),b=!0);const w=f&&f>m?f-m:void 0;return sC(o,b,y,w)};if(t){const n=t+iC,o=i;i=u=>u.startsWith(n)?o(u.slice(n.length)):sC(ez,!1,u,void 0,!0)}if(r){const n=i;i=o=>r({className:o,parseClassName:n})}return i},rz=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let n=[];for(let o=0;o<r.length;o++){const u=r[o],d=u[0]==="[",m=t.has(u);d||m?(n.length>0&&(n.sort(),i.push(...n),n=[]),i.push(u)):n.push(u)}return n.length>0&&(n.sort(),i.push(...n)),i}},iz=e=>({cache:JP(e.cacheSize),parseClassName:tz(e),sortModifiers:rz(e),postfixLookupClassGroupIds:sz(e),...qP(e)}),sz=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},nz=/\s+/,az=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:n,sortModifiers:o,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(nz);let f="";for(let v=m.length-1;v>=0;v-=1){const p=m[v],{isExternal:y,modifiers:b,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:E}=r(p);if(y){f=p+(f.length>0?" "+f:f);continue}let S=!!E,k;if(S){const H=C.substring(0,E);k=i(H);const L=k&&u[k]?i(C):void 0;L&&L!==k&&(k=L,S=!1)}else k=i(C);if(!k){if(!S){f=p+(f.length>0?" "+f:f);continue}if(k=i(C),!k){f=p+(f.length>0?" "+f:f);continue}S=!1}const j=b.length===0?"":b.length===1?b[0]:o(b).join(":"),N=w?j+N_:j,M=N+k;if(d.indexOf(M)>-1)continue;d.push(M);const D=n(k,S);for(let H=0;H<D.length;++H){const L=D[H];d.push(N+L)}f=p+(f.length>0?" "+f:f)}return f},oz=(...e)=>{let t=0,r,i,n="";for(;t<e.length;)(r=e[t++])&&(i=Pk(r))&&(n&&(n+=" "),n+=i);return n},Pk=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=Pk(e[i]))&&(r&&(r+=" "),r+=t);return r},lz=(e,...t)=>{let r,i,n,o;const u=m=>{const f=t.reduce((v,p)=>p(v),e());return r=iz(f),i=r.cache.get,n=r.cache.set,o=d,d(m)},d=m=>{const f=i(m);if(f)return f;const v=az(m,r);return n(m,v),v};return o=u,(...m)=>o(oz(...m))},cz=[],Cr=e=>{const t=r=>r[e]||cz;return t.isThemeGetter=!0,t},zk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ik=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hz=/\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$/,fz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wa=e=>uz.test(e),et=e=>!!e&&!Number.isNaN(Number(e)),Ks=e=>!!e&&Number.isInteger(Number(e)),bv=e=>e.endsWith("%")&&et(e.slice(0,-1)),On=e=>dz.test(e),$k=()=>!0,gz=e=>hz.test(e)&&!fz.test(e),w0=()=>!1,vz=e=>mz.test(e),_z=e=>pz.test(e),xz=e=>!Me(e)&&!De(e),yz=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)),bz=e=>Va(e,Fk,w0),Me=e=>zk.test(e),po=e=>Va(e,qk,gz),nC=e=>Va(e,jz,et),wz=e=>Va(e,Vk,$k),Sz=e=>Va(e,Wk,w0),aC=e=>Va(e,Uk,w0),Cz=e=>Va(e,Hk,_z),Ih=e=>Va(e,Gk,vz),De=e=>Ik.test(e),lu=e=>Io(e,qk),Ez=e=>Io(e,Wk),oC=e=>Io(e,Uk),kz=e=>Io(e,Fk),Rz=e=>Io(e,Hk),$h=e=>Io(e,Gk,!0),Nz=e=>Io(e,Vk,!0),Va=(e,t,r)=>{const i=zk.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Io=(e,t,r=!1)=>{const i=Ik.exec(e);return i?i[1]?t(i[1]):r:!1},Uk=e=>e==="position"||e==="percentage",Hk=e=>e==="image"||e==="url",Fk=e=>e==="length"||e==="size"||e==="bg-size",qk=e=>e==="length",jz=e=>e==="number",Wk=e=>e==="family-name",Vk=e=>e==="number"||e==="weight",Gk=e=>e==="shadow",Az=()=>{const e=Cr("color"),t=Cr("font"),r=Cr("text"),i=Cr("font-weight"),n=Cr("tracking"),o=Cr("leading"),u=Cr("breakpoint"),d=Cr("container"),m=Cr("spacing"),f=Cr("radius"),v=Cr("shadow"),p=Cr("inset-shadow"),y=Cr("text-shadow"),b=Cr("drop-shadow"),w=Cr("blur"),C=Cr("perspective"),E=Cr("aspect"),S=Cr("ease"),k=Cr("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...N(),De,Me],D=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],L=()=>[De,Me,m],G=()=>[wa,"full","auto",...L()],Z=()=>[Ks,"none","subgrid",De,Me],q=()=>["auto",{span:["full",Ks,De,Me]},Ks,De,Me],P=()=>[Ks,"auto",De,Me],B=()=>["auto","min","max","fr",De,Me],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...L()],$=()=>[wa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],U=()=>[wa,"screen","full","dvw","lvw","svw","min","max","fit",...L()],F=()=>[wa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],W=()=>[e,De,Me],T=()=>[...N(),oC,aC,{position:[De,Me]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",kz,bz,{size:[De,Me]}],J=()=>[bv,lu,po],oe=()=>["","none","full",f,De,Me],ce=()=>["",et,lu,po],Y=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[et,bv,oC,aC],Ae=()=>["","none",w,De,Me],ke=()=>["none",et,De,Me],Ee=()=>["none",et,De,Me],re=()=>[et,De,Me],te=()=>[wa,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[On],breakpoint:[On],color:[$k],container:[On],"drop-shadow":[On],ease:["in","out","in-out"],font:[xz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[On],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[On],shadow:[On],spacing:["px",et],text:[On],"text-shadow":[On],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wa,Me,De,E]}],container:["container"],"container-type":[{"@container":["","normal","size",De,Me]}],"container-named":[yz],columns:[{columns:[et,Me,De,d]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Ks,"auto",De,Me]}],basis:[{basis:[wa,"full","auto",d,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[et,wa,"auto","initial","none",Me]}],grow:[{grow:["",et,De,Me]}],shrink:[{shrink:["",et,De,Me]}],order:[{order:[Ks,"first","last","none",De,Me]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[d,"screen",...$()]}],"min-w":[{"min-w":[d,"screen","none",...$()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",r,lu,po]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,Nz,wz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bv,Me]}],"font-family":[{font:[Ez,Sz,t]}],"font-features":[{"font-features":[Me]}],"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:[n,De,Me]}],"line-clamp":[{"line-clamp":[et,"none",De,nC]}],leading:[{leading:[o,...L()]}],"list-image":[{"list-image":["none",De,Me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,Me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[et,"from-font","auto",De,po]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[et,"auto",De,Me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[Ks,De,Me]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,Me]}],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",De,Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ks,De,Me],radial:["",De,Me],conic:[Ks,De,Me]},Rz,Cz]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-bs":[{"border-bs":ce()}],"border-w-be":[{"border-be":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[et,De,Me]}],"outline-w":[{outline:["",et,lu,po]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",v,$h,Ih]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,$h,Ih]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[et,po]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",y,$h,Ih]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[et,De,Me]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[De,Me]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[et]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,Me]}],filter:[{filter:["","none",De,Me]}],blur:[{blur:Ae()}],brightness:[{brightness:[et,De,Me]}],contrast:[{contrast:[et,De,Me]}],"drop-shadow":[{"drop-shadow":["","none",b,$h,Ih]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",et,De,Me]}],"hue-rotate":[{"hue-rotate":[et,De,Me]}],invert:[{invert:["",et,De,Me]}],saturate:[{saturate:[et,De,Me]}],sepia:[{sepia:["",et,De,Me]}],"backdrop-filter":[{"backdrop-filter":["","none",De,Me]}],"backdrop-blur":[{"backdrop-blur":Ae()}],"backdrop-brightness":[{"backdrop-brightness":[et,De,Me]}],"backdrop-contrast":[{"backdrop-contrast":[et,De,Me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",et,De,Me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[et,De,Me]}],"backdrop-invert":[{"backdrop-invert":["",et,De,Me]}],"backdrop-opacity":[{"backdrop-opacity":[et,De,Me]}],"backdrop-saturate":[{"backdrop-saturate":[et,De,Me]}],"backdrop-sepia":[{"backdrop-sepia":["",et,De,Me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",De,Me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[et,"initial",De,Me]}],ease:[{ease:["linear","initial",S,De,Me]}],delay:[{delay:[et,De,Me]}],animate:[{animate:["none",k,De,Me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,De,Me]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:Ee()}],"scale-x":[{"scale-x":Ee()}],"scale-y":[{"scale-y":Ee()}],"scale-z":[{"scale-z":Ee()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[De,Me,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[Ks,De,Me]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",De,Me]}],"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":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",De,Me]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[et,lu,po,nC]}],stroke:[{stroke:["none",...W()]}],"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"]}},Yk=lz(Az);function it(...e){return Yk(y0(e))}const lC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cC=y0,Kk=(e,t)=>r=>{var i;if((t==null?void 0:t.variants)==null)return cC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:o}=t,u=Object.keys(n).map(f=>{const v=r==null?void 0:r[f],p=o==null?void 0:o[f];if(v===null)return null;const y=lC(v)||lC(p);return n[f][y]}),d=r&&Object.entries(r).reduce((f,v)=>{let[p,y]=v;return y===void 0||(f[p]=y),f},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((f,v)=>{let{class:p,className:y,...b}=v;return Object.entries(b).every(w=>{let[C,E]=w;return Array.isArray(E)?E.includes({...o,...d}[C]):{...o,...d}[C]===E})?[...f,p,y]:f},[]);return cC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},Tz=Kk("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"}}),ue=g.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...n},o)=>{const u=i?oB:"button";return l.jsx(u,{ref:o,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:it(Tz({variant:t,size:r,className:e})),...n})});ue.displayName="Button";function _s(e){return l.jsx(IP,{"data-slot":"alert-dialog",...e})}const hn=g.forwardRef((e,t)=>l.jsx(kk,{ref:t,"data-slot":"alert-dialog-trigger",...e}));hn.displayName=kk.displayName;function Mz(e){return l.jsx($P,{"data-slot":"alert-dialog-portal",...e})}const Xk=g.forwardRef(({className:e,...t},r)=>l.jsx(Rk,{ref:r,"data-slot":"alert-dialog-overlay",className:it("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}));Xk.displayName=Rk.displayName;const qi=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsxs(Mz,{children:[l.jsx(Xk,{}),l.jsx(Nk,{ref:i,"data-slot":"alert-dialog-content","data-size":t,className:it("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})]}));qi.displayName=Nk.displayName;function xs({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:it("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 ys({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:it("-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 Zk({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-media",className:it("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 Wi=g.forwardRef(({className:e,...t},r)=>l.jsx(Tk,{ref:r,"data-slot":"alert-dialog-title",className:it("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}));Wi.displayName=Tk.displayName;const Vi=g.forwardRef(({className:e,...t},r)=>l.jsx(Mk,{ref:r,"data-slot":"alert-dialog-description",className:it("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));Vi.displayName=Mk.displayName;const bs=g.forwardRef(({className:e,variant:t="default",size:r="default",...i},n)=>l.jsx(ue,{variant:t,size:r,asChild:!0,children:l.jsx(jk,{ref:n,"data-slot":"alert-dialog-action",className:it(e),...i})}));bs.displayName=jk.displayName;const Gi=g.forwardRef(({className:e,variant:t="outline",size:r="default",...i},n)=>l.jsx(ue,{variant:t,size:r,asChild:!0,children:l.jsx(Ak,{ref:n,"data-slot":"alert-dialog-cancel",className:it(e),...i})}));Gi.displayName=Ak.displayName;function $o(e){return l.jsx(g0,{"data-slot":"dialog",...e})}const Qk=g.forwardRef((e,t)=>l.jsx(gm,{ref:t,"data-slot":"dialog-trigger",...e}));Qk.displayName=gm.displayName;function Dz(e){return l.jsx(_0,{"data-slot":"dialog-portal",...e})}const S0=g.forwardRef((e,t)=>l.jsx(zo,{ref:t,"data-slot":"dialog-close",...e}));S0.displayName=zo.displayName;const Jk=g.forwardRef(({className:e,...t},r)=>l.jsx(vm,{ref:r,"data-slot":"dialog-overlay",className:it("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}));Jk.displayName=vm.displayName;const Ga=g.forwardRef(({className:e,children:t,showCloseButton:r=!0,...i},n)=>l.jsxs(Dz,{children:[l.jsx(Jk,{}),l.jsxs(_m,{ref:n,"data-slot":"dialog-content",className:it("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(zo,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(ue,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[l.jsx(cn,{"aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));Ga.displayName=_m.displayName;function Uo({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:it("flex flex-col gap-2",e),...t})}function ac({className:e,showCloseButton:t=!1,children:r,...i}){return l.jsxs("div",{"data-slot":"dialog-footer",className:it("-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(zo,{asChild:!0,children:l.jsx(ue,{variant:"outline",children:"Close"})})]})}const Ya=g.forwardRef(({className:e,...t},r)=>l.jsx(xm,{ref:r,"data-slot":"dialog-title",className:it("text-base leading-none font-medium",e),...t}));Ya.displayName=xm.displayName;const Ho=g.forwardRef(({className:e,...t},r)=>l.jsx(ym,{ref:r,"data-slot":"dialog-description",className:it("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));Ho.displayName=ym.displayName;function C0(e){const t=e+"CollectionProvider",[r,i]=Is(t),[n,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:E,children:S}=C,k=g.useRef(null),j=g.useRef(new Map).current;return l.jsx(n,{scope:E,itemMap:j,collectionRef:k,children:S})};u.displayName=t;const d=e+"CollectionSlot",m=To(d),f=g.forwardRef((C,E)=>{const{scope:S,children:k}=C,j=o(d,S),N=nt(E,j.collectionRef);return l.jsx(m,{ref:N,children:k})});f.displayName=d;const v=e+"CollectionItemSlot",p="data-radix-collection-item",y=To(v),b=g.forwardRef((C,E)=>{const{scope:S,children:k,...j}=C,N=g.useRef(null),M=nt(E,N),D=o(v,S);return g.useEffect(()=>(D.itemMap.set(N,{ref:N,...j}),()=>void D.itemMap.delete(N))),l.jsx(y,{[p]:"",ref:M,children:k})});b.displayName=v;function w(C){const E=o(e+"CollectionConsumer",C);return g.useCallback(()=>{const k=E.collectionRef.current;if(!k)return[];const j=Array.from(k.querySelectorAll(`[${p}]`));return Array.from(E.itemMap.values()).sort((D,H)=>j.indexOf(D.ref.current)-j.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:f,ItemSlot:b},w,i]}var Lz=g.createContext(void 0);function od(e){const t=g.useContext(Lz);return e||t||"ltr"}const Oz=["top","right","bottom","left"],za=Math.min,$i=Math.max,Bf=Math.round,Uh=Math.floor,on=e=>({x:e,y:e}),Bz={left:"right",right:"left",bottom:"top",top:"bottom"};function j_(e,t,r){return $i(e,za(t,r))}function Wn(e,t){return typeof e=="function"?e(t):e}function Vn(e){return e.split("-")[0]}function oc(e){return e.split("-")[1]}function E0(e){return e==="x"?"y":"x"}function k0(e){return e==="y"?"height":"width"}function nn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function R0(e){return E0(nn(e))}function Pz(e,t,r){r===void 0&&(r=!1);const i=oc(e),n=R0(e),o=k0(n);let u=n==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(u=Pf(u)),[u,Pf(u)]}function zz(e){const t=Pf(e);return[A_(e),t,A_(t)]}function A_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const uC=["left","right"],dC=["right","left"],Iz=["top","bottom"],$z=["bottom","top"];function Uz(e,t,r){switch(e){case"top":case"bottom":return r?t?dC:uC:t?uC:dC;case"left":case"right":return t?Iz:$z;default:return[]}}function Hz(e,t,r,i){const n=oc(e);let o=Uz(Vn(e),r==="start",i);return n&&(o=o.map(u=>u+"-"+n),t&&(o=o.concat(o.map(A_)))),o}function Pf(e){const t=Vn(e);return Bz[t]+e.slice(t.length)}function Fz(e){return{top:0,right:0,bottom:0,left:0,...e}}function eR(e){return typeof e!="number"?Fz(e):{top:e,right:e,bottom:e,left:e}}function zf(e){const{x:t,y:r,width:i,height:n}=e;return{width:i,height:n,top:r,left:t,right:t+i,bottom:r+n,x:t,y:r}}function hC(e,t,r){let{reference:i,floating:n}=e;const o=nn(t),u=R0(t),d=k0(u),m=Vn(t),f=o==="y",v=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,y=i[d]/2-n[d]/2;let b;switch(m){case"top":b={x:v,y:i.y-n.height};break;case"bottom":b={x:v,y:i.y+i.height};break;case"right":b={x:i.x+i.width,y:p};break;case"left":b={x:i.x-n.width,y:p};break;default:b={x:i.x,y:i.y}}switch(oc(t)){case"start":b[u]-=y*(r&&f?-1:1);break;case"end":b[u]+=y*(r&&f?-1:1);break}return b}async function qz(e,t){var r;t===void 0&&(t={});const{x:i,y:n,platform:o,rects:u,elements:d,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:v="viewport",elementContext:p="floating",altBoundary:y=!1,padding:b=0}=Wn(t,e),w=eR(b),E=d[y?p==="floating"?"reference":"floating":p],S=zf(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:f,rootBoundary:v,strategy:m})),k=p==="floating"?{x:i,y:n,width:u.floating.width,height:u.floating.height}:u.reference,j=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d.floating)),N=await(o.isElement==null?void 0:o.isElement(j))?await(o.getScale==null?void 0:o.getScale(j))||{x:1,y:1}:{x:1,y:1},M=zf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:k,offsetParent:j,strategy:m}):k);return{top:(S.top-M.top+w.top)/N.y,bottom:(M.bottom-S.bottom+w.bottom)/N.y,left:(S.left-M.left+w.left)/N.x,right:(M.right-S.right+w.right)/N.x}}const Wz=50,Vz=async(e,t,r)=>{const{placement:i="bottom",strategy:n="absolute",middleware:o=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:qz},m=await(u.isRTL==null?void 0:u.isRTL(t));let f=await u.getElementRects({reference:e,floating:t,strategy:n}),{x:v,y:p}=hC(f,i,m),y=i,b=0;const w={};for(let C=0;C<o.length;C++){const E=o[C];if(!E)continue;const{name:S,fn:k}=E,{x:j,y:N,data:M,reset:D}=await k({x:v,y:p,initialPlacement:i,placement:y,strategy:n,middlewareData:w,rects:f,platform:d,elements:{reference:e,floating:t}});v=j??v,p=N??p,w[S]={...w[S],...M},D&&b<Wz&&(b++,typeof D=="object"&&(D.placement&&(y=D.placement),D.rects&&(f=D.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:n}):D.rects),{x:v,y:p}=hC(f,y,m)),C=-1)}return{x:v,y:p,placement:y,strategy:n,middlewareData:w}},Gz=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:n,rects:o,platform:u,elements:d,middlewareData:m}=t,{element:f,padding:v=0}=Wn(e,t)||{};if(f==null)return{};const p=eR(v),y={x:r,y:i},b=R0(n),w=k0(b),C=await u.getDimensions(f),E=b==="y",S=E?"top":"left",k=E?"bottom":"right",j=E?"clientHeight":"clientWidth",N=o.reference[w]+o.reference[b]-y[b]-o.floating[w],M=y[b]-o.reference[b],D=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f));let H=D?D[j]:0;(!H||!await(u.isElement==null?void 0:u.isElement(D)))&&(H=d.floating[j]||o.floating[w]);const L=N/2-M/2,G=H/2-C[w]/2-1,Z=za(p[S],G),q=za(p[k],G),P=Z,B=H-C[w]-q,z=H/2-C[w]/2+L,I=j_(P,z,B),A=!m.arrow&&oc(n)!=null&&z!==I&&o.reference[w]/2-(z<P?Z:q)-C[w]/2<0,$=A?z<P?z-P:z-B:0;return{[b]:y[b]+$,data:{[b]:I,centerOffset:z-I-$,...A&&{alignmentOffset:$}},reset:A}}}),Yz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,i;const{placement:n,middlewareData:o,rects:u,initialPlacement:d,platform:m,elements:f}=t,{mainAxis:v=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...E}=Wn(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const S=Vn(n),k=nn(d),j=Vn(d)===d,N=await(m.isRTL==null?void 0:m.isRTL(f.floating)),M=y||(j||!C?[Pf(d)]:zz(d)),D=w!=="none";!y&&D&&M.push(...Hz(d,C,w,N));const H=[d,...M],L=await m.detectOverflow(t,E),G=[];let Z=((i=o.flip)==null?void 0:i.overflows)||[];if(v&&G.push(L[S]),p){const z=Pz(n,u,N);G.push(L[z[0]],L[z[1]])}if(Z=[...Z,{placement:n,overflows:G}],!G.every(z=>z<=0)){var q,P;const z=(((q=o.flip)==null?void 0:q.index)||0)+1,I=H[z];if(I&&(!(p==="alignment"?k!==nn(I):!1)||Z.every(U=>nn(U.placement)===k?U.overflows[0]>0:!0)))return{data:{index:z,overflows:Z},reset:{placement:I}};let A=(P=Z.filter($=>$.overflows[0]<=0).sort(($,U)=>$.overflows[1]-U.overflows[1])[0])==null?void 0:P.placement;if(!A)switch(b){case"bestFit":{var B;const $=(B=Z.filter(U=>{if(D){const F=nn(U.placement);return F===k||F==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(F=>F>0).reduce((F,W)=>F+W,0)]).sort((U,F)=>U[1]-F[1])[0])==null?void 0:B[0];$&&(A=$);break}case"initialPlacement":A=d;break}if(n!==A)return{reset:{placement:A}}}return{}}}};function fC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mC(e){return Oz.some(t=>e[t]>=0)}const Kz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:n="referenceHidden",...o}=Wn(e,t);switch(n){case"referenceHidden":{const u=await i.detectOverflow(t,{...o,elementContext:"reference"}),d=fC(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:mC(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...o,altBoundary:!0}),d=fC(u,r.floating);return{data:{escapedOffsets:d,escaped:mC(d)}}}default:return{}}}}},tR=new Set(["left","top"]);async function Xz(e,t){const{placement:r,platform:i,elements:n}=e,o=await(i.isRTL==null?void 0:i.isRTL(n.floating)),u=Vn(r),d=oc(r),m=nn(r)==="y",f=tR.has(u)?-1:1,v=o&&m?-1:1,p=Wn(t,e);let{mainAxis:y,crossAxis:b,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"&&(b=d==="end"?w*-1:w),m?{x:b*v,y:y*f}:{x:y*f,y:b*v}}const Zz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:n,y:o,placement:u,middlewareData:d}=t,m=await Xz(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:n+m.x,y:o+m.y,data:{...m,placement:u}}}}},Qz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:n,platform:o}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:S=>{let{x:k,y:j}=S;return{x:k,y:j}}},...f}=Wn(e,t),v={x:r,y:i},p=await o.detectOverflow(t,f),y=nn(Vn(n)),b=E0(y);let w=v[b],C=v[y];if(u){const S=b==="y"?"top":"left",k=b==="y"?"bottom":"right",j=w+p[S],N=w-p[k];w=j_(j,w,N)}if(d){const S=y==="y"?"top":"left",k=y==="y"?"bottom":"right",j=C+p[S],N=C-p[k];C=j_(j,C,N)}const E=m.fn({...t,[b]:w,[y]:C});return{...E,data:{x:E.x-r,y:E.y-i,enabled:{[b]:u,[y]:d}}}}}},Jz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:n,rects:o,middlewareData:u}=t,{offset:d=0,mainAxis:m=!0,crossAxis:f=!0}=Wn(e,t),v={x:r,y:i},p=nn(n),y=E0(p);let b=v[y],w=v[p];const C=Wn(d,t),E=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const j=y==="y"?"height":"width",N=o.reference[y]-o.floating[j]+E.mainAxis,M=o.reference[y]+o.reference[j]-E.mainAxis;b<N?b=N:b>M&&(b=M)}if(f){var S,k;const j=y==="y"?"width":"height",N=tR.has(Vn(n)),M=o.reference[p]-o.floating[j]+(N&&((S=u.offset)==null?void 0:S[p])||0)+(N?0:E.crossAxis),D=o.reference[p]+o.reference[j]+(N?0:((k=u.offset)==null?void 0:k[p])||0)-(N?E.crossAxis:0);w<M?w=M:w>D&&(w=D)}return{[y]:b,[p]:w}}}},eI=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:n,rects:o,platform:u,elements:d}=t,{apply:m=()=>{},...f}=Wn(e,t),v=await u.detectOverflow(t,f),p=Vn(n),y=oc(n),b=nn(n)==="y",{width:w,height:C}=o.floating;let E,S;p==="top"||p==="bottom"?(E=p,S=y===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(S=p,E=y==="end"?"top":"bottom");const k=C-v.top-v.bottom,j=w-v.left-v.right,N=za(C-v[E],k),M=za(w-v[S],j),D=!t.middlewareData.shift;let H=N,L=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(L=j),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(H=k),D&&!y){const Z=$i(v.left,0),q=$i(v.right,0),P=$i(v.top,0),B=$i(v.bottom,0);b?L=w-2*(Z!==0||q!==0?Z+q:$i(v.left,v.right)):H=C-2*(P!==0||B!==0?P+B:$i(v.top,v.bottom))}await m({...t,availableWidth:L,availableHeight:H});const G=await u.getDimensions(d.floating);return w!==G.width||C!==G.height?{reset:{rects:!0}}:{}}}};function bm(){return typeof window<"u"}function lc(e){return rR(e)?(e.nodeName||"").toLowerCase():"#document"}function Hi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fn(e){var t;return(t=(rR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rR(e){return bm()?e instanceof Node||e instanceof Hi(e).Node:!1}function Ls(e){return bm()?e instanceof Element||e instanceof Hi(e).Element:!1}function Kn(e){return bm()?e instanceof HTMLElement||e instanceof Hi(e).HTMLElement:!1}function pC(e){return!bm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hi(e).ShadowRoot}function ld(e){const{overflow:t,overflowX:r,overflowY:i,display:n}=Os(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&n!=="inline"&&n!=="contents"}function tI(e){return/^(table|td|th)$/.test(lc(e))}function wm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const rI=/transform|translate|scale|rotate|perspective|filter/,iI=/paint|layout|strict|content/,go=e=>!!e&&e!=="none";let wv;function N0(e){const t=Ls(e)?Os(e):e;return go(t.transform)||go(t.translate)||go(t.scale)||go(t.rotate)||go(t.perspective)||!j0()&&(go(t.backdropFilter)||go(t.filter))||rI.test(t.willChange||"")||iI.test(t.contain||"")}function sI(e){let t=Ia(e);for(;Kn(t)&&!Ql(t);){if(N0(t))return t;if(wm(t))return null;t=Ia(t)}return null}function j0(){return wv==null&&(wv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wv}function Ql(e){return/^(html|body|#document)$/.test(lc(e))}function Os(e){return Hi(e).getComputedStyle(e)}function Sm(e){return Ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ia(e){if(lc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pC(e)&&e.host||fn(e);return pC(t)?t.host:t}function iR(e){const t=Ia(e);return Ql(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kn(t)&&ld(t)?t:iR(t)}function Hu(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=iR(e),o=n===((i=e.ownerDocument)==null?void 0:i.body),u=Hi(n);if(o){const d=T_(u);return t.concat(u,u.visualViewport||[],ld(n)?n:[],d&&r?Hu(d):[])}else return t.concat(n,Hu(n,[],r))}function T_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sR(e){const t=Os(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=Kn(e),o=n?e.offsetWidth:r,u=n?e.offsetHeight:i,d=Bf(r)!==o||Bf(i)!==u;return d&&(r=o,i=u),{width:r,height:i,$:d}}function A0(e){return Ls(e)?e:e.contextElement}function Yl(e){const t=A0(e);if(!Kn(t))return on(1);const r=t.getBoundingClientRect(),{width:i,height:n,$:o}=sR(t);let u=(o?Bf(r.width):r.width)/i,d=(o?Bf(r.height):r.height)/n;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const nI=on(0);function nR(e){const t=Hi(e);return!j0()||!t.visualViewport?nI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aI(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Hi(e)?!1:t}function Mo(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=A0(e);let u=on(1);t&&(i?Ls(i)&&(u=Yl(i)):u=Yl(e));const d=aI(o,r,i)?nR(o):on(0);let m=(n.left+d.x)/u.x,f=(n.top+d.y)/u.y,v=n.width/u.x,p=n.height/u.y;if(o){const y=Hi(o),b=i&&Ls(i)?Hi(i):i;let w=y,C=T_(w);for(;C&&i&&b!==w;){const E=Yl(C),S=C.getBoundingClientRect(),k=Os(C),j=S.left+(C.clientLeft+parseFloat(k.paddingLeft))*E.x,N=S.top+(C.clientTop+parseFloat(k.paddingTop))*E.y;m*=E.x,f*=E.y,v*=E.x,p*=E.y,m+=j,f+=N,w=Hi(C),C=T_(w)}}return zf({width:v,height:p,x:m,y:f})}function Cm(e,t){const r=Sm(e).scrollLeft;return t?t.left+r:Mo(fn(e)).left+r}function aR(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-Cm(e,r),n=r.top+t.scrollTop;return{x:i,y:n}}function oI(e){let{elements:t,rect:r,offsetParent:i,strategy:n}=e;const o=n==="fixed",u=fn(i),d=t?wm(t.floating):!1;if(i===u||d&&o)return r;let m={scrollLeft:0,scrollTop:0},f=on(1);const v=on(0),p=Kn(i);if((p||!p&&!o)&&((lc(i)!=="body"||ld(u))&&(m=Sm(i)),p)){const b=Mo(i);f=Yl(i),v.x=b.x+i.clientLeft,v.y=b.y+i.clientTop}const y=u&&!p&&!o?aR(u,m):on(0);return{width:r.width*f.x,height:r.height*f.y,x:r.x*f.x-m.scrollLeft*f.x+v.x+y.x,y:r.y*f.y-m.scrollTop*f.y+v.y+y.y}}function lI(e){return Array.from(e.getClientRects())}function cI(e){const t=fn(e),r=Sm(e),i=e.ownerDocument.body,n=$i(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=$i(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+Cm(e);const d=-r.scrollTop;return Os(i).direction==="rtl"&&(u+=$i(t.clientWidth,i.clientWidth)-n),{width:n,height:o,x:u,y:d}}const gC=25;function uI(e,t){const r=Hi(e),i=fn(e),n=r.visualViewport;let o=i.clientWidth,u=i.clientHeight,d=0,m=0;if(n){o=n.width,u=n.height;const v=j0();(!v||v&&t==="fixed")&&(d=n.offsetLeft,m=n.offsetTop)}const f=Cm(i);if(f<=0){const v=i.ownerDocument,p=v.body,y=getComputedStyle(p),b=v.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-b);w<=gC&&(o-=w)}else f<=gC&&(o+=f);return{width:o,height:u,x:d,y:m}}function dI(e,t){const r=Mo(e,!0,t==="fixed"),i=r.top+e.clientTop,n=r.left+e.clientLeft,o=Kn(e)?Yl(e):on(1),u=e.clientWidth*o.x,d=e.clientHeight*o.y,m=n*o.x,f=i*o.y;return{width:u,height:d,x:m,y:f}}function vC(e,t,r){let i;if(t==="viewport")i=uI(e,r);else if(t==="document")i=cI(fn(e));else if(Ls(t))i=dI(t,r);else{const n=nR(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zf(i)}function oR(e,t){const r=Ia(e);return r===t||!Ls(r)||Ql(r)?!1:Os(r).position==="fixed"||oR(r,t)}function hI(e,t){const r=t.get(e);if(r)return r;let i=Hu(e,[],!1).filter(d=>Ls(d)&&lc(d)!=="body"),n=null;const o=Os(e).position==="fixed";let u=o?Ia(e):e;for(;Ls(u)&&!Ql(u);){const d=Os(u),m=N0(u);!m&&d.position==="fixed"&&(n=null),(o?!m&&!n:!m&&d.position==="static"&&!!n&&(n.position==="absolute"||n.position==="fixed")||ld(u)&&!m&&oR(e,u))?i=i.filter(v=>v!==u):n=d,u=Ia(u)}return t.set(e,i),i}function fI(e){let{element:t,boundary:r,rootBoundary:i,strategy:n}=e;const u=[...r==="clippingAncestors"?wm(t)?[]:hI(t,this._c):[].concat(r),i],d=vC(t,u[0],n);let m=d.top,f=d.right,v=d.bottom,p=d.left;for(let y=1;y<u.length;y++){const b=vC(t,u[y],n);m=$i(b.top,m),f=za(b.right,f),v=za(b.bottom,v),p=$i(b.left,p)}return{width:f-p,height:v-m,x:p,y:m}}function mI(e){const{width:t,height:r}=sR(e);return{width:t,height:r}}function pI(e,t,r){const i=Kn(t),n=fn(t),o=r==="fixed",u=Mo(e,!0,o,t);let d={scrollLeft:0,scrollTop:0};const m=on(0);function f(){m.x=Cm(n)}if(i||!i&&!o)if((lc(t)!=="body"||ld(n))&&(d=Sm(t)),i){const b=Mo(t,!0,o,t);m.x=b.x+t.clientLeft,m.y=b.y+t.clientTop}else n&&f();o&&!i&&n&&f();const v=n&&!i&&!o?aR(n,d):on(0),p=u.left+d.scrollLeft-m.x-v.x,y=u.top+d.scrollTop-m.y-v.y;return{x:p,y,width:u.width,height:u.height}}function Sv(e){return Os(e).position==="static"}function _C(e,t){if(!Kn(e)||Os(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return fn(e)===r&&(r=r.ownerDocument.body),r}function lR(e,t){const r=Hi(e);if(wm(e))return r;if(!Kn(e)){let n=Ia(e);for(;n&&!Ql(n);){if(Ls(n)&&!Sv(n))return n;n=Ia(n)}return r}let i=_C(e,t);for(;i&&tI(i)&&Sv(i);)i=_C(i,t);return i&&Ql(i)&&Sv(i)&&!N0(i)?r:i||sI(e)||r}const gI=async function(e){const t=this.getOffsetParent||lR,r=this.getDimensions,i=await r(e.floating);return{reference:pI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function vI(e){return Os(e).direction==="rtl"}const _I={convertOffsetParentRelativeRectToViewportRelativeRect:oI,getDocumentElement:fn,getClippingRect:fI,getOffsetParent:lR,getElementRects:gI,getClientRects:lI,getDimensions:mI,getScale:Yl,isElement:Ls,isRTL:vI};function cR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xI(e,t){let r=null,i;const n=fn(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 f=e.getBoundingClientRect(),{left:v,top:p,width:y,height:b}=f;if(d||t(),!y||!b)return;const w=Uh(p),C=Uh(n.clientWidth-(v+y)),E=Uh(n.clientHeight-(p+b)),S=Uh(v),j={rootMargin:-w+"px "+-C+"px "+-E+"px "+-S+"px",threshold:$i(0,za(1,m))||1};let N=!0;function M(D){const H=D[0].intersectionRatio;if(H!==m){if(!N)return u();H?u(!1,H):i=setTimeout(()=>{u(!1,1e-7)},1e3)}H===1&&!cR(f,e.getBoundingClientRect())&&u(),N=!1}try{r=new IntersectionObserver(M,{...j,root:n.ownerDocument})}catch{r=new IntersectionObserver(M,j)}r.observe(e)}return u(!0),o}function yI(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:n=!0,ancestorResize:o=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,f=A0(e),v=n||o?[...f?Hu(f):[],...t?Hu(t):[]]:[];v.forEach(S=>{n&&S.addEventListener("scroll",r,{passive:!0}),o&&S.addEventListener("resize",r)});const p=f&&d?xI(f,r):null;let y=-1,b=null;u&&(b=new ResizeObserver(S=>{let[k]=S;k&&k.target===f&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var j;(j=b)==null||j.observe(t)})),r()}),f&&!m&&b.observe(f),t&&b.observe(t));let w,C=m?Mo(e):null;m&&E();function E(){const S=Mo(e);C&&!cR(C,S)&&r(),C=S,w=requestAnimationFrame(E)}return r(),()=>{var S;v.forEach(k=>{n&&k.removeEventListener("scroll",r),o&&k.removeEventListener("resize",r)}),p==null||p(),(S=b)==null||S.disconnect(),b=null,m&&cancelAnimationFrame(w)}}const bI=Zz,wI=Qz,SI=Yz,CI=eI,EI=Kz,xC=Gz,kI=Jz,RI=(e,t,r)=>{const i=new Map,n={platform:_I,...r},o={...n.platform,_c:i};return Vz(e,t,{...n,platform:o})};var NI=typeof document<"u",jI=function(){},hf=NI?g.useLayoutEffect:jI;function If(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,n;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(!If(e[i],t[i]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,n[i]))return!1;for(i=r;i--!==0;){const o=n[i];if(!(o==="_owner"&&e.$$typeof)&&!If(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function uR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yC(e,t){const r=uR(e);return Math.round(t*r)/r}function Cv(e){const t=g.useRef(e);return hf(()=>{t.current=e}),t}function AI(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:n,elements:{reference:o,floating:u}={},transform:d=!0,whileElementsMounted:m,open:f}=e,[v,p]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=g.useState(i);If(y,i)||b(i);const[w,C]=g.useState(null),[E,S]=g.useState(null),k=g.useCallback(U=>{U!==D.current&&(D.current=U,C(U))},[]),j=g.useCallback(U=>{U!==H.current&&(H.current=U,S(U))},[]),N=o||w,M=u||E,D=g.useRef(null),H=g.useRef(null),L=g.useRef(v),G=m!=null,Z=Cv(m),q=Cv(n),P=Cv(f),B=g.useCallback(()=>{if(!D.current||!H.current)return;const U={placement:t,strategy:r,middleware:y};q.current&&(U.platform=q.current),RI(D.current,H.current,U).then(F=>{const W={...F,isPositioned:P.current!==!1};z.current&&!If(L.current,W)&&(L.current=W,Wa.flushSync(()=>{p(W)}))})},[y,t,r,q,P]);hf(()=>{f===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,p(U=>({...U,isPositioned:!1})))},[f]);const z=g.useRef(!1);hf(()=>(z.current=!0,()=>{z.current=!1}),[]),hf(()=>{if(N&&(D.current=N),M&&(H.current=M),N&&M){if(Z.current)return Z.current(N,M,B);B()}},[N,M,B,Z,G]);const I=g.useMemo(()=>({reference:D,floating:H,setReference:k,setFloating:j}),[k,j]),A=g.useMemo(()=>({reference:N,floating:M}),[N,M]),$=g.useMemo(()=>{const U={position:r,left:0,top:0};if(!A.floating)return U;const F=yC(A.floating,v.x),W=yC(A.floating,v.y);return d?{...U,transform:"translate("+F+"px, "+W+"px)",...uR(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:W}},[r,d,A.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:B,refs:I,elements:A,floatingStyles:$}),[v,B,I,A,$])}const TI=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:n}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?xC({element:i.current,padding:n}).fn(r):{}:i?xC({element:i,padding:n}).fn(r):{}}}},MI=(e,t)=>{const r=bI(e);return{name:r.name,fn:r.fn,options:[e,t]}},DI=(e,t)=>{const r=wI(e);return{name:r.name,fn:r.fn,options:[e,t]}},LI=(e,t)=>({fn:kI(e).fn,options:[e,t]}),OI=(e,t)=>{const r=SI(e);return{name:r.name,fn:r.fn,options:[e,t]}},BI=(e,t)=>{const r=CI(e);return{name:r.name,fn:r.fn,options:[e,t]}},PI=(e,t)=>{const r=EI(e);return{name:r.name,fn:r.fn,options:[e,t]}},zI=(e,t)=>{const r=TI(e);return{name:r.name,fn:r.fn,options:[e,t]}};var II="Arrow",dR=g.forwardRef((e,t)=>{const{children:r,width:i=10,height:n=5,...o}=e;return l.jsx(Ye.svg,{...o,ref:t,width:i,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});dR.displayName=II;var $I=dR;function UI(e){const[t,r]=g.useState(void 0);return rr(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const o=n[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;u=f.inlineSize,d=f.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 T0="Popper",[hR,Em]=Is(T0),[HI,fR]=hR(T0),mR=e=>{const{__scopePopper:t,children:r}=e,[i,n]=g.useState(null),[o,u]=g.useState(void 0);return l.jsx(HI,{scope:t,anchor:i,onAnchorChange:n,placementState:o,setPlacementState:u,children:r})};mR.displayName=T0;var pR="PopperAnchor",gR=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...n}=e,o=fR(pR,r),u=g.useRef(null),d=o.onAnchorChange,m=g.useCallback(w=>{u.current=w,w&&d(w)},[d]),f=nt(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&&D0(o.placementState),y=p==null?void 0:p[0],b=p==null?void 0:p[1];return i?null:l.jsx(Ye.div,{"data-radix-popper-side":y,"data-radix-popper-align":b,...n,ref:f})});gR.displayName=pR;var M0="PopperContent",[FI,qI]=hR(M0),vR=g.forwardRef((e,t)=>{var ne,de,Ae,ke,Ee,re;const{__scopePopper:r,side:i="bottom",sideOffset:n=0,align:o="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:v=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:w,...C}=e,E=fR(M0,r),[S,k]=g.useState(null),j=nt(t,k),[N,M]=g.useState(null),D=UI(N),H=(D==null?void 0:D.width)??0,L=(D==null?void 0:D.height)??0,G=i+(o!=="center"?"-"+o:""),Z=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},q=Array.isArray(f)?f:[f],P=q.length>0,B={padding:Z,boundary:q.filter(VI),altBoundary:P},{refs:z,floatingStyles:I,placement:A,isPositioned:$,middlewareData:U}=AI({strategy:"fixed",placement:G,whileElementsMounted:(...te)=>yI(...te,{animationFrame:b==="always"}),elements:{reference:E.anchor},middleware:[MI({mainAxis:n+L,alignmentAxis:u}),m&&DI({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?LI():void 0,...B}),m&&OI({...B}),BI({...B,apply:({elements:te,rects:Ce,availableWidth:me,availableHeight:je})=>{const{width:We,height:Te}=Ce.reference,ze=te.floating.style;ze.setProperty("--radix-popper-available-width",`${me}px`),ze.setProperty("--radix-popper-available-height",`${je}px`),ze.setProperty("--radix-popper-anchor-width",`${We}px`),ze.setProperty("--radix-popper-anchor-height",`${Te}px`)}}),N&&zI({element:N,padding:d}),GI({arrowWidth:H,arrowHeight:L}),y&&PI({strategy:"referenceHidden",...B,boundary:P?B.boundary:void 0})]}),F=E.setPlacementState;rr(()=>(F(A),()=>{F(void 0)}),[A,F]);const[W,T]=D0(A),V=Nr(w);rr(()=>{$&&(V==null||V())},[$,V]);const K=(ne=U.arrow)==null?void 0:ne.x,J=(de=U.arrow)==null?void 0:de.y,oe=((Ae=U.arrow)==null?void 0:Ae.centerOffset)!==0,[ce,Y]=g.useState();return rr(()=>{S&&Y(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ke=U.transformOrigin)==null?void 0:ke.x,(Ee=U.transformOrigin)==null?void 0:Ee.y].join(" "),...((re=U.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(FI,{scope:r,placedSide:W,placedAlign:T,onArrowChange:M,arrowX:K,arrowY:J,shouldHideArrow:oe,children:l.jsx(Ye.div,{"data-side":W,"data-align":T,...C,ref:j,style:{...C.style,animation:$?void 0:"none"}})})})});vR.displayName=M0;var _R="PopperArrow",WI={top:"bottom",right:"left",bottom:"top",left:"right"},xR=g.forwardRef(function(t,r){const{__scopePopper:i,...n}=t,o=qI(_R,i),u=WI[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($I,{...n,ref:r,style:{...n.style,display:"block"}})})});xR.displayName=_R;function VI(e){return e!==null}var GI=e=>({name:"transformOrigin",options:e,fn(t){var E,S,k;const{placement:r,rects:i,middlewareData:n}=t,u=((E=n.arrow)==null?void 0:E.centerOffset)!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[f,v]=D0(r),p={start:"0%",center:"50%",end:"100%"}[v],y=(((S=n.arrow)==null?void 0:S.x)??0)+d/2,b=(((k=n.arrow)==null?void 0:k.y)??0)+m/2;let w="",C="";return f==="bottom"?(w=u?p:`${y}px`,C=`${-m}px`):f==="top"?(w=u?p:`${y}px`,C=`${i.floating.height+m}px`):f==="right"?(w=`${-m}px`,C=u?p:`${b}px`):f==="left"&&(w=`${i.floating.width+m}px`,C=u?p:`${b}px`),{data:{x:w,y:C}}}});function D0(e){const[t,r="center"]=e.split("-");return[t,r]}var yR=mR,bR=gR,wR=vR,SR=xR,Ev=!1;function YI(){const[e,t]=g.useState(Ev);return g.useEffect(()=>{Ev||(Ev=!0,t(!0))},[]),e}var CR=Ha[" useSyncExternalStore ".trim().toString()];function KI(){return()=>{}}function XI(){return CR(KI,()=>!0,()=>!1)}var ZI=typeof CR=="function"?XI:YI,kv="rovingFocusGroup.onEntryFocus",QI={bubbles:!1,cancelable:!0},cd="RovingFocusGroup",[M_,ER,JI]=C0(cd),[e8,km]=Is(cd,[JI]),[t8,r8]=e8(cd),kR=g.forwardRef((e,t)=>l.jsx(M_.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(M_.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(i8,{...e,ref:t})})}));kR.displayName=cd;var i8=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:n=!1,dir:o,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:v=!1,...p}=e,y=g.useRef(null),b=nt(t,y),w=od(o),[C,E]=Ao({prop:u,defaultProp:d??null,onChange:m,caller:cd}),[S,k]=g.useState(!1),j=Nr(f),N=ER(r),M=g.useRef(!1),[D,H]=g.useState(0);return g.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(kv,j),()=>L.removeEventListener(kv,j)},[j]),l.jsx(t8,{scope:r,orientation:i,dir:w,loop:n,currentTabStopId:C,onItemFocus:g.useCallback(L=>E(L),[E]),onItemShiftTab:g.useCallback(()=>k(!0),[]),onFocusableItemAdd:g.useCallback(()=>H(L=>L+1),[]),onFocusableItemRemove:g.useCallback(()=>H(L=>L-1),[]),children:l.jsx(Ye.div,{tabIndex:S||D===0?-1:0,"data-orientation":i,...p,ref:b,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{M.current=!0}),onFocus:Pe(e.onFocus,L=>{const G=!M.current;if(L.target===L.currentTarget&&G&&!S){const Z=new CustomEvent(kv,QI);if(L.currentTarget.dispatchEvent(Z),!Z.defaultPrevented){const q=N().filter(A=>A.focusable),P=q.find(A=>A.active),B=q.find(A=>A.id===C),I=[P,B,...q].filter(Boolean).map(A=>A.ref.current);jR(I,v)}}M.current=!1}),onBlur:Pe(e.onBlur,()=>k(!1))})})}),RR="RovingFocusGroupItem",NR=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:n=!1,tabStopId:o,children:u,...d}=e,m=Ds(),f=o||m,v=r8(RR,r),p=v.currentTabStopId===f,y=ER(r),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:C}=v,E=ZI();return rr(()=>{if(!(!E||!i))return b(),()=>w()},[E,i,b,w]),g.useEffect(()=>{if(!(E||!i))return b(),()=>w()},[E,i,b,w]),l.jsx(M_.ItemSlot,{scope:r,id:f,focusable:i,active:n,children:l.jsx(Ye.span,{tabIndex:p?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Pe(e.onMouseDown,S=>{i?v.onItemFocus(f):S.preventDefault()}),onFocus:Pe(e.onFocus,()=>v.onItemFocus(f)),onKeyDown:Pe(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){v.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=a8(S,v.orientation,v.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let N=y().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const M=N.indexOf(S.currentTarget);N=v.loop?o8(N,M+1):N.slice(M+1)}setTimeout(()=>jR(N))}}),children:typeof u=="function"?u({isCurrentTabStop:p,hasTabStop:C!=null}):u})})});NR.displayName=RR;var s8={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function n8(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function a8(e,t,r){const i=n8(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return s8[i]}function jR(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function o8(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var AR=kR,TR=NR,D_=["Enter"," "],l8=["ArrowDown","PageUp","Home"],MR=["ArrowUp","PageDown","End"],c8=[...l8,...MR],u8={ltr:[...D_,"ArrowRight"],rtl:[...D_,"ArrowLeft"]},d8={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ud="Menu",[Fu,h8,f8]=C0(ud),[Fo,DR]=Is(ud,[f8,Em,km]),Rm=Em(),LR=km(),[m8,qo]=Fo(ud),[p8,dd]=Fo(ud),OR=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:n,onOpenChange:o,modal:u=!0}=e,d=Rm(t),[m,f]=g.useState(null),v=g.useRef(!1),p=Nr(o),y=od(n);return g.useEffect(()=>{const b=()=>{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",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),g.useEffect(()=>{if(!r)return;const b=()=>p(!1);return window.addEventListener("blur",b),()=>window.removeEventListener("blur",b)},[r,p]),l.jsx(yR,{...d,children:l.jsx(m8,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:f,children:l.jsx(p8,{scope:t,onClose:g.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:v,dir:y,modal:u,children:i})})})};OR.displayName=ud;var g8="MenuAnchor",L0=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,n=Rm(r);return l.jsx(bR,{...n,...i,ref:t})});L0.displayName=g8;var O0="MenuPortal",[v8,BR]=Fo(O0,{forceMount:void 0}),PR=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:n}=e,o=qo(O0,t);return l.jsx(v8,{scope:t,forceMount:r,children:l.jsx($s,{present:r||o.open,children:l.jsx(hm,{asChild:!0,container:n,children:i})})})};PR.displayName=O0;var ms="MenuContent",[_8,B0]=Fo(ms),zR=g.forwardRef((e,t)=>{const r=BR(ms,e.__scopeMenu),{forceMount:i=r.forceMount,...n}=e,o=qo(ms,e.__scopeMenu),u=dd(ms,e.__scopeMenu);return l.jsx(Fu.Provider,{scope:e.__scopeMenu,children:l.jsx($s,{present:i||o.open,children:l.jsx(Fu.Slot,{scope:e.__scopeMenu,children:u.modal?l.jsx(x8,{...n,ref:t}):l.jsx(y8,{...n,ref:t})})})})}),x8=g.forwardRef((e,t)=>{const r=qo(ms,e.__scopeMenu),i=g.useRef(null),n=nt(t,i);return g.useEffect(()=>{const o=i.current;if(o)return p0(o)},[]),l.jsx(P0,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),y8=g.forwardRef((e,t)=>{const r=qo(ms,e.__scopeMenu);return l.jsx(P0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),b8=To("MenuContent.ScrollLock"),P0=g.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:y,onDismiss:b,disableOutsideScroll:w,...C}=e,E=qo(ms,r),S=dd(ms,r),k=Rm(r),j=LR(r),N=h8(r),[M,D]=g.useState(null),H=g.useRef(null),L=nt(t,H,E.onContentChange),G=g.useRef(0),Z=g.useRef(""),q=g.useRef(0),P=g.useRef(null),B=g.useRef("right"),z=g.useRef(0),I=w?mm:g.Fragment,A=w?{as:b8,allowPinchZoom:!0}:void 0,$=F=>{var Y,ne;const W=Z.current+F,T=N().filter(de=>!de.disabled),V=document.activeElement,K=(Y=T.find(de=>de.ref.current===V))==null?void 0:Y.textValue,J=T.map(de=>de.textValue),oe=D8(J,W,K),ce=(ne=T.find(de=>de.textValue===oe))==null?void 0:ne.ref.current;(function de(Ae){Z.current=Ae,window.clearTimeout(G.current),Ae!==""&&(G.current=window.setTimeout(()=>de(""),1e3))})(W),ce&&setTimeout(()=>ce.focus())};g.useEffect(()=>()=>window.clearTimeout(G.current),[]),m0();const U=g.useCallback(F=>{var T,V;return B.current===((T=P.current)==null?void 0:T.side)&&O8(F,(V=P.current)==null?void 0:V.area)},[]);return l.jsx(_8,{scope:r,searchRef:Z,onItemEnter:g.useCallback(F=>{U(F)&&F.preventDefault()},[U]),onItemLeave:g.useCallback(F=>{var W;U(F)||((W=H.current)==null||W.focus(),D(null))},[U]),onTriggerLeave:g.useCallback(F=>{U(F)&&F.preventDefault()},[U]),pointerGraceTimerRef:q,onPointerGraceIntentChange:g.useCallback(F=>{P.current=F},[]),children:l.jsx(I,{...A,children:l.jsx(dm,{asChild:!0,trapped:n,onMountAutoFocus:Pe(o,F=>{var W;F.preventDefault(),(W=H.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:l.jsx(um,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:y,onDismiss:b,children:l.jsx(AR,{asChild:!0,...j,dir:S.dir,orientation:"vertical",loop:i,currentTabStopId:M,onCurrentTabStopIdChange:D,onEntryFocus:Pe(m,F=>{S.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(wR,{role:"menu","aria-orientation":"vertical","data-state":eN(E.open),"data-radix-menu-content":"",dir:S.dir,...k,...C,ref:L,style:{outline:"none",...C.style},onKeyDown:Pe(C.onKeyDown,F=>{const T=F.target.closest("[data-radix-menu-content]")===F.currentTarget,V=F.ctrlKey||F.altKey||F.metaKey,K=F.key.length===1;T&&(F.key==="Tab"&&F.preventDefault(),!V&&K&&$(F.key));const J=H.current;if(F.target!==J||!c8.includes(F.key))return;F.preventDefault();const ce=N().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);MR.includes(F.key)&&ce.reverse(),T8(ce)}),onBlur:Pe(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(G.current),Z.current="")}),onPointerMove:Pe(e.onPointerMove,qu(F=>{const W=F.target,T=z.current!==F.clientX;if(F.currentTarget.contains(W)&&T){const V=F.clientX>z.current?"right":"left";B.current=V,z.current=F.clientX}}))})})})})})})});zR.displayName=ms;var w8="MenuGroup",z0=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ye.div,{role:"group",...i,ref:t})});z0.displayName=w8;var S8="MenuLabel",IR=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ye.div,{...i,ref:t})});IR.displayName=S8;var $f="MenuItem",bC="menu.itemSelect",Nm=g.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...n}=e,o=g.useRef(null),u=dd($f,e.__scopeMenu),d=B0($f,e.__scopeMenu),m=nt(t,o),f=g.useRef(!1),v=()=>{const p=o.current;if(!r&&p){const y=new CustomEvent(bC,{bubbles:!0,cancelable:!0});p.addEventListener(bC,b=>i==null?void 0:i(b),{once:!0}),KE(p,y),y.defaultPrevented?f.current=!1:u.onClose()}};return l.jsx($R,{...n,ref:m,disabled:r,onClick:Pe(e.onClick,v),onPointerDown:p=>{var y;(y=e.onPointerDown)==null||y.call(e,p),f.current=!0},onPointerUp:Pe(e.onPointerUp,p=>{var y;f.current||(y=p.currentTarget)==null||y.click()}),onKeyDown:Pe(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||D_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});Nm.displayName=$f;var $R=g.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:n,...o}=e,u=B0($f,r),d=LR(r),m=g.useRef(null),f=nt(t,m),[v,p]=g.useState(!1),[y,b]=g.useState("");return g.useEffect(()=>{const w=m.current;w&&b((w.textContent??"").trim())},[o.children]),l.jsx(Fu.ItemSlot,{scope:r,disabled:i,textValue:n??y,children:l.jsx(TR,{asChild:!0,...d,focusable:!i,children:l.jsx(Ye.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:f,onPointerMove:Pe(e.onPointerMove,qu(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Pe(e.onPointerLeave,qu(w=>u.onItemLeave(w))),onFocus:Pe(e.onFocus,()=>p(!0)),onBlur:Pe(e.onBlur,()=>p(!1))})})})}),C8="MenuCheckboxItem",UR=g.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...n}=e;return l.jsx(VR,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nm,{role:"menuitemcheckbox","aria-checked":Uf(r)?"mixed":r,...n,ref:t,"data-state":$0(r),onSelect:Pe(n.onSelect,()=>i==null?void 0:i(Uf(r)?!0:!r),{checkForDefaultPrevented:!1})})})});UR.displayName=C8;var HR="MenuRadioGroup",[E8,k8]=Fo(HR,{value:void 0,onValueChange:()=>{}}),FR=g.forwardRef((e,t)=>{const{value:r,onValueChange:i,...n}=e,o=Nr(i);return l.jsx(E8,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(z0,{...n,ref:t})})});FR.displayName=HR;var qR="MenuRadioItem",WR=g.forwardRef((e,t)=>{const{value:r,...i}=e,n=k8(qR,e.__scopeMenu),o=r===n.value;return l.jsx(VR,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nm,{role:"menuitemradio","aria-checked":o,...i,ref:t,"data-state":$0(o),onSelect:Pe(i.onSelect,()=>{var u;return(u=n.onValueChange)==null?void 0:u.call(n,r)},{checkForDefaultPrevented:!1})})})});WR.displayName=qR;var I0="MenuItemIndicator",[VR,R8]=Fo(I0,{checked:!1}),GR=g.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...n}=e,o=R8(I0,r);return l.jsx($s,{present:i||Uf(o.checked)||o.checked===!0,children:l.jsx(Ye.span,{...n,ref:t,"data-state":$0(o.checked)})})});GR.displayName=I0;var N8="MenuSeparator",YR=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ye.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});YR.displayName=N8;var j8="MenuArrow",KR=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,n=Rm(r);return l.jsx(SR,{...n,...i,ref:t})});KR.displayName=j8;var A8="MenuSub",[VX,XR]=Fo(A8),Eu="MenuSubTrigger",ZR=g.forwardRef((e,t)=>{const r=qo(Eu,e.__scopeMenu),i=dd(Eu,e.__scopeMenu),n=XR(Eu,e.__scopeMenu),o=B0(Eu,e.__scopeMenu),u=g.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},v=g.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);g.useEffect(()=>v,[v]),g.useEffect(()=>{const y=d.current;return()=>{window.clearTimeout(y),m(null)}},[d,m]);const p=nt(t,n.onTriggerChange);return l.jsx(L0,{asChild:!0,...f,children:l.jsx($R,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?n.contentId:void 0,"data-state":eN(r.open),...e,ref:p,onClick:y=>{var b;(b=e.onClick)==null||b.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Pe(e.onPointerMove,qu(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(o.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),v()},100))})),onPointerLeave:Pe(e.onPointerLeave,qu(y=>{var w,C;v();const b=(w=r.content)==null?void 0:w.getBoundingClientRect();if(b){const E=(C=r.content)==null?void 0:C.dataset.side,S=E==="right",k=S?-5:5,j=b[S?"left":"right"],N=b[S?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+k,y:y.clientY},{x:j,y:b.top},{x:N,y:b.top},{x:N,y:b.bottom},{x:j,y:b.bottom}],side:E}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Pe(e.onKeyDown,y=>{var w;e.disabled||y.target!==y.currentTarget||o.searchRef.current!==""&&y.key===" "||u8[i.dir].includes(y.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),y.preventDefault())})})})});ZR.displayName=Eu;var QR="MenuSubContent",JR=g.forwardRef((e,t)=>{const r=BR(ms,e.__scopeMenu),{forceMount:i=r.forceMount,align:n="start",...o}=e,u=qo(ms,e.__scopeMenu),d=dd(ms,e.__scopeMenu),m=XR(QR,e.__scopeMenu),f=g.useRef(null),v=nt(t,f);return l.jsx(Fu.Provider,{scope:e.__scopeMenu,children:l.jsx($s,{present:i||u.open,children:l.jsx(Fu.Slot,{scope:e.__scopeMenu,children:l.jsx(P0,{id:m.contentId,"aria-labelledby":m.triggerId,...o,ref:v,align:n,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var y;d.isUsingKeyboardRef.current&&((y=f.current)==null||y.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Pe(e.onFocusOutside,p=>{p.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Pe(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Pe(e.onKeyDown,p=>{var w;const y=p.currentTarget.contains(p.target),b=d8[d.dir].includes(p.key);y&&b&&(u.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});JR.displayName=QR;function eN(e){return e?"open":"closed"}function Uf(e){return e==="indeterminate"}function $0(e){return Uf(e)?"indeterminate":e?"checked":"unchecked"}function T8(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function M8(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function D8(e,t,r){const n=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=M8(e,Math.max(o,0));n.length===1&&(u=u.filter(f=>f!==r));const m=u.find(f=>f.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function L8(e,t){const{x:r,y:i}=e;let n=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const d=t[o],m=t[u],f=d.x,v=d.y,p=m.x,y=m.y;v>i!=y>i&&r<(p-f)*(i-v)/(y-v)+f&&(n=!n)}return n}function O8(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return L8(r,t)}function qu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var B8=OR,P8=L0,z8=PR,I8=zR,$8=z0,U8=IR,H8=Nm,F8=UR,q8=FR,W8=WR,V8=GR,G8=YR,Y8=KR,K8=ZR,X8=JR,jm="DropdownMenu",[Z8]=Is(jm,[DR]),pi=DR(),[Q8,tN]=Z8(jm),rN=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:n,defaultOpen:o,onOpenChange:u,modal:d=!0}=e,m=pi(t),f=g.useRef(null),[v,p]=Ao({prop:n,defaultProp:o??!1,onChange:u,caller:jm});return l.jsx(Q8,{scope:t,triggerId:Ds(),triggerRef:f,contentId:Ds(),open:v,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(y=>!y),[p]),modal:d,children:l.jsx(B8,{...m,open:v,onOpenChange:p,dir:i,modal:d,children:r})})};rN.displayName=jm;var iN="DropdownMenuTrigger",sN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...n}=e,o=tN(iN,r),u=pi(r),d=nt(t,o.triggerRef);return l.jsx(P8,{asChild:!0,...u,children:l.jsx(Ye.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,...n,ref:d,onPointerDown:Pe(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(o.onOpenToggle(),o.open||m.preventDefault())}),onKeyDown:Pe(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&o.onOpenToggle(),m.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});sN.displayName=iN;var J8="DropdownMenuPortal",nN=e=>{const{__scopeDropdownMenu:t,...r}=e,i=pi(t);return l.jsx(z8,{...i,...r})};nN.displayName=J8;var aN="DropdownMenuContent",oN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=tN(aN,r),o=pi(r),u=g.useRef(!1);return l.jsx(I8,{id:n.contentId,"aria-labelledby":n.triggerId,...o,...i,ref:t,onCloseAutoFocus:Pe(e.onCloseAutoFocus,d=>{var m;u.current||(m=n.triggerRef.current)==null||m.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Pe(e.onInteractOutside,d=>{const m=d.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,v=m.button===2||f;(!n.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)"}})});oN.displayName=aN;var e7="DropdownMenuGroup",t7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx($8,{...n,...i,ref:t})});t7.displayName=e7;var r7="DropdownMenuLabel",i7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(U8,{...n,...i,ref:t})});i7.displayName=r7;var s7="DropdownMenuItem",lN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(H8,{...n,...i,ref:t})});lN.displayName=s7;var n7="DropdownMenuCheckboxItem",a7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(F8,{...n,...i,ref:t})});a7.displayName=n7;var o7="DropdownMenuRadioGroup",l7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(q8,{...n,...i,ref:t})});l7.displayName=o7;var c7="DropdownMenuRadioItem",u7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(W8,{...n,...i,ref:t})});u7.displayName=c7;var d7="DropdownMenuItemIndicator",h7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(V8,{...n,...i,ref:t})});h7.displayName=d7;var f7="DropdownMenuSeparator",m7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(G8,{...n,...i,ref:t})});m7.displayName=f7;var p7="DropdownMenuArrow",g7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(Y8,{...n,...i,ref:t})});g7.displayName=p7;var v7="DropdownMenuSubTrigger",_7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(K8,{...n,...i,ref:t})});_7.displayName=v7;var x7="DropdownMenuSubContent",y7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,n=pi(r);return l.jsx(X8,{...n,...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)"}})});y7.displayName=x7;var b7=rN,cN=sN,w7=nN,uN=oN,dN=lN;function L_(e){return l.jsx(b7,{"data-slot":"dropdown-menu",...e})}const Hf=g.forwardRef((e,t)=>l.jsx(cN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));Hf.displayName=cN.displayName;const Ff=g.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...i},n)=>l.jsx(w7,{children:l.jsx(uN,{ref:n,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:it("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})}));Ff.displayName=uN.displayName;const Wu=g.forwardRef(({className:e,variant:t="default",...r},i)=>l.jsx(dN,{ref:i,"data-slot":"dropdown-menu-item","data-variant":t,className:it("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}));Wu.displayName=dN.displayName;const At=g.forwardRef(({className:e,type:t,...r},i)=>l.jsx("input",{ref:i,type:t,"data-slot":"input",className:it("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}));At.displayName="Input";function Am({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:it("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 S7({idPrefix:e,fields:t,activeFieldId:r,answers:i,otherValues:n,otherSelections:o,errors:u={},disabled:d=!1,onNavigate:m,onAnswerChange:f,onOtherValueChange:v,onOtherSelectionChange:p}){const y=g.useRef(null),b=g.useRef(void 0),w=g.useRef(void 0),C=t.findIndex(L=>L.id===r),E=C>=0?C:0,S=t[E],k=S?u[S.id]:void 0,j=S?i[S.id]:void 0;if(g.useEffect(()=>{if(!S)return;const L=b.current!==void 0&&b.current!==S.id,G=!!k&&w.current!==k;if(b.current=S.id,w.current=k,!L&&!G)return;const Z=y.current,q=(Z==null?void 0:Z.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(Z==null?void 0:Z.querySelector("input:checked:not([disabled])"))??(Z==null?void 0:Z.querySelector("input:not([disabled]), textarea:not([disabled])"));q==null||q.focus()},[k,S]),!S)return null;const N=`${e}-field-${E}`,M=S.description?`${N}-description`:void 0,D=k?`${N}-error`:void 0,H=[M,D].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:y,children:S.type==="text"?l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("label",{htmlFor:N,className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(CC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),S.multiline&&!S.secret?l.jsx(Am,{id:N,value:typeof j=="string"?j:"",disabled:d,placeholder:S.placeholder,"aria-invalid":k?!0:void 0,"aria-describedby":H,required:S.required,onChange:L=>f(S.id,L.target.value)}):l.jsx(At,{id:N,type:S.secret?"password":"text",autoComplete:"off",value:typeof j=="string"?j:"",disabled:d,placeholder:S.placeholder,"aria-invalid":k?!0:void 0,"aria-describedby":H,required:S.required,onChange:L=>f(S.id,L.target.value)}),l.jsx(SC,{id:D,error:k})]}):l.jsxs("fieldset",{disabled:d,role:S.multiple?void 0:"radiogroup","aria-required":!S.multiple&&S.required?!0:void 0,"aria-invalid":k?!0:void 0,"aria-describedby":H,className:"grid gap-1.5",children:[l.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(CC,{})]}),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((L,G)=>{const Z=`${N}-option-${G}`,q=S.multiple?Array.isArray(j)&&j.includes(L.value):o[S.id]!==!0&&j===L.value;return l.jsx(wC,{id:Z,name:S.multiple?void 0:N,type:S.multiple?"checkbox":"radio",checked:q,label:L.label,description:L.description,onChange:P=>{if(S.multiple){const B=Array.isArray(j)?j:[];f(S.id,P?[...B.filter(z=>z!==L.value),L.value]:B.filter(z=>z!==L.value))}else f(S.id,L.value),p(S.id,!1)}},L.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(wC,{id:`${N}-other`,name:S.multiple?void 0:N,type:S.multiple?"checkbox":"radio",checked:o[S.id]===!0,label:"Other",embedded:!0,onChange:L=>{p(S.id,L),L&&!S.multiple&&f(S.id,"")}}),l.jsx(At,{value:n[S.id]??"",disabled:d||o[S.id]!==!0,"aria-label":`Other answer for ${S.label}`,"aria-invalid":k?!0:void 0,"aria-describedby":H,placeholder:"Enter another answer",onChange:L=>v(S.id,L.target.value)})]}),!S.required&&!S.multiple&&(o[S.id]===!0||typeof j=="string"&&j.length>0)&&l.jsx(ue,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{f(S.id,""),p(S.id,!1)},children:"Clear selection"})]}),l.jsx(SC,{id:D,error:k})]})}),t.length>1&&l.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[l.jsxs(ue,{type:"button",size:"xs",variant:"ghost",disabled:d||E===0,onClick:()=>m(t[E-1].id),children:[l.jsx(zE,{}),"Previous"]}),l.jsxs(ue,{type:"button",size:"xs",variant:"outline",disabled:d||E===t.length-1,onClick:()=>m(t[E+1].id),children:["Next",l.jsx(Po,{})]})]})]})}function wC({id:e,name:t,type:r,checked:i,label:n,description:o,embedded:u=!1,onChange:d}){return l.jsxs("label",{htmlFor:e,className:it("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(zs,{"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:n}),o&&l.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:o})]})]})}function SC({id:e,error:t}){return t?l.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function CC(){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 hN({className:e,size:t="default",...r}){return l.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:it("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(l0,{"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 C7=Object.defineProperty,Gn=(e,t)=>C7(e,"name",{value:t,configurable:!0});function fN(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}Gn(fN,"useStateMachine");var Tm=Gn(e=>{const{present:t,children:r}=e,i=mN(t),n=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=pN(i.ref,gN(n));return typeof r=="function"||i.isPresent?g.cloneElement(n,{ref:o}):null},"Presence");function mN(e){const[t,r]=g.useState(),i=g.useRef(null),n=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,f]=fN(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??Il(i.current),u.current=void 0):o.current="none"},[m]),rr(()=>{const v=i.current,p=n.current;if(p!==e){const b=o.current,w=Il(v);e?(u.current=w,f("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?f("UNMOUNT"):f(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,f]),rr(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,y=Gn(w=>{const E=Il(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(f("ANIMATION_END"),!n.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),b=Gn(w=>{w.target===t&&(o.current=Il(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=Il(p)}else i.current=null;r(v)},[])}}Gn(mN,"usePresence");function O_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Gn(O_,"setRef");function pN(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let n=!1;const o=i.map(u=>{const d=O_(u,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():O_(i[u],null)}}},[])}Gn(pN,"useStableComposedRefs");function Il(e){return(e==null?void 0:e.animationName)||"none"}Gn(Il,"getAnimationName");function gN(e){var i,n;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=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Gn(gN,"getElementRef");function B_(e,[t,r]){return Math.min(r,Math.max(t,e))}var E7=Object.defineProperty,cc=(e,t)=>E7(e,"name",{value:t,configurable:!0}),vN=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ba(e,t,{checkForDefaultPrevented:r=!0}={}){return cc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}cc(Ba,"composeEventHandlers");function k7(e){var t;if(!vN)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}cc(k7,"getOwnerWindow");function P_(e){if(!vN)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}cc(P_,"getOwnerDocument");function _N(e,t=!1){const{activeElement:r}=P_(e);if(!(r!=null&&r.nodeName))return null;if(xN(r)&&r.contentDocument)return _N(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const n=P_(r).getElementById(i);if(n)return n}}return r}cc(_N,"getActiveElement");function xN(e){return e.tagName==="IFRAME"}cc(xN,"isFrame");var R7=Object.defineProperty,ct=(e,t)=>R7(e,"name",{value:t,configurable:!0});function yN(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}ct(yN,"useStateMachine");var bN="ScrollArea",[wN]=Is(bN),[N7,ws]=wN(bN),j7=g.forwardRef(ct(function(t,r){const{__scopeScrollArea:i,type:n="hover",dir:o,scrollHideDelay:u=600,...d}=t,[m,f]=g.useState(null),[v,p]=g.useState(null),[y,b]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(null),[k,j]=g.useState(0),[N,M]=g.useState(0),[D,H]=g.useState(!1),[L,G]=g.useState(!1),Z=nt(r,f),q=od(o);return l.jsx(N7,{scope:i,type:n,dir:q,scrollHideDelay:u,scrollArea:m,viewport:v,onViewportChange:p,content:y,onContentChange:b,scrollbarX:w,onScrollbarXChange:C,scrollbarXEnabled:D,onScrollbarXEnabledChange:H,scrollbarY:E,onScrollbarYChange:S,scrollbarYEnabled:L,onScrollbarYEnabledChange:G,onCornerWidthChange:j,onCornerHeightChange:M,children:l.jsx(Ye.div,{dir:q,...d,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})},"ScrollArea")),A7="ScrollAreaViewport",T7=g.forwardRef(ct(function(t,r){const{__scopeScrollArea:i,children:n,nonce:o,...u}=t,d=ws(A7,i),m=g.useRef(null),f=nt(r,m,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx(M7,{nonce:o}),l.jsx(Ye.div,{"data-radix-scroll-area-viewport":"",...u,ref:f,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:n})})]})},"ScrollAreaViewport")),M7=g.memo(ct(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),Xn="ScrollAreaScrollbar",SN=g.forwardRef(ct(function(t,r){const{forceMount:i,...n}=t,o=ws(Xn,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(D7,{...n,ref:r,forceMount:i}):o.type==="scroll"?l.jsx(L7,{...n,ref:r,forceMount:i}):o.type==="auto"?l.jsx(CN,{...n,ref:r,forceMount:i}):o.type==="always"?l.jsx(U0,{...n,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),D7=g.forwardRef(ct(function(t,r){const{forceMount:i,...n}=t,o=ws(Xn,t.__scopeScrollArea),[u,d]=g.useState(!1);return g.useEffect(()=>{const m=o.scrollArea;let f=0;if(m){const v=ct(()=>{window.clearTimeout(f),d(!0)},"handlePointerEnter"),p=ct(()=>{f=window.setTimeout(()=>d(!1),o.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",v),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(f),m.removeEventListener("pointerenter",v),m.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(Tm,{present:i||u,children:l.jsx(CN,{"data-state":u?"visible":"hidden",...n,ref:r})})},"ScrollAreaScrollbarHover")),L7=g.forwardRef(ct(function(t,r){const{forceMount:i,...n}=t,o=ws(Xn,t.__scopeScrollArea),u=t.orientation==="horizontal",d=fd(()=>f("SCROLL_END"),100),[m,f]=yN("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(()=>f("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(v)}},[m,o.scrollHideDelay,f]),g.useEffect(()=>{const v=o.viewport,p=u?"scrollLeft":"scrollTop";if(v){let y=v[p];const b=ct(()=>{const w=v[p];y!==w&&(f("SCROLL"),d()),y=w},"handleScroll");return v.addEventListener("scroll",b),()=>v.removeEventListener("scroll",b)}},[o.viewport,u,f,d]),l.jsx(Tm,{present:i||m!=="hidden",children:l.jsx(U0,{"data-state":m==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:Ba(t.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Ba(t.onPointerLeave,()=>f("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),CN=g.forwardRef(ct(function(t,r){const i=ws(Xn,t.__scopeScrollArea),{forceMount:n,...o}=t,[u,d]=g.useState(!1),m=t.orientation==="horizontal",f=fd(()=>{if(i.viewport){const v=i.viewport.offsetWidth<i.viewport.scrollWidth,p=i.viewport.offsetHeight<i.viewport.scrollHeight;d(m?v:p)}},10);return Do(i.viewport,f),Do(i.content,f),l.jsx(Tm,{present:n||u,children:l.jsx(U0,{"data-state":u?"visible":"hidden",...o,ref:r})})},"ScrollAreaScrollbarAuto")),U0=g.forwardRef(ct(function(t,r){const{orientation:i="vertical",...n}=t,o=ws(Xn,t.__scopeScrollArea),u=g.useRef(null),d=g.useRef(0),[m,f]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),v=H0(m.viewport,m.content),p={...n,sizes:m,onSizesChange:f,hasThumb:v>0&&v<1,onThumbChange:ct(b=>u.current=b,"onThumbChange"),onThumbPointerUp:ct(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:ct(b=>d.current=b,"onThumbPointerDown")};function y(b,w){return NN(b,d.current,m,w)}return ct(y,"getScrollPosition"),i==="horizontal"?l.jsx(O7,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollLeft,w=I_(b,m,o.dir);u.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:b=>{o.viewport&&(o.viewport.scrollLeft=b)},onDragScroll:b=>{o.viewport&&(o.viewport.scrollLeft=y(b,o.dir))}}):i==="vertical"?l.jsx(B7,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollTop,w=I_(b,m);u.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:b=>{o.viewport&&(o.viewport.scrollTop=b)},onDragScroll:b=>{o.viewport&&(o.viewport.scrollTop=y(b))}}):null},"ScrollAreaScrollbarVisible")),O7=g.forwardRef(ct(function(t,r){const{sizes:i,onSizesChange:n,...o}=t,u=ws(Xn,t.__scopeScrollArea),[d,m]=g.useState(),f=g.useRef(null),v=nt(r,f,u.onScrollbarXChange);return g.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),l.jsx(kN,{"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":hd(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,y)=>{if(u.viewport){const b=u.viewport.scrollLeft+p.deltaX;t.onWheelScroll(b),q0(b,y)&&p.preventDefault()}},onResize:()=>{f.current&&u.viewport&&d&&n({content:u.viewport.scrollWidth,viewport:u.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Vu(d.paddingLeft),paddingEnd:Vu(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),B7=g.forwardRef(ct(function(t,r){const{sizes:i,onSizesChange:n,...o}=t,u=ws(Xn,t.__scopeScrollArea),[d,m]=g.useState(),f=g.useRef(null),v=nt(r,f,u.onScrollbarYChange);return g.useEffect(()=>{f.current&&m(getComputedStyle(f.current))},[f]),l.jsx(kN,{"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":hd(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,y)=>{if(u.viewport){const b=u.viewport.scrollTop+p.deltaY;t.onWheelScroll(b),q0(b,y)&&p.preventDefault()}},onResize:()=>{f.current&&u.viewport&&d&&n({content:u.viewport.scrollHeight,viewport:u.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Vu(d.paddingTop),paddingEnd:Vu(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[P7,EN]=wN(Xn),kN=g.forwardRef(ct(function(t,r){const{__scopeScrollArea:i,sizes:n,hasThumb:o,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:f,onDragScroll:v,onWheelScroll:p,onResize:y,...b}=t,w=ws(Xn,i),[C,E]=g.useState(null),S=nt(r,E),k=g.useRef(null),j=g.useRef(""),N=w.viewport,M=n.content-n.viewport,D=Nr(p),H=Nr(f),L=fd(y,10);function G(Z){if(k.current){const q=Z.clientX-k.current.left,P=Z.clientY-k.current.top;v({x:q,y:P})}}return ct(G,"handleDragScroll"),g.useEffect(()=>{const Z=ct(q=>{const P=q.target;(C==null?void 0:C.contains(P))&&D(q,M)},"handleWheel");return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[N,C,M,D]),g.useEffect(H,[n,H]),Do(C,L),Do(w.content,L),l.jsx(P7,{scope:i,scrollbar:C,hasThumb:o,onThumbChange:Nr(u),onThumbPointerUp:Nr(d),onThumbPositionChange:H,onThumbPointerDown:Nr(m),children:l.jsx(Ye.div,{...b,ref:S,style:{position:"absolute",...b.style},onPointerDown:Ba(t.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),k.current=C.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),G(Z))}),onPointerMove:Ba(t.onPointerMove,G),onPointerUp:Ba(t.onPointerUp,Z=>{const q=Z.target;q.hasPointerCapture(Z.pointerId)&&q.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=j.current,w.viewport&&(w.viewport.style.scrollBehavior=""),k.current=null})})})},"ScrollAreaScrollbarImpl")),z_="ScrollAreaThumb",z7=g.forwardRef(ct(function(t,r){const{forceMount:i,...n}=t,o=EN(z_,t.__scopeScrollArea);return l.jsx(Tm,{present:i||o.hasThumb,children:l.jsx(I7,{ref:r,...n})})},"ScrollAreaThumb")),I7=g.forwardRef(ct(function(t,r){const{__scopeScrollArea:i,style:n,...o}=t,u=ws(z_,i),d=EN(z_,i),{onThumbPositionChange:m}=d,f=nt(r,d.onThumbChange),v=g.useRef(void 0),p=fd(()=>{v.current&&(v.current(),v.current=void 0)},100);return g.useEffect(()=>{const y=u.viewport;if(y){const b=ct(()=>{if(p(),!v.current){const w=H7(y,m);v.current=w,m()}},"handleScroll");return m(),y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)}},[u.viewport,p,m]),l.jsx(Ye.div,{"data-state":d.hasThumb?"visible":"hidden",...o,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ba(t.onPointerDownCapture,y=>{const w=y.target.getBoundingClientRect(),C=y.clientX-w.left,E=y.clientY-w.top;d.onThumbPointerDown({x:C,y:E})}),onPointerUp:Ba(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),RN="ScrollAreaCorner",$7=g.forwardRef(ct(function(t,r){const i=ws(RN,t.__scopeScrollArea),n=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&n?l.jsx(U7,{...t,ref:r}):null},"ScrollAreaCorner")),U7=g.forwardRef(ct(function(t,r){const{__scopeScrollArea:i,...n}=t,o=ws(RN,i),[u,d]=g.useState(0),[m,f]=g.useState(0),v=!!(u&&m),{onCornerWidthChange:p,onCornerHeightChange:y}=o;return Do(o.scrollbarX,()=>{var w;const b=((w=o.scrollbarX)==null?void 0:w.offsetHeight)||0;o.onCornerHeightChange(b),f(b)}),Do(o.scrollbarY,()=>{var w;const b=((w=o.scrollbarY)==null?void 0:w.offsetWidth)||0;o.onCornerWidthChange(b),d(b)}),g.useEffect(()=>()=>{p(0),y(0)},[p,y]),v?l.jsx(Ye.div,{...n,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 Vu(e){return e?parseInt(e,10):0}ct(Vu,"toInt");function H0(e,t){const r=e/t;return isNaN(r)?0:r}ct(H0,"getThumbRatio");function hd(e){const t=H0(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=(e.scrollbar.size-r)*t;return Math.max(i,18)}ct(hd,"getThumbSize");function NN(e,t,r,i="ltr"){const n=hd(r),o=n/2,u=t||o,d=n-u,m=r.scrollbar.paddingStart+u,f=r.scrollbar.size-r.scrollbar.paddingEnd-d,v=r.content-r.viewport,p=i==="ltr"?[0,v]:[v*-1,0];return F0([m,f],p)(e)}ct(NN,"getScrollPositionFromPointer");function I_(e,t,r="ltr"){const i=hd(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-n,u=t.content-t.viewport,d=o-i,m=r==="ltr"?[0,u]:[u*-1,0],f=B_(e,m);return F0([0,u],[0,d])(f)}ct(I_,"getThumbOffsetFromScroll");function F0(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])}}ct(F0,"linearScale");function q0(e,t){return e>0&&e<t}ct(q0,"isScrollingWithinScrollbarBounds");var H7=ct((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},i=0;return ct((function n(){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(n)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function fd(e,t){const r=Nr(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])}ct(fd,"useDebounceCallback");function Do(e,t){const r=Nr(t);rr(()=>{let i=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(i),n.unobserve(e)}}},[e,r])}ct(Do,"useResizeObserver");var jN=j7,F7=T7,q7=$7;const vs=g.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:i,viewportProps:n,scrollbars:o="vertical",type:u="auto",...d},m)=>l.jsxs(jN,{ref:m,"data-slot":"scroll-area",type:u,className:it("relative overflow-hidden",e),...d,children:[l.jsx(F7,{ref:i,"data-slot":"scroll-area-viewport",className:it("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),...n,children:t}),o!=="horizontal"&&l.jsx($_,{orientation:"vertical"}),o!=="vertical"&&l.jsx($_,{orientation:"horizontal"}),l.jsx(q7,{"data-slot":"scroll-area-corner"})]}));vs.displayName=jN.displayName;const $_=g.forwardRef(({className:e,orientation:t="vertical",style:r,...i},n)=>l.jsx(SN,{ref:n,"data-slot":"scroll-area-scrollbar",orientation:t,className:it("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(z7,{"data-slot":"scroll-area-thumb",className:it("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")})}));$_.displayName=SN.displayName;function W7(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 AN=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"}),V7="VisuallyHidden",G7=g.forwardRef((e,t)=>l.jsx(Ye.span,{...e,ref:t,style:{...AN,...e.style}}));G7.displayName=V7;var Y7=[" ","Enter","ArrowUp","ArrowDown"],K7=[" ","Enter"],Lo="Select",[Mm,Dm,X7]=C0(Lo),[Wo]=Is(Lo,[X7,Em]),Lm=Em(),[Z7,Ka]=Wo(Lo),[Q7,J7]=Wo(Lo),e$="SelectProvider";function TN(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:n,onOpenChange:o,value:u,defaultValue:d,onValueChange:m,dir:f,name:v,autoComplete:p,disabled:y,required:b,form:w,internal_do_not_use_render:C}=e,E=Lm(t),[S,k]=g.useState(null),[j,N]=g.useState(null),[M,D]=g.useState(!1),H=od(f),[L,G]=Ao({prop:i,defaultProp:n??!1,onChange:o,caller:Lo}),[Z,q]=Ao({prop:u,defaultProp:d,onChange:m,caller:Lo}),P=g.useRef(null),B=g.useRef(Z);g.useEffect(()=>{const V=w?S==null?void 0:S.ownerDocument.getElementById(w):S==null?void 0:S.form;if(V instanceof HTMLFormElement){const K=()=>q(B.current);return V.addEventListener("reset",K),()=>V.removeEventListener("reset",K)}},[w,S,q]);const z=S?!!w||!!S.closest("form"):!0,[I,A]=g.useState(new Set),$=Ds(),U=Array.from(I).map(V=>V.props.value).join(";"),F=g.useCallback(V=>{A(K=>new Set(K).add(V))},[]),W=g.useCallback(V=>{A(K=>{const J=new Set(K);return J.delete(V),J})},[]),T={required:b,trigger:S,onTriggerChange:k,valueNode:j,onValueNodeChange:N,valueNodeHasChildren:M,onValueNodeHasChildrenChange:D,contentId:$,value:Z,onValueChange:q,open:L,onOpenChange:G,dir:H,triggerPointerDownPosRef:P,disabled:y,name:v,autoComplete:p,form:w,nativeOptions:I,nativeSelectKey:U,isFormControl:z};return l.jsx(yR,{...E,children:l.jsx(Z7,{scope:t,...T,children:l.jsx(Mm.Provider,{scope:t,children:l.jsx(Q7,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:W,children:m$(C)?C(T):r})})})})}TN.displayName=e$;var MN=e=>{const{__scopeSelect:t,children:r,...i}=e;return l.jsx(TN,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:n})=>l.jsxs(l.Fragment,{children:[r,n?l.jsx(QN,{__scopeSelect:t}):null]})})};MN.displayName=Lo;var DN="SelectTrigger",W0=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...n}=e,o=Lm(r),u=Ka(DN,r),d=u.disabled||i,m=nt(t,u.onTriggerChange),f=Dm(r),v=g.useRef("touch"),[p,y,b]=JN(C=>{const E=f().filter(j=>!j.disabled),S=E.find(j=>j.value===u.value),k=ej(E,C,S);k!==void 0&&u.onValueChange(k.value)}),w=C=>{d||(u.onOpenChange(!0),b()),C&&(u.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return l.jsx(bR,{asChild:!0,...o,children:l.jsx(Ye.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":Om(u.value)?"":void 0,...n,ref:m,onClick:Pe(n.onClick,C=>{C.currentTarget.focus(),v.current!=="mouse"&&w(C)}),onPointerDown:Pe(n.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:Pe(n.onKeyDown,C=>{const E=p.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&y(C.key),!(E&&C.key===" ")&&Y7.includes(C.key)&&(w(),C.preventDefault())})})})});W0.displayName=DN;var LN="SelectValue",V0=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:n,children:o,placeholder:u="",...d}=e,m=Ka(LN,r),{onValueNodeHasChildrenChange:f}=m,v=o!==void 0,p=nt(t,m.onValueNodeChange);rr(()=>{f(v)},[f,v]);const y=Om(m.value);return l.jsx(Ye.span,{...d,asChild:y?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:l.jsx(g.Fragment,{children:y?u:o},y?"placeholder":"value")})});V0.displayName=LN;var t$="SelectIcon",ON=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...n}=e;return l.jsx(Ye.span,{"aria-hidden":!0,...n,ref:t,children:i||"▼"})});ON.displayName=t$;var BN="SelectPortal",[r$,i$]=Wo(BN,{forceMount:void 0}),PN=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return l.jsx(r$,{scope:e.__scopeSelect,forceMount:r,children:l.jsx(hm,{asChild:!0,...i})})};PN.displayName=BN;var $a="SelectContent",G0=g.forwardRef((e,t)=>{const r=i$($a,e.__scopeSelect),{forceMount:i=r.forceMount,...n}=e,o=Ka($a,e.__scopeSelect),[u,d]=g.useState();return rr(()=>{d(new DocumentFragment)},[]),l.jsx($s,{present:i||o.open,children:({present:m})=>m?l.jsx($N,{...n,ref:t}):l.jsx(zN,{...n,fragment:u})})});G0.displayName=$a;var zN=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:n}=e;return n?Wa.createPortal(l.jsx(IN,{scope:r,children:l.jsx(Mm.Slot,{scope:r,children:l.jsx("div",{ref:t,children:i})})}),n):null});zN.displayName="SelectContentFragment";var As=10,[IN,Xa]=Wo($a),s$="SelectContentImpl",n$=To("SelectContent.RemoveScroll"),$N=g.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:o,onPointerDownOutside:u,side:d,sideOffset:m,align:f,alignOffset:v,arrowPadding:p,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E,...S}=e,k=Ka($a,r),[j,N]=g.useState(null),[M,D]=g.useState(null),H=nt(t,N),[L,G]=g.useState(null),[Z,q]=g.useState(null),P=Dm(r),[B,z]=g.useState(!1),I=g.useRef(!1);g.useEffect(()=>{if(j)return p0(j)},[j]),m0();const A=g.useCallback(Y=>{const[ne,...de]=P().map(Ee=>Ee.ref.current),[Ae]=de.slice(-1),ke=document.activeElement;for(const Ee of Y)if(Ee===ke||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===ne&&M&&(M.scrollTop=0),Ee===Ae&&M&&(M.scrollTop=M.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==ke))return},[P,M]),$=g.useCallback(()=>A([L,j]),[A,L,j]);g.useEffect(()=>{B&&$()},[B,$]);const{onOpenChange:U,triggerPointerDownPosRef:F}=k;g.useEffect(()=>{if(j){let Y={x:0,y:0};const ne=Ae=>{var ke,Ee;Y={x:Math.abs(Math.round(Ae.pageX)-(((ke=F.current)==null?void 0:ke.x)??0)),y:Math.abs(Math.round(Ae.pageY)-(((Ee=F.current)==null?void 0:Ee.y)??0))}},de=Ae=>{Y.x<=10&&Y.y<=10?Ae.preventDefault():Ae.composedPath().includes(j)||U(!1),document.removeEventListener("pointermove",ne),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",de,{capture:!0})}}},[j,U,F]),g.useEffect(()=>{const Y=()=>U(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[U]);const[W,T]=JN(Y=>{const ne=P().filter(ke=>!ke.disabled),de=ne.find(ke=>ke.ref.current===document.activeElement),Ae=ej(ne,Y,de);Ae&&setTimeout(()=>{var ke;return(ke=Ae.ref.current)==null?void 0:ke.focus()})}),V=g.useCallback((Y,ne,de)=>{const Ae=!I.current&&!de;(k.value!==void 0&&k.value===ne||Ae)&&(G(Y),Ae&&(I.current=!0))},[k.value]),K=g.useCallback(()=>j==null?void 0:j.focus(),[j]),J=g.useCallback((Y,ne,de)=>{const Ae=!I.current&&!de;(k.value!==void 0&&k.value===ne||Ae)&&q(Y)},[k.value]),oe=i==="popper"?U_:UN,ce=oe===U_?{side:d,sideOffset:m,align:f,alignOffset:v,arrowPadding:p,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E}:{};return l.jsx(IN,{scope:r,content:j,viewport:M,onViewportChange:D,itemRefCallback:V,selectedItem:L,onItemLeave:K,itemTextRefCallback:J,focusSelectedItem:$,selectedItemText:Z,position:i,isPositioned:B,searchRef:W,children:l.jsx(mm,{as:n$,allowPinchZoom:!0,children:l.jsx(dm,{asChild:!0,trapped:k.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Pe(n,Y=>{var ne;(ne=k.trigger)==null||ne.focus({preventScroll:!0}),Y.preventDefault()}),children:l.jsx(um,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>k.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:k.contentId,"data-state":k.open?"open":"closed",dir:k.dir,onContextMenu:Y=>Y.preventDefault(),...S,...ce,onPlaced:()=>z(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Pe(S.onKeyDown,Y=>{const ne=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ne&&Y.key.length===1&&T(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let Ae=P().filter(ke=>!ke.disabled).map(ke=>ke.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const ke=Y.target,Ee=Ae.indexOf(ke);Ae=Ae.slice(Ee+1)}setTimeout(()=>A(Ae)),Y.preventDefault()}})})})})})})});$N.displayName=s$;var a$="SelectItemAlignedPosition",UN=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...n}=e,o=Ka($a,r),u=Xa($a,r),[d,m]=g.useState(null),[f,v]=g.useState(null),p=nt(t,v),y=Dm(r),b=g.useRef(!1),w=g.useRef(!0),{viewport:C,selectedItem:E,selectedItemText:S,focusSelectedItem:k}=u,j=g.useCallback(()=>{if(o.trigger&&o.valueNode&&d&&f&&C&&E&&S){const H=o.trigger.getBoundingClientRect(),L=f.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(o.dir!=="rtl"){const ke=Z.left-L.left,Ee=G.left-ke,re=H.left-Ee,te=H.width+re,Ce=Math.max(te,L.width),me=window.innerWidth-As,je=B_(Ee,[As,Math.max(As,me-Ce)]);d.style.minWidth=te+"px",d.style.left=je+"px"}else{const ke=L.right-Z.right,Ee=window.innerWidth-G.right-ke,re=window.innerWidth-H.right-Ee,te=H.width+re,Ce=Math.max(te,L.width),me=window.innerWidth-As,je=B_(Ee,[As,Math.max(As,me-Ce)]);d.style.minWidth=te+"px",d.style.right=je+"px"}const q=y(),P=window.innerHeight-As*2,B=C.scrollHeight,z=window.getComputedStyle(f),I=parseInt(z.borderTopWidth,10),A=parseInt(z.paddingTop,10),$=parseInt(z.borderBottomWidth,10),U=parseInt(z.paddingBottom,10),F=I+A+B+U+$,W=Math.min(E.offsetHeight*5,F),T=window.getComputedStyle(C),V=parseInt(T.paddingTop,10),K=parseInt(T.paddingBottom,10),J=H.top+H.height/2-As,oe=P-J,ce=E.offsetHeight/2,Y=E.offsetTop+ce,ne=I+A+Y,de=F-ne;if(ne<=J){const ke=q.length>0&&E===q[q.length-1].ref.current;d.style.bottom="0px";const Ee=f.clientHeight-C.offsetTop-C.offsetHeight,re=Math.max(oe,ce+(ke?K:0)+Ee+$),te=ne+re;d.style.height=te+"px"}else{const ke=q.length>0&&E===q[0].ref.current;d.style.top="0px";const re=Math.max(J,I+C.offsetTop+(ke?V:0)+ce)+de;d.style.height=re+"px",C.scrollTop=ne-J+C.offsetTop}d.style.margin=`${As}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=P+"px",i==null||i(),requestAnimationFrame(()=>b.current=!0)}},[y,o.trigger,o.valueNode,d,f,C,E,S,o.dir,i]);rr(()=>j(),[j]);const[N,M]=g.useState();rr(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const D=g.useCallback(H=>{H&&w.current===!0&&(j(),k==null||k(),w.current=!1)},[j,k]);return l.jsx(l$,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:b,onScrollButtonChange:D,children:l.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:l.jsx(Ye.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});UN.displayName=a$;var o$="SelectPopperPosition",U_=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:n=As,...o}=e,u=Lm(r);return l.jsx(wR,{...u,...o,ref:t,align:i,collisionPadding:n,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)"}})});U_.displayName=o$;var[l$,Y0]=Wo($a,{}),H_="SelectViewport",HN=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...n}=e,o=Xa(H_,r),u=Y0(H_,r),d=nt(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(Mm.Slot,{scope:r,children:l.jsx(Ye.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Pe(n.onScroll,f=>{const v=f.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=u;if(y!=null&&y.current&&p){const b=Math.abs(m.current-v.scrollTop);if(b>0){const w=window.innerHeight-As*2,C=parseFloat(p.style.minHeight),E=parseFloat(p.style.height),S=Math.max(C,E);if(S<w){const k=S+b,j=Math.min(w,k),N=k-j;p.style.height=j+"px",p.style.bottom==="0px"&&(v.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});HN.displayName=H_;var FN="SelectGroup",[c$,u$]=Wo(FN),K0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,n=Ds();return l.jsx(c$,{scope:r,id:n,children:l.jsx(Ye.div,{role:"group","aria-labelledby":n,...i,ref:t})})});K0.displayName=FN;var qN="SelectLabel",X0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,n=u$(qN,r);return l.jsx(Ye.div,{id:n.id,...i,ref:t})});X0.displayName=qN;var qf="SelectItem",[d$,WN]=Wo(qf),Z0=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:n=!1,textValue:o,...u}=e,d=Ka(qf,r),m=Xa(qf,r),f=d.value===i,[v,p]=g.useState(o??""),[y,b]=g.useState(!1),w=Nr(j=>{var N;return(N=m.itemRefCallback)==null?void 0:N.call(m,j,i,n)}),C=nt(t,w),E=Ds(),S=g.useRef("touch"),k=()=>{n||(d.onValueChange(i),d.onOpenChange(!1))};return l.jsx(d$,{scope:r,value:i,disabled:n,textId:E,isSelected:f,onItemTextChange:g.useCallback(j=>{p(N=>N||((j==null?void 0:j.textContent)??"").trim())},[]),children:l.jsx(Mm.ItemSlot,{scope:r,value:i,disabled:n,textValue:v,children:l.jsx(Ye.div,{role:"option","aria-labelledby":E,"data-highlighted":y?"":void 0,"aria-selected":f&&y,"data-state":f?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...u,ref:C,onFocus:Pe(u.onFocus,()=>b(!0)),onBlur:Pe(u.onBlur,()=>b(!1)),onClick:Pe(u.onClick,()=>{S.current!=="mouse"&&k()}),onPointerUp:Pe(u.onPointerUp,()=>{S.current==="mouse"&&k()}),onPointerDown:Pe(u.onPointerDown,j=>{S.current=j.pointerType}),onPointerMove:Pe(u.onPointerMove,j=>{var N;S.current=j.pointerType,n?(N=m.onItemLeave)==null||N.call(m):S.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pe(u.onPointerLeave,j=>{var N;j.currentTarget===document.activeElement&&((N=m.onItemLeave)==null||N.call(m))}),onKeyDown:Pe(u.onKeyDown,j=>{var M;n||j.target!==j.currentTarget||((M=m.searchRef)==null?void 0:M.current)!==""&&j.key===" "||(K7.includes(j.key)&&k(),j.key===" "&&j.preventDefault())})})})})});Z0.displayName=qf;var ku="SelectItemText",VN=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:n,...o}=e,u=Ka(ku,r),d=Xa(ku,r),m=WN(ku,r),f=J7(ku,r),[v,p]=g.useState(null),y=Nr(k=>{var j;return(j=d.itemTextRefCallback)==null?void 0:j.call(d,k,m.value,m.disabled)}),b=nt(t,p,m.onItemTextChange,y),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}=f;return rr(()=>(E(C),()=>S(C)),[E,S,C]),l.jsxs(l.Fragment,{children:[l.jsx(Ye.span,{id:m.textId,...o,ref:b}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Om(u.value)?Wa.createPortal(o.children,u.valueNode):null]})});VN.displayName=ku;var GN="SelectItemIndicator",YN=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return WN(GN,r).isSelected?l.jsx(Ye.span,{"aria-hidden":!0,...i,ref:t}):null});YN.displayName=GN;var F_="SelectScrollUpButton",Q0=g.forwardRef((e,t)=>{const r=Xa(F_,e.__scopeSelect),i=Y0(F_,e.__scopeSelect),[n,o]=g.useState(!1),u=nt(t,i.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollTop>0;o(f)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?l.jsx(KN,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});Q0.displayName=F_;var q_="SelectScrollDownButton",J0=g.forwardRef((e,t)=>{const r=Xa(q_,e.__scopeSelect),i=Y0(q_,e.__scopeSelect),[n,o]=g.useState(!1),u=nt(t,i.onScrollButtonChange);return rr(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<f;o(v)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?l.jsx(KN,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});J0.displayName=q_;var KN=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...n}=e,o=Xa("SelectScrollButton",r),u=g.useRef(null),d=Dm(r),m=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>m(),[m]),rr(()=>{var v;const f=d().find(p=>p.ref.current===document.activeElement);(v=f==null?void 0:f.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),l.jsx(Ye.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:Pe(n.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Pe(n.onPointerMove,()=>{var f;(f=o.onItemLeave)==null||f.call(o),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Pe(n.onPointerLeave,()=>{m()})})}),h$="SelectSeparator",ey=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return l.jsx(Ye.div,{"aria-hidden":!0,...i,ref:t})});ey.displayName=h$;var XN="SelectArrow",f$=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,n=Lm(r);return Xa(XN,r).position==="popper"?l.jsx(SR,{...n,...i,ref:t}):null});f$.displayName=XN;var ZN="SelectBubbleInput",QN=g.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Ka(ZN,e),{value:n,onValueChange:o,required:u,disabled:d,name:m,autoComplete:f,form:v}=i,{nativeOptions:p,nativeSelectKey:y}=i,b=g.useRef(null),w=nt(r,b),C=n??"",E=W7(C),S=Array.from(p).some(k=>(k.props.value??"")==="");return g.useEffect(()=>{const k=b.current;if(!k)return;const j=window.HTMLSelectElement.prototype,M=Object.getOwnPropertyDescriptor(j,"value").set;if(E!==C&&M){const D=new Event("change",{bubbles:!0});M.call(k,C),k.dispatchEvent(D)}},[E,C]),l.jsxs(Ye.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:f,disabled:d,form:v,onChange:k=>o(k.target.value),...t,style:{...AN,...t.style},ref:w,defaultValue:C,children:[Om(n)&&!S?l.jsx("option",{value:""}):null,Array.from(p)]},y)});QN.displayName=ZN;function m$(e){return typeof e=="function"}function Om(e){return e===""||e===void 0}function JN(e){const t=Nr(e),r=g.useRef(""),i=g.useRef(0),n=g.useCallback(u=>{const d=r.current+u;t(d),(function m(f){r.current=f,window.clearTimeout(i.current),f!==""&&(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,n,o]}function ej(e,t,r){const n=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=p$(e,Math.max(o,0));n.length===1&&(u=u.filter(f=>f!==r));const m=u.find(f=>f.textValue.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function p$(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function Gu(e){return l.jsx(MN,{"data-slot":"select",...e})}const ff=g.forwardRef(({className:e,...t},r)=>l.jsx(K0,{ref:r,"data-slot":"select-group",className:it("scroll-my-1 p-1",e),...t}));ff.displayName=K0.displayName;const Jl=g.forwardRef((e,t)=>l.jsx(V0,{ref:t,"data-slot":"select-value",...e}));Jl.displayName=V0.displayName;const ec=g.forwardRef(({className:e,size:t="default",children:r,...i},n)=>l.jsxs(W0,{ref:n,"data-slot":"select-trigger","data-size":t,className:it("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(ON,{asChild:!0,children:l.jsx(l0,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));ec.displayName=W0.displayName;const tj=g.forwardRef(({className:e,...t},r)=>l.jsx(Q0,{ref:r,"data-slot":"select-scroll-up-button",className:it("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(f4,{"aria-hidden":"true"})}));tj.displayName=Q0.displayName;const rj=g.forwardRef(({className:e,...t},r)=>l.jsx(J0,{ref:r,"data-slot":"select-scroll-down-button",className:it("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(l0,{"aria-hidden":"true"})}));rj.displayName=J0.displayName;const tc=g.forwardRef(({className:e,children:t,position:r="popper",align:i="center",sideOffset:n=4,collisionPadding:o=8,...u},d)=>l.jsx(PN,{children:l.jsxs(G0,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:i,sideOffset:n,collisionPadding:o,className:it("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(tj,{}),l.jsx(HN,{"data-position":r,className:it("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(rj,{})]})}));tc.displayName=G0.displayName;const mf=g.forwardRef(({className:e,...t},r)=>l.jsx(X0,{ref:r,"data-slot":"select-label",className:it("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));mf.displayName=X0.displayName;const Ui=g.forwardRef(({className:e,children:t,...r},i)=>l.jsxs(Z0,{ref:i,"data-slot":"select-item",className:it("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(YN,{children:l.jsx(zs,{"aria-hidden":"true",className:"pointer-events-none"})})}),l.jsx(VN,{children:t})]}));Ui.displayName=Z0.displayName;const Bm=g.forwardRef(({className:e,...t},r)=>l.jsx(ey,{ref:r,"data-slot":"select-separator",className:it("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));Bm.displayName=ey.displayName;var g$=Object.defineProperty,uc=(e,t)=>g$(e,"name",{value:t,configurable:!0}),ij=!!(typeof window<"u"&&window.document&&window.document.createElement);function ty(e,t,{checkForDefaultPrevented:r=!0}={}){return uc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}uc(ty,"composeEventHandlers");function v$(e){var t;if(!ij)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}uc(v$,"getOwnerWindow");function W_(e){if(!ij)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}uc(W_,"getOwnerDocument");function sj(e,t=!1){const{activeElement:r}=W_(e);if(!(r!=null&&r.nodeName))return null;if(nj(r)&&r.contentDocument)return sj(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const n=W_(r).getElementById(i);if(n)return n}}return r}uc(sj,"getActiveElement");function nj(e){return e.tagName==="IFRAME"}uc(nj,"isFrame");var _$=Object.defineProperty,ry=(e,t)=>_$(e,"name",{value:t,configurable:!0});function V_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ry(V_,"setRef");function aj(...e){return t=>{let r=!1;const i=e.map(n=>{const o=V_(n,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let n=0;n<i.length;n++){const o=i[n];typeof o=="function"?o():V_(e[n],null)}}}}ry(aj,"composeRefs");function Pm(...e){return g.useCallback(aj(...e),e)}ry(Pm,"useComposedRefs");var x$=Object.defineProperty,fs=(e,t)=>x$(e,"name",{value:t,configurable:!0});function y$(e,t){const r=g.createContext(t);r.displayName=e+"Context";const i=fs(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 n(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 fs(n,"useContext"),[i,n]}fs(y$,"createContext");function oj(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 f=fs(p=>{var S;const{scope:y,children:b,...w}=p,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})},"Provider");f.displayName=o+"Provider";function v(p,y,b={}){var S;const{optional:w=!1}=b,C=((S=y==null?void 0:y[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 fs(v,"useContext"),[f,v]}fs(i,"createContext");const n=fs(()=>{const o=r.map(u=>g.createContext(u));return fs(function(d){const m=(d==null?void 0:d[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return n.scopeName=e,[i,lj(n,...t)]}fs(oj,"createContextScope");function lj(...e){const t=e[0];if(e.length===1)return t;const r=fs(()=>{const i=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return fs(function(o){const u=i.reduce((d,{useScope:m,scopeName:f})=>{const p=m(o)[`__scope${f}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}fs(lj,"composeContextScopes");var iy=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},b$=Object.defineProperty,w$=(e,t)=>b$(e,"name",{value:t,configurable:!0}),EC=Ha[" useEffectEvent ".trim().toString()],kC=Ha[" useInsertionEffect ".trim().toString()];function cj(e){if(typeof EC=="function")return EC(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof kC=="function"?kC(()=>{t.current=e}):iy(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}w$(cj,"useEffectEvent");var S$=Object.defineProperty,md=(e,t)=>S$(e,"name",{value:t,configurable:!0}),C$=Ha[" useInsertionEffect ".trim().toString()]||iy;function uj({prop:e,defaultProp:t,onChange:r=md(()=>{},"onChange"),caller:i}){const[n,o,u]=dj({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n,f=g.useCallback(v=>{var p;if(d){const y=hj(v)?v(e):v;y!==e&&((p=u.current)==null||p.call(u,y))}else o(v)},[d,e,o,u]);return[m,f]}md(uj,"useControllableState");function dj({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),n=g.useRef(r),o=g.useRef(t);return C$(()=>{o.current=t},[t]),g.useEffect(()=>{var u;n.current!==r&&((u=o.current)==null||u.call(o,r),n.current=r)},[r,n]),[r,i,o]}md(dj,"useUncontrolledState");function hj(e){return typeof e=="function"}md(hj,"isFunction");var RC=Symbol("RADIX:SYNC_STATE");function E$(e,t,r,i){const{prop:n,defaultProp:o,onChange:u,caller:d}=t,m=n!==void 0,f=cj(u),v=[{...r,state:o}];i&&v.push(i);const[p,y]=g.useReducer((E,S)=>{if(S.type===RC)return{...E,state:S.state};const k=e(E,S);return m&&!Object.is(k.state,E.state)&&f(k.state),k},...v),b=p.state,w=g.useRef(b);g.useEffect(()=>{w.current!==b&&(w.current=b,m||f(b))},[b,w,m]);const C=g.useMemo(()=>n!==void 0?{...p,state:n}:p,[p,n]);return g.useEffect(()=>{m&&!Object.is(n,p.state)&&y({type:RC,state:n})},[n,p.state,m]),[C,y]}md(E$,"useControllableStateReducer");var k$=Object.defineProperty,R$=(e,t)=>k$(e,"name",{value:t,configurable:!0});function fj(e){const[t,r]=g.useState(void 0);return iy(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const o=n[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;u=f.inlineSize,d=f.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}R$(fj,"useSize");var N$=Object.defineProperty,Ss=(e,t)=>N$(e,"name",{value:t,configurable:!0}),j$=Ss(((e,t)=>{const r={...t};for(const i in t){const n=e[i],o=t[i];if(/^on[A-Z]/.test(i))if(n&&o){const d=typeof n=="function",m=typeof o=="function";r[i]=(...f)=>{const v=m?o(...f):void 0;return d&&n(...f),v}}else n&&(r[i]=n);else i==="style"?r[i]={...typeof n=="object"?n:null,...typeof o=="object"?o:null}:i==="className"?r[i]=[n,o].filter(Boolean).join(" "):i==="aria-describedby"&&(r[i]=mj(o,n))}return{...e,...r}}),"mergeProps");function mj(...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}Ss(mj,"concatAriaDescribedby");var pj=g.createContext(j$);pj.displayName="SlotContext";function gj(e){const t=g.forwardRef((r,i)=>{const n=g.useContext(pj);let{children:o,mergeProps:u=n,...d}=r,m=null,f=!1;const v=[];G_(o)&&typeof Hh=="function"&&(o=Hh(o._payload)),g.Children.forEach(o,w=>{var C;if(xj(w)){f=!0;const E=w;let S="child"in E.props?E.props.child:E.props.children;G_(S)&&typeof Hh=="function"&&(S=Hh(S._payload)),m=T$(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):!f&&g.Children.count(o)===1&&g.isValidElement(o)&&(m=o);const p=m?_j(m):void 0,y=Pm(i,p);if(!m){if(o||o===0)throw new Error(f?L$(e):D$(e));return o}const b=u(d,m.props??{});return m.type!==g.Fragment&&(b.ref=i?y:p),g.cloneElement(m,b)});return t.displayName=`${e}.Slot`,t}Ss(gj,"createSlot");var vj=Symbol.for("radix.slottable");function A$(e){const t=Ss(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=vj,t}Ss(A$,"createSlottable");var T$=Ss((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 _j(e){var i,n;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=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Ss(_j,"getElementRef");function xj(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vj}Ss(xj,"isSlottable");var M$=Symbol.for("react.lazy");function G_(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===M$&&"_payload"in e&&yj(e._payload)}Ss(G_,"isLazyComponent");function yj(e){return typeof e=="object"&&e!==null&&"then"in e}Ss(yj,"isPromiseLike");var D$=Ss(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),L$=Ss(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Hh=Ha[" use ".trim().toString()],O$=Object.defineProperty,B$=(e,t)=>O$(e,"name",{value:t,configurable:!0}),P$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sy=P$.reduce((e,t)=>{const r=gj(`Primitive.${t}`),i=g.forwardRef((n,o)=>{const{asChild:u,...d}=n,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 z$(e,t){e&&Wa.flushSync(()=>e.dispatchEvent(t))}B$(z$,"dispatchDiscreteCustomEvent");var I$=Object.defineProperty,Ua=(e,t)=>I$(e,"name",{value:t,configurable:!0}),ny="Switch",[$$,GX]=oj(ny),[U$,ay]=$$(ny);function bj(e){const{__scopeSwitch:t,checked:r,children:i,defaultChecked:n,disabled:o,form:u,name:d,onCheckedChange:m,required:f,value:v="on",internal_do_not_use_render:p}=e,[y,b]=uj({prop:r,defaultProp:n??!1,onChange:m,caller:ny}),[w,C]=g.useState(null),[E,S]=g.useState(null),k=g.useRef(!1),[j,N]=g.useReducer(H=>H+1,0),M=w?!!u||!!w.closest("form"):!0,D={checked:y,setChecked:b,disabled:o,control:w,setControl:C,name:d,form:u,value:v,hasConsumerStoppedPropagationRef:k,userInteractionCount:j,onUserInteraction:N,required:f,defaultChecked:n,isFormControl:M,bubbleInput:E,setBubbleInput:S};return l.jsx(U$,{scope:t,...D,children:Sj(p)?p(D):i})}Ua(bj,"SwitchProvider");var H$="SwitchTrigger",F$=g.forwardRef(Ua(function({__scopeSwitch:t,onClick:r,...i},n){const{control:o,form:u,value:d,disabled:m,checked:f,required:v,setControl:p,setChecked:y,hasConsumerStoppedPropagationRef:b,onUserInteraction:w,isFormControl:C,bubbleInput:E}=ay(H$,t),S=Pm(n,p),k=g.useRef(f);return g.useEffect(()=>{const j=u?o==null?void 0:o.ownerDocument.getElementById(u):o==null?void 0:o.form;if(j instanceof HTMLFormElement){const N=Ua(()=>y(k.current),"reset");return j.addEventListener("reset",N),()=>j.removeEventListener("reset",N)}},[o,u,y]),l.jsx(sy.button,{type:"button",role:"switch","aria-checked":f,"aria-required":v,"data-state":oy(f),"data-disabled":m?"":void 0,disabled:m,value:d,...i,ref:S,onClick:ty(r,j=>{w(),y(N=>!N),E&&C&&(b.current=j.isPropagationStopped(),b.current||j.stopPropagation())})})},"SwitchTrigger")),wj=g.forwardRef(Ua(function(t,r){const{__scopeSwitch:i,name:n,checked:o,defaultChecked:u,required:d,disabled:m,value:f,onCheckedChange:v,form:p,...y}=t;return l.jsx(bj,{__scopeSwitch:i,checked:o,defaultChecked:u,disabled:m,required:d,onCheckedChange:v,name:n,form:p,value:f,internal_do_not_use_render:({isFormControl:b})=>l.jsxs(l.Fragment,{children:[l.jsx(F$,{...y,ref:r,__scopeSwitch:i}),b&&l.jsx(G$,{__scopeSwitch:i})]})})},"Switch")),q$="SwitchThumb",W$=g.forwardRef(Ua(function(t,r){const{__scopeSwitch:i,...n}=t,o=ay(q$,i);return l.jsx(sy.span,{"data-state":oy(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:r})},"SwitchThumb")),V$="SwitchBubbleInput",G$=g.forwardRef(Ua(function({__scopeSwitch:t,onClick:r,...i},n){const{control:o,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:m,defaultChecked:f,required:v,disabled:p,name:y,value:b,form:w,bubbleInput:C,setBubbleInput:E}=ay(V$,t),S=Pm(n,E),k=fj(o),j=g.useRef(!1),N=g.useRef(m),M=g.useRef(d);g.useEffect(()=>{const H=C;if(!H)return;const L=window.HTMLInputElement.prototype,Z=Object.getOwnPropertyDescriptor(L,"checked").set,q=d!==M.current;M.current=d;const P=N.current!==m;N.current=m;const B=!(q&&u.current);if(P&&Z){j.current=!q;const z=new Event("click",{bubbles:B});Z.call(H,m),H.dispatchEvent(z),j.current=!1}},[C,m,u,d]);const D=g.useRef(m);return l.jsx(sy.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??D.current,required:v,disabled:p,name:y,value:b,form:w,...i,tabIndex:-1,ref:S,onClick:ty(r,H=>{j.current&&H.stopPropagation()}),style:{...i.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Sj(e){return typeof e=="function"}Ua(Sj,"isFunction");function oy(e){return e?"checked":"unchecked"}Ua(oy,"getState");const ly=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsx(wj,{ref:i,"data-slot":"switch","data-size":t,className:it("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(W$,{"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"})}));ly.displayName=wj.displayName;var zm="Tabs",[Y$]=Is(zm,[km]),Cj=km(),[K$,cy]=Y$(zm),Ej=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:n,defaultValue:o,orientation:u="horizontal",dir:d,activationMode:m="automatic",...f}=e,v=od(d),[p,y]=Ao({prop:i,onChange:n,defaultProp:o??"",caller:zm});return l.jsx(K$,{scope:r,baseId:Ds(),value:p,onValueChange:y,orientation:u,dir:v,activationMode:m,children:l.jsx(Ye.div,{dir:v,"data-orientation":u,...f,ref:t})})});Ej.displayName=zm;var kj="TabsList",Rj=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:i=!0,...n}=e,o=cy(kj,r),u=Cj(r);return l.jsx(AR,{asChild:!0,...u,orientation:o.orientation,dir:o.dir,loop:i,children:l.jsx(Ye.div,{role:"tablist","aria-orientation":o.orientation,...n,ref:t})})});Rj.displayName=kj;var Nj="TabsTrigger",jj=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,disabled:n=!1,...o}=e,u=cy(Nj,r),d=Cj(r),m=Mj(u.baseId,i),f=Dj(u.baseId,i),v=i===u.value;return l.jsx(TR,{asChild:!0,...d,focusable:!n,active:v,children:l.jsx(Ye.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":f,"data-state":v?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:m,...o,ref:t,onMouseDown:Pe(e.onMouseDown,p=>{!n&&p.button===0&&p.ctrlKey===!1?u.onValueChange(i):p.preventDefault()}),onKeyDown:Pe(e.onKeyDown,p=>{n||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&u.onValueChange(i)}),onFocus:Pe(e.onFocus,()=>{const p=u.activationMode!=="manual";!v&&!n&&p&&u.onValueChange(i)})})})});jj.displayName=Nj;var Aj="TabsContent",Tj=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,forceMount:n,children:o,...u}=e,d=cy(Aj,r),m=Mj(d.baseId,i),f=Dj(d.baseId,i),v=i===d.value,p=g.useRef(v);return g.useEffect(()=>{const y=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(y)},[]),l.jsx($s,{present:n||v,children:({present:y})=>l.jsx(Ye.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:f,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:y&&o})})});Tj.displayName=Aj;function Mj(e,t){return`${e}-trigger-${t}`}function Dj(e,t){return`${e}-content-${t}`}var Lj=Ej,Oj=Rj,Bj=jj,Pj=Tj;function X$(e){return l.jsx(Lj,{"data-slot":"tabs",...e})}const zj=g.forwardRef(({className:e,...t},r)=>l.jsx(Oj,{ref:r,"data-slot":"tabs-list",className:it("inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));zj.displayName="TabsList";const pf=g.forwardRef(({className:e,...t},r)=>l.jsx(Bj,{ref:r,"data-slot":"tabs-trigger",className:it("inline-flex h-7 items-center justify-center whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-border data-[state=active]:bg-background data-[state=active]:text-foreground",e),...t}));pf.displayName="TabsTrigger";const gf=g.forwardRef(({className:e,...t},r)=>l.jsx(Pj,{ref:r,"data-slot":"tabs-content",className:it("mt-4 outline-none",e),...t}));gf.displayName="TabsContent";const pt={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",runtimes:"/settings/runtimes",providers:"/settings/providers",projects:"/settings/projects",agents:"/settings/agents",skills:"/settings/skills",plugins:"/settings/plugins",localRuntime:"/settings/local-runtime",computerUse:"/settings/computer-use"},Yu="/settings",Y_=pt.overview,Z$="/runtimes/:runtimeSelector/sessions",Q$="/runtimes/:runtimeSelector/sessions/:sessionId",Ku="!invalid-runtime-owner",J$=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,e9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",projects:"/projects",agents:"/agents",skills:"/skills",plugins:"/plugins"},t9={"/settings/updates":`${pt.overview}#software-update`,"/settings/daemon":`${pt.localRuntime}#runtime`,"/settings/command":`${pt.localRuntime}#terminal-command`,"/settings/computer":`${pt.computerUse}#permissions`,"/settings/inspection":`${pt.computerUse}#chrome-inspection`},Ij=["localRuntime","computerUse"];function r9(e){return Ij.includes(e)}function $j(e,t){return!r9(e)||t}function Uj(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(K_(t)||t===pt.sessions||t.startsWith(`${pt.sessions}/`))return"sessions";const r=Object.entries(pt).find(([,i])=>i===t);return(r==null?void 0:r[0])??"sessions"}function i9(e,t=!0){const r=Uj(e);return r==="sessions"||!$j(r,t)?null:r}function K_(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return Fj(decodeURIComponent(t[1]))}catch{return Ku}}function Hj(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?Ku:Fj(t[0])}function Fj(e){return J$.test(e)?e:Ku}function $l(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function La(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function qj(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==Yu&&!r.startsWith(`${Yu}/`)?r:t}const Wj="/api/plugins/install-preparations",Fh="/api/plugin-marketplaces",s9=/^[A-Za-z0-9_-]{32,128}$/;function Vj(e){if(!s9.test(e))throw new Error("invalid plugin preparation token");return`${Wj}/${encodeURIComponent(e)}`}function n9(e){return`${Vj(e)}/commit`}class Co extends Error{constructor(r,i,n,o){super(r);si(this,"status");si(this,"code");si(this,"outcome");this.name="ApiRequestError",this.status=i,this.code=n,this.outcome=o}}function Im(e){return e instanceof Co&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const a9="/api/runtimes/capability",o9="x-rynx-runtime-capability";let Ul;async function l9(e,t,r){const i=location.protocol==="https:"?"wss":"ws",n=await Xu(r.refreshCapability),o=new URLSearchParams({capability:n,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 c9(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 u9(e,t,r,i){const n=i?`${Lr(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 tt(n,o):await st(n,o)).disposition}async function st(e,t={}){return Gj(e,{},t)}async function Gj(e,t,r={}){const i=new Headers(r.headers);r.body&&!i.has("content-type")&&i.set("content-type","application/json");const n=await fetch(e,{...r,headers:i});if(!n.ok){let u=`${n.status}`,d,m;try{const f=await n.json();typeof f.error=="string"&&(d=f.error,u=f.error),(f.outcome==="not_started"||f.outcome==="unknown")&&(m=f.outcome)}catch{}throw new Co(u,n.status,d,m)}const o=await n.text();return o?JSON.parse(o):t}async function Xu(e=!1){return e&&(Ul=void 0),Ul||(Ul=st(a9,{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 Ul=void 0,t})),Ul}async function tt(e,t){const r=async n=>{const o=new Headers(t.headers);return o.set(o9,n),st(e,{...t,headers:o})},i=await Xu();try{return await r(i)}catch(n){if(!(n instanceof Error)||n.message!=="invalid_runtime_capability")throw n;return Ul=void 0,r(await Xu())}}async function Rv(e,t={}){const r=new Headers(t.headers),i=await fetch(e,{...t,headers:r});if(!i.ok){let n=`${i.status}`;try{const o=await i.json();o.error&&(n=o.error)}catch{}throw new Error(n)}return i.blob()}async function d9(e,t,r,i){const n=new Headers({"content-type":"application/json"}),o=await fetch(e,{method:"POST",headers:n,body:t===void 0?void 0:JSON.stringify(t),signal:i});await Yj(o,r)}async function h9(e,t,r){const i=await fetch(e,{signal:r});await Yj(i,t)}async function Yj(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 n="";for(;;){const{done:o,value:u}=await r.read();if(o)break;n+=i.decode(u,{stream:!0});let d;for(;(d=n.indexOf(`
556
+
557
+ `))!==-1;){const m=n.slice(0,d);n=n.slice(d+2);const f=f9(m);f&&t(f)}}}function f9(e){let t="message",r="";for(const n of e.split(`
558
+ `))n.startsWith("event:")?t=n.slice(6).trim():n.startsWith("data:")&&(r+=n.slice(5).trim());if(!t&&!r)return null;let i={};try{r&&(i=JSON.parse(r))}catch{}return{event:t,data:i}}function X_(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function cu(e,t,r){const i=X_(e,t);return e?tt(i,r):st(i,r)}function Lr(e,t,r){const i=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return i;const n=`${i}/${encodeURIComponent(t)}`;return r?`${n}/${r}`:n}function qh(e,t){const r=`/api/runtimes/${encodeURIComponent(e)}/projects`;return t===void 0?r:`${r}/${encodeURIComponent(t)}`}function Hl(e,t,...r){const i=`${Lr(e,t)}/browser`;return r.length===0?i:`${i}/${r.map(n=>encodeURIComponent(n)).join("/")}`}function vo(e,t,r){const i=`${Lr(e,t)}/emulator`;return r?`${i}/${r}`:i}function m9(e,t,r){const i=new URLSearchParams({bindingId:r});return`${Lr(e,t)}/emulator/frame?${i.toString()}`}function uu(e,t,r,i,n){return tt(Hl(e,t,"pages",i,n),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function Wh(e,t,r){return e?Lr(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const xe={meta:()=>st("/api/meta"),listRuntimeShareAddresses:()=>st("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>tt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>st("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>tt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>tt(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>st("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>st(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>tt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>st(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>tt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>tt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>tt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>Gj(Hl(e,t),null),openRuntimeBrowser:(e,t,r)=>tt(Hl(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>tt(Hl(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,i)=>tt(Hl(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...i===void 0?{}:{url:i}})}),closeRuntimeBrowserPage:(e,t,r,i)=>uu(e,t,r,i,"close"),activateRuntimeBrowserPage:(e,t,r,i)=>uu(e,t,r,i,"activate"),navigateRuntimeBrowserPage:(e,t,r,i,n)=>tt(Hl(e,t,"pages",i,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:n})}),backRuntimeBrowserPage:(e,t,r,i)=>uu(e,t,r,i,"back"),forwardRuntimeBrowserPage:(e,t,r,i)=>uu(e,t,r,i,"forward"),reloadRuntimeBrowserPage:(e,t,r,i)=>uu(e,t,r,i,"reload"),getSessionEmulator:(e,t)=>st(vo(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>st(vo(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>tt(vo(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>tt(vo(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,i,n)=>tt(vo(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:i,y:n})}),gestureSessionEmulator:(e,t,r,i)=>tt(vo(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:i})}),buttonSessionEmulator:(e,t,r,i)=>tt(vo(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:i})}),sessionEmulatorFrameBlob:(e,t,r,i)=>Rv(m9(e,t,r),{signal:i,cache:"no-store"}),listPlugins:()=>st("/api/plugins").then(e=>e.plugins),listPluginMarketplaces:()=>st(Fh,{cache:"no-store"}).then(e=>e.marketplaces),addPluginMarketplace:e=>tt(Fh,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e)}),refreshPluginMarketplace:e=>tt(`${Fh}/${encodeURIComponent(e)}/refresh`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}),removePluginMarketplace:e=>tt(`${Fh}/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"x-rynx-console":"1"}}),preparePluginInstallation:(e,t)=>tt(Wj,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e),signal:t}),commitPluginInstallation:(e,t,r)=>tt(n9(e),{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(t),signal:r}),cancelPluginInstallation:e=>tt(Vj(e),{method:"DELETE",headers:{"x-rynx-console":"1"}}),setPluginEnabled:(e,t)=>tt(`/api/plugins/${encodeURIComponent(e)}/${t?"enable":"disable"}`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}).then(r=>r.plugin),pluginSettingsUi:(e,t)=>st(`/api/plugins/${encodeURIComponent(e)}/settings-ui`,{cache:"no-store",signal:t}),pluginSettingsCall:(e,t,r,i,n)=>tt(`/api/plugins/${encodeURIComponent(e)}/settings`,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify({generation:t,method:r,params:i}),signal:n}).then(o=>o.result),emulatorDevices:e=>st(X_(e,"devices")).then(t=>t.devices),activeEmulator:e=>st(X_(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>cu(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,i)=>cu(i,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>cu(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>cu(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>cu(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>Rv(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>st("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>Rv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>st("/api/agents").then(e=>e.agents),getAgent:e=>st(`/api/agents/${encodeURIComponent(e)}`),writeAgent:e=>st("/api/agents",{method:"POST",body:JSON.stringify(e)}),deleteAgent:e=>st(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listProjects:e=>st(qh(e),{cache:"no-store"}).then(t=>t.projects),createProject:(e,t)=>tt(qh(e),{method:"POST",body:JSON.stringify(t)}).then(r=>r.project),updateProject:(e,t,r)=>tt(qh(e,t),{method:"PUT",body:JSON.stringify(r)}).then(i=>i.project),deleteProject:(e,t)=>tt(qh(e,t),{method:"DELETE"}),listSkills:()=>st("/api/skills").then(e=>e.skills),getSkill:e=>st(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>st(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>st("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),deleteSkill:e=>st(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),listSessions:e=>st(e?Lr(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>st(`${Lr(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>st(`${Lr(e)}/launch-options`),createSession:(e,t)=>{const r=t?Lr(t):"/api/sessions",i={method:"POST",body:JSON.stringify(e)};return t?tt(r,i):st(r,i)},forkSession:(e,t,r)=>tt(Lr(e,t,"fork"),{method:"POST",body:JSON.stringify(r)}),sendSessionMessage:(e,t,r,i,n)=>n?tt(Lr(n,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:i}).then(()=>{}):d9(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,i),getSessionResourcePolicy:(e,t)=>st(`${Lr(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,i,n)=>tt(Lr(e,t,"resources"),{method:"POST",body:r,signal:n,headers:{"content-type":r.type,"x-rynx-upload-id":i,"x-rynx-filename":encodeURIComponent(r.name)}}).then(o=>o.resource),deleteSessionResource:(e,t,r)=>tt(`${Lr(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>`${Lr(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`,enqueueSessionMessage:(e,t,r)=>tt(Lr(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t,r)=>tt(Lr(e,t,"terminal/start"),{method:"POST",body:"{}",signal:r}),streamSession:(e,t,r,i)=>h9(Wh(i,e,"stream"),t,r),getSessionHistory:e=>st(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>st(Wh(r,e,"snapshot"),{signal:t}),getSessionSnapshotPage:(e,t,r,i)=>{const n=new URLSearchParams;t!==void 0&&n.set("afterId",t);const o=n.size>0?`?${n.toString()}`:"";return st(`${Wh(i,e,"snapshot-page")}${o}`,{signal:r})},closeSession:(e,t)=>{const r=t?Lr(t,e):`/api/sessions/${encodeURIComponent(e)}`,i={method:"DELETE"};return t?tt(r,i):st(r,i)},interruptSession:(e,t)=>{const r=Wh(t,e,"interrupt"),i={method:"POST"};return t?tt(r,i):st(r,i)}},Kj="rynx.control.runtime-target.v1",Xj={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function p9(e){var t;if(!e)return"local";try{return((t=e.getItem(Kj))==null?void 0:t.trim())||"local"}catch{return"local"}}function NC(e,t){if(e)try{e.setItem(Kj,t)}catch{}}function g9(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",Xj),[...t.values()].sort((r,i)=>r.selector==="local"?-1:i.selector==="local"?1:r.displayName.localeCompare(i.displayName))}const Zj=g.createContext(null);function v9({children:e}){const t=Hr(),r=Fa(),i=K_(t.pathname)??(t.pathname===pt.sessions?Hj(t.search):null),[n,o]=g.useState(()=>p9(typeof window>"u"?void 0:window.localStorage)),u=i??n,[d,m]=g.useState([Xj]),f=g.useCallback(b=>{m(g9(b))},[]),v=g.useCallback(async()=>{try{f(await xe.listRuntimes())}catch(b){ve.error(`Failed to load Runtimes: ${b.message}`)}},[f]);g.useEffect(()=>{v()},[v]),g.useEffect(()=>{!i||i===Ku||(o(i),NC(typeof window>"u"?void 0:window.localStorage,i))},[i]);const p=g.useCallback(b=>{const w=b.trim();if(!w)return;o(w),NC(typeof window>"u"?void 0:window.localStorage,w),(t.pathname===pt.sessions||t.pathname.startsWith(`${pt.sessions}/`)||K_(t.pathname)!==null)&&i!==w&&r(La(w))},[t.pathname,r,i]),y=g.useMemo(()=>{const b=d.find(C=>C.selector===u)??(u===Ku?{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:b,isRemoteRuntime:w,selectRuntime:p,refreshRuntimes:v,updateRuntimes:f}},[v,u,d,p,f]);return l.jsx(Zj.Provider,{value:y,children:e})}function dc(){const e=g.useContext(Zj);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const jC="!add-runtime";function _9(){const e=Hr(),t=Fa(),{runtimes:r,runtimeSelector:i,selectedRuntime:n,selectRuntime:o}=dc(),u=r.some(m=>m.selector===i)?r:[...r,n],d=m=>{if(m===jC){t(pt.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(Gu,{value:i,onValueChange:d,children:[l.jsxs(ec,{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(Jl,{placeholder:"Select Runtime"})]}),l.jsxs(tc,{align:"end",children:[u.map(m=>{const f=m.binding==="local"?$E:cm;return l.jsx(Ui,{value:m.selector,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(f,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),l.jsx(Bm,{}),l.jsx(Ui,{value:jC,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(ri,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function Vo(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function Qj(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function vf(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||e.globalCli.state==="development"||Qj(e)&&t}const Jj=g.createContext({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function x9({children:e}){const t=Vo(),[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState(null);g.useEffect(()=>{if(!t)return;let p=!0;const y=t.onAppUpdateStatus(b=>{p&&(i(b),b.error||d(null))});return t.getAppUpdateStatus().then(b=>{p&&i(b)}).catch(b=>{p&&d(Nv(b))}),()=>{p=!1,y()}},[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(Nv(p)),null}finally{o(null)}},[t]),f=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(Nv(p)),null}finally{o(null)}},[t]),v=g.useMemo(()=>({status:r,operation:n,error:u,checkForUpdates:m,installUpdate:f}),[m,u,f,n,r]);return l.jsx(Jj.Provider,{value:v,children:e})}function uy(){return g.useContext(Jj)}function Nv(e){return e instanceof Error?e.message:String(e)}function y9(){const{status:e,operation:t,error:r,installUpdate:i}=uy();if(!(e!=null&&e.availableVersion)||e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="installing")return null;const n=t==="install"||e.phase==="installing",o=e.phase==="ready"&&!n,u=r??e.error;return l.jsxs("div",{className:"group/update relative flex shrink-0 items-center",children:[l.jsxs(ue,{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"||n?l.jsx($e,{className:"animate-spin"}):l.jsx(Ou,{}),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(Ou,{className:"size-4"}):e.phase==="downloading"?l.jsx(ad,{className:"size-4"}):l.jsx($e,{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":n?"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.`:n?"Rynx will restart when the local Runtime is safe to stop.":`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),o&&l.jsxs(ue,{size:"sm",className:"mt-3 w-full",onClick:()=>void i(),children:[l.jsx(Ou,{}),"Restart to update"]}),u&&l.jsx("p",{className:"mt-2 text-[10px] leading-4 text-[var(--destructive)]",children:u})]})})]})}function qe(...e){return Yk(y0(e))}function b9({children:e,theme:t,onToggleTheme:r}){const i=Hr(),{runtimeSelector:n}=dc(),o=Uj(i.pathname),u=i.pathname===Yu||i.pathname.startsWith(`${Yu}/`),d=qj(i.state,La(n)),m=u?d:Y_,f=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(_9,{}),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(y9,{}),l.jsx(ue,{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(g6,{}):l.jsx(bO,{})}),l.jsx(ue,{asChild:!0,variant:"ghost",size:"icon-xs",className:qe("shrink-0",u&&"text-[var(--primary)]"),children:l.jsx(Da,{to:m,state:f,"aria-label":u?"Back to app":"Settings",title:u?"Back to app":"Settings",children:l.jsx(JO,{})})})]})]})]})]})}const Wf="/assets/rynx-wordmark-LL1QRYHD.png";function w9({bridge:e,children:t}){const[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState("refresh"),[m,f]=g.useState(!1),v=g.useCallback(async(E=!1)=>{d("refresh"),o(null);try{const S=await e.getStatus(E);vf(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?vf(r,m):!1;async function y(){const E=r==null?void 0:r.globalCli.path;if(E){d("install"),o(null);try{const S=await e.installCli(E);f(!1),vf(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 b(){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:Wf,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(S9,{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(C9,{status:r,pending:u,acknowledged:m,onAcknowledgedChange:f,onInstall:()=>void y(),onRefresh:()=>void v(!0),onContinue:()=>void w()}):l.jsx(E9,{status:r,pending:u,onRetry:()=>void b()}):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($e,{className:"size-4 animate-spin"}),u==="refresh"?"Getting Rynx ready…":"Setup status is unavailable."]})}),n&&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(nc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:n})]})]})})]})]})}function S9({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 C9({status:e,pending:t,acknowledged:r,onAcknowledgedChange:i,onInstall:n,onRefresh:o,onContinue:u}){const d=e.globalCli.state==="installed",m=e.globalCli.state==="development",f=d&&!e.globalCli.canInstall,v=Qj(e),p=vf(e,r);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:f?"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:f?l.jsx(zs,{className:"size-4"}):l.jsx(u0,{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:k9(e)})]})]}),v&&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:y=>i(y.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(ue,{disabled:t!==null,onClick:n,children:[t==="install"&&l.jsx($e,{className:"animate-spin"}),"Install command"]}),(f||m||v)&&l.jsxs(ue,{disabled:t!==null||!p,onClick:u,children:["Continue",l.jsx(PE,{})]}),l.jsxs(ue,{variant:"outline",disabled:t!==null,onClick:o,children:[l.jsx(Et,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function E9({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(nc,{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(ue,{className:"mt-4",variant:"outline",disabled:t!==null,onClick:r,children:[t==="runtime"&&l.jsx($e,{className:"animate-spin"}),"Try again"]})]})]})}function k9(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"development":return"Terminal command registration is disabled in development builds.";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 R9({bridge:e}){const[t,r]=g.useState(null),[i,n]=g.useState(!1),[o,u]=g.useState(null),d=g.useRef(!1),m=g.useRef(0),f=g.useCallback(b=>{b.requestId<=m.current||(m.current=b.requestId,r(b),n(!1),u(null),d.current=!1)},[]);g.useEffect(()=>{let b=!0;const w=e.onQuitPrompt(C=>{b&&f(C)});return e.getPendingQuitPrompt().then(C=>{b&&C&&f(C)}).catch(()=>{}),()=>{b=!1,w()}},[f,e]);const v=g.useCallback(async()=>{if(!(!t||i||d.current)){d.current=!0;try{const b=await e.respondToQuit(t.requestId,"cancel");if(b.outcome==="failed"){u(b.message);return}if(b.outcome==="quitting"){n(!0);return}b.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,n(!0),u(null);try{const b=await e.respondToQuit(t.requestId,"force");b.outcome==="failed"?(u(b.message),n(!1)):b.outcome==="cancelled"&&(r(null),n(!1))}catch{u("Rynx couldn’t stop the running work. Try again."),n(!1)}finally{d.current=!1}}},[e,t]),y=(t==null?void 0:t.kind)==="active-work";return l.jsx(_s,{open:t!==null,onOpenChange:b=>{b||v()},children:l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsx(Zk,{className:"bg-destructive/10 text-destructive",children:l.jsx(Ms,{"aria-hidden":"true"})}),l.jsx(Wi,{children:y?"Quit Rynx?":"Rynx couldn’t quit"}),l.jsx(Vi,{children:y?"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(ys,{children:[l.jsx(Gi,{disabled:i,children:y?"Keep working":"Close"}),y&&l.jsx(ue,{type:"button",variant:"destructive",disabled:i,onClick:()=>void p(),children:i?l.jsxs(l.Fragment,{children:[l.jsx($e,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const N9=[{label:"General",items:[{id:"overview",label:"Overview",icon:aO},{id:"projects",label:"Projects",icon:F4}]},{label:"Connections",items:[{id:"localRuntime",label:"Local Runtime",icon:u0},{id:"runtimes",label:"Runtimes",icon:cm}]},{label:"AI Capabilities",items:[{id:"providers",label:"Providers",icon:GE},{id:"agents",label:"Agents",icon:o0},{id:"skills",label:"Skills",icon:VE}]},{label:"Integrations",items:[{id:"computerUse",label:"Computer Use",icon:UE},{id:"emulator",label:"Emulator",icon:Xl},{id:"plugins",label:"Plugins",icon:lm}]}];function j9({activeView:e,desktopIntegrationAvailable:t,children:r}){const i=Fa(),n=Hr(),{runtimeSelector:o}=dc(),u=qj(n.state,La(o)),d={returnTo:u},m=N9.map(v=>({...v,items:v.items.filter(({id:p})=>$j(p,t))})).filter(v=>v.items.length>0),f=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(Da,{to:u,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[l.jsx("img",{src:Wf,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(ue,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:l.jsxs(Da,{to:u,children:[l.jsx(jo,{className:"size-3.5"}),"Back to app"]})})]}),l.jsx(vs,{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:y,icon:b})=>l.jsxs(Da,{to:pt[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(b,{className:"size-3.5 shrink-0"}),y]},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(Da,{to:u,className:"app-no-drag shrink-0","aria-label":"Rynx",children:l.jsx("img",{src:Wf,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),l.jsx(ue,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:l.jsxs(Da,{to:u,children:[l.jsx(jo,{className:"size-3.5"}),"Back"]})}),l.jsx(hN,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:v=>i(pt[v.target.value],{state:d}),children:f.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(vs,{className:"min-h-0 flex-1",children:l.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var A9="Label",eA=g.forwardRef((e,t)=>l.jsx(Ye.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));eA.displayName=A9;var T9=eA;const ti=g.forwardRef(({className:e,...t},r)=>l.jsx(T9,{ref:r,className:qe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));ti.displayName="Label";function tA({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[i,n]=g.useState(!1),[o,u]=g.useState(""),[d,m]=g.useState(""),[f,v]=g.useState(""),[p,y]=g.useState(!1);function b(){u(""),m(""),v("")}const w=(()=>{const k=o.trim();return!k||!d.trim()?k:`${k}#${d.trim()}`})(),C=!!d.trim()&&o.includes("#");async function E(){const k=w;if(k){if(C){ve.error("Source already pins a ref with '#' — clear one of the two.");return}y(!0);try{const j=await xe.installSkill({tool:"skills-cli",source:k,...f.trim()?{skill:f.trim()}:{}});ve.success(`Installed ${f.trim()||k}`),e(j),b(),n(!1)}catch(j){ve.error(`Install failed: ${j.message}`)}finally{y(!1)}}}const S=["npx skills add",w||"<source>",f.trim()&&`--skill ${f.trim()}`].filter(Boolean).join(" ");return l.jsxs($o,{open:i,onOpenChange:k=>{n(k),k||b()},children:[l.jsx(Qk,{asChild:!0,children:l.jsxs(ue,{size:"sm",variant:r,children:[l.jsx(ri,{})," ",t]})}),l.jsxs(Ga,{children:[l.jsxs(Uo,{children:[l.jsx(Ya,{children:"Install a skill"}),l.jsxs(Ho,{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(ti,{children:["Source ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(At,{value:o,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:k=>u(k.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(ti,{children:"Skill"}),l.jsx(At,{value:f,placeholder:"find-skills",onChange:k=>v(k.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(ti,{children:"Branch"}),l.jsx(At,{value:d,placeholder:"main",onChange:k=>m(k.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(ac,{children:[l.jsx(ue,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),l.jsx(ue,{onClick:E,disabled:p||!o.trim(),children:p?"Installing…":"Install"})]})]})]})}const M9=["codex","traex","claude"],D9=["none","minimal","low","medium","high","xhigh","max","ultra"],L9=["read-only","workspace-write","danger-full-access"],O9=["never","on-failure","on-request","untrusted"],B9=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function P9({value:e,onChange:t}){return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(Rr,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:l.jsx(At,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),l.jsx(Rr,{label:"Description",children:l.jsx(At,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),l.jsx(Rr,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:l.jsx(Am,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function z9({value:e,onChange:t}){const r=e.executor??{},i=r.retry??{},n=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(Rr,{label:"Runtime",children:l.jsx(Bu,{value:r.runtime,options:M9,required:!0,onChange:u=>n({runtime:u})})}),l.jsx(Rr,{label:"Reasoning effort",children:l.jsx(Bu,{value:r.reasoningEffort,options:D9,onChange:u=>n({reasoningEffort:u})})})]}),l.jsx(Rr,{label:"Model",help:"Blank inherits the runtime default.",children:l.jsx(At,{value:r.model??"",placeholder:"runtime default",onChange:u=>n({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(Rr,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:l.jsx(du,{value:r.timeout,onChange:u=>n({timeout:u})})}),l.jsx(Rr,{label:"Max iterations",help:"claude only (→ --max-turns).",children:l.jsx(du,{value:r.maxIterations,onChange:u=>n({maxIterations:u})})}),l.jsx(Rr,{label:"Context window",help:"codex/traex token budget.",children:l.jsx(du,{value:r.contextWindow,onChange:u=>n({contextWindow:u})})}),l.jsx(Rr,{label:"Retry: max retries",children:l.jsx(du,{value:i.maxRetries,onChange:u=>o({maxRetries:u})})}),l.jsx(Rr,{label:"Retry: timeout/req (s)",children:l.jsx(du,{value:i.timeoutPerRequestSeconds,onChange:u=>o({timeoutPerRequestSeconds:u})})})]})]})}function I9({value:e,onChange:t}){var o;const r=e.osEnv??{},i=u=>t({...e,osEnv:{...r,...u}}),n=((o=e.executor)==null?void 0:o.runtime)??"codex";return l.jsx("div",{className:"grid gap-4",children:l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n==="claude"?l.jsx(Rr,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:l.jsx(Bu,{value:r.permissionMode,options:B9,onChange:u=>i({permissionMode:u})})}):l.jsxs(l.Fragment,{children:[l.jsx(Rr,{label:"Sandbox",children:l.jsx(Bu,{value:r.sandbox,options:L9,onChange:u=>i({sandbox:u})})}),l.jsx(Rr,{label:"Approval policy",help:"Codex's approval axis.",children:l.jsx(Bu,{value:r.approvalPolicy,options:O9,onChange:u=>i({approvalPolicy:u})})})]}),l.jsx(Rr,{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"})]})})]})})}function $9({value:e,onChange:t}){const r=e.tools??{},i=n=>t({...e,tools:{...r,...n}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(Rr,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:l.jsx(AC,{items:r.allowed??[],placeholder:"ToolName",onChange:n=>i({allowed:n})})}),l.jsx(Rr,{label:"Disallowed tools",children:l.jsx(AC,{items:r.disallowed??[],placeholder:"ToolName",onChange:n=>i({disallowed:n})})}),l.jsx(Rr,{label:"MCP servers",help:"HTTP transport only.",children:l.jsx(H9,{rows:r.mcp??[],onChange:n=>i({mcp:n})})})]})}function U9({value:e,onChange:t}){const r=e.skills??[],[i,n]=g.useState(null);g.useEffect(()=>{xe.listSkills().then(n).catch(v=>{n([]),ve.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)),f=r.map(v=>v.name).filter(v=>!m.has(v));return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(Rr,{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&&f.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)),f.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(tA,{onInstalled:n,triggerVariant:"outline"})})]})}function rA(e){const{skills:t,...r}=e,i=Z_(r)??{};return Array.isArray(t)&&t.length>0&&(i.skills=t),i}function Z_(e){if(Array.isArray(e)){const t=e.map(Z_).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 n=Z_(i);n!==void 0&&(t[r]=n)}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 Rr({label:e,help:t,children:r}){return l.jsxs("div",{className:"grid content-start gap-1.5",children:[l.jsx(ti,{children:e}),r,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const jv="__default__";function Bu({value:e,options:t,onChange:r,disabled:i,required:n}){return l.jsxs(Gu,{value:e??(n?t[0]:jv),disabled:i,onValueChange:o=>r(o===jv?void 0:o),children:[l.jsx(ec,{children:l.jsx(Jl,{})}),l.jsxs(tc,{children:[!n&&l.jsx(Ui,{value:jv,children:l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(o=>l.jsx(Ui,{value:o,children:o},o))]})]})}function du({value:e,onChange:t}){return l.jsx(At,{type:"number",value:e??"",onChange:r=>{const i=r.target.value;t(i===""?void 0:Number(i))}})}function AC({items:e,placeholder:t,onChange:r}){const i=(o,u)=>r(e.map((d,m)=>m===o?u:d)),n=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(At,{value:o,placeholder:t,onChange:d=>i(u,d.target.value)}),l.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>n(u),children:l.jsx(cn,{})})]},u)),l.jsxs(ue,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[l.jsx(ri,{})," Add"]})]})}function H9({rows:e,onChange:t}){const r=g.useRef(0),[i,n]=g.useState(()=>e.map(()=>r.current++)),o=(m,f)=>t(e.map((v,p)=>p===m?{...v,...f}:v)),u=m=>{t(e.filter((f,v)=>v!==m)),n(i.filter((f,v)=>v!==m))},d=()=>{t([...e,{name:"",url:""}]),n([...i,r.current++])};return l.jsxs("div",{className:"grid gap-2",children:[e.map((m,f)=>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(At,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:v=>o(f,{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(At,{value:m.url??"",placeholder:"https://server/mcp",onChange:v=>o(f,{url:v.target.value})}),l.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>u(f),children:l.jsx(cn,{})})]}),l.jsx(F9,{headers:m.headers??{},onChange:v=>o(f,{headers:v})})]},i[f]??f)),l.jsxs(ue,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[l.jsx(ri,{})," Add MCP server"]})]})}function F9({headers:e,onChange:t}){const[r,i]=g.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function n(d){i(d);const m={};for(const{k:f,v}of d){const p=f.trim();p&&(m[p]=v)}t(Object.keys(m).length>0?m:void 0)}const o=(d,m)=>n(r.map((f,v)=>v===d?{...f,...m}:f)),u=d=>n(r.filter((m,f)=>f!==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(At,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:f=>o(m,{k:f.target.value})}),l.jsx(At,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:f=>o(m,{v:f.target.value})}),l.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>u(m),children:l.jsx(cn,{})})]},m)),l.jsxs(ue,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>n([...r,{k:"",v:""}]),children:[l.jsx(ri,{})," Add header"]})]})}function ir({className:e,...t}){return l.jsx("div",{className:qe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function mi({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 li({className:e,...t}){return l.jsx("h3",{className:qe("text-sm font-semibold tracking-tight",e),...t})}function fr({className:e,...t}){return l.jsx("div",{className:qe("p-5",e),...t})}const Av=/^[a-z0-9][a-z0-9-]{0,63}$/,Q_=[{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 and per-runtime approval behavior."},{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 q9({initial:e,onClose:t,onSaved:r}){const i=e.id==="",[n,o]=g.useState(e.id),[u,d]=g.useState(e.spec),[m,f]=g.useState("identity"),[v,p]=g.useState("form"),[y,b]=g.useState(()=>JSON.stringify(e.spec,null,2)),[w,C]=g.useState(!1);function E(k){if(k!==v)if(k==="json")b(JSON.stringify(u,null,2)),p("json");else try{d(JSON.parse(y)),p("form")}catch(j){ve.error(`Invalid JSON: ${j.message}`)}}async function S(){const k=n.trim();if(i&&!Av.test(k))return f("identity"),ve.error(k?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let j;if(v==="json")try{j=JSON.parse(y)}catch(N){return ve.error(`Invalid JSON: ${N.message}`)}else j=u;C(!0);try{await xe.writeAgent({...rA(j),id:n.trim()}),ve.success(`Agent "${n}" saved`),await r()}catch(N){ve.error(`Save failed: ${N.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(jo,{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(k=>l.jsx("button",{type:"button",onClick:()=>E(k),className:qe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",v===k?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:k},k))})]}),v==="json"?l.jsx(Am,{value:y,onChange:k=>b(k.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:Q_.map(k=>l.jsx("button",{type:"button",onClick:()=>f(k.id),className:qe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===k.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:k.label},k.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:TC(m).label}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:TC(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(ti,{children:["Agent ID ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(At,{value:n,disabled:!i,onChange:k=>o(k.target.value),placeholder:"polly","aria-invalid":i&&n.trim()!==""&&!Av.test(n.trim())}),i&&n.trim()!==""&&!Av.test(n.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(P9,{value:u,onChange:d})]}),m==="model"&&l.jsx(z9,{value:u,onChange:d}),m==="environment"&&l.jsx(I9,{value:u,onChange:d}),m==="tools"&&l.jsx($9,{value:u,onChange:d}),m==="skills"&&l.jsx(U9,{value:u,onChange:d}),m==="review"&&l.jsx(W9,{id:n,spec:u})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[l.jsx(ue,{variant:"outline",onClick:t,children:"Cancel"}),l.jsx(ue,{onClick:S,disabled:w,children:w?"Saving…":"Save"})]})]})}function TC(e){return Q_.find(t=>t.id===e)??Q_[0]}function W9({id:e,spec:t}){var n,o,u,d,m,f;const r=rA(t),i=[["Agent ID",e||"—"],["Display name",((n=t.name)==null?void 0:n.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",V9(t.skills)],["MCP servers",String(((f=(m=t.tools)==null?void 0:m.mcp)==null?void 0:f.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(ti,{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 V9(e){return e!=null&&e.length?`${e.length} declared`:"None"}const G9={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 Y9({agents:e,onChange:t}){const[r,i]=g.useState(null);function n(){i({id:"",spec:structuredClone(G9)})}async function o(u){try{const d=await xe.getAgent(u);delete d.id,i({id:u,spec:d})}catch(d){ve.error(`Load failed: ${d.message}`)}}return r?l.jsx(q9,{initial:r,onClose:()=>i(null),onSaved:async()=>{i(null),await t()}}):l.jsxs(ir,{children:[l.jsxs(mi,{children:[l.jsxs(li,{children:["Agents ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(ue,{size:"sm",onClick:n,children:[l.jsx(ri,{})," New agent"]})]}),l.jsx(fr,{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(ue,{variant:"ghost",size:"sm",onClick:()=>void o(u.id),children:[l.jsx(FE,{})," Edit"]}),l.jsx(K9,{id:u.id,onChange:t})]})})]},u.id))]})]})})]})}function K9({id:e,onChange:t}){return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsx(ue,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(qa,{})})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:['Delete agent "',e,'"?']}),l.jsx(Vi,{children:"Removes its config directory. New sessions fall back to the configured defaults."})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:async()=>{try{await xe.deleteAgent(e),ve.success(`Agent "${e}" deleted`),await t()}catch(r){ve.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}const X9=Kk("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 Pt({className:e,variant:t,...r}){return l.jsx("span",{className:qe(X9({variant:t}),e),...r})}async function iA(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 MC="127.0.0.1:9333";function Z9({embedded:e=!1}={}){const t=Vo(),r=g.useRef(null),[i,n]=g.useState(null),[o,u]=g.useState(null),[d,m]=g.useState("load"),f=g.useCallback(async()=>{if(!t){m(null),u("Chrome inspection is available only in the Rynx app.");return}m("load"),u(null);try{n(await t.getChromeInspectionStatus())}catch(w){u(w.message)}finally{m(null)}},[t]);g.useEffect(()=>{f()},[f]);async function v(w){if(t){m("save"),u(null);try{n(await t.configureChromeInspection(w))}catch(C){const E=C.message;u(E),ve.error(`Could not update Chrome inspection: ${E}`)}finally{m(null)}}}async function p(){const w=await iA(MC,r.current);w==="clipboard"||w==="selection"?ve.success("Address copied"):w==="selected"?ve.info("Address selected — copy it manually"):ve.error("Copy is unavailable")}const y=i==null?void 0:i.settings,b=d!==null;return l.jsxs("div",{id:e?"chrome-inspection":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&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(ir,{"aria-busy":d!==null,children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(li,{children:"DevTools discovery"}),i&&l.jsx(Q9,{status:i})]}),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(ue,{variant:"outline",size:"sm",disabled:b,onClick:()=>void f(),children:[l.jsx(Et,{className:d==="load"?"animate-spin":""}),"Check"]})]}),l.jsxs(fr,{className:"grid gap-5",children:[i&&y?l.jsxs(l.Fragment,{children:[l.jsx(J9,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:l.jsx(ly,{"aria-label":"Enable Chrome inspection",checked:y.enabled,disabled:b,onCheckedChange:w=>void v({...y,enabled:w})})}),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(DC,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:y.includeLocal,disabled:b||!y.enabled,onChange:w=>void v({...y,includeLocal:w})}),i.remotes.map(w=>l.jsx(DC,{title:w.displayName,detail:tU(w.status),badge:w.status,checked:y.remoteDaemonIds.includes(w.daemonId),disabled:b||!y.enabled||w.status==="incompatible",onChange:C=>void v({...y,remoteDaemonIds:C?[...y.remoteDaemonIds,w.daemonId]:y.remoteDaemonIds.filter(E=>E!==w.daemonId)})},w.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(At,{ref:r,value:MC,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),l.jsxs(ue,{variant:"outline",onClick:()=>void p(),"aria-label":"Copy Chrome inspection address",children:[l.jsx(d0,{}),"Copy"]})]})]}),i.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(Ms,{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:i.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(Ms,{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:[d==="load"&&l.jsx($e,{className:"size-4 animate-spin"}),d==="load"?"Loading Chrome inspection…":"Chrome inspection settings are unavailable."]}),o&&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(Ms,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:o})]})]})]})]})}function Q9({status:e}){return e.runtime.state==="listening"?l.jsxs(Pt,{variant:"success",children:[l.jsx(zs,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?l.jsx(Pt,{variant:"warning",children:"Needs attention"}):l.jsx(Pt,{variant:"outline",children:"Off"})}function J9({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 DC({title:e,detail:t,badge:r,checked:i,disabled:n,onChange:o}){return l.jsxs("label",{className:qe("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",n&&"opacity-55"),children:[l.jsx("input",{type:"checkbox",checked:i,disabled:n,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(Pt,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:eU(r)})]}),l.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function eU(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function tU(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function rU({embedded:e=!1}={}){const t=Vo(),[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState("refresh"),m=g.useCallback(async()=>{if(t){d("refresh"),o(null);try{i(await t.getStatus())}catch(v){o(v.message)}finally{d(null)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(v){if(t){d("permission"),o(null);try{await t.openSystemSettings(v),ve.message("After granting access, return to Rynx and click Check again.")}catch(p){const y=p.message;o(y),ve.error(`Could not open System Settings: ${y}`)}finally{d(null)}}}return l.jsxs("div",{id:e?"permissions":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&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(ir,{"aria-busy":u!==null,children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{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(ue,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(),children:[l.jsx(Et,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(fr,{className:"grid gap-3",children:[r?l.jsxs(l.Fragment,{children:[l.jsx(LC,{icon:l.jsx(VO,{className:"size-4"}),ready:r.permissions.accessibility==="granted",title:"Accessibility",description:OC(r.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:r.permissions.accessibility!=="granted"?l.jsxs(ue,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void f("accessibility"),children:[l.jsx(b_,{}),"Open Settings"]}):void 0}),l.jsx(LC,{icon:l.jsx(_O,{className:"size-4"}),ready:r.permissions.screenRecording==="granted",title:"Screen Recording",description:OC(r.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:r.permissions.screenRecording!=="granted"?l.jsxs(ue,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void f("screen-recording"),children:[l.jsx(b_,{}),"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:[u==="refresh"&&l.jsx($e,{className:"size-4 animate-spin"}),u==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),n&&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(nc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:n})]})]})]})]})}function LC({icon:e,ready:t,title:r,description:i,action:n}){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(zs,{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(Pt,{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})]}),n&&l.jsx("div",{className:"sm:justify-self-end",children:n})]})}function OC(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 iU(){return l.jsxs("div",{className:"grid max-w-3xl gap-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer Use"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Configure macOS permissions and Chrome DevTools access for computer automation."})]}),l.jsx(rU,{embedded:!0}),l.jsx(Z9,{embedded:!0})]})}const sU=700,nU=250,BC=33333,_f=new Uint8Array([0,0,0,1]);function aU(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Tv(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 PC(e,t){const r=aU(e,t),i=Tv(r,0);if(!i)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const n=[];let o=i.index,u=i.index+i.length,d=Tv(r,u);for(;d;)d.index>u&&n.push(r.slice(u,d.index)),o=d.index,u=d.index+d.length,d=Tv(r,u);return{nals:n,pending:r.slice(o)}}function $m(e){return e[0]&31}function oU(e){if($m(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 lU(e){const t=e.reduce((n,o)=>n+_f.length+o.length,0),r=new Uint8Array(t);let i=0;for(const n of e)r.set(_f,i),i+=_f.length,r.set(n,i),i+=n.length;return r}function zC(e){const t=$m(e);return t===1||t===5}function cU(e){return e.some(t=>$m(t)===5)}function Mv(e,t,r,i){(e.width!==r||e.height!==i)&&(e.width=r,e.height=i);const n=e.getContext("2d");n&&n.drawImage(t,0,0,r,i)}function uU(e,t){return new Promise((r,i)=>{if(t.aborted){i(t.reason);return}const n=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(n),i(t.reason)},{once:!0})})}function IC(e){return e instanceof Error?e.message:String(e)}function dU(e){return e instanceof DOMException&&e.name==="AbortError"}function hU({device:e,alt:t,mediaRef:r,onFrameSize:i}){const n=g.useRef(null),o=g.useRef(!1),u=g.useRef(!1),d=g.useRef(null),[m,f]=g.useState("video"),[v,p]=g.useState(!1),[y,b]=g.useState("Loading preview..."),w=g.useCallback(S=>{n.current=S,r==null||r(S)},[r]),C=g.useCallback(()=>{o.current||(o.current=!0,p(!0),b(""))},[]),E=g.useCallback((S,k)=>{const j=d.current;(j==null?void 0:j.width)===S&&j.height===k||(d.current={width:S,height:k},i==null||i(S,k))},[i]);return g.useEffect(()=>{o.current=!1,u.current=!1,d.current=null,p(!1),b("Loading preview..."),f("video")},[e]),g.useEffect(()=>{if(m!=="video"||o.current)return;let S=!1;return(async()=>{try{const j=await xe.emulatorFrameBlob(e);if(S||o.current)return;const N=await createImageBitmap(j);try{const M=n.current;M&&!o.current&&(Mv(M,N,N.width,N.height),E(N.width,N.height),C())}finally{N.close()}}catch{}})(),()=>{S=!0}},[e,C,m,E]),g.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){b("Video decoder unavailable"),f("fallback");return}const S=new AbortController,k=N=>{const M=n.current;try{if(M){const D=N.displayWidth||N.codedWidth,H=N.displayHeight||N.codedHeight;Mv(M,N,D,H),E(D,H),u.current=!0,C()}}finally{N.close()}};return(async()=>{for(;!S.signal.aborted;){let N=null,M=null,D=new Uint8Array,H=[],L=!1,G=0,Z="avc1.42E01F";const q=async()=>{if(N)return N;const z={codec:Z,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(z)).supported)throw new Error(`Unsupported Android video codec: ${Z}`);return N=new VideoDecoder({output:k,error:A=>{b(A.message)}}),N.configure(z),N},P=async()=>{if(!L){H=[];return}const z=await q(),I=cU(H),A=lU(H),$=G;G+=BC,H=[],L=!1,!(z.decodeQueueSize>2&&!I)&&z.decode(new EncodedVideoChunk({type:I?"key":"delta",timestamp:$,duration:BC,data:A}))},B=async z=>{const I=oU(z);I&&(Z=I),($m(z)===9||zC(z))&&L&&await P(),H.push(z),zC(z)&&(L=!0)};try{const z=await fetch(xe.emulatorVideoStreamUrl(e),{cache:"no-store",signal:S.signal});if(!z.ok||!z.body)throw new Error(`Android video stream failed: ${z.status}`);for(M=z.body.getReader();;){const{done:A,value:$}=await M.read();if(A)break;const U=PC(D,$);D=U.pending;for(const F of U.nals)await B(F)}const I=PC(D,_f);for(const A of I.nals)await B(A);await P(),(N==null?void 0:N.state)==="configured"&&await N.flush()}catch(z){if(S.signal.aborted||dU(z))break;if(b(IC(z)),!u.current){f("fallback");break}}finally{try{M==null||M.releaseLock()}catch{}(N==null?void 0:N.state)!=="closed"&&(N==null||N.close())}S.signal.aborted||await uU(nU,S.signal).catch(()=>{})}})(),()=>{S.abort()}},[e,C,m,E]),g.useEffect(()=>{if(m!=="fallback")return;let S=!1,k;const j=async()=>{try{const N=await xe.emulatorFrameBlob(e);if(S)return;const M=await createImageBitmap(N);try{const D=n.current;D&&(Mv(D,M,M.width,M.height),E(M.width,M.height),C())}finally{M.close()}}catch(N){S||b(IC(N))}finally{S||(k=window.setTimeout(j,sU))}};return j(),()=>{S=!0,k&&window.clearTimeout(k)}},[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:y})]})}const $C=8,fU=.012,mU=1500,pU=35,gU=260,vU=40,_U=3,xU=5e3,yU=750;function UC(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function HC(e,t,r){return Math.max(t,Math.min(r,e))}function FC(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function bU(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 n=r/i;if(t.width/t.height>n){const d=t.height*n;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const u=t.width/n;return new DOMRect(t.left,t.top+(t.height-u)/2,t.width,u)}function Dv(e,t,r){if(!e)return null;const i=bU(e);if(!i)return null;const n=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;return!r&&(n<0||n>1||o<0||o>1)?null:{x:HC(n,0,1),y:HC(o,0,1)}}function wU(e){return new Promise(t=>setTimeout(t,e))}function SU(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=_U,r.set(t,1),r.buffer}function CU(){const[e,t]=g.useState([]),[r,i]=g.useState(null),[n,o]=g.useState(!0),[u,d]=g.useState(null),[m,f]=g.useState(null),[v,p]=g.useState(!1),[y,b]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(!1),[k,j]=g.useState(0),N=g.useRef(null),M=g.useRef(null),D=g.useRef(null),H=g.useRef(null),L=g.useRef(null),G=g.useRef(null),Z=g.useCallback(async()=>{o(!0);try{const[re,te]=await Promise.all([xe.emulatorDevices(),xe.activeEmulator()]);t(re),i(te)}catch(re){ve.error(`Failed to load emulator: ${re.message}`)}finally{o(!1)}},[]);g.useEffect(()=>{Z()},[Z]),g.useEffect(()=>()=>{D.current!==null&&window.clearTimeout(D.current),M.current!==null&&window.clearTimeout(M.current)},[]),g.useEffect(()=>()=>{var te;const re=(te=H.current)==null?void 0:te.socket;H.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close()},[r==null?void 0:r.wsUrl]),g.useEffect(()=>{var re;if((r==null?void 0:r.backend)!=="android"){const te=(re=L.current)==null?void 0:re.socket;L.current=null,te&&te.readyState!==WebSocket.CLOSED&&te.close();return}return oe(r.deviceUdid).catch(()=>{}),()=>{var Ce;const te=(Ce=L.current)==null?void 0:Ce.socket;L.current=null,te&&te.readyState!==WebSocket.CLOSED&&te.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const q=(r==null?void 0:r.streamUrl)??null,P=q&&k>0?`${q}${q.includes("?")?"&":"?"}rynx_preview_retry=${k}`:q,B=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,z=!!(q||B),I=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},A=g.useCallback((re,te)=>{if(!Number.isFinite(re)||!Number.isFinite(te)||re<=0||te<=0)return;const Ce=re/te;C(me=>me!==null&&Math.abs(me-Ce)<1e-4?me:Ce)},[]),$=g.useCallback(()=>{M.current!==null&&(window.clearTimeout(M.current),M.current=null)},[]),U=g.useCallback((re,te)=>{$(),A(re,te),S(!0)},[$,A]),F=g.useCallback(()=>{S(!1),M.current===null&&(M.current=window.setTimeout(()=>{M.current=null,j(re=>re+1)},yU))},[]);g.useEffect(()=>{if($(),C(null),S(!1),j(0),!q)return;const re=()=>{const Ce=N.current;Ce instanceof HTMLImageElement&&Ce.naturalWidth>0&&Ce.naturalHeight>0&&U(Ce.naturalWidth,Ce.naturalHeight)};re();const te=window.setInterval(re,500);return()=>window.clearInterval(te)},[$,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,U,q]),g.useEffect(()=>{if(!q||E)return;const re=window.setTimeout(F,xU);return()=>window.clearTimeout(re)},[k,E,q,F]);async function W(re){if(r){b("home");try{await xe.buttonEmulator(re,r.deviceUdid)}catch(te){ve.error(`${re==="appswitch"?"App switcher":"Home"} failed: ${te.message}`)}finally{b(null)}}}function T(){if(!(!r||y)){if(D.current!==null){window.clearTimeout(D.current),D.current=null,W("appswitch");return}D.current=window.setTimeout(()=>{D.current=null,W("home")},gU)}}async function V(re,te){const Ce=(r==null?void 0:r.deviceUdid)===re;D.current!==null&&(window.clearTimeout(D.current),D.current=null),f(re),Ce&&b("shutdown");try{await xe.shutdownEmulator(re),Ce&&i(null),ve.success(`Shutdown ${te}`),Z()}catch(me){ve.error(`Shutdown failed: ${me.message}`)}finally{f(null),Ce&&b(null)}}async function K(re){d(re.id);try{const te=await xe.attachEmulator(re.id);i(te),ve.success(`Attached ${te.deviceName??te.deviceUdid}`),Z()}catch(te){ve.error(`Attach failed: ${te.message}`)}finally{d(null)}}function J(re){var je;const te=H.current;if((te==null?void 0:te.url)===re){if(((je=te.socket)==null?void 0:je.readyState)===WebSocket.OPEN)return Promise.resolve(te.socket);if(te.connecting)return te.connecting}else te!=null&&te.socket&&te.socket.readyState!==WebSocket.CLOSED&&te.socket.close();const Ce={url:re,socket:null,connecting:null},me=new Promise((We,Te)=>{const ze=new WebSocket(re),Se=window.setTimeout(()=>{ze.close(),Te(new Error("Timed out connecting to emulator gesture stream."))},1500),Ue=()=>window.clearTimeout(Se);ze.binaryType="arraybuffer",ze.addEventListener("open",()=>{Ue(),Ce.socket=ze,Ce.connecting=null,We(ze)},{once:!0}),ze.addEventListener("error",()=>{Ue(),Ce.connecting=null,Te(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),ze.addEventListener("close",()=>{var Gt;((Gt=H.current)==null?void 0:Gt.socket)===ze&&(H.current=null)})});return Ce.connecting=me,H.current=Ce,me}function oe(re){var je;const te=L.current;if((te==null?void 0:te.device)===re){if(((je=te.socket)==null?void 0:je.readyState)===WebSocket.OPEN)return Promise.resolve(te.socket);if(te.connecting)return te.connecting}else te!=null&&te.socket&&te.socket.readyState!==WebSocket.CLOSED&&te.socket.close();const Ce={device:re,socket:null,connecting:null},me=new Promise((We,Te)=>{const ze=new WebSocket(c9(re));let Se=!1;const Ue=window.setTimeout(()=>{Se||(Se=!0,ze.close(),Te(new Error("Timed out connecting to Android touch stream.")))},mU),Gt=()=>window.clearTimeout(Ue);ze.addEventListener("message",wt=>{if(!Se&&typeof wt.data=="string")try{const Re=JSON.parse(wt.data);Re.t==="opened"?(Se=!0,Gt(),Ce.socket=ze,Ce.connecting=null,We(ze)):Re.t==="error"&&(Se=!0,Gt(),Ce.connecting=null,Te(new Error(Re.message??"Android touch stream failed.")))}catch{}}),ze.addEventListener("error",()=>{Se||(Se=!0,Gt(),Ce.connecting=null,Te(new Error("Failed to connect to Android touch stream.")))},{once:!0}),ze.addEventListener("close",()=>{var wt;Gt(),Ce.connecting=null,Se||(Se=!0,Te(new Error("Android touch stream closed before it was ready."))),((wt=L.current)==null?void 0:wt.socket)===ze&&(L.current=null)})});return Ce.connecting=me,L.current=Ce,me}async function ce(re,te){if(re.backend==="android"){if(re.liveFailed)return!1;try{return(await oe(re.device)).send(JSON.stringify(te)),re.sentLiveFrames+=1,!0}catch(Ce){return re.liveFailed=!0,re.sentLiveFrames>0&&ve.error(`Android touch stream failed: ${Ce.message}`),!1}}if(!re.wsUrl||re.liveFailed)return!1;try{return(await J(re.wsUrl)).send(SU(te)),re.sentLiveFrames+=1,!0}catch(Ce){return re.liveFailed=!0,re.sentLiveFrames>0&&ve.error(`Gesture stream failed: ${Ce.message}`),!1}}function Y(re,te){xe.gestureEmulator([{type:"begin",x:re.x,y:re.y}],te).catch(Ce=>{ve.error(`Tap failed: ${Ce.message}`)})}function ne(re,te){xe.gestureEmulator(re,te).catch(Ce=>{ve.error(`Gesture failed: ${Ce.message}`)})}function de(re){if(!r||!z||!re.isPrimary||re.pointerType==="mouse"&&re.button!==0)return;const te=Dv(N.current,re,!1);te&&(re.preventDefault(),re.currentTarget.setPointerCapture(re.pointerId),G.current={backend:r.backend,pointerId:re.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:re.clientX,startClientY:re.clientY,lastPoint:te,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:te.x,y:te.y}]},ce(G.current,{type:"begin",x:te.x,y:te.y}),p(!0))}function Ae(re){const te=G.current;if(!te||te.pointerId!==re.pointerId)return;const Ce=Dv(N.current,re,!0);if(!Ce)return;re.preventDefault();const me=Math.hypot(re.clientX-te.startClientX,re.clientY-te.startClientY)>$C,je=FC(Ce,te.lastPoint)>fU;if(te.lastPoint=Ce,me&&(je||!te.moved)){te.moved=!0;const We={type:"move",x:Ce.x,y:Ce.y};te.points.push(We),ce(te,We)}}async function ke(re){const te=G.current;if(!te||te.pointerId!==re.pointerId)return;re.preventDefault();const Ce=Dv(N.current,re,!0)??te.lastPoint,me=Math.hypot(re.clientX-te.startClientX,re.clientY-te.startClientY)>$C;G.current=null,p(!1);try{re.currentTarget.releasePointerCapture(re.pointerId)}catch{}const je={type:"end",x:Ce.x,y:Ce.y};if((te.backend==="android"||te.wsUrl)&&!te.liveFailed&&(!te.moved&&!me&&await wU(te.backend==="android"?pU:vU),await ce(te,je)||te.sentLiveFrames>0))return;if(!te.moved&&!me){Y(Ce,te.device);return}const We=[...te.points],Te=We[We.length-1];Te&&FC(Te,Ce)<=.001?We[We.length-1]=je:We.push(je),ne(We,te.device)}function Ee(re){const te=G.current;!te||te.pointerId!==re.pointerId||(G.current=null,p(!1),(te.backend==="android"||te.wsUrl)&&!te.liveFailed&&ce(te,{type:"end",x:te.lastPoint.x,y:te.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(ir,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(mi,{className:"px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(li,{className:"flex items-center gap-2",children:[l.jsx(UE,{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(ue,{variant:"outline",size:"icon",className:"size-8",onClick:T,disabled:!r||y!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:l.jsx(IE,{className:qe(y==="home"&&"animate-pulse")})}),l.jsx(ue,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&V(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||y!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:l.jsx(C_,{className:qe(y==="shutdown"&&"animate-pulse")})}),l.jsx(ue,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void Z(),disabled:n,"aria-label":"Refresh emulator",title:"Refresh",children:l.jsx(Et,{className:qe(n&&"animate-spin")})})]})]}),l.jsxs(fr,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":z&&!E,children:[z?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?I:void 0,onPointerDown:de,onPointerMove:Ae,onPointerUp:ke,onPointerCancel:Ee,children:q?l.jsx("img",{ref:re=>{N.current=re},src:P??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:re=>{U(re.currentTarget.naturalWidth,re.currentTarget.naturalHeight)},onError:F,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${k}`):r&&B?l.jsx(hU,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:re=>{N.current=re},onFrameSize:U},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"}),z&&!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(Et,{className:"size-4 animate-spin text-[var(--primary)]"}),l.jsx("span",{children:"Loading preview…"})]})})]})]}),l.jsxs(ir,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(mi,{children:[l.jsxs(li,{className:"flex items-center gap-2",children:[l.jsx(Xl,{className:"size-4"}),"Devices"]}),l.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),l.jsx(fr,{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:n?"Loading...":"No devices"}):l.jsx(vs,{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(re=>{const te=(r==null?void 0:r.deviceUdid)===re.id,Ce=u===re.id,me=m===re.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(Xl,{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:re.name}),l.jsxs(Pt,{variant:re.state==="booted"?"success":re.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"}),re.state]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:UC(re),children:UC(re)})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(ue,{size:"xs",variant:te?"outline":"default",onClick:()=>void K(re),disabled:Ce||m!==null,children:Ce?"Attaching…":te?"Reattach":"Attach"}),re.state==="booted"&&l.jsx(ue,{size:"icon-xs",variant:"destructive",onClick:()=>void V(re.id,re.name),disabled:u!==null||m!==null,"aria-label":`Shutdown ${re.name}`,title:`Shutdown ${re.name}`,children:l.jsx(C_,{className:qe(me&&"animate-pulse")})})]})]},`${re.backend}:${re.id}`)})})})})]})]})}function EU({embedded:e=!1}={}){const t=Vo(),[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState(!1),m=g.useCallback(async()=>{if(t){d(!0),o(null);try{i(await t.getStatus())}catch(p){o(p.message)}finally{d(!1)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(p){if(!(!t||p===(r==null?void 0:r.runtime.lifecycleMode))){d(!0),o(null);try{i(await t.setDaemonLifecycleMode(p)),ve.success(p==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(y){const b=y.message;o(b),ve.error(`Could not change Runtime mode: ${b}`)}finally{d(!1)}}}async function v(){if(t){d(!0),o(null);try{i(await t.restartDaemon()),ve.success("Local Runtime restarted")}catch(p){const y=p.message;o(y),ve.error(`Could not restart Runtime: ${y}`)}finally{d(!1)}}}return l.jsxs("div",{id:e?"runtime":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&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(ir,{"aria-busy":u,children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{children:"Runtime lifecycle"}),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(ue,{variant:"outline",size:"sm",disabled:u,onClick:()=>void m(),children:[l.jsx(Et,{className:u?"animate-spin":""}),"Check"]}),l.jsxs(ue,{variant:"outline",size:"sm",disabled:u,onClick:()=>void v(),children:[l.jsx(Et,{}),"Restart"]})]})]}),l.jsxs(fr,{className:"grid gap-5",children:[r?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:r.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(cm,{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(Pt,{variant:r.runtime.ready?"success":"warning",children:kU(r.runtime.state)}),l.jsx(Pt,{variant:"outline",children:r.runtime.managedBy==="app"?"Managed by app":r.runtime.managedBy==="external"?"External":"Not managed"})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:r.runtime.detail??RU(r)})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(ti,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),l.jsxs(hN,{id:"daemon-lifecycle-mode",value:r.runtime.lifecycleMode,disabled:u,className:"max-w-sm",onChange:p=>void f(p.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:r.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:[u&&l.jsx($e,{className:"size-4 animate-spin"}),u?"Checking Runtime…":"Runtime status is unavailable."]}),n&&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(nc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:n})]})]})]})]})}function kU(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function RU(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."}function NU({embedded:e=!1}={}){const t=Vo(),[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState("refresh"),m=g.useCallback(async(C=!1)=>{if(t){d("refresh"),o(null);try{i(await t.getStatus(C))}catch(E){o(E.message)}finally{d(null)}}},[t]);g.useEffect(()=>{m()},[m]);async function f(C){if(t){d("install"),o(null);try{i(await t.installCli(C)),ve.success("Terminal command installed")}catch(E){const S=E.message;o(S),ve.error(`Could not install the Terminal command: ${S}`);try{i(await t.getStatus(!0))}catch{}}finally{d(null)}}}async function v(C){if(t){d("remove"),o(null);try{i(await t.removeCli(C)),ve.success("Terminal command removed")}catch(E){const S=E.message;o(S),ve.error(`Could not remove the Terminal command: ${S}`);try{i(await t.getStatus(!0))}catch{}}finally{d(null)}}}const p=r==null?void 0:r.globalCli,y=(p==null?void 0:p.state)==="installed",b=(p==null?void 0:p.state)==="development",w=(p==null?void 0:p.state)==="installed"&&p.canInstall&&!!(p.path&&p.target&&p.path!==p.target);return l.jsxs("div",{id:e?"terminal-command":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&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(ir,{"aria-busy":u!==null,children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{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(ue,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(!0),children:[l.jsx(Et,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(fr,{className:"grid gap-3",children:[p?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:y?"grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":b?"grid size-10 place-items-center rounded-lg bg-[var(--muted)] text-[var(--muted-foreground)]":"grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:y?l.jsx(zs,{className:"size-5"}):l.jsx(u0,{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(Pt,{variant:y?"success":b?"outline":"warning",children:jU(p.state)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:AU(p)}),p.path&&l.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]",children:p.path}),w&&p.target&&l.jsxs("p",{className:"mt-1 break-all text-[11px] text-[var(--muted-foreground)]",children:["Recommended: ",l.jsx("code",{className:"font-mono",children:p.target})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2 sm:justify-self-end",children:[p.canInstall&&l.jsxs(ue,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>p.path&&void f(p.path),children:[u==="install"&&l.jsx($e,{className:"animate-spin"}),w?"Move command":p.state==="stale"?"Repair command":"Install command"]}),p.canRemove&&l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsxs(ue,{variant:"outline",size:"sm",disabled:u!==null,children:[l.jsx(qa,{}),"Remove command"]})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsx(Wi,{children:"Remove the Terminal command?"}),l.jsx(Vi,{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(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>p.path&&void v(p.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:[u==="refresh"&&l.jsx($e,{className:"size-4 animate-spin"}),u==="refresh"?"Checking command…":"Command status is unavailable."]}),n&&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(nc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:n})]})]})]})]})}function jU(e){switch(e){case"installed":return"Installed";case"missing":return"Not installed";case"stale":return"Needs repair";case"foreign":return"Managed externally";case"development":return"Development build";case"unwritable":case"error":return"Unavailable"}}function AU(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"development":return"Global Terminal command registration is disabled in development builds. Install a packaged Rynx app to manage the rynx command.";case"unwritable":return"Rynx could not find a supported location for the command.";case"error":return"Rynx could not check the command."}}function TU(){return l.jsxs("div",{className:"grid max-w-3xl gap-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Local Runtime"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Manage the Runtime bundled with Rynx and its Terminal command."})]}),l.jsx(EU,{embedded:!0}),l.jsx(NU,{embedded:!0})]})}function MU(){const{status:e,operation:t,error:r,checkForUpdates:i,installUpdate:n}=uy(),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?ve.error(`Could not check for updates: ${m.error}`):m.phase==="idle"?ve.success(`${m.appName} is up to date`):m.availableVersion&&ve.message(`Rynx ${m.availableVersion} is available`))}return l.jsxs(ir,{id:"software-update",className:"scroll-mt-6","aria-busy":o,children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{children:"Software update"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Review the installed Desktop version and check GitHub Releases for updates."})]}),l.jsxs(ue,{variant:"outline",size:"sm",disabled:o||!(e!=null&&e.supported),onClick:()=>void d(),children:[l.jsx(Et,{className:t==="check"||(e==null?void 0:e.phase)==="checking"?"animate-spin":""}),"Check for updates"]})]}),l.jsxs(fr,{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:LU(e),children:l.jsx(DU,{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(Pt,{variant:"outline",children:["Version ",e.currentVersion]}),l.jsx(Pt,{variant:e.channel==="preview"?"warning":"default",children:BU(e.channel)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:OU(e)}),e.lastCheckedAt&&l.jsxs("p",{className:"mt-1 text-[10px] text-[var(--muted-foreground)]",children:["Last checked ",PU(e.lastCheckedAt)]})]}),e.phase==="ready"&&l.jsxs(ue,{size:"sm",disabled:t==="install",onClick:()=>void n(),children:[t==="install"?l.jsx($e,{className:"animate-spin"}):l.jsx(Ou,{}),"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($e,{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(nc,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:u})]})]})]})}function DU({status:e}){return e.phase==="checking"||e.phase==="installing"?l.jsx($e,{className:"size-5 animate-spin"}):e.phase==="downloading"?l.jsx(ad,{className:"size-5"}):e.phase==="ready"?l.jsx(Ou,{className:"size-5"}):l.jsx(c0,{className:"size-5"})}function LU(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 OU(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 BU(e){switch(e){case"local":return"Local build";case"preview":return"Preview channel";case"stable":return"Stable channel"}}function PU(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function zU({plugins:e,agents:t,desktopIntegrationAvailable:r}){const i=Fa(),n=d=>i(pt[d]),o=e.filter(d=>d.enabled).length,u=e.filter(d=>d.runtimeState==="running").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:"Plugins own integrations and their settings; agents define task behavior."})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsx(qC,{icon:lm,label:"Plugins",value:e.length,sub:`${o} enabled · ${u} healthy`,onClick:()=>n("plugins")}),l.jsx(qC,{icon:o0,label:"Agents",value:t.length,sub:t.length===1?"1 defined":`${t.length} defined`,onClick:()=>n("agents")})]}),l.jsxs(ir,{children:[l.jsxs(mi,{children:[l.jsx(li,{children:"Plugins"}),l.jsx(ue,{variant:"outline",size:"sm",onClick:()=>n("plugins"),children:"Manage"})]}),l.jsx(fr,{className:"p-0",children:e.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No plugins installed. Add one from a Market or a Git repository with the Rynx CLI.",l.jsx("div",{className:"mt-3",children:l.jsx(ue,{size:"sm",onClick:()=>n("plugins"),children:"View plugins"})})]}):l.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(d=>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:d.pluginId}),l.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[d.id," · v",d.version]})]}),l.jsx("span",{className:"rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:d.enabled?d.runtimeState:"disabled"})]},d.id))})})]}),r&&l.jsx(MU,{})]})}function qC({icon:e,label:t,value:r,sub:i,onClick:n}){return l.jsx(ir,{children:l.jsxs("button",{onClick:n,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})]})]})})}function sA({description:e="You're about to visit an external website. Review the complete destination before continuing.",onConfirm:t,onOpenChange:r,open:i,url:n}){const[o,u]=g.useState(!1);g.useEffect(()=>{i||u(!1)},[i]);const d=async()=>{try{await navigator.clipboard.writeText(n),u(!0)}catch{}};return l.jsx(_s,{open:i,onOpenChange:r,children:l.jsxs(qi,{className:"sm:max-w-xl",children:[l.jsxs(xs,{children:[l.jsx(Zk,{children:l.jsx(b_,{})}),l.jsx(Wi,{children:"Open external link?"}),l.jsx(Vi,{children:e})]}),l.jsxs("div",{className:"relative",children:[l.jsx("code",{className:"block max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-lg border border-[var(--border)] bg-[var(--muted)]/40 py-3 pr-11 pl-3 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:n}),l.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2","aria-label":o?"Link copied":"Copy link",title:o?"Link copied":"Copy link",onClick:()=>void d(),children:o?l.jsx(zs,{}):l.jsx(d0,{})})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{onClick:t,children:"Open link"})]})]})})}function IU(e){const t=$U(e)?e.url:void 0;if(typeof t!="string"||!t.trim())throw new Error("external URL is required");let r;try{r=new URL(t)}catch{throw new Error("external URL is invalid")}if(r.protocol!=="https:")throw new Error("only HTTPS links may be opened");if(r.username||r.password)throw new Error("external URLs must not contain credentials");return r.href}function $U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const nA=1024*1024,UU=16,HU=3e4,FU=2e3,qU=/^[A-Za-z][A-Za-z0-9._:-]{0,127}$/;function WU({plugins:e,theme:t,onChange:r}){const[i,n]=g.useState(),[o,u]=g.useState(),[d,m]=g.useState("discover"),[f,v]=g.useState(null),[p,y]=g.useState(),[b,w]=g.useState(!0),[C,E]=g.useState(!1),[S,k]=g.useState(),[j,N]=g.useState(),[M,D]=g.useState(),[H,L]=g.useState(!1),G=g.useRef(0),Z=g.useRef(!1),q=g.useRef(!1),P=e.find(T=>T.id===i),B=g.useCallback(async()=>{const T=++G.current;w(!0);try{const V=await xe.listPluginMarketplaces();if(T!==G.current)return!0;const K=Z.current;return Z.current=!1,v(V),y(void 0),K&&r(),!0}catch(V){return T!==G.current?!0:(Z.current=!0,y(V.message),!1)}finally{T===G.current&&w(!1)}},[r]);g.useEffect(()=>{let T=!1,V;const K=async()=>{!await B()&&!T&&(V=window.setTimeout(()=>void K(),FU))};return K(),()=>{T=!0,V!==void 0&&window.clearTimeout(V),G.current+=1}},[B]),g.useEffect(()=>{i&&!P&&n(void 0)},[P,i]);const z=async T=>{u(T.id);try{await xe.setPluginEnabled(T.id,!T.enabled),await r()}catch(V){ve.error(`Failed to ${T.enabled?"disable":"enable"} plugin: ${V.message}`)}finally{u(void 0)}},I=async T=>{N(T);try{D(await xe.preparePluginInstallation({operation:"install",marketplacePlugin:T}))}catch(V){ve.error(`Could not prepare ${T}: ${V.message}`)}finally{N(void 0)}},A=async T=>{N(T);try{const V=await xe.preparePluginInstallation({operation:"update",pluginId:T});if(V.unchanged){await xe.cancelPluginInstallation(V.token).catch(()=>!1),ve.info(`${T} is already up to date.`);return}D(V)}catch(V){ve.error(`Could not prepare update for ${T}: ${V.message}`)}finally{N(void 0)}},$=()=>{const T=M;D(void 0),T&&xe.cancelPluginInstallation(T.token).catch(()=>!1)},U=async()=>{if(!M)return;const T=!!M.existing;L(!0);try{const V=await xe.commitPluginInstallation(M.token,{overwrite:!!M.existing,expectedDigest:M.artifact.digest});D(void 0),ve.success(`${T?"Updated":"Installed"} ${V.plugin.id} v${V.plugin.version}.`+(T?" No Rynx restart required.":"")),await r(),m("installed")}catch(V){D(void 0),ve.error(`${T?"Update":"Installation"} failed: ${V.message}`)}finally{L(!1)}},F=async T=>{if(!q.current){q.current=!0,k(T.id);try{await xe.refreshPluginMarketplace(T.id),await Promise.all([B(),r()]),ve.success(`Refreshed ${T.id}`)}catch(V){ve.error(`Market refresh failed: ${V.message}`)}finally{q.current=!1,k(void 0)}}},W=async T=>{if(!q.current){q.current=!0,k(T.id);try{await xe.removePluginMarketplace(T.id),await B(),ve.success(`Removed ${T.id}`)}catch(V){ve.error(`Market removal failed: ${V.message}`)}finally{q.current=!1,k(void 0)}}};return P!=null&&P.hasSettingsUi?l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[l.jsxs(ue,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>n(void 0),children:[l.jsx(jo,{}),"Plugins"]}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("h1",{className:"text-xl font-semibold tracking-tight",children:[P.pluginId," settings"]}),l.jsx(oA,{plugin:P})]}),l.jsxs("div",{className:"truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["Sandboxed plugin UI · ",P.id," · v",P.version]})]})]}),l.jsx(ir,{className:"overflow-hidden",children:l.jsx(fr,{className:"p-0",children:l.jsx(QU,{plugin:P,theme:t,onChange:r})})})]}):l.jsxs("div",{className:"grid gap-5",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Plugins"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Discover plugins from trusted Markets, then review their source and executable entries before installation."})]}),l.jsxs(ue,{size:"sm",className:"shrink-0",onClick:()=>E(!0),children:[l.jsx(ri,{}),"Add Market"]})]}),l.jsxs(X$,{value:d,onValueChange:m,children:[l.jsxs(zj,{"aria-label":"Plugin management views",children:[l.jsxs(pf,{value:"discover",className:"gap-1.5 leading-none",children:["Discover",l.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(f==null?void 0:f.reduce((T,V)=>T+V.plugins.length,0))??0})]}),l.jsxs(pf,{value:"installed",className:"gap-1.5 leading-none",children:["Installed",l.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:e.length})]}),l.jsxs(pf,{value:"markets",className:"gap-1.5 leading-none",children:["Markets",l.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(f==null?void 0:f.length)??0})]})]}),l.jsx(gf,{value:"discover",children:f===null&&p?l.jsx(WC,{error:p,retrying:b,onRetry:()=>void B()}):l.jsx(VU,{markets:f,installed:e,preparingId:j,onAddMarket:()=>E(!0),onInstall:T=>void I(T)})}),l.jsx(gf,{value:"installed",children:l.jsx(GU,{plugins:e,mutatingId:o,preparingId:j,onBrowse:()=>m("discover"),onConfigure:n,onUpdate:T=>void A(T),onChangeEnabled:T=>void z(T)})}),l.jsx(gf,{value:"markets",children:f===null&&p?l.jsx(WC,{error:p,retrying:b,onRetry:()=>void B()}):l.jsx(YU,{markets:f,mutatingId:S,onAdd:()=>E(!0),onRefresh:T=>void F(T),onRemove:T=>void W(T)})})]}),l.jsx(KU,{open:C,onOpenChange:E,onAdded:async T=>{await B(),m("discover"),ve.success(`Added ${T.id}`)}}),l.jsx(XU,{preparation:M,committing:H,onCancel:$,onCommit:()=>void U()})]})}function VU({markets:e,installed:t,preparingId:r,onAddMarket:i,onInstall:n}){const[o,u]=g.useState(""),d=new Set(t.map(p=>p.id)),m=(e??[]).flatMap(p=>p.plugins.map(y=>({id:`${y.id}@${p.id}`,pluginId:y.id,market:p}))),f=o.trim().toLowerCase(),v=f?m.filter(({id:p})=>p.includes(f)):m;return e===null?l.jsx(aA,{label:"Loading plugin catalogs…"}):e.length===0?l.jsx(dy,{icon:Df,title:"Add a Market to discover plugins",description:"A Market is a Git or local catalog. Adding it downloads metadata only and never installs plugin code.",action:l.jsxs(ue,{size:"sm",onClick:i,children:[l.jsx(ri,{})," Add Market"]})}):l.jsxs(ir,{children:[l.jsxs(mi,{className:"flex-col items-stretch gap-3 sm:flex-row sm:items-center",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{children:"Available plugins"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Catalog entries stay inert until you review and install one."})]}),l.jsxs("div",{className:"relative w-full sm:w-64",children:[l.jsx(qE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(At,{"aria-label":"Search available plugins",className:"pl-8",value:o,placeholder:"Search plugins or Markets",onChange:p=>u(p.target.value)})]})]}),l.jsx(fr,{className:"p-0",children:v.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No catalog entries match “",o.trim(),"”."]}):l.jsx("div",{className:"divide-y divide-[var(--border)]",children:v.map(({id:p,pluginId:y,market:b})=>{const w=d.has(p),C=r===p;return l.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 sm:flex-row sm:items-center",children:[l.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(lm,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("strong",{className:"text-sm",children:y}),l.jsx(Pt,{variant:"outline",className:"font-mono",children:b.id})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:p})]}),l.jsx(ue,{size:"sm",variant:w?"outline":"default",disabled:w||!!r,onClick:()=>n(p),children:w?l.jsxs(l.Fragment,{children:[l.jsx(zs,{})," Installed"]}):C?l.jsxs(l.Fragment,{children:[l.jsx($e,{className:"animate-spin"})," Preparing…"]}):l.jsxs(l.Fragment,{children:[l.jsx(ad,{})," Install"]})})]},p)})})})]})}function GU({plugins:e,mutatingId:t,preparingId:r,onBrowse:i,onConfigure:n,onUpdate:o,onChangeEnabled:u}){return e.length===0?l.jsx(dy,{icon:zS,title:"No plugins installed",description:"Browse your registered Markets and review a plugin before installing it.",action:l.jsxs(ue,{size:"sm",onClick:i,children:[l.jsx(zS,{})," Browse plugins"]})}):l.jsx("div",{className:"grid gap-3",children:e.map(d=>l.jsx(ir,{children:l.jsxs(fr,{className:"flex flex-col gap-4 sm:flex-row sm:items-center",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(lm,{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("strong",{className:"text-sm",children:d.pluginId}),l.jsx(oA,{plugin:d}),l.jsx(Pt,{variant:"outline",children:d.marketplaceId})]}),l.jsxs("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["v",d.version]}),d.runtimeError&&l.jsxs("div",{className:"mt-2 flex items-start gap-1.5 text-xs text-[var(--danger)]",children:[l.jsx(Ms,{className:"mt-0.5 size-3.5 shrink-0"}),d.runtimeError]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.hasSettingsUi&&l.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>n(d.id),children:[l.jsx(ZO,{}),"Configure"]}),d.updateState!=="current"&&l.jsxs(ue,{variant:"outline",size:"sm",disabled:!!r||t!==void 0,onClick:()=>o(d.id),children:[l.jsx(Et,{className:r===d.id?"animate-spin":""}),r===d.id?"Checking…":d.updateState==="available"?"Update":"Check for updates"]}),l.jsx(ly,{"aria-label":`${d.enabled?"Disable":"Enable"} ${d.pluginId}`,checked:d.enabled,disabled:t===d.id,onCheckedChange:()=>u(d)})]})]})},d.id))})}function YU({markets:e,mutatingId:t,onAdd:r,onRefresh:i,onRemove:n}){return e===null?l.jsx(aA,{label:"Loading Markets…"}):e.length===0?l.jsx(dy,{icon:Df,title:"No Markets registered",description:"Add a trusted Git repository or local catalog to make its plugins discoverable.",action:l.jsxs(ue,{size:"sm",onClick:r,children:[l.jsx(ri,{})," Add Market"]})}):l.jsxs(ir,{children:[l.jsxs(mi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{children:"Registered Markets"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Built-in Markets update with Rynx. User-added Markets can be refreshed independently."})]}),l.jsxs(ue,{size:"sm",variant:"outline",onClick:r,children:[l.jsx(ri,{})," Add Market"]})]}),l.jsx(fr,{className:"p-0",children:l.jsx("div",{className:"divide-y divide-[var(--border)]",children:e.map(o=>l.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center",children:[l.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Df,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("strong",{className:"font-mono text-sm",children:o.id}),l.jsx(Pt,{variant:"outline",children:o.builtIn?"Built-in":o.source}),l.jsxs(Pt,{variant:"default",children:[o.plugins.length," plugins"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:o.builtIn?`Managed by Rynx · updated ${new Date(o.refreshedAt).toLocaleString()}`:`${o.id} · ${ZU(o.resolvedRevision)} · refreshed ${new Date(o.refreshedAt).toLocaleString()}`})]}),!o.builtIn&&l.jsxs("div",{className:"flex shrink-0 gap-2",children:[l.jsxs(ue,{size:"sm",variant:"outline",disabled:t!==void 0,onClick:()=>i(o),children:[l.jsx(Et,{className:t===o.id?"animate-spin":""}),"Refresh"]}),l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsx(ue,{size:"icon-sm",variant:"ghost",disabled:t!==void 0,"aria-label":`Remove ${o.id}`,children:l.jsx(qa,{})})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsx(Wi,{children:"Remove this Market?"}),l.jsxs(Vi,{children:[o.id," will disappear from Discover. A Market with installed plugins cannot be removed until those plugins are uninstalled."]})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>n(o),children:"Remove Market"})]})]})]})]})]},o.id))})})]})}function KU({open:e,onOpenChange:t,onAdded:r}){const[i,n]=g.useState(""),[o,u]=g.useState(!1),d=()=>{n(""),t(!1)},m=async()=>{if(i.trim()){u(!0);try{const f=await xe.addPluginMarketplace({source:i.trim()});d(),await r(f)}catch(f){ve.error(`Could not add Market: ${f.message}`)}finally{u(!1)}}};return l.jsx($o,{open:e,onOpenChange:f=>{o||(f?t(!0):d())},children:l.jsxs(Ga,{className:"sm:max-w-lg",showCloseButton:!o,children:[l.jsxs(Uo,{children:[l.jsx(Ya,{children:"Add a Market"}),l.jsxs(Ho,{children:["Register a Git repository or local directory containing"," ",l.jsx("code",{children:".rynx-plugin/marketplace.json"}),". This reads the catalog only."]})]}),l.jsx("div",{className:"grid gap-4",children:l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"market-source",children:"Source"}),l.jsx(At,{id:"market-source",autoFocus:!0,value:i,placeholder:"owner/repo or https://github.com/owner/repo",onChange:f=>n(f.target.value)}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"GitHub shorthand, a credential-free Git URL, or an absolute local path."})]})}),l.jsxs(ac,{children:[l.jsx(ue,{variant:"outline",disabled:o,onClick:d,children:"Cancel"}),l.jsxs(ue,{disabled:o||!i.trim(),onClick:()=>void m(),children:[o?l.jsx($e,{className:"animate-spin"}):l.jsx(Df,{}),o?"Adding…":"Add Market"]})]})]})})}function XU({preparation:e,committing:t,onCancel:r,onCommit:i}){const n=e==null?void 0:e.artifact;return l.jsx($o,{open:!!e,onOpenChange:o=>{!o&&!t&&r()},children:l.jsx(Ga,{className:"max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-2xl",children:e&&n&&l.jsxs(l.Fragment,{children:[l.jsxs(Uo,{className:"px-5 pb-4 pr-12 pt-5",children:[l.jsxs(Ya,{children:["Review ",e.existing?"plugin update":"plugin installation"]}),l.jsx(Ho,{children:"Rynx inspected an immutable package snapshot. Confirm its source and executable entries before the active installation changes."})]}),l.jsx(vs,{className:"min-h-0",children:l.jsxs("div",{className:"grid gap-3 px-5 pb-5",children:[l.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("strong",{children:n.pluginId}),l.jsx(Pt,{variant:"outline",children:n.marketplaceId}),l.jsxs(Pt,{variant:"default",children:["v",n.version]})]}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:n.id}),l.jsx("div",{className:"break-all font-mono text-[10px] leading-relaxed text-[var(--muted-foreground)]",children:n.digest}),l.jsxs("dl",{className:"grid gap-2 border-t border-[var(--border)] pt-3 text-xs",children:[l.jsx(Sa,{label:"Source",children:n.resolvedSource.type==="git"?n.resolvedSource.repository:"Local directory (path hidden)"}),l.jsx(Sa,{label:"Subdirectory",children:n.resolvedSource.subdirectory}),n.resolvedSource.type==="git"&&l.jsx(Sa,{label:"Commit",children:n.resolvedSource.commit})]}),(n.runtimeEntry||n.settingsBackgroundEntry||n.commandsEntry||n.settingsUiEntry||n.skillDirectory)&&l.jsxs("div",{className:"grid gap-2 border-t border-[var(--border)] pt-3",children:[l.jsx("div",{className:"text-xs font-medium",children:"Included components"}),l.jsxs("dl",{className:"grid gap-2 text-xs",children:[n.runtimeEntry&&l.jsx(Sa,{label:n.runtimeEntry.type==="module"?"Runtime module":"Runtime process",children:n.runtimeEntry.type==="module"?n.runtimeEntry.entry:[n.runtimeEntry.command,...n.runtimeEntry.args].join(" ")}),n.commandsEntry&&l.jsx(Sa,{label:"Commands",children:n.commandsEntry}),n.settingsUiEntry&&l.jsx(Sa,{label:"Settings UI",children:n.settingsUiEntry}),n.settingsBackgroundEntry&&l.jsx(Sa,{label:n.settingsBackgroundEntry.type==="module"?"Settings background":"Settings process",children:n.settingsBackgroundEntry.type==="module"?n.settingsBackgroundEntry.entry:[n.settingsBackgroundEntry.command,...n.settingsBackgroundEntry.args].join(" ")}),n.skillDirectory&&l.jsx(Sa,{label:"Skills",children:n.skillDirectory})]})]})]}),e.existing&&l.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-[var(--warning)]/35 bg-[var(--warning)]/10 p-3 text-xs",children:[l.jsx(Ms,{className:"mt-0.5 size-4 shrink-0 text-[var(--warning)]"}),"This replaces ",e.existing.id," v",e.existing.version,". Its enabled state and plugin-owned data are retained."]})]})}),l.jsxs(ac,{className:"mx-0 mb-0 rounded-none rounded-b-xl px-5 py-3",children:[l.jsx(ue,{variant:"outline",disabled:t,onClick:r,children:"Cancel"}),l.jsxs(ue,{disabled:t,onClick:i,children:[t?l.jsx($e,{className:"animate-spin"}):e.existing?l.jsx(Et,{}):l.jsx(ad,{}),t?e.existing?"Updating…":"Installing…":e.existing?"Update plugin":"Install plugin"]})]})]})})})}function Sa({label:e,children:t}){return l.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-[7rem_minmax(0,1fr)] sm:gap-3",children:[l.jsx("dt",{className:"text-[var(--muted-foreground)]",children:e}),l.jsx("dd",{className:"min-w-0",children:l.jsx("code",{className:"break-all text-[11px]",children:t})})]})}function dy({icon:e,title:t,description:r,action:i}){return l.jsx(ir,{children:l.jsxs(fr,{className:"grid justify-items-center gap-3 py-12 text-center",children:[l.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(e,{className:"size-5"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:t}),l.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:r})]}),i]})})}function aA({label:e}){return l.jsx(ir,{children:l.jsxs(fr,{className:"flex items-center justify-center gap-2 py-12 text-sm text-[var(--muted-foreground)]",children:[l.jsx($e,{className:"size-4 animate-spin"}),e]})})}function WC({error:e,retrying:t,onRetry:r}){return l.jsx(ir,{role:"alert",children:l.jsxs(fr,{className:"grid justify-items-center gap-3 py-12 text-center",children:[l.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--danger)]/10 text-[var(--danger)]",children:l.jsx(Ms,{className:"size-5"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:"Rynx Runtime is unavailable"}),l.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:"Plugin catalogs could not be loaded. Rynx will retry automatically."}),l.jsx("p",{className:"mt-2 max-w-md break-all font-mono text-[10px] text-[var(--danger)]",children:e})]}),l.jsxs(ue,{size:"sm",variant:"outline",disabled:t,onClick:r,children:[l.jsx(Et,{className:t?"animate-spin":""}),t?"Retrying…":"Retry now"]})]})})}function ZU(e){return e==="local"||e.length<=12?e:e.slice(0,12)}function oA({plugin:e}){if(!e.enabled)return null;const t=e.runtimeState,r=t==="absent"?"Unavailable":t.charAt(0).toUpperCase()+t.slice(1);return l.jsx("span",{className:qe("rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px]",t==="running"&&"text-[var(--success)]",(t==="failed"||t==="degraded")&&"text-[var(--danger)]",(t==="stopped"||t==="absent")&&"text-[var(--muted-foreground)]"),children:r})}function QU({plugin:e,theme:t,onChange:r}){const i=g.useRef(null),n=g.useRef(()=>{}),o=g.useRef(null),u=g.useRef(void 0),d=g.useRef(void 0),[m,f]=g.useState(),[v,p]=g.useState(),[y,b]=g.useState(),w=g.useCallback((S,k)=>{const j=IU(S);return d.current?Promise.reject(new Error("another external link confirmation is already open")):new Promise((N,M)=>{let D=!1,H;const L=()=>{k.removeEventListener("abort",G),d.current===H&&(d.current=void 0,b(void 0))},G=()=>{D||(D=!0,L(),M(new Error("external link request was cancelled")))};H={url:j,settle(Z){D||(D=!0,L(),Z&&window.open(j,"_blank","noopener,noreferrer"),N({opened:Z}))}},d.current=H,b(H),k.aborted?G():k.addEventListener("abort",G,{once:!0})})},[]);g.useEffect(()=>{const S=new AbortController;return n.current(),u.current=void 0,f(void 0),p(void 0),xe.pluginSettingsUi(e.id,S.signal).then(f).catch(k=>{S.signal.aborted||p(k.message)}),()=>{S.abort(),n.current()}},[e.id,e.updatedAt]),g.useEffect(()=>{var S;(S=o.current)==null||S.postMessage(JU(t))},[t]);const C=g.useCallback(()=>{var H;if(n.current(),!m||!((H=i.current)!=null&&H.contentWindow))return;const S=new MessageChannel,k=new Set,j=new Set;let N=!0,M=0;const D=L=>{if(!N)return;const G=rH(L);S.port1.postMessage(G)};S.port1.onmessage=L=>{const G=tH(L.data);if(!G.ok){D({id:G.id,error:G.error});return}if(j.has(G.id)){D({id:G.id,error:"duplicate request id"});return}if(M>=UU){D({id:G.id,error:"too many requests in flight"});return}j.add(G.id),M+=1;const Z=new AbortController;k.add(Z);const q=window.setTimeout(()=>Z.abort(),HU);eH(e.id,m.generation,w,G.method,G.params,Z.signal).then(P=>{D({id:G.id,result:P}),G.method!=="host.openExternal"&&r()}).catch(P=>{D({id:G.id,error:Z.signal.aborted?"request timed out":P.message})}).finally(()=>{window.clearTimeout(q),k.delete(Z),j.delete(G.id),M-=1})},S.port1.onmessageerror=()=>{D({id:null,error:"invalid plugin UI message"})},S.port1.start(),o.current=S.port1,i.current.contentWindow.postMessage({type:"rynx-plugin-connect",pluginId:e.id,appearance:{colorScheme:t}},"*",[S.port2]),n.current=()=>{if(N){N=!1;for(const L of k)L.abort();k.clear(),j.clear(),o.current===S.port1&&(o.current=null),S.port1.close(),S.port2.close()}}},[m,r,e.id,w,t]),E=g.useCallback(()=>{if(m){if(u.current===m.generation){n.current();return}u.current=m.generation,C()}},[C,m]);return v?l.jsx("div",{className:"p-5 text-sm text-[var(--danger)]",children:v}):m?l.jsxs(l.Fragment,{children:[l.jsx("iframe",{ref:i,title:`${e.pluginId} settings`,className:"h-[calc(100dvh-10rem)] min-h-[28rem] max-h-[64rem] w-full border-0 bg-[var(--background)]",sandbox:"allow-scripts",referrerPolicy:"no-referrer",srcDoc:m.html,onLoad:E}),l.jsx(sA,{open:!!y,url:(y==null?void 0:y.url)??"",onOpenChange:S=>{S||y==null||y.settle(!1)},description:l.jsxs(l.Fragment,{children:["The ",e.pluginId," plugin wants to open this address in a new browser tab. Review the complete destination before continuing."]}),onConfirm:()=>y==null?void 0:y.settle(!0)})]}):l.jsx("div",{className:"p-5 text-sm text-[var(--muted-foreground)]",children:"Loading plugin UI…"})}function JU(e){return{type:"rynx-host-appearance",appearance:{colorScheme:e}}}async function eH(e,t,r,i,n,o){if(i==="host.openExternal")return r(n,o);if(i.startsWith("host."))throw new Error(`unknown Rynx host settings method "${i}"`);return xe.pluginSettingsCall(e,t,i,n,o)}function tH(e){let t;try{t=lA(e)}catch{return{ok:!1,id:null,error:"request is not serializable"}}if(t>nA)return{ok:!1,id:null,error:"request exceeds 1 MiB"};if(typeof e!="object"||e===null||Array.isArray(e))return{ok:!1,id:null,error:"request must be an object"};const r=e,i=typeof r.id=="string"||typeof r.id=="number"&&Number.isSafeInteger(r.id)?r.id:null;return i===null||typeof r.method!="string"||!qU.test(r.method)?{ok:!1,id:i,error:"request id or method is invalid"}:{ok:!0,id:i,method:r.method,params:r.params}}function rH(e){try{return lA(e)<=nA?e:{id:VC(e),error:"response exceeds 1 MiB"}}catch{return{id:VC(e),error:"response is not serializable"}}}function lA(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}function VC(e){if(typeof e!="object"||e===null)return null;const t=e.id;return typeof t=="string"||typeof t=="number"?t:null}function cA(e){const t=[...new Set(e.directories.map(i=>i.trim()).filter(Boolean))],r=e.primary.trim();return{name:e.name.trim()||iH(r),directories:t,primary:r}}function iH(e){const t=e.trim().replace(/[\\/]+$/,"");if(!t||/^[A-Za-z]:$/.test(t))return"";const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return t.slice(r+1)}const sH={name:"",directories:[],primary:""},Vf="local";function nH(){const e=Hr(),[t,r]=g.useState([]),[i,n]=g.useState(!0),[o,u]=g.useState(),[d,m]=g.useState(()=>{var p;return((p=e.state)==null?void 0:p.createProject)===!0?"new":null}),f=g.useRef(0);async function v(p=!1){const y=++f.current;p&&n(!0);try{const b=await xe.listProjects(Vf);if(y!==f.current)return;r(b),u(void 0)}catch(b){if(y!==f.current)return;r([]),u(`Could not load projects: ${b.message}`)}finally{y===f.current&&n(!1)}}return g.useEffect(()=>(r([]),u(void 0),n(!0),v(),()=>{f.current+=1}),[]),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs(ir,{children:[l.jsxs(mi,{className:"flex-wrap",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(li,{children:["Projects"," ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:t.length})]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Reusable source directories stored on This device."})]}),l.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none",children:l.jsxs(ue,{size:"sm",onClick:()=>m("new"),children:[l.jsx(ri,{})," New project"]})})]}),l.jsx(fr,{className:"p-0",children:i?l.jsxs("div",{className:"flex min-h-36 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",role:"status",children:[l.jsx($e,{className:"size-4 animate-spin"})," Loading projects…"]}):o?l.jsxs("div",{className:"grid min-h-36 place-items-center gap-3 px-5 py-8 text-center",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"Projects are unavailable"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:o})]}),l.jsx(ue,{variant:"outline",size:"sm",onClick:()=>void v(!0),children:"Retry"})]}):t.length===0?l.jsx("div",{className:"grid min-h-44 place-items-center px-5 py-8 text-center",children:l.jsxs("div",{className:"max-w-sm",children:[l.jsx("span",{className:"mx-auto flex size-10 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(w_,{className:"size-5"})}),l.jsx("p",{className:"mt-3 text-sm font-medium",children:"No projects on this device"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Save one or more directories so a new Session can start in the same workspace."}),l.jsxs(ue,{className:"mt-4",size:"sm",onClick:()=>m("new"),children:[l.jsx(ri,{})," New project"]})]})}):l.jsx("ul",{className:"divide-y divide-[var(--border)]",children:t.map(p=>l.jsx(aH,{project:p,onEdit:()=>m(p),onDeleted:()=>void v()},p.id))})})]}),l.jsx(oH,{open:d!==null,project:d==="new"?void 0:d??void 0,onOpenChange:p=>{p||m(null)},onSaved:async()=>{m(null),await v()}},d==="new"?"new":(d==null?void 0:d.id)??"closed")]})}function aH({project:e,onEdit:t,onDeleted:r}){const[i,n]=g.useState(!1);async function o(){n(!0);try{await xe.deleteProject(Vf,e.id),ve.success(`Project "${e.name}" removed`),r()}catch(u){ve.error(`Delete failed: ${u.message}`)}finally{n(!1)}}return l.jsxs("li",{className:"grid gap-3 px-5 py-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Uu,{className:"size-4 shrink-0 text-[var(--primary)]","aria-hidden":"true"}),l.jsx("span",{className:"truncate text-sm font-medium",children:e.name}),l.jsxs("span",{className:"rounded-md bg-[var(--muted)] px-1.5 py-0.5 font-mono text-[9px] text-[var(--muted-foreground)]",children:[e.directories.length," ",e.directories.length===1?"folder":"folders"]})]}),l.jsxs("div",{className:"mt-1.5 flex min-w-0 items-center gap-1.5 pl-6 font-mono text-[10px] text-[var(--muted-foreground)]",children:[l.jsx(YE,{className:"size-3 shrink-0","aria-hidden":"true"}),l.jsx("span",{className:"truncate",title:e.primary,children:e.primary})]})]}),l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsxs(ue,{variant:"ghost",size:"sm",onClick:t,children:[l.jsx(FE,{})," Edit"]}),l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsx(ue,{variant:"ghost",size:"icon-sm",className:"text-[var(--destructive)]","aria-label":`Delete ${e.name}`,disabled:i,children:i?l.jsx($e,{className:"animate-spin"}):l.jsx(qa,{})})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:["Remove project “",e.name,"”?"]}),l.jsx(Vi,{children:"This removes only the saved project. It does not delete any directories or affect existing Sessions."})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>void o(),children:"Remove project"})]})]})]})]})]})}function oH({open:e,project:t,onOpenChange:r,onSaved:i}){const n=Vo(),o=!!(n!=null&&n.chooseDirectory),[u,d]=g.useState(()=>t?{name:t.name,directories:[...t.directories],primary:t.primary}:{...sH}),[m,f]=g.useState(!1),[v,p]=g.useState(!1),y=g.useMemo(()=>lH(u),[u]);function b(){d(k=>({...k,directories:[...k.directories,""]}))}async function w(){var j;const k=await((j=n==null?void 0:n.chooseDirectory)==null?void 0:j.call(n));k&&d(N=>N.directories.includes(k)?N:{...N,directories:[...N.directories,k],primary:N.primary||k})}function C(k,j){d(N=>{const M=N.directories[k]??"",D=N.directories.map((L,G)=>G===k?j:L);let H=N.primary;return H===M&&(H=j),!H&&j&&(H=j),{...N,directories:D,primary:H}})}function E(k){d(j=>{const N=j.directories[k],M=j.directories.filter((D,H)=>H!==k);return{...j,directories:M,primary:j.primary===N?M.find(Boolean)??"":j.primary}})}async function S(){if(p(!0),y)return;const k=cA(u);f(!0);try{t?(await xe.updateProject(Vf,t.id,k),ve.success(`Project "${k.name}" updated`)):(await xe.createProject(Vf,k),ve.success(`Project "${k.name}" created`)),await i()}catch(j){ve.error(`Save failed: ${j.message}`)}finally{f(!1)}}return l.jsx($o,{open:e,onOpenChange:r,children:l.jsxs(Ga,{className:"sm:max-w-2xl",children:[l.jsxs(Uo,{children:[l.jsx(Ya,{children:t?"Edit project":"Create project"}),l.jsx(Ho,{children:"These paths belong to This device. The Primary directory becomes the Session working directory; every listed directory is available to the Session."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:k=>{k.preventDefault(),S()},children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"project-name",children:"Name"}),l.jsx(At,{id:"project-name",value:u.name,onChange:k=>d(j=>({...j,name:k.target.value})),placeholder:"Defaults to Primary folder name",maxLength:128,autoFocus:!0})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[l.jsxs("div",{children:[l.jsx(ti,{children:"Source directories"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Choose local folders or enter absolute paths."})]}),l.jsxs("div",{className:"flex gap-1.5",children:[o&&l.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>void w(),children:[l.jsx(w_,{})," Choose folder"]}),l.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:b,children:[l.jsx(ri,{})," ",o?"Enter path":"Add path"]})]})]}),l.jsx("div",{className:"overflow-hidden rounded-lg border border-[var(--border)]",children:u.directories.length===0?l.jsxs("button",{type:"button",className:"flex min-h-24 w-full items-center justify-center gap-2 text-sm text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/40 hover:text-[var(--foreground)]",onClick:o?()=>void w():b,children:[l.jsx(w_,{className:"size-4"}),o?"Choose a source folder":"Add an absolute directory path"]}):l.jsx("div",{className:"divide-y divide-[var(--border)]",children:u.directories.map((k,j)=>{const N=k!==""&&k===u.primary;return l.jsxs("div",{className:"grid gap-2 p-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"relative min-w-0",children:[l.jsx(Uu,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(At,{value:k,onChange:M=>C(j,M.target.value),placeholder:"/Users/name/Workspace/project",className:"pl-8 font-mono text-xs","aria-label":`Source directory ${j+1}`,autoCapitalize:"none",autoCorrect:"off",spellCheck:!1})]}),l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[l.jsxs(ue,{type:"button",variant:N?"secondary":"ghost",size:"sm",className:qe(N&&"text-[var(--primary)]"),disabled:!k.trim(),onClick:()=>d(M=>({...M,primary:k})),children:[N?l.jsx(zs,{}):l.jsx(YE,{}),N?"Primary":"Make primary"]}),l.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove source directory ${j+1}`,onClick:()=>E(j),children:l.jsx(cn,{})})]})]},j)})})}),v&&y&&l.jsx("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:y})]}),l.jsxs(ac,{children:[l.jsx(ue,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),l.jsxs(ue,{type:"submit",disabled:m,children:[m?l.jsx($e,{className:"animate-spin"}):null,t?"Save changes":"Create project"]})]})]})]})})}function lH(e){const t=cA(e);if(!t.name)return"Enter a project name.";if(t.directories.length===0)return"Add at least one source directory.";if(t.directories.some(r=>!cH(r)))return"Every source directory must be an absolute path.";if(!t.primary||!t.directories.includes(t.primary))return"Choose one listed directory as Primary."}function cH(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}const GC={codex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAGcklEQVR42s2YbayXZR3HP9efc3g4wEEcgiKSIuQENCnEkUo5ZeUxS4eVtnzR1gpdTzO1CNfDirlc9aJMrfmi1Zo2K2wtQsk0TM6gLWxATUklFQNFoIOcwznA+fSi7023twcQa617++9/77qvh9/j9/f9XfB/9pTXM0ktQCmlDKonAvOBWUAnsBv4C7CmlLI9c1uAzW1KKf7HEucA1AnqEnW9+pK6V92v9qkvZvwW9fgj7NVSh1V7HpOFqkWlFNXZwNeBLqAfWAlsBF4BjgPmARcAB4FfAo/EeqcB+4CtwHpgdSmlX21l78E3YqEp6kr/9SxXL81Yh9oejTvVT6l7PPzznHqPellt72HN89oOI0RbYmAUcD3wLuBe4HOllGcbcztiobnAGGAb8DiwGdgOjIyl5gBXA+eqk4CfAL1q64iWip/b8j5bfVn9q3p6XSt1hHq+ert6IFb4nfrxBP6r3K/OU7+j7lN3qNdUMXXUAM77OPUmdVBdFgFa+Z+mfjZuUN2cgJ5cWz9cHTHEGV9OIqxT5xzOdTQ2eqv6LXWb2pO4aY+mXeqaCLJd/Z46q+5udZK6SH2/Or4K4ig0Sr0v62/Nnm2Hc1W7ekMEqZ5d6twsHKmuyvgKdUHNJdXvktqcgbwvbEDItfn2sHpC0zvUNFim9kage9Q/JXPelu+jY+rd6hV1U6tnqz/IN9Un1A15f1n9fuADdYb6uPqUOu81AmXgg1m4O+Y+TX1QfaUmUIfaHWC8MGOnqF9UN6r9EeJG9Uz1DPXz6gsR7KnE5cxYeJfaNZSFxqu/zaIlMf3ECLSnIdC6WPCqxEh3A2/uUMfU9h6rzle/28jGreom9YKES6nj0PnA2cA64L6g84QhkHxYkHoscAMwExgHLAf6gEuBK4EO9X7gwVLKHqBb3Qw8DFwLvDf7PQ8MpEb+u/6ptwUflsYKJS5bFQudm3mdsZrRtlu9Tj0p6P0JdW2+P5MUn1vPInWq+pmai7+R2GzVXXZvNvlIbezUHN6jnhUhO5MZAwG5aUNk6zT1rhxmYmpxFKzjXJf6fDDpw9V4q/Ffh/BWXNoC2kId9qUU9AA/K6U8HVxpVRhTSnka+CnwJNALvAm4E7gDWBilhpdSVgBLs/9i9bi6IM+lUp+stteYQD/QASxKTB2I0AUYGY33l1IGU4/2Z6wdmAg8ASwGHgUWhgl8NDFWgDXAauDNwCV1gbqBncBFwKmZ/BKwKoIuSeBenYJ74Cjkzli3L0X5CuCrGXsPMDEW/1uoyvEhfYcEeijVeQHw9pp77gYuB34TvnMXcAbwYiwj0F65DGivrbXm7p1x49643PChgWTaMGDqIYFKKbvi50FgmdpVShkopfQAD8Ts10ejDmAGcJU6rZTSV7mslNKXQF8UgrYPGBWLH4wgBxr09rXxGw1HJwX7k5KfVqc2iuZc9SvqlmTQ2qT6lKT+dYGCCgAfUDuz/pxk7OqUjhKIWRrIuW2oWnZeDUdU7w8aT6gTMvXK1K2/qzvVH6s/z5qd6mPh3KvVsbVa16M+Wqtp03PejjqTrKp1S70wcL5V/X0OOJhyML/aPGvGZLz+rEkdXJTysk4d3RBotTo5Zy7JuoeqtG92Fl3R8NfqLPXmFERTIJekYJ6ZIrkh5t4QgjYl+yxIAe5uCLQnAk2PlXenoH/gcK3OeYH89TXKOivIuyOCbQy1qLjS3epZdeJeO2xtVWgj0D/UP4favBCq87V62DQFOkF9JHB+TePbRaEM/XHjr9R31glazTorIvAqdWTG3xJrVM+2kMH2VwnTyKISWmm0GNGgn+PU96mXp3GsE7RZobPba/HUVVFU9eJYaLv6TXWOOvxIXLrqJuaof4g5bxliXnujek9O/Gyu9V83qqc3GoMvpWG4SR03VGMxpFD5fSgx06d+Oy1Macw9Sf1YyFZFR25PazSioeQ09cm4bHbNI62jNYrm94tA/BeATwIXA+vVZ4K+JwLTgXPy/iPgh7lw6D3Up5dyUD0ldWwGcCuwJYL6ulrpRlxcllh6dojWeDD/e4LqndG6PeA5Je3T8sxbWcHCMV/H1C8DYv4FaYVPBkYAW8KJ3pHi2wY8Fgq8Ky31bODdmb8CuLmUsql+iXHM1zCJp9YR5oxPLfpjsqc3VzR7A4zr03VMOGoAv5ELqyHWDqYhmBQ+MzPXMz3AJqC7lLKtIvD/lQur//XzT+4u16KSSLsQAAAAAElFTkSuQmCC",monochrome:!0},claude:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAEYElEQVR4nMVXW4hVVRjedrMii+6FRRRFUQ9iVNAFKipoKAeC1vrXGTUkSn0xGpyz/nVmHjpRYJQvZQ+R0EOXhyQksQsVKFo9WBORdc6sf59RiWlUyCmly5SWJ/69195n7T3nOo31w2Lm/Ovyf+v7b2sHQQcZXbnyVCoVrpsYFGcE/4eQgdcJoU6oDo2PqMubrakOL7uUNGwkLW6ZU+PVtQNXxMbjYTU83x4kfDenALaX7zqFEI54IH6ulMVZMwAgTLr5z+cUAAtp+ZTPQqjVE4En9XL5JEI4FjGE8FqQkxDVUIhqNERYFcxGamv65ocIoQdib12Ik5N5Wlu4IAVnoOjvJVTDqfsQfuO1bY2NG3E1aVkaQ3VbBgTKJZlYQLksnSuJ6xsA5L2pcQOP+XsIYcoH3lRIw2du8V+Mvh4E85I5i/BRaggh5PiI9FrenejHSg+dH4EqijsJ4WjGdaiGOtIdImzKoDawdbcZONe76bGUBSMfjUGr5Y7i76N1eullhHAwaxw2+ZdpKVXOZ4RtOer2WK1uciy84un3VcritMTPoZFbOF4I1a7c/mqzzGkpdY5qLUv+bQnhTzJq0AH8xbvZKkJ4yf1+mlC+nDP+aw0LNwSzETJwc6jh2+yB8j1r5Iue7muL8JZz186c8Xpo1Irg30htTd98i+qZXED97f1/nBB+yBt2pfvtZmfuK684vWbU4lp56dndAzFqMSHsbm5o5uCc52Dcg+KcUBfuCzWMuACnOMOidYfTBlcZFOftLy85sxMbhLDOO6DlCBF+4uDLseUPPuPd6GAaEQsJ4Q83Mc11PfK9gZ0c2YTqDfa7Raldyq3rlglvHOCUJqPKhNBndf+CzO0oimD4wlE06W7Qq5FM6kXtGeGR0Axc1bWvm9HOhYhrOB9ULQ5cw/7sYJzpHSOEHYRyM/ueBzcqi/IFaxSSUdCxLOeFHyOhgTdd5LcDMMW1gTtgh3j5JCnnbYX9ZQ08Swi/JxFOBjZEf1seLjdzlYz3Fu6P9sd1Ytpbd5gzpaVhpohQPh4FUCO6t9eKcCMhVBJDbUB8nA+2OJPEHXxu0mOaitXi2lxNP2KNXM1l2iK843Tb0pZrYEOSctyULMJXMWA1une4cHHQi1gjV2fo1fB+8hi1Gp50+h85fUMtn4vXqHsI1avZHpGyM26HxJVdGa8HwbxGE1KHOO9TYCV5uyvJx0NUD7COiwmv5YZTK4kLXQDGgTgiFvIj1v2e7LopWa0eZmp96uIuKPc7RtYnekI5EencU4vzvtGI5JZIF7tpOr7QLJ7to/xhgupTx8oujm7WV4riEmfsqP/YIC0/zD/dCGGRK3IHegZgG+33oO/LsAgPumifmFEvGpV0anxo+UUxs/0LmN2ejFMUXGlzWZSZi+s6G/lyBmiUMmVBq/6eb50IFxEuq7WSuDXICSF84FJwa34umtewngx8w608OBFCydeQho0nxEDQCQDfkGu9l6r/PYhOXzpdyD/VGsqNWs3dHgAAAABJRU5ErkJggg==",monochrome:!1},traex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF9SURBVHgB7Zm9SsNQFMf/EYWiVB2KKGLBScHFN9BJurmoa0dn9QGqD1CdHbtWFzd10jfQQdBJqIgKGYw4VCR+nGD0ptqmsSectD0/CKXpbXJ+3HvOyYfVP5B+RxvTgzZHBaRRAWlUQBoVkEYFpOkNGzC0MgtJnPJZw99DBcZ2FiFJmIDmgDSdn8S1PB9d4aFwiDgY2cwhnZuK9J/IAq5TxevNI+Lg7amKqGgO/DrgYIplTNPnAyN9E8OYPF5FZmOu7hgKPrufZ+svkXOgHhR8di/vfWbW5719dvE0MMYPPjUz6m3E3doBWoFlBszgfUjCnAkzeB+6TGl1JuJNYuOJk/W1ccMiQGW1slwKlFe7eAJ7+2cJuZ8lsrJUwsvF/fc+us5JxBIiTIna4H1MCY7gCbYkJij464Xdhg3Jl3D/0bT+gj0HmummXMET2omlCc2By/GtwHeq3dO3BSQFXULSdN8dGdV6p3yOpGDpOzJhVEAaFZBGBaRRAWlUQJoPEeV5RYlN/QYAAAAASUVORK5CYII=",monochrome:!1}},Lv="local",uH={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function dH(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[n,o]=g.useState(!1),[u,d]=g.useState({}),m=g.useRef(0),f=g.useCallback(async(p=!1)=>{const y=++m.current;p&&o(!0),i(null);try{const b=await xe.listProviderClis(Lv);y===m.current&&t(b)}catch(b){y===m.current&&(t(null),i(b instanceof Error?b.message:String(b)))}finally{y===m.current&&o(!1)}},[]);g.useEffect(()=>{f()},[f]);const v=async(p,y)=>{try{let b=(await xe.startProviderCliOperation(Lv,p,y)).job;for(d(w=>({...w,[p]:b}));b.state==="running";)await _H(750),b=await xe.getProviderCliJob(Lv,b.id),d(w=>({...w,[p]:b}));b.state==="succeeded"?(ve.success(`${YC(p)} ${y} completed`),await f(),d(w=>{const C={...w};return delete C[p],C})):ve.error(b.error??`${YC(p)} ${y} failed`)}catch(b){ve.error(b.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.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(ue,{variant:"outline",size:"sm",disabled:n,onClick:()=>void f(!0),children:[l.jsx(Et,{className:n?"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(Ms,{className:"size-4"})," Could not inspect Providers"]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),l.jsxs(ue,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void f(!0),children:[l.jsx(Et,{})," Retry"]})]}),e===null&&!r?l.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>l.jsx(fH,{},p))}):l.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>l.jsx(hH,{provider:p,job:u[p.id],readOnly:e.management==="read_only",onOperation:v},p.id))})]})}function hH({provider:e,job:t,readOnly:r,onOperation:i}){const n=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(ir,{className:"min-w-0",children:l.jsxs(fr,{className:"grid gap-3 p-4 text-xs",children:[l.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-3 md:col-span-2 xl:col-span-1",children:[l.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--background)]",children:l.jsx("img",{src:GC[e.id].src,alt:"","aria-hidden":"true",className:qe("size-full object-cover",GC[e.id].monochrome&&"brightness-0 dark:invert")})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx(li,{children:e.name}),l.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),l.jsx(Ov,{icon:fO,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),l.jsx(Ov,{icon:Et,label:"Version",value:gH(e),mono:!0,noWrap:!0}),l.jsx(Ov,{icon:iO,label:"Authentication",value:vH(e)}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end",children:[l.jsx(mH,{provider:e}),!r&&n&&l.jsx(pH,{provider:e,operation:n,disabled:o,onConfirm:()=>i(e.id,n)})]})]}),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(Et,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?l.jsx(c0,{className:"size-3.5 text-[var(--success)]"}):l.jsx(Ms,{className:"size-3.5 text-[var(--destructive)]"}),l.jsx("span",{children:t.error??uH[t.stage]})]})]})})}function fH(){return l.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[l.jsxs("div",{className:"flex items-center gap-3 md:col-span-2 xl:col-span-1",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)]"})]})]}),["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 md:col-span-2 xl:col-span-1 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 mH({provider:e}){return e.availability==="missing"?l.jsx(Pt,{variant:"warning",children:"Not installed"}):e.availability==="broken"?l.jsx(Pt,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?l.jsx(Pt,{variant:"warning",children:"New version"}):l.jsx(Pt,{variant:"success",children:"Installed"})}function Ov({icon:e,label:t,value:r,mono:i=!1,noWrap:n=!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&&!n&&"break-all",n&&"whitespace-nowrap"),children:r})]})]})}function pH({provider:e,operation:t,disabled:r,onConfirm:i}){const n=t==="install"?"Install":"Update";return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsxs(ue,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?l.jsx(Et,{className:"animate-spin"}):l.jsx(ad,{}),r?"Working…":n]})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:[n," ",e.name,"?"]}),l.jsxs(Vi,{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(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{onClick:()=>void i(),children:n})]})]})]})}function gH(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 vH(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function YC(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function _H(e){return new Promise(t=>window.setTimeout(t,e))}function xH(e,t){if(e instanceof Co)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 yH(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=dc(),[i,n]=g.useState(null),[o,u]=g.useState(!1),[d,m]=g.useState(null),[f,v]=g.useState(null),[p,y]=g.useState({}),[b,w]=g.useState({});async function C(){try{const k=await xe.listRuntimes();n(k),r(k)}catch(k){n([]),ve.error(`Failed to load Runtimes: ${k.message}`)}}g.useEffect(()=>{C()},[]);async function E(k){v(k.selector);try{const j=await xe.testRuntime(k.selector);y(N=>({...N,[k.selector]:j})),w(N=>{const M={...N};return delete M[k.selector],M}),ve.success(`${k.displayName} is reachable`)}catch(j){y(M=>{const D={...M};return delete D[k.selector],D});const N={code:j instanceof Co?j.code:void 0,message:j.message};w(M=>({...M,[k.selector]:N})),ve.error(N.code==="authentication_failed"?"Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.":`Connection test failed: ${N.message}`)}finally{v(null)}}async function S(k){try{await xe.forgetRuntime(k.daemonId),y(j=>{const N={...j};return delete N[k.selector],N}),w(j=>{const N={...j};return delete N[k.selector],N}),ve.success(`Forgot ${k.displayName}`),e===k.selector&&t("local"),await C()}catch(j){ve.error(`Forget failed: ${j.message}`)}}return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(bH,{}),l.jsxs(ir,{children:[l.jsxs(mi,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(li,{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(ue,{size:"sm",onClick:()=>u(!0),children:[l.jsx(ri,{})," Add Runtime"]})]}),l.jsx(fr,{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(k=>{const j=p[k.selector],N=b[k.selector],M=(N==null?void 0:N.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:k.binding==="local"?l.jsx($E,{className:"size-4"}):l.jsx(cm,{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:k.displayName}),l.jsx(Pt,{variant:k.binding==="local"?"default":"outline",children:k.binding}),j&&l.jsxs(Pt,{variant:"success",children:[l.jsx(c0,{className:"mr-1 size-3"})," reachable"]}),M&&l.jsxs(Pt,{variant:"warning",children:[l.jsx(h0,{className:"size-3"})," authorization required"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:k.daemonId}),k.endpoint&&l.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:k.endpoint}),k.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(Mf,{className:"size-3 shrink-0"}),k.identityKeyFingerprint]}),j&&l.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",j.status.daemonInstanceId]})]})]}),l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[k.binding==="direct"&&l.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>m(k),children:[l.jsx(Mf,{}),"Reauthorize"]}),l.jsxs(ue,{variant:"outline",size:"sm",disabled:f===k.selector,onClick:()=>void E(k),children:[l.jsx(Et,{className:f===k.selector?"animate-spin":""}),"Test"]}),k.binding==="direct"&&l.jsx(kH,{target:k,onForget:()=>S(k)})]})]},k.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(ZC,{open:o,onOpenChange:u,onAdded:async k=>{y(j=>({...j,[k.target.selector]:k})),await C()}}),l.jsx(ZC,{open:d!==null,target:d,onOpenChange:k=>{k||m(null)},onAdded:async k=>{y(j=>({...j,[k.target.selector]:k})),w(j=>{const N={...j};return delete N[k.target.selector],N}),await C()}})]})}const KC="__rynx_custom_share_address__";function bH(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[n,o]=g.useState(null),[u,d]=g.useState(!1),[m,f]=g.useState(!1),[v,p]=g.useState(""),[y,b]=g.useState(!1),[w,C]=g.useState(""),[E,S]=g.useState(!1),[k,j]=g.useState(null),N=g.useRef(null),[M,D]=g.useState(null),[H,L]=g.useState(null),[G,Z]=g.useState(!1),[q,P]=g.useState(null),[B,z]=g.useState(null),I=g.useCallback(async(Y=!1)=>{Z(!0);try{D(await xe.listRuntimeAccess()),L(null),Y&&ve.success("Shared access refreshed")}catch(ne){const de=ne.message;L(de),Y&&ve.error(`Failed to refresh shared access: ${de}`)}finally{Z(!1)}},[]),A=g.useCallback(async(Y=!1)=>{d(!0);try{const ne=await xe.listRuntimeShareAddresses();t(ne),o(null),i(de=>(de==null?void 0:de.kind)==="custom"||de&&ne.some(Ae=>Ae.address===de.address)?de:ne[0]?{kind:"detected",address:ne[0].address}:null),Y&&ve.success("Network addresses refreshed")}catch(ne){const de=ne.message;t(Ae=>Ae??[]),o(de),Y&&ve.error(`Failed to refresh network addresses: ${de}`)}finally{d(!1)}},[]);g.useEffect(()=>{I(),A()},[I,A]);const $=(r==null?void 0:r.address)??"",U=w.trim(),F=k&&k.address===$.trim()&&k.clientLabel===U?k.code:"";function W(Y){if(Y===KC){p((r==null?void 0:r.kind)==="custom"?r.address:""),b(!1),f(!0);return}Y!==Bv(r)&&e!=null&&e.some(ne=>ne.address===Y)&&i({kind:"detected",address:Y})}function T(){const Y=v.trim();if(!SH(Y)){b(!0);return}i({kind:"custom",address:Y}),f(!1),b(!1)}async function V(){const Y=$.trim();if(!Y){ve.error("Choose an address that the other device can reach");return}S(!0);try{const ne=await xe.shareRuntime({address:Y,...U?{clientLabel:U}:{}});j({code:ne.pairingCode,address:Y,clientLabel:U}),ve.success("Pairing link generated"),await I()}catch(ne){ve.error(`Failed to generate pairing link: ${ne.message}`)}finally{S(!1)}}async function K(){if(!F)return;const Y=await iA(F,N.current);Y==="clipboard"||Y==="selection"?ve.success("Pairing link copied"):Y==="selected"?ve.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):ve.error("Copy is unavailable — select the pairing link and copy it manually")}async function J(Y){P(Y.grantId);try{const ne=await xe.revokeRuntimeAccess(Y.grantId);ve.success(`Revoked ${Pu(Y)}${ne.closedConnections>0?` and closed ${ne.closedConnections} active connection${ne.closedConnections===1?"":"s"}`:""}`),await I()}catch(ne){ve.error(`Revoke failed: ${ne.message}`)}finally{P(null)}}async function oe(Y){z(Y.grantId);try{await xe.deleteRevokedRuntimeAccess(Y.grantId),ve.success(`Removed revoked access record for ${Pu(Y)}`),await I()}catch(ne){ve.error(`Remove failed: ${ne.message}`)}finally{z(null)}}const ce=(M==null?void 0:M.filter(Y=>Y.revokedAt===null).length)??0;return l.jsxs(ir,{children:[l.jsx(mi,{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(t6,{className:"size-4"})}),l.jsxs("div",{className:"grid gap-1",children:[l.jsx(li,{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(fr,{className:"grid gap-6",children:[l.jsxs("form",{className:"grid gap-3",onSubmit:Y=>{Y.preventDefault(),V()},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(ti,{htmlFor:"runtime-share-address",children:"Connection address"}),l.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[l.jsxs(Gu,{value:(r==null?void 0:r.kind)==="custom"?Bv(r):r==null?void 0:r.address,onValueChange:W,disabled:e===null,children:[l.jsx(ec,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:l.jsx(Jl,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?wH(e??[],r.address):void 0})}),l.jsxs(tc,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&l.jsxs(Ui,{value:Bv(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Y=>l.jsx(Ui,{value:Y.address,children:uA(Y)},Y.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&l.jsx(Bm,{}),l.jsx(Ui,{value:KC,children:"Enter custom address…"})]})]}),l.jsx(ue,{type:"button",variant:"outline",size:"icon",disabled:u,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void A(!0),children:l.jsx(Et,{className:u?"animate-spin":""})})]})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"runtime-share-label",children:"Client label"}),l.jsx(At,{id:"runtime-share-label",value:w,onChange:Y=>C(Y.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),l.jsxs(ue,{type:"submit",disabled:E||!r,children:[E?l.jsx(Et,{className:"animate-spin"}):l.jsx(lO,{}),"Generate Link"]})]}),l.jsx("p",{id:"runtime-share-address-help",className:n?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:n?"alert":void 0,children:n?`Could not refresh network addresses: ${n}`:(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(ti,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),l.jsxs("div",{className:"flex min-w-0 gap-2",children:[l.jsx(At,{id:"runtime-pairing-code",ref:N,value:F,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),l.jsxs(ue,{type:"button",variant:"outline",onClick:()=>void K(),children:[l.jsx(d0,{})," 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:ce})]}),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(ue,{type:"button",variant:"ghost",size:"icon-sm",disabled:G,"aria-label":"Refresh shared access",onClick:()=>void I(!0),children:l.jsx(Et,{className:G?"animate-spin":""})})]}),M===null&&!H&&l.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),H&&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: ",H]}),l.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>void I(),children:"Retry"})]}),(M==null?void 0:M.length)===0&&!H&&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(Y=>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:Pu(Y)}),l.jsxs(Pt,{variant:Y.revokedAt?"destructive":"success",children:[Y.revokedAt?l.jsx(h0,{className:"size-3"}):l.jsx(Mf,{className:"size-3"}),Y.revokedAt?"revoked":"active"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:Y.grantId}),l.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:Y.lastUsedAt?`Last used ${XC(Y.lastUsedAt)}`:`Created ${XC(Y.createdAt)} · never connected`})]}),Y.revokedAt?l.jsx(EH,{client:Y,disabled:B===Y.grantId,onRemove:()=>oe(Y)}):l.jsx(CH,{client:Y,disabled:q===Y.grantId,onRevoke:()=>J(Y)})]},Y.grantId))})]})]}),l.jsx($o,{open:m,onOpenChange:Y=>{f(Y),Y||b(!1)},children:l.jsxs(Ga,{className:"sm:max-w-md",children:[l.jsxs(Uo,{children:[l.jsx(Ya,{children:"Enter custom address"}),l.jsx(Ho,{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:Y=>{Y.preventDefault(),T()},children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),l.jsx(At,{id:"runtime-custom-share-address",value:v,onChange:Y=>{p(Y.target.value),Y.target.value.trim()&&b(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":y,"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:y?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:y?"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(ac,{children:[l.jsx(S0,{asChild:!0,children:l.jsx(ue,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(ue,{type:"submit",disabled:!v.trim(),children:"Use Address"})]})]})]})})]})}function uA(e){return`${e.interfaceName} (${e.address})`}function wH(e,t){const r=e.find(i=>i.address===t);return r?uA(r):t}function Bv(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function SH(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function CH({client:e,disabled:t,onRevoke:r}){return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsxs(ue,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?l.jsx(Et,{className:"animate-spin"}):l.jsx(h0,{}),"Revoke"]})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:["Revoke access for “",Pu(e),"”?"]}),l.jsx(Vi,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function EH({client:e,disabled:t,onRemove:r}){return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsxs(ue,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?l.jsx(Et,{className:"animate-spin"}):l.jsx(qa,{}),"Remove Record"]})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:["Remove revoked record for “",Pu(e),"”?"]}),l.jsx(Vi,{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(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Pu(e){return e.clientLabel??e.clientId}function XC(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function ZC({open:e,target:t=null,onOpenChange:r,onAdded:i}){const[n,o]=g.useState(""),[u,d]=g.useState(""),[m,f]=g.useState(!1),v=t!==null;g.useEffect(()=>{e&&(o((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function p(){const y=u.trim();if(y){f(!0);try{const b=await xe.pairRuntime({offer:y,...n.trim()?{displayName:n.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});ve.success(v?`Reauthorized ${b.target.displayName}`:`Paired ${b.target.displayName}`),await i(b),o(""),d(""),r(!1)}catch(b){ve.error(xH(b,v?"Reauthorization":"Pairing"))}finally{f(!1)}}}return l.jsx($o,{open:e,onOpenChange:r,children:l.jsxs(Ga,{className:"sm:max-w-lg",children:[l.jsxs(Uo,{children:[l.jsx(Ya,{children:v?"Reauthorize Runtime":"Add Runtime"}),l.jsx(Ho,{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:y=>{y.preventDefault(),p()},children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"runtime-name",children:"Display name"}),l.jsx(At,{id:"runtime-name",value:n,onChange:y=>o(y.target.value),placeholder:"Remote lab",maxLength:128})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(ti,{htmlFor:"runtime-offer",children:"Pairing link"}),l.jsx(At,{id:"runtime-offer",value:u,onChange:y=>d(y.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(ac,{children:[l.jsx(S0,{asChild:!0,children:l.jsx(ue,{type:"button",variant:"outline",children:"Cancel"})}),l.jsxs(ue,{type:"submit",disabled:m||!u.trim(),children:[m?l.jsx(Et,{className:"animate-spin"}):l.jsx(Mf,{}),v?"Reauthorize":"Add Runtime"]})]})]})]})})}function kH({target:e,onForget:t}){return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsxs(ue,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[l.jsx(qa,{}),l.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:["Forget “",e.displayName,"”?"]}),l.jsxs(Vi,{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(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}function RH(e,t){return t==="install"||(e==null?void 0:e.phase)==="installing"}const NH="rynx.control.session-launch-selection.v2";function dA(e){return`${e.kind}:${e.id}`}function hA(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 jH(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function AH(e,t){const r=t?hA(t):null;if(r&&jH(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 n=e.agents.find(o=>o.ready);return n?{kind:"agent",id:n.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function TH(e,t){if(!t)return null;try{return t.getItem(fA(e))}catch{return null}}function MH(e,t,r){if(t)try{t.setItem(fA(e),dA(r))}catch{}}function fA(e){return`${NH}:${encodeURIComponent(e)}`}function DH(e,t,r){const i=r?{projectId:r}:{};return e.kind==="provider"?{provider:e.id,title:t,...i}:{agent:e.id,title:t,...i}}function LH(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function OH(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function Pv(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function Zu(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function J_(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 mA=Lj,pA=g.forwardRef(({className:e,...t},r)=>l.jsx(Oj,{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}));pA.displayName="TabsList";const ex=g.forwardRef(({className:e,...t},r)=>l.jsx(Bj,{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}));ex.displayName="TabsTrigger";const Qu=g.forwardRef(({className:e,...t},r)=>l.jsx(Pj,{ref:r,className:qe("mt-4 focus-visible:outline-none",e),...t}));Qu.displayName="TabsContent";function Um(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function BH(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function PH(e){var i;const t=e.data.content.flatMap((n,o)=>"text"in n?[o]:[]);return t.length!==1?!1:((i=e.truncations)==null?void 0:i.some(({field:n})=>n===`data.content[${t[0]}].text`))===!0}function zH(e){return e.filter(t=>t.type==="input_image")}function IH(e,t){return e.length===t.length&&e.every((r,i)=>{var n;return r.resourceId===((n=t[i])==null?void 0:n.resourceId)})}function Vh(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const i=t[r],n=t[r-1];i.type!=="reasoning"||i.data.model!=="traex"||n.type!=="message"||n.data.role!=="assistant"||n.data.model!=="traex"||n.responseId!==i.responseId||i.createdAt<n.createdAt||i.createdAt-n.createdAt>500||(t[r]=n,t[r-1]=i)}return t}function rn(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 ji(e,t,r){e.items[t]=r}function ds(e,t){const r=e.items.length;return e.items.push(t),r}function QC(e){const t=Um();for(const r of e.items){if(r.kind!=="message"||r.role!=="user"||!r.optimistic)continue;const i={...r,images:r.images.slice()};t.byId[i.id]=ds(t,i)}return t}function JC(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 gA(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=gA(r.children));return t}function Eo(e){e.waitingForInteraction=gA(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function vA(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function tx(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?vA(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:tx(r.children,t)}:r)}function rx(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&rx(r.children,t);return t}function e2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:o})=>o.interactionId));for(const[o,u]of Object.entries(e.childStates)){const d=rn(u);d.items=tx(d.items,r),Eo(d),e.childStates[o]=d;const m=e.callIndex[o];if(m!==void 0){const f=e.items[m];ji(e,m,{...f,children:d.items})}}e.items=tx(e.items,r);const i=rx(e.items);for(const o of Object.values(e.childStates))rx(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]=ds(e,d),i.add(u.interactionId)}const n=new Set(t.activeResponseIds);for(const[o,u]of Object.entries(e.turns))n.has(o)||u.status==="running"&&(e.turns[o]={...u,status:"completed"},ix(e,o));UH(e,n);for(const o of n)e.turns[o]={...e.turns[o],status:"running"};e.runStatus=t.status,e.statusKind=t.statusKind,e.waitingForInteraction=r.size>0}function t2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function r2(e,t,r,i){const n=e.byId[t];if(n!==void 0)return n;const o=ds(e,i());return e.byId[t]=o,o}function Hm(e,t){e.items.splice(t,1);for(const r of[e.byId,e.callIndex,e.interactionIndex])for(const[i,n]of Object.entries(r))n===t?delete r[i]:n>t&&(r[i]=n-1)}function $H(e,t,r){const i=rn(e.childStates[t]??Um());Un(i,{...r,parentToolCallId:void 0}),Eo(i),e.childStates[t]=i;const n=e.callIndex[t];if(n!==void 0){const o=e.items[n];ji(e,n,{...o,children:i.items})}}function Un(e,t){var r;if(t.parentToolCallId){$H(e,t.parentToolCallId,t);return}switch(t.type){case"message":{JC(e,t.responseId,t.data.model);const i={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:BH(t.data.content),images:zH(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...PH(t)?{textPrefixTruncated:!0}:{}},n=e.byId[t.id];if(n!==void 0){ji(e,n,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&&IH(u.images,i.images));if(o!==-1){const u=e.items[o];delete e.byId[u.id],ji(e,o,i),e.byId[t.id]=o;return}}e.byId[t.id]=ds(e,i);return}case"reasoning":{JC(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},n=e.byId[t.id];n!==void 0?ji(e,n,i):e.byId[t.id]=ds(e,i);return}case"function_call":{const i=t.data.callId,n=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:n?n.status??"completed":t.status,output:n==null?void 0:n.output,exitCode:n==null?void 0:n.exitCode,...o&&o.length?{children:o}:{}};n&&delete e.pendingOutputs[i];const d=e.callIndex[i];d!==void 0?ji(e,d,u):e.callIndex[i]=ds(e,u);return}case"function_call_output":{const i=t.data.callId,n=e.callIndex[i];if(n===void 0){e.pendingOutputs[i]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const o=e.items[n];ji(e,n,{...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}:{}},n=e.byId[t.id];n!==void 0?ji(e,n,i):e.byId[t.id]=ds(e,i);return}case"interaction_request":{const i=t.data.interaction,n=i.interactionId,o=e.interactionIndex[n],u=e.pendingInteractionResolutions[n],d=o===void 0?void 0:e.items[o];let m={kind:"interaction",id:n,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=t2(m,u),delete e.pendingInteractionResolutions[n]),o===void 0?e.interactionIndex[n]=ds(e,m):ji(e,o,m),e.byId[t.id]=e.interactionIndex[n];return}case"interaction_resolution":{const i=t.data,n=e.interactionIndex[i.interactionId];if(n===void 0){e.pendingInteractionResolutions[i.interactionId]={...i,responseId:t.responseId,itemId:t.id};return}const o=e.items[n];ji(e,n,t2(o,i)),e.byId[t.id]=n;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},n=e.byId[t.id];n!==void 0?ji(e,n,i):e.byId[t.id]=ds(e,i);return}}}function ix(e,t){const r=i=>i===t;Gf(e,r),e.items=sx(e.items,t);for(const[i,n]of Object.entries(e.childStates)){const o=rn(n);Gf(o,r),o.items=sx(o.items,t),Eo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];ji(e,u,{...d,children:o.items})}}}function UH(e,t){const r=i=>!t.has(i);Gf(e,r);for(const[i,n]of Object.entries(e.childStates)){const o=rn(n);Gf(o,r),Eo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];ji(e,u,{...d,children:o.items})}}}function Gf(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&&Hm(e,r)}}function HH(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 n=e.items[i];(n==null?void 0:n.kind)==="message"&&n.responseId===t&&n.role==="assistant"&&n.liveDraft===!0&&r.some(o=>o.text===n.text||o.textPrefixTruncated===!0&&o.text.length>0&&n.text.startsWith(o.text))&&Hm(e,i)}}function sx(e,t){return e.map(r=>{const i=r.kind==="tool"&&r.children?{...r,children:sx(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 i2(e){return Object.values(e.turns).some(t=>t.status==="running")}function Rs(e){e.note=void 0,e.statusKind=void 0}function FH(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",Rs(e);return}case"response.output_text.delta":{Rs(e);const i=e.byId[t.itemId],n=i===void 0?void 0:e.items[i];if(t.discard===!0){i!==void 0&&(n==null?void 0:n.kind)==="message"&&n.role==="assistant"&&n.responseId===t.responseId&&n.liveDraft===!0&&Hm(e,i);return}const o=(r=e.turns[t.responseId])==null?void 0:r.status;if(o==="completed"||o==="failed"||(n==null?void 0:n.kind)==="message"&&n.role==="assistant"&&n.liveDraft!==!0)return;const u=r2(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&&HH(e,t.responseId);return}case"response.reasoning_summary_text.delta":{Rs(e);const i=r2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),n=e.items[i],o=n.summary.slice();o[t.summaryIndex]=(o[t.summaryIndex]??"")+t.delta,e.items[i]={...n,summary:o,streaming:!0};return}case"response.function_call_output.delta":{Rs(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 n=e.items[i];e.items[i]={...n,output:(n.output??"")+t.delta};return}case"session.interaction.requested":{Rs(e),Un(e,t.item);const i=e.interactionIndex[t.interaction.interactionId];if(i!==void 0){const n=e.items[i];(n.status==="pending"||n.status==="inactive")&&ji(e,i,vA(n))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{Rs(e),Un(e,t.item);return}case"response.output_item.done":{Rs(e),Un(e,t.item);return}case"response.completed":{Rs(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"completed",usage:t.usage},ix(e,t.responseId),!i2(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{Rs(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)||ds(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}),ix(e,t.responseId),e.runStatus=i2(e)?"running":"idle";return}case"session.input.consumed":{Rs(e),Un(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{ds(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",Rs(e);return}}}function qH(e,t){var r;switch(t.kind){case"reset":return Um();case"snapshot":{const i=QC(e);for(const n of Vh(t.items))Un(i,n);return e2(i,t.runtime),i.historyLoaded=!0,i}case"reconcile_snapshot":{const i=rn(e);for(const n of Vh(t.items))Un(i,n);return e2(i,t.runtime),i.historyLoaded=!0,i.error=void 0,i}case"history":{const i=QC(e);for(const n of Vh(t.items))Un(i,n);return Eo(i),i.historyLoaded=!0,i}case"reconcile_history":{const i=rn(e);for(const n of Vh(t.items))Un(i,n);return Eo(i),i.historyLoaded=!0,i.error=void 0,i}case"event":{const i=rn(e);return FH(i,t.event),Eo(i),i}case"optimistic_user":{const i=rn(e),n={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]=ds(i,n),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 n=rn(e);return Hm(n,i),n}case"stream_error":{const i=rn(e);return i.error=t.message,i}case"stream_done":return e}}function WH(e){let t;for(const r of e.items){const i=e.turns[r.responseId];i&&(t=i)}return t}function VH(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 nx="browser:",ax="emulator:",s2=.44,Ru=360,GH=420;function YH(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(nx)?{type:"browser",pageId:e.slice(nx.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(ax)?{type:"emulator",bindingId:e.slice(ax.length).trim()||null}:null:null}function Js(e){return e?`${nx}${e}`:"browser"}function en(e){return e?`${ax}${e}`:"emulator"}function n2(e,t){const r=new Set(t),i=new Set,n=[];for(const o of e)!r.has(o)||i.has(o)||(i.add(o),n.push(o));for(const o of t)i.has(o)||(i.add(o),n.push(o));return n}function Gh(e,t){const r=Math.max(0,e),i=Math.max(0,r-GH),n=Math.min(Ru,i);return Math.min(i,Math.max(n,t))}function KH(e,t,r){var i;return!e||e.pages.length===0?null:t&&e.pages.some(n=>n.pageId===t)?t:r&&e.pages.some(n=>n.pageId===r)?r:e.activePageId&&e.pages.some(n=>n.pageId===e.activePageId)?e.activePageId:((i=e.pages[0])==null?void 0:i.pageId)??null}function XH(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}const hy="desktop-direct-view",ZH=4,QH=5*1024*1024,JH=20*1024*1024,eF=8192,tF=4e7,rF=["image/png","image/jpeg","image/webp"];function iF(){return{enabled:!0,mediaTypes:[...rF],maxImagesPerMessage:ZH,maxImageBytes:QH,maxMessageBytes:JH,maxImageSide:eF,maxImagePixels:tF}}new TextEncoder;new TextEncoder;function sF(e,t){const r=new Map;for(const i of t)i.type==="interaction_request"&&r.set(i.data.interaction.interactionId,i);return{status:e.status,...e.statusKind===void 0?{}:{statusKind:e.statusKind},activeResponseIds:[...e.activeResponseIds],pendingInteractions:e.pendingInteractions.flatMap(i=>{const n=r.get(i.interactionId);return!n||n.responseId!==i.responseId?[]:[{responseId:i.responseId,interaction:n.data.interaction}]})}}const nF={"status.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:null},"provider.cli.status.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.provider-cli.status.v1"},"project.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.update":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.active.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.kill":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.shutdown":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"session.emulator.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.detach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.list.v1"},"session.agentOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.agent-options.v1"},"session.launchOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.launch-options.v2"},"session.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.create.v1"},"session.fork":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.fork.v1"},"session.message.send":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message.v1"},"session.resource.policy.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.begin":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.chunk":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.upload.commit":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.read":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.resource.delete":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.resources.v1"},"session.message.enqueue":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message-queue.v1"},"session.terminal.start":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.terminal-start.v1"},"session.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.delete.v1"},"session.snapshot.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.snapshot.v1"},"session.interrupt":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interrupt.v1"},"session.interaction.resolve":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interaction.v1"},"browser.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.open":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.activate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.navigate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.back":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.forward":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.reload":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"}};new Set(Object.keys(nF));new TextEncoder;let zv=0;function Ju(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 zv=zv+1>>>0,`${e}_${Date.now().toString(36)}_${zv.toString(36)}`}const aF=256,oF=4*1024*1024;function lF(e,t,r,i){return e||(r?t:i)}function cF(e){return e.type==="response.created"}function a2(e,t,r){return r&&e!==null&&t===e}function uF(e,t){return e&&t}function dF(e,{runtimeSelector:t,allowSend:r=!0}={}){const[i,n]=g.useReducer(qH,void 0,Um),[o,u]=g.useState(!1),[d,m]=g.useState(!1),f=g.useRef(null),v=g.useRef(0),p=g.useRef(null),y=g.useRef(null),b=g.useRef(0);g.useEffect(()=>{if(n({kind:"reset"}),p.current=null,y.current=null,u(!1),m(!1),!e)return;const E=new AbortController;let S=!1,k=!0,j;return(async()=>{let M=500;for(;!E.signal.aborted;){const D=new AbortController,H=()=>D.abort();E.signal.addEventListener("abort",H,{once:!0});let L=!1,G=!1,Z=!1;const q={events:[],utf8Bytes:0};let P,B;const z=new Promise(($,U)=>{P=$,B=U}),I=xe.streamSession(e,$=>{if(!(S||D.signal.aborted))if($.event==="ready"){const U=fF(j,$.data);j=U.daemonInstanceId,U.changed&&(k=!0,n({kind:"reset"}),m(!1)),P()}else if($.event==="event"){const U=$.data,F=p.current;F!==null&&cF(U)&&(y.current=F,a2(p.current,y.current,L)&&(p.current=null,y.current=null,u(!1))),L?n({kind:"event",event:U}):hF(q,U)||(Z=!0,D.abort())}else $.event==="error"&&n({kind:"stream_error",message:String($.data.message??"stream error")})},D.signal,t).then(()=>(B(new Error("session stream closed before ready")),{error:void 0})).catch($=>(B($),{error:$}));try{await z,M=500;let $=500,U,F=0;const W=[];for(;;){const T=new AbortController,V=()=>T.abort();D.signal.addEventListener("abort",V,{once:!0}),D.signal.aborted&&T.abort();const K=t?xe.getSessionSnapshotPage(e,U,T.signal,t).then(Y=>({kind:"snapshot_page",page:Y})).catch(Y=>({kind:"snapshot_error",error:Y})):xe.getSessionSnapshot(e,T.signal).then(Y=>({kind:"snapshot",snapshot:Y})).catch(Y=>({kind:"snapshot_error",error:Y})),J=await Promise.race([K,I.then(()=>({kind:"stream_ended"}))]);if(D.signal.removeEventListener("abort",V),J.kind==="stream_ended"){T.abort();break}if(S||E.signal.aborted)return;if(Z)break;if(J.kind==="snapshot_page"){const{page:Y}=J;if(Y.sessionId!==e||Y.hasMore&&(!Y.nextAfterId||Y.nextAfterId===U)){n({kind:"stream_error",message:"Session snapshot page did not advance"}),D.abort();break}if(W.push(...Y.items),n({kind:k&&F===0?"history":"reconcile_history",items:Y.items}),F+=1,$=500,Y.hasMore){U=Y.nextAfterId;continue}n({kind:"reconcile_snapshot",items:[],runtime:sF(Y.runtime,W)}),G=!0,k=!1;break}if(J.kind==="snapshot"){const{snapshot:Y}=J;n({kind:k?"snapshot":"reconcile_snapshot",items:Y.items,runtime:Y.runtime}),G=!0,k=!1;break}const{error:oe}=J;n({kind:"stream_error",message:oe instanceof Error?oe.message:String(oe)});const ce=await Promise.race([I.then(()=>"stream_ended"),o2($,E.signal).then(()=>"retry")]);if(E.signal.aborted)return;if(ce==="stream_ended")break;$=Math.min($*2,8e3)}}catch($){!S&&!E.signal.aborted&&!Z&&n({kind:"stream_error",message:$ instanceof Error?$.message:String($)})}finally{if(Z||(L=!0),!S&&!E.signal.aborted&&!Z){for(const $ of q.events.splice(0))n({kind:"event",event:$});q.utf8Bytes=0,G&&(m(!0),a2(p.current,y.current,!0)&&(p.current=null,y.current=null,u(!1)))}}const A=await I;if(S||m(!1),E.signal.removeEventListener("abort",H),D.abort(),E.signal.aborted)return;A.error,await o2(M,E.signal),M=Math.min(M*2,8e3)}})(),()=>{S=!0,E.abort()}},[t,e]);const w=g.useCallback(async E=>{if(!e||!r)return;const S=typeof E=="string"?E:E.text,k=typeof E=="string"?[]:E.images,j=typeof E=="string"?void 0:E.clientMessageId??Ju("msg"),N=new AbortController,M=++v.current;f.current=N,p.current=M,y.current=null,u(!0);const D=`optimistic_${b.current++}`;n({kind:"optimistic_user",id:D,text:S,images:k});try{await xe.sendSessionMessage(e,k.length===0?S:{content:[...k.map(H=>({type:"input_image",resourceId:H.resourceId,mediaType:H.mediaType,...H.filename?{filename:H.filename}:{},...H.byteLength?{byteLength:H.byteLength}:{},...H.width?{width:H.width}:{},...H.height?{height:H.height}:{}})),...S?[{type:"input_text",text:S}]:[]],clientMessageId:j},()=>{},N.signal,t)}catch(H){throw N.signal.aborted||(Im(H)&&n({kind:"discard_optimistic_user",id:D}),n({kind:"stream_error",message:H.message})),p.current===M&&(p.current=null,y.current=null,u(!1)),H}finally{f.current===N&&(f.current=null)}},[r,t,e]),C=g.useCallback(async()=>{var E;if((E=f.current)==null||E.abort(),p.current=null,y.current=null,u(!1),!!e)try{await xe.interruptSession(e,t)}catch{}},[t,e]);return g.useEffect(()=>{if(!o)return;if(uF(d,i.runStatus==="running"||i.waitingForInteraction)){p.current=null,y.current=null,u(!1);return}const E=p.current,S=window.setTimeout(()=>{p.current===E&&(p.current=null,y.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 hF(e,t,r={}){const i=r.events??aF,n=r.utf8Bytes??oF;let o;try{o=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=i||o>n||e.utf8Bytes+o>n?!1:(e.events.push(t),e.utf8Bytes+=o,!0)}function fF(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 o2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const i=window.setTimeout(n,e);t.addEventListener("abort",n,{once:!0});function n(){window.clearTimeout(i),t.removeEventListener("abort",n),r()}})}const mF=1,l2=32*1024,c2=4*1024*1024,pF=4096,gF=4096,vF=8847360,_F=4*1024,ox=512,xF=1024,u2=new Uint8Array([82,66,83,70]),Ll=38,yF=1,bF=2,Yf=new TextEncoder,wF=new TextDecoder("utf-8",{fatal:!0});function SF(e){const t=EF(e);switch(t.type){case"browser.surface.ready":{Iv(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=Kf(t.sourceWidth,"sourceWidth"),i=Kf(t.sourceHeight,"sourceHeight");return _A(r,i),{type:"browser.surface.ready",subscriptionId:Nu(t.subscriptionId,"subscriptionId"),browserGeneration:d2(t.browserGeneration,"browserGeneration"),viewportRevision:NF(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:i,deviceScaleFactor:AF(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:TF(t.format),grantedRole:xf(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{Iv(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=xf(t.driver,["none","desktop","stream"],"driver"),i=t.driverSubscriptionId===void 0?void 0:Nu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(i!==void 0))throw Xt("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:Nu(t.subscriptionId,"subscriptionId"),browserGeneration:d2(t.browserGeneration,"browserGeneration"),driver:r,...i===void 0?{}:{driverSubscriptionId:i}}}case"browser.surface.closed":{Iv(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:RF(t.message,"message",xF);return{type:"browser.surface.closed",subscriptionId:Nu(t.subscriptionId,"subscriptionId"),reason:xf(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 Xt("unknown Browser Surface server frame type")}}function CF(e){if(!(e instanceof Uint8Array)||e.byteLength<Ll+1||e.byteLength>Ll+ox+c2)throw Xt("Browser Surface image frame has an invalid byte length");for(let y=0;y<u2.length;y+=1)if(e[y]!==u2[y])throw Xt("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==mF||t.getUint16(6,!1)!==0)throw Xt("Browser Surface image frame header is unsupported");const r=t.getUint8(5),i=r===yF?"jpeg":r===bF?"png":void 0;if(i===void 0)throw Xt("Browser Surface image frame format is unsupported");const n=t.getUint16(32,!1),o=t.getUint32(34,!1);if(n===0||n>ox||o===0||o>c2||Ll+n+o!==e.byteLength)throw Xt("Browser Surface image frame lengths are invalid");let u;try{u=wF.decode(e.subarray(Ll,Ll+n))}catch{throw Xt("subscriptionId must be valid UTF-8")}u=Nu(u,"subscriptionId");const d=h2(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),f=h2(t.getBigUint64(20,!1),"timestampMilliseconds"),v=Kf(t.getUint16(28,!1),"width"),p=Kf(t.getUint16(30,!1),"height");return _A(v,p),{subscriptionId:u,frameSequence:d,viewportRevision:m,timestampMilliseconds:f,width:v,height:p,format:i,encodedBytes:new Uint8Array(e.subarray(Ll+n))}}function EF(e){let t=e;if(typeof e=="string"){if(Yf.encode(e).byteLength>l2)throw Xt("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw Xt("Browser Surface control frame must be valid JSON")}}const r=kF(t,"Browser Surface control frame");let i;try{i=JSON.stringify(r)}catch{throw Xt("Browser Surface control frame must be serializable")}if(Yf.encode(i).byteLength>l2)throw Xt("Browser Surface control frame exceeds its byte limit");return r}function kF(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw Xt(`${t} must be an object`);return e}function Iv(e,t,r,i=!1){const n=Object.keys(e),o=i?t.length-1:t.length;if(n.length<o||n.length>t.length||n.some(u=>!t.includes(u))||t.slice(0,o).some(u=>!Object.hasOwn(e,u)))throw Xt(`${r} contains unknown or missing fields`)}function Nu(e,t){if(typeof e!="string"||e.length===0||Yf.encode(e).byteLength>ox||!/^[\x21-\x7e]+$/.test(e))throw Xt(`${t} must be a bounded opaque identifier`);return e}function RF(e,t,r){if(typeof e!="string"||e.includes("\0")||Yf.encode(e).byteLength>r)throw Xt(`${t} exceeds its text byte limit`);return e}function d2(e,t){if(!Number.isSafeInteger(e)||e<1)throw Xt(`${t} must be a positive safe integer`);return e}function NF(e,t){if(!Number.isSafeInteger(e)||e<0)throw Xt(`${t} must be a nonnegative safe integer`);return e}function jF(e,t,r,i){if(!Number.isInteger(e)||e<t||e>r)throw Xt(`${i} must be an integer from ${t} to ${r}`);return e}function AF(e,t,r,i){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw Xt(`${i} must be a finite number from ${t} to ${r}`);return e}function Kf(e,t){const r=t.toLowerCase().includes("height")?gF:pF;return jF(e,1,r,t)}function _A(e,t){if(e*t>vF)throw Xt("Browser Surface viewport exceeds its maximum pixels")}function TF(e){return xf(e,["jpeg","png"],"format")}function xf(e,t,r){if(typeof e!="string"||!t.includes(e))throw Xt(`${r} is unsupported`);return e}function h2(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw Xt(`${t} exceeds a safe integer`);return Number(e)}function Xt(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const f2=1e4,MF=16,$v=1,m2=[500,1e3,2e3,4e3,8e3,15e3];function DF(e){const t=Math.max(0,Math.min(Math.trunc(e),m2.length-1));return m2[t]}function LF(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function OF(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function xA(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function Yh(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 BF(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(hy)}function PF(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function zF(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(hy)}async function IF(e,t){var o,u,d,m;const r=e.pages.findIndex(f=>f.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 f of e.pages.slice(1))i=await t.createPage(i.browserGeneration,f.url),(d=t.onProgress)==null||d.call(t,i);const n=r>=0?i.pages[r]:void 0;return n&&i.activePageId!==n.pageId&&(i=await t.activatePage(i.browserGeneration,n.pageId),(m=t.onProgress)==null||m.call(t,i)),i}function $F({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:i=t}){const n=Math.max(0,r-t),o=r-i>$v;return{hasOverflow:o,canScrollLeft:o&&e>$v,canScrollRight:o&&e<n-$v}}function UF(e){return Math.max(120,e*.75)}function HF({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:i,inset:n=4}){const o=e,u=e+t,d=Math.max(0,r-n),m=r+i+n;return d<o?d-o:m>u?m-u:0}function FF(e,t,r,i){return{deltaX:p2(e+r),deltaY:p2(t+i)}}function p2(e){return Number.isFinite(e)?Math.max(-f2,Math.min(f2,e)):0}function qF(e){if(!e)return[];const t=new TextEncoder,r=[];let i="",n=0;for(const o of e){const u=t.encode(o).byteLength;if(n+u>_F){if(r.push(i),r.length>=MF)throw new RangeError("Browser text input is too large");i="",n=0}i+=o,n+=u}return i&&r.push(i),r}function WF(e,t){if(t.type==="pointerdown"){const i=g2(t.button);return i&&e.set(t.pointerId,i),i}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??g2(t.button)}function g2(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 VF=1,GF=2;function YF({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i,toolbarHost:n}){const o=g.useRef(null),u=g.useRef(null),d=g.useRef(void 0),m=g.useRef(void 0),f=g.useRef(0),v=g.useRef(0),p=g.useRef(0),y=g.useRef(0),b=g.useRef(void 0),w=g.useRef(!1),C=g.useRef(!1),E=g.useRef(!1),S=g.useRef(void 0),k=g.useRef(void 0),j=g.useRef(void 0),N=g.useRef(new Map),[M,D]=g.useState("connecting"),[H,L]=g.useState(),[G,Z]=g.useState(),[q,P]=g.useState("none"),[B,z]=g.useState(),[I,A]=g.useState(!1),[$,U]=g.useState(!1),F=q==="stream"&&B===(G==null?void 0:G.subscriptionId),W=g.useCallback(()=>{j.current!==void 0&&(window.cancelAnimationFrame(j.current),j.current=void 0),S.current=void 0,k.current=void 0,N.current.clear()},[]),T=g.useCallback(()=>{b.current!==void 0&&(window.clearTimeout(b.current),b.current=void 0)},[]),V=g.useCallback(async({refreshCapability:me=!1,preserveFrame:je=!1}={})=>{var ze;T();const We=++p.current;(ze=d.current)==null||ze.close(1e3,"Browser Surface reconnecting"),d.current=void 0,m.current=void 0,f.current=0,v.current=0,E.current=!1,C.current=!1,W(),D("connecting"),L(void 0),Z(void 0),P("none"),z(void 0),U(!1),je||(w.current=!1,A(!1));const Te=Se=>{if(p.current!==We)return;L(Se),D("connecting");const Ue=DF(y.current++);b.current=window.setTimeout(()=>{b.current=void 0,V({preserveFrame:!0})},Ue)};try{const Se=await Xu(me);if(p.current!==We)return;const Ue=new WebSocket(ZF({runtimeSelector:e,sessionId:t,pageId:i,browserGeneration:r,capability:Se}));Ue.binaryType="arraybuffer",d.current=Ue;let Gt=me,wt=!1;Ue.onmessage=Re=>{var gt;if(p.current!==We||d.current!==Ue)return;if(typeof Re.data=="string"){try{const mt=JSON.parse(Re.data);if(mt&&typeof mt=="object"&&"type"in mt&&mt.type==="error"){const nr="message"in mt&&typeof mt.message=="string"?mt.message:"Browser Surface failed";L(nr);return}const kt=SF(mt);if(kt.type==="browser.surface.ready"){m.current=kt,f.current=kt.viewportRevision,T(),Z(kt),D("ready");return}if(kt.type==="browser.surface.driver.changed"){const nr=kt.driver==="stream"&&kt.driverSubscriptionId===((gt=m.current)==null?void 0:gt.subscriptionId);E.current=nr,nr||W(),P(kt.driver),z(kt.driverSubscriptionId);return}E.current=!1,W();const ut=kt.message??QF(kt.reason);wt=!0,OF(kt.reason)?(Te(ut),Ue.close(1e3,"recovering Browser Surface")):(L(ut),D("closed"))}catch{wt=!0,L("Browser Surface sent an invalid control frame"),D("closed"),Ue.close(4400,"invalid Browser Surface control")}return}if(!(Re.data instanceof ArrayBuffer)){L("Browser Surface sent an invalid image frame"),Ue.close(4400,"invalid Browser Surface image");return}const Ve=()=>p.current===We&&d.current===Ue;KF(Re.data,Ue,o.current,m.current,Ve).then(mt=>{mt===void 0||!Ve()||(f.current=mt,w.current=!0,C.current=!0,y.current=0,A(!0),U(!0))}).catch(()=>{Ve()&&(wt=!0,L("Browser preview could not be decoded"),D("closed"),Ue.close(4400,"Browser Surface image decode failed"))})},Ue.onclose=Re=>{if(!(p.current!==We||d.current!==Ue)&&(d.current=void 0,E.current=!1,W(),!wt)){if((Re.code===4403||Re.code===1006)&&!Gt){Gt=!0,V({refreshCapability:!0,preserveFrame:!0});return}if(LF(Re.code)){Te(x2(Re.code));return}D("closed"),L(Ve=>Ve??x2(Re.code))}},Ue.onerror=()=>{d.current===Ue&&L("Browser preview transport failed")}}catch(Se){if(p.current!==We)return;Te(Se instanceof Error?Se.message:"Browser preview could not connect")}},[e,t,i,r,W,T]);g.useEffect(()=>(V(),()=>{var me;p.current+=1,T(),W(),(me=d.current)==null||me.close(1e3,"Browser Surface view unmounted"),d.current=void 0}),[V,W,T]);const K=g.useCallback(()=>{y.current=0,V({preserveFrame:!0})},[V]),J=g.useCallback(me=>{const je=d.current;return!je||je.readyState!==WebSocket.OPEN?!1:(je.send(JSON.stringify(me)),!0)},[]),oe=g.useCallback(()=>{var je;const me=m.current;!me||!C.current||(J({type:"browser.surface.driver.take",subscriptionId:me.subscriptionId,browserGeneration:me.browserGeneration,viewportRevision:f.current}),(je=u.current)==null||je.focus())},[J]),ce=g.useCallback(()=>{const me=m.current;me&&(W(),u.current&&(u.current.value=""),J({type:"browser.surface.driver.release",subscriptionId:me.subscriptionId,browserGeneration:me.browserGeneration}))},[J,W]),Y=g.useCallback(me=>{const je=m.current;return!je||!C.current||!E.current?!1:J({type:"browser.surface.input",subscriptionId:je.subscriptionId,browserGeneration:je.browserGeneration,viewportRevision:f.current,inputSequence:v.current++,event:me})},[J]),ne=g.useCallback(me=>{let je;try{je=qF(me)}catch{return L("Text input is limited to 64 KiB at a time."),!1}let We=!1;for(const Te of je){if(!Y({type:"text.insert",text:Te}))return We;We=!0}return We},[Y]),de=g.useCallback(()=>{j.current!==void 0&&(window.cancelAnimationFrame(j.current),j.current=void 0);const me=S.current,je=k.current;S.current=void 0,k.current=void 0,E.current&&(me&&Y({...me}),je&&Y({...je}))},[Y]),Ae=g.useCallback(()=>{j.current===void 0&&(j.current=window.requestAnimationFrame(de))},[de]);g.useEffect(()=>{E.current=F,F||(W(),u.current&&(u.current.value="",u.current.blur()))},[F,W]);const ke=g.useCallback(me=>{var Se;if(!F)return;const je=v2(me.currentTarget,me.clientX,me.clientY);if(!je)return;if(me.type==="pointermove"){S.current={type:"pointer.move",...je,modifiers:Kh(me)},Ae(),me.preventDefault();return}de(),me.type==="pointerdown"&&((Se=u.current)==null||Se.focus(),me.currentTarget.setPointerCapture(me.pointerId));const We=me.type==="pointerdown"?"pointer.down":"pointer.up",Te=WF(N.current,me);if(!Te)return;const ze={type:We,...je,button:Te,modifiers:Kh(me)};Y(ze)&&me.preventDefault()},[F,Y,de,Ae]),Ee=g.useCallback(me=>{if(!F)return;const je=v2(me.currentTarget,me.clientX,me.clientY);if(!je)return;const We=me.deltaMode===VF?16:me.deltaMode===GF?Math.max(1,me.currentTarget.clientHeight):1,Te=k.current,ze=FF((Te==null?void 0:Te.deltaX)??0,(Te==null?void 0:Te.deltaY)??0,me.deltaX*We,me.deltaY*We);k.current={type:"wheel",...je,...ze,modifiers:Kh(me)},Ae(),me.preventDefault()},[F,Ae]),re=g.useCallback(me=>{if(me.nativeEvent.isComposing||me.key==="Process"||me.key==="Dead")return;de();const je=Y({type:me.type==="keydown"?"key.down":"key.up",key:me.key,code:me.code,repeat:me.repeat,modifiers:Kh(me)}),We=XF({type:me.type,key:me.key,altKey:me.altKey,ctrlKey:me.ctrlKey,metaKey:me.metaKey,isComposing:me.nativeEvent.isComposing}),Te=We===void 0?!1:ne(We);(je||Te)&&me.preventDefault()},[Y,ne,de]),te=g.useCallback(me=>{de();const je=me.clipboardData.getData("text/plain");je&&ne(je)&&me.preventDefault()},[ne,de]),Ce=g.useCallback(me=>{const je=me.data||me.currentTarget.value;me.currentTarget.value="",je&&ne(je)},[ne]);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:ke,onPointerDown:ke,onPointerUp:ke,onPointerCancel:ke,onWheel:Ee}),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:re,onKeyUp:re,onPaste:te,onCompositionEnd:Ce}),M==="connecting"&&l.jsx(_2,{preserveFrame:I,icon:l.jsx($e,{className:"size-5 animate-spin"}),label:I?"Reconnecting preview…":"Connecting preview…"}),M==="ready"&&!$&&l.jsx(_2,{icon:l.jsx($e,{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:H??"The Browser Surface ended."})]})}),n&&Wa.createPortal(l.jsx("div",{className:"flex items-center",children:M==="closed"?l.jsx(ue,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:K,children:l.jsx(Et,{className:"size-4"})}):M!=="ready"||!$?l.jsx(ue,{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($e,{className:"size-4 animate-spin"})}):F?l.jsx(ue,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:ce,children:l.jsx(SO,{className:"size-4"})}):l.jsx(ue,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:oe,children:l.jsx(EO,{className:"size-4"})})}),n),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:H??(F?"Browser control active":`Browser preview ${M}`)})]})}async function KF(e,t,r,i,n){const o=CF(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(!n()||!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 XF(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 ZF(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 v2(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 Kh(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 _2({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 QF(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 x2(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 JF=400;function eq({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}){const n=g.useRef(null),[o,u]=g.useState(0),[d,m]=g.useState("mounting"),[f,v]=g.useState("unavailable"),[p,y]=g.useState(!1),[b,w]=g.useState(),C=g.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}),[e,t,r,i]);g.useEffect(()=>{const S=window.rynxDesktopBrowser,k=n.current;if(!S||!k){m("unavailable");return}let j=!1,N=0,M;const D=Uv(C),H=async()=>{if(j)return;const P=tq(k.getBoundingClientRect());if(!P){S.park(C);return}try{const B=await S.mount(C,P);if(j)return;if(B==="mounted"){m("mounted"),M!==void 0&&window.clearTimeout(M),M=void 0;return}}catch{}j||(m("mounting"),M=window.setTimeout(()=>void H(),JF))},L=()=>{window.cancelAnimationFrame(N),N=window.requestAnimationFrame(()=>void H())},G=new ResizeObserver(L);G.observe(k),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0);const Z=S.onState(P=>{if(Uv(P.resource)===D){if(P.state==="closed"){m("unavailable");return}L()}}),q=S.onDriver(P=>{Uv(P.resource)===D&&(v(P.driver),P.driver==="desktop"&&(y(!1),w(void 0)))});return v(S.getDriver(C)),m("mounting"),L(),()=>{j=!0,G.disconnect(),Z(),q(),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0),window.cancelAnimationFrame(N),M!==void 0&&window.clearTimeout(M),S.park(C)}},[C,o]);const E=async()=>{const S=window.rynxDesktopBrowser;if(!(!S||p)){y(!0),w(void 0);try{if(await S.takeBack(C)!=="taken")throw new Error("The remote controller is no longer available.")}catch(k){y(!1),w(k instanceof Error?k.message:"Could not take back browser control.")}}};return l.jsxs("div",{ref:n,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($e,{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(ue,{size:"sm",variant:"outline",onClick:()=>u(S=>S+1),children:[l.jsx(Et,{}),"Retry"]})]})}),d==="mounted"&&f==="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(ue,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void E(),children:[p?l.jsx($e,{className:"animate-spin"}):null,"Take back control"]}),b?l.jsx("p",{role:"alert",className:"mt-2 text-xs text-[var(--destructive)]",children:b}):null]})})]})}function tq(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)),n=Math.min(window.innerHeight,Math.floor(e.bottom));return i<=t||n<=r?null:{x:t,y:r,width:i-t,height:n-r}}function Uv(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const rq="size-11 sm:size-8";function iq({sessionId:e,runtimeSelector:t,pageId:r,browserResource:i}){const{browser:n,loading:o,pendingAction:u,error:d,disabled:m,load:f,openBrowser:v,closeBrowser:p,recreateForDesktop:y,navigatePage:b,backPage:w,forwardPage:C,reloadPage:E}=i,S=g.useMemo(()=>n==null?void 0:n.pages.find(L=>L.pageId===r),[n,r]),k=n!==null&&BF(t,n,typeof window.rynxDesktopBrowser<"u"),j=n!==null&&n.sessionId===e&&PF(t,n,typeof window.rynxDesktopBrowser<"u"),N=n!==null&&n.sessionId===e&&zF(t,n,typeof window.rynxDesktopBrowser<"u"),M=g.useRef(null),[D,H]=g.useState(null);return g.useEffect(()=>{const L=`${t}
559
+ ${e}`;!j||M.current===L||(M.current=L,y())},[j,y,t,e]),o&&n===null?l.jsx(Hv,{label:"Loading browser…"}):n===null?l.jsx(sq,{error:d,pending:u!==null,onOpen:L=>void v(L),onRetry:()=>void f(!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(Xh,{label:"Go back",disabled:m||!(S!=null&&S.canGoBack),onClick:()=>S&&void w(S.pageId),children:l.jsx(jo,{})}),l.jsx(Xh,{label:"Go forward",disabled:m||!(S!=null&&S.canGoForward),onClick:()=>S&&void C(S.pageId),children:l.jsx(PE,{})}),l.jsx(Xh,{label:"Reload page",disabled:m||!S,onClick:()=>S&&void E(S.pageId),children:l.jsx(qO,{className:S!=null&&S.loading?"animate-spin":void 0})})]}),S?l.jsx(nq,{page:S,disabled:m,onNavigate:L=>void b(S.pageId,L)},`${S.pageId}
560
+ ${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"}),!k&&l.jsx("div",{ref:H,className:"flex shrink-0 items-center"}),N&&l.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void y(),children:"Open in app"}),l.jsx(Xh,{label:"Stop browser",disabled:u!==null,onClick:()=>void p(),children:l.jsx(C_,{})})]}),l.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[j?l.jsx(Hv,{label:"Opening in Desktop…"}):n.status==="ready"&&S?k?l.jsx(eq,{runtimeSelector:t,sessionId:e,browserGeneration:n.browserGeneration,pageId:S.pageId}):l.jsx(YF,{runtimeSelector:t,sessionId:e,browserGeneration:n.browserGeneration,pageId:S.pageId,toolbarHost:D}):n.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."}):n.status==="unavailable"?l.jsx(aq,{error:d,pending:u!==null,onRestart:()=>void v()}):l.jsx(Hv,{label:n.status==="closing"?"Closing browser…":"Starting browser…"}),d&&n.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??(n.status==="ready"?"Browser ready":`Browser ${n.status}`)})]})}function sq({error:e,pending:t,onOpen:r,onRetry:i}){const[n,o]=g.useState(""),u=d=>{d.preventDefault(),r(xA(n))};return l.jsx(vs,{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($u,{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(At,{value:n,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(ue,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?l.jsx($e,{className:"animate-spin"}):l.jsx($u,{}),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(ue,{type:"button",variant:"ghost",size:"sm",onClick:i,children:"Retry"})]}),l.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function nq({page:e,disabled:t,onNavigate:r}){const[i,n]=g.useState(e.url),o=u=>{u.preventDefault();const d=xA(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(At,{value:i,onChange:u=>n(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 Xh({label:e,disabled:t,onClick:r,children:i}){return l.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:rq,"aria-label":e,title:e,disabled:t,onClick:r,children:i})}function Hv({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($e,{className:"size-4 animate-spin"}),e]})}function aq({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(Et,{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(ue,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&l.jsx($e,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function oq(e,t,r,i){return r===i?t:e}function yA(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const lx=iF(),y2={...lx,enabled:!1};function bA({policy:e,upload:t,deleteResource:r,onChange:i}){const[n,o]=g.useState([]),u=g.useRef([]),d=g.useRef(new Map),m=g.useCallback(b=>{o(w=>{const C=b(w);return u.current=C,C})},[]);g.useEffect(()=>()=>{for(const b of d.current.values())b.abort();for(const b of u.current)URL.revokeObjectURL(b.previewUrl)},[]);const f=g.useCallback(b=>{if(!e.enabled)return;const w=Math.max(0,e.maxImagesPerMessage-u.current.length),C=b.slice(0,w);if(C.length!==0){i==null||i();for(const E of C){const S=Ju("attachment"),k=Ju("upl"),j=URL.createObjectURL(E),N=E.type;if(!e.mediaTypes.includes(N)){m(H=>[...H,{id:S,file:E,clientUploadId:k,previewUrl:j,state:"failed",error:"Unsupported image type"}]);continue}if(E.size<=0||E.size>e.maxImageBytes){m(H=>[...H,{id:S,file:E,clientUploadId:k,previewUrl:j,state:"failed",error:`Image must be smaller than ${lq(e.maxImageBytes)}`}]);continue}const M={id:S,file:E,clientUploadId:k,previewUrl:j,state:t?"uploading":"ready"};if(m(H=>[...H,M]),!t)continue;const D=new AbortController;d.current.set(S,D),t(E,k,D.signal).then(H=>{if(d.current.delete(S),!u.current.some(L=>L.id===S)){r==null||r(H).catch(()=>{});return}m(L=>L.map(G=>G.id===S?{...G,state:"ready",resource:H}:G))}).catch(H=>{d.current.delete(S),!D.signal.aborted&&m(L=>L.map(G=>G.id===S?{...G,state:"failed",error:H instanceof Error?H.message:"Upload failed"}:G))})}}},[r,i,e,m,t]),v=g.useCallback(b=>{const w=Array.from(b.clipboardData.files).filter(C=>C.type.startsWith("image/"));w.length!==0&&(b.preventDefault(),f(w))},[f]),p=g.useCallback(b=>{var w;i==null||i(),(w=d.current.get(b.id))==null||w.abort(),d.current.delete(b.id),m(C=>C.filter(E=>E.id!==b.id)),URL.revokeObjectURL(b.previewUrl),b.resource&&(r==null||r(b.resource).catch(()=>{}))},[r,i,m]),y=g.useCallback(()=>{for(const b of d.current.values())b.abort();d.current.clear();for(const b of u.current)URL.revokeObjectURL(b.previewUrl);u.current=[],o([])},[]);return{images:n,addFiles:f,onPaste:v,remove:p,clear:y,hasPending:n.some(b=>b.state==="uploading"),hasFailed:n.some(b=>b.state==="failed"),readyResources:n.flatMap(b=>b.state==="ready"&&b.resource?[b.resource]:[]),readyUploads:n.flatMap(b=>b.state==="ready"?[{file:b.file,clientUploadId:b.clientUploadId}]:[])}}function wA({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(n=>l.jsxs("div",{className:"group relative size-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",title:n.error??n.file.name,children:[l.jsx("img",{src:n.previewUrl,alt:n.file.name,className:"size-full object-cover"}),n.state==="uploading"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:l.jsx($e,{className:"size-5 animate-spin"})}),n.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 ${n.file.name}`,disabled:t,onClick:()=>r(n),children:l.jsx(cn,{className:"size-3"})})]},n.id))})}function SA({policy:e,imageCount:t,disabled:r,onFiles:i,className:n}){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(ue,{type:"button",variant:"ghost",size:"icon",className:qe("size-8 shrink-0",n),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(tO,{}):l.jsx(OO,{})})]})}function lq(e){return`${Math.round(e/(1024*1024))} MB`}const Fv=200;function cq({initialDraft:e,model:t,running:r,disabled:i,sessionId:n,runtimeSelector:o,onSend:u,onStop:d}){const[m,f]=g.useState(e??""),[v,p]=g.useState(y2),[y,b]=g.useState(!1),w=g.useRef(null),C=g.useRef(!1),E=g.useRef(void 0),S=g.useRef(0),k=g.useRef(!1),j=bA({policy:v,upload:(D,H,L)=>xe.uploadSessionResource(o,n,D,H,L),deleteResource:D=>xe.deleteSessionResource(o,n,D.resourceId),onChange:()=>{E.current=void 0}});g.useEffect(()=>{let D=!1;return xe.getSessionResourcePolicy(o,n).then(H=>{D||p(H)}).catch(()=>{D||p(y2)}),()=>{D=!0}},[o,n]),g.useEffect(()=>{e!==void 0&&f(D=>D||e)},[e]),g.useLayoutEffect(()=>{const D=w.current;if(!D)return;D.style.height="auto";const H=D.scrollHeight;D.style.height=`${Math.min(H,Fv)}px`,D.style.overflowY=H>Fv?"auto":"hidden"},[m]);async function N(){if(k.current)return;const D=m,H=S.current,L=m.trim(),G=j.readyResources;if(!L&&G.length===0||j.hasPending||j.hasFailed)return;const Z=G.length>0?E.current??Ju("msg"):void 0;Z&&(E.current=Z),k.current=!0,b(!0),f("");try{await u({text:L,images:G,clientMessageId:Z}),j.clear(),E.current=void 0}catch(q){ve.error(`Could not send message: ${q instanceof Error?q.message:"unknown error"}`),Im(q)?f(P=>oq(P,D,S.current,H)):(j.clear(),E.current=void 0)}finally{k.current=!1,b(!1)}}const M=!i&&!y&&!j.hasPending&&!j.hasFailed&&(!!m.trim()||j.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(wA,{images:j.images,disabled:y,onRemove:j.remove}),l.jsx("textarea",{ref:w,value:m,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:i,onChange:D=>{S.current+=1,E.current=void 0,f(D.target.value)},onPaste:D=>{y||j.onPaste(D)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&!C.current&&!D.nativeEvent.isComposing&&D.keyCode!==229&&(D.preventDefault(),M&&N())},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:Fv}}),l.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[l.jsx(SA,{policy:v,imageCount:j.images.length,disabled:i||y,onFiles:j.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(ue,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:d,title:"Stop the running turn",children:[l.jsx(h6,{})," Stop"]}):l.jsxs(ue,{className:"ml-auto h-8 shrink-0",onClick:N,disabled:!M,children:[l.jsx(WE,{})," Send"]})]})]})})}const CA=24,uq={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function dq({pages:e,order:t,selectedPageId:r,selectionDisabled:i,mutationDisabled:n,createDisabled:o,createPending:u,emulatorAttached:d,emulator:m,onSelectPage:f,onClosePage:v,onCreatePage:p,onSelectEmulator:y,onCloseEmulator:b,onAddEmulator:w,headerLeadingAction:C,leadingAction:E,trailingAction:S}){const k=g.useRef(null),j=g.useRef(null),N=g.useRef(null),M=g.useRef(null),D=g.useRef(null),H=g.useRef(null),[L,G]=g.useState(uq),Z=t.flatMap(F=>{if(F===en())return m?[{type:"emulator",key:F,emulator:m}]:[];const W=e.find(T=>Js(T.pageId)===F);return W?[{type:"browser",key:F,page:W}]:[]}),q=Z.map(F=>F.key).join(`
561
+ `),P=Z.length,B=g.useCallback(()=>{const F=k.current,W=j.current,T=N.current;if(!(!F||!W||!T))return $F({scrollLeft:W.scrollLeft,viewportWidth:W.clientWidth,contentWidth:T.scrollWidth,availableWidth:F.clientWidth})},[]),z=g.useCallback(()=>{const F=B();F&&G(W=>hq(W,F)?W:F)},[B]),I=g.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,z()}))},[z]),A=g.useCallback(F=>{const W=j.current,T=M.current;if(!W||!T)return;const V=W.getBoundingClientRect(),K=T.getBoundingClientRect(),J=HF({scrollLeft:W.scrollLeft,viewportWidth:W.clientWidth,tabLeft:W.scrollLeft+K.left-V.left,tabWidth:K.width,inset:CA});J!==0&&W.scrollBy({left:J,behavior:F})},[]),$=g.useCallback(F=>{const W=j.current;if(!W)return;const T=UF(W.clientWidth);W.scrollBy({left:F==="left"?-T:T,behavior:w2()})},[]);g.useEffect(()=>()=>{D.current!==null&&window.cancelAnimationFrame(D.current)},[]),g.useLayoutEffect(()=>{const F=k.current,W=j.current,T=N.current;if(!F||!W||!T)return;const V=()=>{const J=W.clientWidth,oe=H.current===null||Math.abs(J-H.current)>1;H.current=J,I(),oe&&A("auto")},K=typeof ResizeObserver>"u"?void 0:new ResizeObserver(V);return K==null||K.observe(F),K==null||K.observe(W),K==null||K.observe(T),window.addEventListener("resize",V),z(),()=>{K==null||K.disconnect(),window.removeEventListener("resize",V)}},[A,I,z]),g.useEffect(()=>{const F=j.current;if(!F)return;const W=T=>{if(T.ctrlKey||T.deltaY===0||Math.abs(T.deltaY)<=Math.abs(T.deltaX))return;const V=B();(T.deltaY<0?V!=null&&V.canScrollLeft:V!=null&&V.canScrollRight)&&(T.preventDefault(),F.scrollLeft+=T.deltaY,I())};return F.addEventListener("wheel",W,{passive:!1}),()=>F.removeEventListener("wheel",W)},[B,I]),g.useLayoutEffect(()=>{A(w2()),I()},[q,A,I,L.hasOverflow,r]);function U(F,W){var K;let T;if(F.key==="ArrowLeft"?T=(W-1+P)%P:F.key==="ArrowRight"?T=(W+1)%P:F.key==="Home"?T=0:F.key==="End"&&(T=P-1),T===void 0||T===W)return;F.preventDefault();const V=(K=N.current)==null?void 0:K.querySelectorAll('[role="tab"]').item(T);V==null||V.focus(),V==null||V.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:k,className:"flex min-w-0 flex-1 items-end gap-1",children:[L.hasOverflow&&l.jsx(b2,{direction:"left",disabled:!L.canScrollLeft,onClick:()=>$("left")}),l.jsx("div",{ref:j,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:fq(L),onScroll:I,children:l.jsx("div",{ref:N,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:Z.map((F,W)=>{if(F.type==="emulator"){const J=F.emulator;return l.jsxs("div",{ref:J.selected?M:void 0,role:"presentation",className:J.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":J.selected,"aria-label":J.label,title:J.label,tabIndex:J.selected?0:-1,onClick:y,onKeyDown:oe=>U(oe,W),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:[J.busy?l.jsx($e,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Xl,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:J.label})]}),l.jsx(ue,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:b,className:"ml-1",children:l.jsx(cn,{className:"size-3"})})]},F.key)}const T=F.page,V=T.pageId===r,K=T.title||T.url||"New page";return l.jsxs("div",{ref:V?M:void 0,role:"presentation",className:V?"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":V,"aria-label":K,title:K,tabIndex:V?0:-1,disabled:i,onClick:()=>f(T.pageId),onKeyDown:J=>U(J,W),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:[T.loading?l.jsx($e,{className:"size-3 shrink-0 animate-spin"}):l.jsx($u,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:K})]}),l.jsx(ue,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${K}`,title:`Close ${K}`,disabled:n,onClick:()=>v(T.pageId),className:"ml-1",children:l.jsx(cn,{className:"size-3"})})]},F.key)})})}),L.hasOverflow&&l.jsx(b2,{direction:"right",disabled:!L.canScrollRight,onClick:()=>$("right")})]}),E&&l.jsx("div",{className:"mb-1 shrink-0",children:E}),l.jsxs(L_,{children:[l.jsx(Hf,{asChild:!0,children:l.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:l.jsx(ri,{})})}),l.jsxs(Ff,{align:"end",children:[l.jsxs(Wu,{disabled:o,"aria-busy":u,onSelect:p,children:[u?l.jsx($e,{className:"animate-spin"}):l.jsx($u,{}),u?"Creating browser tab…":"New browser tab"]}),l.jsxs(Wu,{onSelect:w,children:[l.jsx(Xl,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),S&&l.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:S})]})}function b2({direction:e,disabled:t,onClick:r}){const i=e==="left"?zE:Po;return l.jsx(ue,{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 w2(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function hq(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function fq(e){const t=`${CA}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 mq=8,pq=256,gq=4e3;function vq({sessionId:e,runtimeSelector:t,controller:r}){return r.binding?l.jsx(xq,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r}):l.jsx(_q,{controller:r})}function _q({controller:e}){const[t,r]=g.useState(null),i=async n=>{r(n);try{await e.attach(n)}catch(o){ve.error(`Could not attach Emulator: ${o.message}`)}finally{r(null)}};return l.jsx(vs,{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(ue,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:l.jsx(Et,{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(kA,{icon:l.jsx($e,{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(S_,{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(n=>l.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void i(n.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===n.id?l.jsx($e,{className:"size-4 animate-spin"}):l.jsx(S_,{className:"size-4"})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium",children:n.name}),l.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[l.jsx(EA,{state:n.state}),l.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:n.backend})]})]})]},`${n.backend}:${n.id}`))})]})})})}function xq({sessionId:e,runtimeSelector:t,binding:r,controller:i}){const[n,o]=g.useState(null),[u,d]=g.useState(!1),[m,f]=g.useState(null),[v,p]=g.useState(null),y=g.useRef(null),b=g.useRef(null),w=g.useRef(null),C=g.useRef(null),E=g.useRef(null);g.useEffect(()=>{o(null),d(!1),p(null),f(null);let L=!1,G,Z,q=0,P=0,B=!1,z=null,I,A="png";const $=()=>{Z!==void 0&&window.clearTimeout(Z),Z=void 0,f(null)},U=(V,K=!1)=>{if(Z!==void 0&&window.clearTimeout(Z),K||z===null){f(V);return}Z=window.setTimeout(()=>{Z=void 0,L||f(V)},gq)},F=V=>{if(L)return;const K=URL.createObjectURL(V),J=z;z=K,o(K),$(),q=0,B=!1,J&&window.setTimeout(()=>URL.revokeObjectURL(J),1e3)},W=(V,K=!1)=>{if(L)return;G!==void 0&&window.clearTimeout(G);const J=K?0:Math.min(8e3,500*2**q++);G=window.setTimeout(()=>void V(K),J)},T=async(V=!1)=>{const K=++P;try{const J=await Xu(V);if(L||K!==P)return;const oe=new WebSocket(yq({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:J}));I=oe,oe.binaryType="arraybuffer",oe.onmessage=ce=>{if(L||K!==P||I!==oe)return;if(typeof ce.data=="string"){try{const de=JSON.parse(ce.data);if(de.type!=="emulator.surface.ready"||typeof de.surfaceId!="string"||de.format!=="png"&&de.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");A=de.format,b.current={socket:oe,surfaceId:de.surfaceId,inputSequence:0}}catch{oe.close(4400,"invalid Emulator Surface ready frame")}return}const Y=ce.data instanceof ArrayBuffer||ce.data instanceof Blob?ce.data:null,ne=A==="jpeg"?"image/jpeg":"image/png";Y instanceof Blob?F(new Blob([Y],{type:ne})):Y&&F(new Blob([Y],{type:ne}))},oe.onclose=ce=>{var ne;if(L||K!==P||I!==oe)return;((ne=b.current)==null?void 0:ne.socket)===oe&&(b.current=null);const Y=new Error(ce.code===4406?"emulator_surface_upgrade_required":ce.reason||"Remote Emulator Surface disconnected");U(Y,ce.code===4406),ce.code!==4406&&((ce.code===4403||ce.code===1006)&&!B?(B=!0,W(T,!0)):W(T))},oe.onerror=()=>{}}catch(J){if(L||K!==P)return;U(J instanceof Error?J:new Error(String(J))),W(T)}};return T(),()=>{L=!0,P+=1,b.current=null,I==null||I.close(1e3,"Session Emulator pane closed"),G!==void 0&&window.clearTimeout(G),Z!==void 0&&window.clearTimeout(Z),z&&URL.revokeObjectURL(z)}},[r.backend,r.bindingId,t,e]);const S=g.useCallback((L,G,Z)=>{const q=b.current;if(!q||q.socket.readyState!==WebSocket.OPEN||Z!==void 0&&q.surfaceId!==Z)return!1;try{return q.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:q.surfaceId,inputSequence:q.inputSequence++,phase:L,...G})),!0}catch{return!1}},[]),k=g.useCallback(()=>{C.current!==null&&window.cancelAnimationFrame(C.current),C.current=null;const L=w.current;w.current=null,L&&S("move",L,L.surfaceId)},[S]),j=g.useCallback(L=>{const G=y.current;if(!G)return null;const Z=G.getBoundingClientRect();return Z.width<=0||Z.height<=0?null:{x:Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width)),y:Math.max(0,Math.min(1,(L.clientY-Z.top)/Z.height))}},[]),N=L=>{var P;if(i.mutating)return;const G=j(L.nativeEvent);if(!G)return;L.currentTarget.setPointerCapture(L.pointerId);const Z=((P=b.current)==null?void 0:P.surfaceId)??null,q=Z!==null&&S("begin",G,Z);E.current={pointerId:L.pointerId,startX:L.clientX,startY:L.clientY,lastPoint:G,points:[{type:"begin",...G}],live:q,surfaceId:q?Z:null}},M=L=>{const G=E.current;if(!G||G.pointerId!==L.pointerId)return;const Z=j(L.nativeEvent);Z&&G.live?(G.lastPoint=Z,w.current=G.surfaceId?{...Z,surfaceId:G.surfaceId}:null,C.current===null&&(C.current=window.requestAnimationFrame(()=>k()))):Z&&G.points.length<pq-1&&(G.lastPoint=Z,G.points.push({type:"move",...Z}))},D=L=>{const G=E.current;if(E.current=null,!G||G.pointerId!==L.pointerId)return;const Z=j(L.nativeEvent);if(!Z)return;if(G.live){k(),G.surfaceId&&S("end",Z,G.surfaceId);return}(Math.hypot(L.clientX-G.startX,L.clientY-G.startY)>mq?i.gesture([...G.points,{type:"end",...Z}]):i.tap(Z.x,Z.y)).catch(B=>ve.error(`Emulator input failed: ${B.message}`))},H=async()=>{try{await i.detach()}catch(L){ve.error(`Could not detach Emulator: ${L.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(EA,{state:r.deviceState}),!r.available&&l.jsx(Pt,{variant:"outline",children:"Unavailable"}),m&&n&&l.jsxs(Pt,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[l.jsx($e,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(ue,{variant:"ghost",size:"icon-sm",disabled:!r.available||i.mutating,title:"Home","aria-label":"Home",onClick:()=>void i.button("home").catch(L=>ve.error(`Home failed: ${L.message}`)),children:l.jsx(IE,{})}),l.jsxs(ue,{variant:"ghost",size:"sm",disabled:i.mutating,title:"Detach from this session",onClick:()=>void H(),children:[i.mutating?l.jsx($e,{className:"animate-spin"}):l.jsx(w6,{}),"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(kA,{icon:l.jsx($e,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),m&&!n&&l.jsxs("div",{className:"max-w-sm text-center",children:[l.jsx(S_,{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})]}),n&&l.jsx("img",{ref:y,src:n,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:L=>{p({width:L.currentTarget.naturalWidth,height:L.currentTarget.naturalHeight}),d(!0)},onPointerDown:N,onPointerMove:M,onPointerUp:D,onPointerCancel:()=>{const L=E.current;E.current=null,L!=null&&L.live&&(k(),L.surfaceId&&S("end",L.lastPoint,L.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 yq(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 EA({state:e}){return l.jsxs(Pt,{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 kA({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 RA="rynx.control.theme";function bq(){const e=localStorage.getItem(RA);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fy(){const[e,t]=g.useState(bq);return g.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(RA,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
562
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
563
+ * @license MIT
564
+ *
565
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
566
+ * @license MIT
567
+ *
568
+ * Originally forked from (with the author's permission):
569
+ * Fabrice Bellard's javascript vt100 for jslinux:
570
+ * http://bellard.org/jslinux/
571
+ * Copyright (c) 2011 Fabrice Bellard
572
+ */var wq=2,Sq=1,Cq=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")),n=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,f=i-d,v=n-m-t;return{cols:Math.max(wq,Math.floor(v/e.css.cell.width)),rows:Math.max(Sq,Math.floor(f/e.css.cell.height))}}};/**
573
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
574
+ * @license MIT
575
+ *
576
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
577
+ * @license MIT
578
+ *
579
+ * Originally forked from (with the author's permission):
580
+ * Fabrice Bellard's javascript vt100 for jslinux:
581
+ * http://bellard.org/jslinux/
582
+ * Copyright (c) 2011 Fabrice Bellard
583
+ */var Eq=class{constructor(t,r,i,n={}){this._terminal=t,this._regex=r,this._handler=i,this._options=n}provideLinks(t,r){let i=Rq.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,n)=>{if(this._options.hover){let{range:o}=r;this._options.hover(i,n,o)}},r))}};function kq(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 Rq=class yf{static computeLink(t,r,i,n){let o=new RegExp(r.source,(r.flags||"")+"g"),[u,d]=yf._getWindowedLineStrings(t-1,i),m=u.join(""),f,v=[];for(;f=o.exec(m);){let p=f[0];if(!kq(p))continue;let[y,b]=yf._mapStrIdx(i,d,0,f.index),[w,C]=yf._mapStrIdx(i,y,b,p.length);if(y===-1||b===-1||w===-1||C===-1)continue;let E={start:{x:b+1,y:y+1},end:{x:C,y:w+1}};v.push({range:E,text:p,activate:n})}return v}static _getWindowedLineStrings(t,r){let i,n=t,o=t,u=0,d="",m=[];if(i=r.buffer.active.getLine(t)){let f=i.translateToString(!0);if(i.isWrapped&&f[0]!==" "){for(u=0;(i=r.buffer.active.getLine(--n))&&u<2048&&(d=i.translateToString(!0),u+=d.length,m.push(d),!(!i.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(f),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,n]}static _mapStrIdx(t,r,i,n){let o=t.buffer.active,u=o.getNullCell(),d=i;for(;n;){let m=o.getLine(r);if(!m)return[-1,-1];for(let f=d;f<m.length;++f){m.getCell(f,u);let v=u.getChars();if(u.getWidth()&&(n-=v.length||1,f===m.length-1&&v==="")){let p=o.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,u),u.getWidth()===2&&(n+=1))}if(n<0)return[r,f]}r++,d=0}return[r,d]}},Nq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function jq(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 Aq=class{constructor(t=jq,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,i=r.urlRegex||Nq;this._linkProvider=this._terminal.registerLinkProvider(new Eq(this._terminal,i,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
584
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
585
+ * @license MIT
586
+ *
587
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
588
+ * @license MIT
589
+ *
590
+ * Originally forked from (with the author's permission):
591
+ * Fabrice Bellard's javascript vt100 for jslinux:
592
+ * http://bellard.org/jslinux/
593
+ * Copyright (c) 2011 Fabrice Bellard
594
+ */var Tq=(e,t,r,i)=>{for(var n=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=u(n)||n);return n},Mq=(e,t)=>(r,i)=>t(r,i,e),Dq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?S2.isErrorNoTelemetry(e)?new S2(e.message+`
595
+
596
+ `+e.stack):new Error(e.message+`
597
+
598
+ `+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)}},Lq=new Dq;function qv(e){Oq(e)||Lq.onUnexpectedError(e)}var cx="Canceled";function Oq(e){return e instanceof Bq?!0:e instanceof Error&&e.name===cx&&e.message===cx}var Bq=class extends Error{constructor(){super(cx),this.name=this.message}},S2=class ux extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ux)return t;let r=new ux;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Pq;(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 n(o){return o===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Pq||(Pq={}));function zq(e,t){let r=this,i=!1,n;return function(){return i||(i=!0,t||(n=e.apply(r,arguments))),n}}var NA;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(N){yield N}e.single=n;function o(N){return t(N)?N:n(N)}e.wrap=o;function u(N){return N||r}e.from=u;function*d(N){for(let M=N.length-1;M>=0;M--)yield N[M]}e.reverse=d;function m(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(N){return N[Symbol.iterator]().next().value}e.first=f;function v(N,M){let D=0;for(let H of N)if(M(H,D++))return!0;return!1}e.some=v;function p(N,M){for(let D of N)if(M(D))return D}e.find=p;function*y(N,M){for(let D of N)M(D)&&(yield D)}e.filter=y;function*b(N,M){let D=0;for(let H of N)yield M(H,D++)}e.map=b;function*w(N,M){let D=0;for(let H of N)yield*M(H,D++)}e.flatMap=w;function*C(...N){for(let M of N)yield*M}e.concat=C;function E(N,M,D){let H=D;for(let L of N)H=M(H,L);return H}e.reduce=E;function*S(N,M,D=N.length){for(M<0&&(M+=N.length),D<0?D+=N.length:D>N.length&&(D=N.length);M<D;M++)yield N[M]}e.slice=S;function k(N,M=Number.POSITIVE_INFINITY){let D=[];if(M===0)return[D,N];let H=N[Symbol.iterator]();for(let L=0;L<M;L++){let G=H.next();if(G.done)return[D,e.empty()];D.push(G.value)}return[D,{[Symbol.iterator](){return H}}]}e.consume=k;async function j(N){let M=[];for await(let D of N)M.push(D);return Promise.resolve(M)}e.asyncToArray=j})(NA||(NA={}));function jA(e){if(NA.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 AA(...e){return oi(()=>jA(e))}function oi(e){return{dispose:zq(()=>{e()})}}var TA=class MA{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{jA(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?MA.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)}};TA.DISABLE_DISPOSED_WARNING=!1;var Kl=TA,Bs=class{constructor(){this._store=new Kl,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)}};Bs.None=Object.freeze({dispose(){}});var hu=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}},my=typeof process<"u"&&"title"in process,Fm=my?"node":navigator.userAgent,Iq=my?"node":navigator.platform,$q=Fm.includes("Firefox"),Uq=Fm.includes("Edge"),DA=/^((?!chrome|android).)*safari/i.test(Fm);function Hq(){if(!DA)return 0;let e=Fm.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}Iq.indexOf("Linux")>=0;var Fq="",Br=0,Pr=0,zr=0,er=0,os={css:"#00000000",rgba:0},fi;(e=>{function t(n,o,u,d){return d!==void 0?`#${_o(n)}${_o(o)}${_o(u)}${_o(d)}`:`#${_o(n)}${_o(o)}${_o(u)}`}e.toCss=t;function r(n,o,u,d=255){return(n<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(n,o,u,d){return{css:e.toCss(n,o,u,d),rgba:e.toRgba(n,o,u,d)}}e.toColor=i})(fi||(fi={}));var ju;(e=>{function t(m,f){if(er=(f.rgba&255)/255,er===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,p=f.rgba>>16&255,y=f.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Br=b+Math.round((v-b)*er),Pr=w+Math.round((p-w)*er),zr=C+Math.round((y-C)*er);let E=fi.toCss(Br,Pr,zr),S=fi.toRgba(Br,Pr,zr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,f,v){let p=ko.ensureContrastRatio(m.rgba,f.rgba,v);if(p)return fi.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function n(m){let f=(m.rgba|255)>>>0;return[Br,Pr,zr]=ko.toChannels(f),{css:fi.toCss(Br,Pr,zr),rgba:f}}e.opaque=n;function o(m,f){return er=Math.round(f*255),[Br,Pr,zr]=ko.toChannels(m.rgba),{css:fi.toCss(Br,Pr,zr,er),rgba:fi.toRgba(Br,Pr,zr,er)}}e.opacity=o;function u(m,f){return er=m.rgba&255,o(m,er*f/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(ju||(ju={}));var qq;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let o=n.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return Br=parseInt(n.slice(1,2).repeat(2),16),Pr=parseInt(n.slice(2,3).repeat(2),16),zr=parseInt(n.slice(3,4).repeat(2),16),fi.toColor(Br,Pr,zr);case 5:return Br=parseInt(n.slice(1,2).repeat(2),16),Pr=parseInt(n.slice(2,3).repeat(2),16),zr=parseInt(n.slice(3,4).repeat(2),16),er=parseInt(n.slice(4,5).repeat(2),16),fi.toColor(Br,Pr,zr,er);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let o=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Br=parseInt(o[1]),Pr=parseInt(o[2]),zr=parseInt(o[3]),er=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),fi.toColor(Br,Pr,zr,er);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Br,Pr,zr,er]=t.getImageData(0,0,1,1).data,er!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:fi.toRgba(Br,Pr,zr,er),css:n}}e.toColor=i})(qq||(qq={}));var di;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,o){let u=i/255,d=n/255,m=o/255,f=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 f*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(di||(di={}));var ko;(e=>{function t(u,d){if(er=(d&255)/255,er===1)return d;let m=d>>24&255,f=d>>16&255,v=d>>8&255,p=u>>24&255,y=u>>16&255,b=u>>8&255;return Br=p+Math.round((m-p)*er),Pr=y+Math.round((f-y)*er),zr=b+Math.round((v-b)*er),fi.toRgba(Br,Pr,zr)}e.blend=t;function r(u,d,m){let f=di.relativeLuminance(u>>8),v=di.relativeLuminance(d>>8);if(Bn(f,v)<m){if(v<f){let b=i(u,d,m),w=Bn(f,di.relativeLuminance(b>>8));if(w<m){let C=n(u,d,m),E=Bn(f,di.relativeLuminance(C>>8));return w>E?b:C}return b}let p=n(u,d,m),y=Bn(f,di.relativeLuminance(p>>8));if(y<m){let b=i(u,d,m),w=Bn(f,di.relativeLuminance(b>>8));return y>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Bn(di.relativeLuminance2(y,b,w),di.relativeLuminance2(f,v,p));for(;C<m&&(y>0||b>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Bn(di.relativeLuminance2(y,b,w),di.relativeLuminance2(f,v,p));return(y<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function n(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Bn(di.relativeLuminance2(y,b,w),di.relativeLuminance2(f,v,p));for(;C<m&&(y<255||b<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Bn(di.relativeLuminance2(y,b,w),di.relativeLuminance2(f,v,p));return(y<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=n;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(ko||(ko={}));function _o(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function yr(e){if(!e)throw new Error("value must not be falsy");return e}function py(e){return 57508<=e&&e<=57558}function Wq(e){return 57520<=e&&e<=57527}function Vq(e){return 57344<=e&&e<=63743}function Gq(e){return 9472<=e&&e<=9631}function Yq(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 Kq(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Yq(e)&&!py(e)&&!Vq(e)}function LA(e){return py(e)||Gq(e)}function Xq(){return{css:{canvas:Zh(),cell:Zh()},device:{canvas:Zh(),cell:Zh(),char:{width:0,height:0,left:0,top:0}}}}function Zh(){return{width:0,height:0}}function Zq(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Zr=0,Dr=0,Xs=!1,Pn=!1,Qh=!1,ki,Wv=0,Qq=class{constructor(e,t,r,i,n,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=n,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,Dr=0,Zr=0,Pn=!1,Xs=!1,Qh=!1,ki=this._themeService.colors,Wv=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Wv=t*i%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(Dr=n.backgroundColorRGB.rgba>>8&16777215,Pn=!0),n.foregroundColorRGB&&(Zr=n.foregroundColorRGB.rgba>>8&16777215,Xs=!0)}),Qh=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Qh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Dr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Dr=(this.result.fg&16777215)<<8|255;break;case 0:default:Dr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Dr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Dr=(this.result.bg&16777215)<<8|255;break}Dr=ko.blend(Dr,(this._coreBrowserService.isFocused?ki.selectionBackgroundOpaque:ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Dr=(this._coreBrowserService.isFocused?ki.selectionBackgroundOpaque:ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Pn=!0,ki.selectionForeground&&(Zr=ki.selectionForeground.rgba>>8&16777215,Xs=!0),LA(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Zr=(this._coreBrowserService.isFocused?ki.selectionBackgroundOpaque:ki.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Zr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Zr=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Zr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Zr=(this.result.fg&16777215)<<8|255;break;case 0:default:Zr=this._themeService.colors.foreground.rgba}Zr=ko.blend(Zr,(this._coreBrowserService.isFocused?ki.selectionBackgroundOpaque:ki.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Xs=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(Dr=n.backgroundColorRGB.rgba>>8&16777215,Pn=!0),n.foregroundColorRGB&&(Zr=n.foregroundColorRGB.rgba>>8&16777215,Xs=!0)}),Pn&&(Qh?Dr=e.bg&-16777216&-134217729|Dr|50331648:Dr=e.bg&-16777216|Dr|50331648),Xs&&(Zr=e.fg&-16777216&-67108865|Zr|50331648),this.result.fg&67108864&&(Pn&&!Xs&&((this.result.bg&50331648)===0?Zr=this.result.fg&-134217728|ki.background.rgba>>8&16777215&16777215|50331648:Zr=this.result.fg&-134217728|this.result.bg&67108863,Xs=!0),!Pn&&Xs&&((this.result.fg&50331648)===0?Dr=this.result.bg&-67108864|ki.foreground.rgba>>8&16777215&16777215|50331648:Dr=this.result.bg&-67108864|this.result.fg&67108863,Pn=!0)),ki=void 0,this.result.bg=Pn?Dr:this.result.bg,this.result.fg=Xs?Zr:this.result.fg,this.result.ext&=536870911,this.result.ext|=Wv<<29&3758096384}},Jq=.5,OA=$q||Uq?"bottom":"ideographic",eW={"▀":[{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}]},tW={"░":[[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]]},rW={"─":{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`}},ed={"":{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}};ed[""]=ed[""];ed[""]=ed[""];function iW(e,t,r,i,n,o,u,d){let m=eW[t];if(m)return sW(e,m,r,i,n,o),!0;let f=tW[t];if(f)return nW(e,f,r,i,n,o),!0;let v=rW[t];if(v)return aW(e,v,r,i,n,o,d),!0;let p=ed[t];return p?(oW(e,p,r,i,n,o,u,d),!0):!1}function sW(e,t,r,i,n,o){for(let u=0;u<t.length;u++){let d=t[u],m=n/8,f=o/8;e.fillRect(r+d.x*m,i+d.y*f,d.w*m,d.h*f)}}var C2=new Map;function nW(e,t,r,i,n,o){let u=C2.get(t);u||(u=new Map,C2.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 f=t[0].length,v=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=f,p.height=v;let y=yr(p.getContext("2d")),b=new ImageData(f,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(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let k=0;k<v;k++)for(let j=0;j<f;j++)b.data[(k*f+j)*4]=w,b.data[(k*f+j)*4+1]=C,b.data[(k*f+j)*4+2]=E,b.data[(k*f+j)*4+3]=t[k][j]*(S*255);y.putImageData(b,0,0),m=yr(e.createPattern(p,null)),u.set(d,m)}e.fillStyle=m,e.fillRect(r,i,n,o)}function aW(e,t,r,i,n,o,u){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(d);let f;if(typeof m=="function"){let v=.15/o*n;f=m(.15,v)}else f=m;for(let v of f.split(" ")){let p=v[0],y=BA[p];if(!y){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||y(e,PA(b,n,o,r,i,!0,u))}e.stroke(),e.closePath()}}function oW(e,t,r,i,n,o,u,d){let m=new Path2D;m.rect(r,i,n,o),e.clip(m),e.beginPath();let f=u/12;e.lineWidth=d*f;for(let v of t.d.split(" ")){let p=v[0],y=BA[p];if(!y){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||y(e,PA(b,n,o,r,i,!1,d,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function E2(e,t,r=0){return Math.max(Math.min(e,t),r)}var BA={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 PA(e,t,r,i,n,o,u,d=0,m=0){let f=e.map(v=>parseFloat(v)||parseInt(v));if(f.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<f.length;v+=2)f[v]*=t-d*u-m*u,o&&f[v]!==0&&(f[v]=E2(Math.round(f[v]+.5)-.5,t,0)),f[v]+=i+d*u;for(let v=1;v<f.length;v+=2)f[v]*=r,o&&f[v]!==0&&(f[v]=E2(Math.round(f[v]+.5)-.5,r,0)),f[v]+=n;return f}var k2=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={}}},R2=class{constructor(){this._data=new k2}set(e,t,r,i,n){this._data.get(e,t)||this._data.set(e,t,new k2),this._data.get(e,t).set(r,i,n)}get(e,t,r,i){var n;return(n=this._data.get(e,t))==null?void 0:n.get(r,i)}clear(){this._data.clear()}},zA=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(),n=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),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},lW=class extends zA{_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())}}},cW=class extends zA{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},uW=!my&&"requestIdleCallback"in window?cW:lW,ql=class IA{constructor(){this.fg=0,this.bg=0,this.extended=new $A}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 IA;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}},$A=class UA{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 UA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},dW=globalThis.performance&&typeof globalThis.performance.now=="function",hW=class HA{static create(t){return new HA(t)}constructor(t){this._now=dW&&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}},Hn;(e=>{e.None=()=>Bs.None;function t(P,B){return p(P,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function r(P){return(B,z=null,I)=>{let A=!1,$;return $=P(U=>{if(!A)return $?$.dispose():A=!0,B.call(z,U)},null,I),A&&$.dispose(),$}}e.once=r;function i(P,B,z){return f((I,A=null,$)=>P(U=>I.call(A,B(U)),null,$),z)}e.map=i;function n(P,B,z){return f((I,A=null,$)=>P(U=>{B(U),I.call(A,U)},null,$),z)}e.forEach=n;function o(P,B,z){return f((I,A=null,$)=>P(U=>B(U)&&I.call(A,U),null,$),z)}e.filter=o;function u(P){return P}e.signal=u;function d(...P){return(B,z=null,I)=>{let A=AA(...P.map($=>$(U=>B.call(z,U))));return v(A,I)}}e.any=d;function m(P,B,z,I){let A=z;return i(P,$=>(A=B(A,$),A),I)}e.reduce=m;function f(P,B){let z,I={onWillAddFirstListener(){z=P(A.fire,A)},onDidRemoveLastListener(){z==null||z.dispose()}},A=new qt(I);return B==null||B.add(A),A.event}function v(P,B){return B instanceof Array?B.push(P):B&&B.add(P),P}function p(P,B,z=100,I=!1,A=!1,$,U){let F,W,T,V=0,K,J={leakWarningThreshold:$,onWillAddFirstListener(){F=P(ce=>{V++,W=B(W,ce),I&&!T&&(oe.fire(W),W=void 0),K=()=>{let Y=W;W=void 0,T=void 0,(!I||V>1)&&oe.fire(Y),V=0},typeof z=="number"?(clearTimeout(T),T=setTimeout(K,z)):T===void 0&&(T=0,queueMicrotask(K))})},onWillRemoveListener(){A&&V>0&&(K==null||K())},onDidRemoveLastListener(){K=void 0,F.dispose()}},oe=new qt(J);return U==null||U.add(oe),oe.event}e.debounce=p;function y(P,B=0,z){return e.debounce(P,(I,A)=>I?(I.push(A),I):[A],B,void 0,!0,void 0,z)}e.accumulate=y;function b(P,B=(I,A)=>I===A,z){let I=!0,A;return o(P,$=>{let U=I||!B($,A);return I=!1,A=$,U},z)}e.latch=b;function w(P,B,z){return[e.filter(P,B,z),e.filter(P,I=>!B(I),z)]}e.split=w;function C(P,B=!1,z=[],I){let A=z.slice(),$=P(W=>{A?A.push(W):F.fire(W)});I&&I.add($);let U=()=>{A==null||A.forEach(W=>F.fire(W)),A=null},F=new qt({onWillAddFirstListener(){$||($=P(W=>F.fire(W)),I&&I.add($))},onDidAddFirstListener(){A&&(B?setTimeout(U):U())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return I&&I.add(F),F.event}e.buffer=C;function E(P,B){return(z,I,A)=>{let $=B(new k);return P(function(U){let F=$.evaluate(U);F!==S&&z.call(I,F)},void 0,A)}}e.chain=E;let S=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(z=>(B(z),z)),this}filter(B){return this.steps.push(z=>B(z)?z:S),this}reduce(B,z){let I=z;return this.steps.push(A=>(I=B(I,A),I)),this}latch(B=(z,I)=>z===I){let z=!0,I;return this.steps.push(A=>{let $=z||!B(A,I);return z=!1,I=A,$?A:S}),this}evaluate(B){for(let z of this.steps)if(B=z(B),B===S)break;return B}}function j(P,B,z=I=>I){let I=(...F)=>U.fire(z(...F)),A=()=>P.on(B,I),$=()=>P.removeListener(B,I),U=new qt({onWillAddFirstListener:A,onDidRemoveLastListener:$});return U.event}e.fromNodeEventEmitter=j;function N(P,B,z=I=>I){let I=(...F)=>U.fire(z(...F)),A=()=>P.addEventListener(B,I),$=()=>P.removeEventListener(B,I),U=new qt({onWillAddFirstListener:A,onDidRemoveLastListener:$});return U.event}e.fromDOMEventEmitter=N;function M(P){return new Promise(B=>r(P)(B))}e.toPromise=M;function D(P){let B=new qt;return P.then(z=>{B.fire(z)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=D;function H(P,B){return P(z=>B.fire(z))}e.forward=H;function L(P,B,z){return B(z),P(I=>B(I))}e.runAndSubscribe=L;class G{constructor(B,z){this._observable=B,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new qt(I),z&&z.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,z){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(P,B){return new G(P,B).emitter.event}e.fromObservable=Z;function q(P){return(B,z,I)=>{let A=0,$=!1,U={beginUpdate(){A++},endUpdate(){A--,A===0&&(P.reportChanges(),$&&($=!1,B.call(z)))},handlePossibleChange(){},handleChange(){$=!0}};P.addObserver(U),P.reportChanges();let F={dispose(){P.removeObserver(U)}};return I instanceof Kl?I.add(F):Array.isArray(I)&&I.push(F),F}}e.fromObservableLight=q})(Hn||(Hn={}));var dx=class hx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${hx._idPool++}`,hx.all.add(this)}start(t){this._stopWatch=new hW,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}}};dx.all=new Set,dx._idPool=0;var fW=dx,mW=-1,FA=class qA{constructor(t,r,i=(qA._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 n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+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 vW(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,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};FA._idPool=1;var pW=FA,gW=class WA{constructor(t){this.value=t}static create(){let t=new Error;return new WA(t.stack??"")}print(){console.warn(this.value.split(`
599
+ `).slice(2).join(`
600
+ `))}},vW=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},_W=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},xW=0,Vv=class{constructor(e){this.value=e,this.id=xW++}},yW=2,bW,qt=class{constructor(t){var r,i,n,o;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new pW((t==null?void 0:t.onListenerError)??qv,((i=this._options)==null?void 0:i.leakWarningThreshold)??mW):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new fW(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,r,i,n;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),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var d,m,f,v,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new _W(`${y}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((d=this._options)==null?void 0:d.onListenerError)||qv)(w),Bs.None}if(this._disposed)return Bs.None;r&&(t=t.bind(r));let n=new Vv(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=gW.create(),o=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof Vv?(this._deliveryQueue??(this._deliveryQueue=new wW),this._listeners=[this._listeners,n]):this._listeners.push(n):((f=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||f.call(m,this),this._listeners=n,(p=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||p.call(v,this)),this._size++;let u=oi(()=>{o==null||o(),this._removeListener(n)});return i instanceof Kl?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 n=this._deliveryQueue.current===this;if(this._size*yW<=r.length){let f=0;for(let v=0;v<r.length;v++)r[v]?r[f++]=r[v]:n&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=f}}_deliver(t,r){var n;if(!t)return;let i=((n=this._options)==null?void 0:n.onListenerError)||qv;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,n,o;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof Vv)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}},wW=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}},N2={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}},fu=2,mu,ja=class Fl{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new R2,this._cacheMapCombined=new R2,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new ql,this._textureSize=512,this._onAddTextureAtlasCanvas=new qt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new qt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=VA(t,this._config.deviceCellWidth*4+fu*2,this._config.deviceCellHeight+fu*2),this._tmpCtx=yr(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 uW;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(Fl.maxAtlasPages&&this._pages.length>=Math.max(4,Fl.maxAtlasPages)){let r=this._pages.filter(f=>f.canvas.width*2<=(Fl.maxTextureSize||4096)).sort((f,v)=>v.canvas.width!==f.canvas.width?v.canvas.width-f.canvas.width:v.percentageUsed-f.percentageUsed),i=-1,n=0;for(let f=0;f<r.length;f++)if(r[f].canvas.width!==n)i=f,n=r[f].canvas.width;else if(f-i===3)break;let o=r.slice(i,i+4),u=o.map(f=>f.glyphs[0].texturePage).sort((f,v)=>f>v?1:-1),d=this.pages.length-o.length,m=this._mergePages(o,d);m.version++;for(let f=u.length-1;f>=0;f--)this._deletePage(u[f]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new Gv(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,n=new Gv(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;n.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 f=this._activePages.indexOf(u);f!==-1&&this._activePages.splice(f,1)}return n}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let n of i.glyphs)n.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,n,o,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,n,o,u)}getRasterizedGlyph(t,r,i,n,o,u){return this._getFromCacheMap(this._cacheMap,t,r,i,n,o,u)}_getFromCacheMap(t,r,i,n,o,u,d){return mu=t.get(r,i,n,o),mu||(mu=this._drawToCache(r,i,n,o,u,d),t.set(r,i,n,o,mu)),mu}_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,n){if(this._config.allowTransparency)return os;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(r);break;case 50331648:let u=ql.toColorRGB(r);o=fi.toColor(u[0],u[1],u[2]);break;case 0:default:i?o=ju.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=ju.opaque(o)),o}_getForegroundColor(t,r,i,n,o,u,d,m,f,v){let p=this._getMinimumContrastColor(t,r,i,n,o,u,d,f,m,v);if(p)return p;let y;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&u<8&&(u+=8),y=this._getColorFromAnsiIndex(u);break;case 50331648:let b=ql.toColorRGB(u);y=fi.toColor(b[0],b[1],b[2]);break;case 0:default:d?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=ju.opaque(y)),m&&(y=ju.multiplyOpacity(y,Jq)),y}_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,n){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&n&&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,n,o,u,d,m,f,v){if(this._config.minimumContrastRatio===1||v)return;let p=this._getContrastCache(f),y=p.getColor(t,n);if(y!==void 0)return y||void 0;let b=this._resolveBackgroundRgba(r,i,d),w=this._resolveForegroundRgba(o,u,d,m),C=ko.ensureContrastRatio(b,w,this._config.minimumContrastRatio/(f?2:1));if(!C){p.setColor(t,n,null);return}let E=fi.toColor(C>>24&255,C>>16&255,C>>8&255);return p.setColor(t,n,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,n,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)+fu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let f=Math.min(this._config.deviceCellHeight+fu*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=n,!!this._workAttributeData.isInvisible())return N2;let v=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),b=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),k=this._workAttributeData.getFgColorMode(),j=this._workAttributeData.getBgColor(),N=this._workAttributeData.getBgColorMode();if(p){let W=S;S=j,j=W;let T=k;k=N,N=T}let M=this._getBackgroundColor(N,j,p,y);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 D=v?this._config.fontWeightBold:this._config.fontWeight,H=b?"italic":"";this._tmpCtx.font=`${H} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=OA;let L=d.length===1&&py(d.charCodeAt(0)),G=d.length===1&&Wq(d.charCodeAt(0)),Z=this._getForegroundColor(r,N,j,i,k,S,p,y,v,LA(d.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;let q=G?0:fu*2,P=!1;this._config.customGlyphs!==!1&&(P=iW(this._tmpCtx,d,q,q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!L,z;if(typeof t=="number"?z=this._unicodeService.wcwidth(t):z=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=W%2===1?.5:0;if(this._tmpCtx.lineWidth=W,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${ql.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let Y=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Y<8&&(Y+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Y).css}this._tmpCtx.beginPath();let V=q,K=Math.ceil(q+this._config.deviceCharHeight)-T-(o?W*2:0),J=K+W,oe=K+W*2,ce=this._workAttributeData.getUnderlineVariantOffset();for(let Y=0;Y<z;Y++){this._tmpCtx.save();let ne=V+Y*this._config.deviceCellWidth,de=V+(Y+1)*this._config.deviceCellWidth,Ae=ne+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ne,K),this._tmpCtx.lineTo(de,K),this._tmpCtx.moveTo(ne,oe),this._tmpCtx.lineTo(de,oe);break;case 3:let ke=W<=1?oe:Math.ceil(q+this._config.deviceCharHeight-W/2)-T,Ee=W<=1?K:Math.ceil(q+this._config.deviceCharHeight+W/2)-T,re=new Path2D;re.rect(ne,K,this._config.deviceCellWidth,oe-K),this._tmpCtx.clip(re),this._tmpCtx.moveTo(ne-this._config.deviceCellWidth/2,J),this._tmpCtx.bezierCurveTo(ne-this._config.deviceCellWidth/2,Ee,ne,Ee,ne,J),this._tmpCtx.bezierCurveTo(ne,ke,Ae,ke,Ae,J),this._tmpCtx.bezierCurveTo(Ae,Ee,de,Ee,de,J),this._tmpCtx.bezierCurveTo(de,ke,de+this._config.deviceCellWidth/2,ke,de+this._config.deviceCellWidth/2,J);break;case 4:let te=ce===0?0:ce>=W?W*2-ce:W-ce;ce>=W||te===0?(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(ne+te,K),this._tmpCtx.lineTo(de,K)):(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(ne,K),this._tmpCtx.lineTo(ne+te,K),this._tmpCtx.moveTo(ne+te+W,K),this._tmpCtx.lineTo(de,K)),ce=Zq(de-ne,W,ce);break;case 5:let Ce=.6,me=.3,je=de-ne,We=Math.floor(Ce*je),Te=Math.floor(me*je),ze=je-We-Te;this._tmpCtx.setLineDash([We,Te,ze]),this._tmpCtx.moveTo(ne,K),this._tmpCtx.lineTo(de,K);break;case 1:default:this._tmpCtx.moveTo(ne,K),this._tmpCtx.lineTo(de,K);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!P&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Y=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Y&&Y.actualBoundingBoxDescent>0){this._tmpCtx.save();let ne=new Path2D;ne.rect(V,K-Math.ceil(W/2),this._config.deviceCellWidth*z,oe-K+Math.ceil(W/2)),this._tmpCtx.clip(ne),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 W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),T=W%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+T),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*z,q+T),this._tmpCtx.stroke()}if(P||this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let W=Yv(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,Z,B);if(W)for(let T=1;T<=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-T),W=Yv(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,Z,B),!!W);T++);}if(C){let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),T=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*z,q+Math.floor(this._config.deviceCharHeight/2)-T),this._tmpCtx.stroke()}this._tmpCtx.restore();let I=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),A;if(this._config.allowTransparency?A=SW(I):A=Yv(I,M,Z,B),A)return N2;let $=this._findGlyphBoundingBox(I,this._workBoundingBox,m,G,P,q),U,F;for(;;){if(this._activePages.length===0){let W=this._createNewPage();U=W,F=W.currentRow,F.height=$.size.y;break}U=this._activePages[this._activePages.length-1],F=U.currentRow;for(let W of this._activePages)$.size.y<=W.currentRow.height&&(U=W,F=W.currentRow);for(let W=this._activePages.length-1;W>=0;W--)for(let T of this._activePages[W].fixedRows)T.height<=F.height&&$.size.y<=T.height&&(U=this._activePages[W],F=T);if($.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Gv(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),U=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+$.size.x>=U.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+$.size.y>=U.canvas.height||F.height>$.size.y+2){let W=!1;if(U.currentRow.y+U.currentRow.height+$.size.y>=U.canvas.height){let T;for(let V of this._activePages)if(V.currentRow.y+V.currentRow.height+$.size.y<V.canvas.height){T=V;break}if(T)U=T;else if(Fl.maxAtlasPages&&this._pages.length>=Fl.maxAtlasPages&&F.y+$.size.y<=U.canvas.height&&F.height>=$.size.y&&F.x+$.size.x<=U.canvas.width)W=!0;else{let V=this._createNewPage();U=V,F=V.currentRow,F.height=$.size.y,W=!0}}W||(U.currentRow.height>0&&U.fixedRows.push(U.currentRow),F={x:0,y:U.currentRow.y+U.currentRow.height,height:$.size.y},U.fixedRows.push(F),U.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+$.size.x<=U.canvas.width)break;F===U.currentRow?(F.x=0,F.y+=F.height,F.height=0):U.fixedRows.splice(U.fixedRows.indexOf(F),1)}return $.texturePage=this._pages.indexOf(U),$.texturePosition.x=F.x,$.texturePosition.y=F.y,$.texturePositionClipSpace.x=F.x/U.canvas.width,$.texturePositionClipSpace.y=F.y/U.canvas.height,$.sizeClipSpace.x/=U.canvas.width,$.sizeClipSpace.y/=U.canvas.height,F.height=Math.max(F.height,$.size.y),F.x+=$.size.x,U.ctx.putImageData(I,$.texturePosition.x-this._workBoundingBox.left,$.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,$.size.x,$.size.y),U.addGlyph($),U.version++,$}_findGlyphBoundingBox(t,r,i,n,o,u){r.top=0;let d=n?this._config.deviceCellHeight:this._tmpCanvas.height,m=n?this._config.deviceCellWidth:i,f=!1;for(let v=0;v<d;v++){for(let p=0;p<m;p++){let y=v*this._tmpCanvas.width*4+p*4+3;if(t.data[y]!==0){r.top=v,f=!0;break}}if(f)break}r.left=0,f=!1;for(let v=0;v<u+m;v++){for(let p=0;p<d;p++){let y=p*this._tmpCanvas.width*4+v*4+3;if(t.data[y]!==0){r.left=v,f=!0;break}}if(f)break}r.right=m,f=!1;for(let v=u+m-1;v>=u;v--){for(let p=0;p<d;p++){let y=p*this._tmpCanvas.width*4+v*4+3;if(t.data[y]!==0){r.right=v,f=!0;break}}if(f)break}r.bottom=d,f=!1;for(let v=d-1;v>=0;v--){for(let p=0;p<m;p++){let y=v*this._tmpCanvas.width*4+p*4+3;if(t.data[y]!==0){r.bottom=v,f=!0;break}}if(f)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+(n||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(n||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Gv=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 n of i)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=VA(t,r,r),this.ctx=yr(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 Yv(e,t,r,i){let n=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,f=r.rgba>>>8&255,v=Math.floor((Math.abs(n-d)+Math.abs(o-m)+Math.abs(u-f))/12),p=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===n&&e.data[y+1]===o&&e.data[y+2]===u||i&&Math.abs(e.data[y]-n)+Math.abs(e.data[y+1]-o)+Math.abs(e.data[y+2]-u)<v?e.data[y+3]=0:p=!1;return p}function SW(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function VA(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function CW(e,t,r,i,n,o,u,d){let m={foreground:o.foreground,background:o.background,cursor:os,cursorAccent:os,selectionForeground:os,selectionBackgroundTransparent:os,selectionBackgroundOpaque:os,selectionInactiveBackgroundTransparent:os,selectionInactiveBackgroundOpaque:os,overviewRulerBorder:os,scrollbarSliderBackground:os,scrollbarSliderHoverBackground:os,scrollbarSliderActiveBackground:os,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:n.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:d,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontWeightBold:n.fontWeightBold,allowTransparency:n.allowTransparency,drawBoldTextInBrightColors:n.drawBoldTextInBrightColors,minimumContrastRatio:n.minimumContrastRatio,colors:m}}function j2(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 EW(e){return(e&50331648)===16777216||(e&50331648)===33554432}var hs=[];function GA(e,t,r,i,n,o,u,d,m){let f=CW(i,n,o,u,t,r,d,m);for(let y=0;y<hs.length;y++){let b=hs[y],w=b.ownedBy.indexOf(e);if(w>=0){if(j2(b.config,f))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),hs.splice(y,1)):b.ownedBy.splice(w,1);break}}for(let y=0;y<hs.length;y++){let b=hs[y];if(j2(b.config,f))return b.ownedBy.push(e),b.atlas}let v=e._core,p={atlas:new ja(document,f,v.unicodeService),config:f,ownedBy:[e]};return hs.push(p),p.atlas}function A2(e){for(let t=0;t<hs.length;t++){let r=hs[t].ownedBy.indexOf(e);if(r!==-1){hs[t].ownedBy.length===1?(hs[t].atlas.dispose(),hs.splice(t,1)):hs[t].ownedBy.splice(r,1);break}}}var Jh=600,kW=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=Jh){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Jh-(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=Jh-(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})},Jh)},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 T2(e,t,r){let i=new t.ResizeObserver(n=>{let o=n.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 oi(()=>i==null?void 0:i.disconnect())}function RW(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var M2=class YA extends ql{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $A,this.combinedData=""}static fromCharData(t){let r=new YA;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?RW(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 n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-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()]}},KA=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function XA(e,t,r){let i=yr(e.createProgram());if(e.attachShader(i,yr(D2(e,e.VERTEX_SHADER,t))),e.attachShader(i,yr(D2(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 D2(e,t,r){let i=yr(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 NW(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let n=0;n<e.length;n++)i[n]=e[n];return i}var jW=class{constructor(t){this.texture=t,this.version=-1}},AW=`#version 300 es
601
+ layout (location = 0) in vec2 a_unitquad;
602
+ layout (location = 1) in vec2 a_cellpos;
603
+ layout (location = 2) in vec2 a_offset;
604
+ layout (location = 3) in vec2 a_size;
605
+ layout (location = 4) in float a_texpage;
606
+ layout (location = 5) in vec2 a_texcoord;
607
+ layout (location = 6) in vec2 a_texsize;
608
+
609
+ uniform mat4 u_projection;
610
+ uniform vec2 u_resolution;
611
+
612
+ out vec2 v_texcoord;
613
+ flat out int v_texpage;
614
+
615
+ void main() {
616
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
617
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
618
+ v_texpage = int(a_texpage);
619
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
620
+ }`;function TW(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
621
+ precision lowp float;
622
+
623
+ in vec2 v_texcoord;
624
+ flat in int v_texpage;
625
+
626
+ uniform sampler2D u_texture[${e}];
627
+
628
+ out vec4 outColor;
629
+
630
+ void main() {
631
+ if (v_texpage == 0) {
632
+ outColor = texture(u_texture[0], v_texcoord);
633
+ } ${t}
634
+ }`}var Aa=11,Ol=Aa*Float32Array.BYTES_PER_ELEMENT,MW=2,Jt=0,Ht,Kv=0,pu=0,DW=class extends Bs{constructor(t,r,i,n){super(),this._terminal=t,this._gl=r,this._dimensions=i,this._optionsService=n,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;ja.maxAtlasPages===void 0&&(ja.maxAtlasPages=Math.min(32,yr(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ja.maxTextureSize=yr(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=yr(XA(o,AW,TW(ja.maxAtlasPages))),this._register(oi(()=>o.deleteProgram(this._program))),this._projectionLocation=yr(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=yr(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=yr(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(oi(()=>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]),f=o.createBuffer();this._register(oi(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,m,o.STATIC_DRAW),this._attributesBuffer=yr(o.createBuffer()),this._register(oi(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Ol,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Ol,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Ol,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Ol,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Ol,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Ol,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let v=new Int32Array(ja.maxAtlasPages);for(let p=0;p<ja.maxAtlasPages;p++)v[p]=p;o.uniform1iv(this._textureLocation,v),o.uniformMatrix4fv(this._projectionLocation,!1,KA),this._atlasTextures=[];for(let p=0;p<ja.maxAtlasPages;p++){let y=new jW(yr(o.createTexture()));this._register(oi(()=>o.deleteTexture(y.texture))),o.activeTexture(o.TEXTURE0+p),o.bindTexture(o.TEXTURE_2D,y.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]=y}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,n,o,u,d,m,f){this._updateCell(this._vertices.attributes,t,r,i,n,o,u,d,m,f)}_updateCell(t,r,i,n,o,u,d,m,f,v){if(Jt=(i*this._terminal.cols+r)*Aa,n===0||n===void 0){t.fill(0,Jt,Jt+Aa-1-MW);return}this._atlas&&(m&&m.length>1?Ht=this._atlas.getRasterizedGlyphCombinedChar(m,o,u,d,!1,this._terminal.element):Ht=this._atlas.getRasterizedGlyph(n,o,u,d,!1,this._terminal.element),Kv=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==v&&Ht.offset.x>Kv?(pu=Ht.offset.x-Kv,t[Jt]=-(Ht.offset.x-pu)+this._dimensions.device.char.left,t[Jt+1]=-Ht.offset.y+this._dimensions.device.char.top,t[Jt+2]=(Ht.size.x-pu)/this._dimensions.device.canvas.width,t[Jt+3]=Ht.size.y/this._dimensions.device.canvas.height,t[Jt+4]=Ht.texturePage,t[Jt+5]=Ht.texturePositionClipSpace.x+pu/this._atlas.pages[Ht.texturePage].canvas.width,t[Jt+6]=Ht.texturePositionClipSpace.y,t[Jt+7]=Ht.sizeClipSpace.x-pu/this._atlas.pages[Ht.texturePage].canvas.width,t[Jt+8]=Ht.sizeClipSpace.y):(t[Jt]=-Ht.offset.x+this._dimensions.device.char.left,t[Jt+1]=-Ht.offset.y+this._dimensions.device.char.top,t[Jt+2]=Ht.size.x/this._dimensions.device.canvas.width,t[Jt+3]=Ht.size.y/this._dimensions.device.canvas.height,t[Jt+4]=Ht.texturePage,t[Jt+5]=Ht.texturePositionClipSpace.x,t[Jt+6]=Ht.texturePositionClipSpace.y,t[Jt+7]=Ht.sizeClipSpace.x,t[Jt+8]=Ht.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Kq(n,f,Ht.size.x,this._dimensions.device.cell.width)&&(t[Jt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*Aa;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 n=0;n<t.rows;n++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=n/t.rows,i+=Aa}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],n=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*Aa,d=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*Aa);i.set(d,n),n+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,i.subarray(0,n),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,n/Aa)}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}},LW=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,n=!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),f=Math.min(d,t.rows-1);if(m>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=u,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=f,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 OW(){return new LW}var Xf=4,bf=1,wf=2,Xv=3,BW=2147483648,PW=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=OW()}resize(t,r){let i=t*r*Xf;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)}},zW=`#version 300 es
635
+ layout (location = 0) in vec2 a_position;
636
+ layout (location = 1) in vec2 a_size;
637
+ layout (location = 2) in vec4 a_color;
638
+ layout (location = 3) in vec2 a_unitquad;
639
+
640
+ uniform mat4 u_projection;
641
+
642
+ out vec4 v_color;
643
+
644
+ void main() {
645
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
646
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
647
+ v_color = a_color;
648
+ }`,IW=`#version 300 es
649
+ precision lowp float;
650
+
651
+ in vec4 v_color;
652
+
653
+ out vec4 outColor;
654
+
655
+ void main() {
656
+ outColor = v_color;
657
+ }`,$n=8,Zv=$n*Float32Array.BYTES_PER_ELEMENT,$W=20*$n,L2=class{constructor(){this.attributes=new Float32Array($W),this.count=0}},zn=0,O2=0,B2=0,P2=0,z2=0,I2=0,$2=0,UW=class extends Bs{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new L2,this._verticesCursor=new L2;let n=this._gl;this._program=yr(XA(n,zW,IW)),this._register(oi(()=>n.deleteProgram(this._program))),this._projectionLocation=yr(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=n.createBuffer();this._register(oi(()=>n.deleteBuffer(u))),n.bindBuffer(n.ARRAY_BUFFER,u),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=n.createBuffer();this._register(oi(()=>n.deleteBuffer(m))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m),n.bufferData(n.ELEMENT_ARRAY_BUFFER,d,n.STATIC_DRAW),this._attributesBuffer=yr(n.createBuffer()),this._register(oi(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,Zv,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Zv,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,Zv,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),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,KA),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,n,o,u,d,m,f,v,p,y,b,w;for(n=0;n<t.rows;n++){for(u=-1,d=0,m=0,f=!1,o=0;o<t.cols;o++)v=(n*t.cols+o)*Xf,p=e.cells[v+bf],y=e.cells[v+wf],b=!!(y&67108864),(p!==d||y!==m&&(f||b))&&((d!==0||f&&m!==0)&&(w=i++*$n,this._updateRectangle(r,w,m,d,u,o,n)),u=o,d=p,m=y,f=b);(d!==0||f&&m!==0)&&(w=i++*$n,this._updateRectangle(r,w,m,d,u,t.cols,n))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,n=0;(r.style==="bar"||r.style==="outline")&&(i=n++*$n,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=n++*$n,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=n++*$n,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=n++*$n,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=n}_updateRectangle(e,t,r,i,n,o,u){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:zn=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:zn=(r&16777215)<<8;break;case 0:default:zn=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:zn=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:zn=(i&16777215)<<8;break;case 0:default:zn=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=NW(e.attributes,this._terminal.rows*this._terminal.cols*$n)),O2=n*this._dimensions.device.cell.width,B2=u*this._dimensions.device.cell.height,P2=(zn>>24&255)/255,z2=(zn>>16&255)/255,I2=(zn>>8&255)/255,$2=1,this._addRectangle(e.attributes,t,O2,B2,(o-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,P2,z2,I2,$2)}_addRectangle(e,t,r,i,n,o,u,d,m,f){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/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]=f}_addRectangleFloat(e,t,r,i,n,o,u){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=n/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])}},HW=class extends Bs{constructor(t,r,i,n,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=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(oi(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=yr(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,n=!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=GA(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,n){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(t,r,i,n){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=OA,this._clipCell(i,n,r.getWidth()),this._ctx.fillText(r.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,n*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 n=r?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${n} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},FW=class extends HW{constructor(t,r,i,n,o,u,d){super(i,t,"link",r,!0,o,u,d),this._register(n.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(n.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&&EW(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()}},wo=typeof window=="object"?window:globalThis,fx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new qt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new qt,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}};fx.INSTANCE=new fx;var ZA=fx;function qW(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}ZA.INSTANCE.onDidChangeZoomLevel;ZA.INSTANCE.onDidChangeFullscreen;var hc=typeof navigator=="object"?navigator.userAgent:"";hc.indexOf("Firefox")>=0;hc.indexOf("AppleWebKit")>=0;var WW=hc.indexOf("Chrome")>=0;!WW&&hc.indexOf("Safari")>=0;hc.indexOf("Electron/")>=0;hc.indexOf("Android")>=0;var Qv=!1;if(typeof wo.matchMedia=="function"){let e=wo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=wo.matchMedia("(display-mode: fullscreen)");Qv=e.matches,qW(wo,e,({matches:r})=>{Qv&&t.matches||(Qv=r)})}var Wl="en",Jv=!1,QA=!1,ef,Sf=Wl,U2=Wl,VW,Ns,Ro=globalThis,Qr,nE;typeof Ro.vscode<"u"&&typeof Ro.vscode.process<"u"?Qr=Ro.vscode.process:typeof process<"u"&&typeof((nE=process==null?void 0:process.versions)==null?void 0:nE.node)=="string"&&(Qr=process);var aE,GW=typeof((aE=Qr==null?void 0:Qr.versions)==null?void 0:aE.electron)=="string",YW=GW&&(Qr==null?void 0:Qr.type)==="renderer",oE;if(typeof Qr=="object"){Qr.platform,Qr.platform,Jv=Qr.platform==="linux",Jv&&Qr.env.SNAP&&Qr.env.SNAP_REVISION,Qr.env.CI||Qr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ef=Wl,Sf=Wl;let e=Qr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ef=t.userLocale,U2=t.osLocale,Sf=t.resolvedLanguage||Wl,VW=(oE=t.languagePack)==null?void 0:oE.translationsConfigFile}catch{}QA=!0}else typeof navigator=="object"&&!YW?(Ns=navigator.userAgent,Ns.indexOf("Windows")>=0,Ns.indexOf("Macintosh")>=0,(Ns.indexOf("Macintosh")>=0||Ns.indexOf("iPad")>=0||Ns.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Jv=Ns.indexOf("Linux")>=0,(Ns==null?void 0:Ns.indexOf("Mobi"))>=0,Sf=globalThis._VSCODE_NLS_LANGUAGE||Wl,ef=navigator.language.toLowerCase(),U2=ef):console.error("Unable to resolve platform.");var H2=QA,un=Ns,Ca=Sf,KW;(e=>{function t(){return Ca}e.value=t;function r(){return Ca.length===2?Ca==="en":Ca.length>=3?Ca[0]==="e"&&Ca[1]==="n"&&Ca[2]==="-":!1}e.isDefaultVariant=r;function i(){return Ca==="en"}e.isDefault=i})(KW||(KW={}));var XW=typeof Ro.postMessage=="function"&&!Ro.importScripts;(()=>{if(XW){let e=[];Ro.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;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}),Ro.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var ZW=!!(un&&un.indexOf("Chrome")>=0);un&&un.indexOf("Firefox")>=0;!ZW&&un&&un.indexOf("Safari")>=0;un&&un.indexOf("Edg/")>=0;un&&un.indexOf("Android")>=0;var Bl=typeof navigator=="object"?navigator:{};H2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Bl&&Bl.clipboard&&Bl.clipboard.writeText,H2||Bl&&Bl.clipboard&&Bl.clipboard.readText;var gy=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}},e_=new gy,F2=new gy,q2=new gy;new Array(230);var QW;(e=>{function t(d){return e_.keyCodeToStr(d)}e.toString=t;function r(d){return e_.strToKeyCode(d)}e.fromString=r;function i(d){return F2.keyCodeToStr(d)}e.toUserSettingsUS=i;function n(d){return q2.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function o(d){return F2.strToKeyCode(d)||q2.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 e_.keyCodeToStr(d)}e.toElectronAccelerator=u})(QW||(QW={}));var JA=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),JW;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof eV?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Hn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:JA})})(JW||(JW={}));var eV=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?JA:(this._emitter||(this._emitter=new qt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},tV;(e=>{async function t(i){let n,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return o}e.settled=t;function r(i){return new Promise(async(n,o)=>{try{await i(n,o)}catch(u){o(u)}})}e.withAsyncBody=r})(tV||(tV={}));var W2=class ls{static fromArray(t){return new ls(r=>{r.emitMany(t)})}static fromPromise(t){return new ls(async r=>{r.emitMany(await t)})}static fromPromises(t){return new ls(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new ls(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new qt,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}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 Hn.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 ls(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return ls.map(this,t)}static filter(t,r){return new ls(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return ls.filter(this,t)}static coalesce(t){return ls.filter(t,r=>!!r)}coalesce(){return ls.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return ls.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())}};W2.EMPTY=W2.fromArray([]);var{getWindow:rV}=(function(){let e=new Map,t={window:wo,disposables:new Kl};e.set(wo.vscodeWindowId,t);let r=new qt,i=new qt,n=new qt;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Bs.None;let d=new Kl,m={window:u,disposables:d.add(new Kl)};return e.set(u.vscodeWindowId,m),d.add(oi(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(mx(u,sV.BEFORE_UNLOAD,()=>{n.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 f;let d=u;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:wo},getDocument(u){return rV(u).document}}})(),iV=class{constructor(t,r,i,n){this._node=t,this._type=r,this._handler=i,this._options=n||!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 mx(e,t,r,i){return new iV(e,t,r,i)}var sV={BEFORE_UNLOAD:"beforeunload"},nV=class extends Bs{constructor(t,r,i,n,o,u,d,m,f){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=i,this._coreBrowserService=n,this._coreService=o,this._decorationService=u,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new hu,this._charAtlasDisposable=this._register(new hu),this._observerDisposable=this._register(new hu),this._model=new PW,this._workCell=new M2,this._workCell2=new M2,this._rectangleRenderer=this._register(new hu),this._glyphRenderer=this._register(new hu),this._onChangeTextureAtlas=this._register(new qt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new qt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new qt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new qt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new qt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:f};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 Qq(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new FW(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=Xq(),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(mx(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(mx(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,A2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=T2(this._canvas,this._coreBrowserService.window,(p,y)=>this._setCanvasDevicePixelDimensions(p,y)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=T2(this._canvas,p,(y,b)=>this._setCanvasDevicePixelDimensions(y,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(oi(()=>{var p;for(let y of this._renderLayers)y.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),A2(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,n,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),(n=this._rectangleRenderer.value)==null||n.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 n of this._renderLayers)n.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 UW(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new DW(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=GA(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=AA(Hn.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Hn.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 n of this._renderLayers)n.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 kW(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let i=this._core,n=this._workCell,o,u,d,m,f,v,p=0,y=!0,b,w,C,E,S,k,j,N,M;t=V2(t,i.rows-1,0),r=V2(r,i.rows-1,0);let D=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,L=H-i.buffer.ydisp,G=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Z=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let P=!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=H===d,p=0,f=this._characterJoinerService.getJoinedCharacters(d),N=0;N<i.cols;N++){if(o=this._cellColorResolver.result.bg,m.loadCell(N,n),N===0&&(o=this._cellColorResolver.result.bg),v=!1,y=N>=p,b=N,f.length>0&&N===f[0][0]&&y){w=f.shift();let B=this._model.selection.isCellSelected(this._terminal,w[0],d);for(j=w[0]+1;j<w[1];j++)y&&(y=B===this._model.selection.isCellSelected(this._terminal,j,d));y&&(y=!C||G<w[0]||G>=w[1]),y?(v=!0,n=new aV(n,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),b=w[1]-1):p=w[1]}if(E=n.getChars(),S=n.getCode(),j=(u*i.cols+N)*Xf,this._cellColorResolver.resolve(n,N,d,this.dimensions.device.cell.width),q&&d===H&&(N===G&&(this._model.cursor={x:G,y:L,width:n.getWidth(),style:this._coreBrowserService.isFocused?D:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Z=G+n.getWidth()-1),N>=G&&N<=Z&&(this._coreBrowserService.isFocused&&D==="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]=N+1),!(this._model.cells[j]===S&&this._model.cells[j+bf]===this._cellColorResolver.result.bg&&this._model.cells[j+wf]===this._cellColorResolver.result.fg&&this._model.cells[j+Xv]===this._cellColorResolver.result.ext)&&(P=!0,E.length>1&&(S|=BW),this._model.cells[j]=S,this._model.cells[j+bf]=this._cellColorResolver.result.bg,this._model.cells[j+wf]=this._cellColorResolver.result.fg,this._model.cells[j+Xv]=this._cellColorResolver.result.ext,k=n.getWidth(),this._glyphRenderer.value.updateCell(N,u,S,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,k,o),v)){for(n=this._workCell,N++;N<=b;N++)M=(u*i.cols+N)*Xf,this._glyphRenderer.value.updateCell(N,u,0,0,0,0,Fq,0,0),this._model.cells[M]=0,this._model.cells[M+bf]=this._cellColorResolver.result.bg,this._model.cells[M+wf]=this._cellColorResolver.result.fg,this._model.cells[M+Xv]=this._cellColorResolver.result.ext;N--}}P&&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})}},aV=class extends ql{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 V2(e,t,r=0){return Math.max(Math.min(e,t),r)}var G2="di$target",Y2="di$dependencies",t_=new Map;function mn(e){if(t_.has(e))return t_.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");oV(t,r,n)};return t._id=e,t_.set(e,t),t}function oV(e,t,r){t[G2]===t?t[Y2].push({id:e,index:r}):(t[Y2]=[{id:e,index:r}],t[G2]=t)}mn("BufferService");mn("CoreMouseService");mn("CoreService");mn("CharsetService");mn("InstantiationService");mn("LogService");var lV=mn("OptionsService");mn("OscLinkService");mn("UnicodeService");mn("DecorationService");var cV={trace:0,debug:1,info:2,warn:3,error:4,off:5},uV="xterm.js: ",K2=class extends Bs{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=cV[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?"":uV)+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)}};K2=Tq([Mq(0,lV)],K2);var dV=class extends Bs{constructor(t){if(DA&&Hq()<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 qt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new qt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new qt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new qt),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,n=r.optionsService,o=r,u=o._renderService,d=o._characterJoinerService,m=o._charSizeService,f=o._coreBrowserService,v=o._decorationService;o._logService;let p=o._themeService;this._renderer=this._register(new nV(t,d,m,f,i,v,n,p,this._preserveDrawingBuffer)),this._register(Hn.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Hn.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Hn.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Hn.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(oi(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.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()}};/**
658
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
659
+ * @license MIT
660
+ *
661
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
662
+ * @license MIT
663
+ *
664
+ * Originally forked from (with the author's permission):
665
+ * Fabrice Bellard's javascript vt100 for jslinux:
666
+ * http://bellard.org/jslinux/
667
+ * Copyright (c) 2011 Fabrice Bellard
668
+ */var eT=Object.defineProperty,hV=Object.getOwnPropertyDescriptor,fV=(e,t)=>{for(var r in t)eT(e,r,{get:t[r],enumerable:!0})},sr=(e,t,r,i)=>{for(var n=i>1?void 0:i?hV(t,r):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(i?u(t,r,n):u(n))||n);return i&&n&&eT(t,r,n),n},Ne=(e,t)=>(r,i)=>t(r,i,e),X2="Terminal input",px={get:()=>X2,set:e=>X2=e},Z2="Too much output to announce, navigate to rows manually to read",gx={get:()=>Z2,set:e=>Z2=e};function mV(e){return e.replace(/\r?\n/g,"\r")}function pV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function gV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function vV(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let n=e.clipboardData.getData("text/plain");tT(n,t,r,i)}}function tT(e,t,r,i){e=mV(e),e=pV(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function rT(e,t,r){let i=r.getBoundingClientRect(),n=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function Q2(e,t,r,i,n){rT(e,t,r),n&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Ma(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qm(e,t=0,r=e.length){let i="";for(let n=t;n<r;++n){let o=e[n];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var _V=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,n=0;if(this._interim){let o=e.charCodeAt(n++);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=n;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}},xV=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,n,o,u,d,m=0,f=0;if(this.interim[0]){let y=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)b<<=6,b|=C;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=E-w;for(;f<S;){if(f>=r)return 0;if(C=e[f++],(C&192)!==128){f--,y=!0;break}else this.interim[w++]=C,b<<=6,b|=C&63}y||(E===2?b<128?f--:t[i++]=b:E===3?b<2048||b>=55296&&b<=57343||b===65279||(t[i++]=b):b<65536||b>1114111||(t[i++]=b)),this.interim.fill(0)}let v=r-4,p=f;for(;p<r;){for(;p<v&&!((n=e[p])&128)&&!((o=e[p+1])&128)&&!((u=e[p+2])&128)&&!((d=e[p+3])&128);)t[i++]=n,t[i++]=o,t[i++]=u,t[i++]=d,p+=4;if(n=e[p++],n<128)t[i++]=n;else if((n&224)===192){if(p>=r)return this.interim[0]=n,i;if(o=e[p++],(o&192)!==128){p--;continue}if(m=(n&31)<<6|o&63,m<128){p--;continue}t[i++]=m}else if((n&240)===224){if(p>=r)return this.interim[0]=n,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(m=(n&15)<<12|(o&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[i++]=m}else if((n&248)===240){if(p>=r)return this.interim[0]=n,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=r)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=u,i;if(d=e[p++],(d&192)!==128){p--;continue}if(m=(n&7)<<18|(o&63)<<12|(u&63)<<6|d&63,m<65536||m>1114111)continue;t[i++]=m}}return i}},iT="",Oa=" ",pd=class sT{constructor(){this.fg=0,this.bg=0,this.extended=new Zf}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 sT;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}},Zf=class nT{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 nT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ps=class aT extends pd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zf,this.combinedData=""}static fromCharData(t){let r=new aT;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?Ma(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 n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-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()]}},J2="di$target",vx="di$dependencies",r_=new Map;function yV(e){return e[vx]||[]}function Fr(e){if(r_.has(e))return r_.get(e);let t=function(r,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");bV(t,r,n)};return t._id=e,r_.set(e,t),t}function bV(e,t,r){t[J2]===t?t[vx].push({id:e,index:r}):(t[vx]=[{id:e,index:r}],t[J2]=t)}var gi=Fr("BufferService"),oT=Fr("CoreMouseService"),Go=Fr("CoreService"),wV=Fr("CharsetService"),vy=Fr("InstantiationService"),lT=Fr("LogService"),vi=Fr("OptionsService"),cT=Fr("OscLinkService"),SV=Fr("UnicodeService"),gd=Fr("DecorationService"),_x=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=[],n=this._optionsService.rawOptions.linkHandler,o=new ps,u=r.getTrimmedLength(),d=-1,m=-1,f=!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 f=o.extended.urlId!==d;else m!==-1&&(f=!0);if(f||m!==-1&&p===u-1){let y=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(y){let b={start:{x:m+1,y:e},end:{x:p+(!f&&p===u-1?1:0),y:e}},w=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let C=new URL(y);["http:","https:"].includes(C.protocol)||(w=!0)}catch{w=!0}w||i.push({text:y,range:b,activate:(C,E)=>n?n.activate(C,E,b):CV(C,E),hover:(C,E)=>{var S;return(S=n==null?void 0:n.hover)==null?void 0:S.call(n,C,E,b)},leave:(C,E)=>{var S;return(S=n==null?void 0:n.leave)==null?void 0:S.call(n,C,E,b)}})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(m=p,d=o.extended.urlId):(m=-1,d=-1)}}t(i)}};_x=sr([Ne(0,gi),Ne(1,vi),Ne(2,cT)],_x);function CV(e,t){if(confirm(`Do you want to navigate to ${t}?
669
+
670
+ 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 Wm=Fr("CharSizeService"),Zn=Fr("CoreBrowserService"),_y=Fr("MouseService"),Qn=Fr("RenderService"),EV=Fr("SelectionService"),uT=Fr("CharacterJoinerService"),fc=Fr("ThemeService"),dT=Fr("LinkProviderService"),kV=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?e5.isErrorNoTelemetry(e)?new e5(e.message+`
671
+
672
+ `+e.stack):new Error(e.message+`
673
+
674
+ `+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)}},RV=new kV;function Cf(e){NV(e)||RV.onUnexpectedError(e)}var xx="Canceled";function NV(e){return e instanceof jV?!0:e instanceof Error&&e.name===xx&&e.message===xx}var jV=class extends Error{constructor(){super(xx),this.name=this.message}};function AV(e){return new Error(`Illegal argument: ${e}`)}var e5=class yx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof yx)return t;let r=new yx;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},bx=class hT extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hT.prototype)}};function zi(e,t=0){return e[e.length-(1+t)]}var TV;(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 n(o){return o===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(TV||(TV={}));function MV(e,t){let r=this,i=!1,n;return function(){return i||(i=!0,t||(n=e.apply(r,arguments))),n}}var fT;(e=>{function t(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*n(N){yield N}e.single=n;function o(N){return t(N)?N:n(N)}e.wrap=o;function u(N){return N||r}e.from=u;function*d(N){for(let M=N.length-1;M>=0;M--)yield N[M]}e.reverse=d;function m(N){return!N||N[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(N){return N[Symbol.iterator]().next().value}e.first=f;function v(N,M){let D=0;for(let H of N)if(M(H,D++))return!0;return!1}e.some=v;function p(N,M){for(let D of N)if(M(D))return D}e.find=p;function*y(N,M){for(let D of N)M(D)&&(yield D)}e.filter=y;function*b(N,M){let D=0;for(let H of N)yield M(H,D++)}e.map=b;function*w(N,M){let D=0;for(let H of N)yield*M(H,D++)}e.flatMap=w;function*C(...N){for(let M of N)yield*M}e.concat=C;function E(N,M,D){let H=D;for(let L of N)H=M(H,L);return H}e.reduce=E;function*S(N,M,D=N.length){for(M<0&&(M+=N.length),D<0?D+=N.length:D>N.length&&(D=N.length);M<D;M++)yield N[M]}e.slice=S;function k(N,M=Number.POSITIVE_INFINITY){let D=[];if(M===0)return[D,N];let H=N[Symbol.iterator]();for(let L=0;L<M;L++){let G=H.next();if(G.done)return[D,e.empty()];D.push(G.value)}return[D,{[Symbol.iterator](){return H}}]}e.consume=k;async function j(N){let M=[];for await(let D of N)M.push(D);return Promise.resolve(M)}e.asyncToArray=j})(fT||(fT={}));function Oo(e){if(fT.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 DV(...e){return Vt(()=>Oo(e))}function Vt(e){return{dispose:MV(()=>{e()})}}var mT=class pT{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{Oo(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?pT.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)}};mT.DISABLE_DISPOSED_WARNING=!1;var Pa=mT,rt=class{constructor(){this._store=new Pa,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)}};rt.None=Object.freeze({dispose(){}});var rc=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}},Fn=typeof window=="object"?window:globalThis,wx=class Sx{constructor(t){this.element=t,this.next=Sx.Undefined,this.prev=Sx.Undefined}};wx.Undefined=new wx(void 0);var Yt=wx,t5=class{constructor(){this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Yt.Undefined}clear(){let e=this._first;for(;e!==Yt.Undefined;){let t=e.next;e.prev=Yt.Undefined,e.next=Yt.Undefined,e=t}this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new Yt(e);if(this._first===Yt.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==Yt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Yt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Yt.Undefined&&e.next!==Yt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Yt.Undefined&&e.next===Yt.Undefined?(this._first=Yt.Undefined,this._last=Yt.Undefined):e.next===Yt.Undefined?(this._last=this._last.prev,this._last.next=Yt.Undefined):e.prev===Yt.Undefined&&(this._first=this._first.next,this._first.prev=Yt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Yt.Undefined;)yield e.element,e=e.next}},LV=globalThis.performance&&typeof globalThis.performance.now=="function",OV=class gT{static create(t){return new gT(t)}constructor(t){this._now=LV&&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}},ei;(e=>{e.None=()=>rt.None;function t(P,B){return p(P,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function r(P){return(B,z=null,I)=>{let A=!1,$;return $=P(U=>{if(!A)return $?$.dispose():A=!0,B.call(z,U)},null,I),A&&$.dispose(),$}}e.once=r;function i(P,B,z){return f((I,A=null,$)=>P(U=>I.call(A,B(U)),null,$),z)}e.map=i;function n(P,B,z){return f((I,A=null,$)=>P(U=>{B(U),I.call(A,U)},null,$),z)}e.forEach=n;function o(P,B,z){return f((I,A=null,$)=>P(U=>B(U)&&I.call(A,U),null,$),z)}e.filter=o;function u(P){return P}e.signal=u;function d(...P){return(B,z=null,I)=>{let A=DV(...P.map($=>$(U=>B.call(z,U))));return v(A,I)}}e.any=d;function m(P,B,z,I){let A=z;return i(P,$=>(A=B(A,$),A),I)}e.reduce=m;function f(P,B){let z,I={onWillAddFirstListener(){z=P(A.fire,A)},onDidRemoveLastListener(){z==null||z.dispose()}},A=new be(I);return B==null||B.add(A),A.event}function v(P,B){return B instanceof Array?B.push(P):B&&B.add(P),P}function p(P,B,z=100,I=!1,A=!1,$,U){let F,W,T,V=0,K,J={leakWarningThreshold:$,onWillAddFirstListener(){F=P(ce=>{V++,W=B(W,ce),I&&!T&&(oe.fire(W),W=void 0),K=()=>{let Y=W;W=void 0,T=void 0,(!I||V>1)&&oe.fire(Y),V=0},typeof z=="number"?(clearTimeout(T),T=setTimeout(K,z)):T===void 0&&(T=0,queueMicrotask(K))})},onWillRemoveListener(){A&&V>0&&(K==null||K())},onDidRemoveLastListener(){K=void 0,F.dispose()}},oe=new be(J);return U==null||U.add(oe),oe.event}e.debounce=p;function y(P,B=0,z){return e.debounce(P,(I,A)=>I?(I.push(A),I):[A],B,void 0,!0,void 0,z)}e.accumulate=y;function b(P,B=(I,A)=>I===A,z){let I=!0,A;return o(P,$=>{let U=I||!B($,A);return I=!1,A=$,U},z)}e.latch=b;function w(P,B,z){return[e.filter(P,B,z),e.filter(P,I=>!B(I),z)]}e.split=w;function C(P,B=!1,z=[],I){let A=z.slice(),$=P(W=>{A?A.push(W):F.fire(W)});I&&I.add($);let U=()=>{A==null||A.forEach(W=>F.fire(W)),A=null},F=new be({onWillAddFirstListener(){$||($=P(W=>F.fire(W)),I&&I.add($))},onDidAddFirstListener(){A&&(B?setTimeout(U):U())},onDidRemoveLastListener(){$&&$.dispose(),$=null}});return I&&I.add(F),F.event}e.buffer=C;function E(P,B){return(z,I,A)=>{let $=B(new k);return P(function(U){let F=$.evaluate(U);F!==S&&z.call(I,F)},void 0,A)}}e.chain=E;let S=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(z=>(B(z),z)),this}filter(B){return this.steps.push(z=>B(z)?z:S),this}reduce(B,z){let I=z;return this.steps.push(A=>(I=B(I,A),I)),this}latch(B=(z,I)=>z===I){let z=!0,I;return this.steps.push(A=>{let $=z||!B(A,I);return z=!1,I=A,$?A:S}),this}evaluate(B){for(let z of this.steps)if(B=z(B),B===S)break;return B}}function j(P,B,z=I=>I){let I=(...F)=>U.fire(z(...F)),A=()=>P.on(B,I),$=()=>P.removeListener(B,I),U=new be({onWillAddFirstListener:A,onDidRemoveLastListener:$});return U.event}e.fromNodeEventEmitter=j;function N(P,B,z=I=>I){let I=(...F)=>U.fire(z(...F)),A=()=>P.addEventListener(B,I),$=()=>P.removeEventListener(B,I),U=new be({onWillAddFirstListener:A,onDidRemoveLastListener:$});return U.event}e.fromDOMEventEmitter=N;function M(P){return new Promise(B=>r(P)(B))}e.toPromise=M;function D(P){let B=new be;return P.then(z=>{B.fire(z)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=D;function H(P,B){return P(z=>B.fire(z))}e.forward=H;function L(P,B,z){return B(z),P(I=>B(I))}e.runAndSubscribe=L;class G{constructor(B,z){this._observable=B,this._counter=0,this._hasChanged=!1;let I={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new be(I),z&&z.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,z){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(P,B){return new G(P,B).emitter.event}e.fromObservable=Z;function q(P){return(B,z,I)=>{let A=0,$=!1,U={beginUpdate(){A++},endUpdate(){A--,A===0&&(P.reportChanges(),$&&($=!1,B.call(z)))},handlePossibleChange(){},handleChange(){$=!0}};P.addObserver(U),P.reportChanges();let F={dispose(){P.removeObserver(U)}};return I instanceof Pa?I.add(F):Array.isArray(I)&&I.push(F),F}}e.fromObservableLight=q})(ei||(ei={}));var Cx=class Ex{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ex._idPool++}`,Ex.all.add(this)}start(t){this._stopWatch=new OV,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}}};Cx.all=new Set,Cx._idPool=0;var BV=Cx,PV=-1,vT=class _T{constructor(t,r,i=(_T._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 n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+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 $V(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,n]of this._stacks)(!t||r<n)&&(t=[i,n],r=n);return t}};vT._idPool=1;var zV=vT,IV=class xT{constructor(t){this.value=t}static create(){let t=new Error;return new xT(t.stack??"")}print(){console.warn(this.value.split(`
675
+ `).slice(2).join(`
676
+ `))}},$V=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},UV=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},HV=0,i_=class{constructor(e){this.value=e,this.id=HV++}},FV=2,qV,be=class{constructor(e){var t,r,i,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new zV((e==null?void 0:e.onListenerError)??Cf,((r=this._options)==null?void 0:r.leakWarningThreshold)??PV):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new BV(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.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,f,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 y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new UV(`${p}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((u=this._options)==null?void 0:u.onListenerError)||Cf)(b),rt.None}if(this._disposed)return rt.None;t&&(e=e.bind(t));let i=new i_(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=IV.create(),n=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof i_?(this._deliveryQueue??(this._deliveryQueue=new WV),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=(f=this._options)==null?void 0:f.onDidAddFirstListener)==null||v.call(f,this)),this._size++;let o=Vt(()=>{n==null||n(),this._removeListener(i)});return r instanceof Pa?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,u,d;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,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*FV<=t.length){let m=0;for(let f=0;f<t.length;f++)t[f]?t[m++]=t[f]: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)||Cf;if(!r){e.value(t);return}try{e.value(t)}catch(n){r(n)}}_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,n;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 i_)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},WV=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}},kx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,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}};kx.INSTANCE=new kx;var xy=kx;function VV(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}xy.INSTANCE.onDidChangeZoomLevel;function GV(e){return xy.INSTANCE.getZoomFactor(e)}xy.INSTANCE.onDidChangeFullscreen;var mc=typeof navigator=="object"?navigator.userAgent:"",Rx=mc.indexOf("Firefox")>=0,YV=mc.indexOf("AppleWebKit")>=0,yy=mc.indexOf("Chrome")>=0,KV=!yy&&mc.indexOf("Safari")>=0;mc.indexOf("Electron/")>=0;mc.indexOf("Android")>=0;var s_=!1;if(typeof Fn.matchMedia=="function"){let e=Fn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Fn.matchMedia("(display-mode: fullscreen)");s_=e.matches,VV(Fn,e,({matches:r})=>{s_&&t.matches||(s_=r)})}var Vl="en",Nx=!1,jx=!1,Ef=!1,yT=!1,tf,kf=Vl,r5=Vl,XV,js,No=globalThis,Jr,lE;typeof No.vscode<"u"&&typeof No.vscode.process<"u"?Jr=No.vscode.process:typeof process<"u"&&typeof((lE=process==null?void 0:process.versions)==null?void 0:lE.node)=="string"&&(Jr=process);var cE,ZV=typeof((cE=Jr==null?void 0:Jr.versions)==null?void 0:cE.electron)=="string",QV=ZV&&(Jr==null?void 0:Jr.type)==="renderer",uE;if(typeof Jr=="object"){Nx=Jr.platform==="win32",jx=Jr.platform==="darwin",Ef=Jr.platform==="linux",Ef&&Jr.env.SNAP&&Jr.env.SNAP_REVISION,Jr.env.CI||Jr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tf=Vl,kf=Vl;let e=Jr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);tf=t.userLocale,r5=t.osLocale,kf=t.resolvedLanguage||Vl,XV=(uE=t.languagePack)==null?void 0:uE.translationsConfigFile}catch{}yT=!0}else typeof navigator=="object"&&!QV?(js=navigator.userAgent,Nx=js.indexOf("Windows")>=0,jx=js.indexOf("Macintosh")>=0,(js.indexOf("Macintosh")>=0||js.indexOf("iPad")>=0||js.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ef=js.indexOf("Linux")>=0,(js==null?void 0:js.indexOf("Mobi"))>=0,kf=globalThis._VSCODE_NLS_LANGUAGE||Vl,tf=navigator.language.toLowerCase(),r5=tf):console.error("Unable to resolve platform.");var bT=Nx,ln=jx,JV=Ef,i5=yT,dn=js,Ea=kf,eG;(e=>{function t(){return Ea}e.value=t;function r(){return Ea.length===2?Ea==="en":Ea.length>=3?Ea[0]==="e"&&Ea[1]==="n"&&Ea[2]==="-":!1}e.isDefaultVariant=r;function i(){return Ea==="en"}e.isDefault=i})(eG||(eG={}));var tG=typeof No.postMessage=="function"&&!No.importScripts;(()=>{if(tG){let e=[];No.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,n=e.length;i<n;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}),No.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var rG=!!(dn&&dn.indexOf("Chrome")>=0);dn&&dn.indexOf("Firefox")>=0;!rG&&dn&&dn.indexOf("Safari")>=0;dn&&dn.indexOf("Edg/")>=0;dn&&dn.indexOf("Android")>=0;var Pl=typeof navigator=="object"?navigator:{};i5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Pl&&Pl.clipboard&&Pl.clipboard.writeText,i5||Pl&&Pl.clipboard&&Pl.clipboard.readText;var by=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}},n_=new by,s5=new by,n5=new by,iG=new Array(230),wT;(e=>{function t(d){return n_.keyCodeToStr(d)}e.toString=t;function r(d){return n_.strToKeyCode(d)}e.fromString=r;function i(d){return s5.keyCodeToStr(d)}e.toUserSettingsUS=i;function n(d){return n5.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function o(d){return s5.strToKeyCode(d)||n5.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 n_.keyCodeToStr(d)}e.toElectronAccelerator=u})(wT||(wT={}));var sG=class ST{constructor(t,r,i,n,o){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=n,this.keyCode=o}equals(t){return t instanceof ST&&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",n=this.metaKey?"1":"0";return`K${t}${r}${i}${n}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new nG([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},nG=class{constructor(e){if(e.length===0)throw AV("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 aG(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return wT.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Rx)switch(t){case 59:return 85;case 60:if(JV)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ln)return 57;break}else if(YV&&(ln&&t===93||!ln&&t===92))return 57;return iG[t]||0}var oG=ln?256:2048,lG=512,cG=1024,uG=ln?2048:256,a5=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=aG(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|=oG),this.altKey&&(t|=lG),this.shiftKey&&(t|=cG),this.metaKey&&(t|=uG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new sG(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},o5=new WeakMap;function dG(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 hG=class{static getSameOriginWindowChain(e){let t=o5.get(e);if(!t){t=[],o5.set(e,t);let r=e,i;do i=dG(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,n=this.getSameOriginWindowChain(e);for(let o of n){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}}},rf=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=hG.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},l5=class{constructor(e,t=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(yy){let o=navigator.userAgent.match(/Chrome\/(\d+)/);i=(o?parseInt(o[1]):123)<=122}if(e){let o=e,u=e,d=((n=e.view)==null?void 0:n.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?Rx&&!ln?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")KV&&bT?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?Rx&&!ln?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()}},CT=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),fG;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof mG?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:CT})})(fG||(fG={}));var mG=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?CT:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},wy=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 bx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new bx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},pG=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 bx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=Vt(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},gG;(e=>{async function t(i){let n,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return o}e.settled=t;function r(i){return new Promise(async(n,o)=>{try{await i(n,o)}catch(u){o(u)}})}e.withAsyncBody=r})(gG||(gG={}));var c5=class cs{static fromArray(t){return new cs(r=>{r.emitMany(t)})}static fromPromise(t){return new cs(async r=>{r.emitMany(await t)})}static fromPromises(t){return new cs(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new cs(async r=>{await Promise.all(t.map(async i=>{for await(let n of i)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new be,queueMicrotask(async()=>{let i={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(i)),this.resolve()}catch(n){this.reject(n)}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 ei.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 cs(async i=>{for await(let n of t)i.emitOne(r(n))})}map(t){return cs.map(this,t)}static filter(t,r){return new cs(async i=>{for await(let n of t)r(n)&&i.emitOne(n)})}filter(t){return cs.filter(this,t)}static coalesce(t){return cs.filter(t,r=>!!r)}coalesce(){return cs.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return cs.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())}};c5.EMPTY=c5.fromArray([]);var{getWindow:an,getWindowId:vG,onDidRegisterWindow:_G}=(function(){let e=new Map,t={window:Fn,disposables:new Pa};e.set(Fn.vscodeWindowId,t);let r=new be,i=new be,n=new be;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return rt.None;let d=new Pa,m={window:u,disposables:d.add(new Pa)};return e.set(u.vscodeWindowId,m),d.add(Vt(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(Ge(u,Or.BEFORE_UNLOAD,()=>{n.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 f;let d=u;if((f=d==null?void 0:d.ownerDocument)!=null&&f.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:Fn},getDocument(u){return an(u).document}}})(),xG=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 Ge(e,t,r,i){return new xG(e,t,r,i)}var u5=function(e,t,r,i){return Ge(e,t,r,i)},Sy,yG=class extends pG{constructor(e){super(),this.defaultTarget=e&&an(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},d5=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){Cf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,n=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(d5.sort),u.shift().execute();i.set(o,!1)};Sy=(o,u,d=0)=>{let m=vG(o),f=new d5(u,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(f),r.get(m)||(r.set(m,!0),o.requestAnimationFrame(()=>n(m))),f}})();function bG(e){let t=e.getBoundingClientRect(),r=an(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Or={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"},wG=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=Ri(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ri(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ri(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ri(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ri(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ri(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ri(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ri(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ri(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ri(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ri(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=Ri(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=Ri(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ri(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 Ri(e){return typeof e=="number"?`${e}px`:e}function zu(e){return new wG(e)}var ET=class{constructor(){this._hooks=new Pa,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,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=n;let o=e;try{e.setPointerCapture(t),this._hooks.add(Vt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=an(e)}this._hooks.add(Ge(o,Or.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ge(o,Or.POINTER_UP,u=>this.stopMonitoring(!0)))}};function SG(e,t,r){let i=null,n=null;if(typeof r.value=="function"?(i="value",n=r.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",n=r.get),!n)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:n.apply(this,u)}),this[o]}}var tn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(tn||(tn={}));var Au=class ai extends rt{constructor(){super(),this.dispatched=!1,this.targets=new t5,this.ignoreTargets=new t5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ei.runAndSubscribe(_G,({window:t,disposables:r})=>{r.add(Ge(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(Ge(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(Ge(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Fn,disposables:this._store}))}static addTarget(t){if(!ai.isTouchDevice())return rt.None;ai.INSTANCE||(ai.INSTANCE=new ai);let r=ai.INSTANCE.targets.push(t);return Vt(r)}static ignoreTarget(t){if(!ai.isTouchDevice())return rt.None;ai.INSTANCE||(ai.INSTANCE=new ai);let r=ai.INSTANCE.ignoreTargets.push(t);return Vt(r)}static isTouchDevice(){return"ontouchstart"in Fn||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,n=t.targetTouches.length;i<n;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(tn.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(),n=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],f=Date.now()-m.initialTimeStamp;if(f<ai.HOLD_DELAY&&Math.abs(m.initialPageX-zi(m.rollingPageX))<30&&Math.abs(m.initialPageY-zi(m.rollingPageY))<30){let v=this.newGestureEvent(tn.Tap,m.initialTarget);v.pageX=zi(m.rollingPageX),v.pageY=zi(m.rollingPageY),this.dispatchEvent(v)}else if(f>=ai.HOLD_DELAY&&Math.abs(m.initialPageX-zi(m.rollingPageX))<30&&Math.abs(m.initialPageY-zi(m.rollingPageY))<30){let v=this.newGestureEvent(tn.Contextmenu,m.initialTarget);v.pageX=zi(m.rollingPageX),v.pageY=zi(m.rollingPageY),this.dispatchEvent(v)}else if(n===1){let v=zi(m.rollingPageX),p=zi(m.rollingPageY),y=zi(m.rollingTimestamps)-m.rollingTimestamps[0],b=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(b)/y,b>0?1:-1,v,Math.abs(w)/y,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(tn.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===tn.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>ai.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===tn.Change||t.type===tn.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 n=0,o=t.initialTarget;for(;o&&o!==i;)n++,o=o.parentElement;r.push([n,i])}r.sort((i,n)=>i[0]-n[0]);for(let[i,n]of r)n.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,n,o,u,d,m,f){this.handle=Sy(t,()=>{let v=Date.now(),p=v-i,y=0,b=0,w=!0;n+=ai.SCROLL_FRICTION*p,d+=ai.SCROLL_FRICTION*p,n>0&&(w=!1,y=o*n*p),d>0&&(w=!1,b=m*d*p);let C=this.newGestureEvent(tn.Change);C.translationX=y,C.translationY=b,r.forEach(E=>E.dispatchEvent(C)),w||this.inertia(t,r,v,n,o,u+y,d,m,f+b)})}onTouchMove(t){let r=Date.now();for(let i=0,n=t.changedTouches.length;i<n;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(tn.Change,u.initialTarget);d.translationX=o.pageX-zi(u.rollingPageX),d.translationY=o.pageY-zi(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)}};Au.SCROLL_FRICTION=-.005,Au.HOLD_DELAY=700,Au.CLEAR_TAP_COUNT_TIME=400,sr([SG],Au,"isTouchDevice",1);var CG=Au,Cy=class extends rt{onclick(e,t){this._register(Ge(e,Or.CLICK,r=>t(new rf(an(e),r))))}onmousedown(e,t){this._register(Ge(e,Or.MOUSE_DOWN,r=>t(new rf(an(e),r))))}onmouseover(e,t){this._register(Ge(e,Or.MOUSE_OVER,r=>t(new rf(an(e),r))))}onmouseleave(e,t){this._register(Ge(e,Or.MOUSE_LEAVE,r=>t(new rf(an(e),r))))}onkeydown(e,t){this._register(Ge(e,Or.KEY_DOWN,r=>t(new a5(r))))}onkeyup(e,t){this._register(Ge(e,Or.KEY_UP,r=>t(new a5(r))))}oninput(e,t){this._register(Ge(e,Or.INPUT,t))}onblur(e,t){this._register(Ge(e,Or.BLUR,t))}onfocus(e,t){this._register(Ge(e,Or.FOCUS,t))}onchange(e,t){this._register(Ge(e,Or.CHANGE,t))}ignoreGesture(e){return CG.ignoreTarget(e)}},h5=11,EG=class extends Cy{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=h5+"px",this.domNode.style.height=h5+"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 ET),this._register(u5(this.bgDomNode,Or.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(u5(this.domNode,Or.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new yG),this._pointerdownScheduleRepeatTimer=this._register(new wy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,an(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()}},kG=class Ax{constructor(t,r,i,n,o,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,n=n|0,o=o|0,u=u|0,d=d|0),this.rawScrollLeft=n,this.rawScrollTop=d,r<0&&(r=0),n+r>i&&(n=i-r),n<0&&(n=0),o<0&&(o=0),d+o>u&&(d=u-o),d<0&&(d=0),this.width=r,this.scrollWidth=i,this.scrollLeft=n,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 Ax(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 Ax(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,n=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:n,scrollLeftChanged:o,heightChanged:u,scrollHeightChanged:d,scrollTopChanged:m}}},RG=class extends rt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kG(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 m5(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=m5.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)))}},f5=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function a_(e,t){let r=t-e;return function(i){return e+r*AG(i)}}function NG(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var m5=class Tx{constructor(t,r,i,n){this.from=t,this.to=r,this.duration=n,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 n,o;return t<r?(n=t+.75*i,o=r-.75*i):(n=t-.75*i,o=r+.75*i),NG(a_(t,n),a_(o,r),.33)}return a_(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),n=this.scrollTop(r);return new f5(i,n,!1)}return new f5(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return Tx.start(t,r,i)}static start(t,r,i){i=i+10;let n=Date.now()-10;return new Tx(t,r,n,i)}};function jG(e){return Math.pow(e,3)}function AG(e){return 1-jG(1-e)}var TG=class extends rt{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 wy)}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":"")))}},MG=140,kT=class extends Cy{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 TG(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ET),this._shouldRender=!0,this.domNode=zu(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(Ge(this.domNode.domNode,Or.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new EG(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=zu(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(Ge(this.slider.domNode,Or.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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(),n=this._sliderPointerPosition(e);r<=n&&n<=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 n=bG(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.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,n=>{let o=this._sliderOrthogonalPointerPosition(n),u=Math.abs(o-r);if(bT&&u>MG){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(n)-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()}},RT=class Mx{constructor(t,r,i,n,o,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=n,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 Mx(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,n,o){let u=Math.max(0,i-t),d=Math.max(0,u-2*r),m=n>0&&n>i;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*d/n))),v=(d-f)/(n-i),p=o*v;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:v,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=Mx._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)}},DG=class extends kT{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new RT(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,n.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}},LG=class extends kT{constructor(e,t,r){let i=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new RT(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,n.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}},OG=500,p5=50,BG=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Dx=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,n=this._rear;do{let o=n===this._front?t:Math.pow(2,-i);if(t-=o,r+=this._memory[n].score*o,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(yy){let r=an(t.browserEvent),i=GV(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 n=null,o=new BG(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(n=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,n)}_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 n=Math.abs(t.deltaX),o=Math.abs(t.deltaY),u=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(n,u),1),f=Math.max(Math.min(o,d),1),v=Math.max(n,u),p=Math.max(o,d);v%m===0&&p%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Dx.INSTANCE=new Dx;var PG=Dx,zG=class extends Cy{constructor(e,t,r){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=$G(t),this._scrollable=r,this._register(this._scrollable.onScroll(n=>{this._onWillScroll.fire(n),this._onDidScroll(n),this._onScroll.fire(n)}));let i={onMouseWheel:n=>this._onMouseWheel(n),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new LG(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new DG(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=zu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=zu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=zu(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,n=>this._onMouseOver(n)),this.onmouseleave(this._listenOnDomNode,n=>this._onMouseLeave(n)),this._hideTimeout=this._register(new wy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Oo(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,ln&&(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 l5(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Oo(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new l5(r))};this._mouseWheelToDispose.push(Ge(this._listenOnDomNode,Or.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var n;if((n=e.browserEvent)!=null&&n.defaultPrevented)return;let t=PG.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=!ln&&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(),f={};if(o){let v=p5*o,p=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(f,p)}if(u){let v=p5*u,p=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(m.scrollLeft!==f.scrollLeft||m.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),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":"",n=t?" top":"",o=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${n}${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(),OG)}},IG=class extends zG{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 $G(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,ln&&(t.className+=" mac"),t}var Lx=class extends rt{constructor(e,t,r,i,n,o,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new RG({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Sy(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new IG(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(n.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ei.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Vt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Vt(()=>this._styleElement.remove())),this._register(ei.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(`
677
+ `)})),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(f=>this._handleScroll(f)))}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}};Lx=sr([Ne(2,gi),Ne(3,Zn),Ne(4,oT),Ne(5,fc),Ne(6,vi),Ne(7,Qn)],Lx);var Ox=class extends rt{constructor(e,t,r,i,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,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(Vt(()=>{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()}};Ox=sr([Ne(1,gi),Ne(2,Zn),Ne(3,gd),Ne(4,Qn)],Ox);var UG=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)}},Zs={full:0,left:0,center:0,right:0},ka={full:0,left:0,center:0,right:0},gu={full:0,left:0,center:0,right:0},Qf=class extends rt{constructor(e,t,r,i,n,o,u,d){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=n,this._optionsService=o,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new UG,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(Vt(()=>{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);ka.full=this._canvas.width,ka.left=e,ka.center=t,ka.right=e,this._refreshDrawHeightConstants(),gu.full=1,gu.left=1,gu.center=1+ka.left,gu.right=1+ka.left+ka.center}_refreshDrawHeightConstants(){Zs.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);Zs.left=t,Zs.center=t,Zs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Zs.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(gu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Zs[e.position||"full"]/2),ka[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Zs[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}))}};Qf=sr([Ne(2,gi),Ne(3,gd),Ne(4,Qn),Ne(5,vi),Ne(6,fc),Ne(7,Zn)],Qf);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=`
678
+ `,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 Rf;(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="Ÿ"))(Rf||(Rf={}));var NT;(e=>e.ST=`${ge.ESC}\\`)(NT||(NT={}));var Bx=class{constructor(e,t,r,i,n,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=n,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,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"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=n+"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)}}};Bx=sr([Ne(2,gi),Ne(3,vi),Ne(4,Go),Ne(5,Qn)],Bx);var Ir=0,$r=0,Ur=0,tr=0,g5={css:"#00000000",rgba:0},br;(e=>{function t(n,o,u,d){return d!==void 0?`#${xo(n)}${xo(o)}${xo(u)}${xo(d)}`:`#${xo(n)}${xo(o)}${xo(u)}`}e.toCss=t;function r(n,o,u,d=255){return(n<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(n,o,u,d){return{css:e.toCss(n,o,u,d),rgba:e.toRgba(n,o,u,d)}}e.toColor=i})(br||(br={}));var Ft;(e=>{function t(m,f){if(tr=(f.rgba&255)/255,tr===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,p=f.rgba>>16&255,y=f.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Ir=b+Math.round((v-b)*tr),$r=w+Math.round((p-w)*tr),Ur=C+Math.round((y-C)*tr);let E=br.toCss(Ir,$r,Ur),S=br.toRgba(Ir,$r,Ur);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,f,v){let p=Nf.ensureContrastRatio(m.rgba,f.rgba,v);if(p)return br.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function n(m){let f=(m.rgba|255)>>>0;return[Ir,$r,Ur]=Nf.toChannels(f),{css:br.toCss(Ir,$r,Ur),rgba:f}}e.opaque=n;function o(m,f){return tr=Math.round(f*255),[Ir,$r,Ur]=Nf.toChannels(m.rgba),{css:br.toCss(Ir,$r,Ur,tr),rgba:br.toRgba(Ir,$r,Ur,tr)}}e.opacity=o;function u(m,f){return tr=m.rgba&255,o(m,tr*f/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Ft||(Ft={}));var Kt;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let o=n.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return Ir=parseInt(n.slice(1,2).repeat(2),16),$r=parseInt(n.slice(2,3).repeat(2),16),Ur=parseInt(n.slice(3,4).repeat(2),16),br.toColor(Ir,$r,Ur);case 5:return Ir=parseInt(n.slice(1,2).repeat(2),16),$r=parseInt(n.slice(2,3).repeat(2),16),Ur=parseInt(n.slice(3,4).repeat(2),16),tr=parseInt(n.slice(4,5).repeat(2),16),br.toColor(Ir,$r,Ur,tr);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let o=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Ir=parseInt(o[1]),$r=parseInt(o[2]),Ur=parseInt(o[3]),tr=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),br.toColor(Ir,$r,Ur,tr);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ir,$r,Ur,tr]=t.getImageData(0,0,1,1).data,tr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:br.toRgba(Ir,$r,Ur,tr),css:n}}e.toColor=i})(Kt||(Kt={}));var hi;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,n,o){let u=i/255,d=n/255,m=o/255,f=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 f*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(hi||(hi={}));var Nf;(e=>{function t(u,d){if(tr=(d&255)/255,tr===1)return d;let m=d>>24&255,f=d>>16&255,v=d>>8&255,p=u>>24&255,y=u>>16&255,b=u>>8&255;return Ir=p+Math.round((m-p)*tr),$r=y+Math.round((f-y)*tr),Ur=b+Math.round((v-b)*tr),br.toRgba(Ir,$r,Ur)}e.blend=t;function r(u,d,m){let f=hi.relativeLuminance(u>>8),v=hi.relativeLuminance(d>>8);if(In(f,v)<m){if(v<f){let b=i(u,d,m),w=In(f,hi.relativeLuminance(b>>8));if(w<m){let C=n(u,d,m),E=In(f,hi.relativeLuminance(C>>8));return w>E?b:C}return b}let p=n(u,d,m),y=In(f,hi.relativeLuminance(p>>8));if(y<m){let b=i(u,d,m),w=In(f,hi.relativeLuminance(b>>8));return y>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=In(hi.relativeLuminance2(y,b,w),hi.relativeLuminance2(f,v,p));for(;C<m&&(y>0||b>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=In(hi.relativeLuminance2(y,b,w),hi.relativeLuminance2(f,v,p));return(y<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function n(u,d,m){let f=u>>24&255,v=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=In(hi.relativeLuminance2(y,b,w),hi.relativeLuminance2(f,v,p));for(;C<m&&(y<255||b<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=In(hi.relativeLuminance2(y,b,w),hi.relativeLuminance2(f,v,p));return(y<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=n;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(Nf||(Nf={}));function xo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function In(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var HG=class extends pd{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()]}},Jf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ps}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),n=0,o=0,u=0,d=t.getFg(0),m=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(f-n>1){let v=this._getJoinedRanges(i,u,o,t,n);for(let p=0;p<v.length;p++)r.push(v[p])}n=f,u=o,d=this._workCell.fg,m=this._workCell.bg}o+=this._workCell.getChars().length||Oa.length}if(this._bufferService.cols-n>1){let f=this._getJoinedRanges(i,u,o,t,n);for(let v=0;v<f.length;v++)r.push(f[v])}return r}_getJoinedRanges(e,t,r,i,n){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 f=0;f<m.length;f++)Jf._mergeRanges(u,m[f])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,i,n),u}_stringRangesToCellRanges(e,t,r){let i=0,n=!1,o=0,u=e[i];if(u){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),f=t.getString(d).length||Oa.length;if(m!==0){if(!n&&u[0]<=o&&(u[0]=d,n=!0),u[1]<=o){if(u[1]=d,u=e[++i],!u)break;u[0]<=o?(u[0]=d,n=!0):n=!1}o+=f}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let n=e[i];if(r){if(t[1]<=n[0])return e[i-1][1]=t[1],e;if(t[1]<=n[1])return e[i-1][1]=Math.max(t[1],n[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=n[0])return e.splice(i,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Jf=sr([Ne(0,gi)],Jf);function FG(e){return 57508<=e&&e<=57558}function qG(e){return 9472<=e&&e<=9631}function WG(e){return FG(e)||qG(e)}function VG(){return{css:{canvas:sf(),cell:sf()},device:{canvas:sf(),cell:sf(),char:{width:0,height:0,left:0,top:0}}}}function sf(){return{width:0,height:0}}var Px=class{constructor(e,t,r,i,n,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=n,this._decorationService=o,this._themeService=u,this._workCell=new ps,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,n,o,u,d,m,f,v){let p=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<o+1&&(w=o+1);let C,E=0,S="",k=0,j=0,N=0,M=0,D=!1,H=0,L=!1,G=0,Z=0,q=[],P=f!==-1&&v!==-1;for(let B=0;B<w;B++){e.loadCell(B,this._workCell);let z=this._workCell.getWidth();if(z===0)continue;let I=!1,A=B>=Z,$=B,U=this._workCell;if(y.length>0&&B===y[0][0]&&A){let re=y.shift(),te=this._isCellInSelection(re[0],t);for(k=re[0]+1;k<re[1];k++)A&&(A=te===this._isCellInSelection(k,t));A&&(A=!r||o<re[0]||o>=re[1]),A?(I=!0,U=new HG(this._workCell,e.translateToString(!0,re[0],re[1]),re[1]-re[0]),$=re[1]-1,z=U.getWidth()):Z=re[1]}let F=this._isCellInSelection(B,t),W=r&&B===o,T=P&&B>=f&&B<=v,V=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,re=>{V=!0});let K=U.getChars()||Oa;if(K===" "&&(U.isUnderline()||U.isOverline())&&(K=" "),G=z*d-m.get(K,U.isBold(),U.isItalic()),!C)C=this._document.createElement("span");else if(E&&(F&&L||!F&&!L&&U.bg===j)&&(F&&L&&b.selectionForeground||U.fg===N)&&U.extended.ext===M&&T===D&&G===H&&!W&&!I&&!V&&A){U.isInvisible()?S+=Oa:S+=K,E++;continue}else E&&(C.textContent=S),C=this._document.createElement("span"),E=0,S="";if(j=U.bg,N=U.fg,M=U.extended.ext,D=T,H=G,L=F,I&&o>=B&&o<=$&&(o=B),!this._coreService.isCursorHidden&&W&&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(n)switch(n){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(U.isBold()&&q.push("xterm-bold"),U.isItalic()&&q.push("xterm-italic"),U.isDim()&&q.push("xterm-dim"),U.isInvisible()?S=Oa:S=U.getChars()||Oa,U.isUnderline()&&(q.push(`xterm-underline-${U.extended.underlineStyle}`),S===" "&&(S=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${pd.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let re=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&re<8&&(re+=8),C.style.textDecorationColor=b.ansi[re].css}U.isOverline()&&(q.push("xterm-overline"),S===" "&&(S=" ")),U.isStrikethrough()&&q.push("xterm-strikethrough"),T&&(C.style.textDecoration="underline");let J=U.getFgColor(),oe=U.getFgColorMode(),ce=U.getBgColor(),Y=U.getBgColorMode(),ne=!!U.isInverse();if(ne){let re=J;J=ce,ce=re;let te=oe;oe=Y,Y=te}let de,Ae,ke=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,re=>{re.options.layer!=="top"&&ke||(re.backgroundColorRGB&&(Y=50331648,ce=re.backgroundColorRGB.rgba>>8&16777215,de=re.backgroundColorRGB),re.foregroundColorRGB&&(oe=50331648,J=re.foregroundColorRGB.rgba>>8&16777215,Ae=re.foregroundColorRGB),ke=re.options.layer==="top")}),!ke&&F&&(de=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ce=de.rgba>>8&16777215,Y=50331648,ke=!0,b.selectionForeground&&(oe=50331648,J=b.selectionForeground.rgba>>8&16777215,Ae=b.selectionForeground)),ke&&q.push("xterm-decoration-top");let Ee;switch(Y){case 16777216:case 33554432:Ee=b.ansi[ce],q.push(`xterm-bg-${ce}`);break;case 50331648:Ee=br.toColor(ce>>16,ce>>8&255,ce&255),this._addStyle(C,`background-color:#${v5((ce>>>0).toString(16),"0",6)}`);break;case 0:default:ne?(Ee=b.foreground,q.push("xterm-bg-257")):Ee=b.background}switch(de||U.isDim()&&(de=Ft.multiplyOpacity(Ee,.5)),oe){case 16777216:case 33554432:U.isBold()&&J<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(J+=8),this._applyMinimumContrast(C,Ee,b.ansi[J],U,de,void 0)||q.push(`xterm-fg-${J}`);break;case 50331648:let re=br.toColor(J>>16&255,J>>8&255,J&255);this._applyMinimumContrast(C,Ee,re,U,de,Ae)||this._addStyle(C,`color:#${v5(J.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,Ee,b.foreground,U,de,Ae)||ne&&q.push("xterm-fg-257")}q.length&&(C.className=q.join(" "),q.length=0),!W&&!I&&!V&&A?E++:C.textContent=S,G!==this.defaultSpacing&&(C.style.letterSpacing=`${G}px`),p.push(C),B=$}return C&&E&&(C.textContent=S),p}_applyMinimumContrast(e,t,r,i,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||WG(i.getCode()))return!1;let u=this._getContrastCache(i),d;if(!n&&!o&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Ft.ensureContrastRatio(n||t,o||r,m),u.setColor((n||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]}};Px=sr([Ne(1,uT),Ne(2,vi),Ne(3,Zn),Ne(4,Go),Ne(5,gd),Ne(6,fc)],Px);function v5(e,t,r){for(;e.length<r;)e=t+e;return e}var GG=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 n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.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,n,o],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(n),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 n=e;t&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(o===void 0){let u=0;t&&(u|=1),r&&(u|=2),o=this._measure(e,u),o>0&&this._holey.set(n,o)}return o}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},YG=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 n=e.buffers.active.ydisp,o=t[1]-n,u=r[1]-n,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 KG(){return new YG}var o_="xterm-dom-renderer-owner-",as="xterm-rows",nf="xterm-fg-",_5="xterm-bg-",vu="xterm-focus",af="xterm-selection",XG=1,zx=class extends rt{constructor(e,t,r,i,n,o,u,d,m,f,v,p,y,b){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=n,this._helperContainer=o,this._linkifier2=u,this._charSizeService=m,this._optionsService=f,this._bufferService=v,this._coreService=p,this._coreBrowserService=y,this._themeService=b,this._terminalClass=XG++,this._rowElements=[],this._selectionRenderModel=KG(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(as),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(af),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=VG(),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(Px,document),this._element.classList.add(o_+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(Vt(()=>{this._element.classList.remove(o_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new GG(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} .${as} 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} .${as} { 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} .${as} .xterm-dim { color: ${Ft.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}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${as}.${vu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${as}.${vu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${as}.${vu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${as} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${as} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${as} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${as} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${as} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${af} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${af} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${af} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${nf}${o} { color: ${u.css}; }${this._terminalSelector} .${nf}${o}.xterm-dim { color: ${Ft.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${_5}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${nf}257 { color: ${Ft.opaque(e.background).css}; }${this._terminalSelector} .${nf}257.xterm-dim { color: ${Ft.multiplyOpacity(Ft.opaque(e.background),.5).css}; }${this._terminalSelector} .${_5}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(vu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(vu),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,n=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,f=o===n?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,m,f));let v=u-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,v)),o!==u){let p=n===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,p))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,i=1){let n=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),n.style.height=`${i*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${u}px`,n}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,n=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 f=m+r.ydisp,v=this._rowElements[m],p=r.lines.get(f);if(!v||!p)break;v.replaceChildren(...this._rowFactory.createRow(p,f,f===i,u,d,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${o_}${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,n,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),n=Math.min(n,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,f=Math.min(d.x,n-1),v=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=r;b<=i;++b){let w=b+d.ydisp,C=this._rowElements[b],E=d.lines.get(w);if(!C||!E)break;C.replaceChildren(...this._rowFactory.createRow(E,w,w===m,p,y,f,v,this.dimensions.css.cell.width,this._widthCache,o?b===r?e:0:-1,o?(b===i?t:n)-1:-1))}}};zx=sr([Ne(7,vy),Ne(8,Wm),Ne(9,vi),Ne(10,gi),Ne(11,Go),Ne(12,Zn),Ne(13,fc)],zx);var Ix=class extends rt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new QG(this._optionsService))}catch{this._measureStrategy=this._register(new ZG(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=sr([Ne(2,vi)],Ix);var jT=class extends rt{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)}},ZG=class extends jT{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}},QG=class extends jT{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}},JG=class extends rt{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 eY(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ge(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ge(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}},eY=class extends rt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new rc),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Vt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ge(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)}},tY=class extends rt{constructor(){super(),this.linkProviders=[],this._register(Vt(()=>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 Ey(e,t,r){let i=r.getBoundingClientRect(),n=e.getComputedStyle(r),o=parseInt(n.getPropertyValue("padding-left")),u=parseInt(n.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function rY(e,t,r,i,n,o,u,d,m){if(!o)return;let f=Ey(e,t,r);if(f)return f[0]=Math.ceil((f[0]+(m?u/2:0))/u),f[1]=Math.ceil(f[1]/d),f[0]=Math.min(Math.max(f[0],1),i+(m?1:0)),f[1]=Math.min(Math.max(f[1],1),n),f}var $x=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,n){return rY(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=Ey(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])}}};$x=sr([Ne(0,Qn),Ne(1,Wm)],$x);var iY=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=[]}},AT={};fV(AT,{getSafariVersion:()=>nY,isChromeOS:()=>LT,isFirefox:()=>TT,isIpad:()=>aY,isIphone:()=>oY,isLegacyEdge:()=>sY,isLinux:()=>ky,isMac:()=>em,isNode:()=>Vm,isSafari:()=>MT,isWindows:()=>DT});var Vm=typeof process<"u"&&"title"in process,vd=Vm?"node":navigator.userAgent,_d=Vm?"node":navigator.platform,TT=vd.includes("Firefox"),sY=vd.includes("Edge"),MT=/^((?!chrome|android).)*safari/i.test(vd);function nY(){if(!MT)return 0;let e=vd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var em=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_d),aY=_d==="iPad",oY=_d==="iPhone",DT=["Windows","Win16","Win32","WinCE"].includes(_d),ky=_d.indexOf("Linux")>=0,LT=/\bCrOS\b/.test(vd),OT=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(),n=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),n=e.timeRemaining(),r*1.5>n){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=n}this.clear()}},lY=class extends OT{_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())}}},cY=class extends OT{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},tm=!Vm&&"requestIdleCallback"in window?cY:lY,uY=class{constructor(){this._queue=new tm}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ux=class extends rt{constructor(e,t,r,i,n,o,u,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=n,this._coreBrowserService=d,this._renderer=this._register(new rc),this._pausedResizeTask=new uY,this._observerDisposable=this._register(new rc),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new iY((f,v)=>this._renderRows(f,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new dY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Vt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.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(f=>this._registerIntersectionObserver(f,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=Vt(()=>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()}};Ux=sr([Ne(2,vi),Ne(3,Wm),Ne(4,Go),Ne(5,gd),Ne(6,gi),Ne(7,Zn),Ne(8,fc)],Ux);var dY=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 hY(e,t,r,i){let n=r.buffer.x,o=r.buffer.y;if(!r.buffer.hasScrollback)return pY(n,o,e,t,r,i)+Gm(o,t,r,i)+gY(n,o,e,t,r,i);let u;if(o===t)return u=n>e?"D":"C",rd(Math.abs(n-e),td(u,i));u=o>t?"D":"C";let d=Math.abs(o-t),m=mY(o>t?e:n,r)+(d-1)*r.cols+1+fY(o>t?n:e);return rd(m,td(u,i))}function fY(e,t){return e-1}function mY(e,t){return t.cols-e}function pY(e,t,r,i,n,o){return Gm(t,i,n,o).length===0?"":rd(PT(e,t,e,t-Bo(t,n),!1,n).length,td("D",o))}function Gm(e,t,r,i){let n=e-Bo(e,r),o=t-Bo(t,r),u=Math.abs(n-o)-vY(e,t,r);return rd(u,td(BT(e,t),i))}function gY(e,t,r,i,n,o){let u;Gm(t,i,n,o).length>0?u=i-Bo(i,n):u=t;let d=i,m=_Y(e,t,r,i,n,o);return rd(PT(e,u,r,d,m==="C",n).length,td(m,o))}function vY(e,t,r){var u;let i=0,n=e-Bo(e,r),o=t-Bo(t,r);for(let d=0;d<Math.abs(n-o);d++){let m=BT(e,t)==="A"?-1:1;(u=r.buffer.lines.get(n+m*d))!=null&&u.isWrapped&&i++}return i}function Bo(e,t){let r=0,i=t.buffer.lines.get(e),n=i==null?void 0:i.isWrapped;for(;n&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),n=i==null?void 0:i.isWrapped;return r}function _Y(e,t,r,i,n,o){let u;return Gm(r,i,n,o).length>0?u=i-Bo(i,n):u=t,e<r&&u<=i||e>=r&&u<i?"C":"D"}function BT(e,t){return e>t?"A":"B"}function PT(e,t,r,i,n,o){let u=e,d=t,m="";for(;(u!==r||d!==i)&&d>=0&&d<o.buffer.lines.length;)u+=n?1:-1,n&&u>o.cols-1?(m+=o.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!n&&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 td(e,t){let r=t?"O":"[";return ge.ESC+r+e}function rd(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var xY=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 x5(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 l_=50,yY=15,bY=50,wY=500,SY=" ",CY=new RegExp(SY,"g"),Hx=class extends rt{constructor(e,t,r,i,n,o,u,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=n,this._mouseService=o,this._optionsService=u,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ps,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new xY(this._bufferService),this._activeSelectionMode=0,this._register(Vt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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 n=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,n,o);i.push(d)}}else{let n=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],n));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(n=>n.replace(CY," ")).join(DT?`\r
679
+ `:`
680
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ky&&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 n,o;let r=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=x5(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=Ey(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,-l_),l_),t/=l_,t/Math.abs(t)+Math.round(t*(yY-1)))}shouldForceSelection(e){return em?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(),bY)}_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&&!(em&&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<wY&&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=hY(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 n=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==i&&(r+=n-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 n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let u=n.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),m=d,f=e[0]-d,v=0,p=0,y=0,b=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 k=o.getString(S).length;for(k>1&&(b+=k-1,m+=k-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):j>1&&(y+=j-1,d-=j-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 j=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,S++):j>1&&(b+=j-1,m+=j-1),m++,S++}}m++;let w=d+f-v+y,C=Math.min(this._bufferService.cols,m-d+v+p-y-b);if(!(!t&&u.slice(d,m).trim()==="")){if(r&&w===0&&o.getCodePoint(0)!==32){let E=n.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 k=this._bufferService.cols-S.start;w-=k,C+=k}}}if(i&&w+C===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=n.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=x5(r,this._bufferService.cols)}};Hx=sr([Ne(3,gi),Ne(4,Go),Ne(5,_y),Ne(6,vi),Ne(7,Qn),Ne(8,Zn)],Hx);var y5=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={}}},b5=class{constructor(){this._color=new y5,this._css=new y5}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()}},Er=Object.freeze((()=>{let e=[Kt.toColor("#2e3436"),Kt.toColor("#cc0000"),Kt.toColor("#4e9a06"),Kt.toColor("#c4a000"),Kt.toColor("#3465a4"),Kt.toColor("#75507b"),Kt.toColor("#06989a"),Kt.toColor("#d3d7cf"),Kt.toColor("#555753"),Kt.toColor("#ef2929"),Kt.toColor("#8ae234"),Kt.toColor("#fce94f"),Kt.toColor("#729fcf"),Kt.toColor("#ad7fa8"),Kt.toColor("#34e2e2"),Kt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],n=t[r/6%6|0],o=t[r%6];e.push({css:br.toCss(i,n,o),rgba:br.toRgba(i,n,o)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:br.toCss(i,i,i),rgba:br.toRgba(i,i,i)})}return e})()),yo=Kt.toColor("#ffffff"),Tu=Kt.toColor("#000000"),w5=Kt.toColor("#ffffff"),S5=Tu,_u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},EY=yo,Fx=class extends rt{constructor(e){super(),this._optionsService=e,this._contrastCache=new b5,this._halfContrastCache=new b5,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:yo,background:Tu,cursor:w5,cursorAccent:S5,selectionForeground:void 0,selectionBackgroundTransparent:_u,selectionBackgroundOpaque:Ft.blend(Tu,_u),selectionInactiveBackgroundTransparent:_u,selectionInactiveBackgroundOpaque:Ft.blend(Tu,_u),scrollbarSliderBackground:Ft.opacity(yo,.2),scrollbarSliderHoverBackground:Ft.opacity(yo,.4),scrollbarSliderActiveBackground:Ft.opacity(yo,.5),overviewRulerBorder:yo,ansi:Er.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=Bt(e.foreground,yo),t.background=Bt(e.background,Tu),t.cursor=Ft.blend(t.background,Bt(e.cursor,w5)),t.cursorAccent=Ft.blend(t.background,Bt(e.cursorAccent,S5)),t.selectionBackgroundTransparent=Bt(e.selectionBackground,_u),t.selectionBackgroundOpaque=Ft.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Bt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ft.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Bt(e.selectionForeground,g5):void 0,t.selectionForeground===g5&&(t.selectionForeground=void 0),Ft.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ft.opacity(t.selectionBackgroundTransparent,.3)),Ft.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ft.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Bt(e.scrollbarSliderBackground,Ft.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Bt(e.scrollbarSliderHoverBackground,Ft.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Bt(e.scrollbarSliderActiveBackground,Ft.opacity(t.foreground,.5)),t.overviewRulerBorder=Bt(e.overviewRulerBorder,EY),t.ansi=Er.slice(),t.ansi[0]=Bt(e.black,Er[0]),t.ansi[1]=Bt(e.red,Er[1]),t.ansi[2]=Bt(e.green,Er[2]),t.ansi[3]=Bt(e.yellow,Er[3]),t.ansi[4]=Bt(e.blue,Er[4]),t.ansi[5]=Bt(e.magenta,Er[5]),t.ansi[6]=Bt(e.cyan,Er[6]),t.ansi[7]=Bt(e.white,Er[7]),t.ansi[8]=Bt(e.brightBlack,Er[8]),t.ansi[9]=Bt(e.brightRed,Er[9]),t.ansi[10]=Bt(e.brightGreen,Er[10]),t.ansi[11]=Bt(e.brightYellow,Er[11]),t.ansi[12]=Bt(e.brightBlue,Er[12]),t.ansi[13]=Bt(e.brightMagenta,Er[13]),t.ansi[14]=Bt(e.brightCyan,Er[14]),t.ansi[15]=Bt(e.brightWhite,Er[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]=Bt(e.extendedAnsi[i],Er[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()}}};Fx=sr([Ne(0,vi)],Fx);function Bt(e,t){if(e!==void 0)try{return Kt.toColor(e)}catch{}return t}var kY=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)}},RY=class{constructor(){this._services=new kY,this._services.set(vy,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=yV(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 n=r.length>0?r[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},NY={trace:0,debug:1,info:2,warn:3,error:4,off:5},jY="xterm.js: ",qx=class extends rt{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=NY[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?"":jY)+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)}};qx=sr([Ne(0,vi)],qx);var C5=class extends rt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),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 n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));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,xr=Object.freeze(new pd),of=0,c_=2,Mu=class zT{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Je);let n=r||ps.fromCharData([0,iT,1,0]);for(let o=0;o<t;++o)this.setCell(o,n);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?Ma(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?Ma(r&2097151):""}isProtected(t){return this._data[t*Je+2]&536870912}loadCell(t,r){return of=t*Je,r.content=this._data[of+0],r.fg=this._data[of+1],r.bg=this._data[of+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,n){n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Je+0]=r|i<<22,this._data[t*Je+1]=n.fg,this._data[t*Je+2]=n.bg}addCodepointToCell(t,r,i){let n=this._data[t*Je+0];n&2097152?this._combined[t]+=Ma(r):n&2097151?(this._combined[t]=Ma(n&2097151)+Ma(r),n&=-2097152,n|=2097152):n=r|1<<22,i&&(n&=-12582913,n|=i<<22),this._data[t*Je+0]=n}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 n=new ps;for(let o=this.length-t-r-1;o>=0;--o)this.setCell(t+r+o,this.loadCell(t+o,n));for(let o=0;o<r;++o)this.setCell(t+o,i)}else for(let n=t;n<this.length;++n)this.setCell(n,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 n=new ps;for(let o=0;o<this.length-t-r;++o)this.setCell(t+o,this.loadCell(t+r+o,n));for(let o=this.length-r;o<this.length;++o)this.setCell(o,i)}else for(let n=t;n<this.length;++n)this.setCell(n,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,n=!1){if(n){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*c_<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 n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);let n=Object.keys(this._combined);for(let u=0;u<n.length;u++){let d=parseInt(n[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*c_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*c_<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 zT(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,n,o){let u=t._data;if(o)for(let m=n-1;m>=0;m--){for(let f=0;f<Je;f++)this._data[(i+m)*Je+f]=u[(r+m)*Je+f];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}else for(let m=0;m<n;m++){for(let f=0;f<Je;f++)this._data[(i+m)*Je+f]=u[(r+m)*Je+f];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 f=parseInt(d[m],10);f>=r&&(this._combined[f-r+i]=t._combined[f])}}translateToString(t,r,i,n){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let o="";for(;r<i;){let u=this._data[r*Je+0],d=u&2097151,m=u&2097152?this._combined[r]:d?Ma(d):Oa;if(o+=m,n)for(let f=0;f<m.length;++f)n.push(r);r+=u>>22||1}return n&&n.push(r),o}};function AY(e,t,r,i,n,o){let u=[];for(let d=0;d<e.length-1;d++){let m=d,f=e.get(++m);if(!f.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&f.isWrapped;)v.push(f),f=e.get(++m);if(!o&&i>=d&&i<m){d+=v.length-1;continue}let p=0,y=id(v,p,t),b=1,w=0;for(;b<v.length;){let E=id(v,b,t),S=E-w,k=r-y,j=Math.min(S,k);v[p].copyCellsFrom(v[b],w,y,j,!1),y+=j,y===r&&(p++,y=0),w+=j,w===E&&(b++,w=0),y===0&&p!==0&&v[p-1].getWidth(r-1)===2&&(v[p].copyCellsFrom(v[p-1],r-1,y++,1,!1),v[p-1].setCell(r-1,n))}v[p].replaceCells(y,r,n);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 TY(e,t){let r=[],i=0,n=t[i],o=0;for(let u=0;u<e.length;u++)if(n===u){let d=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:d}),u+=d-1,o+=d,n=t[++i]}else r.push(u);return{layout:r,countRemoved:o}}function MY(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 DY(e,t,r){let i=[],n=e.map((m,f)=>id(e,f,t)).reduce((m,f)=>m+f),o=0,u=0,d=0;for(;d<n;){if(n-d<r){i.push(n-d);break}o+=r;let m=id(e,u,t);o>m&&(o-=m,u++);let f=e[u].getWidth(o-1)===2;f&&o--;let v=f?r-1:r;i.push(v),d+=v}return i}function id(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,n=e[t+1].getWidth(0)===2;return i&&n?r-1:r}var IT=class $T{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=$T._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Oo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};IT._nextId=1;var LY=IT,jr={},bo=jr.B;jr[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:"≥","{":"π","|":"≠","}":"£","~":"·"};jr.A={"#":"£"};jr.B=void 0;jr[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};jr.C=jr[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};jr.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};jr.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};jr.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};jr.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};jr.E=jr[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};jr.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};jr.H=jr[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};jr["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var E5=4294967295,k5=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=xr.clone(),this.savedCharset=bo,this.markers=[],this._nullCell=ps.fromCharData([0,iT,1,0]),this._whitespaceCell=ps.fromCharData([0,Oa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new tm,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new C5(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 Zf),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 Zf),this._whitespaceCell}getBlankLine(e,t){return new Mu(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>E5?E5:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=xr);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 C5(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(xr),i=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),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 Mu(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 Mu(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(n<this.lines.maxLength){let u=this.lines.length-n;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=n}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=AY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(xr),r);if(i.length>0){let n=TY(this.lines,i);MY(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(xr),n=r;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Mu(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(xr),n=[],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 j=this.ybase+this.y;if(j>=u&&j<u+m.length)continue}let f=m[m.length-1].getTrimmedLength(),v=DY(m,this._cols,e),p=v.length-m.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+p):y=Math.max(0,this.lines.length-this.lines.maxLength+p);let b=[];for(let j=0;j<p;j++){let N=this.getBlankLine(xr,!0);b.push(N)}b.length>0&&(n.push({start:u+m.length+o,newLines:b}),o+=b.length),m.push(...b);let w=v.length-1,C=v[w];C===0&&(w--,C=v[w]);let E=m.length-p-1,S=f;for(;E>=0;){let j=Math.min(S,C);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[E],S-j,C-j,j,!0),C-=j,C===0&&(w--,C=v[w]),S-=j,S===0){E--;let N=Math.max(E,0);S=id(m,N,this._cols)}}for(let j=0;j<m.length;j++)v[j]<e&&m[j].setCell(v[j],i);let k=p-y;for(;k-- >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(n.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,f=m-1,v=0,p=n[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let y=0;for(let C=Math.min(this.lines.maxLength-1,m+o-1);C>=0;C--)if(p&&p.start>f+y){for(let E=p.newLines.length-1;E>=0;E--)this.lines.set(C--,p.newLines[E]);C++,u.push({index:f+1,amount:p.newLines.length}),y+=p.newLines.length,p=n[++v]}else this.lines.set(C,d[f--]);let b=0;for(let C=u.length-1;C>=0;C--)u[C].index+=b,this.lines.onInsertEmitter.fire(u[C]),b+=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 n=this.lines.get(e);return n?n.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 LY(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)}},OY=class extends rt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 k5(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new k5(!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)}},UT=2,HT=1,Wx=class extends rt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,UT),this.rows=Math.max(e.rawOptions.rows||0,HT),this.buffers=this._register(new OY(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 n=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-n+1;r.lines.shiftElements(n+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))}};Wx=sr([Ne(0,vi)],Wx);var zl={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:em,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},BY=["normal","bold","100","200","300","400","500","600","700","800","900"],PY=class extends rt{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...zl};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(Vt(()=>{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 zl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in zl))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=zl[e]),!zY(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=zl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=BY.includes(t)?t:zl[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 zY(e){return e==="block"||e==="underline"||e==="bar"}function Du(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]&&Du(e[i],t-1);return r}var R5=Object.freeze({insertMode:!1}),N5=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Vx=class extends rt{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 be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Du(R5),this.decPrivateModes=Du(N5)}reset(){this.modes=Du(R5),this.decPrivateModes=Du(N5)}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))}};Vx=sr([Ne(0,gi),Ne(1,lT),Ne(2,vi)],Vx);var j5={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 u_(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 d_=String.fromCharCode,A5={DEFAULT:e=>{let t=[u_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${d_(t[0])}${d_(t[1])}${d_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${u_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${u_(e,!0)};${e.x};${e.y}${t}`}},Gx=class extends rt{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 be),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(j5))this.addProtocol(i,j5[i]);for(let i of Object.keys(A5))this.addEncoding(i,A5[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,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=i+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_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)}};Gx=sr([Ne(0,gi),Ne(1,Go),Ne(2,vi)],Gx);var h_=[[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]],IY=[[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]],kr;function $Y(e,t){let r=0,i=t.length-1,n;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else if(e<t[n][0])i=n-1;else return!0;return!1}var UY=class{constructor(){if(this.version="6",!kr){kr=new Uint8Array(65536),kr.fill(1),kr[0]=0,kr.fill(0,1,32),kr.fill(0,127,160),kr.fill(2,4352,4448),kr[9001]=2,kr[9002]=2,kr.fill(2,11904,42192),kr[12351]=1,kr.fill(2,44032,55204),kr.fill(2,63744,64256),kr.fill(2,65040,65050),kr.fill(2,65072,65136),kr.fill(2,65280,65377),kr.fill(2,65504,65511);for(let e=0;e<h_.length;++e)kr.fill(0,h_[e][0],h_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?kr[e]:$Y(e,IY)?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 n=So.extractWidth(t);n===0?i=!1:n>r&&(r=n)}return So.createPropertyValue(0,r,i)}},So=class jf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new UY;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,n=t.length;for(let o=0;o<n;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=n)return r+this.wcwidth(u);let f=t.charCodeAt(o);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:r+=this.wcwidth(f)}let d=this.charProperties(u,i),m=jf.extractWidth(d);jf.extractShouldJoin(d)&&(m-=jf.extractWidth(i)),r+=m,i=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},HY=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 T5(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 xu=2147483647,FY=256,FT=class Yx{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>FY)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 Yx;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let n=t[i];if(Array.isArray(n))for(let o=0;o<n.length;++o)r.addSubParam(n[o]);else r.addParam(n)}return r}clone(){let t=new Yx(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,n=this._subParamsIdx[r]&255;n-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,n))}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>xu?xu: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>xu?xu: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,n=this._subParamsIdx[r]&255;n-i>0&&(t[r]=this._subParams.slice(i,n))}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,n=i[r-1];i[r-1]=~n?Math.min(n*10+t,xu):t}},yu=[],qY=class{constructor(){this._state=0,this._active=yu,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=yu}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=yu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||yu,!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",qm(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,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&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=yu,this._id=-1,this._state=0}}},Ii=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+=qm(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}},bu=[],WY=class{constructor(){this._handlers=Object.create(null),this._active=bu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=bu}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=bu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||bu,!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",qm(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,n=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&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=bu,this._ident=0}},Lu=new FT;Lu.addParam(0);var M5=class{constructor(e){this._handler=e,this._data="",this._params=Lu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Lu,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=qm(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=Lu,this._data="",this._hitLimit=!1,r));return this._params=Lu,this._data="",this._hitLimit=!1,t}},VY=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 n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|i}},us=160,GY=(function(){let e=new VY(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),i=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,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(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,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(n,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(n,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(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,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(n,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(n,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(us,0,2,0),e.add(us,8,5,8),e.add(us,6,0,6),e.add(us,11,0,11),e.add(us,13,13,13),e})(),YY=class extends rt{constructor(e=GY){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 FT,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(Vt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new qY),this._dcsParser=this._register(new WY),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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);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 n=i.indexOf(t);n!==-1&&i.splice(n,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 n=i.indexOf(t);n!==-1&&i.splice(n,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,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=n}parse(e,t,r){let i=0,n=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],n=this._transitions.table[this.currentState<<8|(i<160?i:us)],n>>4){case 2:for(let y=d+1;;++y){if(y>=t||(i=e[y])<32||i>126&&i<us){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<us){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<us){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<us){this._printHandler(e,d,y),d=y-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],f=m?m.length-1:-1;for(;f>=0&&(u=m[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._preserveStack(3,m,f,n,d),u;f<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,n,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 y=d+1;;++y)if(y>=t||(i=e[y])===24||i===26||i===27||i>127&&i<us){this._dcsParser.put(e,d,y),d=y-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,n,d),u;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let y=d+1;;y++)if(y>=t||(i=e[y])<32||i>127&&i<us){this._oscParser.put(e,d,y),d=y-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,n,d),u;i===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},KY=/^([\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})$/,XY=/^[\da-f]+$/;function D5(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=KY.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),XY.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let n=0;n<3;++n){let o=parseInt(t.slice(r*n,r*n+r),16);i[n]=r===1?o<<4:r===2?o:r===3?o>>4:o>>8}return i}}function f_(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 ZY(e,t=16){let[r,i,n]=e;return`rgb:${f_(r,t)}/${f_(i,t)}/${f_(n,t)}`}var QY={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ra=131072,L5=10;function O5(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 B5=5e3,P5=0,JY=class extends rt{constructor(e,t,r,i,n,o,u,d,m=new YY){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=n,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _V,this._utf8Decoder=new xV,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=xr.clone(),this._eraseAttrDataInternal=xr.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 Kx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:v.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,v,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:v,data:p})}),this._parser.setDcsHandlerFallback((f,v,p)=>{v==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:v,payload:p})}),this._parser.setPrintHandler((f,v,p)=>this.print(f,v,p)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!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(Rf.IND,()=>this.index()),this._parser.setExecuteHandler(Rf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ii(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Ii(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Ii(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Ii(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Ii(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Ii(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Ii(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Ii(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Ii(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Ii(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Ii(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Ii(f=>this.restoreCursorColor(f))),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 f in jr)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new M5((f,v)=>this.requestStatusString(f,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"),B5))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${B5} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,n=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,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ra&&(o=this._parseStack.position+Ra)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ra&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ra))),u||this._dirtyRowTracker.clearRange(),e.length>Ra)for(let f=o;f<e.length;f+=Ra){let v=f+Ra<e.length?f+Ra:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(f,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,n,p,f),this._logSlowResolvingAsync(r),r}else if(!u){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,n,f,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==n)&&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,n,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,f=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 y=this._parser.precedingJoinState;for(let b=t;b<r;++b){if(i=e[b],i<127&&o){let S=o[String.fromCharCode(i)];S&&(i=S.charCodeAt(0))}let w=this._unicodeService.charProperties(i,y);n=So.extractWidth(w);let C=So.extractShouldJoin(w),E=C?So.extractWidth(y):0;if(y=w,u&&this._onA11yChar.fire(Ma(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-E>d){if(m){let S=p,k=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 Mu&&p.copyCellsFrom(S,k,0,E,!1);k<d;)S.setCellFromCodepoint(k++,0,1,v)}else if(this._activeBuffer.x=d-1,n===2)continue}if(C&&this._activeBuffer.x){let S=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-S,i,n);for(let k=n-E;--k>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(f&&(p.insertCells(this._activeBuffer.x,n-E,this._activeBuffer.getNullCell(v)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,v)),p.setCellFromCodepoint(this._activeBuffer.x++,i,n,v),n>0)for(;--n;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=y,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=>O5(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new M5(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ii(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,n=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),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 n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,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,n=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(n-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(xr));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=So.extractWidth(t),n=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),u=new Uint32Array(o.length*r),d=0;for(let f=0;f<o.length;){let v=o.codePointAt(f)||0;u[d++]=v,f+=v>65535?2:1}let m=d;for(let f=1;f<r;++f)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,bo),this._charsetService.setgCharset(1,bo),this._charsetService.setgCharset(2,bo),this._charsetService.setgCharset(3,bo);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:n,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:f,alt:v}=d,p=this._optionsService.rawOptions,y=(C,E)=>(u.triggerDataEvent(`${ge.ESC}[${t?"":"?"}${C};${E}$y`),!0),b=C=>C?1:2,w=e.params[0];return t?w===2?y(w,4):w===4?y(w,b(u.modes.insertMode)):w===12?y(w,3):w===20?y(w,b(p.convertEol)):y(w,0):w===1?y(w,b(i.applicationCursorKeys)):w===3?y(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?y(w,b(i.origin)):w===7?y(w,b(i.wraparound)):w===8?y(w,3):w===9?y(w,b(n==="X10")):w===12?y(w,b(p.cursorBlink)):w===25?y(w,b(!u.isCursorHidden)):w===45?y(w,b(i.reverseWraparound)):w===66?y(w,b(i.applicationKeypad)):w===67?y(w,4):w===1e3?y(w,b(n==="VT200")):w===1002?y(w,b(n==="DRAG")):w===1003?y(w,b(n==="ANY")):w===1004?y(w,b(i.sendFocus)):w===1005?y(w,4):w===1006?y(w,b(o==="SGR")):w===1015?y(w,4):w===1016?y(w,b(o==="SGR_PIXELS")):w===1048?y(w,1):w===47||w===1047||w===1049?y(w,b(f===v)):w===2004?y(w,b(i.bracketedPasteMode)):w===2026?y(w,b(i.synchronizedOutput)):y(w,0)}_updateAttrColor(e,t,r,i,n){return t===2?(e|=50331648,e&=-16777216,e|=pd.fromColorRGB([r,i,n])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],n=0,o=0;do{if(i[o+n]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),d=0;do i[1]===5&&(n=1),i[o+d+1+n]=u[d];while(++d<u.length&&d+o+1+n<i.length);break}if(i[1]===5&&o+n>=2||i[1]===2&&o+n>=5)break;i[1]&&(n=1)}while(++o+t<e.length&&o+n<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=xr.fg,e.bg=xr.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 n=0;n<t;n++)r=e.params[n],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(n)?e.getSubParams(n)[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|=xr.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=xr.bg&16777215):r===38||r===48||r===58?n+=this._extractColor(e,n,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|=xr.fg&16777215,i.bg&=-67108864,i.bg|=xr.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=xr.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(!O5(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>L5&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>L5&&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(),n=r.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(z5(o))if(n==="?")t.push({type:0,index:o});else{let u=D5(n);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,n=r.findIndex(o=>o.startsWith("id="));return n!==-1&&(i=r[n].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 n=D5(r[i]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}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 n=parseInt(r[i]);z5(n)&&t.push({type:2,index:n})}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,bo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(QY[e[0]],jr[e[1]]||bo),!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=xr.clone(),this._eraseAttrDataInternal=xr.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 ps;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,n=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}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Kx=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&&(P5=e,e=t,t=P5),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Kx=sr([Ne(0,gi)],Kx);function z5(e){return 0<=e&&e<256}var eK=5e7,I5=12,tK=50,rK=class extends rt{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 be),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>eK)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],n=this._action(i,t);if(n){let u=d=>performance.now()-r>=I5?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);n.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>=I5)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>tK&&(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()}},Xx=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),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.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)))}};Xx=sr([Ne(0,gi)],Xx);var $5=!1,iK=class extends rt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new rc),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new RY,this.optionsService=this._register(new PY(e)),this._instantiationService.setService(vi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Wx)),this._instantiationService.setService(gi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(qx)),this._instantiationService.setService(lT,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Vx)),this._instantiationService.setService(Go,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Gx)),this._instantiationService.setService(oT,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(So)),this._instantiationService.setService(SV,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HY),this._instantiationService.setService(wV,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Xx),this._instantiationService.setService(cT,this._oscLinkService),this._inputHandler=this._register(new JY(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ei.forward(this._bufferService.onResize,this._onResize)),this._register(ei.forward(this.coreService.onData,this._onData)),this._register(ei.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 rK((t,r)=>this._inputHandler.parse(t,r))),this._register(ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),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&&!$5&&(this._logService.warn("writeSync is unreliable and will be removed soon."),$5=!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,UT),t=Math.max(t,HT),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(T5.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(T5(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Vt(()=>{for(let t of e)t.dispose()})}}},sK={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 nK(e,t,r,i){var u;let n={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?n.key=ge.ESC+"OA":n.key=ge.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?n.key=ge.ESC+"OD":n.key=ge.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?n.key=ge.ESC+"OC":n.key=ge.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?n.key=ge.ESC+"OB":n.key=ge.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":ge.DEL,e.altKey&&(n.key=ge.ESC+n.key);break;case 9:if(e.shiftKey){n.key=ge.ESC+"[Z";break}n.key=ge.HT,n.cancel=!0;break;case 13:n.key=e.altKey?ge.ESC+ge.CR:ge.CR,n.cancel=!0;break;case 27:n.key=ge.ESC,e.altKey&&(n.key=ge.ESC+ge.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=ge.ESC+"[1;"+(o+1)+"D":t?n.key=ge.ESC+"OD":n.key=ge.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=ge.ESC+"[1;"+(o+1)+"C":t?n.key=ge.ESC+"OC":n.key=ge.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=ge.ESC+"[1;"+(o+1)+"A":t?n.key=ge.ESC+"OA":n.key=ge.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=ge.ESC+"[1;"+(o+1)+"B":t?n.key=ge.ESC+"OB":n.key=ge.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=ge.ESC+"[2~");break;case 46:o?n.key=ge.ESC+"[3;"+(o+1)+"~":n.key=ge.ESC+"[3~";break;case 36:o?n.key=ge.ESC+"[1;"+(o+1)+"H":t?n.key=ge.ESC+"OH":n.key=ge.ESC+"[H";break;case 35:o?n.key=ge.ESC+"[1;"+(o+1)+"F":t?n.key=ge.ESC+"OF":n.key=ge.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=ge.ESC+"[5;"+(o+1)+"~":n.key=ge.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=ge.ESC+"[6;"+(o+1)+"~":n.key=ge.ESC+"[6~";break;case 112:o?n.key=ge.ESC+"[1;"+(o+1)+"P":n.key=ge.ESC+"OP";break;case 113:o?n.key=ge.ESC+"[1;"+(o+1)+"Q":n.key=ge.ESC+"OQ";break;case 114:o?n.key=ge.ESC+"[1;"+(o+1)+"R":n.key=ge.ESC+"OR";break;case 115:o?n.key=ge.ESC+"[1;"+(o+1)+"S":n.key=ge.ESC+"OS";break;case 116:o?n.key=ge.ESC+"[15;"+(o+1)+"~":n.key=ge.ESC+"[15~";break;case 117:o?n.key=ge.ESC+"[17;"+(o+1)+"~":n.key=ge.ESC+"[17~";break;case 118:o?n.key=ge.ESC+"[18;"+(o+1)+"~":n.key=ge.ESC+"[18~";break;case 119:o?n.key=ge.ESC+"[19;"+(o+1)+"~":n.key=ge.ESC+"[19~";break;case 120:o?n.key=ge.ESC+"[20;"+(o+1)+"~":n.key=ge.ESC+"[20~";break;case 121:o?n.key=ge.ESC+"[21;"+(o+1)+"~":n.key=ge.ESC+"[21~";break;case 122:o?n.key=ge.ESC+"[23;"+(o+1)+"~":n.key=ge.ESC+"[23~";break;case 123:o?n.key=ge.ESC+"[24;"+(o+1)+"~":n.key=ge.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?n.key=ge.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?n.key=ge.DEL:e.keyCode===219?n.key=ge.ESC:e.keyCode===220?n.key=ge.FS:e.keyCode===221&&(n.key=ge.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let d=(u=sK[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)n.key=ge.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(m);e.shiftKey&&(f=f.toUpperCase()),n.key=ge.ESC+f}else if(e.keyCode===32)n.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()),n.key=ge.ESC+m,n.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(n.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?n.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(n.key=ge.US),e.key==="@"&&(n.key=ge.NUL));break}return n}var hr=0,aK=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new tm,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new tm,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((n,o)=>this._getKey(n)-this._getKey(o)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<i.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[n]=e[t],t++):i[n]=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||(hr=this._search(t),hr===-1)||this._getKey(this._array[hr])!==t)return!1;do if(this._array[hr]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(hr),!0;while(++hr<this._array.length&&this._getKey(this._array[hr])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),t=0,r=new Array(this._array.length-e.length),i=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:r[i++]=this._array[n];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&&(hr=this._search(e),!(hr<0||hr>=this._array.length)&&this._getKey(this._array[hr])===e))do yield this._array[hr];while(++hr<this._array.length&&this._getKey(this._array[hr])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(hr=this._search(e),!(hr<0||hr>=this._array.length)&&this._getKey(this._array[hr])===e))do t(this._array[hr]);while(++hr<this._array.length&&this._getKey(this._array[hr])===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,n=this._getKey(this._array[i]);if(n>e)r=i-1;else if(n<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},m_=0,U5=0,oK=class extends rt{constructor(){super(),this._decorations=new aK(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Vt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new lK(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,n=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,n=i+(o.options.width??1),e>=i&&e<n&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,n=>{m_=n.options.x??0,U5=m_+(n.options.width??1),e>=m_&&e<U5&&(!r||(n.options.layer??"bottom")===r)&&i(n)})}},lK=class extends Pa{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=Kt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Kt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},cK=1e3,uK=class{constructor(e,t=cK){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 n=i-this._lastRefreshMs,o=this._debounceThresholdMS-n;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)}},H5=20,rm=class extends rt{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 n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.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=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new uK(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(`
681
+ `))),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(Ge(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Vt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<H5+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
682
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===H5+1&&(this._liveRegion.textContent+=gx.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 n=e;n<=t;n++){let o=r.lines.get(r.ydisp+n),u=[],d=(o==null?void 0:o.translateToString(!0,void 0,void 0,u))||"",m=(r.ydisp+n+1).toString(),f=this._rowElements[n];f&&(d.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=d,this._rowColumns.set(f,u)),f.setAttribute("aria-posinset",m),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}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],n=r.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(n===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 n=({node:m,offset:f})=>{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 y=this._rowColumns.get(v);if(!y)return console.warn("columns is null. Race condition?"),null;let b=f<y.length?y[f]:y.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},o=n(t),u=n(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 n,o;e.style.transform="";let t=e.getBoundingClientRect().width,r=(o=(n=this._rowColumns.get(e))==null?void 0:n.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})`}};rm=sr([Ne(1,vy),Ne(2,Zn),Ne(3,Qn)],rm);var Zx=class extends rt{constructor(e,t,r,i,n){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Vt(()=>{var o;Oo(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(Ge(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ge(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ge(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ge(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 n=r[i];if(n.classList.contains("xterm"))break;if(n.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,n;(!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?(n=this._activeProviderReplies)!=null&&n.get(o)&&(r=this._checkLinkProviderResult(o,e,r)):u.provideLinks(e.y,d=>{var f,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(p=>({link:p}));(f=this._activeProviderReplies)==null||f.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 n=t.get(i);if(n)for(let o=0;o<n.length;o++){let u=n[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 f=d;f<=m;f++){if(r.has(f)){n.splice(o--,1);break}r.add(f)}}}}_checkLinkProviderResult(e,t,r){var o;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),n=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(n=!0);if(!n&&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&&dK(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,Oo(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,n,o;(i=this._currentLink)!=null&&i.state&&((o=(n=this._currentLink)==null?void 0:n.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,n=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(i,n),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,n=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(n)}_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,n=t.y*this._bufferService.cols+t.x;return r<=n&&n<=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,n){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:n}}};Zx=sr([Ne(1,_y),Ne(2,Qn),Ne(3,gi),Ne(4,dT)],Zx);function dK(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 hK=class extends iK{constructor(e={}){super(e),this._linkifier=this._register(new rc),this.browser=AT,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new rc),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(oK),this._instantiationService.setService(gd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(tY),this._instantiationService.setService(dT,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_x)),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(ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Vt(()=>{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 n=Ft.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ge.ESC}]${i};${ZY(n)}${NT.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=br.toColor(...t.color));else{let o=r;this._themeService.modifyColors(u=>u[o]=br.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(rm,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,n=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,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(Ge(this.element,"copy",t=>{this.hasSelection()&&gV(t,this._selectionService)}));let e=t=>vV(t,this.textarea,this.coreService,this.optionsService);this._register(Ge(this.textarea,"paste",e)),this._register(Ge(this.element,"paste",e)),TT?this._register(Ge(this.element,"mousedown",t=>{t.button===2&&Q2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ge(this.element,"contextmenu",t=>{Q2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ky&&this._register(Ge(this.element,"auxclick",t=>{t.button===1&&rT(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ge(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ge(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ge(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ge(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ge(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ge(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ge(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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(Ge(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",px.get()),LT||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(JG,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zn,this._coreBrowserService),this._register(Ge(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Ge(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ix,this._document,this._helperContainer),this._instantiationService.setService(Wm,this._charSizeService),this._themeService=this._instantiationService.createInstance(Fx),this._instantiationService.setService(fc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Jf),this._instantiationService.setService(uT,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ux,this.rows,this.screenElement)),this._instantiationService.setService(Qn,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(Bx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($x),this._instantiationService.setService(_y,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Zx,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(Lx,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(Hx,this.element,this.screenElement,i)),this._instantiationService.setService(EV,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(ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Ox,this.screenElement)),this._register(Ge(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(rm,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(zx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(o){var f,v,p,y,b;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,(y=(p=(v=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:v.device)==null?void 0:p.cell)==null?void 0:y.height,(b=e._coreBrowserService)==null?void 0:b.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},n={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",n.mousemove),i.mousemove=n.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),i.wheel=n.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ge(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(Ge(t,"wheel",o=>{var u,d,m,f,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,(f=(m=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:f.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){tT(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=nK(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)&&(fK(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(xr));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),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[6;${n};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function fK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var mK=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)}},pK=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 ps)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},F5=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 pK(t)}getNullCell(){return new ps}},gK=class extends rt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new F5(this._core.buffers.normal,"normal"),this._alternate=new F5(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)}},vK=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)}},_K=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}},xK=["cols","rows"],Qs=0,yK=class extends rt{constructor(e){super(),this._core=this._register(new hK(e)),this._addonManager=this._register(new mK),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,n)=>{this._checkReadonlyOptions(i),this._core.options[i]=n};for(let i in this._core.options){let n={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,n)}}_checkReadonlyOptions(e){if(xK.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 vK(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _K(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 gK(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
683
+ `,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 px.get()},set promptLabel(e){px.set(e)},get tooMuchOutput(){return gx.get()},set tooMuchOutput(e){gx.set(e)}}}_verifyIntegers(...e){for(Qs of e)if(Qs===1/0||isNaN(Qs)||Qs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Qs of e)if(Qs&&(Qs===1/0||isNaN(Qs)||Qs%1!==0||Qs<0))throw new Error("This API only accepts positive integers")}};function q5(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 W5(){const e=q5("--card","#0b0b12"),t=q5("--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 bK(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function wK(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 SK(e){return e===1001||e===1006||e===1012||e===1013}function CK(e,t,r){return!e&&t&&r.kind==="closed"&&r.code===4404}function EK(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 kK="\x1B[13;2u";function RK(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?kK:null}const V5=new TextEncoder,NK=750,jK=2048;function AK(e,t){return t<NK&&e<=jK}function TK(e){let t;try{t=new dV}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function MK(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class DK{constructor(t,r,i){si(this,"term");si(this,"fit");si(this,"webgl");si(this,"listenerCtl");si(this,"resizeObserver");si(this,"ws",null);si(this,"dataDispose",null);si(this,"lastUserInputAt",0);si(this,"disposed",!1);si(this,"connectedOnce",!1);si(this,"connectionGeneration",0);si(this,"layoutVisible",!1);this.url=r,this.onState=i,this.term=new yK({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:W5(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0}),this.fit=new Cq,this.term.loadAddon(this.fit),this.term.loadAddon(new Aq(bK)),this.term.open(t),this.webgl=TK(this.term),this.listenerCtl=new AbortController;const{signal:n}=this.listenerCtl;t.addEventListener("copy",o=>MK(o,this.term.getSelection()),{capture:!0,signal:n}),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;EK(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 n=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=wK(u.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(n=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,!(n!==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(V5.encode(u))}),this.term.attachCustomKeyEventHandler(u=>{const d=RK(u);return d===null?!0:(u.type==="keydown"&&(u.preventDefault(),this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(V5.encode(d))),!1)})}setTheme(){this.term.options.theme=W5()}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(AK(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 G5=[500,1e3,2e3,4e3,8e3],LK=3e4,OK=15e3;function BK({sessionId:e,runtimeSelector:t,active:r,role:i="owner",setup:n}){const[o,u]=g.useState({kind:"connecting"}),[d,m]=g.useState(0),[f,v]=g.useState(!1),[p,y]=g.useState(!1),[b,w]=g.useState(null),C=g.useRef(0),E=g.useRef(null),S=g.useRef(null),k=g.useRef(r),j=`${t}\0${e}`,N=g.useRef(j);N.current=j;const{theme:M}=fy(),D=g.useCallback(Z=>u(Z),[]);g.useEffect(()=>{var Z;(Z=S.current)==null||Z.setTheme()},[M]),g.useEffect(()=>{w(null),y(!1)},[j]);const H=g.useCallback(Z=>{if(Z===null)return;D({kind:"connecting"});let q=null,P=!1;return queueMicrotask(()=>{P||(q=new DK(Z,({cols:B,rows:z})=>l9(t,e,{role:i,cols:B,rows:z,refreshCapability:!0}),D),S.current=q)}),()=>{P=!0,q==null||q.dispose(),S.current=null}},[e,t,i,D]);g.useEffect(()=>{if(o.kind==="connected"){E.current=Date.now(),v(!1);return}if(o.kind!=="closed")return;if(!r){v(!1);return}if(!SK(o.code)){v(!1);return}if(E.current!==null&&Date.now()-E.current>=LK&&(C.current=0),E.current=null,C.current>=G5.length){v(!1);return}const Z=G5[C.current];C.current+=1,v(!0);let q=!1;const P=()=>{q||(q=!0,S.current?S.current.reconnect():m(I=>I+1))},B=window.setTimeout(P,Z),z=()=>{document.visibilityState==="visible"&&P()};return document.addEventListener("visibilitychange",z),()=>{window.clearTimeout(B),document.removeEventListener("visibilitychange",z)}},[r,o]);const L=g.useCallback(()=>{C.current=0,E.current=null,v(!1),S.current?S.current.reconnect():m(Z=>Z+1)},[]);g.useEffect(()=>{var q;const Z=k.current;k.current=r,CK(Z,r,o)&&(C.current=0,E.current=null,v(!1),(q=S.current)==null||q.reconnect({silent:!0}))},[r,o]);const G=g.useCallback(async()=>{if(p)return;const Z=j,q=new AbortController,P=window.setTimeout(()=>q.abort(),OK);y(!0),w(null);try{if(await xe.startSessionTerminal(t,e,q.signal),N.current!==Z)return;L()}catch(B){if(N.current!==Z)return;w(q.signal.aborted?"Terminal start timed out. Try again.":B instanceof Error?B.message:"Could not start terminal")}finally{window.clearTimeout(P),N.current===Z&&y(!1)}},[L,t,e,p,j]);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:H,className:"h-full w-full overflow-hidden"},d),o.kind!=="connected"&&l.jsx(IK,{state:o,reconnectPending:f,startingTerminal:p,startError:b,onRetry:L,onStartTerminal:()=>void G(),setup:n})]}),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:zK(PK())})})]})}function PK(){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 zK(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function IK({state:e,reconnectPending:t,startingTerminal:r,startError:i,onRetry:n,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($e,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx($e,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?l.jsx($K,{starting:r,error:i,onStart:o,setup:u}):l.jsx(Y5,{message:e.reason||"Terminal connection closed",onRetry:n})),e.kind==="probing"&&l.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[l.jsx($e,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&l.jsx(Y5,{message:e.message,onRetry:n})]})}function $K({starting:e,error:t,onStart:r,setup:i}){const n=(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"?`${n} 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 ${n} is ready.`:i.reason??`Complete ${n} 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 ${n} 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(ue,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?l.jsx($e,{className:"animate-spin"}):l.jsx(zO,{}),e?"Opening…":d]})]})}function Y5({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(ue,{variant:"outline",size:"sm",onClick:t,children:[l.jsx(Et,{})," Retry"]})]})}var Ym="Collapsible",[UK]=Is(Ym),[HK,Ry]=UK(Ym),qT=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:i,defaultOpen:n,disabled:o,onOpenChange:u,...d}=e,[m,f]=Ao({prop:i,defaultProp:n??!1,onChange:u,caller:Ym});return l.jsx(HK,{scope:r,disabled:o,contentId:Ds(),open:m,onOpenToggle:g.useCallback(()=>f(v=>!v),[f]),children:l.jsx(Ye.div,{"data-state":jy(m),"data-disabled":o?"":void 0,...d,ref:t})})});qT.displayName=Ym;var WT="CollapsibleTrigger",VT=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,n=Ry(WT,r);return l.jsx(Ye.button,{type:"button","aria-controls":n.open?n.contentId:void 0,"aria-expanded":n.open||!1,"data-state":jy(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...i,ref:t,onClick:Pe(e.onClick,n.onOpenToggle)})});VT.displayName=WT;var Ny="CollapsibleContent",GT=g.forwardRef((e,t)=>{const{forceMount:r,...i}=e,n=Ry(Ny,e.__scopeCollapsible);return l.jsx($s,{present:r||n.open,children:({present:o})=>l.jsx(FK,{...i,ref:t,present:o})})});GT.displayName=Ny;var FK=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:i,children:n,...o}=e,u=Ry(Ny,r),[d,m]=g.useState(i),f=g.useRef(null),v=nt(t,f),p=g.useRef(0),y=p.current,b=g.useRef(0),w=b.current,C=u.open||d,E=g.useRef(C),S=g.useRef(void 0);return g.useEffect(()=>{const k=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(k)},[]),rr(()=>{const k=f.current;if(k){S.current=S.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const j=k.getBoundingClientRect();p.current=j.height,b.current=j.width,E.current||(k.style.transitionDuration=S.current.transitionDuration,k.style.animationName=S.current.animationName),m(i)}},[u.open,i]),l.jsx(Ye.div,{"data-state":jy(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!C,...o,ref:v,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:C&&n})});function jy(e){return e?"open":"closed"}var qK=qT,WK=VT,VK=GT;const Km=qK,Xm=WK,Zm=VK;function GK({status:e}){return e==="completed"?l.jsx(zs,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?l.jsx($e,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):l.jsx(k4,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function YK({todos:e}){const[t,r]=g.useState(!0);if(e.length===0)return null;const i=e.filter(n=>n.status==="completed").length;return l.jsxs(Km,{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(Xm,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[l.jsx(Po,{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(Zm,{className:"overflow-hidden px-3 pb-2",children:l.jsx("ul",{className:"space-y-1",children:e.map(n=>l.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[l.jsx(GK,{status:n.status}),l.jsx("span",{className:qe("truncate",n.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:n.subject})]},n.id))})})]})}function K5(e,t,r={},i={},n=!0){const o={},u={};for(const d of e){if(d.type==="text"){const b=typeof t[d.id]=="string"?t[d.id]:"";n&&d.required&&!b.trim()?u[d.id]=`${d.label} is required`:b.length>0&&(o[d.id]=b);continue}const m=new Set(d.options.map(b=>b.value)),f=d.allowOther===!0&&i[d.id]===!0,v=f?(r[d.id]??"").trim():"";if(d.multiple){const b=Array.isArray(t[d.id])?t[d.id]:[],w=d.options.map(C=>C.value).filter(C=>b.includes(C));v&&!w.includes(v)&&w.push(v),n&&f&&!v?u[d.id]=`${d.label}: enter a value for Other`:n&&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]:"",y=f?v:m.has(p)?p:"";n&&f&&!v?u[d.id]=`${d.label}: enter a value for Other`:n&&d.required&&!y?u[d.id]=`${d.label} is required`:y&&(o[d.id]=y)}return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:o}}function KK({sessionId:e,item:t,canResolve:r=!0}){var B;const{runtimeSelector:i}=dc(),n=g.useId().replaceAll(":",""),[o,u]=g.useState({}),[d,m]=g.useState({}),[f,v]=g.useState({}),[p,y]=g.useState({}),[b,w]=g.useState(()=>{var z;return(z=t.request.fields[0])==null?void 0:z.id}),[C,E]=g.useState(),[S,k]=g.useState(),j=t.status==="pending";function N(z){y(I=>{if(!I[z])return I;const A={...I};return delete A[z],A})}function M(z,I){u(A=>({...A,[z]:I})),N(z)}function D(z,I){v(A=>({...A,[z]:I})),N(z)}function H(z){const I=t.request.fields,A=Math.max(I.findIndex(U=>U.id===b),0),$=I.findIndex(U=>U.id===z);if(!($<0)){if($>A){const U=I[A];if(U){const F=K5([U],o,d,f);if(!F.ok){y(W=>({...W,...F.errors}));return}N(U.id)}}w(z)}}async function L(z){if(!r)return;const I=K5(t.request.fields,o,d,f,z.requiresAnswers);if(!I.ok){y(I.errors);const A=t.request.fields.find($=>I.errors[$.id]);A&&w(A.id);return}y({}),E(void 0),k(z.id);try{await u9(e,t.id,{actionId:z.id,...Object.keys(I.answers).length>0?{answers:I.answers}:{}},i)}catch(A){k(void 0),E(A instanceof Error?A.message:String(A))}}const G=t.request.kind==="permission"?i6:t.request.kind==="form"?uO:_4,Z=Math.max(t.request.fields.findIndex(z=>z.id===b),0),q=t.request.fields.length===0||Z===t.request.fields.length-1,P=t.request.actions.filter(z=>!z.requiresAnswers||q);return l.jsxs("section",{"aria-labelledby":`${n}-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(G,{"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:`${n}-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(XK,{item:t}),j&&!r?l.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):j?l.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[l.jsx(S7,{idPrefix:n,fields:t.request.fields,activeFieldId:b,answers:o,otherValues:d,otherSelections:f,errors:p,disabled:S!==void 0,onNavigate:H,onAnswerChange:M,onOtherSelectionChange:D,onOtherValueChange:(z,I)=>{m(A=>({...A,[z]:I})),N(z)}}),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:[P.map(z=>l.jsxs(ue,{type:"button",size:"sm",variant:QK(z),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:S!==void 0,title:z.description,"aria-label":z.description?`${z.label}. ${z.description}`:void 0,onClick:()=>void L(z),children:[S===z.id&&l.jsx($e,{"aria-hidden":"true",className:"animate-spin"}),z.label]},z.id)),S&&l.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(B=t.request.actions.find(z=>z.id===S))==null?void 0:B.label,"…"]})]})]}):l.jsx(ZK,{item:t})]})}function XK({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(X5,{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(X5,{value:t.diff,tall:!0})]}):null}function X5({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 ZK({item:e}){var i;if(e.status!=="resolved"){const n=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:[n,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(n=>{var o;return n.id===((o=e.resolution)==null?void 0:o.actionId)}),r=e.request.fields.flatMap(n=>{var d,m;const o=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[n.id];if(o===void 0)return[];const u=n.type==="text"&&n.secret?"••••••••":Array.isArray(o)?o.join(", "):o;return[{id:n.id,label:n.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(n=>l.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[l.jsx("span",{children:n.label}),l.jsx("span",{className:"break-words text-[var(--foreground)]",children:n.value})]},n.id))]})}function QK(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function JK({item:e}){const t=e.rotateKind==="fork"?Y4:L4;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 eX({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(w4,{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(Ms,{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 tX="modulepreload",rX=function(e){return"/"+e},Z5={},iX=function(t,r,i){let n=Promise.resolve();if(r&&r.length>0){let u=function(f){return Promise.all(f.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"));n=u(r.map(f=>{if(f=rX(f),f in Z5)return;Z5[f]=!0;const v=f.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":tX,v||(y.as="script"),y.crossOrigin="",y.href=f,m&&y.setAttribute("nonce",m),document.head.appendChild(y),v)return new Promise((b,w)=>{y.addEventListener("load",b),y.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return n.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},sX=g.lazy(()=>iX(()=>import("./mermaid-GHXKKRXX-C1fxAgiw.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),nX=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 aX({isOpen:e,onClose:t,onConfirm:r,url:i}){return l.jsx(sA,{open:e,url:i,onOpenChange:n=>{n||t()},onConfirm:r})}function YT({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(sX,{shikiTheme:["github-light","github-dark"],linkSafety:{enabled:!0,renderModal:aX},className:qe(nX,t),children:e})})}function oX({item:e,sessionId:t,runtimeSelector:r}){const[i,n]=g.useState(null),[o,u]=g.useState(()=>new Set),d=e.images??[],m=d.find(f=>f.resourceId===i);return g.useEffect(()=>{if(!i)return;const f=v=>{v.key==="Escape"&&n(null)};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[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(f=>{const v=xe.sessionResourceContentUrl(r,t,f),p=o.has(f.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||n(f.resourceId)},"aria-label":`Open ${f.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(J4,{className:"size-4"}),"Image unavailable"]}):l.jsx("img",{src:v,alt:f.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>u(y=>new Set(y).add(f.resourceId))})},f.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:()=>n(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:()=>n(null),children:l.jsx(cn,{className:"size-5"})}),l.jsx("img",{src:xe.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:f=>f.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(YT,{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 lX({item:e}){const t=e.summary.filter(Boolean).join(`
684
+
685
+ `).trim(),[r,i]=g.useState(e.streaming??!1);return g.useEffect(()=>{i(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:l.jsxs(Km,{open:r,onOpenChange:i,className:"my-0.5",children:[l.jsxs(Xm,{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(Po,{className:qe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),l.jsx(VE,{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(Zm,{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(YT,{children:t}):l.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const Q5=12e3;function J5(e){return e.length<=Q5?{text:e,truncated:!1}:{text:e.slice(0,Q5),truncated:!0}}function cX({item:e}){const[t,r]=g.useState(!1),i=e.stdout?J5(e.stdout):null,n=e.stderr?J5(e.stderr):null,o=!!(i||n);return l.jsxs(Km,{open:t,onOpenChange:r,className:"my-0.5",children:[l.jsxs(Xm,{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(Po,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx(GE,{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(Zm,{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"})]}),n&&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:n.text}),n.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 eE=80,tE=12e3;function uX(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function dX(e){try{const t=JSON.parse(e);for(const i of["command","cmd","path","file","file_path","query","url","pattern","description"]){const n=t[i];if(typeof n=="string"&&n)return n}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function hX(e){let t=e,r=!1;const i=t.split(`
686
+ `);return i.length>eE&&(t=i.slice(0,eE).join(`
687
+ `),r=!0),t.length>tE&&(t=t.slice(0,tE),r=!0),{text:t,truncated:r}}function fX({status:e}){return e==="in_progress"?l.jsx($e,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?l.jsx(C4,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?l.jsx(y4,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):l.jsx(zs,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function mX({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){const[n,o]=g.useState(!1),u=dX(e.arguments),d=e.output?hX(e.output):null,m=!!e.arguments&&e.arguments!=="{}",f=e.children??[];return l.jsxs(Km,{open:n,onOpenChange:o,className:"my-0.5",children:[l.jsxs(Xm,{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(Po,{className:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",n&&"rotate-90")}),l.jsx(fX,{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(Zm,{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:uX(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]}),f.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(C6,{className:"size-3 shrink-0 text-[var(--primary)]"}),l.jsxs("span",{className:"font-mono",children:[f.length," sub-agent step",f.length===1?"":"s"]})]}),f.map(v=>l.jsx(KT,{item:v,sessionId:t,runtimeSelector:r,canResolveInteractions:i},v.id))]})]})]})}function KT({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){switch(e.kind){case"message":return e.isMeta?null:l.jsx(oX,{item:e,sessionId:t,runtimeSelector:r});case"tool":return l.jsx(mX,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i});case"reasoning":return l.jsx(lX,{item:e});case"terminal_command":return l.jsx(cX,{item:e});case"divider":return l.jsx(JK,{item:e});case"error":return l.jsx(eX,{item:e});case"interaction":return l.jsx(KK,{sessionId:t,item:e,canResolve:i})}}function pX(){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 gX(){return l.jsxs("div",{"data-testid":"runner-starting-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx($e,{className:"size-4 shrink-0 animate-spin text-[var(--muted-foreground)]","aria-hidden":"true"}),l.jsx("span",{children:"Starting up… getting your terminal ready."})]})}function vX(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function _X({message:e}){const t=g.useRef(Date.now()),[r,i]=g.useState(0);return g.useEffect(()=>{const n=()=>i(Math.floor((Date.now()-t.current)/1e3));n();const o=window.setInterval(n,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($e,{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 ",vX(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,startingUp:i=!1,waitingForInteraction:n,queueStatus:o,sessionId:u,runtimeSelector:d}){const m=g.useRef(null),[f,v]=g.useState(!0),p=e[e.length-1],y=(p==null?void 0:p.kind)==="message"&&p.role==="assistant"&&!!p.streaming,b=i&&!o,w=r&&!b&&!y&&!n&&!o;return g.useEffect(()=>{f&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[e,r,i,o,f]),l.jsx(vs,{className:"min-w-0 flex-1",viewportRef:m,viewportProps:{onScroll:C=>{const E=C.currentTarget;v(E.scrollHeight-E.scrollTop-E.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&&!o&&!b?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($e,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),l.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r&&!o&&!b?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(C=>l.jsx(KT,{item:C,sessionId:u,runtimeSelector:d,canResolveInteractions:!0},C.id)),b&&l.jsx(gX,{}),o&&l.jsx(_X,{message:o}),w&&l.jsx(pX,{})]})})})}const yX=2500,wu=new Map;function bX({sessionId:e,runtimeSelector:t,active:r,polling:i=r}){const n=`${t}
688
+ ${e}`,o=g.useRef(n);o.current=n;const u=g.useRef(r);u.current=r;const d=g.useRef(0),m=g.useRef(0),f=g.useRef(!1),v=g.useRef(null),p=g.useRef(null),[y,b]=g.useState(()=>wu.get(n)??null),[w,C]=g.useState(()=>!wu.has(n)),[E,S]=g.useState(null),[k,j]=g.useState(null),N=g.useCallback(P=>{p.current=P,j(P)},[]),M=g.useCallback(P=>{v.current=P,wu.set(n,P),b(P)},[n]),D=g.useCallback(async P=>{if(!u.current||f.current)return;const B=n,z=d.current,I=m.current;P&&C(!0);try{const A=await xe.getRuntimeBrowserState(t,e);return!u.current||d.current!==z||m.current!==I||o.current!==B||f.current?void 0:(M(A),P&&N(null),A)}catch(A){if(!u.current||d.current!==z||m.current!==I||o.current!==B)return;P&&N(Yh(A));return}finally{u.current&&d.current===z&&m.current===I&&o.current===B&&P&&C(!1)}},[n,t,e,M,N]);g.useEffect(()=>{const P=++d.current,B=wu.has(n);return M(wu.get(n)??null),N(null),C(!B),S(null),f.current=!1,D(!B),()=>{d.current===P&&(d.current+=1)}},[n,r,D,M,N]),g.useEffect(()=>{if(!i)return;const P=window.setInterval(()=>void D(!1),yX);return()=>window.clearInterval(P)},[r,D,i]);const H=g.useCallback(async(P,B)=>{if(!u.current||f.current)return;const z=n,I=d.current;m.current+=1,f.current=!0,S(P),N(null);try{const A=await B();return u.current&&d.current===I&&o.current===z?(M(A),A):void 0}catch(A){u.current&&d.current===I&&o.current===z&&N(Yh(A));return}finally{u.current&&d.current===I&&o.current===z&&(f.current=!1,S(null),C(!1))}},[n,M,N]),L=g.useCallback((P,B)=>{const z=v.current;return z?H(P,()=>B(z.browserGeneration)):Promise.resolve(void 0)},[H]),G=g.useCallback(P=>H("Starting browser",()=>xe.openRuntimeBrowser(t,e,P)),[t,e,H]),Z=g.useCallback(async()=>{const P=v.current;if(!u.current||!P||f.current)return;const B=n,z=d.current;m.current+=1,f.current=!0,S("Closing browser"),N(null);try{await xe.closeRuntimeBrowser(t,e,P.browserGeneration),u.current&&d.current===z&&o.current===B&&M(null)}catch(I){u.current&&d.current===z&&o.current===B&&N(Yh(I))}finally{u.current&&d.current===z&&o.current===B&&(f.current=!1,S(null))}},[n,t,e,M,N]),q=g.useCallback(async()=>{const P=v.current;if(!u.current||!P||f.current)return;const B=n,z=d.current;m.current+=1,f.current=!0,S("Opening in Desktop"),N(null);try{const I=await IF(P,{close:A=>xe.closeRuntimeBrowser(t,e,A).then(()=>{}),open:A=>xe.openRuntimeBrowser(t,e,A),createPage:(A,$)=>xe.createRuntimeBrowserPage(t,e,A,$),activatePage:(A,$)=>xe.activateRuntimeBrowserPage(t,e,A,$),onProgress:A=>{u.current&&d.current===z&&o.current===B&&(M(A),S("Restoring browser tabs"))}});return u.current&&d.current===z&&o.current===B?(M(I),(I.executionBackend!=="embedded-electron"||!I.capabilities.includes(hy))&&N("Desktop Browser Host is unavailable; using streamed browser"),I):void 0}catch(I){const A=await xe.getRuntimeBrowserState(t,e).catch(()=>{});u.current&&d.current===z&&o.current===B&&(A!==void 0&&M(A),N(Yh(I)));return}finally{u.current&&d.current===z&&o.current===B&&(f.current=!1,S(null),C(!1))}},[n,t,e,M,N]);return{browser:y,loading:w,pendingAction:E,error:k,currentError:()=>p.current,disabled:E!==null||(y==null?void 0:y.status)!=="ready",createDisabled:E!==null,load:D,openBrowser:G,closeBrowser:Z,recreateForDesktop:q,createPage:()=>L("Creating page",P=>xe.createRuntimeBrowserPage(t,e,P)),closePage:P=>L("Closing page",B=>xe.closeRuntimeBrowserPage(t,e,B,P)),activatePage:P=>L("Switching page",B=>xe.activateRuntimeBrowserPage(t,e,B,P)),navigatePage:(P,B)=>L("Navigating",z=>xe.navigateRuntimeBrowserPage(t,e,z,P,B)),backPage:P=>L("Going back",B=>xe.backRuntimeBrowserPage(t,e,B,P)),forwardPage:P=>L("Going forward",B=>xe.forwardRuntimeBrowserPage(t,e,B,P)),reloadPage:P=>L("Reloading page",B=>xe.reloadRuntimeBrowserPage(t,e,B,P))}}const wX=2500,Su=new Map;function SX({sessionId:e,runtimeSelector:t,active:r,polling:i=r,devicesActive:n=!1}){const o=`${t}
689
+ ${e}`,[u,d]=g.useState(()=>Su.get(o)??null),[m,f]=g.useState([]),[v,p]=g.useState(()=>!Su.has(o)),[y,b]=g.useState(!1),[w,C]=g.useState(!1),[E,S]=g.useState(null),k=g.useRef(0),j=g.useRef(0),N=g.useRef(!1),M=g.useRef(!1),D=g.useRef(!1),H=g.useRef(null);H.current=u;const L=g.useCallback(I=>{H.current=I,Su.set(o,I),d(I)},[o]),G=g.useCallback(async()=>{if(N.current)return;const I=k.current,A=j.current;M.current||p(!0);try{const $=await xe.getSessionEmulator(t,e);if(k.current!==I||j.current!==A||N.current)return;L($),S(null)}catch($){if(k.current!==I||j.current!==A||N.current)return;S(p_($))}finally{k.current===I&&j.current===A&&!N.current&&(M.current=!0,p(!1))}},[t,e,L]),Z=g.useCallback(async()=>{if(N.current)return;const I=k.current,A=j.current;b(!0);try{const $=await xe.listSessionEmulatorDevices(t,e);if(k.current!==I||j.current!==A||N.current)return;f($),S(null)}catch($){if(k.current!==I||j.current!==A||N.current)return;S(p_($))}finally{k.current===I&&j.current===A&&!N.current&&(D.current=!0,b(!1))}},[t,e]);g.useEffect(()=>{k.current+=1;const I=Su.has(o);L(Su.get(o)??null),f([]),S(null),p(!I),b(!1),C(!1),N.current=!1,M.current=I,D.current=!1,G()},[r,G,o,L]),g.useEffect(()=>{if(!i)return;const I=window.setInterval(()=>void G(),wX);return()=>window.clearInterval(I)},[r,i,G]),g.useEffect(()=>{!n||v||w||u||D.current||Z()},[r,u,n,v,w,Z]);const q=g.useCallback(async(I,A)=>{const $=k.current,U=++j.current;N.current=!0,C(!0),S(null);try{const F=await I();return k.current!==$||j.current!==U?null:(A==null||A(F),F)}catch(F){throw k.current===$&&j.current===U&&S(p_(F)),F}finally{k.current===$&&j.current===U&&(N.current=!1,C(!1))}},[]),P=g.useCallback(I=>q(()=>xe.attachSessionEmulator(t,e,I),A=>L(A)),[q,t,e]),B=g.useCallback(async()=>{const I=H.current;return I?await q(()=>xe.detachSessionEmulator(t,e,I.bindingId),()=>L(null))!==null:!1},[q,t,e]),z=g.useCallback(async I=>{const A=H.current;if(!A)throw new Error("This Session has no Emulator attached");await q(()=>I(A))},[q]);return{binding:u,devices:m,loading:v,devicesLoading:y,mutating:w,error:E,reload:G,reloadDevices:Z,attach:P,detach:B,tap:(I,A)=>z($=>xe.tapSessionEmulator(t,e,$.bindingId,I,A)),gesture:I=>z(A=>xe.gestureSessionEmulator(t,e,A.bindingId,I)),button:I=>z(A=>xe.buttonSessionEmulator(t,e,A.bindingId,I))}}function p_(e){return e instanceof Error?e:new Error(String(e))}const XT="rynx.session-resource-dock-width";function CX({session:e,runtimeSelector:t,leadingControls:r,initialDraft:i,initialMessage:n,sendInitialMessage:o=!1,onInitialMessageStarted:u,onInitialMessageConsumed:d,onInitialMessageFailed:m,terminalSetup:f}){var cr,Ki,Wr,Vr,pn,_i;const[v,p]=YL(),y=v.get("view"),b=y==="terminal"?"terminal":"chat",w=YH(v.get("surface")),C=v.get("panel")==="resources",E=y==="browser"||w!==null||C,S=(w==null?void 0:w.type)==="browser"?w.pageId:null,k=g.useRef(null),j=g.useRef(null),N=g.useRef("browser"),M=g.useRef(null),D=g.useRef(0),H=g.useRef(null),[L]=g.useState(EX),G=g.useRef(L),Z=g.useRef(null),q=g.useRef(null),P=g.useRef(null),B=g.useRef(null),z=g.useRef(null),I=g.useRef(null),A=g.useRef(!1),[$,U]=g.useState(!1),[F,W]=g.useState(!1),[T,V]=g.useState(null),[K,J]=g.useState(Ru),[oe,ce]=g.useState(!1),[Y,ne]=g.useState(!1),[de,Ae]=g.useState([]),[ke,Ee]=g.useState(!!n),re=g.useRef(null),{state:te,pendingSend:Ce,current:me,send:je,stop:We}=dF(e.id,{runtimeSelector:t,allowSend:!0}),Te=bX({sessionId:e.id,runtimeSelector:t,active:!0,polling:E}),ze=SX({sessionId:e.id,runtimeSelector:t,active:!0,polling:E,devicesActive:(w==null?void 0:w.type)==="emulator"}),Se=g.useMemo(()=>KH(Te.browser,S,k.current),[Te.browser,S]),Ue=lF(Ce,te.runStatus==="running"||te.waitingForInteraction,me,e.status==="running"),Gt=e.agent??(e.provider?Zu(e.provider):void 0),wt=(cr=WH(te))==null?void 0:cr.model,Re=g.useMemo(()=>VH(te.items),[te.items]),Ve=g.useMemo(()=>!n||Re.length>0?Re:[{kind:"message",id:"optimistic_initial",responseId:"optimistic_initial",role:"user",text:n,images:[],streaming:!1,optimistic:!0}],[n,Re]),gt=te.waitingForInteraction||te.runStatus==="running"&&te.statusKind!=="startup",mt=te.statusKind==="startup"||!gt&&(Ce||ke),kt=((Ki=Te.browser)==null?void 0:Ki.pages)??[],ut=(w==null?void 0:w.type)==="emulator"||$,nr=Te.loading||ze.loading,qr=kt.length>0||ut,ii=g.useMemo(()=>[...kt.map(_e=>Js(_e.pageId)),...ut?[en()]:[]],[kt,ut]),ar=g.useMemo(()=>n2(de,ii),[ii,de]);g.useEffect(()=>{Ae(_e=>{const Oe=n2(_e,ii);return kX(_e,Oe)?_e:Oe})},[ii]),g.useEffect(()=>{const _e=H.current;if(!_e)return;const Oe=()=>{const at=_e.getBoundingClientRect().width,vt=Gh(at,Number.POSITIVE_INFINITY);J(vt);const xi=G.current,Hs=Gh(at,xi??at*s2);xi!==null&&_e.style.setProperty("--session-resource-dock-width",`${Hs}px`),Z.current=Hs,V(Hs)};Oe();const Qe=new ResizeObserver(Oe);return Qe.observe(_e),()=>Qe.disconnect()},[]),g.useEffect(()=>()=>{var _e;P.current!==null&&window.cancelAnimationFrame(P.current),(_e=z.current)==null||_e.call(z),rE(I)},[]),g.useEffect(()=>{k.current=null,j.current=null,N.current="browser",M.current=null,U(!1),ne(!1),Ae([]),D.current+=1},[t,e.id]),g.useEffect(()=>{if(!n||!o||re.current===n)return;re.current=n,Ee(!0),u==null||u(),je(n).catch(Oe=>{Ee(!1),Im(Oe)&&(m==null||m(n))})},[n,m,u,je,o]),g.useEffect(()=>{!n||!Re.some(Oe=>Oe.kind==="message"&&Oe.role==="user"&&Oe.optimistic!==!0&&Oe.text===n)||(Ee(!1),d==null||d())},[n,d,Re]);const St=(_e,Oe=!0)=>{Oe&&(D.current+=1);const Qe=new URLSearchParams(v);_e?(Qe.set("surface",_e),Qe.delete("panel")):(Qe.delete("surface"),Qe.set("panel","resources")),Qe.get("view")==="browser"&&Qe.set("view","chat"),p(Qe,{replace:!0})},or=()=>{D.current+=1,ne(!1);const _e=new URLSearchParams(v);_e.delete("surface"),_e.delete("panel"),_e.get("view")==="browser"&&_e.set("view","chat"),p(_e,{replace:!0})},Ar=()=>{if(N.current==="emulator"&&$){St(en(M.current));return}if(k.current){St(Js(k.current));return}if($){St(en(M.current));return}St(null)};g.useEffect(()=>{w&&(N.current=w.type,w.type==="emulator"&&U(!0))},[w==null?void 0:w.type]),g.useEffect(()=>{var Oe;const _e=((Oe=ze.binding)==null?void 0:Oe.bindingId)??null;_e&&(M.current&&_e!==M.current?U(!0):M.current||U(!0),M.current=_e)},[(Wr=ze.binding)==null?void 0:Wr.bindingId]),g.useEffect(()=>{if(y!=="browser")return;const _e=new URLSearchParams(v);_e.set("view","chat"),_e.set("surface",Js(Se)),_e.delete("panel"),p(_e,{replace:!0})},[y,v,Se,p]),g.useEffect(()=>{if((w==null?void 0:w.type)!=="browser")return;Se&&(k.current=Se);const _e=Js(Se);if(v.get("surface")===_e)return;const Oe=new URLSearchParams(v);Oe.set("surface",_e),p(Oe,{replace:!0})},[w==null?void 0:w.type,v,Se,p]),g.useEffect(()=>{const _e=kt.map(Qe=>Qe.pageId),Oe=XH(j.current,Te.browser);j.current=_e,!(!Oe||(w==null?void 0:w.type)!=="browser")&&(k.current=Oe,St(Js(Oe),!1))},[kt,Te.browser,w==null?void 0:w.type]),g.useEffect(()=>{var Qe;if((w==null?void 0:w.type)!=="emulator")return;const _e=en((Qe=ze.binding)==null?void 0:Qe.bindingId);if(v.get("surface")===_e)return;const Oe=new URLSearchParams(v);Oe.set("surface",_e),p(Oe,{replace:!0})},[(Vr=ze.binding)==null?void 0:Vr.bindingId,w==null?void 0:w.type,v,p]),g.useEffect(()=>{var _e,Oe;if(!(!E||nr)){if(!qr){w&&St(null,!1);return}(w==null?void 0:w.type)==="browser"&&Se||(w==null?void 0:w.type)==="emulator"&&ut||(N.current==="emulator"&&ut?St(en((_e=ze.binding)==null?void 0:_e.bindingId),!1):Se?St(Js(Se),!1):ut&&St(en((Oe=ze.binding)==null?void 0:Oe.bindingId),!1))}},[(pn=ze.binding)==null?void 0:pn.bindingId,ut,qr,w==null?void 0:w.type,E,nr,Se]);const Ai=async()=>{var Oe,Qe;if(A.current)return;A.current=!0,W(!0);const _e=D.current;try{const at=((Oe=Te.browser)==null?void 0:Oe.status)==="ready"?await Te.createPage():await Te.openBrowser(),vt=(at==null?void 0:at.activePageId)??((Qe=at==null?void 0:at.pages.at(-1))==null?void 0:Qe.pageId);if(!at){ve.error(`Could not create Browser tab: ${Te.currentError()??"Browser is unavailable"}`);return}vt&&D.current===_e&&St(Js(vt),!1)}finally{A.current=!1,W(!1)}},yt=_e=>{const Oe=H.current;if(!Oe)return null;const Qe=Gh(Oe.getBoundingClientRect().width,_e);return Oe.style.setProperty("--session-resource-dock-width",`${Qe}px`),Z.current=Qe,Qe},lr=_e=>{const Oe=H.current;return Oe?yt(Oe.getBoundingClientRect().right-_e):null},ci=_e=>{if(_e!==null){G.current=_e,V(_e);try{window.localStorage.setItem(XT,String(Math.round(_e)))}catch{}}},Yi=_e=>{B.current=_e,P.current===null&&(P.current=window.requestAnimationFrame(()=>{P.current=null;const Oe=B.current;B.current=null,Oe!==null&&lr(Oe)}))},mr=(_e,Oe,Qe)=>{var vt;if(q.current!==Oe)return;P.current!==null&&(window.cancelAnimationFrame(P.current),P.current=null),B.current=null;const at=Qe===void 0?Z.current:lr(Qe);ci(at),q.current=null,(vt=z.current)==null||vt.call(z),z.current=null,_e.hasPointerCapture(Oe)&&_e.releasePointerCapture(Oe),rE(I),ce(!1)},He=_e=>{var Hs;if(_e.button!==0)return;_e.preventDefault(),(Hs=z.current)==null||Hs.call(z),q.current=_e.pointerId;const Oe=_e.currentTarget;Oe.setPointerCapture(_e.pointerId);const Qe=gn=>{q.current===gn.pointerId&&Yi(gn.clientX)},at=gn=>{mr(Oe,gn.pointerId,gn.clientX)},vt=gn=>{mr(Oe,gn.pointerId)};window.addEventListener("pointermove",Qe,!0),window.addEventListener("pointerup",at,!0),window.addEventListener("pointercancel",vt,!0),z.current=()=>{window.removeEventListener("pointermove",Qe,!0),window.removeEventListener("pointerup",at,!0),window.removeEventListener("pointercancel",vt,!0)};const xi=document.documentElement.style;I.current={cursor:xi.cursor,userSelect:xi.userSelect},xi.cursor="col-resize",xi.userSelect="none",ce(!0),lr(_e.clientX)},Tt=_e=>{const Oe=H.current;if(!Oe)return;const Qe=Z.current??Gh(Oe.getBoundingClientRect().width,Oe.getBoundingClientRect().width*s2),at=_e.shiftKey?32:16;let vt=null;_e.key==="ArrowLeft"&&(vt=Qe+at),_e.key==="ArrowRight"&&(vt=Qe-at),_e.key==="Home"&&(vt=0),_e.key==="End"&&(vt=Number.POSITIVE_INFINITY),vt!==null&&(_e.preventDefault(),ci(yt(vt)))},Ct=_e=>{D.current+=1;const Oe=new URLSearchParams(v);Oe.set("view",_e),p(Oe,{replace:!0})},It=l.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":b==="chat"?"Open terminal":"Open chat",title:b==="chat"?"Open terminal":"Open chat",onClick:()=>Ct(b==="chat"?"terminal":"chat"),children:b==="chat"?l.jsx(_6,{}):l.jsx(pO,{})}),Rt=l.jsx(ue,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":E?"Hide Session resources":"Show Session resources",title:E?"Hide Session resources":"Show Session resources",onClick:E?or:Ar,children:E?l.jsx(TO,{}):l.jsx(DO,{})}),Mt=l.jsx(ue,{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:()=>ne(_e=>!_e),children:Y?l.jsx(o6,{}):l.jsx(B4,{})});return l.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:l.jsxs("div",{ref:H,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??Gt??"session"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[It,!E&&Rt]})]}),l.jsxs(mA,{value:b,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[l.jsxs(Qu,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[l.jsx(YK,{todos:te.todos}),l.jsx(xX,{items:Ve,historyLoaded:te.historyLoaded,running:Ue,startingUp:mt,waitingForInteraction:te.waitingForInteraction,queueStatus:te.statusKind==="queue"?te.note:void 0,sessionId:e.id,runtimeSelector:t}),l.jsx(cq,{initialDraft:i,model:wt,running:Ue,sessionId:e.id,runtimeSelector:t,onSend:je,onStop:We})]}),l.jsx(Qu,{value:"terminal",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:l.jsx(BK,{sessionId:e.id,runtimeSelector:t,active:b==="terminal",setup:f})})]})]}),E&&l.jsxs(l.Fragment,{children:[!Y&&l.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(Ru,K),"aria-valuemax":K,"aria-valuenow":Math.round(T??Ru),"aria-valuetext":`${Math.round(T??Ru)} 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:He,onKeyDown:Tt,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)] ${oe?"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:[qr&&l.jsx(dq,{pages:kt,order:ar,selectedPageId:(w==null?void 0:w.type)==="browser"?Se:null,selectionDisabled:Te.pendingAction!==null,mutationDisabled:Te.disabled,createDisabled:Te.createDisabled||F,createPending:F,emulatorAttached:!!ze.binding,emulator:ut?{selected:(w==null?void 0:w.type)==="emulator",label:((_i=ze.binding)==null?void 0:_i.deviceName)??"Emulator",busy:ze.loading||ze.mutating}:null,onSelectPage:_e=>{var Oe;k.current=_e,St(Js(_e)),((Oe=Te.browser)==null?void 0:Oe.status)==="ready"&&Te.activatePage(_e)},onClosePage:_e=>{D.current+=1,k.current===_e&&(k.current=null),Te.closePage(_e)},onCreatePage:()=>void Ai(),onSelectEmulator:()=>{var _e;U(!0),St(en((_e=ze.binding)==null?void 0:_e.bindingId))},onCloseEmulator:()=>{U(!1),N.current="browser",St(Se?Js(Se):null)},onAddEmulator:()=>{var _e;U(!0),St(en((_e=ze.binding)==null?void 0:_e.bindingId))},headerLeadingAction:Y?r:void 0,leadingAction:Mt,trailingAction:Rt}),!qr&&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:[Mt,Rt]})]}),qr?(w==null?void 0:w.type)==="emulator"?l.jsx(vq,{sessionId:e.id,runtimeSelector:t,controller:ze}):(w==null?void 0:w.type)==="browser"?l.jsx(iq,{sessionId:e.id,runtimeSelector:t,pageId:Se,browserResource:Te}):l.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[l.jsx($e,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),l.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):l.jsx(RX,{browserBusy:Te.createDisabled||F,emulatorBusy:ze.mutating,onOpenBrowser:()=>void Ai(),onOpenEmulator:()=>{var _e;U(!0),St(en((_e=ze.binding)==null?void 0:_e.bindingId))}})]})]})]})})}function EX(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(XT));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function rE(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 kX(e,t){return e.length===t.length&&e.every((r,i)=>r===t[i])}function RX({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($e,{className:"size-4 shrink-0 animate-spin"}):l.jsx($u,{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($e,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Xl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Emulator"})]})]})})}const NX=400,jX=160;function AX({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:i,loading:n,selectedId:o,onCollapsedChange:u,onSelect:d,onNew:m,onRetry:f,onFork:v,onDeleted:p}){const[y,b]=g.useState(""),w=y.trim().toLocaleLowerCase(),C=g.useMemo(()=>w?e.filter(S=>[S.title,S.id,S.provider,S.provider?Zu(S.provider):void 0,S.agent,S.source].some(k=>k==null?void 0:k.toLocaleLowerCase().includes(w))):e,[w,e]);async function E(S){try{await xe.closeSession(S,t)}catch(k){ve.error(`Delete session failed: ${k instanceof Error?k.message:String(k)}`);return}p(S)}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(Da,{to:La(t),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[l.jsx("img",{src:Wf,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(ue,{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(NO,{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(qE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(At,{value:y,onChange:S=>b(S.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),l.jsx(ue,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:l.jsx(ri,{})})]})]}),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(ue,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:f,children:"Retry"})]}),l.jsx(vs,{className:"min-h-0 flex-1",children:n&&e.length===0?l.jsx(MX,{}):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(ue,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[l.jsx(ri,{})," New session"]})]}):C.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",y.trim(),"”."]}):l.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:C.map(S=>l.jsx(TX,{session:S,runtimeLabel:r,selected:o===S.id,onSelect:()=>d(S.id),onFork:()=>v(S.id),onDelete:()=>E(S.id)},S.id))})})]})}function TX({session:e,runtimeLabel:t,selected:r,onSelect:i,onFork:n,onDelete:o}){const[u,d]=g.useState(!1),[m,f]=g.useState(!1),[v,p]=g.useState(!1),[y,b]=g.useState(!1),w=g.useRef(null),C=g.useRef(null),E=DX(e.updatedAt??e.createdAt),S=e.agent??(e.provider?Zu(e.provider):void 0),k=e.title??S??e.source??"Untitled session";g.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current),C.current!==null&&window.clearTimeout(C.current)},[]);const j=()=>{w.current!==null&&(window.clearTimeout(w.current),w.current=null)},N=()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null)},M=()=>{j(),N(),!v&&f(!0)},D=()=>{N(),!(v||m||w.current!==null)&&(w.current=window.setTimeout(()=>{w.current=null,f(!0)},NX))},H=()=>{j(),N(),f(!1)},L=()=>{j(),N(),m&&(C.current=window.setTimeout(()=>{C.current=null,f(!1)},jX))};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:D,onMouseLeave:L,children:[l.jsxs(L_,{modal:!1,open:m,onOpenChange:G=>{G?M():H()},children:[l.jsx(Hf,{asChild:!0,children:l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),l.jsxs(Ff,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${k}`,onMouseEnter:M,onMouseLeave:L,onOpenAutoFocus:G=>G.preventDefault(),onCloseAutoFocus:G=>G.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:k}),l.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:E})]}),l.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[S&&l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${S}`,children:[l.jsx(o0,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 truncate",children:S})]}),l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[l.jsx(o4,{"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(U4,{"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:M,onBlur:L,children:l.jsx("span",{className:"block truncate text-sm font-medium",children:k})}),l.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:H,onMouseLeave:D,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($e,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),l.jsxs(L_,{open:v,onOpenChange:G=>{p(G),G&&H()},children:[l.jsx(Hf,{asChild:!0,children:l.jsx(ue,{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 ${k}`,"aria-label":`Session actions for ${k}`,children:l.jsx(M4,{})})}),l.jsxs(Ff,{align:"end",children:[l.jsxs(Wu,{disabled:y||e.status==="running",onSelect:()=>{b(!0),n().finally(()=>b(!1))},children:[y?l.jsx($e,{className:"animate-spin motion-reduce:animate-none"}):l.jsx(X4,{}),"Fork session"]}),l.jsxs(Wu,{variant:"destructive",onSelect:()=>d(!0),children:[l.jsx(qa,{}),"Delete session"]})]})]}),l.jsx(_s,{open:u,onOpenChange:d,children:l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsx(Wi,{children:"Delete this session?"}),l.jsxs(Vi,{children:["“",k,"” will be deleted from ",t,". This cannot be undone."]})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:()=>void o(),children:"Delete"})]})]})})]})]})}function MX(){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 DX(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)}const g_="!no-project",iE="!new-project";function LX({runtimeLabel:e,options:t,selection:r,projects:i,projectId:n,loading:o,projectsLoading:u,submitting:d,error:m,projectError:f,listCollapsed:v,onShowSessions:p,onRetryOptions:y,onSelectionChange:b,onProjectChange:w,onNewProject:C,onSubmit:E}){const[S,k]=g.useState(""),j=g.useRef(null),N=g.useRef(!1),M=g.useRef(void 0),D=bA({policy:lx,onChange:()=>{M.current=void 0}}),H=J_(r,t),L=n?i.find(q=>q.id===n):void 0,G=!!((S.trim()||D.images.length>0)&&r&&!o&&!d&&!D.hasPending&&!D.hasFailed);async function Z(){const q=S.trim();if(!q&&D.images.length===0||!r||o||d||D.hasPending||D.hasFailed)return;const P=D.images.length>0?M.current??Ju("msg"):void 0;P&&(M.current=P),await E({text:q,images:D.readyUploads,...P?{clientMessageId:P}:{}})&&(D.clear(),k(""),M.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:[v&&l.jsx(ue,{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:p,title:"Show session list","aria-label":"Show session list",children:l.jsx(HE,{className:"size-3.5"})}),l.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),l.jsx(vs,{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(ue,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:p,children:[l.jsx(jo,{})," 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:j,onSubmit:q=>{q.preventDefault(),Z()},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":d,children:[l.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),l.jsx(wA,{images:D.images,disabled:d,onRemove:D.remove,className:"px-5 pt-4"}),l.jsx(Am,{id:"session-initial-prompt",value:S,disabled:d,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:q=>{M.current=void 0,k(q.target.value)},onPaste:D.onPaste,onCompositionStart:()=>{N.current=!0},onCompositionEnd:()=>{N.current=!1},onKeyDown:q=>{var P;q.key!=="Enter"||q.shiftKey||N.current||q.nativeEvent.isComposing||q.keyCode===229||(q.preventDefault(),(P=j.current)==null||P.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(SA,{policy:lx,imageCount:D.images.length,disabled:d,onFiles:D.addFiles}),l.jsx("label",{htmlFor:"session-project",className:"sr-only",children:"Project"}),l.jsxs(Gu,{value:n?`project:${n}`:g_,disabled:u||d,onValueChange:q=>{if(q===iE){C();return}w(q===g_?null:q.startsWith("project:")?q.slice(8):null)},children:[l.jsx(ec,{id:"session-project",className:"h-11 w-[min(100%,14rem)] bg-[var(--background)] md:h-9 md:w-48","aria-label":"Project",children:l.jsx(Jl,{placeholder:u?"Loading projects…":"Choose project",children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[L?l.jsx(Uu,{className:"size-3.5 shrink-0 text-[var(--primary)]"}):l.jsx(PS,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate",children:(L==null?void 0:L.name)??"No project"})]})})}),l.jsxs(tc,{align:"start",children:[i.length>0&&l.jsxs(ff,{children:[l.jsxs(mf,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:["Projects on ",e]}),i.map(q=>l.jsx(Ui,{value:`project:${q.id}`,textValue:q.name,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Uu,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),l.jsx("span",{className:"truncate",children:q.name})]})},q.id))]}),i.length>0&&l.jsx(Bm,{}),l.jsx(Ui,{value:iE,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(PS,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"New project"})]})}),l.jsx(Ui,{value:g_,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(cn,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"No project"})]})})]})]}),l.jsx("label",{htmlFor:"session-launch-target",className:"sr-only",children:"Run with"}),l.jsxs(Gu,{value:r?dA(r):"",disabled:o||d,onValueChange:q=>{const P=hA(q);P&&b(P)},children:[l.jsx(ec,{id:"session-launch-target",className:"h-11 w-[min(100%,17rem)] bg-[var(--background)] md:ml-auto md:h-9 md:w-56","aria-label":"Run with",children:l.jsx(Jl,{placeholder:o?"Loading…":"Choose how to run",children:H&&l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate",children:H.name}),l.jsx(v_,{status:Pv(H)})]})})}),l.jsxs(tc,{align:"end",children:[t.providers.length>0&&l.jsxs(ff,{children:[l.jsx(mf,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers"}),t.providers.map(q=>l.jsx(Ui,{value:`provider:${q.id}`,textValue:q.name,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(v_,{status:Pv(q)}),l.jsx("span",{children:q.name})]})},`provider:${q.id}`))]}),t.agents.length>0&&l.jsxs(ff,{children:[l.jsx(mf,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),t.agents.map(q=>l.jsx(Ui,{value:`agent:${q.id}`,textValue:q.name??q.id,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(v_,{status:Pv(q)}),l.jsx("span",{children:q.name??q.id})]})},`agent:${q.id}`))]})]})]}),l.jsx(ue,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!G,"aria-label":d?"Starting session":"Start session",children:d?l.jsx($e,{className:"animate-spin"}):l.jsx(WE,{})})]})]}),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:m||f?"alert":"status","aria-live":m||f?"assertive":"polite",children:[l.jsx("span",{children:m??f??(H&&!H.ready?`${H.reason??`${H.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:"")}),m&&t.providers.length===0&&t.agents.length===0&&!o&&l.jsx(ue,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:y,children:"Retry"})]}),l.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function v_({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 __(){const e=Fa(),{sessionId:t}=jE(),{runtimeSelector:r,selectedRuntime:i}=dc(),{status:n,operation:o}=uy(),u=RH(n,o),[d,m]=g.useState([]),[f,v]=g.useState({providers:[],agents:[]}),[p,y]=g.useState(null),[b,w]=g.useState([]),[C,E]=g.useState(null),[S,k]=g.useState(!0),[j,N]=g.useState(!0),[M,D]=g.useState(),[H,L]=g.useState(),[G,Z]=g.useState(),[q,P]=g.useState(!0),[B,z]=g.useState(!1),[I,A]=g.useState(!1),[$,U]=g.useState(!1),[F,W]=g.useState(),[T,V]=g.useState(),K=g.useRef(!1),J=g.useRef(0),oe=g.useRef(0),ce=g.useRef(0),Y=g.useRef(0),ne=g.useRef(void 0),de=g.useRef(r),Ae=g.useRef(r),ke=g.useRef(u);ke.current=u;const Ee=g.useRef({selector:r});Ee.current.selector!==r&&(Ee.current={selector:r});const re=Ee.current,te=t??null,Ce=g.useRef(te);g.useEffect(()=>()=>{Y.current+=1},[]),g.useEffect(()=>{Ce.current!==te&&(Ce.current=te,Y.current+=1)},[te]);const me=g.useCallback(async(Re=!1)=>{if(ke.current)return;const Ve=++J.current;Re&&P(!0);try{const gt=await xe.listSessions(r);if(J.current!==Ve)return;de.current=r,m(gt),Z(void 0)}catch(gt){if(J.current!==Ve||ke.current)return;Z(`Could not load sessions: ${gt.message}`)}finally{J.current===Ve&&P(!1)}},[r]);g.useEffect(()=>{Ae.current!==r&&(Ae.current=r,ne.current=void 0,ce.current+=1,J.current+=1,m([]),w([]),E(null),L(void 0),N(!0),Z(void 0),P(!0))},[r]);const je=g.useCallback(async()=>{if(ke.current)return;const Re=++ce.current;N(!0),L(void 0);try{const Ve=await xe.listProjects(r);if(ce.current!==Re)return;w(Ve),E(gt=>gt&&Ve.some(mt=>mt.id===gt)?gt:null)}catch(Ve){if(ce.current!==Re||ke.current)return;w([]),E(null),L(`Could not load projects: ${Ve.message}`)}finally{ce.current===Re&&N(!1)}},[r]);g.useEffect(()=>{if(u){J.current+=1,Z(void 0),P(!1);return}me(!0);const Re=setInterval(()=>void me(),4e3);return()=>clearInterval(Re)},[me,u]);const We=g.useCallback(async()=>{if(ke.current)return;const Re=++oe.current;k(!0),D(void 0);try{let Ve;try{Ve=await xe.listSessionLaunchOptions(r)}catch(mt){if(!(mt instanceof Co)||mt.code!=="incompatible"&&mt.code!=="method_not_found")throw mt;Ve=OH(await xe.listSessionAgentOptions(r))}if(oe.current!==Re)return;const gt=TH(r,typeof window>"u"?void 0:window.localStorage);v(Ve),y(AH(Ve,gt))}catch(Ve){if(oe.current!==Re||ke.current)return;v({providers:[],agents:[]}),y(null),D(`Could not load launch options: ${Ve.message}`)}finally{oe.current===Re&&k(!1)}},[r]);g.useEffect(()=>{if(u){oe.current+=1,D(void 0),k(!1);return}return v({providers:[],agents:[]}),y(null),k(!0),D(void 0),A(!1),W(void 0),V(void 0),We(),()=>{oe.current+=1}},[We,u]),g.useEffect(()=>{if(u){ce.current+=1,L(void 0),N(!1);return}return w([]),E(null),N(!0),L(void 0),je(),()=>{ce.current+=1}},[je,u]);const Te=g.useCallback(async Re=>{var St,or;if(K.current)return!1;const Ve=Re.text,gt=p;if(!gt)return D("Choose a provider or Agent before starting."),!1;const mt=J_(gt,f);if(!mt)return D("Choose a provider or Agent before starting."),!1;const kt=!mt.ready&&mt.readiness!=="unverified";if(kt&&Re.images.length>0)return D(`${mt.name} must finish login or first-run setup before starting with images.`),!1;const ut=Ee.current,nr=i.displayName,qr=++Y.current,ii=LH(Ve||((St=Re.images[0])==null?void 0:St.file.name)||"Image");let ar;K.current=!0,U(!0),D(void 0);try{const Ar=ne.current,yt=Ar&&Ar.selector===ut.selector&&Ar.selection.kind===gt.kind&&Ar.selection.id===gt.id&&Ar.projectId===C?Ar.sessionId:(await xe.createSession(DH(gt,ii,C??void 0),ut.selector)).sessionId;if(ar=yt,ne.current={selector:ut.selector,selection:gt,projectId:C,sessionId:yt},!kt&&Re.images.length===0){const Ct=new Date().toISOString(),It=gt.kind==="agent"?(or=f.agents.find(cr=>cr.id===gt.id))==null?void 0:or.runtime:void 0,Rt=gt.kind==="provider"?gt.id:OX(It)?It:void 0,Mt={id:yt,...Rt?{provider:Rt}:{},title:ii,status:"running",createdAt:Ct,updatedAt:Ct,source:"console"};return de.current=ut.selector,m(cr=>[Mt,...cr.filter(Ki=>Ki.id!==yt)]),V({sessionId:yt,message:Ve,started:!1}),A(!1),ne.current=void 0,e($l(ut.selector,yt)),!0}let lr,ci=!1,Yi=!1;if(kt)try{await xe.enqueueSessionMessage(ut.selector,yt,Ve),ci=!0}catch(Ct){lr=Ct}else try{if(!(await xe.getSessionResourcePolicy(ut.selector,yt)).enabled)throw new Co("Session image resources are unavailable on this Runtime",409,"failed_precondition","not_started");const It=await Promise.all(Re.images.map(Rt=>xe.uploadSessionResource(ut.selector,yt,Rt.file,Rt.clientUploadId)));Yi=!0,await xe.sendSessionMessage(yt,{content:[...It.map(Rt=>({type:"input_image",resourceId:Rt.resourceId,mediaType:Rt.mediaType,...Rt.filename?{filename:Rt.filename}:{},...Rt.byteLength?{byteLength:Rt.byteLength}:{},...Rt.width?{width:Rt.width}:{},...Rt.height?{height:Rt.height}:{}})),...Ve?[{type:"input_text",text:Ve}]:[]],clientMessageId:Re.clientMessageId},()=>{},void 0,ut.selector)}catch(Ct){lr=Ct}const mr=!!(!ci&&(Re.images.length>0&&!Yi&&lr||Im(lr)));if(Ee.current!==ut)return ne.current=void 0,lr?mr?ve.error(`Session created on ${nr}, but the first message was not sent: ${lr.message}`):ve.warning(`Session created on ${nr}, but message delivery is unknown. Check its history before retrying.`):ve.success(`Session started on ${nr}; switch back to view it.`),!0;if(Y.current!==qr)return ne.current=void 0,lr?mr?ve.error(`Session created on ${nr}, but the first message was not sent. Open it to retry.`):ve.warning(`Session created on ${nr}, but message delivery is unknown. Check its history before retrying.`):ve.success(`Session started on ${nr} in the background.`),!0;if(Re.images.length>0&&mr)return D(`Session created, but the first image message was not sent: ${lr.message}. Retry will reuse this Session.`),me(),!1;const He=new Date().toISOString(),Tt={id:yt,...gt.kind==="provider"?{provider:gt.id}:{agent:gt.id},title:ii,status:mr?"idle":"running",createdAt:He,updatedAt:He,source:"console",...ci?{setupStatus:"waiting_for_provider"}:{}};return de.current=ut.selector,m(Ct=>[Tt,...Ct.filter(It=>It.id!==yt)]),W(mr?{sessionId:yt,message:Ve}:void 0),A(!1),ne.current=void 0,e(ci?`${$l(ut.selector,yt)}?view=terminal`:$l(ut.selector,yt)),me(),ci?ve.info(`${mt.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):lr&&(mr?ve.error(`Session created, but the first message was not sent: ${lr.message}`):ve.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(Ar){const Ai=Ar instanceof Co&&Ar.outcome==="unknown",yt=ar?`Session created, but its first message was not sent: ${Ar.message}. Retry will reuse this Session.`:Ai?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${Ar.message}`;return Ee.current===ut&&Y.current===qr?D(yt):Ai?ve.warning(`Session creation on ${nr} may have succeeded. Check its Session list before retrying.`):ve.error(`Could not start Session on ${nr}: ${Ar.message}`),!ar&&Ai?(ne.current=void 0,!0):!1}finally{K.current=!1,U(!1)}},[f,p,e,C,me,i.displayName]),ze=de.current===r?d:[],Se=ze.find(Re=>Re.id===te)??null,Ue=Se?J_(Se.provider?{kind:"provider",id:Se.provider}:Se.agent?{kind:"agent",id:Se.agent}:null,f):null,Gt=(Se==null?void 0:Se.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(Ue==null?void 0:Ue.name)??(Se.provider?Zu(Se.provider):Se.agent)}:Se&&(Se.setupStatus==="waiting_for_provider"||(Ue==null?void 0:Ue.ready)===!1)?{kind:"required",target:(Ue==null?void 0:Ue.name)??(Se.provider?Zu(Se.provider):Se.agent),taskQueued:Se.setupStatus==="waiting_for_provider",...Ue!=null&&Ue.reason?{reason:Ue.reason}:{}}:void 0;g.useEffect(()=>{(F==null?void 0:F.sessionId)===(Se==null?void 0:Se.id)&&W(void 0)},[F,Se==null?void 0:Se.id]);const wt=Se?l.jsxs("div",{className:qe("flex shrink-0 items-center gap-1",B&&"desktop-macos-titlebar-leading-inset"),children:[l.jsx(ue,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{A(!0),e(La(r),{replace:!0})},children:l.jsx(jo,{})}),B&&l.jsx(ue,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>z(!1),children:l.jsx(HE,{className:"size-3.5"})})]}):void 0;return l.jsxs("div",{className:qe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",B?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!B&&l.jsx("div",{className:qe("min-h-0 min-w-0 border-r border-[var(--border)]",(!I||Se)&&"hidden md:block"),children:l.jsx(AX,{sessions:ze,runtimeSelector:r,runtimeLabel:i.displayName,listError:G,loading:q,selectedId:te,onCollapsedChange:z,onSelect:Re=>{Y.current+=1,ne.current=void 0,A(!1),W(void 0),e($l(r,Re))},onNew:()=>{Y.current+=1,ne.current=void 0,A(!1),W(void 0),V(void 0),e(La(r))},onRetry:()=>void me(!0),onFork:async Re=>{try{const Ve=await xe.forkSession(r,Re,{operationId:`web_${crypto.randomUUID()}`});if(Ee.current!==re)return;await me(),A(!1),e($l(r,Ve.sessionId)),ve.success("Session forked")}catch(Ve){ve.error(`Fork session failed: ${Ve instanceof Error?Ve.message:String(Ve)}`)}},onDeleted:Re=>{Ee.current===re&&(te===Re&&e(La(r),{replace:!0}),me())}},r)}),Se?l.jsx(CX,{session:Se,runtimeSelector:r,leadingControls:wt,initialDraft:(F==null?void 0:F.sessionId)===Se.id?F.message:void 0,initialMessage:(T==null?void 0:T.sessionId)===Se.id?T.message:void 0,sendInitialMessage:(T==null?void 0:T.sessionId)===Se.id&&!T.started,onInitialMessageStarted:()=>{V(Re=>(Re==null?void 0:Re.sessionId)===Se.id?{...Re,started:!0}:Re)},onInitialMessageConsumed:()=>{V(Re=>(Re==null?void 0:Re.sessionId)===Se.id?void 0:Re)},onInitialMessageFailed:Re=>{V(Ve=>(Ve==null?void 0:Ve.sessionId)===Se.id?void 0:Ve),W({sessionId:Se.id,message:Re})},terminalSetup:Gt},`${r}:${Se.id}`):te&&q?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($e,{className:"size-4 animate-spin"})," Loading session…"]})}):l.jsx("div",{className:qe("min-h-0 min-w-0",I&&!B&&"hidden md:block"),children:l.jsx(LX,{runtimeLabel:i.displayName,options:f,selection:p,projects:b,projectId:C,loading:S,projectsLoading:j,submitting:$,error:M??G??(te?"Session not found. Start a new session or choose another from the list.":void 0),projectError:H,listCollapsed:B,onShowSessions:()=>{Y.current+=1,z(!1),A(!0)},onRetryOptions:()=>{We()},onSelectionChange:Re=>{ne.current=void 0,y(Re),D(void 0),MH(r,typeof window>"u"?void 0:window.localStorage,Re)},onProjectChange:Re=>{ne.current=void 0,E(Re),D(void 0)},onNewProject:()=>{e(pt.projects,{state:{returnTo:La(r),createProject:!0}})},onSubmit:Te},r)})]})}function OX(e){return e==="codex"||e==="claude"||e==="traex"}function BX({name:e,onClose:t}){const[r,i]=g.useState(null),[n,o]=g.useState("meta"),[u,d]=g.useState(null),[m,f]=g.useState(""),[v,p]=g.useState(!1),[y,b]=g.useState(new Set),w=C=>b(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),f("");return}o("meta");let C=!1;return xe.getSkill(e).then(E=>{var S;C||(i(E),b(new Set(PX(E.files))),d(((S=E.files.find(k=>k.path==="SKILL.md")??E.files[0])==null?void 0:S.path)??null))}).catch(E=>ve.error(`Load skill failed: ${E.message}`)),()=>{C=!0}},[e]),g.useEffect(()=>{if(!e||!u){f("");return}let C=!1;return p(!0),xe.readSkillFile(e,u).then(E=>!C&&f(E.content)).catch(E=>!C&&f(`⚠ ${E.message}`)).finally(()=>!C&&p(!1)),()=>{C=!0}},[e,u]),l.jsx($o,{open:e!=null,onOpenChange:C=>!C&&t(),children:l.jsxs(Ga,{className:"flex max-h-[85vh] max-w-3xl flex-col overflow-hidden",children:[l.jsx(Uo,{children:l.jsx(Ya,{className:"font-mono",children:e})}),l.jsxs(mA,{value:n,onValueChange:o,className:"flex min-h-0 flex-1 flex-col gap-3",children:[l.jsxs(pA,{className:"self-start",children:[l.jsx(ex,{value:"meta",children:"Meta"}),l.jsxs(ex,{value:"files",children:["Files",r?` (${r.files.length})`:""]})]}),l.jsx(Qu,{value:"meta",className:"mt-0 min-h-0 flex-1",children:l.jsx(vs,{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=yA((E=r.ref)==null?void 0:E.install);return l.jsxs(l.Fragment,{children:[l.jsx(Cu,{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(Cu,{label:"Version",children:l.jsx("span",{className:"font-mono text-xs",children:C.version})}),((S=r.ref)==null?void 0:S.contentHash)&&l.jsx(Cu,{label:"Content",children:l.jsx("span",{className:"break-all font-mono text-xs",children:r.ref.contentHash})})]})})(),l.jsx(Cu,{label:"Files",children:r.files.length}),l.jsx(Cu,{label:"Size",children:ZT(r.totalSize)})]})]})})}),l.jsx(Qu,{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(vs,{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(JT,{nodes:zX(r.files),depth:0,active:u,onSelect:d,collapsed:y,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 Cu({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 ZT(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:"—"}function PX(e){const t=new Set;for(const r of e){const i=r.path.split("/");for(let n=0;n<i.length-1;n++)t.add(i.slice(0,n+1).join("/"))}return[...t]}function zX(e){const t={children:[]};for(const r of e){const i=r.path.split("/");let n=t;i.forEach((o,u)=>{const d=u===i.length-1;let m=n.children.find(f=>f.name===o);m||(m={name:o,path:i.slice(0,u+1).join("/"),isDir:!d,children:[]},d&&(m.size=r.size),n.children.push(m)),n=m})}return QT(t),t.children}function QT(e){e.children.sort((t,r)=>t.isDir===r.isDir?t.name.localeCompare(r.name):t.isDir?-1:1),e.children.forEach(QT)}function JT({nodes:e,depth:t,active:r,onSelect:i,collapsed:n,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(Po,{className:qe("size-3 shrink-0 transition-transform",!n.has(d.path)&&"rotate-90")}),l.jsx(Uu,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:"truncate font-mono",children:d.name})]}),!n.has(d.path)&&l.jsx(JT,{nodes:d.children,depth:t+1,active:r,onSelect:i,collapsed:n,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(I4,{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:ZT(d.size??0)})]},d.path))})}function IX(){const[e,t]=g.useState(null),[r,i]=g.useState(null);async function n(){try{t(await xe.listSkills())}catch(o){t([]),ve.error(`Failed to load skills: ${o.message}`)}}return g.useEffect(()=>{n()},[]),l.jsxs(ir,{children:[l.jsxs(mi,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(li,{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(tA,{onInstalled:t})})]}),l.jsx(fr,{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=yA((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(ue,{variant:"ghost",size:"sm",onClick:()=>i(o.name),children:"View"}),l.jsx($X,{name:o.name,onDeleted:n})]})})]},o.name))]})]})}),l.jsx(BX,{name:r,onClose:()=>i(null)})]})}function $X({name:e,onDeleted:t}){return l.jsxs(_s,{children:[l.jsx(hn,{asChild:!0,children:l.jsx(ue,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(qa,{})})}),l.jsxs(qi,{children:[l.jsxs(xs,{children:[l.jsxs(Wi,{children:['Remove skill "',e,'"?']}),l.jsx(Vi,{children:"Deletes it from the global catalog. Agents that reference it will no longer resolve it."})]}),l.jsxs(ys,{children:[l.jsx(Gi,{children:"Cancel"}),l.jsx(bs,{variant:"destructive",onClick:async()=>{try{await xe.deleteSkill(e),ve.success(`Skill "${e}" removed`),await t()}catch(r){ve.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function UX(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function HX(){const e=Vo();return e?l.jsxs(l.Fragment,{children:[l.jsx(w9,{bridge:e,children:l.jsx(sE,{desktopIntegrationAvailable:!0})}),l.jsx(R9,{bridge:e})]}):l.jsx(sE,{desktopIntegrationAvailable:!1})}function sE({desktopIntegrationAvailable:e}){const{theme:t,toggle:r}=fy(),i=Hr(),n=i9(i.pathname,e),o=g.useRef(null),[u,d]=g.useState([]),[m,f]=g.useState([]),[v,p]=g.useState(!1),y=g.useCallback(async()=>{try{d(await xe.listAgents())}catch(E){ve.error(`Failed to load agents: ${E.message}`)}},[]),b=g.useCallback(async()=>{const E=await Promise.allSettled([xe.listPlugins(),xe.listAgents()]);E[0].status==="fulfilled"&&f(E[0].value),E[1].status==="fulfilled"&&d(E[1].value)},[]);g.useEffect(()=>{n&&n!=="emulator"&&b()},[b,n]),g.useEffect(()=>{let E=!0;const S=async()=>{try{const j=await xe.meta();E&&p(UX(j))}catch{}};S();const k=window.setInterval(()=>void S(),15e3);return()=>{E=!1,window.clearInterval(k)}},[]),g.useEffect(()=>{const E=window.requestAnimationFrame(()=>{var S;return(S=o.current)==null?void 0:S.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(E)},[i.pathname]);const w=aL([{path:"/",element:l.jsx(Ta,{replace:!0,to:pt.sessions})},{path:Yu,element:l.jsx(Ta,{replace:!0,to:Y_})},{path:pt.overview,element:l.jsx(zU,{plugins:m,agents:u,desktopIntegrationAvailable:e})},{path:pt.runtimes,element:l.jsx(yH,{})},{path:pt.providers,element:l.jsx(dH,{})},{path:pt.projects,element:l.jsx(nH,{})},{path:pt.plugins,element:l.jsx(WU,{plugins:m,theme:t,onChange:b})},{path:pt.agents,element:l.jsx(Y9,{agents:u,onChange:y})},{path:pt.skills,element:l.jsx(IX,{})},{path:Z$,element:l.jsx(__,{})},{path:Q$,element:l.jsx(__,{})},{path:pt.sessions,element:l.jsx(__,{})},{path:`${pt.sessions}/:sessionId`,element:l.jsx(FX,{})},{path:pt.emulator,element:l.jsx(CU,{})},...e?[{path:pt.localRuntime,element:l.jsx(TU,{})},{path:pt.computerUse,element:l.jsx(iU,{})}]:Ij.map(E=>({path:pt[E],element:l.jsx(Ta,{replace:!0,to:Y_})})),...Object.entries(e9).map(([E,S])=>({path:S,element:l.jsx(Ta,{replace:!0,to:pt[E]})})),...Object.entries(t9).map(([E,S])=>({path:E,element:l.jsx(Ta,{replace:!0,to:S})})),{path:"*",element:l.jsx(Ta,{replace:!0,to:pt.sessions})}]),C=n?l.jsx(j9,{activeView:n,desktopIntegrationAvailable:e,children:w}):w;return l.jsx(b9,{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:[v&&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(Ms,{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 → Local Runtime"}),", 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:C})]})})}function FX(){const{sessionId:e}=jE(),t=Hr();if(!e)return l.jsx(Ta,{replace:!0,to:pt.sessions});const r=Hj(t.search)??"local";return l.jsx(Ta,{replace:!0,to:$l(r,e)})}function qX(e){const{theme:t}=fy();return l.jsx(J6,{theme:t,...e})}var dE;((dE=window.rynxDesktopIntegration)==null?void 0:dE.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");bD.createRoot(document.getElementById("root")).render(l.jsx(g.StrictMode,{children:l.jsx(qL,{children:l.jsx(v9,{children:l.jsxs(x9,{children:[l.jsx(HX,{}),l.jsx(qX,{richColors:!0,position:"top-right"})]})})})}));export{iX as _,Wa as a,y0 as c,hE as g,l as j,g as r,Yk as t};