@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.
@@ -1,661 +0,0 @@
1
- var YD=Object.defineProperty;var KD=(e,t,r)=>t in e?YD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Wr=(e,t,r)=>KD(e,typeof t!="symbol"?t+"":t,r);function XD(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();function gx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qg={exports:{}},Jc={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var HS;function ZD(){if(HS)return Jc;HS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,s,o){var u=null;if(o!==void 0&&(u=""+o),s.key!==void 0&&(u=""+s.key),"key"in s){o={};for(var d in s)d!=="key"&&(o[d]=s[d])}else o=s;return s=o.ref,{$$typeof:e,type:i,key:u,ref:s!==void 0?s:null,props:o}}return Jc.Fragment=t,Jc.jsx=r,Jc.jsxs=r,Jc}var FS;function QD(){return FS||(FS=1,Qg.exports=ZD()),Qg.exports}var l=QD(),Jg={exports:{}},Ge={};/**
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 JD(){if(WS)return Ge;WS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),x=Symbol.iterator;function b(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function S(I,Y,K){this.props=I,this.context=Y,this.refs=E,this.updater=K||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,Y){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,Y,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=S.prototype;function k(I,Y,K){this.props=I,this.context=Y,this.refs=E,this.updater=K||w}var R=k.prototype=new N;R.constructor=k,C(R,S.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function L(){}var $={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function q(I,Y,K){var ee=K.ref;return{$$typeof:e,type:I,key:Y,ref:ee!==void 0?ee:null,props:K}}function G(I,Y){return q(I.type,Y,I.props)}function W(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function B(I){var Y={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(K){return Y[K]})}var j=/\/+/g;function O(I,Y){return typeof I=="object"&&I!==null&&I.key!=null?B(""+I.key):Y.toString(36)}function z(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(L,L):(I.status="pending",I.then(function(Y){I.status==="pending"&&(I.status="fulfilled",I.value=Y)},function(Y){I.status==="pending"&&(I.status="rejected",I.reason=Y)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function T(I,Y,K,ee,oe){var ce=typeof I;(ce==="undefined"||ce==="boolean")&&(I=null);var Z=!1;if(I===null)Z=!0;else switch(ce){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(I.$$typeof){case e:case t:Z=!0;break;case v:return Z=I._init,T(Z(I._payload),Y,K,ee,oe)}}if(Z)return oe=oe(I),Z=ee===""?"."+O(I,0):ee,M(oe)?(K="",Z!=null&&(K=Z.replace(j,"$&/")+"/"),T(oe,Y,K,"",function(Se){return Se})):oe!=null&&(W(oe)&&(oe=G(oe,K+(oe.key==null||I&&I.key===oe.key?"":(""+oe.key).replace(j,"$&/")+"/")+Z)),Y.push(oe)),1;Z=0;var le=ee===""?".":ee+":";if(M(I))for(var ie=0;ie<I.length;ie++)ee=I[ie],ce=le+O(ee,ie),Z+=T(ee,Y,K,ce,oe);else if(ie=b(I),typeof ie=="function")for(I=ie.call(I),ie=0;!(ee=I.next()).done;)ee=ee.value,ce=le+O(ee,ie++),Z+=T(ee,Y,K,ce,oe);else if(ce==="object"){if(typeof I.then=="function")return T(z(I),Y,K,ee,oe);throw Y=String(I),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Z}function U(I,Y,K){if(I==null)return I;var ee=[],oe=0;return T(I,ee,"","",function(ce){return Y.call(K,ce,oe++)}),ee}function H(I){if(I._status===-1){var Y=I._result;Y=Y(),Y.then(function(K){(I._status===0||I._status===-1)&&(I._status=1,I._result=K)},function(K){(I._status===0||I._status===-1)&&(I._status=2,I._result=K)}),I._status===-1&&(I._status=0,I._result=Y)}if(I._status===1)return I._result.default;throw I._result}var F=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},V={map:U,forEach:function(I,Y,K){U(I,function(){Y.apply(this,arguments)},K)},count:function(I){var Y=0;return U(I,function(){Y++}),Y},toArray:function(I){return U(I,function(Y){return Y})||[]},only:function(I){if(!W(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Ge.Activity=p,Ge.Children=V,Ge.Component=S,Ge.Fragment=r,Ge.Profiler=s,Ge.PureComponent=k,Ge.StrictMode=i,Ge.Suspense=m,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(I){return $.H.useMemoCache(I)}},Ge.cache=function(I){return function(){return I.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(I,Y,K){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ee=C({},I.props),oe=I.key;if(Y!=null)for(ce in Y.key!==void 0&&(oe=""+Y.key),Y)!D.call(Y,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&Y.ref===void 0||(ee[ce]=Y[ce]);var ce=arguments.length-2;if(ce===1)ee.children=K;else if(1<ce){for(var Z=Array(ce),le=0;le<ce;le++)Z[le]=arguments[le+2];ee.children=Z}return q(I.type,oe,ee)},Ge.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:o,_context:I},I},Ge.createElement=function(I,Y,K){var ee,oe={},ce=null;if(Y!=null)for(ee in Y.key!==void 0&&(ce=""+Y.key),Y)D.call(Y,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(oe[ee]=Y[ee]);var Z=arguments.length-2;if(Z===1)oe.children=K;else if(1<Z){for(var le=Array(Z),ie=0;ie<Z;ie++)le[ie]=arguments[ie+2];oe.children=le}if(I&&I.defaultProps)for(ee in Z=I.defaultProps,Z)oe[ee]===void 0&&(oe[ee]=Z[ee]);return q(I,ce,oe)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(I){return{$$typeof:d,render:I}},Ge.isValidElement=W,Ge.lazy=function(I){return{$$typeof:v,_payload:{_status:-1,_result:I},_init:H}},Ge.memo=function(I,Y){return{$$typeof:h,type:I,compare:Y===void 0?null:Y}},Ge.startTransition=function(I){var Y=$.T,K={};$.T=K;try{var ee=I(),oe=$.S;oe!==null&&oe(K,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(L,F)}catch(ce){F(ce)}finally{Y!==null&&K.types!==null&&(Y.types=K.types),$.T=Y}},Ge.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ge.use=function(I){return $.H.use(I)},Ge.useActionState=function(I,Y,K){return $.H.useActionState(I,Y,K)},Ge.useCallback=function(I,Y){return $.H.useCallback(I,Y)},Ge.useContext=function(I){return $.H.useContext(I)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(I,Y){return $.H.useDeferredValue(I,Y)},Ge.useEffect=function(I,Y){return $.H.useEffect(I,Y)},Ge.useEffectEvent=function(I){return $.H.useEffectEvent(I)},Ge.useId=function(){return $.H.useId()},Ge.useImperativeHandle=function(I,Y,K){return $.H.useImperativeHandle(I,Y,K)},Ge.useInsertionEffect=function(I,Y){return $.H.useInsertionEffect(I,Y)},Ge.useLayoutEffect=function(I,Y){return $.H.useLayoutEffect(I,Y)},Ge.useMemo=function(I,Y){return $.H.useMemo(I,Y)},Ge.useOptimistic=function(I,Y){return $.H.useOptimistic(I,Y)},Ge.useReducer=function(I,Y,K){return $.H.useReducer(I,Y,K)},Ge.useRef=function(I){return $.H.useRef(I)},Ge.useState=function(I){return $.H.useState(I)},Ge.useSyncExternalStore=function(I,Y,K){return $.H.useSyncExternalStore(I,Y,K)},Ge.useTransition=function(){return $.H.useTransition()},Ge.version="19.2.7",Ge}var qS;function vx(){return qS||(qS=1,Jg.exports=JD()),Jg.exports}var g=vx();const Ee=gx(g),Oa=XD({__proto__:null,default:Ee},[g]);var ev={exports:{}},eu={},tv={exports:{}},rv={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var VS;function eL(){return VS||(VS=1,(function(e){function t(T,U){var H=T.length;T.push(U);e:for(;0<H;){var F=H-1>>>1,V=T[F];if(0<s(V,U))T[F]=U,T[H]=V,H=F;else break e}}function r(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var U=T[0],H=T.pop();if(H!==U){T[0]=H;e:for(var F=0,V=T.length,I=V>>>1;F<I;){var Y=2*(F+1)-1,K=T[Y],ee=Y+1,oe=T[ee];if(0>s(K,H))ee<V&&0>s(oe,K)?(T[F]=oe,T[ee]=H,F=ee):(T[F]=K,T[Y]=H,F=Y);else if(ee<V&&0>s(oe,H))T[F]=oe,T[ee]=H,F=ee;else break e}}return U}function s(T,U){var H=T.sortIndex-U.sortIndex;return H!==0?H:T.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],h=[],v=1,p=null,x=3,b=!1,w=!1,C=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function R(T){for(var U=r(h);U!==null;){if(U.callback===null)i(h);else if(U.startTime<=T)i(h),U.sortIndex=U.expirationTime,t(m,U);else break;U=r(h)}}function M(T){if(C=!1,R(T),!w)if(r(m)!==null)w=!0,L||(L=!0,B());else{var U=r(h);U!==null&&z(M,U.startTime-T)}}var L=!1,$=-1,D=5,q=-1;function G(){return E?!0:!(e.unstable_now()-q<D)}function W(){if(E=!1,L){var T=e.unstable_now();q=T;var U=!0;try{e:{w=!1,C&&(C=!1,N($),$=-1),b=!0;var H=x;try{t:{for(R(T),p=r(m);p!==null&&!(p.expirationTime>T&&G());){var F=p.callback;if(typeof F=="function"){p.callback=null,x=p.priorityLevel;var V=F(p.expirationTime<=T);if(T=e.unstable_now(),typeof V=="function"){p.callback=V,R(T),U=!0;break t}p===r(m)&&i(m),R(T)}else i(m);p=r(m)}if(p!==null)U=!0;else{var I=r(h);I!==null&&z(M,I.startTime-T),U=!1}}break e}finally{p=null,x=H,b=!1}U=void 0}}finally{U?B():L=!1}}}var B;if(typeof k=="function")B=function(){k(W)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,O=j.port2;j.port1.onmessage=W,B=function(){O.postMessage(null)}}else B=function(){S(W,0)};function z(T,U){$=S(function(){T(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(T){switch(x){case 1:case 2:case 3:var U=3;break;default:U=x}var H=x;x=U;try{return T()}finally{x=H}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(T,U){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var H=x;x=T;try{return U()}finally{x=H}},e.unstable_scheduleCallback=function(T,U,H){var F=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?F+H:F):H=F,T){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=H+V,T={id:v++,callback:U,priorityLevel:T,startTime:H,expirationTime:V,sortIndex:-1},H>F?(T.sortIndex=H,t(h,T),r(m)===null&&T===r(h)&&(C?(N($),$=-1):C=!0,z(M,H-F))):(T.sortIndex=V,t(m,T),w||b||(w=!0,L||(L=!0,B()))),T},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(T){var U=x;return function(){var H=x;x=U;try{return T.apply(this,arguments)}finally{x=H}}}})(rv)),rv}var GS;function tL(){return GS||(GS=1,tv.exports=eL()),tv.exports}var iv={exports:{}},qr={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var YS;function rL(){if(YS)return qr;YS=1;var e=vx();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return qr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,qr.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,v)},qr.flushSync=function(m){var h=u.T,v=i.p;try{if(u.T=null,i.p=2,m)return m()}finally{u.T=h,i.p=v,i.d.f()}},qr.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(m,h))},qr.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},qr.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,p=d(v,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?i.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:x,fetchPriority:b}):v==="script"&&i.d.X(m,{crossOrigin:p,integrity:x,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},qr.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=d(h.as,h.crossOrigin);i.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(m)},qr.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,p=d(v,h.crossOrigin);i.d.L(m,v,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},qr.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=d(h.as,h.crossOrigin);i.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(m)},qr.requestFormReset=function(m){i.d.r(m)},qr.unstable_batchedUpdates=function(m,h){return m(h)},qr.useFormState=function(m,h,v){return u.H.useFormState(m,h,v)},qr.useFormStatus=function(){return u.H.useHostTransitionStatus()},qr.version="19.2.7",qr}var KS;function iR(){if(KS)return iv.exports;KS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),iv.exports=rL(),iv.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var XS;function iL(){if(XS)return eu;XS=1;var e=tL(),t=vx(),r=iR();function i(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function o(n){var a=n,c=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(c=a.return),n=a.return;while(n)}return a.tag===3?c:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function d(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(o(n)!==n)throw Error(i(188))}function h(n){var a=n.alternate;if(!a){if(a=o(n),a===null)throw Error(i(188));return a!==n?null:n}for(var c=n,f=a;;){var _=c.return;if(_===null)break;var y=_.alternate;if(y===null){if(f=_.return,f!==null){c=f;continue}break}if(_.child===y.child){for(y=_.child;y;){if(y===c)return m(_),n;if(y===f)return m(_),a;y=y.sibling}throw Error(i(188))}if(c.return!==f.return)c=_,f=y;else{for(var A=!1,P=_.child;P;){if(P===c){A=!0,c=_,f=y;break}if(P===f){A=!0,f=_,c=y;break}P=P.sibling}if(!A){for(P=y.child;P;){if(P===c){A=!0,c=y,f=_;break}if(P===f){A=!0,f=y,c=_;break}P=P.sibling}if(!A)throw Error(i(189))}}if(c.alternate!==f)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?n:a}function v(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=v(n),a!==null)return a;n=n.sibling}return null}var p=Object.assign,x=Symbol.for("react.element"),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"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=W&&n[W]||n["@@iterator"],typeof n=="function"?n:null)}var j=Symbol.for("react.client.reference");function O(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===j?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case C:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case M:return"Suspense";case L:return"SuspenseList";case q:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case w:return"Portal";case k:return n.displayName||"Context";case N:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return a=n.displayName||null,a!==null?a:O(n.type)||"Memo";case D:a=n._payload,n=n._init;try{return O(n(a))}catch{}}return null}var z=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},F=[],V=-1;function I(n){return{current:n}}function Y(n){0>V||(n.current=F[V],F[V]=null,V--)}function K(n,a){V++,F[V]=n.current,n.current=a}var ee=I(null),oe=I(null),ce=I(null),Z=I(null);function le(n,a){switch(K(ce,a),K(oe,n),K(ee,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?dS(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=dS(a),n=hS(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Y(ee),K(ee,n)}function ie(){Y(ee),Y(oe),Y(ce)}function Se(n){n.memoizedState!==null&&K(Z,n);var a=ee.current,c=hS(a,n.type);a!==c&&(K(oe,n),K(ee,c))}function be(n){oe.current===n&&(Y(ee),Y(oe)),Z.current===n&&(Y(Z),Kc._currentValue=H)}var Ce,Q;function re(n){if(Ce===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Ce=a&&a[1]||"",Q=-1<c.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Ce+n+Q}var ye=!1;function me(n,a){if(!n||ye)return"";ye=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(ue){var ae=ue}Reflect.construct(n,[],ge)}else{try{ge.call()}catch(ue){ae=ue}n.call(ge.prototype)}}else{try{throw Error()}catch(ue){ae=ue}(ge=n())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ue){if(ue&&ae&&typeof ue.stack=="string")return[ue.stack,ae.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=f.DetermineComponentFrameRoot(),A=y[0],P=y[1];if(A&&P){var X=A.split(`
44
- `),se=P.split(`
45
- `);for(_=f=0;f<X.length&&!X[f].includes("DetermineComponentFrameRoot");)f++;for(;_<se.length&&!se[_].includes("DetermineComponentFrameRoot");)_++;if(f===X.length||_===se.length)for(f=X.length-1,_=se.length-1;1<=f&&0<=_&&X[f]!==se[_];)_--;for(;1<=f&&0<=_;f--,_--)if(X[f]!==se[_]){if(f!==1||_!==1)do if(f--,_--,0>_||X[f]!==se[_]){var de=`
46
- `+X[f].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=f&&0<=_);break}}}finally{ye=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?re(c):""}function Ae(n,a){switch(n.tag){case 26:case 27:case 5:return re(n.type);case 16:return re("Lazy");case 13:return n.child!==a&&a!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return me(n.type,!1);case 11:return me(n.type.render,!1);case 1:return me(n.type,!0);case 31:return re("Activity");default:return""}}function Le(n){try{var a="",c=null;do a+=Ae(n,c),c=n,n=n.return;while(n);return a}catch(f){return`
47
- Error generating stack: `+f.message+`
48
- `+f.stack}}var je=Object.prototype.hasOwnProperty,Ye=e.unstable_scheduleCallback,at=e.unstable_cancelCallback,qe=e.unstable_shouldYield,Pt=e.unstable_requestPaint,Ie=e.unstable_now,Mt=e.unstable_getCurrentPriorityLevel,pt=e.unstable_ImmediatePriority,Jt=e.unstable_UserBlockingPriority,xt=e.unstable_NormalPriority,Tt=e.unstable_LowPriority,Ft=e.unstable_IdlePriority,ni=e.log,xi=e.unstable_setDisableYieldValue,Fr=null,er=null;function Rt(n){if(typeof ni=="function"&&xi(n),er&&typeof er.setStrictMode=="function")try{er.setStrictMode(Fr,n)}catch{}}var xr=Math.clz32?Math.clz32:yi,qa=Math.log,Hs=Math.LN2;function yi(n){return n>>>=0,n===0?32:31-(qa(n)/Hs|0)|0}var ns=256,ss=262144,Mn=4194304;function bi(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function $e(n,a,c){var f=n.pendingLanes;if(f===0)return 0;var _=0,y=n.suspendedLanes,A=n.pingedLanes;n=n.warmLanes;var P=f&134217727;return P!==0?(f=P&~y,f!==0?_=bi(f):(A&=P,A!==0?_=bi(A):c||(c=P&~n,c!==0&&(_=bi(c))))):(P=f&~y,P!==0?_=bi(P):A!==0?_=bi(A):c||(c=f&~n,c!==0&&(_=bi(c)))),_===0?0:a!==0&&a!==_&&(a&y)===0&&(y=_&-_,c=a&-a,y>=c||y===32&&(c&4194048)!==0)?a:_}function pe(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function ke(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ue(){var n=Mn;return Mn<<=1,(Mn&62914560)===0&&(Mn=4194304),n}function yt(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Ze(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Wt(n,a,c,f,_,y){var A=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var P=n.entanglements,X=n.expirationTimes,se=n.hiddenUpdates;for(c=A&~c;0<c;){var de=31-xr(c),ge=1<<de;P[de]=0,X[de]=-1;var ae=se[de];if(ae!==null)for(se[de]=null,de=0;de<ae.length;de++){var ue=ae[de];ue!==null&&(ue.lane&=-536870913)}c&=~ge}f!==0&&si(n,f,0),y!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=y&~(A&~a))}function si(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var f=31-xr(a);n.entangledLanes|=a,n.entanglements[f]=n.entanglements[f]|1073741824|c&261930}function qt(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var f=31-xr(c),_=1<<f;_&a|n[f]&a&&(n[f]|=a),c&=~_}}function ai(n,a){var c=a&-a;return c=(c&42)!==0?1:Fo(c),(c&(n.suspendedLanes|a))!==0?0:c}function Fo(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function ln(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Hm(){var n=U.p;return n!==0?n:(n=window.event,n===void 0?32:OS(n.type))}function Zy(n,a){var c=U.p;try{return U.p=n,a()}finally{U.p=c}}var Fs=Math.random().toString(36).slice(2),Mr="__reactFiber$"+Fs,oi="__reactProps$"+Fs,Wo="__reactContainer$"+Fs,Fm="__reactEvents$"+Fs,Pj="__reactListeners$"+Fs,Ij="__reactHandles$"+Fs,Qy="__reactResources$"+Fs,uc="__reactMarker$"+Fs;function Wm(n){delete n[Mr],delete n[oi],delete n[Fm],delete n[Pj],delete n[Ij]}function qo(n){var a=n[Mr];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Wo]||c[Mr]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=xS(n);n!==null;){if(c=n[Mr])return c;n=xS(n)}return a}n=c,c=n.parentNode}return null}function Vo(n){if(n=n[Mr]||n[Wo]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function dc(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(i(33))}function Go(n){var a=n[Qy];return a||(a=n[Qy]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function yr(n){n[uc]=!0}var Jy=new Set,eb={};function Va(n,a){Yo(n,a),Yo(n+"Capture",a)}function Yo(n,a){for(eb[n]=a,n=0;n<a.length;n++)Jy.add(a[n])}var zj=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),tb={},rb={};function $j(n){return je.call(rb,n)?!0:je.call(tb,n)?!1:zj.test(n)?rb[n]=!0:(tb[n]=!0,!1)}function _d(n,a,c){if($j(a))if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+c)}}function xd(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function as(n,a,c,f){if(f===null)n.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+f)}}function Li(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ib(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Uj(n,a,c){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var _=f.get,y=f.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return _.call(this)},set:function(A){c=""+A,y.call(this,A)}}),Object.defineProperty(n,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(A){c=""+A},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function qm(n){if(!n._valueTracker){var a=ib(n)?"checked":"value";n._valueTracker=Uj(n,a,""+n[a])}}function nb(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return n&&(f=ib(n)?n.checked?"true":"false":n.value),n=f,n!==c?(a.setValue(n),!0):!1}function yd(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Hj=/[\n"\\]/g;function Oi(n){return n.replace(Hj,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Vm(n,a,c,f,_,y,A,P){n.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.type=A:n.removeAttribute("type"),a!=null?A==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Li(a)):n.value!==""+Li(a)&&(n.value=""+Li(a)):A!=="submit"&&A!=="reset"||n.removeAttribute("value"),a!=null?Gm(n,A,Li(a)):c!=null?Gm(n,A,Li(c)):f!=null&&n.removeAttribute("value"),_==null&&y!=null&&(n.defaultChecked=!!y),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?n.name=""+Li(P):n.removeAttribute("name")}function sb(n,a,c,f,_,y,A,P){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),a!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){qm(n);return}c=c!=null?""+Li(c):"",a=a!=null?""+Li(a):c,P||a===n.value||(n.value=a),n.defaultValue=a}f=f??_,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=P?n.checked:!!f,n.defaultChecked=!!f,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(n.name=A),qm(n)}function Gm(n,a,c){a==="number"&&yd(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function Ko(n,a,c,f){if(n=n.options,a){a={};for(var _=0;_<c.length;_++)a["$"+c[_]]=!0;for(c=0;c<n.length;c++)_=a.hasOwnProperty("$"+n[c].value),n[c].selected!==_&&(n[c].selected=_),_&&f&&(n[c].defaultSelected=!0)}else{for(c=""+Li(c),a=null,_=0;_<n.length;_++){if(n[_].value===c){n[_].selected=!0,f&&(n[_].defaultSelected=!0);return}a!==null||n[_].disabled||(a=n[_])}a!==null&&(a.selected=!0)}}function ab(n,a,c){if(a!=null&&(a=""+Li(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+Li(c):""}function ob(n,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(i(92));if(z(f)){if(1<f.length)throw Error(i(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Li(a),n.defaultValue=c,f=n.textContent,f===c&&f!==""&&f!==null&&(n.value=f),qm(n)}function Xo(n,a){if(a){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=a;return}}n.textContent=a}var Fj=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function lb(n,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":f?n.setProperty(a,c):typeof c!="number"||c===0||Fj.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function cb(n,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(n=n.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var _ in a)f=a[_],a.hasOwnProperty(_)&&c[_]!==f&&lb(n,_,f)}else for(var y in a)a.hasOwnProperty(y)&&lb(n,y,a[y])}function Ym(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Wj=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"]]),qj=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bd(n){return qj.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function os(){}var Km=null;function Xm(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zo=null,Qo=null;function ub(n){var a=Vo(n);if(a&&(n=a.stateNode)){var c=n[oi]||null;e:switch(n=a.stateNode,a.type){case"input":if(Vm(n,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Oi(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==n&&f.form===n.form){var _=f[oi]||null;if(!_)throw Error(i(90));Vm(f,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===n.form&&nb(f)}break e;case"textarea":ab(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Ko(n,!!c.multiple,a,!1)}}}var Zm=!1;function db(n,a,c){if(Zm)return n(a,c);Zm=!0;try{var f=n(a);return f}finally{if(Zm=!1,(Zo!==null||Qo!==null)&&(lh(),Zo&&(a=Zo,n=Qo,Qo=Zo=null,ub(a),n)))for(a=0;a<n.length;a++)ub(n[a])}}function hc(n,a){var c=n.stateNode;if(c===null)return null;var f=c[oi]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var ls=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qm=!1;if(ls)try{var fc={};Object.defineProperty(fc,"passive",{get:function(){Qm=!0}}),window.addEventListener("test",fc,fc),window.removeEventListener("test",fc,fc)}catch{Qm=!1}var Ws=null,Jm=null,wd=null;function hb(){if(wd)return wd;var n,a=Jm,c=a.length,f,_="value"in Ws?Ws.value:Ws.textContent,y=_.length;for(n=0;n<c&&a[n]===_[n];n++);var A=c-n;for(f=1;f<=A&&a[c-f]===_[y-f];f++);return wd=_.slice(n,1<f?1-f:void 0)}function Sd(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Cd(){return!0}function fb(){return!1}function li(n){function a(c,f,_,y,A){this._reactName=c,this._targetInst=_,this.type=f,this.nativeEvent=y,this.target=A,this.currentTarget=null;for(var P in n)n.hasOwnProperty(P)&&(c=n[P],this[P]=c?c(y):y[P]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Cd:fb,this.isPropagationStopped=fb,this}return p(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Cd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Cd)},persist:function(){},isPersistent:Cd}),a}var Ga={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ed=li(Ga),mc=p({},Ga,{view:0,detail:0}),Vj=li(mc),ep,tp,pc,Rd=p({},mc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ip,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==pc&&(pc&&n.type==="mousemove"?(ep=n.screenX-pc.screenX,tp=n.screenY-pc.screenY):tp=ep=0,pc=n),ep)},movementY:function(n){return"movementY"in n?n.movementY:tp}}),mb=li(Rd),Gj=p({},Rd,{dataTransfer:0}),Yj=li(Gj),Kj=p({},mc,{relatedTarget:0}),rp=li(Kj),Xj=p({},Ga,{animationName:0,elapsedTime:0,pseudoElement:0}),Zj=li(Xj),Qj=p({},Ga,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Jj=li(Qj),e3=p({},Ga,{data:0}),pb=li(e3),t3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},r3={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"},i3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n3(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=i3[n])?!!a[n]:!1}function ip(){return n3}var s3=p({},mc,{key:function(n){if(n.key){var a=t3[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Sd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?r3[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ip,charCode:function(n){return n.type==="keypress"?Sd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Sd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),a3=li(s3),o3=p({},Rd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gb=li(o3),l3=p({},mc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ip}),c3=li(l3),u3=p({},Ga,{propertyName:0,elapsedTime:0,pseudoElement:0}),d3=li(u3),h3=p({},Rd,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),f3=li(h3),m3=p({},Ga,{newState:0,oldState:0}),p3=li(m3),g3=[9,13,27,32],np=ls&&"CompositionEvent"in window,gc=null;ls&&"documentMode"in document&&(gc=document.documentMode);var v3=ls&&"TextEvent"in window&&!gc,vb=ls&&(!np||gc&&8<gc&&11>=gc),_b=" ",xb=!1;function yb(n,a){switch(n){case"keyup":return g3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bb(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Jo=!1;function _3(n,a){switch(n){case"compositionend":return bb(a);case"keypress":return a.which!==32?null:(xb=!0,_b);case"textInput":return n=a.data,n===_b&&xb?null:n;default:return null}}function x3(n,a){if(Jo)return n==="compositionend"||!np&&yb(n,a)?(n=hb(),wd=Jm=Ws=null,Jo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return vb&&a.locale!=="ko"?null:a.data;default:return null}}var y3={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function wb(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!y3[n.type]:a==="textarea"}function Sb(n,a,c,f){Zo?Qo?Qo.push(f):Qo=[f]:Zo=f,a=ph(a,"onChange"),0<a.length&&(c=new Ed("onChange","change",null,c,f),n.push({event:c,listeners:a}))}var vc=null,_c=null;function b3(n){sS(n,0)}function kd(n){var a=dc(n);if(nb(a))return n}function Cb(n,a){if(n==="change")return a}var Eb=!1;if(ls){var sp;if(ls){var ap="oninput"in document;if(!ap){var Rb=document.createElement("div");Rb.setAttribute("oninput","return;"),ap=typeof Rb.oninput=="function"}sp=ap}else sp=!1;Eb=sp&&(!document.documentMode||9<document.documentMode)}function kb(){vc&&(vc.detachEvent("onpropertychange",Nb),_c=vc=null)}function Nb(n){if(n.propertyName==="value"&&kd(_c)){var a=[];Sb(a,_c,n,Xm(n)),db(b3,a)}}function w3(n,a,c){n==="focusin"?(kb(),vc=a,_c=c,vc.attachEvent("onpropertychange",Nb)):n==="focusout"&&kb()}function S3(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return kd(_c)}function C3(n,a){if(n==="click")return kd(a)}function E3(n,a){if(n==="input"||n==="change")return kd(a)}function R3(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var wi=typeof Object.is=="function"?Object.is:R3;function xc(n,a){if(wi(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var _=c[f];if(!je.call(a,_)||!wi(n[_],a[_]))return!1}return!0}function Ab(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Tb(n,a){var c=Ab(n);n=0;for(var f;c;){if(c.nodeType===3){if(f=n+c.textContent.length,n<=a&&f>=a)return{node:c,offset:a-n};n=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Ab(c)}}function Mb(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Mb(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function jb(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=yd(n.document);a instanceof n.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)n=a.contentWindow;else break;a=yd(n.document)}return a}function op(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var k3=ls&&"documentMode"in document&&11>=document.documentMode,el=null,lp=null,yc=null,cp=!1;function Db(n,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;cp||el==null||el!==yd(f)||(f=el,"selectionStart"in f&&op(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),yc&&xc(yc,f)||(yc=f,f=ph(lp,"onSelect"),0<f.length&&(a=new Ed("onSelect","select",null,a,c),n.push({event:a,listeners:f}),a.target=el)))}function Ya(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var tl={animationend:Ya("Animation","AnimationEnd"),animationiteration:Ya("Animation","AnimationIteration"),animationstart:Ya("Animation","AnimationStart"),transitionrun:Ya("Transition","TransitionRun"),transitionstart:Ya("Transition","TransitionStart"),transitioncancel:Ya("Transition","TransitionCancel"),transitionend:Ya("Transition","TransitionEnd")},up={},Lb={};ls&&(Lb=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function Ka(n){if(up[n])return up[n];if(!tl[n])return n;var a=tl[n],c;for(c in a)if(a.hasOwnProperty(c)&&c in Lb)return up[n]=a[c];return n}var Ob=Ka("animationend"),Bb=Ka("animationiteration"),Pb=Ka("animationstart"),N3=Ka("transitionrun"),A3=Ka("transitionstart"),T3=Ka("transitioncancel"),Ib=Ka("transitionend"),zb=new Map,dp="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(" ");dp.push("scrollEnd");function cn(n,a){zb.set(n,a),Va(a,[n])}var Nd=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Bi=[],rl=0,hp=0;function Ad(){for(var n=rl,a=hp=rl=0;a<n;){var c=Bi[a];Bi[a++]=null;var f=Bi[a];Bi[a++]=null;var _=Bi[a];Bi[a++]=null;var y=Bi[a];if(Bi[a++]=null,f!==null&&_!==null){var A=f.pending;A===null?_.next=_:(_.next=A.next,A.next=_),f.pending=_}y!==0&&$b(c,_,y)}}function Td(n,a,c,f){Bi[rl++]=n,Bi[rl++]=a,Bi[rl++]=c,Bi[rl++]=f,hp|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function fp(n,a,c,f){return Td(n,a,c,f),Md(n)}function Xa(n,a){return Td(n,null,null,a),Md(n)}function $b(n,a,c){n.lanes|=c;var f=n.alternate;f!==null&&(f.lanes|=c);for(var _=!1,y=n.return;y!==null;)y.childLanes|=c,f=y.alternate,f!==null&&(f.childLanes|=c),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(_=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,_&&a!==null&&(_=31-xr(c),n=y.hiddenUpdates,f=n[_],f===null?n[_]=[a]:f.push(a),a.lane=c|536870912),y):null}function Md(n){if(50<Hc)throw Hc=0,wg=null,Error(i(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var il={};function M3(n,a,c,f){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Si(n,a,c,f){return new M3(n,a,c,f)}function mp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function cs(n,a){var c=n.alternate;return c===null?(c=Si(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function Ub(n,a){n.flags&=65011714;var c=n.alternate;return c===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=c.childLanes,n.lanes=c.lanes,n.child=c.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=c.memoizedProps,n.memoizedState=c.memoizedState,n.updateQueue=c.updateQueue,n.type=c.type,a=c.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function jd(n,a,c,f,_,y){var A=0;if(f=n,typeof n=="function")mp(n)&&(A=1);else if(typeof n=="string")A=BD(n,c,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case q:return n=Si(31,c,a,_),n.elementType=q,n.lanes=y,n;case C:return Za(c.children,_,y,a);case E:A=8,_|=24;break;case S:return n=Si(12,c,a,_|2),n.elementType=S,n.lanes=y,n;case M:return n=Si(13,c,a,_),n.elementType=M,n.lanes=y,n;case L:return n=Si(19,c,a,_),n.elementType=L,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case k:A=10;break e;case N:A=9;break e;case R:A=11;break e;case $:A=14;break e;case D:A=16,f=null;break e}A=29,c=Error(i(130,n===null?"null":typeof n,"")),f=null}return a=Si(A,c,a,_),a.elementType=n,a.type=f,a.lanes=y,a}function Za(n,a,c,f){return n=Si(7,n,f,a),n.lanes=c,n}function pp(n,a,c){return n=Si(6,n,null,a),n.lanes=c,n}function Hb(n){var a=Si(18,null,null,0);return a.stateNode=n,a}function gp(n,a,c){return a=Si(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var Fb=new WeakMap;function Pi(n,a){if(typeof n=="object"&&n!==null){var c=Fb.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Le(a)},Fb.set(n,a),a)}return{value:n,source:a,stack:Le(a)}}var nl=[],sl=0,Dd=null,bc=0,Ii=[],zi=0,qs=null,jn=1,Dn="";function us(n,a){nl[sl++]=bc,nl[sl++]=Dd,Dd=n,bc=a}function Wb(n,a,c){Ii[zi++]=jn,Ii[zi++]=Dn,Ii[zi++]=qs,qs=n;var f=jn;n=Dn;var _=32-xr(f)-1;f&=~(1<<_),c+=1;var y=32-xr(a)+_;if(30<y){var A=_-_%5;y=(f&(1<<A)-1).toString(32),f>>=A,_-=A,jn=1<<32-xr(a)+_|c<<_|f,Dn=y+n}else jn=1<<y|c<<_|f,Dn=n}function vp(n){n.return!==null&&(us(n,1),Wb(n,1,0))}function _p(n){for(;n===Dd;)Dd=nl[--sl],nl[sl]=null,bc=nl[--sl],nl[sl]=null;for(;n===qs;)qs=Ii[--zi],Ii[zi]=null,Dn=Ii[--zi],Ii[zi]=null,jn=Ii[--zi],Ii[zi]=null}function qb(n,a){Ii[zi++]=jn,Ii[zi++]=Dn,Ii[zi++]=qs,jn=a.id,Dn=a.overflow,qs=n}var jr=null,jt=null,ut=!1,Vs=null,$i=!1,xp=Error(i(519));function Gs(n){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wc(Pi(a,n)),xp}function Vb(n){var a=n.stateNode,c=n.type,f=n.memoizedProps;switch(a[Mr]=n,a[oi]=f,c){case"dialog":nt("cancel",a),nt("close",a);break;case"iframe":case"object":case"embed":nt("load",a);break;case"video":case"audio":for(c=0;c<Wc.length;c++)nt(Wc[c],a);break;case"source":nt("error",a);break;case"img":case"image":case"link":nt("error",a),nt("load",a);break;case"details":nt("toggle",a);break;case"input":nt("invalid",a),sb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":nt("invalid",a);break;case"textarea":nt("invalid",a),ob(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||cS(a.textContent,c)?(f.popover!=null&&(nt("beforetoggle",a),nt("toggle",a)),f.onScroll!=null&&nt("scroll",a),f.onScrollEnd!=null&&nt("scrollend",a),f.onClick!=null&&(a.onclick=os),a=!0):a=!1,a||Gs(n,!0)}function Gb(n){for(jr=n.return;jr;)switch(jr.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:jr=jr.return}}function al(n){if(n!==jr)return!1;if(!ut)return Gb(n),ut=!0,!1;var a=n.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=n.type,c=!(c!=="form"&&c!=="button")||Pg(n.type,n.memoizedProps)),c=!c),c&&jt&&Gs(n),Gb(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));jt=_S(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));jt=_S(n)}else a===27?(a=jt,oa(n.type)?(n=Hg,Hg=null,jt=n):jt=a):jt=jr?Hi(n.stateNode.nextSibling):null;return!0}function Qa(){jt=jr=null,ut=!1}function yp(){var n=Vs;return n!==null&&(hi===null?hi=n:hi.push.apply(hi,n),Vs=null),n}function wc(n){Vs===null?Vs=[n]:Vs.push(n)}var bp=I(null),Ja=null,ds=null;function Ys(n,a,c){K(bp,a._currentValue),a._currentValue=c}function hs(n){n._currentValue=bp.current,Y(bp)}function wp(n,a,c){for(;n!==null;){var f=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),n===c)break;n=n.return}}function Sp(n,a,c,f){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var y=_.dependencies;if(y!==null){var A=_.child;y=y.firstContext;e:for(;y!==null;){var P=y;y=_;for(var X=0;X<a.length;X++)if(P.context===a[X]){y.lanes|=c,P=y.alternate,P!==null&&(P.lanes|=c),wp(y.return,c,n),f||(A=null);break e}y=P.next}}else if(_.tag===18){if(A=_.return,A===null)throw Error(i(341));A.lanes|=c,y=A.alternate,y!==null&&(y.lanes|=c),wp(A,c,n),A=null}else A=_.child;if(A!==null)A.return=_;else for(A=_;A!==null;){if(A===n){A=null;break}if(_=A.sibling,_!==null){_.return=A.return,A=_;break}A=A.return}_=A}}function ol(n,a,c,f){n=null;for(var _=a,y=!1;_!==null;){if(!y){if((_.flags&524288)!==0)y=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var A=_.alternate;if(A===null)throw Error(i(387));if(A=A.memoizedProps,A!==null){var P=_.type;wi(_.pendingProps.value,A.value)||(n!==null?n.push(P):n=[P])}}else if(_===Z.current){if(A=_.alternate,A===null)throw Error(i(387));A.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Kc):n=[Kc])}_=_.return}n!==null&&Sp(a,n,c,f),a.flags|=262144}function Ld(n){for(n=n.firstContext;n!==null;){if(!wi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function eo(n){Ja=n,ds=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Dr(n){return Yb(Ja,n)}function Od(n,a){return Ja===null&&eo(n),Yb(n,a)}function Yb(n,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},ds===null){if(n===null)throw Error(i(308));ds=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else ds=ds.next=a;return c}var j3=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(c,f){n.push(f)}};this.abort=function(){a.aborted=!0,n.forEach(function(c){return c()})}},D3=e.unstable_scheduleCallback,L3=e.unstable_NormalPriority,sr={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cp(){return{controller:new j3,data:new Map,refCount:0}}function Sc(n){n.refCount--,n.refCount===0&&D3(L3,function(){n.controller.abort()})}var Cc=null,Ep=0,ll=0,cl=null;function O3(n,a){if(Cc===null){var c=Cc=[];Ep=0,ll=Ng(),cl={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Ep++,a.then(Kb,Kb),a}function Kb(){if(--Ep===0&&Cc!==null){cl!==null&&(cl.status="fulfilled");var n=Cc;Cc=null,ll=0,cl=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function B3(n,a){var c=[],f={status:"pending",value:null,reason:null,then:function(_){c.push(_)}};return n.then(function(){f.status="fulfilled",f.value=a;for(var _=0;_<c.length;_++)(0,c[_])(a)},function(_){for(f.status="rejected",f.reason=_,_=0;_<c.length;_++)(0,c[_])(void 0)}),f}var Xb=T.S;T.S=function(n,a){Dw=Ie(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&O3(n,a),Xb!==null&&Xb(n,a)};var to=I(null);function Rp(){var n=to.current;return n!==null?n:kt.pooledCache}function Bd(n,a){a===null?K(to,to.current):K(to,a.pool)}function Zb(){var n=Rp();return n===null?null:{parent:sr._currentValue,pool:n}}var ul=Error(i(460)),kp=Error(i(474)),Pd=Error(i(542)),Id={then:function(){}};function Qb(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Jb(n,a,c){switch(c=n[c],c===void 0?n.push(a):c!==a&&(a.then(os,os),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,t1(n),n;default:if(typeof a.status=="string")a.then(os,os);else{if(n=kt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=a,n.status="pending",n.then(function(f){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=f}},function(f){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,t1(n),n}throw io=a,ul}}function ro(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(io=c,ul):c}}var io=null;function e1(){if(io===null)throw Error(i(459));var n=io;return io=null,n}function t1(n){if(n===ul||n===Pd)throw Error(i(483))}var dl=null,Ec=0;function zd(n){var a=Ec;return Ec+=1,dl===null&&(dl=[]),Jb(dl,n,a)}function Rc(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function $d(n,a){throw a.$$typeof===x?Error(i(525)):(n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function r1(n){function a(te,J){if(n){var ne=te.deletions;ne===null?(te.deletions=[J],te.flags|=16):ne.push(J)}}function c(te,J){if(!n)return null;for(;J!==null;)a(te,J),J=J.sibling;return null}function f(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function _(te,J){return te=cs(te,J),te.index=0,te.sibling=null,te}function y(te,J,ne){return te.index=ne,n?(ne=te.alternate,ne!==null?(ne=ne.index,ne<J?(te.flags|=67108866,J):ne):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function A(te){return n&&te.alternate===null&&(te.flags|=67108866),te}function P(te,J,ne,fe){return J===null||J.tag!==6?(J=pp(ne,te.mode,fe),J.return=te,J):(J=_(J,ne),J.return=te,J)}function X(te,J,ne,fe){var Pe=ne.type;return Pe===C?de(te,J,ne.props.children,fe,ne.key):J!==null&&(J.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&ro(Pe)===J.type)?(J=_(J,ne.props),Rc(J,ne),J.return=te,J):(J=jd(ne.type,ne.key,ne.props,null,te.mode,fe),Rc(J,ne),J.return=te,J)}function se(te,J,ne,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==ne.containerInfo||J.stateNode.implementation!==ne.implementation?(J=gp(ne,te.mode,fe),J.return=te,J):(J=_(J,ne.children||[]),J.return=te,J)}function de(te,J,ne,fe,Pe){return J===null||J.tag!==7?(J=Za(ne,te.mode,fe,Pe),J.return=te,J):(J=_(J,ne),J.return=te,J)}function ge(te,J,ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=pp(""+J,te.mode,ne),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return ne=jd(J.type,J.key,J.props,null,te.mode,ne),Rc(ne,J),ne.return=te,ne;case w:return J=gp(J,te.mode,ne),J.return=te,J;case D:return J=ro(J),ge(te,J,ne)}if(z(J)||B(J))return J=Za(J,te.mode,ne,null),J.return=te,J;if(typeof J.then=="function")return ge(te,zd(J),ne);if(J.$$typeof===k)return ge(te,Od(te,J),ne);$d(te,J)}return null}function ae(te,J,ne,fe){var Pe=J!==null?J.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Pe!==null?null:P(te,J,""+ne,fe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:return ne.key===Pe?X(te,J,ne,fe):null;case w:return ne.key===Pe?se(te,J,ne,fe):null;case D:return ne=ro(ne),ae(te,J,ne,fe)}if(z(ne)||B(ne))return Pe!==null?null:de(te,J,ne,fe,null);if(typeof ne.then=="function")return ae(te,J,zd(ne),fe);if(ne.$$typeof===k)return ae(te,J,Od(te,ne),fe);$d(te,ne)}return null}function ue(te,J,ne,fe,Pe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(ne)||null,P(J,te,""+fe,Pe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?ne:fe.key)||null,X(J,te,fe,Pe);case w:return te=te.get(fe.key===null?ne:fe.key)||null,se(J,te,fe,Pe);case D:return fe=ro(fe),ue(te,J,ne,fe,Pe)}if(z(fe)||B(fe))return te=te.get(ne)||null,de(J,te,fe,Pe,null);if(typeof fe.then=="function")return ue(te,J,ne,zd(fe),Pe);if(fe.$$typeof===k)return ue(te,J,ne,Od(J,fe),Pe);$d(J,fe)}return null}function De(te,J,ne,fe){for(var Pe=null,ht=null,Oe=J,Qe=J=0,lt=null;Oe!==null&&Qe<ne.length;Qe++){Oe.index>Qe?(lt=Oe,Oe=null):lt=Oe.sibling;var ft=ae(te,Oe,ne[Qe],fe);if(ft===null){Oe===null&&(Oe=lt);break}n&&Oe&&ft.alternate===null&&a(te,Oe),J=y(ft,J,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft,Oe=lt}if(Qe===ne.length)return c(te,Oe),ut&&us(te,Qe),Pe;if(Oe===null){for(;Qe<ne.length;Qe++)Oe=ge(te,ne[Qe],fe),Oe!==null&&(J=y(Oe,J,Qe),ht===null?Pe=Oe:ht.sibling=Oe,ht=Oe);return ut&&us(te,Qe),Pe}for(Oe=f(Oe);Qe<ne.length;Qe++)lt=ue(Oe,te,Qe,ne[Qe],fe),lt!==null&&(n&&lt.alternate!==null&&Oe.delete(lt.key===null?Qe:lt.key),J=y(lt,J,Qe),ht===null?Pe=lt:ht.sibling=lt,ht=lt);return n&&Oe.forEach(function(ha){return a(te,ha)}),ut&&us(te,Qe),Pe}function ze(te,J,ne,fe){if(ne==null)throw Error(i(151));for(var Pe=null,ht=null,Oe=J,Qe=J=0,lt=null,ft=ne.next();Oe!==null&&!ft.done;Qe++,ft=ne.next()){Oe.index>Qe?(lt=Oe,Oe=null):lt=Oe.sibling;var ha=ae(te,Oe,ft.value,fe);if(ha===null){Oe===null&&(Oe=lt);break}n&&Oe&&ha.alternate===null&&a(te,Oe),J=y(ha,J,Qe),ht===null?Pe=ha:ht.sibling=ha,ht=ha,Oe=lt}if(ft.done)return c(te,Oe),ut&&us(te,Qe),Pe;if(Oe===null){for(;!ft.done;Qe++,ft=ne.next())ft=ge(te,ft.value,fe),ft!==null&&(J=y(ft,J,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return ut&&us(te,Qe),Pe}for(Oe=f(Oe);!ft.done;Qe++,ft=ne.next())ft=ue(Oe,te,Qe,ft.value,fe),ft!==null&&(n&&ft.alternate!==null&&Oe.delete(ft.key===null?Qe:ft.key),J=y(ft,J,Qe),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return n&&Oe.forEach(function(GD){return a(te,GD)}),ut&&us(te,Qe),Pe}function St(te,J,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===C&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case b:e:{for(var Pe=ne.key;J!==null;){if(J.key===Pe){if(Pe=ne.type,Pe===C){if(J.tag===7){c(te,J.sibling),fe=_(J,ne.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&ro(Pe)===J.type){c(te,J.sibling),fe=_(J,ne.props),Rc(fe,ne),fe.return=te,te=fe;break e}c(te,J);break}else a(te,J);J=J.sibling}ne.type===C?(fe=Za(ne.props.children,te.mode,fe,ne.key),fe.return=te,te=fe):(fe=jd(ne.type,ne.key,ne.props,null,te.mode,fe),Rc(fe,ne),fe.return=te,te=fe)}return A(te);case w:e:{for(Pe=ne.key;J!==null;){if(J.key===Pe)if(J.tag===4&&J.stateNode.containerInfo===ne.containerInfo&&J.stateNode.implementation===ne.implementation){c(te,J.sibling),fe=_(J,ne.children||[]),fe.return=te,te=fe;break e}else{c(te,J);break}else a(te,J);J=J.sibling}fe=gp(ne,te.mode,fe),fe.return=te,te=fe}return A(te);case D:return ne=ro(ne),St(te,J,ne,fe)}if(z(ne))return De(te,J,ne,fe);if(B(ne)){if(Pe=B(ne),typeof Pe!="function")throw Error(i(150));return ne=Pe.call(ne),ze(te,J,ne,fe)}if(typeof ne.then=="function")return St(te,J,zd(ne),fe);if(ne.$$typeof===k)return St(te,J,Od(te,ne),fe);$d(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,J!==null&&J.tag===6?(c(te,J.sibling),fe=_(J,ne),fe.return=te,te=fe):(c(te,J),fe=pp(ne,te.mode,fe),fe.return=te,te=fe),A(te)):c(te,J)}return function(te,J,ne,fe){try{Ec=0;var Pe=St(te,J,ne,fe);return dl=null,Pe}catch(Oe){if(Oe===ul||Oe===Pd)throw Oe;var ht=Si(29,Oe,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var no=r1(!0),i1=r1(!1),Ks=!1;function Np(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ap(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function Xs(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Zs(n,a,c){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(mt&2)!==0){var _=f.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),f.pending=a,a=Md(n),$b(n,null,c),a}return Td(n,f,a,c),Md(n)}function kc(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,qt(n,c)}}function Tp(n,a){var c=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var _=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var A={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?_=y=A:y=y.next=A,c=c.next}while(c!==null);y===null?_=y=a:y=y.next=a}else _=y=a;c={baseState:f.baseState,firstBaseUpdate:_,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=a:n.next=a,c.lastBaseUpdate=a}var Mp=!1;function Nc(){if(Mp){var n=cl;if(n!==null)throw n}}function Ac(n,a,c,f){Mp=!1;var _=n.updateQueue;Ks=!1;var y=_.firstBaseUpdate,A=_.lastBaseUpdate,P=_.shared.pending;if(P!==null){_.shared.pending=null;var X=P,se=X.next;X.next=null,A===null?y=se:A.next=se,A=X;var de=n.alternate;de!==null&&(de=de.updateQueue,P=de.lastBaseUpdate,P!==A&&(P===null?de.firstBaseUpdate=se:P.next=se,de.lastBaseUpdate=X))}if(y!==null){var ge=_.baseState;A=0,de=se=X=null,P=y;do{var ae=P.lane&-536870913,ue=ae!==P.lane;if(ue?(ot&ae)===ae:(f&ae)===ae){ae!==0&&ae===ll&&(Mp=!0),de!==null&&(de=de.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var De=n,ze=P;ae=a;var St=c;switch(ze.tag){case 1:if(De=ze.payload,typeof De=="function"){ge=De.call(St,ge,ae);break e}ge=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=ze.payload,ae=typeof De=="function"?De.call(St,ge,ae):De,ae==null)break e;ge=p({},ge,ae);break e;case 2:Ks=!0}}ae=P.callback,ae!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[ae]:ue.push(ae))}else ue={lane:ae,tag:P.tag,payload:P.payload,callback:P.callback,next:null},de===null?(se=de=ue,X=ge):de=de.next=ue,A|=ae;if(P=P.next,P===null){if(P=_.shared.pending,P===null)break;ue=P,P=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);de===null&&(X=ge),_.baseState=X,_.firstBaseUpdate=se,_.lastBaseUpdate=de,y===null&&(_.shared.lanes=0),ra|=A,n.lanes=A,n.memoizedState=ge}}function n1(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function s1(n,a){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)n1(c[n],a)}var hl=I(null),Ud=I(0);function a1(n,a){n=bs,K(Ud,n),K(hl,a),bs=n|a.baseLanes}function jp(){K(Ud,bs),K(hl,hl.current)}function Dp(){bs=Ud.current,Y(hl),Y(Ud)}var Ci=I(null),Ui=null;function Qs(n){var a=n.alternate;K(tr,tr.current&1),K(Ci,n),Ui===null&&(a===null||hl.current!==null||a.memoizedState!==null)&&(Ui=n)}function Lp(n){K(tr,tr.current),K(Ci,n),Ui===null&&(Ui=n)}function o1(n){n.tag===22?(K(tr,tr.current),K(Ci,n),Ui===null&&(Ui=n)):Js()}function Js(){K(tr,tr.current),K(Ci,Ci.current)}function Ei(n){Y(Ci),Ui===n&&(Ui=null),Y(tr)}var tr=I(0);function Hd(n){for(var a=n;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||$g(c)||Ug(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var fs=0,Xe=null,bt=null,ar=null,Fd=!1,fl=!1,so=!1,Wd=0,Tc=0,ml=null,P3=0;function Vt(){throw Error(i(321))}function Op(n,a){if(a===null)return!1;for(var c=0;c<a.length&&c<n.length;c++)if(!wi(n[c],a[c]))return!1;return!0}function Bp(n,a,c,f,_,y){return fs=y,Xe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,T.H=n===null||n.memoizedState===null?W1:Zp,so=!1,y=c(f,_),so=!1,fl&&(y=c1(a,c,f,_)),l1(n),y}function l1(n){T.H=Dc;var a=bt!==null&&bt.next!==null;if(fs=0,ar=bt=Xe=null,Fd=!1,Tc=0,ml=null,a)throw Error(i(300));n===null||or||(n=n.dependencies,n!==null&&Ld(n)&&(or=!0))}function c1(n,a,c,f){Xe=n;var _=0;do{if(fl&&(ml=null),Tc=0,fl=!1,25<=_)throw Error(i(301));if(_+=1,ar=bt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}T.H=q1,y=a(c,f)}while(fl);return y}function I3(){var n=T.H,a=n.useState()[0];return a=typeof a.then=="function"?Mc(a):a,n=n.useState()[0],(bt!==null?bt.memoizedState:null)!==n&&(Xe.flags|=1024),a}function Pp(){var n=Wd!==0;return Wd=0,n}function Ip(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function zp(n){if(Fd){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Fd=!1}fs=0,ar=bt=Xe=null,fl=!1,Tc=Wd=0,ml=null}function Kr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ar===null?Xe.memoizedState=ar=n:ar=ar.next=n,ar}function rr(){if(bt===null){var n=Xe.alternate;n=n!==null?n.memoizedState:null}else n=bt.next;var a=ar===null?Xe.memoizedState:ar.next;if(a!==null)ar=a,bt=n;else{if(n===null)throw Xe.alternate===null?Error(i(467)):Error(i(310));bt=n,n={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},ar===null?Xe.memoizedState=ar=n:ar=ar.next=n}return ar}function qd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mc(n){var a=Tc;return Tc+=1,ml===null&&(ml=[]),n=Jb(ml,n,a),a=Xe,(ar===null?a.memoizedState:ar.next)===null&&(a=a.alternate,T.H=a===null||a.memoizedState===null?W1:Zp),n}function Vd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Mc(n);if(n.$$typeof===k)return Dr(n)}throw Error(i(438,String(n)))}function $p(n){var a=null,c=Xe.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Xe.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=qd(),Xe.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(n),f=0;f<n;f++)c[f]=G;return a.index++,c}function ms(n,a){return typeof a=="function"?a(n):a}function Gd(n){var a=rr();return Up(a,bt,n)}function Up(n,a,c){var f=n.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=c;var _=n.baseQueue,y=f.pending;if(y!==null){if(_!==null){var A=_.next;_.next=y.next,y.next=A}a.baseQueue=_=y,f.pending=null}if(y=n.baseState,_===null)n.memoizedState=y;else{a=_.next;var P=A=null,X=null,se=a,de=!1;do{var ge=se.lane&-536870913;if(ge!==se.lane?(ot&ge)===ge:(fs&ge)===ge){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}),ge===ll&&(de=!0);else if((fs&ae)===ae){se=se.next,ae===ll&&(de=!0);continue}else ge={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},X===null?(P=X=ge,A=y):X=X.next=ge,Xe.lanes|=ae,ra|=ae;ge=se.action,so&&c(y,ge),y=se.hasEagerState?se.eagerState:c(y,ge)}else ae={lane:ge,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},X===null?(P=X=ae,A=y):X=X.next=ae,Xe.lanes|=ge,ra|=ge;se=se.next}while(se!==null&&se!==a);if(X===null?A=y:X.next=P,!wi(y,n.memoizedState)&&(or=!0,de&&(c=cl,c!==null)))throw c;n.memoizedState=y,n.baseState=A,n.baseQueue=X,f.lastRenderedState=y}return _===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function Hp(n){var a=rr(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var f=c.dispatch,_=c.pending,y=a.memoizedState;if(_!==null){c.pending=null;var A=_=_.next;do y=n(y,A.action),A=A.next;while(A!==_);wi(y,a.memoizedState)||(or=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),c.lastRenderedState=y}return[y,f]}function u1(n,a,c){var f=Xe,_=rr(),y=ut;if(y){if(c===void 0)throw Error(i(407));c=c()}else c=a();var A=!wi((bt||_).memoizedState,c);if(A&&(_.memoizedState=c,or=!0),_=_.queue,qp(f1.bind(null,f,_,n),[n]),_.getSnapshot!==a||A||ar!==null&&ar.memoizedState.tag&1){if(f.flags|=2048,pl(9,{destroy:void 0},h1.bind(null,f,_,c,a),null),kt===null)throw Error(i(349));y||(fs&127)!==0||d1(f,a,c)}return c}function d1(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=Xe.updateQueue,a===null?(a=qd(),Xe.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function h1(n,a,c,f){a.value=c,a.getSnapshot=f,m1(a)&&p1(n)}function f1(n,a,c){return c(function(){m1(a)&&p1(n)})}function m1(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!wi(n,c)}catch{return!0}}function p1(n){var a=Xa(n,2);a!==null&&fi(a,n,2)}function Fp(n){var a=Kr();if(typeof n=="function"){var c=n;if(n=c(),so){Rt(!0);try{c()}finally{Rt(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},a}function g1(n,a,c,f){return n.baseState=c,Up(n,bt,typeof f=="function"?f:ms)}function z3(n,a,c,f,_){if(Xd(n))throw Error(i(485));if(n=a.action,n!==null){var y={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){y.listeners.push(A)}};T.T!==null?c(!0):y.isTransition=!1,f(y),c=a.pending,c===null?(y.next=a.pending=y,v1(a,y)):(y.next=c.next,a.pending=c.next=y)}}function v1(n,a){var c=a.action,f=a.payload,_=n.state;if(a.isTransition){var y=T.T,A={};T.T=A;try{var P=c(_,f),X=T.S;X!==null&&X(A,P),_1(n,a,P)}catch(se){Wp(n,a,se)}finally{y!==null&&A.types!==null&&(y.types=A.types),T.T=y}}else try{y=c(_,f),_1(n,a,y)}catch(se){Wp(n,a,se)}}function _1(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){x1(n,a,f)},function(f){return Wp(n,a,f)}):x1(n,a,c)}function x1(n,a,c){a.status="fulfilled",a.value=c,y1(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,v1(n,c)))}function Wp(n,a,c){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,y1(a),a=a.next;while(a!==f)}n.action=null}function y1(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function b1(n,a){return a}function w1(n,a){if(ut){var c=kt.formState;if(c!==null){e:{var f=Xe;if(ut){if(jt){t:{for(var _=jt,y=$i;_.nodeType!==8;){if(!y){_=null;break t}if(_=Hi(_.nextSibling),_===null){_=null;break t}}y=_.data,_=y==="F!"||y==="F"?_:null}if(_){jt=Hi(_.nextSibling),f=_.data==="F!";break e}}Gs(f)}f=!1}f&&(a=c[0])}}return c=Kr(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:b1,lastRenderedState:a},c.queue=f,c=U1.bind(null,Xe,f),f.dispatch=c,f=Fp(!1),y=Xp.bind(null,Xe,!1,f.queue),f=Kr(),_={state:a,dispatch:null,action:n,pending:null},f.queue=_,c=z3.bind(null,Xe,_,y,c),_.dispatch=c,f.memoizedState=n,[a,c,!1]}function S1(n){var a=rr();return C1(a,bt,n)}function C1(n,a,c){if(a=Up(n,a,b1)[0],n=Gd(ms)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Mc(a)}catch(A){throw A===ul?Pd:A}else f=a;a=rr();var _=a.queue,y=_.dispatch;return c!==a.memoizedState&&(Xe.flags|=2048,pl(9,{destroy:void 0},$3.bind(null,_,c),null)),[f,y,n]}function $3(n,a){n.action=a}function E1(n){var a=rr(),c=bt;if(c!==null)return C1(a,c,n);rr(),a=a.memoizedState,c=rr();var f=c.queue.dispatch;return c.memoizedState=n,[a,f,!1]}function pl(n,a,c,f){return n={tag:n,create:c,deps:f,inst:a,next:null},a=Xe.updateQueue,a===null&&(a=qd(),Xe.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=n.next=n:(f=c.next,c.next=n,n.next=f,a.lastEffect=n),n}function R1(){return rr().memoizedState}function Yd(n,a,c,f){var _=Kr();Xe.flags|=n,_.memoizedState=pl(1|a,{destroy:void 0},c,f===void 0?null:f)}function Kd(n,a,c,f){var _=rr();f=f===void 0?null:f;var y=_.memoizedState.inst;bt!==null&&f!==null&&Op(f,bt.memoizedState.deps)?_.memoizedState=pl(a,y,c,f):(Xe.flags|=n,_.memoizedState=pl(1|a,y,c,f))}function k1(n,a){Yd(8390656,8,n,a)}function qp(n,a){Kd(2048,8,n,a)}function U3(n){Xe.flags|=4;var a=Xe.updateQueue;if(a===null)a=qd(),Xe.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function N1(n){var a=rr().memoizedState;return U3({ref:a,nextImpl:n}),function(){if((mt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function A1(n,a){return Kd(4,2,n,a)}function T1(n,a){return Kd(4,4,n,a)}function M1(n,a){if(typeof a=="function"){n=n();var c=a(n);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function j1(n,a,c){c=c!=null?c.concat([n]):null,Kd(4,4,M1.bind(null,a,n),c)}function Vp(){}function D1(n,a){var c=rr();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&Op(a,f[1])?f[0]:(c.memoizedState=[n,a],n)}function L1(n,a){var c=rr();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&Op(a,f[1]))return f[0];if(f=n(),so){Rt(!0);try{n()}finally{Rt(!1)}}return c.memoizedState=[f,a],f}function Gp(n,a,c){return c===void 0||(fs&1073741824)!==0&&(ot&261930)===0?n.memoizedState=a:(n.memoizedState=c,n=Ow(),Xe.lanes|=n,ra|=n,c)}function O1(n,a,c,f){return wi(c,a)?c:hl.current!==null?(n=Gp(n,c,f),wi(n,a)||(or=!0),n):(fs&42)===0||(fs&1073741824)!==0&&(ot&261930)===0?(or=!0,n.memoizedState=c):(n=Ow(),Xe.lanes|=n,ra|=n,a)}function B1(n,a,c,f,_){var y=U.p;U.p=y!==0&&8>y?y:8;var A=T.T,P={};T.T=P,Xp(n,!1,a,c);try{var X=_(),se=T.S;if(se!==null&&se(P,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var de=B3(X,f);jc(n,a,de,Ni(n))}else jc(n,a,f,Ni(n))}catch(ge){jc(n,a,{then:function(){},status:"rejected",reason:ge},Ni())}finally{U.p=y,A!==null&&P.types!==null&&(A.types=P.types),T.T=A}}function H3(){}function Yp(n,a,c,f){if(n.tag!==5)throw Error(i(476));var _=P1(n).queue;B1(n,_,a,H,c===null?H3:function(){return I1(n),c(f)})}function P1(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:H},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:c},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function I1(n){var a=P1(n);a.next===null&&(a=n.alternate.memoizedState),jc(n,a.next.queue,{},Ni())}function Kp(){return Dr(Kc)}function z1(){return rr().memoizedState}function $1(){return rr().memoizedState}function F3(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=Ni();n=Xs(c);var f=Zs(a,n,c);f!==null&&(fi(f,a,c),kc(f,a,c)),a={cache:Cp()},n.payload=a;return}a=a.return}}function W3(n,a,c){var f=Ni();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Xd(n)?H1(a,c):(c=fp(n,a,c,f),c!==null&&(fi(c,n,f),F1(c,a,f)))}function U1(n,a,c){var f=Ni();jc(n,a,c,f)}function jc(n,a,c,f){var _={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Xd(n))H1(a,_);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var A=a.lastRenderedState,P=y(A,c);if(_.hasEagerState=!0,_.eagerState=P,wi(P,A))return Td(n,a,_,0),kt===null&&Ad(),!1}catch{}finally{}if(c=fp(n,a,_,f),c!==null)return fi(c,n,f),F1(c,a,f),!0}return!1}function Xp(n,a,c,f){if(f={lane:2,revertLane:Ng(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Xd(n)){if(a)throw Error(i(479))}else a=fp(n,c,f,2),a!==null&&fi(a,n,2)}function Xd(n){var a=n.alternate;return n===Xe||a!==null&&a===Xe}function H1(n,a){fl=Fd=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function F1(n,a,c){if((c&4194048)!==0){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,qt(n,c)}}var Dc={readContext:Dr,use:Vd,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Dc.useEffectEvent=Vt;var W1={readContext:Dr,use:Vd,useCallback:function(n,a){return Kr().memoizedState=[n,a===void 0?null:a],n},useContext:Dr,useEffect:k1,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Yd(4194308,4,M1.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Yd(4194308,4,n,a)},useInsertionEffect:function(n,a){Yd(4,2,n,a)},useMemo:function(n,a){var c=Kr();a=a===void 0?null:a;var f=n();if(so){Rt(!0);try{n()}finally{Rt(!1)}}return c.memoizedState=[f,a],f},useReducer:function(n,a,c){var f=Kr();if(c!==void 0){var _=c(a);if(so){Rt(!0);try{c(a)}finally{Rt(!1)}}}else _=a;return f.memoizedState=f.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},f.queue=n,n=n.dispatch=W3.bind(null,Xe,n),[f.memoizedState,n]},useRef:function(n){var a=Kr();return n={current:n},a.memoizedState=n},useState:function(n){n=Fp(n);var a=n.queue,c=U1.bind(null,Xe,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:Vp,useDeferredValue:function(n,a){var c=Kr();return Gp(c,n,a)},useTransition:function(){var n=Fp(!1);return n=B1.bind(null,Xe,n.queue,!0,!1),Kr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var f=Xe,_=Kr();if(ut){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),kt===null)throw Error(i(349));(ot&127)!==0||d1(f,a,c)}_.memoizedState=c;var y={value:c,getSnapshot:a};return _.queue=y,k1(f1.bind(null,f,y,n),[n]),f.flags|=2048,pl(9,{destroy:void 0},h1.bind(null,f,y,c,a),null),c},useId:function(){var n=Kr(),a=kt.identifierPrefix;if(ut){var c=Dn,f=jn;c=(f&~(1<<32-xr(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Wd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=P3++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Kp,useFormState:w1,useActionState:w1,useOptimistic:function(n){var a=Kr();a.memoizedState=a.baseState=n;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Xp.bind(null,Xe,!0,c),c.dispatch=a,[n,a]},useMemoCache:$p,useCacheRefresh:function(){return Kr().memoizedState=F3.bind(null,Xe)},useEffectEvent:function(n){var a=Kr(),c={impl:n};return a.memoizedState=c,function(){if((mt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},Zp={readContext:Dr,use:Vd,useCallback:D1,useContext:Dr,useEffect:qp,useImperativeHandle:j1,useInsertionEffect:A1,useLayoutEffect:T1,useMemo:L1,useReducer:Gd,useRef:R1,useState:function(){return Gd(ms)},useDebugValue:Vp,useDeferredValue:function(n,a){var c=rr();return O1(c,bt.memoizedState,n,a)},useTransition:function(){var n=Gd(ms)[0],a=rr().memoizedState;return[typeof n=="boolean"?n:Mc(n),a]},useSyncExternalStore:u1,useId:z1,useHostTransitionStatus:Kp,useFormState:S1,useActionState:S1,useOptimistic:function(n,a){var c=rr();return g1(c,bt,n,a)},useMemoCache:$p,useCacheRefresh:$1};Zp.useEffectEvent=N1;var q1={readContext:Dr,use:Vd,useCallback:D1,useContext:Dr,useEffect:qp,useImperativeHandle:j1,useInsertionEffect:A1,useLayoutEffect:T1,useMemo:L1,useReducer:Hp,useRef:R1,useState:function(){return Hp(ms)},useDebugValue:Vp,useDeferredValue:function(n,a){var c=rr();return bt===null?Gp(c,n,a):O1(c,bt.memoizedState,n,a)},useTransition:function(){var n=Hp(ms)[0],a=rr().memoizedState;return[typeof n=="boolean"?n:Mc(n),a]},useSyncExternalStore:u1,useId:z1,useHostTransitionStatus:Kp,useFormState:E1,useActionState:E1,useOptimistic:function(n,a){var c=rr();return bt!==null?g1(c,bt,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:$p,useCacheRefresh:$1};q1.useEffectEvent=N1;function Qp(n,a,c,f){a=n.memoizedState,c=c(f,a),c=c==null?a:p({},a,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Jp={enqueueSetState:function(n,a,c){n=n._reactInternals;var f=Ni(),_=Xs(f);_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(fi(a,n,f),kc(a,n,f))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var f=Ni(),_=Xs(f);_.tag=1,_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(fi(a,n,f),kc(a,n,f))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=Ni(),f=Xs(c);f.tag=2,a!=null&&(f.callback=a),a=Zs(n,f,c),a!==null&&(fi(a,n,c),kc(a,n,c))}};function V1(n,a,c,f,_,y,A){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,y,A):a.prototype&&a.prototype.isPureReactComponent?!xc(c,f)||!xc(_,y):!0}function G1(n,a,c,f){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==n&&Jp.enqueueReplaceState(a,a.state,null)}function ao(n,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(n=n.defaultProps){c===a&&(c=p({},c));for(var _ in n)c[_]===void 0&&(c[_]=n[_])}return c}function Y1(n){Nd(n)}function K1(n){console.error(n)}function X1(n){Nd(n)}function Zd(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function Z1(n,a,c){try{var f=n.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function eg(n,a,c){return c=Xs(c),c.tag=3,c.payload={element:null},c.callback=function(){Zd(n,a)},c}function Q1(n){return n=Xs(n),n.tag=3,n}function J1(n,a,c,f){var _=c.type.getDerivedStateFromError;if(typeof _=="function"){var y=f.value;n.payload=function(){return _(y)},n.callback=function(){Z1(a,c,f)}}var A=c.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(n.callback=function(){Z1(a,c,f),typeof _!="function"&&(ia===null?ia=new Set([this]):ia.add(this));var P=f.stack;this.componentDidCatch(f.value,{componentStack:P!==null?P:""})})}function q3(n,a,c,f,_){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&ol(a,c,_,!0),c=Ci.current,c!==null){switch(c.tag){case 31:case 13:return Ui===null?ch():c.alternate===null&&Gt===0&&(Gt=3),c.flags&=-257,c.flags|=65536,c.lanes=_,f===Id?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),Eg(n,f,_)),!1;case 22:return c.flags|=65536,f===Id?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),Eg(n,f,_)),!1}throw Error(i(435,c.tag))}return Eg(n,f,_),ch(),!1}if(ut)return a=Ci.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,f!==xp&&(n=Error(i(422),{cause:f}),wc(Pi(n,c)))):(f!==xp&&(a=Error(i(423),{cause:f}),wc(Pi(a,c))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,f=Pi(f,c),_=eg(n.stateNode,f,_),Tp(n,_),Gt!==4&&(Gt=2)),!1;var y=Error(i(520),{cause:f});if(y=Pi(y,c),Uc===null?Uc=[y]:Uc.push(y),Gt!==4&&(Gt=2),a===null)return!0;f=Pi(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=_&-_,c.lanes|=n,n=eg(c.stateNode,f,n),Tp(c,n),!1;case 1:if(a=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(ia===null||!ia.has(y))))return c.flags|=65536,_&=-_,c.lanes|=_,_=Q1(_),J1(_,n,c,f),Tp(c,_),!1}c=c.return}while(c!==null);return!1}var tg=Error(i(461)),or=!1;function Lr(n,a,c,f){a.child=n===null?i1(a,null,c,f):no(a,n.child,c,f)}function ew(n,a,c,f,_){c=c.render;var y=a.ref;if("ref"in f){var A={};for(var P in f)P!=="ref"&&(A[P]=f[P])}else A=f;return eo(a),f=Bp(n,a,c,A,y,_),P=Pp(),n!==null&&!or?(Ip(n,a,_),ps(n,a,_)):(ut&&P&&vp(a),a.flags|=1,Lr(n,a,f,_),a.child)}function tw(n,a,c,f,_){if(n===null){var y=c.type;return typeof y=="function"&&!mp(y)&&y.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=y,rw(n,a,y,f,_)):(n=jd(c.type,null,f,a,a.mode,_),n.ref=a.ref,n.return=a,a.child=n)}if(y=n.child,!cg(n,_)){var A=y.memoizedProps;if(c=c.compare,c=c!==null?c:xc,c(A,f)&&n.ref===a.ref)return ps(n,a,_)}return a.flags|=1,n=cs(y,f),n.ref=a.ref,n.return=a,a.child=n}function rw(n,a,c,f,_){if(n!==null){var y=n.memoizedProps;if(xc(y,f)&&n.ref===a.ref)if(or=!1,a.pendingProps=f=y,cg(n,_))(n.flags&131072)!==0&&(or=!0);else return a.lanes=n.lanes,ps(n,a,_)}return rg(n,a,c,f,_)}function iw(n,a,c,f){var _=f.children,y=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,n!==null){for(f=a.child=n.child,_=0;f!==null;)_=_|f.lanes|f.childLanes,f=f.sibling;f=_&~y}else f=0,a.child=null;return nw(n,a,y,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Bd(a,y!==null?y.cachePool:null),y!==null?a1(a,y):jp(),o1(a);else return f=a.lanes=536870912,nw(n,a,y!==null?y.baseLanes|c:c,c,f)}else y!==null?(Bd(a,y.cachePool),a1(a,y),Js(),a.memoizedState=null):(n!==null&&Bd(a,null),jp(),Js());return Lr(n,a,_,c),a.child}function Lc(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function nw(n,a,c,f,_){var y=Rp();return y=y===null?null:{parent:sr._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},n!==null&&Bd(a,null),jp(),o1(a),n!==null&&ol(n,a,f,!0),a.childLanes=_,null}function Qd(n,a){return a=eh({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function sw(n,a,c){return no(a,n.child,null,c),n=Qd(a,a.pendingProps),n.flags|=2,Ei(a),a.memoizedState=null,n}function V3(n,a,c){var f=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(ut){if(f.mode==="hidden")return n=Qd(a,f),a.lanes=536870912,Lc(null,n);if(Lp(a),(n=jt)?(n=vS(n,$i),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:jn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},c=Hb(n),c.return=a,a.child=c,jr=a,jt=null)):n=null,n===null)throw Gs(a);return a.lanes=536870912,null}return Qd(a,f)}var y=n.memoizedState;if(y!==null){var A=y.dehydrated;if(Lp(a),_)if(a.flags&256)a.flags&=-257,a=sw(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(i(558));else if(or||ol(n,a,c,!1),_=(c&n.childLanes)!==0,or||_){if(f=kt,f!==null&&(A=ai(f,c),A!==0&&A!==y.retryLane))throw y.retryLane=A,Xa(n,A),fi(f,n,A),tg;ch(),a=sw(n,a,c)}else n=y.treeContext,jt=Hi(A.nextSibling),jr=a,ut=!0,Vs=null,$i=!1,n!==null&&qb(a,n),a=Qd(a,f),a.flags|=4096;return a}return n=cs(n.child,{mode:f.mode,children:f.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Jd(n,a){var c=a.ref;if(c===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(n===null||n.ref!==c)&&(a.flags|=4194816)}}function rg(n,a,c,f,_){return eo(a),c=Bp(n,a,c,f,void 0,_),f=Pp(),n!==null&&!or?(Ip(n,a,_),ps(n,a,_)):(ut&&f&&vp(a),a.flags|=1,Lr(n,a,c,_),a.child)}function aw(n,a,c,f,_,y){return eo(a),a.updateQueue=null,c=c1(a,f,c,_),l1(n),f=Pp(),n!==null&&!or?(Ip(n,a,y),ps(n,a,y)):(ut&&f&&vp(a),a.flags|=1,Lr(n,a,c,y),a.child)}function ow(n,a,c,f,_){if(eo(a),a.stateNode===null){var y=il,A=c.contextType;typeof A=="object"&&A!==null&&(y=Dr(A)),y=new c(f,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Jp,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=f,y.state=a.memoizedState,y.refs={},Np(a),A=c.contextType,y.context=typeof A=="object"&&A!==null?Dr(A):il,y.state=a.memoizedState,A=c.getDerivedStateFromProps,typeof A=="function"&&(Qp(a,c,A,f),y.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(A=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),A!==y.state&&Jp.enqueueReplaceState(y,y.state,null),Ac(a,f,y,_),Nc(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(n===null){y=a.stateNode;var P=a.memoizedProps,X=ao(c,P);y.props=X;var se=y.context,de=c.contextType;A=il,typeof de=="object"&&de!==null&&(A=Dr(de));var ge=c.getDerivedStateFromProps;de=typeof ge=="function"||typeof y.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,de||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(P||se!==A)&&G1(a,y,f,A),Ks=!1;var ae=a.memoizedState;y.state=ae,Ac(a,f,y,_),Nc(),se=a.memoizedState,P||ae!==se||Ks?(typeof ge=="function"&&(Qp(a,c,ge,f),se=a.memoizedState),(X=Ks||V1(a,c,X,f,ae,se,A))?(de||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=se),y.props=f,y.state=se,y.context=A,f=X):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{y=a.stateNode,Ap(n,a),A=a.memoizedProps,de=ao(c,A),y.props=de,ge=a.pendingProps,ae=y.context,se=c.contextType,X=il,typeof se=="object"&&se!==null&&(X=Dr(se)),P=c.getDerivedStateFromProps,(se=typeof P=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(A!==ge||ae!==X)&&G1(a,y,f,X),Ks=!1,ae=a.memoizedState,y.state=ae,Ac(a,f,y,_),Nc();var ue=a.memoizedState;A!==ge||ae!==ue||Ks||n!==null&&n.dependencies!==null&&Ld(n.dependencies)?(typeof P=="function"&&(Qp(a,c,P,f),ue=a.memoizedState),(de=Ks||V1(a,c,de,f,ae,ue,X)||n!==null&&n.dependencies!==null&&Ld(n.dependencies))?(se||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,ue,X),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,ue,X)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||A===n.memoizedProps&&ae===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&ae===n.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ue),y.props=f,y.state=ue,y.context=X,f=de):(typeof y.componentDidUpdate!="function"||A===n.memoizedProps&&ae===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&ae===n.memoizedState||(a.flags|=1024),f=!1)}return y=f,Jd(n,a),f=(a.flags&128)!==0,y||f?(y=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,n!==null&&f?(a.child=no(a,n.child,null,_),a.child=no(a,null,c,_)):Lr(n,a,c,_),a.memoizedState=y.state,n=a.child):n=ps(n,a,_),n}function lw(n,a,c,f){return Qa(),a.flags|=256,Lr(n,a,c,f),a.child}var ig={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ng(n){return{baseLanes:n,cachePool:Zb()}}function sg(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=ki),n}function cw(n,a,c){var f=a.pendingProps,_=!1,y=(a.flags&128)!==0,A;if((A=y)||(A=n!==null&&n.memoizedState===null?!1:(tr.current&2)!==0),A&&(_=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,n===null){if(ut){if(_?Qs(a):Js(),(n=jt)?(n=vS(n,$i),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:jn,overflow:Dn}:null,retryLane:536870912,hydrationErrors:null},c=Hb(n),c.return=a,a.child=c,jr=a,jt=null)):n=null,n===null)throw Gs(a);return Ug(n)?a.lanes=32:a.lanes=536870912,null}var P=f.children;return f=f.fallback,_?(Js(),_=a.mode,P=eh({mode:"hidden",children:P},_),f=Za(f,_,c,null),P.return=a,f.return=a,P.sibling=f,a.child=P,f=a.child,f.memoizedState=ng(c),f.childLanes=sg(n,A,c),a.memoizedState=ig,Lc(null,f)):(Qs(a),ag(a,P))}var X=n.memoizedState;if(X!==null&&(P=X.dehydrated,P!==null)){if(y)a.flags&256?(Qs(a),a.flags&=-257,a=og(n,a,c)):a.memoizedState!==null?(Js(),a.child=n.child,a.flags|=128,a=null):(Js(),P=f.fallback,_=a.mode,f=eh({mode:"visible",children:f.children},_),P=Za(P,_,c,null),P.flags|=2,f.return=a,P.return=a,f.sibling=P,a.child=f,no(a,n.child,null,c),f=a.child,f.memoizedState=ng(c),f.childLanes=sg(n,A,c),a.memoizedState=ig,a=Lc(null,f));else if(Qs(a),Ug(P)){if(A=P.nextSibling&&P.nextSibling.dataset,A)var se=A.dgst;A=se,f=Error(i(419)),f.stack="",f.digest=A,wc({value:f,source:null,stack:null}),a=og(n,a,c)}else if(or||ol(n,a,c,!1),A=(c&n.childLanes)!==0,or||A){if(A=kt,A!==null&&(f=ai(A,c),f!==0&&f!==X.retryLane))throw X.retryLane=f,Xa(n,f),fi(A,n,f),tg;$g(P)||ch(),a=og(n,a,c)}else $g(P)?(a.flags|=192,a.child=n.child,a=null):(n=X.treeContext,jt=Hi(P.nextSibling),jr=a,ut=!0,Vs=null,$i=!1,n!==null&&qb(a,n),a=ag(a,f.children),a.flags|=4096);return a}return _?(Js(),P=f.fallback,_=a.mode,X=n.child,se=X.sibling,f=cs(X,{mode:"hidden",children:f.children}),f.subtreeFlags=X.subtreeFlags&65011712,se!==null?P=cs(se,P):(P=Za(P,_,c,null),P.flags|=2),P.return=a,f.return=a,f.sibling=P,a.child=f,Lc(null,f),f=a.child,P=n.child.memoizedState,P===null?P=ng(c):(_=P.cachePool,_!==null?(X=sr._currentValue,_=_.parent!==X?{parent:X,pool:X}:_):_=Zb(),P={baseLanes:P.baseLanes|c,cachePool:_}),f.memoizedState=P,f.childLanes=sg(n,A,c),a.memoizedState=ig,Lc(n.child,f)):(Qs(a),c=n.child,n=c.sibling,c=cs(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,n!==null&&(A=a.deletions,A===null?(a.deletions=[n],a.flags|=16):A.push(n)),a.child=c,a.memoizedState=null,c)}function ag(n,a){return a=eh({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function eh(n,a){return n=Si(22,n,null,a),n.lanes=0,n}function og(n,a,c){return no(a,n.child,null,c),n=ag(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function uw(n,a,c){n.lanes|=a;var f=n.alternate;f!==null&&(f.lanes|=a),wp(n.return,a,c)}function lg(n,a,c,f,_,y){var A=n.memoizedState;A===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:_,treeForkCount:y}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=f,A.tail=c,A.tailMode=_,A.treeForkCount=y)}function dw(n,a,c){var f=a.pendingProps,_=f.revealOrder,y=f.tail;f=f.children;var A=tr.current,P=(A&2)!==0;if(P?(A=A&1|2,a.flags|=128):A&=1,K(tr,A),Lr(n,a,f,c),f=ut?bc:0,!P&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&uw(n,c,a);else if(n.tag===19)uw(n,c,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(_){case"forwards":for(c=a.child,_=null;c!==null;)n=c.alternate,n!==null&&Hd(n)===null&&(_=c),c=c.sibling;c=_,c===null?(_=a.child,a.child=null):(_=c.sibling,c.sibling=null),lg(a,!1,_,c,y,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,_=a.child,a.child=null;_!==null;){if(n=_.alternate,n!==null&&Hd(n)===null){a.child=_;break}n=_.sibling,_.sibling=c,c=_,_=n}lg(a,!0,c,null,y,f);break;case"together":lg(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function ps(n,a,c){if(n!==null&&(a.dependencies=n.dependencies),ra|=a.lanes,(c&a.childLanes)===0)if(n!==null){if(ol(n,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(i(153));if(a.child!==null){for(n=a.child,c=cs(n,n.pendingProps),a.child=c,c.return=a;n.sibling!==null;)n=n.sibling,c=c.sibling=cs(n,n.pendingProps),c.return=a;c.sibling=null}return a.child}function cg(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Ld(n)))}function G3(n,a,c){switch(a.tag){case 3:le(a,a.stateNode.containerInfo),Ys(a,sr,n.memoizedState.cache),Qa();break;case 27:case 5:Se(a);break;case 4:le(a,a.stateNode.containerInfo);break;case 10:Ys(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Lp(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Qs(a),a.flags|=128,null):(c&a.child.childLanes)!==0?cw(n,a,c):(Qs(a),n=ps(n,a,c),n!==null?n.sibling:null);Qs(a);break;case 19:var _=(n.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(ol(n,a,c,!1),f=(c&a.childLanes)!==0),_){if(f)return dw(n,a,c);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),K(tr,tr.current),f)break;return null;case 22:return a.lanes=0,iw(n,a,c,a.pendingProps);case 24:Ys(a,sr,n.memoizedState.cache)}return ps(n,a,c)}function hw(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)or=!0;else{if(!cg(n,c)&&(a.flags&128)===0)return or=!1,G3(n,a,c);or=(n.flags&131072)!==0}else or=!1,ut&&(a.flags&1048576)!==0&&Wb(a,bc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(n=ro(a.elementType),a.type=n,typeof n=="function")mp(n)?(f=ao(n,f),a.tag=1,a=ow(null,a,n,f,c)):(a.tag=0,a=rg(null,a,n,f,c));else{if(n!=null){var _=n.$$typeof;if(_===R){a.tag=11,a=ew(null,a,n,f,c);break e}else if(_===$){a.tag=14,a=tw(null,a,n,f,c);break e}}throw a=O(n)||n,Error(i(306,a,""))}}return a;case 0:return rg(n,a,a.type,a.pendingProps,c);case 1:return f=a.type,_=ao(f,a.pendingProps),ow(n,a,f,_,c);case 3:e:{if(le(a,a.stateNode.containerInfo),n===null)throw Error(i(387));f=a.pendingProps;var y=a.memoizedState;_=y.element,Ap(n,a),Ac(a,f,null,c);var A=a.memoizedState;if(f=A.cache,Ys(a,sr,f),f!==y.cache&&Sp(a,[sr],c,!0),Nc(),f=A.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=lw(n,a,f,c);break e}else if(f!==_){_=Pi(Error(i(424)),a),wc(_),a=lw(n,a,f,c);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(jt=Hi(n.firstChild),jr=a,ut=!0,Vs=null,$i=!0,c=i1(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Qa(),f===_){a=ps(n,a,c);break e}Lr(n,a,f,c)}a=a.child}return a;case 26:return Jd(n,a),n===null?(c=SS(a.type,null,a.pendingProps,null))?a.memoizedState=c:ut||(c=a.type,n=a.pendingProps,f=gh(ce.current).createElement(c),f[Mr]=a,f[oi]=n,Or(f,c,n),yr(f),a.stateNode=f):a.memoizedState=SS(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Se(a),n===null&&ut&&(f=a.stateNode=yS(a.type,a.pendingProps,ce.current),jr=a,$i=!0,_=jt,oa(a.type)?(Hg=_,jt=Hi(f.firstChild)):jt=_),Lr(n,a,a.pendingProps.children,c),Jd(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&ut&&((_=f=jt)&&(f=SD(f,a.type,a.pendingProps,$i),f!==null?(a.stateNode=f,jr=a,jt=Hi(f.firstChild),$i=!1,_=!0):_=!1),_||Gs(a)),Se(a),_=a.type,y=a.pendingProps,A=n!==null?n.memoizedProps:null,f=y.children,Pg(_,y)?f=null:A!==null&&Pg(_,A)&&(a.flags|=32),a.memoizedState!==null&&(_=Bp(n,a,I3,null,null,c),Kc._currentValue=_),Jd(n,a),Lr(n,a,f,c),a.child;case 6:return n===null&&ut&&((n=c=jt)&&(c=CD(c,a.pendingProps,$i),c!==null?(a.stateNode=c,jr=a,jt=null,n=!0):n=!1),n||Gs(a)),null;case 13:return cw(n,a,c);case 4:return le(a,a.stateNode.containerInfo),f=a.pendingProps,n===null?a.child=no(a,null,f,c):Lr(n,a,f,c),a.child;case 11:return ew(n,a,a.type,a.pendingProps,c);case 7:return Lr(n,a,a.pendingProps,c),a.child;case 8:return Lr(n,a,a.pendingProps.children,c),a.child;case 12:return Lr(n,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,Ys(a,a.type,f.value),Lr(n,a,f.children,c),a.child;case 9:return _=a.type._context,f=a.pendingProps.children,eo(a),_=Dr(_),f=f(_),a.flags|=1,Lr(n,a,f,c),a.child;case 14:return tw(n,a,a.type,a.pendingProps,c);case 15:return rw(n,a,a.type,a.pendingProps,c);case 19:return dw(n,a,c);case 31:return V3(n,a,c);case 22:return iw(n,a,c,a.pendingProps);case 24:return eo(a),f=Dr(sr),n===null?(_=Rp(),_===null&&(_=kt,y=Cp(),_.pooledCache=y,y.refCount++,y!==null&&(_.pooledCacheLanes|=c),_=y),a.memoizedState={parent:f,cache:_},Np(a),Ys(a,sr,_)):((n.lanes&c)!==0&&(Ap(n,a),Ac(a,null,null,c),Nc()),_=n.memoizedState,y=a.memoizedState,_.parent!==f?(_={parent:f,cache:f},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),Ys(a,sr,f)):(f=y.cache,Ys(a,sr,f),f!==_.cache&&Sp(a,[sr],c,!0))),Lr(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function gs(n){n.flags|=4}function ug(n,a,c,f,_){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if(zw())n.flags|=8192;else throw io=Id,kp}else n.flags&=-16777217}function fw(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!NS(a))if(zw())n.flags|=8192;else throw io=Id,kp}function th(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Ue():536870912,n.lanes|=a,xl|=a)}function Oc(n,a){if(!ut)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Dt(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,f=0;if(a)for(var _=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags&65011712,f|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags,f|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=f,n.childLanes=c,a}function Y3(n,a,c){var f=a.pendingProps;switch(_p(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(a),null;case 1:return Dt(a),null;case 3:return c=a.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),hs(sr),ie(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(al(a)?gs(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,yp())),Dt(a),null;case 26:var _=a.type,y=a.memoizedState;return n===null?(gs(a),y!==null?(Dt(a),fw(a,y)):(Dt(a),ug(a,_,null,f,c))):y?y!==n.memoizedState?(gs(a),Dt(a),fw(a,y)):(Dt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==f&&gs(a),Dt(a),ug(a,_,n,f,c)),null;case 27:if(be(a),c=ce.current,_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Dt(a),null}n=ee.current,al(a)?Vb(a):(n=yS(_,f,c),a.stateNode=n,gs(a))}return Dt(a),null;case 5:if(be(a),_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Dt(a),null}if(y=ee.current,al(a))Vb(a);else{var A=gh(ce.current);switch(y){case 1:y=A.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:y=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":y=A.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":y=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":y=A.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?A.createElement("select",{is:f.is}):A.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?A.createElement(_,{is:f.is}):A.createElement(_)}}y[Mr]=a,y[oi]=f;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)y.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=y;e:switch(Or(y,_,f),_){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&gs(a)}}return Dt(a),ug(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,c),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(i(166));if(n=ce.current,al(a)){if(n=a.stateNode,c=a.memoizedProps,f=null,_=jr,_!==null)switch(_.tag){case 27:case 5:f=_.memoizedProps}n[Mr]=a,n=!!(n.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||cS(n.nodeValue,c)),n||Gs(a,!0)}else n=gh(n).createTextNode(f),n[Mr]=a,a.stateNode=n}return Dt(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(f=al(a),c!==null){if(n===null){if(!f)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Mr]=a}else Qa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),n=!1}else c=yp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(Ei(a),a):(Ei(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Dt(a),null;case 13:if(f=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=al(a),f!==null&&f.dehydrated!==null){if(n===null){if(!_)throw Error(i(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(i(317));_[Mr]=a}else Qa(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),_=!1}else _=yp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Ei(a),a):(Ei(a),null)}return Ei(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,n=n!==null&&n.memoizedState!==null,c&&(f=a.child,_=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(_=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==_&&(f.flags|=2048)),c!==n&&c&&(a.child.flags|=8192),th(a,a.updateQueue),Dt(a),null);case 4:return ie(),n===null&&jg(a.stateNode.containerInfo),Dt(a),null;case 10:return hs(a.type),Dt(a),null;case 19:if(Y(tr),f=a.memoizedState,f===null)return Dt(a),null;if(_=(a.flags&128)!==0,y=f.rendering,y===null)if(_)Oc(f,!1);else{if(Gt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(y=Hd(n),y!==null){for(a.flags|=128,Oc(f,!1),n=y.updateQueue,a.updateQueue=n,th(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)Ub(c,n),c=c.sibling;return K(tr,tr.current&1|2),ut&&us(a,f.treeForkCount),a.child}n=n.sibling}f.tail!==null&&Ie()>ah&&(a.flags|=128,_=!0,Oc(f,!1),a.lanes=4194304)}else{if(!_)if(n=Hd(y),n!==null){if(a.flags|=128,_=!0,n=n.updateQueue,a.updateQueue=n,th(a,n),Oc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!ut)return Dt(a),null}else 2*Ie()-f.renderingStartTime>ah&&c!==536870912&&(a.flags|=128,_=!0,Oc(f,!1),a.lanes=4194304);f.isBackwards?(y.sibling=a.child,a.child=y):(n=f.last,n!==null?n.sibling=y:a.child=y,f.last=y)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=Ie(),n.sibling=null,c=tr.current,K(tr,_?c&1|2:c&1),ut&&us(a,f.treeForkCount),n):(Dt(a),null);case 22:case 23:return Ei(a),Dp(),f=a.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Dt(a),a.subtreeFlags&6&&(a.flags|=8192)):Dt(a),c=a.updateQueue,c!==null&&th(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),n!==null&&Y(to),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),hs(sr),Dt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function K3(n,a){switch(_p(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return hs(sr),ie(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return be(a),null;case 31:if(a.memoizedState!==null){if(Ei(a),a.alternate===null)throw Error(i(340));Qa()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Ei(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Qa()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Y(tr),null;case 4:return ie(),null;case 10:return hs(a.type),null;case 22:case 23:return Ei(a),Dp(),n!==null&&Y(to),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return hs(sr),null;case 25:return null;default:return null}}function mw(n,a){switch(_p(a),a.tag){case 3:hs(sr),ie();break;case 26:case 27:case 5:be(a);break;case 4:ie();break;case 31:a.memoizedState!==null&&Ei(a);break;case 13:Ei(a);break;case 19:Y(tr);break;case 10:hs(a.type);break;case 22:case 23:Ei(a),Dp(),n!==null&&Y(to);break;case 24:hs(sr)}}function Bc(n,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var _=f.next;c=_;do{if((c.tag&n)===n){f=void 0;var y=c.create,A=c.inst;f=y(),A.destroy=f}c=c.next}while(c!==_)}}catch(P){vt(a,a.return,P)}}function ea(n,a,c){try{var f=a.updateQueue,_=f!==null?f.lastEffect:null;if(_!==null){var y=_.next;f=y;do{if((f.tag&n)===n){var A=f.inst,P=A.destroy;if(P!==void 0){A.destroy=void 0,_=a;var X=c,se=P;try{se()}catch(de){vt(_,X,de)}}}f=f.next}while(f!==y)}}catch(de){vt(a,a.return,de)}}function pw(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{s1(a,c)}catch(f){vt(n,n.return,f)}}}function gw(n,a,c){c.props=ao(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(f){vt(n,a,f)}}function Pc(n,a){try{var c=n.ref;if(c!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof c=="function"?n.refCleanup=c(f):c.current=f}}catch(_){vt(n,a,_)}}function Ln(n,a){var c=n.ref,f=n.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(_){vt(n,a,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(_){vt(n,a,_)}else c.current=null}function vw(n){var a=n.type,c=n.memoizedProps,f=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(_){vt(n,n.return,_)}}function dg(n,a,c){try{var f=n.stateNode;vD(f,n.type,c,a),f[oi]=a}catch(_){vt(n,n.return,_)}}function _w(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&oa(n.type)||n.tag===4}function hg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||_w(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&oa(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function fg(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(n,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(n),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=os));else if(f!==4&&(f===27&&oa(n.type)&&(c=n.stateNode,a=null),n=n.child,n!==null))for(fg(n,a,c),n=n.sibling;n!==null;)fg(n,a,c),n=n.sibling}function rh(n,a,c){var f=n.tag;if(f===5||f===6)n=n.stateNode,a?c.insertBefore(n,a):c.appendChild(n);else if(f!==4&&(f===27&&oa(n.type)&&(c=n.stateNode),n=n.child,n!==null))for(rh(n,a,c),n=n.sibling;n!==null;)rh(n,a,c),n=n.sibling}function xw(n){var a=n.stateNode,c=n.memoizedProps;try{for(var f=n.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);Or(a,f,c),a[Mr]=n,a[oi]=c}catch(y){vt(n,n.return,y)}}var vs=!1,lr=!1,mg=!1,yw=typeof WeakSet=="function"?WeakSet:Set,br=null;function X3(n,a){if(n=n.containerInfo,Og=Sh,n=jb(n),op(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var _=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var A=0,P=-1,X=-1,se=0,de=0,ge=n,ae=null;t:for(;;){for(var ue;ge!==c||_!==0&&ge.nodeType!==3||(P=A+_),ge!==y||f!==0&&ge.nodeType!==3||(X=A+f),ge.nodeType===3&&(A+=ge.nodeValue.length),(ue=ge.firstChild)!==null;)ae=ge,ge=ue;for(;;){if(ge===n)break t;if(ae===c&&++se===_&&(P=A),ae===y&&++de===f&&(X=A),(ue=ge.nextSibling)!==null)break;ge=ae,ae=ge.parentNode}ge=ue}c=P===-1||X===-1?null:{start:P,end:X}}else c=null}c=c||{start:0,end:0}}else c=null;for(Bg={focusedElem:n,selectionRange:c},Sh=!1,br=a;br!==null;)if(a=br,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,br=n;else for(;br!==null;){switch(a=br,y=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(c=0;c<n.length;c++)_=n[c],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,c=a,_=y.memoizedProps,y=y.memoizedState,f=c.stateNode;try{var De=ao(c.type,_);n=f.getSnapshotBeforeUpdate(De,y),f.__reactInternalSnapshotBeforeUpdate=n}catch(ze){vt(c,c.return,ze)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,c=n.nodeType,c===9)zg(n);else if(c===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":zg(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=a.sibling,n!==null){n.return=a.return,br=n;break}br=a.return}}function bw(n,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:xs(n,c),f&4&&Bc(5,c);break;case 1:if(xs(n,c),f&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(A){vt(c,c.return,A)}else{var _=ao(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(_,a,n.__reactInternalSnapshotBeforeUpdate)}catch(A){vt(c,c.return,A)}}f&64&&pw(c),f&512&&Pc(c,c.return);break;case 3:if(xs(n,c),f&64&&(n=c.updateQueue,n!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{s1(n,a)}catch(A){vt(c,c.return,A)}}break;case 27:a===null&&f&4&&xw(c);case 26:case 5:xs(n,c),a===null&&f&4&&vw(c),f&512&&Pc(c,c.return);break;case 12:xs(n,c);break;case 31:xs(n,c),f&4&&Cw(n,c);break;case 13:xs(n,c),f&4&&Ew(n,c),f&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=sD.bind(null,c),ED(n,c))));break;case 22:if(f=c.memoizedState!==null||vs,!f){a=a!==null&&a.memoizedState!==null||lr,_=vs;var y=lr;vs=f,(lr=a)&&!y?ys(n,c,(c.subtreeFlags&8772)!==0):xs(n,c),vs=_,lr=y}break;case 30:break;default:xs(n,c)}}function ww(n){var a=n.alternate;a!==null&&(n.alternate=null,ww(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Wm(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var It=null,ci=!1;function _s(n,a,c){for(c=c.child;c!==null;)Sw(n,a,c),c=c.sibling}function Sw(n,a,c){if(er&&typeof er.onCommitFiberUnmount=="function")try{er.onCommitFiberUnmount(Fr,c)}catch{}switch(c.tag){case 26:lr||Ln(c,a),_s(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:lr||Ln(c,a);var f=It,_=ci;oa(c.type)&&(It=c.stateNode,ci=!1),_s(n,a,c),Vc(c.stateNode),It=f,ci=_;break;case 5:lr||Ln(c,a);case 6:if(f=It,_=ci,It=null,_s(n,a,c),It=f,ci=_,It!==null)if(ci)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(c.stateNode)}catch(y){vt(c,a,y)}else try{It.removeChild(c.stateNode)}catch(y){vt(c,a,y)}break;case 18:It!==null&&(ci?(n=It,pS(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),kl(n)):pS(It,c.stateNode));break;case 4:f=It,_=ci,It=c.stateNode.containerInfo,ci=!0,_s(n,a,c),It=f,ci=_;break;case 0:case 11:case 14:case 15:ea(2,c,a),lr||ea(4,c,a),_s(n,a,c);break;case 1:lr||(Ln(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&gw(c,a,f)),_s(n,a,c);break;case 21:_s(n,a,c);break;case 22:lr=(f=lr)||c.memoizedState!==null,_s(n,a,c),lr=f;break;default:_s(n,a,c)}}function Cw(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{kl(n)}catch(c){vt(a,a.return,c)}}}function Ew(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{kl(n)}catch(c){vt(a,a.return,c)}}function Z3(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new yw),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new yw),a;default:throw Error(i(435,n.tag))}}function ih(n,a){var c=Z3(n);a.forEach(function(f){if(!c.has(f)){c.add(f);var _=aD.bind(null,n,f);f.then(_,_)}})}function ui(n,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var _=c[f],y=n,A=a,P=A;e:for(;P!==null;){switch(P.tag){case 27:if(oa(P.type)){It=P.stateNode,ci=!1;break e}break;case 5:It=P.stateNode,ci=!1;break e;case 3:case 4:It=P.stateNode.containerInfo,ci=!0;break e}P=P.return}if(It===null)throw Error(i(160));Sw(y,A,_),It=null,ci=!1,y=_.alternate,y!==null&&(y.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Rw(a,n),a=a.sibling}var un=null;function Rw(n,a){var c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ui(a,n),di(n),f&4&&(ea(3,n,n.return),Bc(3,n),ea(5,n,n.return));break;case 1:ui(a,n),di(n),f&512&&(lr||c===null||Ln(c,c.return)),f&64&&vs&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var _=un;if(ui(a,n),di(n),f&512&&(lr||c===null||Ln(c,c.return)),f&4){var y=c!==null?c.memoizedState:null;if(f=n.memoizedState,c===null)if(f===null)if(n.stateNode===null){e:{f=n.type,c=n.memoizedProps,_=_.ownerDocument||_;t:switch(f){case"title":y=_.getElementsByTagName("title")[0],(!y||y[uc]||y[Mr]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=_.createElement(f),_.head.insertBefore(y,_.querySelector("head > title"))),Or(y,f,c),y[Mr]=n,yr(y),f=y;break e;case"link":var A=RS("link","href",_).get(f+(c.href||""));if(A){for(var P=0;P<A.length;P++)if(y=A[P],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){A.splice(P,1);break t}}y=_.createElement(f),Or(y,f,c),_.head.appendChild(y);break;case"meta":if(A=RS("meta","content",_).get(f+(c.content||""))){for(P=0;P<A.length;P++)if(y=A[P],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){A.splice(P,1);break t}}y=_.createElement(f),Or(y,f,c),_.head.appendChild(y);break;default:throw Error(i(468,f))}y[Mr]=n,yr(y),f=y}n.stateNode=f}else kS(_,n.type,n.stateNode);else n.stateNode=ES(_,f,n.memoizedProps);else y!==f?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,f===null?kS(_,n.type,n.stateNode):ES(_,f,n.memoizedProps)):f===null&&n.stateNode!==null&&dg(n,n.memoizedProps,c.memoizedProps)}break;case 27:ui(a,n),di(n),f&512&&(lr||c===null||Ln(c,c.return)),c!==null&&f&4&&dg(n,n.memoizedProps,c.memoizedProps);break;case 5:if(ui(a,n),di(n),f&512&&(lr||c===null||Ln(c,c.return)),n.flags&32){_=n.stateNode;try{Xo(_,"")}catch(De){vt(n,n.return,De)}}f&4&&n.stateNode!=null&&(_=n.memoizedProps,dg(n,_,c!==null?c.memoizedProps:_)),f&1024&&(mg=!0);break;case 6:if(ui(a,n),di(n),f&4){if(n.stateNode===null)throw Error(i(162));f=n.memoizedProps,c=n.stateNode;try{c.nodeValue=f}catch(De){vt(n,n.return,De)}}break;case 3:if(xh=null,_=un,un=vh(a.containerInfo),ui(a,n),un=_,di(n),f&4&&c!==null&&c.memoizedState.isDehydrated)try{kl(a.containerInfo)}catch(De){vt(n,n.return,De)}mg&&(mg=!1,kw(n));break;case 4:f=un,un=vh(n.stateNode.containerInfo),ui(a,n),di(n),un=f;break;case 12:ui(a,n),di(n);break;case 31:ui(a,n),di(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 13:ui(a,n),di(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(sh=Ie()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 22:_=n.memoizedState!==null;var X=c!==null&&c.memoizedState!==null,se=vs,de=lr;if(vs=se||_,lr=de||X,ui(a,n),lr=de,vs=se,di(n),f&8192)e:for(a=n.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(c===null||X||vs||lr||oo(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){X=c=a;try{if(y=X.stateNode,_)A=y.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{P=X.stateNode;var ge=X.memoizedProps.style,ae=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;P.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(De){vt(X,X.return,De)}}}else if(a.tag===6){if(c===null){X=a;try{X.stateNode.nodeValue=_?"":X.memoizedProps}catch(De){vt(X,X.return,De)}}}else if(a.tag===18){if(c===null){X=a;try{var ue=X.stateNode;_?gS(ue,!0):gS(X.stateNode,!1)}catch(De){vt(X,X.return,De)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=n.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,ih(n,c))));break;case 19:ui(a,n),di(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ih(n,f)));break;case 30:break;case 21:break;default:ui(a,n),di(n)}}function di(n){var a=n.flags;if(a&2){try{for(var c,f=n.return;f!==null;){if(_w(f)){c=f;break}f=f.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var _=c.stateNode,y=hg(n);rh(n,y,_);break;case 5:var A=c.stateNode;c.flags&32&&(Xo(A,""),c.flags&=-33);var P=hg(n);rh(n,P,A);break;case 3:case 4:var X=c.stateNode.containerInfo,se=hg(n);fg(n,se,X);break;default:throw Error(i(161))}}catch(de){vt(n,n.return,de)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function kw(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;kw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function xs(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)bw(n,a.alternate,a),a=a.sibling}function oo(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ea(4,a,a.return),oo(a);break;case 1:Ln(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&gw(a,a.return,c),oo(a);break;case 27:Vc(a.stateNode);case 26:case 5:Ln(a,a.return),oo(a);break;case 22:a.memoizedState===null&&oo(a);break;case 30:oo(a);break;default:oo(a)}n=n.sibling}}function ys(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,_=n,y=a,A=y.flags;switch(y.tag){case 0:case 11:case 15:ys(_,y,c),Bc(4,y);break;case 1:if(ys(_,y,c),f=y,_=f.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(se){vt(f,f.return,se)}if(f=y,_=f.updateQueue,_!==null){var P=f.stateNode;try{var X=_.shared.hiddenCallbacks;if(X!==null)for(_.shared.hiddenCallbacks=null,_=0;_<X.length;_++)n1(X[_],P)}catch(se){vt(f,f.return,se)}}c&&A&64&&pw(y),Pc(y,y.return);break;case 27:xw(y);case 26:case 5:ys(_,y,c),c&&f===null&&A&4&&vw(y),Pc(y,y.return);break;case 12:ys(_,y,c);break;case 31:ys(_,y,c),c&&A&4&&Cw(_,y);break;case 13:ys(_,y,c),c&&A&4&&Ew(_,y);break;case 22:y.memoizedState===null&&ys(_,y,c),Pc(y,y.return);break;case 30:break;default:ys(_,y,c)}a=a.sibling}}function pg(n,a){var c=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==c&&(n!=null&&n.refCount++,c!=null&&Sc(c))}function gg(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Sc(n))}function dn(n,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Nw(n,a,c,f),a=a.sibling}function Nw(n,a,c,f){var _=a.flags;switch(a.tag){case 0:case 11:case 15:dn(n,a,c,f),_&2048&&Bc(9,a);break;case 1:dn(n,a,c,f);break;case 3:dn(n,a,c,f),_&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Sc(n)));break;case 12:if(_&2048){dn(n,a,c,f),n=a.stateNode;try{var y=a.memoizedProps,A=y.id,P=y.onPostCommit;typeof P=="function"&&P(A,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(X){vt(a,a.return,X)}}else dn(n,a,c,f);break;case 31:dn(n,a,c,f);break;case 13:dn(n,a,c,f);break;case 23:break;case 22:y=a.stateNode,A=a.alternate,a.memoizedState!==null?y._visibility&2?dn(n,a,c,f):Ic(n,a):y._visibility&2?dn(n,a,c,f):(y._visibility|=2,gl(n,a,c,f,(a.subtreeFlags&10256)!==0||!1)),_&2048&&pg(A,a);break;case 24:dn(n,a,c,f),_&2048&&gg(a.alternate,a);break;default:dn(n,a,c,f)}}function gl(n,a,c,f,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=n,A=a,P=c,X=f,se=A.flags;switch(A.tag){case 0:case 11:case 15:gl(y,A,P,X,_),Bc(8,A);break;case 23:break;case 22:var de=A.stateNode;A.memoizedState!==null?de._visibility&2?gl(y,A,P,X,_):Ic(y,A):(de._visibility|=2,gl(y,A,P,X,_)),_&&se&2048&&pg(A.alternate,A);break;case 24:gl(y,A,P,X,_),_&&se&2048&&gg(A.alternate,A);break;default:gl(y,A,P,X,_)}a=a.sibling}}function Ic(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,f=a,_=f.flags;switch(f.tag){case 22:Ic(c,f),_&2048&&pg(f.alternate,f);break;case 24:Ic(c,f),_&2048&&gg(f.alternate,f);break;default:Ic(c,f)}a=a.sibling}}var zc=8192;function vl(n,a,c){if(n.subtreeFlags&zc)for(n=n.child;n!==null;)Aw(n,a,c),n=n.sibling}function Aw(n,a,c){switch(n.tag){case 26:vl(n,a,c),n.flags&zc&&n.memoizedState!==null&&PD(c,un,n.memoizedState,n.memoizedProps);break;case 5:vl(n,a,c);break;case 3:case 4:var f=un;un=vh(n.stateNode.containerInfo),vl(n,a,c),un=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=zc,zc=16777216,vl(n,a,c),zc=f):vl(n,a,c));break;default:vl(n,a,c)}}function Tw(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function $c(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];br=f,jw(f,n)}Tw(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Mw(n),n=n.sibling}function Mw(n){switch(n.tag){case 0:case 11:case 15:$c(n),n.flags&2048&&ea(9,n,n.return);break;case 3:$c(n);break;case 12:$c(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,nh(n)):$c(n);break;default:$c(n)}}function nh(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];br=f,jw(f,n)}Tw(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ea(8,a,a.return),nh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,nh(a));break;default:nh(a)}n=n.sibling}}function jw(n,a){for(;br!==null;){var c=br;switch(c.tag){case 0:case 11:case 15:ea(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Sc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,br=f;else e:for(c=n;br!==null;){f=br;var _=f.sibling,y=f.return;if(ww(f),f===c){br=null;break e}if(_!==null){_.return=y,br=_;break e}br=y}}}var Q3={getCacheForType:function(n){var a=Dr(sr),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return Dr(sr).controller.signal}},J3=typeof WeakMap=="function"?WeakMap:Map,mt=0,kt=null,it=null,ot=0,gt=0,Ri=null,ta=!1,_l=!1,vg=!1,bs=0,Gt=0,ra=0,lo=0,_g=0,ki=0,xl=0,Uc=null,hi=null,xg=!1,sh=0,Dw=0,ah=1/0,oh=null,ia=null,fr=0,na=null,yl=null,ws=0,yg=0,bg=null,Lw=null,Hc=0,wg=null;function Ni(){return(mt&2)!==0&&ot!==0?ot&-ot:T.T!==null?Ng():Hm()}function Ow(){if(ki===0)if((ot&536870912)===0||ut){var n=ss;ss<<=1,(ss&3932160)===0&&(ss=262144),ki=n}else ki=536870912;return n=Ci.current,n!==null&&(n.flags|=32),ki}function fi(n,a,c){(n===kt&&(gt===2||gt===9)||n.cancelPendingCommit!==null)&&(bl(n,0),sa(n,ot,ki,!1)),Ze(n,c),((mt&2)===0||n!==kt)&&(n===kt&&((mt&2)===0&&(lo|=c),Gt===4&&sa(n,ot,ki,!1)),On(n))}function Bw(n,a,c){if((mt&6)!==0)throw Error(i(327));var f=!c&&(a&127)===0&&(a&n.expiredLanes)===0||pe(n,a),_=f?rD(n,a):Cg(n,a,!0),y=f;do{if(_===0){_l&&!f&&sa(n,a,0,!1);break}else{if(c=n.current.alternate,y&&!eD(c)){_=Cg(n,a,!1),y=!1;continue}if(_===2){if(y=a,n.errorRecoveryDisabledLanes&y)var A=0;else A=n.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var P=n;_=Uc;var X=P.current.memoizedState.isDehydrated;if(X&&(bl(P,A).flags|=256),A=Cg(P,A,!1),A!==2){if(vg&&!X){P.errorRecoveryDisabledLanes|=y,lo|=y,_=4;break e}y=hi,hi=_,y!==null&&(hi===null?hi=y:hi.push.apply(hi,y))}_=A}if(y=!1,_!==2)continue}}if(_===1){bl(n,0),sa(n,a,0,!0);break}e:{switch(f=n,y=_,y){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:sa(f,a,ki,!ta);break e;case 2:hi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(_=sh+300-Ie(),10<_)){if(sa(f,a,ki,!ta),$e(f,0,!0)!==0)break e;ws=a,f.timeoutHandle=fS(Pw.bind(null,f,c,hi,oh,xg,a,ki,lo,xl,ta,y,"Throttled",-0,0),_);break e}Pw(f,c,hi,oh,xg,a,ki,lo,xl,ta,y,null,-0,0)}}break}while(!0);On(n)}function Pw(n,a,c,f,_,y,A,P,X,se,de,ge,ae,ue){if(n.timeoutHandle=-1,ge=a.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:os},Aw(a,y,ge);var De=(y&62914560)===y?sh-Ie():(y&4194048)===y?Dw-Ie():0;if(De=ID(ge,De),De!==null){ws=y,n.cancelPendingCommit=De(qw.bind(null,n,a,y,c,f,_,A,P,X,de,ge,null,ae,ue)),sa(n,y,A,!se);return}}qw(n,a,y,c,f,_,A,P,X)}function eD(n){for(var a=n;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var _=c[f],y=_.getSnapshot;_=_.value;try{if(!wi(y(),_))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function sa(n,a,c,f){a&=~_g,a&=~lo,n.suspendedLanes|=a,n.pingedLanes&=~a,f&&(n.warmLanes|=a),f=n.expirationTimes;for(var _=a;0<_;){var y=31-xr(_),A=1<<y;f[y]=-1,_&=~A}c!==0&&si(n,c,a)}function lh(){return(mt&6)===0?(Fc(0),!1):!0}function Sg(){if(it!==null){if(gt===0)var n=it.return;else n=it,ds=Ja=null,zp(n),dl=null,Ec=0,n=it;for(;n!==null;)mw(n.alternate,n),n=n.return;it=null}}function bl(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,yD(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),ws=0,Sg(),kt=n,it=c=cs(n.current,null),ot=a,gt=0,Ri=null,ta=!1,_l=pe(n,a),vg=!1,xl=ki=_g=lo=ra=Gt=0,hi=Uc=null,xg=!1,(a&8)!==0&&(a|=a&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=a;0<f;){var _=31-xr(f),y=1<<_;a|=n[_],f&=~y}return bs=a,Ad(),c}function Iw(n,a){Xe=null,T.H=Dc,a===ul||a===Pd?(a=e1(),gt=3):a===kp?(a=e1(),gt=4):gt=a===tg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ri=a,it===null&&(Gt=1,Zd(n,Pi(a,n.current)))}function zw(){var n=Ci.current;return n===null?!0:(ot&4194048)===ot?Ui===null:(ot&62914560)===ot||(ot&536870912)!==0?n===Ui:!1}function $w(){var n=T.H;return T.H=Dc,n===null?Dc:n}function Uw(){var n=T.A;return T.A=Q3,n}function ch(){Gt=4,ta||(ot&4194048)!==ot&&Ci.current!==null||(_l=!0),(ra&134217727)===0&&(lo&134217727)===0||kt===null||sa(kt,ot,ki,!1)}function Cg(n,a,c){var f=mt;mt|=2;var _=$w(),y=Uw();(kt!==n||ot!==a)&&(oh=null,bl(n,a)),a=!1;var A=Gt;e:do try{if(gt!==0&&it!==null){var P=it,X=Ri;switch(gt){case 8:Sg(),A=6;break e;case 3:case 2:case 9:case 6:Ci.current===null&&(a=!0);var se=gt;if(gt=0,Ri=null,wl(n,P,X,se),c&&_l){A=0;break e}break;default:se=gt,gt=0,Ri=null,wl(n,P,X,se)}}tD(),A=Gt;break}catch(de){Iw(n,de)}while(!0);return a&&n.shellSuspendCounter++,ds=Ja=null,mt=f,T.H=_,T.A=y,it===null&&(kt=null,ot=0,Ad()),A}function tD(){for(;it!==null;)Hw(it)}function rD(n,a){var c=mt;mt|=2;var f=$w(),_=Uw();kt!==n||ot!==a?(oh=null,ah=Ie()+500,bl(n,a)):_l=pe(n,a);e:do try{if(gt!==0&&it!==null){a=it;var y=Ri;t:switch(gt){case 1:gt=0,Ri=null,wl(n,a,y,1);break;case 2:case 9:if(Qb(y)){gt=0,Ri=null,Fw(a);break}a=function(){gt!==2&&gt!==9||kt!==n||(gt=7),On(n)},y.then(a,a);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:Qb(y)?(gt=0,Ri=null,Fw(a)):(gt=0,Ri=null,wl(n,a,y,7));break;case 5:var A=null;switch(it.tag){case 26:A=it.memoizedState;case 5:case 27:var P=it;if(A?NS(A):P.stateNode.complete){gt=0,Ri=null;var X=P.sibling;if(X!==null)it=X;else{var se=P.return;se!==null?(it=se,uh(se)):it=null}break t}}gt=0,Ri=null,wl(n,a,y,5);break;case 6:gt=0,Ri=null,wl(n,a,y,6);break;case 8:Sg(),Gt=6;break e;default:throw Error(i(462))}}iD();break}catch(de){Iw(n,de)}while(!0);return ds=Ja=null,T.H=f,T.A=_,mt=c,it!==null?0:(kt=null,ot=0,Ad(),Gt)}function iD(){for(;it!==null&&!qe();)Hw(it)}function Hw(n){var a=hw(n.alternate,n,bs);n.memoizedProps=n.pendingProps,a===null?uh(n):it=a}function Fw(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=aw(c,a,a.pendingProps,a.type,void 0,ot);break;case 11:a=aw(c,a,a.pendingProps,a.type.render,a.ref,ot);break;case 5:zp(a);default:mw(c,a),a=it=Ub(a,bs),a=hw(c,a,bs)}n.memoizedProps=n.pendingProps,a===null?uh(n):it=a}function wl(n,a,c,f){ds=Ja=null,zp(a),dl=null,Ec=0;var _=a.return;try{if(q3(n,_,a,c,ot)){Gt=1,Zd(n,Pi(c,n.current)),it=null;return}}catch(y){if(_!==null)throw it=_,y;Gt=1,Zd(n,Pi(c,n.current)),it=null;return}a.flags&32768?(ut||f===1?n=!0:_l||(ot&536870912)!==0?n=!1:(ta=n=!0,(f===2||f===9||f===3||f===6)&&(f=Ci.current,f!==null&&f.tag===13&&(f.flags|=16384))),Ww(a,n)):uh(a)}function uh(n){var a=n;do{if((a.flags&32768)!==0){Ww(a,ta);return}n=a.return;var c=Y3(a.alternate,a,bs);if(c!==null){it=c;return}if(a=a.sibling,a!==null){it=a;return}it=a=n}while(a!==null);Gt===0&&(Gt=5)}function Ww(n,a){do{var c=K3(n.alternate,n);if(c!==null){c.flags&=32767,it=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(n=n.sibling,n!==null)){it=n;return}it=n=c}while(n!==null);Gt=6,it=null}function qw(n,a,c,f,_,y,A,P,X){n.cancelPendingCommit=null;do dh();while(fr!==0);if((mt&6)!==0)throw Error(i(327));if(a!==null){if(a===n.current)throw Error(i(177));if(y=a.lanes|a.childLanes,y|=hp,Wt(n,c,y,A,P,X),n===kt&&(it=kt=null,ot=0),yl=a,na=n,ws=c,yg=y,bg=_,Lw=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,oD(xt,function(){return Xw(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=T.T,T.T=null,_=U.p,U.p=2,A=mt,mt|=4;try{X3(n,a,c)}finally{mt=A,U.p=_,T.T=f}}fr=1,Vw(),Gw(),Yw()}}function Vw(){if(fr===1){fr=0;var n=na,a=yl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=mt;mt|=4;try{Rw(a,n);var y=Bg,A=jb(n.containerInfo),P=y.focusedElem,X=y.selectionRange;if(A!==P&&P&&P.ownerDocument&&Mb(P.ownerDocument.documentElement,P)){if(X!==null&&op(P)){var se=X.start,de=X.end;if(de===void 0&&(de=se),"selectionStart"in P)P.selectionStart=se,P.selectionEnd=Math.min(de,P.value.length);else{var ge=P.ownerDocument||document,ae=ge&&ge.defaultView||window;if(ae.getSelection){var ue=ae.getSelection(),De=P.textContent.length,ze=Math.min(X.start,De),St=X.end===void 0?ze:Math.min(X.end,De);!ue.extend&&ze>St&&(A=St,St=ze,ze=A);var te=Tb(P,ze),J=Tb(P,St);if(te&&J&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==J.node||ue.focusOffset!==J.offset)){var ne=ge.createRange();ne.setStart(te.node,te.offset),ue.removeAllRanges(),ze>St?(ue.addRange(ne),ue.extend(J.node,J.offset)):(ne.setEnd(J.node,J.offset),ue.addRange(ne))}}}}for(ge=[],ue=P;ue=ue.parentNode;)ue.nodeType===1&&ge.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ge.length;P++){var fe=ge[P];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Sh=!!Og,Bg=Og=null}finally{mt=_,U.p=f,T.T=c}}n.current=a,fr=2}}function Gw(){if(fr===2){fr=0;var n=na,a=yl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=mt;mt|=4;try{bw(n,a.alternate,a)}finally{mt=_,U.p=f,T.T=c}}fr=3}}function Yw(){if(fr===4||fr===3){fr=0,Pt();var n=na,a=yl,c=ws,f=Lw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?fr=5:(fr=0,yl=na=null,Kw(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(ia=null),ln(c),a=a.stateNode,er&&typeof er.onCommitFiberRoot=="function")try{er.onCommitFiberRoot(Fr,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=T.T,_=U.p,U.p=2,T.T=null;try{for(var y=n.onRecoverableError,A=0;A<f.length;A++){var P=f[A];y(P.value,{componentStack:P.stack})}}finally{T.T=a,U.p=_}}(ws&3)!==0&&dh(),On(n),_=n.pendingLanes,(c&261930)!==0&&(_&42)!==0?n===wg?Hc++:(Hc=0,wg=n):Hc=0,Fc(0)}}function Kw(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Sc(a)))}function dh(){return Vw(),Gw(),Yw(),Xw()}function Xw(){if(fr!==5)return!1;var n=na,a=yg;yg=0;var c=ln(ws),f=T.T,_=U.p;try{U.p=32>c?32:c,T.T=null,c=bg,bg=null;var y=na,A=ws;if(fr=0,yl=na=null,ws=0,(mt&6)!==0)throw Error(i(331));var P=mt;if(mt|=4,Mw(y.current),Nw(y,y.current,A,c),mt=P,Fc(0,!1),er&&typeof er.onPostCommitFiberRoot=="function")try{er.onPostCommitFiberRoot(Fr,y)}catch{}return!0}finally{U.p=_,T.T=f,Kw(n,a)}}function Zw(n,a,c){a=Pi(c,a),a=eg(n.stateNode,a,2),n=Zs(n,a,2),n!==null&&(Ze(n,2),On(n))}function vt(n,a,c){if(n.tag===3)Zw(n,n,c);else for(;a!==null;){if(a.tag===3){Zw(a,n,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ia===null||!ia.has(f))){n=Pi(c,n),c=Q1(2),f=Zs(a,c,2),f!==null&&(J1(c,f,a,n),Ze(f,2),On(f));break}}a=a.return}}function Eg(n,a,c){var f=n.pingCache;if(f===null){f=n.pingCache=new J3;var _=new Set;f.set(a,_)}else _=f.get(a),_===void 0&&(_=new Set,f.set(a,_));_.has(c)||(vg=!0,_.add(c),n=nD.bind(null,n,a,c),a.then(n,n))}function nD(n,a,c){var f=n.pingCache;f!==null&&f.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,kt===n&&(ot&c)===c&&(Gt===4||Gt===3&&(ot&62914560)===ot&&300>Ie()-sh?(mt&2)===0&&bl(n,0):_g|=c,xl===ot&&(xl=0)),On(n)}function Qw(n,a){a===0&&(a=Ue()),n=Xa(n,a),n!==null&&(Ze(n,a),On(n))}function sD(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),Qw(n,c)}function aD(n,a){var c=0;switch(n.tag){case 31:case 13:var f=n.stateNode,_=n.memoizedState;_!==null&&(c=_.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(a),Qw(n,c)}function oD(n,a){return Ye(n,a)}var hh=null,Sl=null,Rg=!1,fh=!1,kg=!1,aa=0;function On(n){n!==Sl&&n.next===null&&(Sl===null?hh=Sl=n:Sl=Sl.next=n),fh=!0,Rg||(Rg=!0,cD())}function Fc(n,a){if(!kg&&fh){kg=!0;do for(var c=!1,f=hh;f!==null;){if(n!==0){var _=f.pendingLanes;if(_===0)var y=0;else{var A=f.suspendedLanes,P=f.pingedLanes;y=(1<<31-xr(42|n)+1)-1,y&=_&~(A&~P),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,rS(f,y))}else y=ot,y=$e(f,f===kt?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||pe(f,y)||(c=!0,rS(f,y));f=f.next}while(c);kg=!1}}function lD(){Jw()}function Jw(){fh=Rg=!1;var n=0;aa!==0&&xD()&&(n=aa);for(var a=Ie(),c=null,f=hh;f!==null;){var _=f.next,y=eS(f,a);y===0?(f.next=null,c===null?hh=_:c.next=_,_===null&&(Sl=c)):(c=f,(n!==0||(y&3)!==0)&&(fh=!0)),f=_}fr!==0&&fr!==5||Fc(n),aa!==0&&(aa=0)}function eS(n,a){for(var c=n.suspendedLanes,f=n.pingedLanes,_=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var A=31-xr(y),P=1<<A,X=_[A];X===-1?((P&c)===0||(P&f)!==0)&&(_[A]=ke(P,a)):X<=a&&(n.expiredLanes|=P),y&=~P}if(a=kt,c=ot,c=$e(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,c===0||n===a&&(gt===2||gt===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&at(f),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||pe(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(f!==null&&at(f),ln(c)){case 2:case 8:c=Jt;break;case 32:c=xt;break;case 268435456:c=Ft;break;default:c=xt}return f=tS.bind(null,n),c=Ye(c,f),n.callbackPriority=a,n.callbackNode=c,a}return f!==null&&f!==null&&at(f),n.callbackPriority=2,n.callbackNode=null,2}function tS(n,a){if(fr!==0&&fr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(dh()&&n.callbackNode!==c)return null;var f=ot;return f=$e(n,n===kt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(Bw(n,f,a),eS(n,Ie()),n.callbackNode!=null&&n.callbackNode===c?tS.bind(null,n):null)}function rS(n,a){if(dh())return null;Bw(n,a,!0)}function cD(){bD(function(){(mt&6)!==0?Ye(pt,lD):Jw()})}function Ng(){if(aa===0){var n=ll;n===0&&(n=ns,ns<<=1,(ns&261888)===0&&(ns=256)),aa=n}return aa}function iS(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:bd(""+n)}function nS(n,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,n.id&&c.setAttribute("form",n.id),a.parentNode.insertBefore(c,a),n=new FormData(n),c.parentNode.removeChild(c),n}function uD(n,a,c,f,_){if(a==="submit"&&c&&c.stateNode===_){var y=iS((_[oi]||null).action),A=f.submitter;A&&(a=(a=A[oi]||null)?iS(a.formAction):A.getAttribute("formAction"),a!==null&&(y=a,A=null));var P=new Ed("action","action",null,f,_);n.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(aa!==0){var X=A?nS(_,A):new FormData(_);Yp(c,{pending:!0,data:X,method:_.method,action:y},null,X)}}else typeof y=="function"&&(P.preventDefault(),X=A?nS(_,A):new FormData(_),Yp(c,{pending:!0,data:X,method:_.method,action:y},y,X))},currentTarget:_}]})}}for(var Ag=0;Ag<dp.length;Ag++){var Tg=dp[Ag],dD=Tg.toLowerCase(),hD=Tg[0].toUpperCase()+Tg.slice(1);cn(dD,"on"+hD)}cn(Ob,"onAnimationEnd"),cn(Bb,"onAnimationIteration"),cn(Pb,"onAnimationStart"),cn("dblclick","onDoubleClick"),cn("focusin","onFocus"),cn("focusout","onBlur"),cn(N3,"onTransitionRun"),cn(A3,"onTransitionStart"),cn(T3,"onTransitionCancel"),cn(Ib,"onTransitionEnd"),Yo("onMouseEnter",["mouseout","mouseover"]),Yo("onMouseLeave",["mouseout","mouseover"]),Yo("onPointerEnter",["pointerout","pointerover"]),Yo("onPointerLeave",["pointerout","pointerover"]),Va("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Va("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Va("onBeforeInput",["compositionend","keypress","textInput","paste"]),Va("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wc="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(" "),fD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wc));function sS(n,a){a=(a&4)!==0;for(var c=0;c<n.length;c++){var f=n[c],_=f.event;f=f.listeners;e:{var y=void 0;if(a)for(var A=f.length-1;0<=A;A--){var P=f[A],X=P.instance,se=P.currentTarget;if(P=P.listener,X!==y&&_.isPropagationStopped())break e;y=P,_.currentTarget=se;try{y(_)}catch(de){Nd(de)}_.currentTarget=null,y=X}else for(A=0;A<f.length;A++){if(P=f[A],X=P.instance,se=P.currentTarget,P=P.listener,X!==y&&_.isPropagationStopped())break e;y=P,_.currentTarget=se;try{y(_)}catch(de){Nd(de)}_.currentTarget=null,y=X}}}}function nt(n,a){var c=a[Fm];c===void 0&&(c=a[Fm]=new Set);var f=n+"__bubble";c.has(f)||(aS(a,n,2,!1),c.add(f))}function Mg(n,a,c){var f=0;a&&(f|=4),aS(c,n,f,a)}var mh="_reactListening"+Math.random().toString(36).slice(2);function jg(n){if(!n[mh]){n[mh]=!0,Jy.forEach(function(c){c!=="selectionchange"&&(fD.has(c)||Mg(c,!1,n),Mg(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[mh]||(a[mh]=!0,Mg("selectionchange",!1,a))}}function aS(n,a,c,f){switch(OS(a)){case 2:var _=UD;break;case 8:_=HD;break;default:_=Gg}c=_.bind(null,a,c,n),_=void 0,!Qm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),f?_!==void 0?n.addEventListener(a,c,{capture:!0,passive:_}):n.addEventListener(a,c,!0):_!==void 0?n.addEventListener(a,c,{passive:_}):n.addEventListener(a,c,!1)}function Dg(n,a,c,f,_){var y=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var A=f.tag;if(A===3||A===4){var P=f.stateNode.containerInfo;if(P===_)break;if(A===4)for(A=f.return;A!==null;){var X=A.tag;if((X===3||X===4)&&A.stateNode.containerInfo===_)return;A=A.return}for(;P!==null;){if(A=qo(P),A===null)return;if(X=A.tag,X===5||X===6||X===26||X===27){f=y=A;continue e}P=P.parentNode}}f=f.return}db(function(){var se=y,de=Xm(c),ge=[];e:{var ae=zb.get(n);if(ae!==void 0){var ue=Ed,De=n;switch(n){case"keypress":if(Sd(c)===0)break e;case"keydown":case"keyup":ue=a3;break;case"focusin":De="focus",ue=rp;break;case"focusout":De="blur",ue=rp;break;case"beforeblur":case"afterblur":ue=rp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=mb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Yj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=c3;break;case Ob:case Bb:case Pb:ue=Zj;break;case Ib:ue=d3;break;case"scroll":case"scrollend":ue=Vj;break;case"wheel":ue=f3;break;case"copy":case"cut":case"paste":ue=Jj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=gb;break;case"toggle":case"beforetoggle":ue=p3}var ze=(a&4)!==0,St=!ze&&(n==="scroll"||n==="scrollend"),te=ze?ae!==null?ae+"Capture":null:ae;ze=[];for(var J=se,ne;J!==null;){var fe=J;if(ne=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ne===null||te===null||(fe=hc(J,te),fe!=null&&ze.push(qc(J,fe,ne))),St)break;J=J.return}0<ze.length&&(ae=new ue(ae,De,null,c,de),ge.push({event:ae,listeners:ze}))}}if((a&7)===0){e:{if(ae=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",ae&&c!==Km&&(De=c.relatedTarget||c.fromElement)&&(qo(De)||De[Wo]))break e;if((ue||ae)&&(ae=de.window===de?de:(ae=de.ownerDocument)?ae.defaultView||ae.parentWindow:window,ue?(De=c.relatedTarget||c.toElement,ue=se,De=De?qo(De):null,De!==null&&(St=o(De),ze=De.tag,De!==St||ze!==5&&ze!==27&&ze!==6)&&(De=null)):(ue=null,De=se),ue!==De)){if(ze=mb,fe="onMouseLeave",te="onMouseEnter",J="mouse",(n==="pointerout"||n==="pointerover")&&(ze=gb,fe="onPointerLeave",te="onPointerEnter",J="pointer"),St=ue==null?ae:dc(ue),ne=De==null?ae:dc(De),ae=new ze(fe,J+"leave",ue,c,de),ae.target=St,ae.relatedTarget=ne,fe=null,qo(de)===se&&(ze=new ze(te,J+"enter",De,c,de),ze.target=ne,ze.relatedTarget=St,fe=ze),St=fe,ue&&De)t:{for(ze=mD,te=ue,J=De,ne=0,fe=te;fe;fe=ze(fe))ne++;fe=0;for(var Pe=J;Pe;Pe=ze(Pe))fe++;for(;0<ne-fe;)te=ze(te),ne--;for(;0<fe-ne;)J=ze(J),fe--;for(;ne--;){if(te===J||J!==null&&te===J.alternate){ze=te;break t}te=ze(te),J=ze(J)}ze=null}else ze=null;ue!==null&&oS(ge,ae,ue,ze,!1),De!==null&&St!==null&&oS(ge,St,De,ze,!0)}}e:{if(ae=se?dc(se):window,ue=ae.nodeName&&ae.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ae.type==="file")var ht=Cb;else if(wb(ae))if(Eb)ht=E3;else{ht=S3;var Oe=w3}else ue=ae.nodeName,!ue||ue.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?se&&Ym(se.elementType)&&(ht=Cb):ht=C3;if(ht&&(ht=ht(n,se))){Sb(ge,ht,c,de);break e}Oe&&Oe(n,ae,se),n==="focusout"&&se&&ae.type==="number"&&se.memoizedProps.value!=null&&Gm(ae,"number",ae.value)}switch(Oe=se?dc(se):window,n){case"focusin":(wb(Oe)||Oe.contentEditable==="true")&&(el=Oe,lp=se,yc=null);break;case"focusout":yc=lp=el=null;break;case"mousedown":cp=!0;break;case"contextmenu":case"mouseup":case"dragend":cp=!1,Db(ge,c,de);break;case"selectionchange":if(k3)break;case"keydown":case"keyup":Db(ge,c,de)}var Qe;if(np)e:{switch(n){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else Jo?yb(n,c)&&(lt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(lt="onCompositionStart");lt&&(vb&&c.locale!=="ko"&&(Jo||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Jo&&(Qe=hb()):(Ws=de,Jm="value"in Ws?Ws.value:Ws.textContent,Jo=!0)),Oe=ph(se,lt),0<Oe.length&&(lt=new pb(lt,n,null,c,de),ge.push({event:lt,listeners:Oe}),Qe?lt.data=Qe:(Qe=bb(c),Qe!==null&&(lt.data=Qe)))),(Qe=v3?_3(n,c):x3(n,c))&&(lt=ph(se,"onBeforeInput"),0<lt.length&&(Oe=new pb("onBeforeInput","beforeinput",null,c,de),ge.push({event:Oe,listeners:lt}),Oe.data=Qe)),uD(ge,n,se,c,de)}sS(ge,a)})}function qc(n,a,c){return{instance:n,listener:a,currentTarget:c}}function ph(n,a){for(var c=a+"Capture",f=[];n!==null;){var _=n,y=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||y===null||(_=hc(n,c),_!=null&&f.unshift(qc(n,_,y)),_=hc(n,a),_!=null&&f.push(qc(n,_,y))),n.tag===3)return f;n=n.return}return[]}function mD(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function oS(n,a,c,f,_){for(var y=a._reactName,A=[];c!==null&&c!==f;){var P=c,X=P.alternate,se=P.stateNode;if(P=P.tag,X!==null&&X===f)break;P!==5&&P!==26&&P!==27||se===null||(X=se,_?(se=hc(c,y),se!=null&&A.unshift(qc(c,se,X))):_||(se=hc(c,y),se!=null&&A.push(qc(c,se,X)))),c=c.return}A.length!==0&&n.push({event:a,listeners:A})}var pD=/\r\n?/g,gD=/\u0000|\uFFFD/g;function lS(n){return(typeof n=="string"?n:""+n).replace(pD,`
49
- `).replace(gD,"")}function cS(n,a){return a=lS(a),lS(n)===a}function wt(n,a,c,f,_,y){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Xo(n,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Xo(n,""+f);break;case"className":xd(n,"class",f);break;case"tabIndex":xd(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":xd(n,c,f);break;case"style":cb(n,f,y);break;case"data":if(a!=="object"){xd(n,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){n.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=bd(""+f),n.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){n.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(c==="formAction"?(a!=="input"&&wt(n,a,"name",_.name,_,null),wt(n,a,"formEncType",_.formEncType,_,null),wt(n,a,"formMethod",_.formMethod,_,null),wt(n,a,"formTarget",_.formTarget,_,null)):(wt(n,a,"encType",_.encType,_,null),wt(n,a,"method",_.method,_,null),wt(n,a,"target",_.target,_,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(c);break}f=bd(""+f),n.setAttribute(c,f);break;case"onClick":f!=null&&(n.onclick=os);break;case"onScroll":f!=null&&nt("scroll",n);break;case"onScrollEnd":f!=null&&nt("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}c=bd(""+f),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""+f):n.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":f===!0?n.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,f):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(c,f):n.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(c):n.setAttribute(c,f);break;case"popover":nt("beforetoggle",n),nt("toggle",n),_d(n,"popover",f);break;case"xlinkActuate":as(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":as(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":as(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":as(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":as(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":as(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":as(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":as(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":as(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":_d(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Wj.get(c)||c,_d(n,c,f))}}function Lg(n,a,c,f,_,y){switch(c){case"style":cb(n,f,y);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"children":typeof f=="string"?Xo(n,f):(typeof f=="number"||typeof f=="bigint")&&Xo(n,""+f);break;case"onScroll":f!=null&&nt("scroll",n);break;case"onScrollEnd":f!=null&&nt("scrollend",n);break;case"onClick":f!=null&&(n.onclick=os);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!eb.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(_=c.endsWith("Capture"),a=c.slice(2,_?c.length-7:void 0),y=n[oi]||null,y=y!=null?y[c]:null,typeof y=="function"&&n.removeEventListener(a,y,_),typeof f=="function")){typeof y!="function"&&y!==null&&(c in n?n[c]=null:n.hasAttribute(c)&&n.removeAttribute(c)),n.addEventListener(a,f,_);break e}c in n?n[c]=f:f===!0?n.setAttribute(c,""):_d(n,c,f)}}}function Or(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",n),nt("load",n);var f=!1,_=!1,y;for(y in c)if(c.hasOwnProperty(y)){var A=c[y];if(A!=null)switch(y){case"src":f=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:wt(n,a,y,A,c,null)}}_&&wt(n,a,"srcSet",c.srcSet,c,null),f&&wt(n,a,"src",c.src,c,null);return;case"input":nt("invalid",n);var P=y=A=_=null,X=null,se=null;for(f in c)if(c.hasOwnProperty(f)){var de=c[f];if(de!=null)switch(f){case"name":_=de;break;case"type":A=de;break;case"checked":X=de;break;case"defaultChecked":se=de;break;case"value":y=de;break;case"defaultValue":P=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,a));break;default:wt(n,a,f,de,c,null)}}sb(n,y,P,X,se,A,_,!1);return;case"select":nt("invalid",n),f=A=y=null;for(_ in c)if(c.hasOwnProperty(_)&&(P=c[_],P!=null))switch(_){case"value":y=P;break;case"defaultValue":A=P;break;case"multiple":f=P;default:wt(n,a,_,P,c,null)}a=y,c=A,n.multiple=!!f,a!=null?Ko(n,!!f,a,!1):c!=null&&Ko(n,!!f,c,!0);return;case"textarea":nt("invalid",n),y=_=f=null;for(A in c)if(c.hasOwnProperty(A)&&(P=c[A],P!=null))switch(A){case"value":f=P;break;case"defaultValue":_=P;break;case"children":y=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(91));break;default:wt(n,a,A,P,c,null)}ob(n,f,_,y);return;case"option":for(X in c)if(c.hasOwnProperty(X)&&(f=c[X],f!=null))switch(X){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:wt(n,a,X,f,c,null)}return;case"dialog":nt("beforetoggle",n),nt("toggle",n),nt("cancel",n),nt("close",n);break;case"iframe":case"object":nt("load",n);break;case"video":case"audio":for(f=0;f<Wc.length;f++)nt(Wc[f],n);break;case"image":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"embed":case"source":case"link":nt("error",n),nt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in c)if(c.hasOwnProperty(se)&&(f=c[se],f!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:wt(n,a,se,f,c,null)}return;default:if(Ym(a)){for(de in c)c.hasOwnProperty(de)&&(f=c[de],f!==void 0&&Lg(n,a,de,f,c,void 0));return}}for(P in c)c.hasOwnProperty(P)&&(f=c[P],f!=null&&wt(n,a,P,f,c,null))}function vD(n,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,y=null,A=null,P=null,X=null,se=null,de=null;for(ue in c){var ge=c[ue];if(c.hasOwnProperty(ue)&&ge!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":X=ge;default:f.hasOwnProperty(ue)||wt(n,a,ue,null,f,ge)}}for(var ae in f){var ue=f[ae];if(ge=c[ae],f.hasOwnProperty(ae)&&(ue!=null||ge!=null))switch(ae){case"type":y=ue;break;case"name":_=ue;break;case"checked":se=ue;break;case"defaultChecked":de=ue;break;case"value":A=ue;break;case"defaultValue":P=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:ue!==ge&&wt(n,a,ae,ue,f,ge)}}Vm(n,A,P,X,se,de,y,_);return;case"select":ue=A=P=ae=null;for(y in c)if(X=c[y],c.hasOwnProperty(y)&&X!=null)switch(y){case"value":break;case"multiple":ue=X;default:f.hasOwnProperty(y)||wt(n,a,y,null,f,X)}for(_ in f)if(y=f[_],X=c[_],f.hasOwnProperty(_)&&(y!=null||X!=null))switch(_){case"value":ae=y;break;case"defaultValue":P=y;break;case"multiple":A=y;default:y!==X&&wt(n,a,_,y,f,X)}a=P,c=A,f=ue,ae!=null?Ko(n,!!c,ae,!1):!!f!=!!c&&(a!=null?Ko(n,!!c,a,!0):Ko(n,!!c,c?[]:"",!1));return;case"textarea":ue=ae=null;for(P in c)if(_=c[P],c.hasOwnProperty(P)&&_!=null&&!f.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:wt(n,a,P,null,f,_)}for(A in f)if(_=f[A],y=c[A],f.hasOwnProperty(A)&&(_!=null||y!=null))switch(A){case"value":ae=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:_!==y&&wt(n,a,A,_,f,y)}ab(n,ae,ue);return;case"option":for(var De in c)if(ae=c[De],c.hasOwnProperty(De)&&ae!=null&&!f.hasOwnProperty(De))switch(De){case"selected":n.selected=!1;break;default:wt(n,a,De,null,f,ae)}for(X in f)if(ae=f[X],ue=c[X],f.hasOwnProperty(X)&&ae!==ue&&(ae!=null||ue!=null))switch(X){case"selected":n.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:wt(n,a,X,ae,f,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in c)ae=c[ze],c.hasOwnProperty(ze)&&ae!=null&&!f.hasOwnProperty(ze)&&wt(n,a,ze,null,f,ae);for(se in f)if(ae=f[se],ue=c[se],f.hasOwnProperty(se)&&ae!==ue&&(ae!=null||ue!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,a));break;default:wt(n,a,se,ae,f,ue)}return;default:if(Ym(a)){for(var St in c)ae=c[St],c.hasOwnProperty(St)&&ae!==void 0&&!f.hasOwnProperty(St)&&Lg(n,a,St,void 0,f,ae);for(de in f)ae=f[de],ue=c[de],!f.hasOwnProperty(de)||ae===ue||ae===void 0&&ue===void 0||Lg(n,a,de,ae,f,ue);return}}for(var te in c)ae=c[te],c.hasOwnProperty(te)&&ae!=null&&!f.hasOwnProperty(te)&&wt(n,a,te,null,f,ae);for(ge in f)ae=f[ge],ue=c[ge],!f.hasOwnProperty(ge)||ae===ue||ae==null&&ue==null||wt(n,a,ge,ae,f,ue)}function uS(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _D(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var _=c[f],y=_.transferSize,A=_.initiatorType,P=_.duration;if(y&&P&&uS(A)){for(A=0,P=_.responseEnd,f+=1;f<c.length;f++){var X=c[f],se=X.startTime;if(se>P)break;var de=X.transferSize,ge=X.initiatorType;de&&uS(ge)&&(X=X.responseEnd,A+=de*(X<P?1:(P-se)/(X-se)))}if(--f,a+=8*(y+A)/(_.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Og=null,Bg=null;function gh(n){return n.nodeType===9?n:n.ownerDocument}function dS(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hS(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Pg(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Ig=null;function xD(){var n=window.event;return n&&n.type==="popstate"?n===Ig?!1:(Ig=n,!0):(Ig=null,!1)}var fS=typeof setTimeout=="function"?setTimeout:void 0,yD=typeof clearTimeout=="function"?clearTimeout:void 0,mS=typeof Promise=="function"?Promise:void 0,bD=typeof queueMicrotask=="function"?queueMicrotask:typeof mS<"u"?function(n){return mS.resolve(null).then(n).catch(wD)}:fS;function wD(n){setTimeout(function(){throw n})}function oa(n){return n==="head"}function pS(n,a){var c=a,f=0;do{var _=c.nextSibling;if(n.removeChild(c),_&&_.nodeType===8)if(c=_.data,c==="/$"||c==="/&"){if(f===0){n.removeChild(_),kl(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Vc(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Vc(c);for(var y=c.firstChild;y;){var A=y.nextSibling,P=y.nodeName;y[uc]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=A}}else c==="body"&&Vc(n.ownerDocument.body);c=_}while(c);kl(a)}function gS(n,a){var c=n;n=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(n===0)break;n--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||n++;c=f}while(c)}function zg(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":zg(c),Wm(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}n.removeChild(c)}}function SD(n,a,c,f){for(;n.nodeType===1;){var _=c;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[uc])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==_.rel||n.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||n.getAttribute("title")!==(_.title==null?null:_.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var y=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=Hi(n.nextSibling),n===null)break}return null}function CD(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=Hi(n.nextSibling),n===null))return null;return n}function vS(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Hi(n.nextSibling),n===null))return null;return n}function $g(n){return n.data==="$?"||n.data==="$~"}function Ug(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function ED(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function Hi(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Hg=null;function _S(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return Hi(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function xS(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return n;a--}else c!=="/$"&&c!=="/&"||a++}n=n.previousSibling}return null}function yS(n,a,c){switch(a=gh(c),n){case"html":if(n=a.documentElement,!n)throw Error(i(452));return n;case"head":if(n=a.head,!n)throw Error(i(453));return n;case"body":if(n=a.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function Vc(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Wm(n)}var Fi=new Map,bS=new Set;function vh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ss=U.d;U.d={f:RD,r:kD,D:ND,C:AD,L:TD,m:MD,X:DD,S:jD,M:LD};function RD(){var n=Ss.f(),a=lh();return n||a}function kD(n){var a=Vo(n);a!==null&&a.tag===5&&a.type==="form"?I1(a):Ss.r(n)}var Cl=typeof document>"u"?null:document;function wS(n,a,c){var f=Cl;if(f&&typeof a=="string"&&a){var _=Oi(a);_='link[rel="'+n+'"][href="'+_+'"]',typeof c=="string"&&(_+='[crossorigin="'+c+'"]'),bS.has(_)||(bS.add(_),n={rel:n,crossOrigin:c,href:a},f.querySelector(_)===null&&(a=f.createElement("link"),Or(a,"link",n),yr(a),f.head.appendChild(a)))}}function ND(n){Ss.D(n),wS("dns-prefetch",n,null)}function AD(n,a){Ss.C(n,a),wS("preconnect",n,a)}function TD(n,a,c){Ss.L(n,a,c);var f=Cl;if(f&&n&&a){var _='link[rel="preload"][as="'+Oi(a)+'"]';a==="image"&&c&&c.imageSrcSet?(_+='[imagesrcset="'+Oi(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(_+='[imagesizes="'+Oi(c.imageSizes)+'"]')):_+='[href="'+Oi(n)+'"]';var y=_;switch(a){case"style":y=El(n);break;case"script":y=Rl(n)}Fi.has(y)||(n=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),Fi.set(y,n),f.querySelector(_)!==null||a==="style"&&f.querySelector(Gc(y))||a==="script"&&f.querySelector(Yc(y))||(a=f.createElement("link"),Or(a,"link",n),yr(a),f.head.appendChild(a)))}}function MD(n,a){Ss.m(n,a);var c=Cl;if(c&&n){var f=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+Oi(f)+'"][href="'+Oi(n)+'"]',y=_;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Rl(n)}if(!Fi.has(y)&&(n=p({rel:"modulepreload",href:n},a),Fi.set(y,n),c.querySelector(_)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Yc(y)))return}f=c.createElement("link"),Or(f,"link",n),yr(f),c.head.appendChild(f)}}}function jD(n,a,c){Ss.S(n,a,c);var f=Cl;if(f&&n){var _=Go(f).hoistableStyles,y=El(n);a=a||"default";var A=_.get(y);if(!A){var P={loading:0,preload:null};if(A=f.querySelector(Gc(y)))P.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":a},c),(c=Fi.get(y))&&Fg(n,c);var X=A=f.createElement("link");yr(X),Or(X,"link",n),X._p=new Promise(function(se,de){X.onload=se,X.onerror=de}),X.addEventListener("load",function(){P.loading|=1}),X.addEventListener("error",function(){P.loading|=2}),P.loading|=4,_h(A,a,f)}A={type:"stylesheet",instance:A,count:1,state:P},_.set(y,A)}}}function DD(n,a){Ss.X(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),y=f.get(_);y||(y=c.querySelector(Yc(_)),y||(n=p({src:n,async:!0},a),(a=Fi.get(_))&&Wg(n,a),y=c.createElement("script"),yr(y),Or(y,"link",n),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(_,y))}}function LD(n,a){Ss.M(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),y=f.get(_);y||(y=c.querySelector(Yc(_)),y||(n=p({src:n,async:!0,type:"module"},a),(a=Fi.get(_))&&Wg(n,a),y=c.createElement("script"),yr(y),Or(y,"link",n),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(_,y))}}function SS(n,a,c,f){var _=(_=ce.current)?vh(_):null;if(!_)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=El(c.href),c=Go(_).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){n=El(c.href);var y=Go(_).hoistableStyles,A=y.get(n);if(A||(_=_.ownerDocument||_,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,A),(y=_.querySelector(Gc(n)))&&!y._p&&(A.instance=y,A.state.loading=5),Fi.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Fi.set(n,c),y||OD(_,n,c,A.state))),a&&f===null)throw Error(i(528,""));return A}if(a&&f!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Rl(c),c=Go(_).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function El(n){return'href="'+Oi(n)+'"'}function Gc(n){return'link[rel="stylesheet"]['+n+"]"}function CS(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function OD(n,a,c,f){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=n.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Or(a,"link",c),yr(a),n.head.appendChild(a))}function Rl(n){return'[src="'+Oi(n)+'"]'}function Yc(n){return"script[async]"+n}function ES(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=n.querySelector('style[data-href~="'+Oi(c.href)+'"]');if(f)return a.instance=f,yr(f),f;var _=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),yr(f),Or(f,"style",_),_h(f,c.precedence,n),a.instance=f;case"stylesheet":_=El(c.href);var y=n.querySelector(Gc(_));if(y)return a.state.loading|=4,a.instance=y,yr(y),y;f=CS(c),(_=Fi.get(_))&&Fg(f,_),y=(n.ownerDocument||n).createElement("link"),yr(y);var A=y;return A._p=new Promise(function(P,X){A.onload=P,A.onerror=X}),Or(y,"link",f),a.state.loading|=4,_h(y,c.precedence,n),a.instance=y;case"script":return y=Rl(c.src),(_=n.querySelector(Yc(y)))?(a.instance=_,yr(_),_):(f=c,(_=Fi.get(y))&&(f=p({},c),Wg(f,_)),n=n.ownerDocument||n,_=n.createElement("script"),yr(_),Or(_,"link",f),n.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,_h(f,c.precedence,n));return a.instance}function _h(n,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=f.length?f[f.length-1]:null,y=_,A=0;A<f.length;A++){var P=f[A];if(P.dataset.precedence===a)y=P;else if(y!==_)break}y?y.parentNode.insertBefore(n,y.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(n,a.firstChild))}function Fg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Wg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var xh=null;function RS(n,a,c){if(xh===null){var f=new Map,_=xh=new Map;_.set(c,f)}else _=xh,f=_.get(c),f||(f=new Map,_.set(c,f));if(f.has(n))return f;for(f.set(n,null),c=c.getElementsByTagName(n),_=0;_<c.length;_++){var y=c[_];if(!(y[uc]||y[Mr]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var A=y.getAttribute(a)||"";A=n+A;var P=f.get(A);P?P.push(y):f.set(A,[y])}}return f}function kS(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function BD(n,a,c){if(c===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function NS(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function PD(n,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var _=El(f.href),y=a.querySelector(Gc(_));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=yh.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=y,yr(y);return}y=a.ownerDocument||a,f=CS(f),(_=Fi.get(_))&&Fg(f,_),y=y.createElement("link"),yr(y);var A=y;A._p=new Promise(function(P,X){A.onload=P,A.onerror=X}),Or(y,"link",f),c.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=yh.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var qg=0;function ID(n,a){return n.stylesheets&&n.count===0&&wh(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var f=setTimeout(function(){if(n.stylesheets&&wh(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+a);0<n.imgBytes&&qg===0&&(qg=62500*_D());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&wh(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>qg?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(_)}}:null}function yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var bh=null;function wh(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,bh=new Map,a.forEach(zD,n),bh=null,yh.call(n))}function zD(n,a){if(!(a.state.loading&4)){var c=bh.get(n);if(c)var f=c.get(null);else{c=new Map,bh.set(n,c);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<_.length;y++){var A=_[y];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(c.set(A.dataset.precedence,A),f=A)}f&&c.set(null,f)}_=a.instance,A=_.getAttribute("data-precedence"),y=c.get(A)||f,y===f&&c.set(null,_),c.set(A,_),this.count++,f=yh.bind(this),_.addEventListener("load",f),_.addEventListener("error",f),y?y.parentNode.insertBefore(_,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),a.state.loading|=4}}var Kc={$$typeof:k,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function $D(n,a,c,f,_,y,A,P,X){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.hiddenUpdates=yt(null),this.identifierPrefix=f,this.onUncaughtError=_,this.onCaughtError=y,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function AS(n,a,c,f,_,y,A,P,X,se,de,ge){return n=new $D(n,a,c,A,X,se,de,ge,P),a=1,y===!0&&(a|=24),y=Si(3,null,null,a),n.current=y,y.stateNode=n,a=Cp(),a.refCount++,n.pooledCache=a,a.refCount++,y.memoizedState={element:f,isDehydrated:c,cache:a},Np(y),n}function TS(n){return n?(n=il,n):il}function MS(n,a,c,f,_,y){_=TS(_),f.context===null?f.context=_:f.pendingContext=_,f=Xs(a),f.payload={element:c},y=y===void 0?null:y,y!==null&&(f.callback=y),c=Zs(n,f,a),c!==null&&(fi(c,n,a),kc(c,n,a))}function jS(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<a?c:a}}function Vg(n,a){jS(n,a),(n=n.alternate)&&jS(n,a)}function DS(n){if(n.tag===13||n.tag===31){var a=Xa(n,67108864);a!==null&&fi(a,n,67108864),Vg(n,67108864)}}function LS(n){if(n.tag===13||n.tag===31){var a=Ni();a=Fo(a);var c=Xa(n,a);c!==null&&fi(c,n,a),Vg(n,a)}}var Sh=!0;function UD(n,a,c,f){var _=T.T;T.T=null;var y=U.p;try{U.p=2,Gg(n,a,c,f)}finally{U.p=y,T.T=_}}function HD(n,a,c,f){var _=T.T;T.T=null;var y=U.p;try{U.p=8,Gg(n,a,c,f)}finally{U.p=y,T.T=_}}function Gg(n,a,c,f){if(Sh){var _=Yg(f);if(_===null)Dg(n,a,f,Ch,c),BS(n,f);else if(WD(_,n,a,c,f))f.stopPropagation();else if(BS(n,f),a&4&&-1<FD.indexOf(n)){for(;_!==null;){var y=Vo(_);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var A=bi(y.pendingLanes);if(A!==0){var P=y;for(P.pendingLanes|=2,P.entangledLanes|=2;A;){var X=1<<31-xr(A);P.entanglements[1]|=X,A&=~X}On(y),(mt&6)===0&&(ah=Ie()+500,Fc(0))}}break;case 31:case 13:P=Xa(y,2),P!==null&&fi(P,y,2),lh(),Vg(y,2)}if(y=Yg(f),y===null&&Dg(n,a,f,Ch,c),y===_)break;_=y}_!==null&&f.stopPropagation()}else Dg(n,a,f,null,c)}}function Yg(n){return n=Xm(n),Kg(n)}var Ch=null;function Kg(n){if(Ch=null,n=qo(n),n!==null){var a=o(n);if(a===null)n=null;else{var c=a.tag;if(c===13){if(n=u(a),n!==null)return n;n=null}else if(c===31){if(n=d(a),n!==null)return n;n=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Ch=n,null}function OS(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Mt()){case pt:return 2;case Jt:return 8;case xt:case Tt:return 32;case Ft:return 268435456;default:return 32}default:return 32}}var Xg=!1,la=null,ca=null,ua=null,Xc=new Map,Zc=new Map,da=[],FD="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function BS(n,a){switch(n){case"focusin":case"focusout":la=null;break;case"dragenter":case"dragleave":ca=null;break;case"mouseover":case"mouseout":ua=null;break;case"pointerover":case"pointerout":Xc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zc.delete(a.pointerId)}}function Qc(n,a,c,f,_,y){return n===null||n.nativeEvent!==y?(n={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:y,targetContainers:[_]},a!==null&&(a=Vo(a),a!==null&&DS(a)),n):(n.eventSystemFlags|=f,a=n.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),n)}function WD(n,a,c,f,_){switch(a){case"focusin":return la=Qc(la,n,a,c,f,_),!0;case"dragenter":return ca=Qc(ca,n,a,c,f,_),!0;case"mouseover":return ua=Qc(ua,n,a,c,f,_),!0;case"pointerover":var y=_.pointerId;return Xc.set(y,Qc(Xc.get(y)||null,n,a,c,f,_)),!0;case"gotpointercapture":return y=_.pointerId,Zc.set(y,Qc(Zc.get(y)||null,n,a,c,f,_)),!0}return!1}function PS(n){var a=qo(n.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){n.blockedOn=a,Zy(n.priority,function(){LS(c)});return}}else if(a===31){if(a=d(c),a!==null){n.blockedOn=a,Zy(n.priority,function(){LS(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Eh(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var c=Yg(n.nativeEvent);if(c===null){c=n.nativeEvent;var f=new c.constructor(c.type,c);Km=f,c.target.dispatchEvent(f),Km=null}else return a=Vo(c),a!==null&&DS(a),n.blockedOn=c,!1;a.shift()}return!0}function IS(n,a,c){Eh(n)&&c.delete(a)}function qD(){Xg=!1,la!==null&&Eh(la)&&(la=null),ca!==null&&Eh(ca)&&(ca=null),ua!==null&&Eh(ua)&&(ua=null),Xc.forEach(IS),Zc.forEach(IS)}function Rh(n,a){n.blockedOn===a&&(n.blockedOn=null,Xg||(Xg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,qD)))}var kh=null;function zS(n){kh!==n&&(kh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kh===n&&(kh=null);for(var a=0;a<n.length;a+=3){var c=n[a],f=n[a+1],_=n[a+2];if(typeof f!="function"){if(Kg(f||c)===null)continue;break}var y=Vo(c);y!==null&&(n.splice(a,3),a-=3,Yp(y,{pending:!0,data:_,method:c.method,action:f},f,_))}}))}function kl(n){function a(X){return Rh(X,n)}la!==null&&Rh(la,n),ca!==null&&Rh(ca,n),ua!==null&&Rh(ua,n),Xc.forEach(a),Zc.forEach(a);for(var c=0;c<da.length;c++){var f=da[c];f.blockedOn===n&&(f.blockedOn=null)}for(;0<da.length&&(c=da[0],c.blockedOn===null);)PS(c),c.blockedOn===null&&da.shift();if(c=(n.ownerDocument||n).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var _=c[f],y=c[f+1],A=_[oi]||null;if(typeof y=="function")A||zS(c);else if(A){var P=null;if(y&&y.hasAttribute("formAction")){if(_=y,A=y[oi]||null)P=A.formAction;else if(Kg(_)!==null)continue}else P=A.action;typeof P=="function"?c[f+1]=P:(c.splice(f,3),f-=3),zS(c)}}}function $S(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(A){return _=A})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,_=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function Zg(n){this._internalRoot=n}Nh.prototype.render=Zg.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,f=Ni();MS(c,f,n,a,null,null)},Nh.prototype.unmount=Zg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;MS(n.current,2,null,n,null,null),lh(),a[Wo]=null}};function Nh(n){this._internalRoot=n}Nh.prototype.unstable_scheduleHydration=function(n){if(n){var a=Hm();n={blockedOn:null,target:n,priority:a};for(var c=0;c<da.length&&a!==0&&a<da[c].priority;c++);da.splice(c,0,n),c===0&&PS(n)}};var US=t.version;if(US!=="19.2.7")throw Error(i(527,US,"19.2.7"));U.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=h(a),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var VD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ah=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ah.isDisabled&&Ah.supportsFiber)try{Fr=Ah.inject(VD),er=Ah}catch{}}return eu.createRoot=function(n,a){if(!s(n))throw Error(i(299));var c=!1,f="",_=Y1,y=K1,A=X1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=AS(n,1,!1,null,null,c,f,null,_,y,A,$S),n[Wo]=a.current,jg(n),new Zg(a)},eu.hydrateRoot=function(n,a,c){if(!s(n))throw Error(i(299));var f=!1,_="",y=Y1,A=K1,P=X1,X=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(A=c.onCaughtError),c.onRecoverableError!==void 0&&(P=c.onRecoverableError),c.formState!==void 0&&(X=c.formState)),a=AS(n,1,!0,a,c??null,f,_,X,y,A,P,$S),a.context=TS(null),c=a.current,f=Ni(),f=Fo(f),_=Xs(f),_.callback=null,Zs(c,_,f),c=f,a.current.lanes=c,Ze(a,c),On(a),n[Wo]=a.current,jg(n),new Nh(a)},eu.version="19.2.7",eu}var ZS;function nL(){if(ZS)return ev.exports;ZS=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ev.exports=iL(),ev.exports}var sL=nL();/**
50
- * react-router v7.18.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var _x=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,nR=/^[\\/]{2}/;function aL(e,t){return t+e.replace(/\\/g,"/")}var QS="popstate";function JS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function oL(e={}){function t(i,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:m}=o||i.location;return B_("",{pathname:u,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function r(i,s){return typeof s=="string"?s:Bu(s)}return cL(t,r,null,e)}function hr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ji(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lL(){return Math.random().toString(36).substring(2,10)}function eC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function B_(e,t,r=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Qu(t):t,state:r,key:t&&t.key||i||lL(),mask:s}}function Bu({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Qu(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function cL(e,t,r,i={}){let{window:s=document.defaultView,v5Compat:o=!1}=i,u=s.history,d="POP",m=null,h=v();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function v(){return(u.state||{idx:null}).idx}function p(){d="POP";let E=v(),S=E==null?null:E-h;h=E,m&&m({action:d,location:C.location,delta:S})}function x(E,S){d="PUSH";let N=JS(E)?E:B_(C.location,E,S);h=v()+1;let k=eC(N,h),R=C.createHref(N.mask||N);try{u.pushState(k,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;s.location.assign(R)}o&&m&&m({action:d,location:C.location,delta:1})}function b(E,S){d="REPLACE";let N=JS(E)?E:B_(C.location,E,S);h=v();let k=eC(N,h),R=C.createHref(N.mask||N);u.replaceState(k,"",R),o&&m&&m({action:d,location:C.location,delta:0})}function w(E){return uL(s,E)}let C={get action(){return d},get location(){return e(s,u)},listen(E){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(QS,p),m=E,()=>{s.removeEventListener(QS,p),m=null}},createHref(E){return t(s,E)},createURL:w,encodeLocation(E){let S=w(E);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:x,replace:b,go(E){return u.go(E)}};return C}function uL(e,t,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),hr(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Bu(t);return s=s.replace(/ $/,"%20"),!r&&nR.test(s)&&(s=i+s),new URL(s,i)}function sR(e,t,r="/"){return dL(e,t,r,!1)}function dL(e,t,r,i,s){let o=typeof t=="string"?Qu(t):t,u=Ds(o.pathname||"/",r);if(u==null)return null;let d=hL(e),m=null,h=SL(u);for(let v=0;m==null&&v<d.length;++v)m=wL(d[v],h,i);return m}function hL(e){let t=aR(e);return fL(t),t}function aR(e,t=[],r=[],i="",s=!1){let o=(u,d,m=s,h)=>{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(i)&&m)return;hr(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=vn([i,v.relativePath]),x=r.concat(v);u.children&&u.children.length>0&&(hr(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),aR(u.children,t,x,p,m)),!(u.path==null&&!u.index)&&t.push({path:p,score:yL(p,u.index),routesMeta:x.map((b,w)=>{let[C,E]=cR(b.relativePath,b.caseSensitive,w===x.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 h of oR(u.path))o(u,d,!0,h)}),t}function oR(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(i.length===0)return s?[o,""]:[o];let u=oR(i.join("/")),d=[];return d.push(...u.map(m=>m===""?o:[o,m].join("/"))),s&&d.push(...u),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function fL(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:bL(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var mL=/^:[\w-]+$/,pL=3,gL=2,vL=1,_L=10,xL=-2,tC=e=>e==="*";function yL(e,t){let r=e.split("/"),i=r.length;return r.some(tC)&&(i+=xL),t&&(i+=gL),r.filter(s=>!tC(s)).reduce((s,o)=>s+(mL.test(o)?pL:o===""?vL:_L),i)}function bL(e,t){return e.length===t.length&&e.slice(0,-1).every((i,s)=>i===t[s])?e[e.length-1]-t[t.length-1]:0}function wL(e,t,r=!1){let{routesMeta:i}=e,s={},o="/",u=[];for(let d=0;d<i.length;++d){let m=i[d],h=d===i.length-1,v=o==="/"?t:t.slice(o.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},x=m.matcher&&m.compiledParams?lR(p,v,m.matcher,m.compiledParams):Cf(p,v),b=m.route;if(!x&&h&&r&&!i[i.length-1].route.index&&(x=Cf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(s,x.params),u.push({params:s,pathname:vn([o,x.pathname]),pathnameBase:RL(vn([o,x.pathnameBase])),route:b}),x.pathnameBase!=="/"&&(o=vn([o,x.pathnameBase]))}return u}function Cf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=cR(e.path,e.caseSensitive,e.end);return lR(e,t,r,i)}function lR(e,t,r,i){let s=t.match(r);if(!s)return null;let o=s[0],u=o.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:i.reduce((h,{paramName:v,isOptional:p},x)=>{if(v==="*"){let w=d[x]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=d[x];return p&&!b?h[v]=void 0:h[v]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:u,pattern:e}}function cR(e,t=!1,r=!0){Ji(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,h,v)=>{if(i.push({paramName:d,isOptional:m!=null}),m){let p=v.charAt(h+u.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),i]}function SL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ji(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ds(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function CL(e,t="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?Qu(e):e,o;return r?(r=uR(r),r.startsWith("/")?o=rC(r.substring(1),"/"):o=rC(r,t)):o=t,{pathname:o,search:kL(i),hash:NL(s)}}function rC(e,t){let r=Ef(t).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function nv(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 EL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function xx(e){let t=EL(e);return t.map((r,i)=>i===t.length-1?r.pathname:r.pathnameBase)}function Xf(e,t,r,i=!1){let s;typeof e=="string"?s=Qu(e):(s={...e},hr(!s.pathname||!s.pathname.includes("?"),nv("?","pathname","search",s)),hr(!s.pathname||!s.pathname.includes("#"),nv("#","pathname","hash",s)),hr(!s.search||!s.search.includes("#"),nv("#","search","hash",s)));let o=e===""||s.pathname==="",u=o?"/":s.pathname,d;if(u==null)d=r;else{let p=t.length-1;if(!i&&u.startsWith("..")){let x=u.split("/");for(;x[0]==="..";)x.shift(),p-=1;s.pathname=x.join("/")}d=p>=0?t[p]:"/"}let m=CL(s,d),h=u&&u!=="/"&&u.endsWith("/"),v=(o||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||v)&&(m.pathname+="/"),m}var uR=e=>e.replace(/[\\/]{2,}/g,"/"),vn=e=>uR(e.join("/")),Ef=e=>e.replace(/\/+$/,""),RL=e=>Ef(e).replace(/^\/*/,"/"),kL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,AL=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 TL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ML(e){let t=e.map(r=>r.route.path).filter(Boolean);return vn(t)||"/"}var dR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hR(e,t){let r=e;if(typeof r!="string"||!_x.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(dR)try{let o=new URL(window.location.href),u=nR.test(r)?new URL(aL(r,o.protocol)):new URL(r),d=Ds(u.pathname,t);u.origin===o.origin&&d!=null?r=d+u.search+u.hash:s=!0}catch{Ji(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fR=["POST","PUT","PATCH","DELETE"];new Set(fR);var jL=["GET",...fR];new Set(jL);var DL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function LL(e){try{return DL.includes(new URL(e).protocol)}catch{return!1}}var Ql=g.createContext(null);Ql.displayName="DataRouter";var Zf=g.createContext(null);Zf.displayName="DataRouterState";var mR=g.createContext(!1);function OL(){return g.useContext(mR)}var pR=g.createContext({isTransitioning:!1});pR.displayName="ViewTransition";var BL=g.createContext(new Map);BL.displayName="Fetchers";var PL=g.createContext(null);PL.displayName="Await";var Di=g.createContext(null);Di.displayName="Navigation";var Qf=g.createContext(null);Qf.displayName="Location";var Sn=g.createContext({outlet:null,matches:[],isDataRoute:!1});Sn.displayName="Route";var yx=g.createContext(null);yx.displayName="RouteError";var gR="REACT_ROUTER_ERROR",IL="REDIRECT",zL="ROUTE_ERROR_RESPONSE";function $L(e){if(e.startsWith(`${gR}:${IL}:{`))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 UL(e){if(e.startsWith(`${gR}:${zL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new AL(t.status,t.statusText,t.data)}catch{}}function HL(e,{relative:t}={}){hr(Jl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=g.useContext(Di),{hash:s,pathname:o,search:u}=Ju(e,{relative:t}),d=o;return r!=="/"&&(d=o==="/"?r:vn([r,o])),i.createHref({pathname:d,search:u,hash:s})}function Jl(){return g.useContext(Qf)!=null}function Hr(){return hr(Jl(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Qf).location}var vR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _R(e){g.useContext(Di).static||g.useLayoutEffect(e)}function Ba(){let{isDataRoute:e}=g.useContext(Sn);return e?t4():FL()}function FL(){hr(Jl(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Ql),{basename:t,navigator:r}=g.useContext(Di),{matches:i}=g.useContext(Sn),{pathname:s}=Hr(),o=JSON.stringify(xx(i)),u=g.useRef(!1);return _R(()=>{u.current=!0}),g.useCallback((m,h={})=>{if(Ji(u.current,vR),!u.current)return;if(typeof m=="number"){r.go(m);return}let v=Xf(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:vn([t,v.pathname])),(h.replace?r.replace:r.push)(v,h.state,h)},[t,r,o,s,e])}g.createContext(null);function xR(){let{matches:e}=g.useContext(Sn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Ju(e,{relative:t}={}){let{matches:r}=g.useContext(Sn),{pathname:i}=Hr(),s=JSON.stringify(xx(r));return g.useMemo(()=>Xf(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function WL(e,t){return yR(e)}function yR(e,t,r){hr(Jl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Di),{matches:s}=g.useContext(Sn),o=s[s.length-1],u=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let E=h&&h.path||"";wR(d,!h||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let v=Hr(),p;p=v;let x=p.pathname||"/",b=x;if(m!=="/"){let E=m.replace(/^\//,"").split("/");b="/"+x.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(E=>Object.assign(E,{route:r.manifest[E.route.id]||E.route})):sR(e,{pathname:b});return Ji(h||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Ji(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.`),KL(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:vn([m,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:vn([m,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,r)}function qL(){let e=e4(),t=TL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:s},r):null,u)}var VL=g.createElement(qL,null),bR=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=UL(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(Sn.Provider,{value:this.props.routeContext},g.createElement(yx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(GL,{error:e},t):t}};bR.contextType=mR;var sv=new WeakMap;function GL({children:e,error:t}){let{basename:r}=g.useContext(Di);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=$L(t.digest);if(i){let s=sv.get(t);if(s)throw s;let o=hR(i.location,r),u=o.absoluteURL||o.to;if(LL(u))throw new Error("Invalid redirect location");if(dR&&!sv.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 sv.set(t,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function YL({routeContext:e,match:t,children:r}){let i=g.useContext(Ql);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(Sn.Provider,{value:e},r)}function KL(e,t=[],r){let i=r==null?void 0:r.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,o=i==null?void 0:i.errors;if(o!=null){let v=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);hr(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,v+1))}let u=!1,d=-1;if(r&&i){u=i.renderFallback;for(let v=0;v<s.length;v++){let p=s[v];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=v),p.route.id){let{loaderData:x,errors:b}=i,w=p.route.loader&&!x.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,h=i&&m?(v,p)=>{var x,b;m(v,{location:i.location,params:((b=(x=i.matches)==null?void 0:x[0])==null?void 0:b.params)??{},pattern:ML(i.matches),errorInfo:p})}:void 0;return s.reduceRight((v,p,x)=>{let b,w=!1,C=null,E=null;i&&(b=o&&p.route.id?o[p.route.id]:void 0,C=p.route.errorElement||VL,u&&(d<0&&x===0?(wR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===x&&(w=!0,E=p.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,x+1)),N=()=>{let k;return b?k=C:w?k=E:p.route.Component?k=g.createElement(p.route.Component,null):p.route.element?k=p.route.element:k=v,g.createElement(YL,{match:p,routeContext:{outlet:v,matches:S,isDataRoute:i!=null},children:k})};return i&&(p.route.ErrorBoundary||p.route.errorElement||x===0)?g.createElement(bR,{location:i.location,revalidation:i.revalidation,component:C,error:b,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):N()},null)}function bx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function XL(e){let t=g.useContext(Ql);return hr(t,bx(e)),t}function ZL(e){let t=g.useContext(Zf);return hr(t,bx(e)),t}function QL(e){let t=g.useContext(Sn);return hr(t,bx(e)),t}function wx(e){let t=QL(e),r=t.matches[t.matches.length-1];return hr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function JL(){return wx("useRouteId")}function e4(){var i;let e=g.useContext(yx),t=ZL("useRouteError"),r=wx("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function t4(){let{router:e}=XL("useNavigate"),t=wx("useNavigate"),r=g.useRef(!1);return _R(()=>{r.current=!0}),g.useCallback(async(s,o={})=>{Ji(r.current,vR),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var iC={};function wR(e,t,r){!t&&!iC[e]&&(iC[e]=!0,Ji(!1,r))}g.memo(r4);function r4({routes:e,manifest:t,future:r,state:i,isStatic:s,onError:o}){return yR(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function wa({to:e,replace:t,state:r,relative:i}){hr(Jl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=g.useContext(Di);Ji(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=g.useContext(Sn),{pathname:u}=Hr(),d=Ba(),m=Xf(e,xx(o),u,i==="path"),h=JSON.stringify(m);return g.useEffect(()=>{d(JSON.parse(h),{replace:t,state:r,relative:i})},[d,h,i,t,r]),null}function i4({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:u}){hr(!Jl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=g.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:u,future:{}}),[d,s,o,u]);typeof r=="string"&&(r=Qu(r));let{pathname:h="/",search:v="",hash:p="",state:x=null,key:b="default",mask:w}=r,C=g.useMemo(()=>{let E=Ds(h,d);return E==null?null:{location:{pathname:E,search:v,hash:p,state:x,key:b,mask:w},navigationType:i}},[d,h,v,p,x,b,i,w]);return Ji(C!=null,`<Router basename="${d}"> is not able to match the URL "${h}${v}${p}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:g.createElement(Di.Provider,{value:m},g.createElement(Qf.Provider,{children:t,value:C}))}var sf="get",af="application/x-www-form-urlencoded";function Jf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function n4(e){return Jf(e)&&e.tagName.toLowerCase()==="button"}function s4(e){return Jf(e)&&e.tagName.toLowerCase()==="form"}function a4(e){return Jf(e)&&e.tagName.toLowerCase()==="input"}function o4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function l4(e,t){return e.button===0&&(!t||t==="_self")&&!o4(e)}function P_(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(s=>[r,s]):[[r,i]])},[]))}function c4(e,t){let r=P_(e);return t&&t.forEach((i,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}var Th=null;function u4(){if(Th===null)try{new FormData(document.createElement("form"),0),Th=!1}catch{Th=!0}return Th}var d4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function av(e){return e!=null&&!d4.has(e)?(Ji(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${af}"`),null):e}function h4(e,t){let r,i,s,o,u;if(s4(e)){let d=e.getAttribute("action");i=d?Ds(d,t):null,r=e.getAttribute("method")||sf,s=av(e.getAttribute("enctype"))||af,o=new FormData(e)}else if(n4(e)||a4(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(i=m?Ds(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||sf,s=av(e.getAttribute("formenctype"))||av(d.getAttribute("enctype"))||af,o=new FormData(d,e),!u4()){let{name:h,type:v,value:p}=e;if(v==="image"){let x=h?`${h}.`:"";o.append(`${x}x`,"0"),o.append(`${x}y`,"0")}else h&&o.append(h,p)}}else{if(Jf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=sf,i=null,s=af,u=e}return o&&s==="text/plain"&&(u=o,o=void 0),{action:i,method:r.toLowerCase(),encType:s,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Sx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function SR(e,t,r,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:t&&Ds(s.pathname,t)==="/"?s.pathname=`${Ef(t)}/_root.${i}`:s.pathname=`${Ef(s.pathname)}.${i}`,s}async function f4(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 m4(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 p4(e,t,r){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let u=await f4(o,r);return u.links?u.links():[]}return[]}));return x4(i.flat(1).filter(m4).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function nC(e,t,r,i,s,o){let u=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,d=(m,h)=>{var v;return r[h].pathname!==m.pathname||((v=r[h].route.path)==null?void 0:v.endsWith("*"))&&r[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>u(m,h)||d(m,h)):o==="data"?t.filter((m,h)=>{var p;let v=i.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=r[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function g4(e,t,{includeHydrateFallback:r}={}){return v4(e.map(i=>{let s=t.routes[i.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function v4(e){return[...new Set(e)]}function _4(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function x4(e,t){let r=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(_4(s));return r.has(o)||(r.add(o),i.push({key:o,link:s})),i},[])}function Cx(){let e=g.useContext(Ql);return Sx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function y4(){let e=g.useContext(Zf);return Sx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ex=g.createContext(void 0);Ex.displayName="FrameworkContext";function em(){let e=g.useContext(Ex);return Sx(e,"You must render this element inside a <HydratedRouter> element"),e}function b4(e,t){let r=g.useContext(Ex),[i,s]=g.useState(!1),[o,u]=g.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:v,onTouchStart:p}=t,x=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=S=>{S.forEach(N=>{u(N.isIntersecting)})},E=new IntersectionObserver(C,{threshold:.5});return x.current&&E.observe(x.current),()=>{E.disconnect()}}},[e]),g.useEffect(()=>{if(i){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[i]);let b=()=>{s(!0)},w=()=>{s(!1),u(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:tu(d,b),onBlur:tu(m,w),onMouseEnter:tu(h,b),onMouseLeave:tu(v,w),onTouchStart:tu(p,b)}]:[!1,x,{}]}function tu(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function w4({page:e,...t}){let r=OL(),{nonce:i}=em(),{router:s}=Cx(),o=g.useMemo(()=>sR(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?g.createElement(C4,{page:e,matches:o,...t}):g.createElement(E4,{page:e,matches:o,...t})):null}function S4(e){let{manifest:t,routeModules:r}=em(),[i,s]=g.useState([]);return g.useEffect(()=>{let o=!1;return p4(e,t,r).then(u=>{o||s(u)}),()=>{o=!0}},[e,t,r]),i}function C4({page:e,matches:t,...r}){let i=Hr(),{future:s}=em(),{basename:o}=Cx(),u=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=SR(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?m=!0:h.push(v.route.id);return m&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[o,s.v8_trailingSlashAwareDataRequests,e,i,t]);return g.createElement(g.Fragment,null,u.map(d=>g.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function E4({page:e,matches:t,...r}){let i=Hr(),{future:s,manifest:o,routeModules:u}=em(),{basename:d}=Cx(),{loaderData:m,matches:h}=y4(),v=g.useMemo(()=>nC(e,t,h,o,i,"data"),[e,t,h,o,i]),p=g.useMemo(()=>nC(e,t,h,o,i,"assets"),[e,t,h,o,i]),x=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,E=!1;if(t.forEach(N=>{var R;let k=o.routes[N.route.id];!k||!k.hasLoader||(!v.some(M=>M.route.id===N.route.id)&&N.route.id in m&&((R=u[N.route.id])!=null&&R.shouldRevalidate)||k.hasClientLoader?E=!0:C.add(N.route.id))}),C.size===0)return[];let S=SR(e,d,s.v8_trailingSlashAwareDataRequests,"data");return E&&C.size>0&&S.searchParams.set("_routes",t.filter(N=>C.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,m,i,o,v,t,e,u]),b=g.useMemo(()=>g4(p,o),[p,o]),w=S4(p);return g.createElement(g.Fragment,null,x.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 R4(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var k4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{k4&&(window.__reactRouterVersion="7.18.1")}catch{}function N4({basename:e,children:t,useTransitions:r,window:i}){let s=g.useRef();s.current==null&&(s.current=oL({window:i,v5Compat:!0}));let o=s.current,[u,d]=g.useState({action:o.action,location:o.location}),m=g.useCallback(h=>{r===!1?d(h):g.startTransition(()=>d(h))},[r]);return g.useLayoutEffect(()=>o.listen(m),[o,m]),g.createElement(i4,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:r})}var CR=g.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:s,reloadDocument:o,replace:u,mask:d,state:m,target:h,to:v,preventScrollReset:p,viewTransition:x,defaultShouldRevalidate:b,...w},C){let{basename:E,navigator:S,useTransitions:N}=g.useContext(Di),k=typeof v=="string"&&_x.test(v),R=hR(v,E);v=R.to;let M=HL(v,{relative:s}),L=Hr(),$=null;if(d){let z=Xf(d,[],L.mask?L.mask.pathname:"/",!0);E!=="/"&&(z.pathname=z.pathname==="/"?E:vn([E,z.pathname])),$=S.createHref(z)}let[D,q,G]=b4(i,w),W=M4(v,{replace:u,mask:d,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:x,defaultShouldRevalidate:b,useTransitions:N});function B(z){t&&t(z),z.defaultPrevented||W(z)}let j=!(R.isExternal||o),O=g.createElement("a",{...w,...G,href:(j?$:void 0)||R.absoluteURL||M,onClick:j?B:t,ref:R4(C,q),target:h,"data-discover":!k&&r==="render"?"true":void 0});return D&&!k?g.createElement(g.Fragment,null,O,g.createElement(w4,{page:M})):O});CR.displayName="Link";var Ca=g.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:s=!1,style:o,to:u,viewTransition:d,children:m,...h},v){let p=Ju(u,{relative:h.relative}),x=Hr(),b=g.useContext(Zf),{navigator:w,basename:C}=g.useContext(Di),E=b!=null&&P4(p)&&d===!0,S=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,N=x.pathname,k=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;r||(N=N.toLowerCase(),k=k?k.toLowerCase():null,S=S.toLowerCase()),k&&C&&(k=Ds(k,C)||k);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=N===S||!s&&N.startsWith(S)&&N.charAt(R)==="/",L=k!=null&&(k===S||!s&&k.startsWith(S)&&k.charAt(S.length)==="/"),$={isActive:M,isPending:L,isTransitioning:E},D=M?t:void 0,q;typeof i=="function"?q=i($):q=[i,M?"active":null,L?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let G=typeof o=="function"?o($):o;return g.createElement(CR,{...h,"aria-current":D,className:q,ref:v,style:G,to:u,viewTransition:d},typeof m=="function"?m($):m)});Ca.displayName="NavLink";var A4=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:s,state:o,method:u=sf,action:d,onSubmit:m,relative:h,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x,...b},w)=>{let{useTransitions:C}=g.useContext(Di),E=O4(),S=B4(d,{relative:h}),N=u.toLowerCase()==="get"?"get":"post",k=typeof d=="string"&&_x.test(d),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let L=M.nativeEvent.submitter,$=(L==null?void 0:L.getAttribute("formmethod"))||u,D=()=>E(L||M.currentTarget,{fetcherKey:t,method:$,navigate:r,replace:s,state:o,relative:h,preventScrollReset:v,viewTransition:p,defaultShouldRevalidate:x});C&&r!==!1?g.startTransition(()=>D()):D()};return g.createElement("form",{ref:w,method:N,action:S,onSubmit:i?m:R,...b,"data-discover":!k&&e==="render"?"true":void 0})});A4.displayName="Form";function T4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ER(e){let t=g.useContext(Ql);return hr(t,T4(e)),t}function M4(e,{target:t,replace:r,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:h}={}){let v=Ba(),p=Hr(),x=Ju(e,{relative:u});return g.useCallback(b=>{if(l4(b,t)){b.preventDefault();let w=r!==void 0?r:Bu(p)===Bu(x),C=()=>v(e,{replace:w,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m});h?g.startTransition(()=>C()):C()}},[p,v,x,r,i,s,t,e,o,u,d,m,h])}function j4(e){Ji(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(P_(e)),r=g.useRef(!1),i=Hr(),s=g.useMemo(()=>c4(i.search,r.current?null:t.current),[i.search]),o=Ba(),u=g.useCallback((d,m)=>{const h=P_(typeof d=="function"?d(new URLSearchParams(s)):d);r.current=!0,o("?"+h,m)},[o,s]);return[s,u]}var D4=0,L4=()=>`__${String(++D4)}__`;function O4(){let{router:e}=ER("useSubmit"),{basename:t}=g.useContext(Di),r=JL(),i=e.fetch,s=e.navigate;return g.useCallback(async(o,u={})=>{let{action:d,method:m,encType:h,formData:v,body:p}=h4(o,t);if(u.navigate===!1){let x=u.fetcherKey||L4();await i(x,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:p,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:r,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,s,t,r])}function B4(e,{relative:t}={}){let{basename:r}=g.useContext(Di),i=g.useContext(Sn);hr(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...Ju(e||".",{relative:t})},u=Hr();if(e==null){o.search=u.search;let d=new URLSearchParams(o.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let v=d.toString();o.search=v?`?${v}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:vn([r,o.pathname])),Bu(o)}function P4(e,{relative:t}={}){let r=g.useContext(pR);hr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=ER("useViewTransitionState"),s=Ju(e,{relative:t});if(!r.isTransitioning)return!1;let o=Ds(r.currentLocation.pathname,i)||r.currentLocation.pathname,u=Ds(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Cf(s.pathname,u)!=null||Cf(s.pathname,o)!=null}/**
61
- * @license lucide-react v0.475.0 - ISC
62
- *
63
- * This source code is licensed under the ISC license.
64
- * See the LICENSE file in the root directory of this source tree.
65
- */const I4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),RR=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim();/**
66
- * @license lucide-react v0.475.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */var z4={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 $4=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:u,...d},m)=>g.createElement("svg",{ref:m,...z4,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:RR("lucide",s),...d},[...u.map(([h,v])=>g.createElement(h,v)),...Array.isArray(o)?o:[o]]));/**
76
- * @license lucide-react v0.475.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */const Re=(e,t)=>{const r=g.forwardRef(({className:i,...s},o)=>g.createElement($4,{ref:o,iconNode:t,className:RR(`lucide-${I4(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
81
- * @license lucide-react v0.475.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const U4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Gl=Re("ArrowLeft",U4);/**
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 H4=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kR=Re("ArrowRight",H4);/**
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 F4=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Rx=Re("Bot",F4);/**
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 W4=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],NR=Re("Boxes",W4);/**
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 q4=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],kx=Re("Cable",q4);/**
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 V4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pa=Re("Check",V4);/**
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 G4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Nx=Re("ChevronDown",G4);/**
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 Y4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],AR=Re("ChevronLeft",Y4);/**
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 K4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jo=Re("ChevronRight",K4);/**
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 X4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Z4=Re("ChevronUp",X4);/**
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 Q4=[["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"}]],ec=Re("CircleAlert",Q4);/**
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 J4=[["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"}]],Mu=Re("CircleArrowUp",J4);/**
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 eO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ax=Re("CircleCheck",eO);/**
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 tO=[["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"}]],rO=Re("CircleHelp",tO);/**
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 iO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],nO=Re("CircleSlash",iO);/**
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 sO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],aO=Re("CircleStop",sO);/**
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 oO=[["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"}]],lO=Re("CircleX",oO);/**
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 cO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],uO=Re("Circle",cO);/**
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 dO=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Tx=Re("Command",dO);/**
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 hO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],TR=Re("Copy",hO);/**
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 fO=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Mx=Re("Download",fO);/**
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 mO=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Pu=Re("Earth",mO);/**
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 pO=[["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"}]],gO=Re("Ellipsis",pO);/**
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 vO=[["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"}]],_O=Re("Eraser",vO);/**
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 xO=[["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"}]],yO=Re("Expand",xO);/**
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 bO=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],sC=Re("ExternalLink",bO);/**
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 wO=[["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"}]],SO=Re("FileText",wO);/**
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 CO=[["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"}]],EO=Re("Fingerprint",CO);/**
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 RO=[["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"}]],kO=Re("Folder",RO);/**
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 NO=[["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"}]],AO=Re("GitBranch",NO);/**
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 TO=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],MR=Re("House",TO);/**
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 MO=[["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"}]],jO=Re("ImageOff",MO);/**
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 DO=[["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"}]],LO=Re("Image",DO);/**
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 OO=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],jR=Re("KeyRound",OO);/**
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 BO=[["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"}]],DR=Re("Laptop",BO);/**
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 PO=[["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"}]],IO=Re("LayoutDashboard",PO);/**
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 zO=[["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"}]],$O=Re("Link2",zO);/**
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 UO=[["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"}]],HO=Re("ListChecks",UO);/**
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 FO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ve=Re("LoaderCircle",FO);/**
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 WO=[["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"}]],qO=Re("MapPin",WO);/**
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 VO=[["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"}]],GO=Re("MessageSquare",VO);/**
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 YO=[["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"}]],I_=Re("MonitorSmartphone",YO);/**
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 KO=[["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"}]],XO=Re("MonitorUp",KO);/**
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 ZO=[["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"}]],LR=Re("Monitor",ZO);/**
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 QO=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],JO=Re("Moon",QO);/**
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 eB=[["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"}]],tB=Re("MousePointerBan",eB);/**
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 rB=[["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"}]],iB=Re("MousePointerClick",rB);/**
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 nB=[["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"}]],sB=Re("PanelLeftClose",nB);/**
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 aB=[["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"}]],OR=Re("PanelLeftOpen",aB);/**
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 oB=[["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"}]],lB=Re("PanelRightClose",oB);/**
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 cB=[["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"}]],uB=Re("PanelRightOpen",cB);/**
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 dB=[["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"}]],hB=Re("Paperclip",dB);/**
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 fB=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],mB=Re("Pause",fB);/**
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 pB=[["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"}]],gB=Re("Pencil",pB);/**
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 vB=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],BR=Re("Play",vB);/**
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 _B=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],en=Re("Plus",_B);/**
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 xB=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],z_=Re("Power",xB);/**
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 yB=[["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"}]],At=Re("RefreshCw",yB);/**
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 bB=[["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"}]],PR=Re("RotateCw",bB);/**
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 wB=[["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"}]],SB=Re("ScanEye",wB);/**
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 CB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],EB=Re("Search",CB);/**
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 RB=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],IR=Re("Send",RB);/**
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 kB=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ed=Re("Server",kB);/**
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 NB=[["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"}]],AB=Re("Settings",NB);/**
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 TB=[["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"}]],MB=Re("Share2",TB);/**
406
- * @license lucide-react v0.475.0 - ISC
407
- *
408
- * This source code is licensed under the ISC license.
409
- * See the LICENSE file in the root directory of this source tree.
410
- */const jB=[["path",{d:"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"}]],DB=Re("ShieldAlert",jB);/**
411
- * @license lucide-react v0.475.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */const LB=[["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"}]],Rf=Re("ShieldCheck",LB);/**
416
- * @license lucide-react v0.475.0 - ISC
417
- *
418
- * This source code is licensed under the ISC license.
419
- * See the LICENSE file in the root directory of this source tree.
420
- */const OB=[["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"}]],jx=Re("ShieldOff",OB);/**
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 BB=[["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"}]],PB=Re("Shrink",BB);/**
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 IB=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Yl=Re("Smartphone",IB);/**
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 zB=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],zR=Re("Sparkles",zB);/**
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 $B=[["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"}]],Dx=Re("SquareTerminal",$B);/**
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 UB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],HB=Re("Square",UB);/**
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 FB=[["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"}]],WB=Re("Sun",FB);/**
451
- * @license lucide-react v0.475.0 - ISC
452
- *
453
- * This source code is licensed under the ISC license.
454
- * See the LICENSE file in the root directory of this source tree.
455
- */const qB=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],VB=Re("Terminal",qB);/**
456
- * @license lucide-react v0.475.0 - ISC
457
- *
458
- * This source code is licensed under the ISC license.
459
- * See the LICENSE file in the root directory of this source tree.
460
- */const GB=[["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"}]],Ia=Re("Trash2",GB);/**
461
- * @license lucide-react v0.475.0 - ISC
462
- *
463
- * This source code is licensed under the ISC license.
464
- * See the LICENSE file in the root directory of this source tree.
465
- */const YB=[["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"}]],Ra=Re("TriangleAlert",YB);/**
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 KB=[["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"}]],XB=Re("Unlink",KB);/**
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 ZB=[["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"}]],QB=Re("Workflow",ZB);/**
476
- * @license lucide-react v0.475.0 - ISC
477
- *
478
- * This source code is licensed under the ISC license.
479
- * See the LICENSE file in the root directory of this source tree.
480
- */const JB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Aa=Re("X",JB);var za=iR();const e6=gx(za);function t6(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 r6=e=>{switch(e){case"success":return s6;case"info":return o6;case"warning":return a6;case"error":return l6;default:return null}},i6=Array(12).fill(0),n6=({visible:e,className:t})=>Ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ee.createElement("div",{className:"sonner-spinner"},i6.map((r,i)=>Ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),s6=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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"})),a6=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ee.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"})),o6=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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"})),c6=Ee.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"},Ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),u6=()=>{const[e,t]=Ee.useState(document.hidden);return Ee.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let $_=1;class d6{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:i,...s}=t,o=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:$_++,u=this.toasts.find(m=>m.id===o),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),u?this.toasts=this.toasts.map(m=>m.id===o?(this.publish({...m,...t,id:o,title:i}),{...m,...t,id:o,dismissible:d,title:i}):m):this.addToast({title:i,...s,dismissible:d,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=i!==void 0,u;const d=s.then(async h=>{if(u=["resolve",h],Ee.isValidElement(h))o=!1,this.create({id:i,type:"default",message:h});else if(f6(h)&&!h.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,w=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:x,...w})}else if(h instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(h):r.error,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:x,...w})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(h):r.success,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:i,type:"success",description:x,...w})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){o=!1;const v=typeof r.error=="function"?await r.error(h):r.error,p=typeof r.description=="function"?await r.description(h):r.description,b=typeof v=="object"&&!Ee.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((h,v)=>d.then(()=>u[0]==="reject"?v(u[1]):h(u[1])).catch(v));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(t,r)=>{const i=(r==null?void 0:r.id)||$_++;return this.create({jsx:t(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const gi=new d6,h6=(e,t)=>{const r=(t==null?void 0:t.id)||$_++;return gi.addToast({title:e,...t,id:r}),r},f6=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",m6=h6,p6=()=>gi.toasts,g6=()=>gi.getActiveToasts(),_e=Object.assign(m6,{success:gi.success,info:gi.info,warning:gi.warning,error:gi.error,custom:gi.custom,message:gi.message,promise:gi.promise,dismiss:gi.dismiss,loading:gi.loading},{getHistory:p6,getToasts:g6});t6("[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 v6=3,_6="24px",x6="16px",aC=4e3,y6=356,b6=14,w6=45,S6=200;function Bn(...e){return e.filter(Boolean).join(" ")}function C6(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const E6=e=>{var t,r,i,s,o,u,d,m,h;const{invert:v,toast:p,unstyled:x,interacting:b,setHeights:w,visibleToasts:C,heights:E,index:S,toasts:N,expanded:k,removeToast:R,defaultRichColors:M,closeButton:L,style:$,cancelButtonStyle:D,actionButtonStyle:q,className:G="",descriptionClassName:W="",duration:B,position:j,gap:O,expandByDefault:z,classNames:T,icons:U,closeButtonAriaLabel:H="Close toast"}=e,[F,V]=Ee.useState(null),[I,Y]=Ee.useState(null),[K,ee]=Ee.useState(!1),[oe,ce]=Ee.useState(!1),[Z,le]=Ee.useState(!1),[ie,Se]=Ee.useState(!1),[be,Ce]=Ee.useState(!1),[Q,re]=Ee.useState(0),[ye,me]=Ee.useState(0),Ae=Ee.useRef(p.duration||B||aC),Le=Ee.useRef(null),je=Ee.useRef(null),Ye=S===0,at=S+1<=C,qe=p.type,Pt=p.dismissible!==!1,Ie=p.className||"",Mt=p.descriptionClassName||"",pt=Ee.useMemo(()=>E.findIndex($e=>$e.toastId===p.id)||0,[E,p.id]),Jt=Ee.useMemo(()=>{var $e;return($e=p.closeButton)!=null?$e:L},[p.closeButton,L]),xt=Ee.useMemo(()=>p.duration||B||aC,[p.duration,B]),Tt=Ee.useRef(0),Ft=Ee.useRef(0),ni=Ee.useRef(0),xi=Ee.useRef(null),[Fr,er]=j.split("-"),Rt=Ee.useMemo(()=>E.reduce(($e,pe,ke)=>ke>=pt?$e:$e+pe.height,0),[E,pt]),xr=u6(),qa=p.invert||v,Hs=qe==="loading";Ft.current=Ee.useMemo(()=>pt*O+Rt,[pt,Rt]),Ee.useEffect(()=>{Ae.current=xt},[xt]),Ee.useEffect(()=>{ee(!0)},[]),Ee.useEffect(()=>{const $e=je.current;if($e){const pe=$e.getBoundingClientRect().height;return me(pe),w(ke=>[{toastId:p.id,height:pe,position:p.position},...ke]),()=>w(ke=>ke.filter(Ue=>Ue.toastId!==p.id))}},[w,p.id]),Ee.useLayoutEffect(()=>{if(!K)return;const $e=je.current,pe=$e.style.height;$e.style.height="auto";const ke=$e.getBoundingClientRect().height;$e.style.height=pe,me(ke),w(Ue=>Ue.find(Ze=>Ze.toastId===p.id)?Ue.map(Ze=>Ze.toastId===p.id?{...Ze,height:ke}:Ze):[{toastId:p.id,height:ke,position:p.position},...Ue])},[K,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const yi=Ee.useCallback(()=>{ce(!0),re(Ft.current),w($e=>$e.filter(pe=>pe.toastId!==p.id)),setTimeout(()=>{R(p)},S6)},[p,R,w,Ft]);Ee.useEffect(()=>{if(p.promise&&qe==="loading"||p.duration===1/0||p.type==="loading")return;let $e;return k||b||xr?(()=>{if(ni.current<Tt.current){const Ue=new Date().getTime()-Tt.current;Ae.current=Ae.current-Ue}ni.current=new Date().getTime()})():(()=>{Ae.current!==1/0&&(Tt.current=new Date().getTime(),$e=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),yi()},Ae.current))})(),()=>clearTimeout($e)},[k,b,p,qe,xr,yi]),Ee.useEffect(()=>{p.delete&&(yi(),p.onDismiss==null||p.onDismiss.call(p,p))},[yi,p.delete]);function ns(){var $e;if(U!=null&&U.loading){var pe;return Ee.createElement("div",{className:Bn(T==null?void 0:T.loader,p==null||(pe=p.classNames)==null?void 0:pe.loader,"sonner-loader"),"data-visible":qe==="loading"},U.loading)}return Ee.createElement(n6,{className:Bn(T==null?void 0:T.loader,p==null||($e=p.classNames)==null?void 0:$e.loader),visible:qe==="loading"})}const ss=p.icon||(U==null?void 0:U[qe])||r6(qe);var Mn,bi;return Ee.createElement("li",{tabIndex:0,ref:je,className:Bn(G,Ie,T==null?void 0:T.toast,p==null||(t=p.classNames)==null?void 0:t.toast,T==null?void 0:T.default,T==null?void 0:T[qe],p==null||(r=p.classNames)==null?void 0:r[qe]),"data-sonner-toast":"","data-rich-colors":(Mn=p.richColors)!=null?Mn:M,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":K,"data-promise":!!p.promise,"data-swiped":be,"data-removed":oe,"data-visible":at,"data-y-position":Fr,"data-x-position":er,"data-index":S,"data-front":Ye,"data-swiping":Z,"data-dismissible":Pt,"data-type":qe,"data-invert":qa,"data-swipe-out":ie,"data-swipe-direction":I,"data-expanded":!!(k||z&&K),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":N.length-S,"--offset":`${oe?Q:Ft.current}px`,"--initial-height":z?"auto":`${ye}px`,...$,...p.style},onDragEnd:()=>{le(!1),V(null),xi.current=null},onPointerDown:$e=>{$e.button!==2&&(Hs||!Pt||(Le.current=new Date,re(Ft.current),$e.target.setPointerCapture($e.pointerId),$e.target.tagName!=="BUTTON"&&(le(!0),xi.current={x:$e.clientX,y:$e.clientY})))},onPointerUp:()=>{var $e,pe,ke;if(ie||!Pt)return;xi.current=null;const Ue=Number((($e=je.current)==null?void 0:$e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),yt=Number(((pe=je.current)==null?void 0:pe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ze=new Date().getTime()-((ke=Le.current)==null?void 0:ke.getTime()),Wt=F==="x"?Ue:yt,si=Math.abs(Wt)/Ze;if(Math.abs(Wt)>=w6||si>.11){re(Ft.current),p.onDismiss==null||p.onDismiss.call(p,p),Y(F==="x"?Ue>0?"right":"left":yt>0?"down":"up"),yi(),Se(!0);return}else{var qt,ai;(qt=je.current)==null||qt.style.setProperty("--swipe-amount-x","0px"),(ai=je.current)==null||ai.style.setProperty("--swipe-amount-y","0px")}Ce(!1),le(!1),V(null)},onPointerMove:$e=>{var pe,ke,Ue;if(!xi.current||!Pt||((pe=window.getSelection())==null?void 0:pe.toString().length)>0)return;const Ze=$e.clientY-xi.current.y,Wt=$e.clientX-xi.current.x;var si;const qt=(si=e.swipeDirections)!=null?si:C6(j);!F&&(Math.abs(Wt)>1||Math.abs(Ze)>1)&&V(Math.abs(Wt)>Math.abs(Ze)?"x":"y");let ai={x:0,y:0};const Fo=ln=>1/(1.5+Math.abs(ln)/20);if(F==="y"){if(qt.includes("top")||qt.includes("bottom"))if(qt.includes("top")&&Ze<0||qt.includes("bottom")&&Ze>0)ai.y=Ze;else{const ln=Ze*Fo(Ze);ai.y=Math.abs(ln)<Math.abs(Ze)?ln:Ze}}else if(F==="x"&&(qt.includes("left")||qt.includes("right")))if(qt.includes("left")&&Wt<0||qt.includes("right")&&Wt>0)ai.x=Wt;else{const ln=Wt*Fo(Wt);ai.x=Math.abs(ln)<Math.abs(Wt)?ln:Wt}(Math.abs(ai.x)>0||Math.abs(ai.y)>0)&&Ce(!0),(ke=je.current)==null||ke.style.setProperty("--swipe-amount-x",`${ai.x}px`),(Ue=je.current)==null||Ue.style.setProperty("--swipe-amount-y",`${ai.y}px`)}},Jt&&!p.jsx&&qe!=="loading"?Ee.createElement("button",{"aria-label":H,"data-disabled":Hs,"data-close-button":!0,onClick:Hs||!Pt?()=>{}:()=>{yi(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Bn(T==null?void 0:T.closeButton,p==null||(i=p.classNames)==null?void 0:i.closeButton)},(bi=U==null?void 0:U.close)!=null?bi:c6):null,(qe||p.icon||p.promise)&&p.icon!==null&&((U==null?void 0:U[qe])!==null||p.icon)?Ee.createElement("div",{"data-icon":"",className:Bn(T==null?void 0:T.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||ns():null,p.type!=="loading"?ss:null):null,Ee.createElement("div",{"data-content":"",className:Bn(T==null?void 0:T.content,p==null||(o=p.classNames)==null?void 0:o.content)},Ee.createElement("div",{"data-title":"",className:Bn(T==null?void 0:T.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Ee.createElement("div",{"data-description":"",className:Bn(W,Mt,T==null?void 0:T.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),Ee.isValidElement(p.cancel)?p.cancel:p.cancel&&Mh(p.cancel)?Ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||D,onClick:$e=>{Mh(p.cancel)&&Pt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,$e),yi())},className:Bn(T==null?void 0:T.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Ee.isValidElement(p.action)?p.action:p.action&&Mh(p.action)?Ee.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||q,onClick:$e=>{Mh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,$e),!$e.defaultPrevented&&yi())},className:Bn(T==null?void 0:T.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function oC(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function R6(e,t){const r={};return[e,t].forEach((i,s)=>{const o=s===1,u=o?"--mobile-offset":"--offset",d=o?x6:_6;function m(h){["top","right","bottom","left"].forEach(v=>{r[`${u}-${v}`]=typeof h=="number"?`${h}px`:h})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(h=>{i[h]===void 0?r[`${u}-${h}`]=d:r[`${u}-${h}`]=typeof i[h]=="number"?`${i[h]}px`:i[h]}):m(d)}),r}const k6=Ee.forwardRef(function(t,r){const{id:i,invert:s,position:o="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:h,offset:v,mobileOffset:p,theme:x="light",richColors:b,duration:w,style:C,visibleToasts:E=v6,toastOptions:S,dir:N=oC(),gap:k=b6,icons:R,containerAriaLabel:M="Notifications"}=t,[L,$]=Ee.useState([]),D=Ee.useMemo(()=>i?L.filter(K=>K.toasterId===i):L.filter(K=>!K.toasterId),[L,i]),q=Ee.useMemo(()=>Array.from(new Set([o].concat(D.filter(K=>K.position).map(K=>K.position)))),[D,o]),[G,W]=Ee.useState([]),[B,j]=Ee.useState(!1),[O,z]=Ee.useState(!1),[T,U]=Ee.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ee.useRef(null),F=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=Ee.useRef(null),I=Ee.useRef(!1),Y=Ee.useCallback(K=>{$(ee=>{var oe;return(oe=ee.find(ce=>ce.id===K.id))!=null&&oe.delete||gi.dismiss(K.id),ee.filter(({id:ce})=>ce!==K.id)})},[]);return Ee.useEffect(()=>gi.subscribe(K=>{if(K.dismiss){requestAnimationFrame(()=>{$(ee=>ee.map(oe=>oe.id===K.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{e6.flushSync(()=>{$(ee=>{const oe=ee.findIndex(ce=>ce.id===K.id);return oe!==-1?[...ee.slice(0,oe),{...ee[oe],...K},...ee.slice(oe+1)]:[K,...ee]})})})}),[L]),Ee.useEffect(()=>{if(x!=="system"){U(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:ee})=>{U(ee?"dark":"light")})}catch{K.addListener(({matches:oe})=>{try{U(oe?"dark":"light")}catch(ce){console.error(ce)}})}},[x]),Ee.useEffect(()=>{L.length<=1&&j(!1)},[L]),Ee.useEffect(()=>{const K=ee=>{var oe;if(u.every(le=>ee[le]||ee.code===le)){var Z;j(!0),(Z=H.current)==null||Z.focus()}ee.code==="Escape"&&(document.activeElement===H.current||(oe=H.current)!=null&&oe.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[u]),Ee.useEffect(()=>{if(H.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,I.current=!1)}},[H.current]),Ee.createElement("section",{ref:r,"aria-label":`${M} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},q.map((K,ee)=>{var oe;const[ce,Z]=K.split("-");return D.length?Ee.createElement("ol",{key:K,dir:N==="auto"?oC():N,tabIndex:-1,ref:H,className:h,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":ce,"data-x-position":Z,style:{"--front-toast-height":`${((oe=G[0])==null?void 0:oe.height)||0}px`,"--width":`${y6}px`,"--gap":`${k}px`,...C,...R6(v,p)},onBlur:le=>{I.current&&!le.currentTarget.contains(le.relatedTarget)&&(I.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||I.current||(I.current=!0,V.current=le.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{O||j(!1)},onDragEnd:()=>j(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},D.filter(le=>!le.position&&ee===0||le.position===K).map((le,ie)=>{var Se,be;return Ee.createElement(E6,{key:le.id,icons:R,index:ie,toast:le,defaultRichColors:b,duration:(Se=S==null?void 0:S.duration)!=null?Se:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:s,visibleToasts:E,closeButton:(be=S==null?void 0:S.closeButton)!=null?be:m,interacting:O,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:Y,toasts:D.filter(Ce=>Ce.position==le.position),heights:G.filter(Ce=>Ce.position==le.position),setHeights:W,expandByDefault:d,gap:k,expanded:B,swipeDirections:t.swipeDirections})})):null}))});function Cn(e,t=[]){let r=[];function i(o,u){const d=g.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=p=>{var S;const{scope:x,children:b,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})};h.displayName=o+"Provider";function v(p,x,b={}){var S;const{optional:w=!1}=b,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useContext(C);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return[h,v]}const s=()=>{const o=r.map(u=>g.createContext(u));return function(d){const m=(d==null?void 0:d[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[i,N6(s,...t)]}function N6(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function lC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function A6(...e){return t=>{let r=!1;const i=e.map(s=>{const o=lC(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():lC(e[s],null)}}}}function rt(...e){return g.useCallback(A6(...e),e)}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Zt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},T6=Oa[" useId ".trim().toString()]||(()=>{}),M6=0;function _n(e){const[t,r]=g.useState(T6());return Zt(()=>{r(i=>i??String(M6++))},[e]),t?`radix-${t}`:""}var j6=Oa[" useInsertionEffect ".trim().toString()]||Zt;function Eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[s,o,u]=D6({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s;{const v=g.useRef(e!==void 0);g.useEffect(()=>{const p=v.current;p!==d&&console.warn(`${i} is changing from ${p?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=d},[d,i])}const h=g.useCallback(v=>{var p;if(d){const x=L6(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else o(v)},[d,e,o,u]);return[m,h]}function D6({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),s=g.useRef(r),o=g.useRef(t);return j6(()=>{o.current=t},[t]),g.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}function L6(e){return typeof e=="function"}function Ro(e){const t=g.forwardRef((r,i)=>{let{children:s,...o}=r,u=null,d=!1;const m=[];cC(s)&&typeof jh=="function"&&(s=jh(s._payload)),g.Children.forEach(s,x=>{var b;if($6(x)){d=!0;const w=x;let C="child"in w.props?w.props.child:w.props.children;cC(C)&&typeof jh=="function"&&(C=jh(C._payload)),u=P6(w,C),m.push((b=u==null?void 0:u.props)==null?void 0:b.children)}else m.push(x)}),u?u=g.cloneElement(u,void 0,m):!d&&g.Children.count(s)===1&&g.isValidElement(s)&&(u=s);const h=u?z6(u):void 0,v=rt(i,h);if(!u){if(s||s===0)throw new Error(d?W6(e):F6(e));return s}const p=I6(o,u.props??{});return u.type!==g.Fragment&&(p.ref=i?v:h),g.cloneElement(u,p)});return t.displayName=`${e}.Slot`,t}var O6=Ro("Slot"),B6=Symbol.for("radix.slottable"),P6=(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 I6(e,t){const r={...t};for(const i in t){const s=e[i],o=t[i];/^on[A-Z]/.test(i)?s&&o?r[i]=(...d)=>{const m=o(...d);return s(...d),m}:s&&(r[i]=s):i==="style"?r[i]={...s,...o}:i==="className"&&(r[i]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function z6(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function $6(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B6}var U6=Symbol.for("react.lazy");function cC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===U6&&"_payload"in e&&H6(e._payload)}function H6(e){return typeof e=="object"&&e!==null&&"then"in e}var F6=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,W6=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,jh=Oa[" use ".trim().toString()],q6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=q6.reduce((e,t)=>{const r=Ro(`Primitive.${t}`),i=g.forwardRef((s,o)=>{const{asChild:u,...d}=s,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function $R(e,t){e&&za.flushSync(()=>e.dispatchEvent(t))}function vr(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 V6="DismissableLayer",U_="dismissableLayer.update",G6="dismissableLayer.pointerDownOutside",Y6="dismissableLayer.focusOutside",uC,Lx=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),tm=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...h}=e,v=g.useContext(Lx),[p,x]=g.useState(null),b=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=g.useState({}),C=rt(t,x),E=Array.from(v.layers),[S]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),N=S?E.indexOf(S):-1,k=p?E.indexOf(p):-1,R=v.layersWithOutsidePointerEventsDisabled.size>0,M=k>=N,L=g.useRef(!1),$=J6(W=>{o==null||o(W),d==null||d(W),W.defaultPrevented||m==null||m()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:v.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(W=>{if(!(W instanceof Node))return!1;const B=[...v.branches].some(j=>j.contains(W));return M&&!B},[v.branches,M])}),D=eP(W=>{if(i&&L.current)return;const B=W.target;[...v.branches].some(O=>O.contains(B))||(u==null||u(W),d==null||d(W),W.defaultPrevented||m==null||m())},b),q=p?k===E.length-1:!1,G=vr(W=>{W.key==="Escape"&&(s==null||s(W),!W.defaultPrevented&&m&&(W.preventDefault(),m()))});return g.useEffect(()=>{if(q)return b.addEventListener("keydown",G,{capture:!0}),()=>b.removeEventListener("keydown",G,{capture:!0})},[b,q,G]),g.useEffect(()=>{if(p)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(uC=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(p)),v.layers.add(p),dC(),()=>{r&&(v.layersWithOutsidePointerEventsDisabled.delete(p),v.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=uC))}},[p,b,r,v]),g.useEffect(()=>()=>{p&&(v.layers.delete(p),v.layersWithOutsidePointerEventsDisabled.delete(p),dC())},[p,v]),g.useEffect(()=>{const W=()=>w({});return document.addEventListener(U_,W),()=>document.removeEventListener(U_,W)},[]),l.jsx(We.div,{...h,ref:C,style:{pointerEvents:R?M?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,$.onPointerDownCapture)})});tm.displayName=V6;var K6="DismissableLayerBranch",X6=g.forwardRef((e,t)=>{const r=g.useContext(Lx),i=g.useRef(null),s=rt(t,i);return g.useEffect(()=>{const o=i.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(We.div,{...e,ref:s})});X6.displayName=K6;function Z6(){const e=g.useContext(Lx),[t,r]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var Q6=()=>!0;function J6(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:u=Q6}=t,d=vr(e),m=g.useRef(!1),h=g.useRef(!1),v=g.useRef(new Map),p=g.useRef(()=>{});return g.useEffect(()=>{function x(){h.current=!1,s.current=!1,v.current.clear()}function b(){return Array.from(v.current.values()).some(Boolean)}function w(k){if(!h.current)return;const R=k.target;R instanceof Node&&[...o].some(L=>L.contains(R))||v.current.set(k.type,!0),k.type==="click"&&window.setTimeout(()=>{h.current&&p.current()},0)}function C(k){h.current&&v.current.set(k.type,!1)}const E=k=>{if(k.target&&!m.current){let R=function(){r.removeEventListener("click",p.current);const L=b();x(),L||UR(G6,d,M,{discrete:!0})};if(!u(k.target)){r.removeEventListener("click",p.current),x(),m.current=!1;return}const M={originalEvent:k};h.current=!0,s.current=i&&k.button===0,v.current.clear(),!i||k.button!==0?R():(r.removeEventListener("click",p.current),p.current=R,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),x();m.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const k of S)r.addEventListener(k,w,!0),r.addEventListener(k,C);const N=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(N),r.removeEventListener("pointerdown",E),r.removeEventListener("click",p.current);for(const k of S)r.removeEventListener(k,w,!0),r.removeEventListener(k,C)}},[r,d,i,s,o,u]),{onPointerDownCapture:()=>m.current=!0}}function eP(e,t=globalThis==null?void 0:globalThis.document){const r=vr(e),i=g.useRef(!1);return g.useEffect(()=>{const s=o=>{o.target&&!i.current&&UR(Y6,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function dC(){const e=new CustomEvent(U_);document.dispatchEvent(e)}function UR(e,t,r,{discrete:i}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),i?$R(s,o):s.dispatchEvent(o)}var ov="focusScope.autoFocusOnMount",lv="focusScope.autoFocusOnUnmount",hC={bubbles:!1,cancelable:!0},tP="FocusScope",rm=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...u}=e,[d,m]=g.useState(null),h=vr(s),v=vr(o),p=g.useRef(null),x=rt(t,m),b=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let C=function(k){if(b.paused||!d)return;const R=k.target;d.contains(R)?p.current=R:xa(p.current,{select:!0})},E=function(k){if(b.paused||!d)return;const R=k.relatedTarget;R!==null&&(d.contains(R)||xa(p.current,{select:!0}))},S=function(k){if(document.activeElement===document.body)for(const M of k)M.removedNodes.length>0&&xa(d)};document.addEventListener("focusin",C),document.addEventListener("focusout",E);const N=new MutationObserver(S);return d&&N.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",E),N.disconnect()}}},[i,d,b.paused]),g.useEffect(()=>{if(d){mC.add(b);const C=document.activeElement;if(!d.contains(C)){const S=new CustomEvent(ov,hC);d.addEventListener(ov,h),d.dispatchEvent(S),S.defaultPrevented||(rP(oP(HR(d)),{select:!0}),document.activeElement===C&&xa(d))}return()=>{d.removeEventListener(ov,h),setTimeout(()=>{const S=new CustomEvent(lv,hC);d.addEventListener(lv,v),d.dispatchEvent(S),S.defaultPrevented||xa(C??document.body,{select:!0}),d.removeEventListener(lv,v),mC.remove(b)},0)}}},[d,h,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 N=C.currentTarget,[k,R]=iP(N);k&&R?!C.shiftKey&&S===R?(C.preventDefault(),r&&xa(k,{select:!0})):C.shiftKey&&S===k&&(C.preventDefault(),r&&xa(R,{select:!0})):S===N&&C.preventDefault()}},[r,i,b.paused]);return l.jsx(We.div,{tabIndex:-1,...u,ref:x,onKeyDown:w})});rm.displayName=tP;function rP(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(xa(i,{select:t}),document.activeElement!==r)return}function iP(e){const t=HR(e),r=fC(t,e),i=fC(t.reverse(),e);return[r,i]}function HR(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function fC(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):nP(i,{upTo:t})))return i}function nP(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 sP(e){return e instanceof HTMLInputElement&&"select"in e}function xa(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&sP(e)&&t&&e.select()}}var mC=aP();function aP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=pC(e,t),e.unshift(t)},remove(t){var r;e=pC(e,t),(r=e[0])==null||r.resume()}}}function pC(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function oP(e){return e.filter(t=>t.tagName!=="A")}var lP="Portal",im=g.forwardRef((e,t)=>{var d;const{container:r,...i}=e,[s,o]=g.useState(!1);Zt(()=>o(!0),[]);const u=r||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?za.createPortal(l.jsx(We.div,{...i,ref:t}),u):null});im.displayName=lP;function cP(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}var En=e=>{const{present:t,children:r}=e,i=uP(t),s=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=dP(i.ref,hP(s));return typeof r=="function"||i.isPresent?g.cloneElement(s,{ref:o}):null};En.displayName="Presence";function uP(e){const[t,r]=g.useState(),i=g.useRef(null),s=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=cP(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??ru(i.current),u.current=void 0):o.current="none"},[m]),Zt(()=>{const v=i.current,p=s.current;if(p!==e){const b=o.current,w=ru(v);e?(u.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Zt(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=w=>{const E=ru(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(h("ANIMATION_END"),!s.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},b=w=>{w.target===t&&(o.current=ru(i.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=ru(p)}else i.current=null;r(v)},[])}}function gC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dP(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=gC(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():gC(i[u],null)}}},[])}function ru(e){return(e==null?void 0:e.animationName)||"none"}function hP(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Dh=0,Pn=null;function Ox(){g.useEffect(()=>{Pn||(Pn={start:vC(),end:vC()});const{start:e,end:t}=Pn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Dh++,()=>{Dh===1&&(Pn==null||Pn.start.remove(),Pn==null||Pn.end.remove(),Pn=null),Dh=Math.max(0,Dh-1)}},[])}function vC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Gn=function(){return Gn=Object.assign||function(t){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Gn.apply(this,arguments)};function FR(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function fP(e,t,r){if(r||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}var of="right-scroll-bar-position",lf="width-before-scroll-bar",mP="with-scroll-bars-hidden",pP="--removed-body-scroll-bar-size";function cv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function gP(e,t){var r=g.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(i){var s=r.value;s!==i&&(r.value=i,r.callback(i,s))}}}})[0];return r.callback=t,r.facade}var vP=typeof window<"u"?g.useLayoutEffect:g.useEffect,_C=new WeakMap;function _P(e,t){var r=gP(null,function(i){return e.forEach(function(s){return cv(s,i)})});return vP(function(){var i=_C.get(r);if(i){var s=new Set(i),o=new Set(e),u=r.current;s.forEach(function(d){o.has(d)||cv(d,null)}),o.forEach(function(d){s.has(d)||cv(d,u)})}_C.set(r,e)},[e]),r}function xP(e){return e}function yP(e,t){t===void 0&&(t=xP);var r=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var u=t(o,i);return r.push(u),function(){r=r.filter(function(d){return d!==u})}},assignSyncMedium:function(o){for(i=!0;r.length;){var u=r;r=[],u.forEach(o)}r={push:function(d){return o(d)},filter:function(){return r}}},assignMedium:function(o){i=!0;var u=[];if(r.length){var d=r;r=[],d.forEach(o),u=r}var m=function(){var v=u;u=[],v.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),r={push:function(v){u.push(v),h()},filter:function(v){return u=u.filter(v),r}}}};return s}function bP(e){e===void 0&&(e={});var t=yP(null);return t.options=Gn({async:!0,ssr:!1},e),t}var WR=function(e){var t=e.sideCar,r=FR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return g.createElement(i,Gn({},r))};WR.isSideCarExport=!0;function wP(e,t){return e.useMedium(t),WR}var qR=bP(),uv=function(){},nm=g.forwardRef(function(e,t){var r=g.useRef(null),i=g.useState({onScrollCapture:uv,onWheelCapture:uv,onTouchMoveCapture:uv}),s=i[0],o=i[1],u=e.forwardProps,d=e.children,m=e.className,h=e.removeScrollBar,v=e.enabled,p=e.shards,x=e.sideCar,b=e.noRelative,w=e.noIsolation,C=e.inert,E=e.allowPinchZoom,S=e.as,N=S===void 0?"div":S,k=e.gapMode,R=FR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=x,L=_P([r,t]),$=Gn(Gn({},R),s);return g.createElement(g.Fragment,null,v&&g.createElement(M,{sideCar:qR,removeScrollBar:h,shards:p,noRelative:b,noIsolation:w,inert:C,setCallbacks:o,allowPinchZoom:!!E,lockRef:r,gapMode:k}),u?g.cloneElement(g.Children.only(d),Gn(Gn({},$),{ref:L})):g.createElement(N,Gn({},$,{className:m,ref:L}),d))});nm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nm.classNames={fullWidth:lf,zeroRight:of};var SP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SP();return t&&e.setAttribute("nonce",t),e}function EP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function RP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=CP())&&(EP(t,r),RP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},NP=function(){var e=kP();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},VR=function(){var e=NP(),t=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return t},AP={left:0,top:0,right:0,gap:0},dv=function(e){return parseInt(e||"",10)||0},TP=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[dv(r),dv(i),dv(s)]},MP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AP;var t=TP(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])}},jP=VR(),Wl="data-scroll-locked",DP=function(e,t,r,i){var s=e.left,o=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
481
- .`.concat(mP,` {
482
- overflow: hidden `).concat(i,`;
483
- padding-right: `).concat(d,"px ").concat(i,`;
484
- }
485
- body[`).concat(Wl,`] {
486
- overflow: hidden `).concat(i,`;
487
- overscroll-behavior: contain;
488
- `).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&`
489
- padding-left: `.concat(s,`px;
490
- padding-top: `).concat(o,`px;
491
- padding-right: `).concat(u,`px;
492
- margin-left:0;
493
- margin-top:0;
494
- margin-right: `).concat(d,"px ").concat(i,`;
495
- `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),`
496
- }
497
-
498
- .`).concat(of,` {
499
- right: `).concat(d,"px ").concat(i,`;
500
- }
501
-
502
- .`).concat(lf,` {
503
- margin-right: `).concat(d,"px ").concat(i,`;
504
- }
505
-
506
- .`).concat(of," .").concat(of,` {
507
- right: 0 `).concat(i,`;
508
- }
509
-
510
- .`).concat(lf," .").concat(lf,` {
511
- margin-right: 0 `).concat(i,`;
512
- }
513
-
514
- body[`).concat(Wl,`] {
515
- `).concat(pP,": ").concat(d,`px;
516
- }
517
- `)},xC=function(){var e=parseInt(document.body.getAttribute(Wl)||"0",10);return isFinite(e)?e:0},LP=function(){g.useEffect(function(){return document.body.setAttribute(Wl,(xC()+1).toString()),function(){var e=xC()-1;e<=0?document.body.removeAttribute(Wl):document.body.setAttribute(Wl,e.toString())}},[])},OP=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;LP();var o=g.useMemo(function(){return MP(s)},[s]);return g.createElement(jP,{styles:DP(o,!t,s,r?"":"!important")})},H_=!1;if(typeof window<"u")try{var Lh=Object.defineProperty({},"passive",{get:function(){return H_=!0,!0}});window.addEventListener("test",Lh,Lh),window.removeEventListener("test",Lh,Lh)}catch{H_=!1}var Nl=H_?{passive:!1}:!1,BP=function(e){return e.tagName==="TEXTAREA"},GR=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!BP(e)&&r[t]==="visible")},PP=function(e){return GR(e,"overflowY")},IP=function(e){return GR(e,"overflowX")},yC=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=YR(e,i);if(s){var o=KR(e,i),u=o[1],d=o[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},zP=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},$P=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},YR=function(e,t){return e==="v"?PP(t):IP(t)},KR=function(e,t){return e==="v"?zP(t):$P(t)},UP=function(e,t){return e==="h"&&t==="rtl"?-1:1},HP=function(e,t,r,i,s){var o=UP(e,window.getComputedStyle(t).direction),u=o*i,d=r.target,m=t.contains(d),h=!1,v=u>0,p=0,x=0;do{if(!d)break;var b=KR(e,d),w=b[0],C=b[1],E=b[2],S=C-E-o*w;(w||S)&&YR(e,d)&&(p+=S,x+=w);var N=d.parentNode;d=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(v&&Math.abs(p)<1||!v&&Math.abs(x)<1)&&(h=!0),h},Oh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bC=function(e){return[e.deltaX,e.deltaY]},wC=function(e){return e&&"current"in e?e.current:e},FP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},WP=function(e){return`
518
- .block-interactivity-`.concat(e,` {pointer-events: none;}
519
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
520
- `)},qP=0,Al=[];function VP(e){var t=g.useRef([]),r=g.useRef([0,0]),i=g.useRef(),s=g.useState(qP++)[0],o=g.useState(VR)[0],u=g.useRef(e);g.useEffect(function(){u.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var C=fP([e.lockRef.current],(e.shards||[]).map(wC),!0).filter(Boolean);return C.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=g.useCallback(function(C,E){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var S=Oh(C),N=r.current,k="deltaX"in C?C.deltaX:N[0]-S[0],R="deltaY"in C?C.deltaY:N[1]-S[1],M,L=C.target,$=Math.abs(k)>Math.abs(R)?"h":"v";if("touches"in C&&$==="h"&&L.type==="range")return!1;var D=window.getSelection(),q=D&&D.anchorNode,G=q?q===L||q.contains(L):!1;if(G)return!1;var W=yC($,L);if(!W)return!0;if(W?M=$:(M=$==="v"?"h":"v",W=yC($,L)),!W)return!1;if(!i.current&&"changedTouches"in C&&(k||R)&&(i.current=M),!M)return!0;var B=i.current||M;return HP(B,E,C,B==="h"?k:R)},[]),m=g.useCallback(function(C){var E=C;if(!(!Al.length||Al[Al.length-1]!==o)){var S="deltaY"in E?bC(E):Oh(E),N=t.current.filter(function(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&FP(M.delta,S)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(u.current.shards||[]).map(wC).filter(Boolean).filter(function(M){return M.contains(E.target)}),R=k.length>0?d(E,k[0]):!u.current.noIsolation;R&&E.cancelable&&E.preventDefault()}}},[]),h=g.useCallback(function(C,E,S,N){var k={name:C,delta:E,target:S,should:N,shadowParent:GP(S)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(R){return R!==k})},1)},[]),v=g.useCallback(function(C){r.current=Oh(C),i.current=void 0},[]),p=g.useCallback(function(C){h(C.type,bC(C),C.target,d(C,e.lockRef.current))},[]),x=g.useCallback(function(C){h(C.type,Oh(C),C.target,d(C,e.lockRef.current))},[]);g.useEffect(function(){return Al.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Nl),document.addEventListener("touchmove",m,Nl),document.addEventListener("touchstart",v,Nl),function(){Al=Al.filter(function(C){return C!==o}),document.removeEventListener("wheel",m,Nl),document.removeEventListener("touchmove",m,Nl),document.removeEventListener("touchstart",v,Nl)}},[]);var b=e.removeScrollBar,w=e.inert;return g.createElement(g.Fragment,null,w?g.createElement(o,{styles:WP(s)}):null,b?g.createElement(OP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const YP=wP(qR,VP);var sm=g.forwardRef(function(e,t){return g.createElement(nm,Gn({},e,{ref:t,sideCar:YP}))});sm.classNames=nm.classNames;var KP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Tl=new WeakMap,Bh=new WeakMap,Ph={},hv=0,XR=function(e){return e&&(e.host||XR(e.parentNode))},XP=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=XR(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},ZP=function(e,t,r,i){var s=XP(t,Array.isArray(e)?e:[e]);Ph[r]||(Ph[r]=new WeakMap);var o=Ph[r],u=[],d=new Set,m=new Set(s),h=function(p){!p||d.has(p)||(d.add(p),h(p.parentNode))};s.forEach(h);var v=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(x){if(d.has(x))v(x);else try{var b=x.getAttribute(i),w=b!==null&&b!=="false",C=(Tl.get(x)||0)+1,E=(o.get(x)||0)+1;Tl.set(x,C),o.set(x,E),u.push(x),C===1&&w&&Bh.set(x,!0),E===1&&x.setAttribute(r,"true"),w||x.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",x,S)}})};return v(t),d.clear(),hv++,function(){u.forEach(function(p){var x=Tl.get(p)-1,b=o.get(p)-1;Tl.set(p,x),o.set(p,b),x||(Bh.has(p)||p.removeAttribute(i),Bh.delete(p)),b||p.removeAttribute(r)}),hv--,hv||(Tl=new WeakMap,Tl=new WeakMap,Bh=new WeakMap,Ph={})}},Bx=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=KP(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),ZP(i,s,r,"aria-hidden")):function(){return null}},am="Dialog",[ZR,QR]=Cn(am),[QP,Rn]=ZR(am),Px=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:u=!0}=e,d=g.useRef(null),m=g.useRef(null),[h,v]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:am});return l.jsx(QP,{scope:t,triggerRef:d,contentRef:m,contentId:_n(),titleId:_n(),descriptionId:_n(),open:h,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(p=>!p),[v]),modal:u,children:r})};Px.displayName=am;var JR="DialogTrigger",om=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Rn(JR,r),o=rt(t,s.triggerRef);return l.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":$x(s.open),...i,ref:o,onClick:Be(e.onClick,s.onOpenToggle)})});om.displayName=JR;var Ix="DialogPortal",[JP,ek]=ZR(Ix,{forceMount:void 0}),zx=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:s}=e,o=Rn(Ix,t);return l.jsx(JP,{scope:t,forceMount:r,children:g.Children.map(i,u=>l.jsx(En,{present:r||o.open,children:l.jsx(im,{asChild:!0,container:s,children:u})}))})};zx.displayName=Ix;var kf="DialogOverlay",lm=g.forwardRef((e,t)=>{const r=ek(kf,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=Rn(kf,e.__scopeDialog);return o.modal?l.jsx(En,{present:i||o.open,children:l.jsx(tI,{...s,ref:t})}):null});lm.displayName=kf;var eI=Ro("DialogOverlay.RemoveScroll"),tI=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Rn(kf,r),o=Z6(),u=rt(t,o);return l.jsx(sm,{as:eI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(We.div,{"data-state":$x(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Kl="DialogContent",cm=g.forwardRef((e,t)=>{const r=ek(Kl,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=Rn(Kl,e.__scopeDialog);return l.jsx(En,{present:i||o.open,children:o.modal?l.jsx(rI,{...s,ref:t}):l.jsx(iI,{...s,ref:t})})});cm.displayName=Kl;var rI=g.forwardRef((e,t)=>{const r=Rn(Kl,e.__scopeDialog),i=g.useRef(null),s=rt(t,r.contentRef,i);return g.useEffect(()=>{const o=i.current;if(o)return Bx(o)},[]),l.jsx(tk,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Be(e.onCloseAutoFocus,o=>{var u;o.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&o.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault())})}),iI=g.forwardRef((e,t)=>{const r=Rn(Kl,e.__scopeDialog),i=g.useRef(!1),s=g.useRef(!1);return l.jsx(tk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var u,d;(u=e.onCloseAutoFocus)==null||u.call(e,o),o.defaultPrevented||(i.current||(d=r.triggerRef.current)==null||d.focus(),o.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(i.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=o.target;((h=r.triggerRef.current)==null?void 0:h.contains(u))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),tk=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,...u}=e,d=Rn(Kl,r);return Ox(),l.jsx(l.Fragment,{children:l.jsx(rm,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(tm,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":$x(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),rk="DialogTitle",um=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Rn(rk,r);return l.jsx(We.h2,{id:s.titleId,...i,ref:t})});um.displayName=rk;var ik="DialogDescription",dm=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Rn(ik,r);return l.jsx(We.p,{id:s.descriptionId,...i,ref:t})});dm.displayName=ik;var nk="DialogClose",Do=g.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Rn(nk,r);return l.jsx(We.button,{type:"button",...i,ref:t,onClick:Be(e.onClick,()=>s.onOpenChange(!1))})});Do.displayName=nk;function $x(e){return e?"open":"closed"}var sk="AlertDialog",[nI]=Cn(sk,[QR]),Ps=QR(),ak=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx(Px,{...i,...r,modal:!0})};ak.displayName=sk;var sI="AlertDialogTrigger",ok=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(om,{...s,...i,ref:t})});ok.displayName=sI;var aI="AlertDialogPortal",lk=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx(zx,{...i,...r})};lk.displayName=aI;var oI="AlertDialogOverlay",ck=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(lm,{...s,...i,ref:t})});ck.displayName=oI;var uk="AlertDialogContent",[lI,cI]=nI(uk),dk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...s}=e,o=Ps(r),u=g.useRef(null),d=rt(t,u),m=g.useRef(null);return l.jsx(lI,{scope:r,cancelRef:m,children:l.jsx(cm,{role:"alertdialog",...o,...s,ref:d,onOpenAutoFocus:Be(s.onOpenAutoFocus,h=>{var v;h.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:i})})});dk.displayName=uk;var uI="AlertDialogTitle",hk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(um,{...s,...i,ref:t})});hk.displayName=uI;var dI="AlertDialogDescription",fk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(dm,{...s,...i,ref:t})});fk.displayName=dI;var hI="AlertDialogAction",mk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(Do,{...s,...i,ref:t})});mk.displayName=hI;var pk="AlertDialogCancel",gk=g.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:s}=cI(pk,r),o=Ps(r),u=rt(t,s);return l.jsx(Do,{...o,...i,ref:u})});gk.displayName=pk;var fI=ak,vk=ok,mI=lk,_k=ck,xk=dk,yk=mk,bk=gk,wk=hk,Sk=fk;function Ck(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ck(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function Ux(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ck(e))&&(i&&(i+=" "),i+=t);return i}const pI=(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},gI=(e,t)=>({classGroupId:e,validator:t}),Ek=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Nf="-",SC=[],vI="arbitrary..",_I=e=>{const t=yI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return xI(u);const d=u.split(Nf),m=d[0]===""&&d.length>1?1:0;return Rk(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],h=r[u];return m?h?pI(h,m):m:h||SC}return r[u]||SC}}},Rk=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],o=r.nextPart.get(s);if(o){const h=Rk(e,t+1,o);if(h)return h}const u=r.validators;if(u===null)return;const d=t===0?e.join(Nf):e.slice(t).join(Nf),m=u.length;for(let h=0;h<m;h++){const v=u[h];if(v.validator(d))return v.classGroupId}},xI=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?vI+i:void 0})(),yI=e=>{const{theme:t,classGroups:r}=e;return bI(r,t)},bI=(e,t)=>{const r=Ek();for(const i in e){const s=e[i];Hx(s,r,i,t)}return r},Hx=(e,t,r,i)=>{const s=e.length;for(let o=0;o<s;o++){const u=e[o];wI(u,t,r,i)}},wI=(e,t,r,i)=>{if(typeof e=="string"){SI(e,t,r);return}if(typeof e=="function"){CI(e,t,r,i);return}EI(e,t,r,i)},SI=(e,t,r)=>{const i=e===""?t:kk(t,e);i.classGroupId=r},CI=(e,t,r,i)=>{if(RI(e)){Hx(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(gI(r,e))},EI=(e,t,r,i)=>{const s=Object.entries(e),o=s.length;for(let u=0;u<o;u++){const[d,m]=s[u];Hx(m,kk(t,d),r,i)}},kk=(e,t)=>{let r=e;const i=t.split(Nf),s=i.length;for(let o=0;o<s;o++){const u=i[o];let d=r.nextPart.get(u);d||(d=Ek(),r.nextPart.set(u,d)),r=d}return r},RI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,kI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const s=(o,u)=>{r[o]=u,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(o){let u=r[o];if(u!==void 0)return u;if((u=i[o])!==void 0)return s(o,u),u},set(o,u){o in r?r[o]=u:s(o,u)}}},F_="!",CC=":",NI=[],EC=(e,t,r,i,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),AI=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=s=>{const o=[];let u=0,d=0,m=0,h;const v=s.length;for(let C=0;C<v;C++){const E=s[C];if(u===0&&d===0){if(E===CC){o.push(s.slice(m,C)),m=C+1;continue}if(E==="/"){h=C;continue}}E==="["?u++:E==="]"?u--:E==="("?d++:E===")"&&d--}const p=o.length===0?s:s.slice(m);let x=p,b=!1;p.endsWith(F_)?(x=p.slice(0,-1),b=!0):p.startsWith(F_)&&(x=p.slice(1),b=!0);const w=h&&h>m?h-m:void 0;return EC(o,b,x,w)};if(t){const s=t+CC,o=i;i=u=>u.startsWith(s)?o(u.slice(s.length)):EC(NI,!1,u,void 0,!0)}if(r){const s=i;i=o=>r({className:o,parseClassName:s})}return i},TI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let s=[];for(let o=0;o<r.length;o++){const u=r[o],d=u[0]==="[",m=t.has(u);d||m?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(u)):s.push(u)}return s.length>0&&(s.sort(),i.push(...s)),i}},MI=e=>({cache:kI(e.cacheSize),parseClassName:AI(e),sortModifiers:TI(e),postfixLookupClassGroupIds:jI(e),..._I(e)}),jI=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},DI=/\s+/,LI=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(DI);let h="";for(let v=m.length-1;v>=0;v-=1){const p=m[v],{isExternal:x,modifiers:b,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:E}=r(p);if(x){h=p+(h.length>0?" "+h:h);continue}let S=!!E,N;if(S){const $=C.substring(0,E);N=i($);const D=N&&u[N]?i(C):void 0;D&&D!==N&&(N=D,S=!1)}else N=i(C);if(!N){if(!S){h=p+(h.length>0?" "+h:h);continue}if(N=i(C),!N){h=p+(h.length>0?" "+h:h);continue}S=!1}const k=b.length===0?"":b.length===1?b[0]:o(b).join(":"),R=w?k+F_:k,M=R+N;if(d.indexOf(M)>-1)continue;d.push(M);const L=s(N,S);for(let $=0;$<L.length;++$){const D=L[$];d.push(R+D)}h=p+(h.length>0?" "+h:h)}return h},OI=(...e)=>{let t=0,r,i,s="";for(;t<e.length;)(r=e[t++])&&(i=Nk(r))&&(s&&(s+=" "),s+=i);return s},Nk=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=Nk(e[i]))&&(r&&(r+=" "),r+=t);return r},BI=(e,...t)=>{let r,i,s,o;const u=m=>{const h=t.reduce((v,p)=>p(v),e());return r=MI(h),i=r.cache.get,s=r.cache.set,o=d,d(m)},d=m=>{const h=i(m);if(h)return h;const v=LI(m,r);return s(m,v),v};return o=u,(...m)=>o(OI(...m))},PI=[],mr=e=>{const t=r=>r[e]||PI;return t.isThemeGetter=!0,t},Ak=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Tk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,II=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$I=/\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$/,UI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,FI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=e=>II.test(e),et=e=>!!e&&!Number.isNaN(Number(e)),In=e=>!!e&&Number.isInteger(Number(e)),fv=e=>e.endsWith("%")&&et(e.slice(0,-1)),Cs=e=>zI.test(e),Mk=()=>!0,WI=e=>$I.test(e)&&!UI.test(e),Fx=()=>!1,qI=e=>HI.test(e),VI=e=>FI.test(e),GI=e=>!Te(e)&&!Me(e),YI=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)),KI=e=>$a(e,Lk,Fx),Te=e=>Ak.test(e),co=e=>$a(e,Ok,WI),RC=e=>$a(e,i8,et),XI=e=>$a(e,Pk,Mk),ZI=e=>$a(e,Bk,Fx),kC=e=>$a(e,jk,Fx),QI=e=>$a(e,Dk,VI),Ih=e=>$a(e,Ik,qI),Me=e=>Tk.test(e),iu=e=>Lo(e,Ok),JI=e=>Lo(e,Bk),NC=e=>Lo(e,jk),e8=e=>Lo(e,Lk),t8=e=>Lo(e,Dk),zh=e=>Lo(e,Ik,!0),r8=e=>Lo(e,Pk,!0),$a=(e,t,r)=>{const i=Ak.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Lo=(e,t,r=!1)=>{const i=Tk.exec(e);return i?i[1]?t(i[1]):r:!1},jk=e=>e==="position"||e==="percentage",Dk=e=>e==="image"||e==="url",Lk=e=>e==="length"||e==="size"||e==="bg-size",Ok=e=>e==="length",i8=e=>e==="number",Bk=e=>e==="family-name",Pk=e=>e==="number"||e==="weight",Ik=e=>e==="shadow",n8=()=>{const e=mr("color"),t=mr("font"),r=mr("text"),i=mr("font-weight"),s=mr("tracking"),o=mr("leading"),u=mr("breakpoint"),d=mr("container"),m=mr("spacing"),h=mr("radius"),v=mr("shadow"),p=mr("inset-shadow"),x=mr("text-shadow"),b=mr("drop-shadow"),w=mr("blur"),C=mr("perspective"),E=mr("aspect"),S=mr("ease"),N=mr("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...R(),Me,Te],L=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],D=()=>[Me,Te,m],q=()=>[fa,"full","auto",...D()],G=()=>[In,"none","subgrid",Me,Te],W=()=>["auto",{span:["full",In,Me,Te]},In,Me,Te],B=()=>[In,"auto",Me,Te],j=()=>["auto","min","max","fr",Me,Te],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...D()],U=()=>[fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],H=()=>[fa,"screen","full","dvw","lvw","svw","min","max","fit",...D()],F=()=>[fa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],V=()=>[e,Me,Te],I=()=>[...R(),NC,kC,{position:[Me,Te]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",e8,KI,{size:[Me,Te]}],ee=()=>[fv,iu,co],oe=()=>["","none","full",h,Me,Te],ce=()=>["",et,iu,co],Z=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[et,fv,NC,kC],Se=()=>["","none",w,Me,Te],be=()=>["none",et,Me,Te],Ce=()=>["none",et,Me,Te],Q=()=>[et,Me,Te],re=()=>[fa,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Cs],breakpoint:[Cs],color:[Mk],container:[Cs],"drop-shadow":[Cs],ease:["in","out","in-out"],font:[GI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Cs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Cs],shadow:[Cs],spacing:["px",et],text:[Cs],"text-shadow":[Cs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fa,Te,Me,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Me,Te]}],"container-named":[YI],columns:[{columns:[et,Te,Me,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[In,"auto",Me,Te]}],basis:[{basis:[fa,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[et,fa,"auto","initial","none",Te]}],grow:[{grow:["",et,Me,Te]}],shrink:[{shrink:["",et,Me,Te]}],order:[{order:[In,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[d,"screen",...U()]}],"min-w":[{"min-w":[d,"screen","none",...U()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,iu,co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,r8,XI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fv,Te]}],"font-family":[{font:[JI,ZI,t]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Me,Te]}],"line-clamp":[{"line-clamp":[et,"none",Me,RC]}],leading:[{leading:[o,...D()]}],"list-image":[{"list-image":["none",Me,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[et,"from-font","auto",Me,co]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[et,"auto",Me,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[In,Me,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},In,Me,Te],radial:["",Me,Te],conic:[In,Me,Te]},t8,QI]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded: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:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[et,Me,Te]}],"outline-w":[{outline:["",et,iu,co]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",v,zh,Ih]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,zh,Ih]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[et,co]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",x,zh,Ih]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[et,Me,Te]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Me,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[et]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Te]}],filter:[{filter:["","none",Me,Te]}],blur:[{blur:Se()}],brightness:[{brightness:[et,Me,Te]}],contrast:[{contrast:[et,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",b,zh,Ih]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",et,Me,Te]}],"hue-rotate":[{"hue-rotate":[et,Me,Te]}],invert:[{invert:["",et,Me,Te]}],saturate:[{saturate:[et,Me,Te]}],sepia:[{sepia:["",et,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[et,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[et,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",et,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[et,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",et,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[et,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[et,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",et,Me,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[et,"initial",Me,Te]}],ease:[{ease:["linear","initial",S,Me,Te]}],delay:[{delay:[et,Me,Te]}],animate:[{animate:["none",N,Me,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Me,Te]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:Q()}],"skew-x":[{"skew-x":Q()}],"skew-y":[{"skew-y":Q()}],transform:[{transform:[Me,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],zoom:[{zoom:[In,Me,Te]}],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":V()}],"scrollbar-track-color":[{"scrollbar-track":V()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Te]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[et,iu,co,RC]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},zk=BI(n8);function ct(...e){return zk(Ux(e))}const AC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,TC=Ux,$k=(e,t)=>r=>{var i;if((t==null?void 0:t.variants)==null)return TC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,u=Object.keys(s).map(h=>{const v=r==null?void 0:r[h],p=o==null?void 0:o[h];if(v===null)return null;const x=AC(v)||AC(p);return s[h][x]}),d=r&&Object.entries(r).reduce((h,v)=>{let[p,x]=v;return x===void 0||(h[p]=x),h},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((h,v)=>{let{class:p,className:x,...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})?[...h,p,x]:h},[]);return TC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},s8=$k("group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)]","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),he=g.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...s},o)=>{const u=i?O6:"button";return l.jsx(u,{ref:o,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:ct(s8({variant:t,size:r,className:e})),...s})});he.displayName="Button";function kn(e){return l.jsx(fI,{"data-slot":"alert-dialog",...e})}const ts=g.forwardRef((e,t)=>l.jsx(vk,{ref:t,"data-slot":"alert-dialog-trigger",...e}));ts.displayName=vk.displayName;function a8(e){return l.jsx(mI,{"data-slot":"alert-dialog-portal",...e})}const Uk=g.forwardRef(({className:e,...t},r)=>l.jsx(_k,{ref:r,"data-slot":"alert-dialog-overlay",className:ct("fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));Uk.displayName=_k.displayName;const tn=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsxs(a8,{children:[l.jsx(Uk,{}),l.jsx(xk,{ref:i,"data-slot":"alert-dialog-content","data-size":t,className:ct("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));tn.displayName=xk.displayName;function Nn({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:ct("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function An({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function o8({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-media",className:ct("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",e),...t})}const rn=g.forwardRef(({className:e,...t},r)=>l.jsx(wk,{ref:r,"data-slot":"alert-dialog-title",className:ct("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));rn.displayName=wk.displayName;const nn=g.forwardRef(({className:e,...t},r)=>l.jsx(Sk,{ref:r,"data-slot":"alert-dialog-description",className:ct("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));nn.displayName=Sk.displayName;const Tn=g.forwardRef(({className:e,variant:t="default",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(yk,{ref:s,"data-slot":"alert-dialog-action",className:ct(e),...i})}));Tn.displayName=yk.displayName;const sn=g.forwardRef(({className:e,variant:t="outline",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(bk,{ref:s,"data-slot":"alert-dialog-cancel",className:ct(e),...i})}));sn.displayName=bk.displayName;function Oo(e){return l.jsx(Px,{"data-slot":"dialog",...e})}const Hk=g.forwardRef((e,t)=>l.jsx(om,{ref:t,"data-slot":"dialog-trigger",...e}));Hk.displayName=om.displayName;function l8(e){return l.jsx(zx,{"data-slot":"dialog-portal",...e})}const td=g.forwardRef((e,t)=>l.jsx(Do,{ref:t,"data-slot":"dialog-close",...e}));td.displayName=Do.displayName;const Fk=g.forwardRef(({className:e,...t},r)=>l.jsx(lm,{ref:r,"data-slot":"dialog-overlay",className:ct("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));Fk.displayName=lm.displayName;const Ua=g.forwardRef(({className:e,children:t,showCloseButton:r=!0,...i},s)=>l.jsxs(l8,{children:[l.jsx(Fk,{}),l.jsxs(cm,{ref:s,"data-slot":"dialog-content",className:ct("fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...i,children:[t,r&&l.jsx(Do,{"data-slot":"dialog-close",asChild:!0,children:l.jsxs(he,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[l.jsx(Aa,{"aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));Ua.displayName=cm.displayName;function Bo({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:ct("flex flex-col gap-2",e),...t})}function rd({className:e,showCloseButton:t=!1,children:r,...i}){return l.jsxs("div",{"data-slot":"dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...i,children:[r,t&&l.jsx(Do,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Close"})})]})}const Ha=g.forwardRef(({className:e,...t},r)=>l.jsx(um,{ref:r,"data-slot":"dialog-title",className:ct("text-base leading-none font-medium",e),...t}));Ha.displayName=um.displayName;const hm=g.forwardRef(({className:e,...t},r)=>l.jsx(dm,{ref:r,"data-slot":"dialog-description",className:ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));hm.displayName=dm.displayName;function Wx(e){const t=e+"CollectionProvider",[r,i]=Cn(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:E,children:S}=C,N=g.useRef(null),k=g.useRef(new Map).current;return l.jsx(s,{scope:E,itemMap:k,collectionRef:N,children:S})};u.displayName=t;const d=e+"CollectionSlot",m=Ro(d),h=g.forwardRef((C,E)=>{const{scope:S,children:N}=C,k=o(d,S),R=rt(E,k.collectionRef);return l.jsx(m,{ref:R,children:N})});h.displayName=d;const v=e+"CollectionItemSlot",p="data-radix-collection-item",x=Ro(v),b=g.forwardRef((C,E)=>{const{scope:S,children:N,...k}=C,R=g.useRef(null),M=rt(E,R),L=o(v,S);return g.useEffect(()=>(L.itemMap.set(R,{ref:R,...k}),()=>void L.itemMap.delete(R))),l.jsx(x,{[p]:"",ref:M,children:N})});b.displayName=v;function w(C){const E=o(e+"CollectionConsumer",C);return g.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(E.itemMap.values()).sort((L,$)=>k.indexOf(L.ref.current)-k.indexOf($.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:h,ItemSlot:b},w,i]}var c8=g.createContext(void 0);function id(e){const t=g.useContext(c8);return e||t||"ltr"}const u8=["top","right","bottom","left"],Ta=Math.min,Mi=Math.max,Af=Math.round,$h=Math.floor,Xn=e=>({x:e,y:e}),d8={left:"right",right:"left",bottom:"top",top:"bottom"};function W_(e,t,r){return Mi(e,Ta(t,r))}function Ls(e,t){return typeof e=="function"?e(t):e}function Os(e){return e.split("-")[0]}function tc(e){return e.split("-")[1]}function qx(e){return e==="x"?"y":"x"}function Vx(e){return e==="y"?"height":"width"}function Yn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Gx(e){return qx(Yn(e))}function h8(e,t,r){r===void 0&&(r=!1);const i=tc(e),s=Gx(e),o=Vx(s);let u=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(u=Tf(u)),[u,Tf(u)]}function f8(e){const t=Tf(e);return[q_(e),t,q_(t)]}function q_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const MC=["left","right"],jC=["right","left"],m8=["top","bottom"],p8=["bottom","top"];function g8(e,t,r){switch(e){case"top":case"bottom":return r?t?jC:MC:t?MC:jC;case"left":case"right":return t?m8:p8;default:return[]}}function v8(e,t,r,i){const s=tc(e);let o=g8(Os(e),r==="start",i);return s&&(o=o.map(u=>u+"-"+s),t&&(o=o.concat(o.map(q_)))),o}function Tf(e){const t=Os(e);return d8[t]+e.slice(t.length)}function _8(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wk(e){return typeof e!="number"?_8(e):{top:e,right:e,bottom:e,left:e}}function Mf(e){const{x:t,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:t,right:t+i,bottom:r+s,x:t,y:r}}function DC(e,t,r){let{reference:i,floating:s}=e;const o=Yn(t),u=Gx(t),d=Vx(u),m=Os(t),h=o==="y",v=i.x+i.width/2-s.width/2,p=i.y+i.height/2-s.height/2,x=i[d]/2-s[d]/2;let b;switch(m){case"top":b={x:v,y:i.y-s.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-s.width,y:p};break;default:b={x:i.x,y:i.y}}switch(tc(t)){case"start":b[u]-=x*(r&&h?-1:1);break;case"end":b[u]+=x*(r&&h?-1:1);break}return b}async function x8(e,t){var r;t===void 0&&(t={});const{x:i,y:s,platform:o,rects:u,elements:d,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:p="floating",altBoundary:x=!1,padding:b=0}=Ls(t,e),w=Wk(b),E=d[x?p==="floating"?"reference":"floating":p],S=Mf(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(E)))==null||r?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:m})),N=p==="floating"?{x:i,y:s,width:u.floating.width,height:u.floating.height}:u.reference,k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d.floating)),R=await(o.isElement==null?void 0:o.isElement(k))?await(o.getScale==null?void 0:o.getScale(k))||{x:1,y:1}:{x:1,y:1},M=Mf(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:N,offsetParent:k,strategy:m}):N);return{top:(S.top-M.top+w.top)/R.y,bottom:(M.bottom-S.bottom+w.bottom)/R.y,left:(S.left-M.left+w.left)/R.x,right:(M.right-S.right+w.right)/R.x}}const y8=50,b8=async(e,t,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:x8},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:v,y:p}=DC(h,i,m),x=i,b=0;const w={};for(let C=0;C<o.length;C++){const E=o[C];if(!E)continue;const{name:S,fn:N}=E,{x:k,y:R,data:M,reset:L}=await N({x:v,y:p,initialPlacement:i,placement:x,strategy:s,middlewareData:w,rects:h,platform:d,elements:{reference:e,floating:t}});v=k??v,p=R??p,w[S]={...w[S],...M},L&&b<y8&&(b++,typeof L=="object"&&(L.placement&&(x=L.placement),L.rects&&(h=L.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):L.rects),{x:v,y:p}=DC(h,x,m)),C=-1)}return{x:v,y:p,placement:x,strategy:s,middlewareData:w}},w8=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:s,rects:o,platform:u,elements:d,middlewareData:m}=t,{element:h,padding:v=0}=Ls(e,t)||{};if(h==null)return{};const p=Wk(v),x={x:r,y:i},b=Gx(s),w=Vx(b),C=await u.getDimensions(h),E=b==="y",S=E?"top":"left",N=E?"bottom":"right",k=E?"clientHeight":"clientWidth",R=o.reference[w]+o.reference[b]-x[b]-o.floating[w],M=x[b]-o.reference[b],L=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let $=L?L[k]:0;(!$||!await(u.isElement==null?void 0:u.isElement(L)))&&($=d.floating[k]||o.floating[w]);const D=R/2-M/2,q=$/2-C[w]/2-1,G=Ta(p[S],q),W=Ta(p[N],q),B=G,j=$-C[w]-W,O=$/2-C[w]/2+D,z=W_(B,O,j),T=!m.arrow&&tc(s)!=null&&O!==z&&o.reference[w]/2-(O<B?G:W)-C[w]/2<0,U=T?O<B?O-B:O-j:0;return{[b]:x[b]+U,data:{[b]:z,centerOffset:O-z-U,...T&&{alignmentOffset:U}},reset:T}}}),S8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,i;const{placement:s,middlewareData:o,rects:u,initialPlacement:d,platform:m,elements:h}=t,{mainAxis:v=!0,crossAxis:p=!0,fallbackPlacements:x,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:C=!0,...E}=Ls(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const S=Os(s),N=Yn(d),k=Os(d)===d,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=x||(k||!C?[Tf(d)]:f8(d)),L=w!=="none";!x&&L&&M.push(...v8(d,C,w,R));const $=[d,...M],D=await m.detectOverflow(t,E),q=[];let G=((i=o.flip)==null?void 0:i.overflows)||[];if(v&&q.push(D[S]),p){const O=h8(s,u,R);q.push(D[O[0]],D[O[1]])}if(G=[...G,{placement:s,overflows:q}],!q.every(O=>O<=0)){var W,B;const O=(((W=o.flip)==null?void 0:W.index)||0)+1,z=$[O];if(z&&(!(p==="alignment"?N!==Yn(z):!1)||G.every(H=>Yn(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:O,overflows:G},reset:{placement:z}};let T=(B=G.filter(U=>U.overflows[0]<=0).sort((U,H)=>U.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!T)switch(b){case"bestFit":{var j;const U=(j=G.filter(H=>{if(L){const F=Yn(H.placement);return F===N||F==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(F=>F>0).reduce((F,V)=>F+V,0)]).sort((H,F)=>H[1]-F[1])[0])==null?void 0:j[0];U&&(T=U);break}case"initialPlacement":T=d;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function LC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function OC(e){return u8.some(t=>e[t]>=0)}const C8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:s="referenceHidden",...o}=Ls(e,t);switch(s){case"referenceHidden":{const u=await i.detectOverflow(t,{...o,elementContext:"reference"}),d=LC(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:OC(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...o,altBoundary:!0}),d=LC(u,r.floating);return{data:{escapedOffsets:d,escaped:OC(d)}}}default:return{}}}}},qk=new Set(["left","top"]);async function E8(e,t){const{placement:r,platform:i,elements:s}=e,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),u=Os(r),d=tc(r),m=Yn(r)==="y",h=qk.has(u)?-1:1,v=o&&m?-1:1,p=Ls(t,e);let{mainAxis:x,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:x*h}:{x:x*h,y:b*v}}const R8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:s,y:o,placement:u,middlewareData:d}=t,m=await E8(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:u}}}}},k8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:s,platform:o}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:S=>{let{x:N,y:k}=S;return{x:N,y:k}}},...h}=Ls(e,t),v={x:r,y:i},p=await o.detectOverflow(t,h),x=Yn(Os(s)),b=qx(x);let w=v[b],C=v[x];if(u){const S=b==="y"?"top":"left",N=b==="y"?"bottom":"right",k=w+p[S],R=w-p[N];w=W_(k,w,R)}if(d){const S=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=C+p[S],R=C-p[N];C=W_(k,C,R)}const E=m.fn({...t,[b]:w,[x]:C});return{...E,data:{x:E.x-r,y:E.y-i,enabled:{[b]:u,[x]:d}}}}}},N8=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:s,rects:o,middlewareData:u}=t,{offset:d=0,mainAxis:m=!0,crossAxis:h=!0}=Ls(e,t),v={x:r,y:i},p=Yn(s),x=qx(p);let b=v[x],w=v[p];const C=Ls(d,t),E=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const k=x==="y"?"height":"width",R=o.reference[x]-o.floating[k]+E.mainAxis,M=o.reference[x]+o.reference[k]-E.mainAxis;b<R?b=R:b>M&&(b=M)}if(h){var S,N;const k=x==="y"?"width":"height",R=qk.has(Os(s)),M=o.reference[p]-o.floating[k]+(R&&((S=u.offset)==null?void 0:S[p])||0)+(R?0:E.crossAxis),L=o.reference[p]+o.reference[k]+(R?0:((N=u.offset)==null?void 0:N[p])||0)-(R?E.crossAxis:0);w<M?w=M:w>L&&(w=L)}return{[x]:b,[p]:w}}}},A8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:s,rects:o,platform:u,elements:d}=t,{apply:m=()=>{},...h}=Ls(e,t),v=await u.detectOverflow(t,h),p=Os(s),x=tc(s),b=Yn(s)==="y",{width:w,height:C}=o.floating;let E,S;p==="top"||p==="bottom"?(E=p,S=x===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(S=p,E=x==="end"?"top":"bottom");const N=C-v.top-v.bottom,k=w-v.left-v.right,R=Ta(C-v[E],N),M=Ta(w-v[S],k),L=!t.middlewareData.shift;let $=R,D=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(D=k),(i=t.middlewareData.shift)!=null&&i.enabled.y&&($=N),L&&!x){const G=Mi(v.left,0),W=Mi(v.right,0),B=Mi(v.top,0),j=Mi(v.bottom,0);b?D=w-2*(G!==0||W!==0?G+W:Mi(v.left,v.right)):$=C-2*(B!==0||j!==0?B+j:Mi(v.top,v.bottom))}await m({...t,availableWidth:D,availableHeight:$});const q=await u.getDimensions(d.floating);return w!==q.width||C!==q.height?{reset:{rects:!0}}:{}}}};function fm(){return typeof window<"u"}function rc(e){return Vk(e)?(e.nodeName||"").toLowerCase():"#document"}function ji(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rs(e){var t;return(t=(Vk(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Vk(e){return fm()?e instanceof Node||e instanceof ji(e).Node:!1}function xn(e){return fm()?e instanceof Element||e instanceof ji(e).Element:!1}function Is(e){return fm()?e instanceof HTMLElement||e instanceof ji(e).HTMLElement:!1}function BC(e){return!fm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ji(e).ShadowRoot}function nd(e){const{overflow:t,overflowX:r,overflowY:i,display:s}=yn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&s!=="inline"&&s!=="contents"}function T8(e){return/^(table|td|th)$/.test(rc(e))}function mm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const M8=/transform|translate|scale|rotate|perspective|filter/,j8=/paint|layout|strict|content/,uo=e=>!!e&&e!=="none";let mv;function Yx(e){const t=xn(e)?yn(e):e;return uo(t.transform)||uo(t.translate)||uo(t.scale)||uo(t.rotate)||uo(t.perspective)||!Kx()&&(uo(t.backdropFilter)||uo(t.filter))||M8.test(t.willChange||"")||j8.test(t.contain||"")}function D8(e){let t=Ma(e);for(;Is(t)&&!Xl(t);){if(Yx(t))return t;if(mm(t))return null;t=Ma(t)}return null}function Kx(){return mv==null&&(mv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mv}function Xl(e){return/^(html|body|#document)$/.test(rc(e))}function yn(e){return ji(e).getComputedStyle(e)}function pm(e){return xn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ma(e){if(rc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BC(e)&&e.host||rs(e);return BC(t)?t.host:t}function Gk(e){const t=Ma(e);return Xl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&nd(t)?t:Gk(t)}function Iu(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Gk(e),o=s===((i=e.ownerDocument)==null?void 0:i.body),u=ji(s);if(o){const d=V_(u);return t.concat(u,u.visualViewport||[],nd(s)?s:[],d&&r?Iu(d):[])}else return t.concat(s,Iu(s,[],r))}function V_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yk(e){const t=yn(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=Is(e),o=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=Af(r)!==o||Af(i)!==u;return d&&(r=o,i=u),{width:r,height:i,$:d}}function Xx(e){return xn(e)?e:e.contextElement}function ql(e){const t=Xx(e);if(!Is(t))return Xn(1);const r=t.getBoundingClientRect(),{width:i,height:s,$:o}=Yk(t);let u=(o?Af(r.width):r.width)/i,d=(o?Af(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const L8=Xn(0);function Kk(e){const t=ji(e);return!Kx()||!t.visualViewport?L8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function O8(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==ji(e)?!1:t}function ko(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=Xx(e);let u=Xn(1);t&&(i?xn(i)&&(u=ql(i)):u=ql(e));const d=O8(o,r,i)?Kk(o):Xn(0);let m=(s.left+d.x)/u.x,h=(s.top+d.y)/u.y,v=s.width/u.x,p=s.height/u.y;if(o){const x=ji(o),b=i&&xn(i)?ji(i):i;let w=x,C=V_(w);for(;C&&i&&b!==w;){const E=ql(C),S=C.getBoundingClientRect(),N=yn(C),k=S.left+(C.clientLeft+parseFloat(N.paddingLeft))*E.x,R=S.top+(C.clientTop+parseFloat(N.paddingTop))*E.y;m*=E.x,h*=E.y,v*=E.x,p*=E.y,m+=k,h+=R,w=ji(C),C=V_(w)}}return Mf({width:v,height:p,x:m,y:h})}function gm(e,t){const r=pm(e).scrollLeft;return t?t.left+r:ko(rs(e)).left+r}function Xk(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-gm(e,r),s=r.top+t.scrollTop;return{x:i,y:s}}function B8(e){let{elements:t,rect:r,offsetParent:i,strategy:s}=e;const o=s==="fixed",u=rs(i),d=t?mm(t.floating):!1;if(i===u||d&&o)return r;let m={scrollLeft:0,scrollTop:0},h=Xn(1);const v=Xn(0),p=Is(i);if((p||!p&&!o)&&((rc(i)!=="body"||nd(u))&&(m=pm(i)),p)){const b=ko(i);h=ql(i),v.x=b.x+i.clientLeft,v.y=b.y+i.clientTop}const x=u&&!p&&!o?Xk(u,m):Xn(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+v.x+x.x,y:r.y*h.y-m.scrollTop*h.y+v.y+x.y}}function P8(e){return Array.from(e.getClientRects())}function I8(e){const t=rs(e),r=pm(e),i=e.ownerDocument.body,s=Mi(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=Mi(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+gm(e);const d=-r.scrollTop;return yn(i).direction==="rtl"&&(u+=Mi(t.clientWidth,i.clientWidth)-s),{width:s,height:o,x:u,y:d}}const PC=25;function z8(e,t){const r=ji(e),i=rs(e),s=r.visualViewport;let o=i.clientWidth,u=i.clientHeight,d=0,m=0;if(s){o=s.width,u=s.height;const v=Kx();(!v||v&&t==="fixed")&&(d=s.offsetLeft,m=s.offsetTop)}const h=gm(i);if(h<=0){const v=i.ownerDocument,p=v.body,x=getComputedStyle(p),b=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-b);w<=PC&&(o-=w)}else h<=PC&&(o+=h);return{width:o,height:u,x:d,y:m}}function $8(e,t){const r=ko(e,!0,t==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,o=Is(e)?ql(e):Xn(1),u=e.clientWidth*o.x,d=e.clientHeight*o.y,m=s*o.x,h=i*o.y;return{width:u,height:d,x:m,y:h}}function IC(e,t,r){let i;if(t==="viewport")i=z8(e,r);else if(t==="document")i=I8(rs(e));else if(xn(t))i=$8(t,r);else{const s=Kk(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Mf(i)}function Zk(e,t){const r=Ma(e);return r===t||!xn(r)||Xl(r)?!1:yn(r).position==="fixed"||Zk(r,t)}function U8(e,t){const r=t.get(e);if(r)return r;let i=Iu(e,[],!1).filter(d=>xn(d)&&rc(d)!=="body"),s=null;const o=yn(e).position==="fixed";let u=o?Ma(e):e;for(;xn(u)&&!Xl(u);){const d=yn(u),m=Yx(u);!m&&d.position==="fixed"&&(s=null),(o?!m&&!s:!m&&d.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||nd(u)&&!m&&Zk(e,u))?i=i.filter(v=>v!==u):s=d,u=Ma(u)}return t.set(e,i),i}function H8(e){let{element:t,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?mm(t)?[]:U8(t,this._c):[].concat(r),i],d=IC(t,u[0],s);let m=d.top,h=d.right,v=d.bottom,p=d.left;for(let x=1;x<u.length;x++){const b=IC(t,u[x],s);m=Mi(b.top,m),h=Ta(b.right,h),v=Ta(b.bottom,v),p=Mi(b.left,p)}return{width:h-p,height:v-m,x:p,y:m}}function F8(e){const{width:t,height:r}=Yk(e);return{width:t,height:r}}function W8(e,t,r){const i=Is(t),s=rs(t),o=r==="fixed",u=ko(e,!0,o,t);let d={scrollLeft:0,scrollTop:0};const m=Xn(0);function h(){m.x=gm(s)}if(i||!i&&!o)if((rc(t)!=="body"||nd(s))&&(d=pm(t)),i){const b=ko(t,!0,o,t);m.x=b.x+t.clientLeft,m.y=b.y+t.clientTop}else s&&h();o&&!i&&s&&h();const v=s&&!i&&!o?Xk(s,d):Xn(0),p=u.left+d.scrollLeft-m.x-v.x,x=u.top+d.scrollTop-m.y-v.y;return{x:p,y:x,width:u.width,height:u.height}}function pv(e){return yn(e).position==="static"}function zC(e,t){if(!Is(e)||yn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return rs(e)===r&&(r=r.ownerDocument.body),r}function Qk(e,t){const r=ji(e);if(mm(e))return r;if(!Is(e)){let s=Ma(e);for(;s&&!Xl(s);){if(xn(s)&&!pv(s))return s;s=Ma(s)}return r}let i=zC(e,t);for(;i&&T8(i)&&pv(i);)i=zC(i,t);return i&&Xl(i)&&pv(i)&&!Yx(i)?r:i||D8(e)||r}const q8=async function(e){const t=this.getOffsetParent||Qk,r=this.getDimensions,i=await r(e.floating);return{reference:W8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function V8(e){return yn(e).direction==="rtl"}const G8={convertOffsetParentRelativeRectToViewportRelativeRect:B8,getDocumentElement:rs,getClippingRect:H8,getOffsetParent:Qk,getElementRects:q8,getClientRects:P8,getDimensions:F8,getScale:ql,isElement:xn,isRTL:V8};function Jk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Y8(e,t){let r=null,i;const s=rs(e);function o(){var d;clearTimeout(i),(d=r)==null||d.disconnect(),r=null}function u(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),o();const h=e.getBoundingClientRect(),{left:v,top:p,width:x,height:b}=h;if(d||t(),!x||!b)return;const w=$h(p),C=$h(s.clientWidth-(v+x)),E=$h(s.clientHeight-(p+b)),S=$h(v),k={rootMargin:-w+"px "+-C+"px "+-E+"px "+-S+"px",threshold:Mi(0,Ta(1,m))||1};let R=!0;function M(L){const $=L[0].intersectionRatio;if($!==m){if(!R)return u();$?u(!1,$):i=setTimeout(()=>{u(!1,1e-7)},1e3)}$===1&&!Jk(h,e.getBoundingClientRect())&&u(),R=!1}try{r=new IntersectionObserver(M,{...k,root:s.ownerDocument})}catch{r=new IntersectionObserver(M,k)}r.observe(e)}return u(!0),o}function K8(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,h=Xx(e),v=s||o?[...h?Iu(h):[],...t?Iu(t):[]]:[];v.forEach(S=>{s&&S.addEventListener("scroll",r,{passive:!0}),o&&S.addEventListener("resize",r)});const p=h&&d?Y8(h,r):null;let x=-1,b=null;u&&(b=new ResizeObserver(S=>{let[N]=S;N&&N.target===h&&b&&t&&(b.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=b)==null||k.observe(t)})),r()}),h&&!m&&b.observe(h),t&&b.observe(t));let w,C=m?ko(e):null;m&&E();function E(){const S=ko(e);C&&!Jk(C,S)&&r(),C=S,w=requestAnimationFrame(E)}return r(),()=>{var S;v.forEach(N=>{s&&N.removeEventListener("scroll",r),o&&N.removeEventListener("resize",r)}),p==null||p(),(S=b)==null||S.disconnect(),b=null,m&&cancelAnimationFrame(w)}}const X8=R8,Z8=k8,Q8=S8,J8=A8,ez=C8,$C=w8,tz=N8,rz=(e,t,r)=>{const i=new Map,s={platform:G8,...r},o={...s.platform,_c:i};return b8(e,t,{...s,platform:o})};var iz=typeof document<"u",nz=function(){},cf=iz?g.useLayoutEffect:nz;function jf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,i,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!jf(e[i],t[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){const o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!jf(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function eN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UC(e,t){const r=eN(e);return Math.round(t*r)/r}function gv(e){const t=g.useRef(e);return cf(()=>{t.current=e}),t}function sz(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:o,floating:u}={},transform:d=!0,whileElementsMounted:m,open:h}=e,[v,p]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,b]=g.useState(i);jf(x,i)||b(i);const[w,C]=g.useState(null),[E,S]=g.useState(null),N=g.useCallback(H=>{H!==L.current&&(L.current=H,C(H))},[]),k=g.useCallback(H=>{H!==$.current&&($.current=H,S(H))},[]),R=o||w,M=u||E,L=g.useRef(null),$=g.useRef(null),D=g.useRef(v),q=m!=null,G=gv(m),W=gv(s),B=gv(h),j=g.useCallback(()=>{if(!L.current||!$.current)return;const H={placement:t,strategy:r,middleware:x};W.current&&(H.platform=W.current),rz(L.current,$.current,H).then(F=>{const V={...F,isPositioned:B.current!==!1};O.current&&!jf(D.current,V)&&(D.current=V,za.flushSync(()=>{p(V)}))})},[x,t,r,W,B]);cf(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[h]);const O=g.useRef(!1);cf(()=>(O.current=!0,()=>{O.current=!1}),[]),cf(()=>{if(R&&(L.current=R),M&&($.current=M),R&&M){if(G.current)return G.current(R,M,j);j()}},[R,M,j,G,q]);const z=g.useMemo(()=>({reference:L,floating:$,setReference:N,setFloating:k}),[N,k]),T=g.useMemo(()=>({reference:R,floating:M}),[R,M]),U=g.useMemo(()=>{const H={position:r,left:0,top:0};if(!T.floating)return H;const F=UC(T.floating,v.x),V=UC(T.floating,v.y);return d?{...H,transform:"translate("+F+"px, "+V+"px)",...eN(T.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:V}},[r,d,T.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:j,refs:z,elements:T,floatingStyles:U}),[v,j,z,T,U])}const az=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?$C({element:i.current,padding:s}).fn(r):{}:i?$C({element:i,padding:s}).fn(r):{}}}},oz=(e,t)=>{const r=X8(e);return{name:r.name,fn:r.fn,options:[e,t]}},lz=(e,t)=>{const r=Z8(e);return{name:r.name,fn:r.fn,options:[e,t]}},cz=(e,t)=>({fn:tz(e).fn,options:[e,t]}),uz=(e,t)=>{const r=Q8(e);return{name:r.name,fn:r.fn,options:[e,t]}},dz=(e,t)=>{const r=J8(e);return{name:r.name,fn:r.fn,options:[e,t]}},hz=(e,t)=>{const r=ez(e);return{name:r.name,fn:r.fn,options:[e,t]}},fz=(e,t)=>{const r=az(e);return{name:r.name,fn:r.fn,options:[e,t]}};var mz="Arrow",tN=g.forwardRef((e,t)=>{const{children:r,width:i=10,height:s=5,...o}=e;return l.jsx(We.svg,{...o,ref:t,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});tN.displayName=mz;var pz=tN;function gz(e){const[t,r]=g.useState(void 0);return Zt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}var Zx="Popper",[rN,vm]=Cn(Zx),[vz,iN]=rN(Zx),nN=e=>{const{__scopePopper:t,children:r}=e,[i,s]=g.useState(null),[o,u]=g.useState(void 0);return l.jsx(vz,{scope:t,anchor:i,onAnchorChange:s,placementState:o,setPlacementState:u,children:r})};nN.displayName=Zx;var sN="PopperAnchor",aN=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...s}=e,o=iN(sN,r),u=g.useRef(null),d=o.onAnchorChange,m=g.useCallback(w=>{u.current=w,w&&d(w)},[d]),h=rt(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&&Jx(o.placementState),x=p==null?void 0:p[0],b=p==null?void 0:p[1];return i?null:l.jsx(We.div,{"data-radix-popper-side":x,"data-radix-popper-align":b,...s,ref:h})});aN.displayName=sN;var Qx="PopperContent",[_z,xz]=rN(Qx),oN=g.forwardRef((e,t)=>{var le,ie,Se,be,Ce,Q;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:v=0,sticky:p="partial",hideWhenDetached:x=!1,updatePositionStrategy:b="optimized",onPlaced:w,...C}=e,E=iN(Qx,r),[S,N]=g.useState(null),k=rt(t,N),[R,M]=g.useState(null),L=gz(R),$=(L==null?void 0:L.width)??0,D=(L==null?void 0:L.height)??0,q=i+(o!=="center"?"-"+o:""),G=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},W=Array.isArray(h)?h:[h],B=W.length>0,j={padding:G,boundary:W.filter(bz),altBoundary:B},{refs:O,floatingStyles:z,placement:T,isPositioned:U,middlewareData:H}=sz({strategy:"fixed",placement:q,whileElementsMounted:(...re)=>K8(...re,{animationFrame:b==="always"}),elements:{reference:E.anchor},middleware:[oz({mainAxis:s+D,alignmentAxis:u}),m&&lz({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?cz():void 0,...j}),m&&uz({...j}),dz({...j,apply:({elements:re,rects:ye,availableWidth:me,availableHeight:Ae})=>{const{width:Le,height:je}=ye.reference,Ye=re.floating.style;Ye.setProperty("--radix-popper-available-width",`${me}px`),Ye.setProperty("--radix-popper-available-height",`${Ae}px`),Ye.setProperty("--radix-popper-anchor-width",`${Le}px`),Ye.setProperty("--radix-popper-anchor-height",`${je}px`)}}),R&&fz({element:R,padding:d}),wz({arrowWidth:$,arrowHeight:D}),x&&hz({strategy:"referenceHidden",...j,boundary:B?j.boundary:void 0})]}),F=E.setPlacementState;Zt(()=>(F(T),()=>{F(void 0)}),[T,F]);const[V,I]=Jx(T),Y=vr(w);Zt(()=>{U&&(Y==null||Y())},[U,Y]);const K=(le=H.arrow)==null?void 0:le.x,ee=(ie=H.arrow)==null?void 0:ie.y,oe=((Se=H.arrow)==null?void 0:Se.centerOffset)!==0,[ce,Z]=g.useState();return Zt(()=>{S&&Z(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:U?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(be=H.transformOrigin)==null?void 0:be.x,(Ce=H.transformOrigin)==null?void 0:Ce.y].join(" "),...((Q=H.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(_z,{scope:r,placedSide:V,placedAlign:I,onArrowChange:M,arrowX:K,arrowY:ee,shouldHideArrow:oe,children:l.jsx(We.div,{"data-side":V,"data-align":I,...C,ref:k,style:{...C.style,animation:U?void 0:"none"}})})})});oN.displayName=Qx;var lN="PopperArrow",yz={top:"bottom",right:"left",bottom:"top",left:"right"},cN=g.forwardRef(function(t,r){const{__scopePopper:i,...s}=t,o=xz(lN,i),u=yz[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(pz,{...s,ref:r,style:{...s.style,display:"block"}})})});cN.displayName=lN;function bz(e){return e!==null}var wz=e=>({name:"transformOrigin",options:e,fn(t){var E,S,N;const{placement:r,rects:i,middlewareData:s}=t,u=((E=s.arrow)==null?void 0:E.centerOffset)!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[h,v]=Jx(r),p={start:"0%",center:"50%",end:"100%"}[v],x=(((S=s.arrow)==null?void 0:S.x)??0)+d/2,b=(((N=s.arrow)==null?void 0:N.y)??0)+m/2;let w="",C="";return h==="bottom"?(w=u?p:`${x}px`,C=`${-m}px`):h==="top"?(w=u?p:`${x}px`,C=`${i.floating.height+m}px`):h==="right"?(w=`${-m}px`,C=u?p:`${b}px`):h==="left"&&(w=`${i.floating.width+m}px`,C=u?p:`${b}px`),{data:{x:w,y:C}}}});function Jx(e){const[t,r="center"]=e.split("-");return[t,r]}var uN=nN,dN=aN,hN=oN,fN=cN,vv=!1;function Sz(){const[e,t]=g.useState(vv);return g.useEffect(()=>{vv||(vv=!0,t(!0))},[]),e}var mN=Oa[" useSyncExternalStore ".trim().toString()];function Cz(){return()=>{}}function Ez(){return mN(Cz,()=>!0,()=>!1)}var Rz=typeof mN=="function"?Ez:Sz,_v="rovingFocusGroup.onEntryFocus",kz={bubbles:!1,cancelable:!0},sd="RovingFocusGroup",[G_,pN,Nz]=Wx(sd),[Az,_m]=Cn(sd,[Nz]),[Tz,Mz]=Az(sd),gN=g.forwardRef((e,t)=>l.jsx(G_.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(G_.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(jz,{...e,ref:t})})}));gN.displayName=sd;var jz=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:v=!1,...p}=e,x=g.useRef(null),b=rt(t,x),w=id(o),[C,E]=Eo({prop:u,defaultProp:d??null,onChange:m,caller:sd}),[S,N]=g.useState(!1),k=vr(h),R=pN(r),M=g.useRef(!1),[L,$]=g.useState(0);return g.useEffect(()=>{const D=x.current;if(D)return D.addEventListener(_v,k),()=>D.removeEventListener(_v,k)},[k]),l.jsx(Tz,{scope:r,orientation:i,dir:w,loop:s,currentTabStopId:C,onItemFocus:g.useCallback(D=>E(D),[E]),onItemShiftTab:g.useCallback(()=>N(!0),[]),onFocusableItemAdd:g.useCallback(()=>$(D=>D+1),[]),onFocusableItemRemove:g.useCallback(()=>$(D=>D-1),[]),children:l.jsx(We.div,{tabIndex:S||L===0?-1:0,"data-orientation":i,...p,ref:b,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{M.current=!0}),onFocus:Be(e.onFocus,D=>{const q=!M.current;if(D.target===D.currentTarget&&q&&!S){const G=new CustomEvent(_v,kz);if(D.currentTarget.dispatchEvent(G),!G.defaultPrevented){const W=R().filter(T=>T.focusable),B=W.find(T=>T.active),j=W.find(T=>T.id===C),z=[B,j,...W].filter(Boolean).map(T=>T.ref.current);xN(z,v)}}M.current=!1}),onBlur:Be(e.onBlur,()=>N(!1))})})}),vN="RovingFocusGroupItem",_N=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:u,...d}=e,m=_n(),h=o||m,v=Mz(vN,r),p=v.currentTabStopId===h,x=pN(r),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:C}=v,E=Rz();return Zt(()=>{if(!(!E||!i))return b(),()=>w()},[E,i,b,w]),g.useEffect(()=>{if(!(E||!i))return b(),()=>w()},[E,i,b,w]),l.jsx(G_.ItemSlot,{scope:r,id:h,focusable:i,active:s,children:l.jsx(We.span,{tabIndex:p?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Be(e.onMouseDown,S=>{i?v.onItemFocus(h):S.preventDefault()}),onFocus:Be(e.onFocus,()=>v.onItemFocus(h)),onKeyDown:Be(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){v.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const N=Oz(S,v.orientation,v.dir);if(N!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=x().filter(M=>M.focusable).map(M=>M.ref.current);if(N==="last")R.reverse();else if(N==="prev"||N==="next"){N==="prev"&&R.reverse();const M=R.indexOf(S.currentTarget);R=v.loop?Bz(R,M+1):R.slice(M+1)}setTimeout(()=>xN(R))}}),children:typeof u=="function"?u({isCurrentTabStop:p,hasTabStop:C!=null}):u})})});_N.displayName=vN;var Dz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Oz(e,t,r){const i=Lz(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Dz[i]}function xN(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function Bz(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var yN=gN,bN=_N,Y_=["Enter"," "],Pz=["ArrowDown","PageUp","Home"],wN=["ArrowUp","PageDown","End"],Iz=[...Pz,...wN],zz={ltr:[...Y_,"ArrowRight"],rtl:[...Y_,"ArrowLeft"]},$z={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ad="Menu",[zu,Uz,Hz]=Wx(ad),[Po,SN]=Cn(ad,[Hz,vm,_m]),xm=vm(),CN=_m(),[Fz,Io]=Po(ad),[Wz,od]=Po(ad),EN=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:s,onOpenChange:o,modal:u=!0}=e,d=xm(t),[m,h]=g.useState(null),v=g.useRef(!1),p=vr(o),x=id(s);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(uN,{...d,children:l.jsx(Fz,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:h,children:l.jsx(Wz,{scope:t,onClose:g.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:v,dir:x,modal:u,children:i})})})};EN.displayName=ad;var qz="MenuAnchor",ey=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=xm(r);return l.jsx(dN,{...s,...i,ref:t})});ey.displayName=qz;var ty="MenuPortal",[Vz,RN]=Po(ty,{forceMount:void 0}),kN=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:s}=e,o=Io(ty,t);return l.jsx(Vz,{scope:t,forceMount:r,children:l.jsx(En,{present:r||o.open,children:l.jsx(im,{asChild:!0,container:s,children:i})})})};kN.displayName=ty;var Zi="MenuContent",[Gz,ry]=Po(Zi),NN=g.forwardRef((e,t)=>{const r=RN(Zi,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,o=Io(Zi,e.__scopeMenu),u=od(Zi,e.__scopeMenu);return l.jsx(zu.Provider,{scope:e.__scopeMenu,children:l.jsx(En,{present:i||o.open,children:l.jsx(zu.Slot,{scope:e.__scopeMenu,children:u.modal?l.jsx(Yz,{...s,ref:t}):l.jsx(Kz,{...s,ref:t})})})})}),Yz=g.forwardRef((e,t)=>{const r=Io(Zi,e.__scopeMenu),i=g.useRef(null),s=rt(t,i);return g.useEffect(()=>{const o=i.current;if(o)return Bx(o)},[]),l.jsx(iy,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Kz=g.forwardRef((e,t)=>{const r=Io(Zi,e.__scopeMenu);return l.jsx(iy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Xz=Ro("MenuContent.ScrollLock"),iy=g.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:b,disableOutsideScroll:w,...C}=e,E=Io(Zi,r),S=od(Zi,r),N=xm(r),k=CN(r),R=Uz(r),[M,L]=g.useState(null),$=g.useRef(null),D=rt(t,$,E.onContentChange),q=g.useRef(0),G=g.useRef(""),W=g.useRef(0),B=g.useRef(null),j=g.useRef("right"),O=g.useRef(0),z=w?sm:g.Fragment,T=w?{as:Xz,allowPinchZoom:!0}:void 0,U=F=>{var Z,le;const V=G.current+F,I=R().filter(ie=>!ie.disabled),Y=document.activeElement,K=(Z=I.find(ie=>ie.ref.current===Y))==null?void 0:Z.textValue,ee=I.map(ie=>ie.textValue),oe=l7(ee,V,K),ce=(le=I.find(ie=>ie.textValue===oe))==null?void 0:le.ref.current;(function ie(Se){G.current=Se,window.clearTimeout(q.current),Se!==""&&(q.current=window.setTimeout(()=>ie(""),1e3))})(V),ce&&setTimeout(()=>ce.focus())};g.useEffect(()=>()=>window.clearTimeout(q.current),[]),Ox();const H=g.useCallback(F=>{var I,Y;return j.current===((I=B.current)==null?void 0:I.side)&&u7(F,(Y=B.current)==null?void 0:Y.area)},[]);return l.jsx(Gz,{scope:r,searchRef:G,onItemEnter:g.useCallback(F=>{H(F)&&F.preventDefault()},[H]),onItemLeave:g.useCallback(F=>{var V;H(F)||((V=$.current)==null||V.focus(),L(null))},[H]),onTriggerLeave:g.useCallback(F=>{H(F)&&F.preventDefault()},[H]),pointerGraceTimerRef:W,onPointerGraceIntentChange:g.useCallback(F=>{B.current=F},[]),children:l.jsx(z,{...T,children:l.jsx(rm,{asChild:!0,trapped:s,onMountAutoFocus:Be(o,F=>{var V;F.preventDefault(),(V=$.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:l.jsx(tm,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:p,onInteractOutside:x,onDismiss:b,children:l.jsx(yN,{asChild:!0,...k,dir:S.dir,orientation:"vertical",loop:i,currentTabStopId:M,onCurrentTabStopIdChange:L,onEntryFocus:Be(m,F=>{S.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(hN,{role:"menu","aria-orientation":"vertical","data-state":WN(E.open),"data-radix-menu-content":"",dir:S.dir,...N,...C,ref:D,style:{outline:"none",...C.style},onKeyDown:Be(C.onKeyDown,F=>{const I=F.target.closest("[data-radix-menu-content]")===F.currentTarget,Y=F.ctrlKey||F.altKey||F.metaKey,K=F.key.length===1;I&&(F.key==="Tab"&&F.preventDefault(),!Y&&K&&U(F.key));const ee=$.current;if(F.target!==ee||!Iz.includes(F.key))return;F.preventDefault();const ce=R().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);wN.includes(F.key)&&ce.reverse(),a7(ce)}),onBlur:Be(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(q.current),G.current="")}),onPointerMove:Be(e.onPointerMove,$u(F=>{const V=F.target,I=O.current!==F.clientX;if(F.currentTarget.contains(V)&&I){const Y=F.clientX>O.current?"right":"left";j.current=Y,O.current=F.clientX}}))})})})})})})});NN.displayName=Zi;var Zz="MenuGroup",ny=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(We.div,{role:"group",...i,ref:t})});ny.displayName=Zz;var Qz="MenuLabel",AN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(We.div,{...i,ref:t})});AN.displayName=Qz;var Df="MenuItem",HC="menu.itemSelect",ym=g.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...s}=e,o=g.useRef(null),u=od(Df,e.__scopeMenu),d=ry(Df,e.__scopeMenu),m=rt(t,o),h=g.useRef(!1),v=()=>{const p=o.current;if(!r&&p){const x=new CustomEvent(HC,{bubbles:!0,cancelable:!0});p.addEventListener(HC,b=>i==null?void 0:i(b),{once:!0}),$R(p,x),x.defaultPrevented?h.current=!1:u.onClose()}};return l.jsx(TN,{...s,ref:m,disabled:r,onClick:Be(e.onClick,v),onPointerDown:p=>{var x;(x=e.onPointerDown)==null||x.call(e,p),h.current=!0},onPointerUp:Be(e.onPointerUp,p=>{var x;h.current||(x=p.currentTarget)==null||x.click()}),onKeyDown:Be(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||Y_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});ym.displayName=Df;var TN=g.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=e,u=ry(Df,r),d=CN(r),m=g.useRef(null),h=rt(t,m),[v,p]=g.useState(!1),[x,b]=g.useState("");return g.useEffect(()=>{const w=m.current;w&&b((w.textContent??"").trim())},[o.children]),l.jsx(zu.ItemSlot,{scope:r,disabled:i,textValue:s??x,children:l.jsx(bN,{asChild:!0,...d,focusable:!i,children:l.jsx(We.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:h,onPointerMove:Be(e.onPointerMove,$u(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,$u(w=>u.onItemLeave(w))),onFocus:Be(e.onFocus,()=>p(!0)),onBlur:Be(e.onBlur,()=>p(!1))})})})}),Jz="MenuCheckboxItem",MN=g.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return l.jsx(BN,{scope:e.__scopeMenu,checked:r,children:l.jsx(ym,{role:"menuitemcheckbox","aria-checked":Lf(r)?"mixed":r,...s,ref:t,"data-state":ay(r),onSelect:Be(s.onSelect,()=>i==null?void 0:i(Lf(r)?!0:!r),{checkForDefaultPrevented:!1})})})});MN.displayName=Jz;var jN="MenuRadioGroup",[e7,t7]=Po(jN,{value:void 0,onValueChange:()=>{}}),DN=g.forwardRef((e,t)=>{const{value:r,onValueChange:i,...s}=e,o=vr(i);return l.jsx(e7,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(ny,{...s,ref:t})})});DN.displayName=jN;var LN="MenuRadioItem",ON=g.forwardRef((e,t)=>{const{value:r,...i}=e,s=t7(LN,e.__scopeMenu),o=r===s.value;return l.jsx(BN,{scope:e.__scopeMenu,checked:o,children:l.jsx(ym,{role:"menuitemradio","aria-checked":o,...i,ref:t,"data-state":ay(o),onSelect:Be(i.onSelect,()=>{var u;return(u=s.onValueChange)==null?void 0:u.call(s,r)},{checkForDefaultPrevented:!1})})})});ON.displayName=LN;var sy="MenuItemIndicator",[BN,r7]=Po(sy,{checked:!1}),PN=g.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...s}=e,o=r7(sy,r);return l.jsx(En,{present:i||Lf(o.checked)||o.checked===!0,children:l.jsx(We.span,{...s,ref:t,"data-state":ay(o.checked)})})});PN.displayName=sy;var i7="MenuSeparator",IN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(We.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});IN.displayName=i7;var n7="MenuArrow",zN=g.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=xm(r);return l.jsx(fN,{...s,...i,ref:t})});zN.displayName=n7;var s7="MenuSub",[CZ,$N]=Po(s7),bu="MenuSubTrigger",UN=g.forwardRef((e,t)=>{const r=Io(bu,e.__scopeMenu),i=od(bu,e.__scopeMenu),s=$N(bu,e.__scopeMenu),o=ry(bu,e.__scopeMenu),u=g.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,h={__scopeMenu:e.__scopeMenu},v=g.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);g.useEffect(()=>v,[v]),g.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]);const p=rt(t,s.onTriggerChange);return l.jsx(ey,{asChild:!0,...h,children:l.jsx(TN,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":WN(r.open),...e,ref:p,onClick:x=>{var b;(b=e.onClick)==null||b.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,$u(x=>{o.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(o.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),v()},100))})),onPointerLeave:Be(e.onPointerLeave,$u(x=>{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",N=S?-5:5,k=b[S?"left":"right"],R=b[S?"right":"left"];o.onPointerGraceIntentChange({area:[{x:x.clientX+N,y:x.clientY},{x:k,y:b.top},{x:R,y:b.top},{x:R,y:b.bottom},{x:k,y:b.bottom}],side:E}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(x),x.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,x=>{var w;e.disabled||x.target!==x.currentTarget||o.searchRef.current!==""&&x.key===" "||zz[i.dir].includes(x.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),x.preventDefault())})})})});UN.displayName=bu;var HN="MenuSubContent",FN=g.forwardRef((e,t)=>{const r=RN(Zi,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=e,u=Io(Zi,e.__scopeMenu),d=od(Zi,e.__scopeMenu),m=$N(HN,e.__scopeMenu),h=g.useRef(null),v=rt(t,h);return l.jsx(zu.Provider,{scope:e.__scopeMenu,children:l.jsx(En,{present:i||u.open,children:l.jsx(zu.Slot,{scope:e.__scopeMenu,children:l.jsx(iy,{id:m.contentId,"aria-labelledby":m.triggerId,...o,ref:v,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var x;d.isUsingKeyboardRef.current&&((x=h.current)==null||x.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Be(e.onFocusOutside,p=>{p.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{var w;const x=p.currentTarget.contains(p.target),b=$z[d.dir].includes(p.key);x&&b&&(u.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});FN.displayName=HN;function WN(e){return e?"open":"closed"}function Lf(e){return e==="indeterminate"}function ay(e){return Lf(e)?"indeterminate":e?"checked":"unchecked"}function a7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function o7(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function l7(e,t,r){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=o7(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function c7(e,t){const{x:r,y:i}=e;let s=!1;for(let o=0,u=t.length-1;o<t.length;u=o++){const d=t[o],m=t[u],h=d.x,v=d.y,p=m.x,x=m.y;v>i!=x>i&&r<(p-h)*(i-v)/(x-v)+h&&(s=!s)}return s}function u7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return c7(r,t)}function $u(e){return t=>t.pointerType==="mouse"?e(t):void 0}var d7=EN,h7=ey,f7=kN,m7=NN,p7=ny,g7=AN,v7=ym,_7=MN,x7=DN,y7=ON,b7=PN,w7=IN,S7=zN,C7=UN,E7=FN,bm="DropdownMenu",[R7]=Cn(bm,[SN]),ti=SN(),[k7,qN]=R7(bm),VN=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:s,defaultOpen:o,onOpenChange:u,modal:d=!0}=e,m=ti(t),h=g.useRef(null),[v,p]=Eo({prop:s,defaultProp:o??!1,onChange:u,caller:bm});return l.jsx(k7,{scope:t,triggerId:_n(),triggerRef:h,contentId:_n(),open:v,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(x=>!x),[p]),modal:d,children:l.jsx(d7,{...m,open:v,onOpenChange:p,dir:i,modal:d,children:r})})};VN.displayName=bm;var GN="DropdownMenuTrigger",YN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,o=qN(GN,r),u=ti(r),d=rt(t,o.triggerRef);return l.jsx(h7,{asChild:!0,...u,children:l.jsx(We.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Be(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(o.onOpenToggle(),o.open||m.preventDefault())}),onKeyDown:Be(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&o.onOpenToggle(),m.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});YN.displayName=GN;var N7="DropdownMenuPortal",KN=e=>{const{__scopeDropdownMenu:t,...r}=e,i=ti(t);return l.jsx(f7,{...i,...r})};KN.displayName=N7;var XN="DropdownMenuContent",ZN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=qN(XN,r),o=ti(r),u=g.useRef(!1);return l.jsx(m7,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:t,onCloseAutoFocus:Be(e.onCloseAutoFocus,d=>{var m;u.current||(m=s.triggerRef.current)==null||m.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Be(e.onInteractOutside,d=>{const m=d.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,v=m.button===2||h;(!s.modal||v)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ZN.displayName=XN;var A7="DropdownMenuGroup",T7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(p7,{...s,...i,ref:t})});T7.displayName=A7;var M7="DropdownMenuLabel",j7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(g7,{...s,...i,ref:t})});j7.displayName=M7;var D7="DropdownMenuItem",QN=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(v7,{...s,...i,ref:t})});QN.displayName=D7;var L7="DropdownMenuCheckboxItem",O7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(_7,{...s,...i,ref:t})});O7.displayName=L7;var B7="DropdownMenuRadioGroup",P7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(x7,{...s,...i,ref:t})});P7.displayName=B7;var I7="DropdownMenuRadioItem",z7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(y7,{...s,...i,ref:t})});z7.displayName=I7;var $7="DropdownMenuItemIndicator",U7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(b7,{...s,...i,ref:t})});U7.displayName=$7;var H7="DropdownMenuSeparator",F7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(w7,{...s,...i,ref:t})});F7.displayName=H7;var W7="DropdownMenuArrow",q7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(S7,{...s,...i,ref:t})});q7.displayName=W7;var V7="DropdownMenuSubTrigger",G7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(C7,{...s,...i,ref:t})});G7.displayName=V7;var Y7="DropdownMenuSubContent",K7=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=ti(r);return l.jsx(E7,{...s,...i,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});K7.displayName=Y7;var X7=VN,JN=YN,Z7=KN,eA=ZN,tA=QN;function K_(e){return l.jsx(X7,{"data-slot":"dropdown-menu",...e})}const Of=g.forwardRef((e,t)=>l.jsx(JN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));Of.displayName=JN.displayName;const Bf=g.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...i},s)=>l.jsx(Z7,{children:l.jsx(eA,{ref:s,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:ct("cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));Bf.displayName=eA.displayName;const Pf=g.forwardRef(({className:e,variant:t="default",...r},i)=>l.jsx(tA,{ref:i,"data-slot":"dropdown-menu-item","data-variant":t,className:ct("relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t==="destructive"&&"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20",e),...r}));Pf.displayName=tA.displayName;const Et=g.forwardRef(({className:e,type:t,...r},i)=>l.jsx("input",{ref:i,type:t,"data-slot":"input",className:ct("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r}));Et.displayName="Input";function wm({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:ct("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function Q7({idPrefix:e,fields:t,activeFieldId:r,answers:i,otherValues:s,otherSelections:o,errors:u={},disabled:d=!1,onNavigate:m,onAnswerChange:h,onOtherValueChange:v,onOtherSelectionChange:p}){const x=g.useRef(null),b=g.useRef(void 0),w=g.useRef(void 0),C=t.findIndex(D=>D.id===r),E=C>=0?C:0,S=t[E],N=S?u[S.id]:void 0,k=S?i[S.id]:void 0;if(g.useEffect(()=>{if(!S)return;const D=b.current!==void 0&&b.current!==S.id,q=!!N&&w.current!==N;if(b.current=S.id,w.current=N,!D&&!q)return;const G=x.current,W=(G==null?void 0:G.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(G==null?void 0:G.querySelector("input:checked:not([disabled])"))??(G==null?void 0:G.querySelector("input:not([disabled]), textarea:not([disabled])"));W==null||W.focus()},[N,S]),!S)return null;const R=`${e}-field-${E}`,M=S.description?`${R}-description`:void 0,L=N?`${R}-error`:void 0,$=[M,L].filter(Boolean).join(" ")||void 0;return l.jsxs("div",{className:"grid gap-3",children:[t.length>1&&l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",E+1," of ",t.length]}),l.jsx("div",{className:"text-[11px] text-muted-foreground",children:S.required?"Required":"Optional"})]}),l.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":E+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:l.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(E+1)/t.length*100}%`}})})]}),l.jsx("div",{ref:x,children:S.type==="text"?l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("label",{htmlFor:R,className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(qC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),S.multiline&&!S.secret?l.jsx(wm,{id:R,value:typeof k=="string"?k:"",disabled:d,placeholder:S.placeholder,"aria-invalid":N?!0:void 0,"aria-describedby":$,required:S.required,onChange:D=>h(S.id,D.target.value)}):l.jsx(Et,{id:R,type:S.secret?"password":"text",autoComplete:"off",value:typeof k=="string"?k:"",disabled:d,placeholder:S.placeholder,"aria-invalid":N?!0:void 0,"aria-describedby":$,required:S.required,onChange:D=>h(S.id,D.target.value)}),l.jsx(WC,{id:L,error:N})]}):l.jsxs("fieldset",{disabled:d,role:S.multiple?void 0:"radiogroup","aria-required":!S.multiple&&S.required?!0:void 0,"aria-invalid":N?!0:void 0,"aria-describedby":$,className:"grid gap-1.5",children:[l.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(qC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),l.jsxs("div",{className:"grid gap-1.5",children:[S.options.map((D,q)=>{const G=`${R}-option-${q}`,W=S.multiple?Array.isArray(k)&&k.includes(D.value):o[S.id]!==!0&&k===D.value;return l.jsx(FC,{id:G,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:W,label:D.label,description:D.description,onChange:B=>{if(S.multiple){const j=Array.isArray(k)?k:[];h(S.id,B?[...j.filter(O=>O!==D.value),D.value]:j.filter(O=>O!==D.value))}else h(S.id,D.value),p(S.id,!1)}},D.value)}),S.allowOther&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[l.jsx(FC,{id:`${R}-other`,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:o[S.id]===!0,label:"Other",embedded:!0,onChange:D=>{p(S.id,D),D&&!S.multiple&&h(S.id,"")}}),l.jsx(Et,{value:s[S.id]??"",disabled:d||o[S.id]!==!0,"aria-label":`Other answer for ${S.label}`,"aria-invalid":N?!0:void 0,"aria-describedby":$,placeholder:"Enter another answer",onChange:D=>v(S.id,D.target.value)})]}),!S.required&&!S.multiple&&(o[S.id]===!0||typeof k=="string"&&k.length>0)&&l.jsx(he,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{h(S.id,""),p(S.id,!1)},children:"Clear selection"})]}),l.jsx(WC,{id:L,error:N})]})}),t.length>1&&l.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[l.jsxs(he,{type:"button",size:"xs",variant:"ghost",disabled:d||E===0,onClick:()=>m(t[E-1].id),children:[l.jsx(AR,{}),"Previous"]}),l.jsxs(he,{type:"button",size:"xs",variant:"outline",disabled:d||E===t.length-1,onClick:()=>m(t[E+1].id),children:["Next",l.jsx(jo,{})]})]})]})}function FC({id:e,name:t,type:r,checked:i,label:s,description:o,embedded:u=!1,onChange:d}){return l.jsxs("label",{htmlFor:e,className:ct("flex cursor-pointer items-start gap-2 text-xs text-foreground",!u&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[l.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[l.jsx("input",{id:e,type:r,name:t,checked:i,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),l.jsx(Pa,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block",children:s}),o&&l.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:o})]})]})}function WC({id:e,error:t}){return t?l.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function qC(){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),l.jsx("span",{className:"sr-only",children:" (required)"})]})}function ja({className:e,size:t="default",...r}){return l.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:ct("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[l.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),l.jsx(Nx,{"aria-hidden":"true","data-slot":"native-select-icon",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"})]})}var J7=Object.defineProperty,Bs=(e,t)=>J7(e,"name",{value:t,configurable:!0});function rA(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}Bs(rA,"useStateMachine");var Sm=Bs(e=>{const{present:t,children:r}=e,i=iA(t),s=typeof r=="function"?r({present:i.isPresent}):g.Children.only(r),o=nA(i.ref,sA(s));return typeof r=="function"||i.isPresent?g.cloneElement(s,{ref:o}):null},"Presence");function iA(e){const[t,r]=g.useState(),i=g.useRef(null),s=g.useRef(e),o=g.useRef("none"),u=g.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=rA(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{m==="mounted"?(o.current=u.current??Pl(i.current),u.current=void 0):o.current="none"},[m]),Zt(()=>{const v=i.current,p=s.current;if(p!==e){const b=o.current,w=Pl(v);e?(u.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Zt(()=>{if(t){let v;const p=t.ownerDocument.defaultView??window,x=Bs(w=>{const E=Pl(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(h("ANIMATION_END"),!s.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",v=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),b=Bs(w=>{w.target===t&&(o.current=Pl(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{p.clearTimeout(v),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:g.useCallback(v=>{if(v){const p=getComputedStyle(v);i.current=p,u.current=Pl(p)}else i.current=null;r(v)},[])}}Bs(iA,"usePresence");function X_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Bs(X_,"setRef");function nA(...e){const t=g.useRef(e);return t.current=e,g.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=X_(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u<o.length;u++){const d=o[u];typeof d=="function"?d():X_(i[u],null)}}},[])}Bs(nA,"useStableComposedRefs");function Pl(e){return(e==null?void 0:e.animationName)||"none"}Bs(Pl,"getAnimationName");function sA(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Bs(sA,"getElementRef");function Z_(e,[t,r]){return Math.min(r,Math.max(t,e))}var e$=Object.defineProperty,ic=(e,t)=>e$(e,"name",{value:t,configurable:!0}),aA=!!(typeof window<"u"&&window.document&&window.document.createElement);function ka(e,t,{checkForDefaultPrevented:r=!0}={}){return ic(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}ic(ka,"composeEventHandlers");function t$(e){var t;if(!aA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}ic(t$,"getOwnerWindow");function Q_(e){if(!aA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}ic(Q_,"getOwnerDocument");function oA(e,t=!1){const{activeElement:r}=Q_(e);if(!(r!=null&&r.nodeName))return null;if(lA(r)&&r.contentDocument)return oA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=Q_(r).getElementById(i);if(s)return s}}return r}ic(oA,"getActiveElement");function lA(e){return e.tagName==="IFRAME"}ic(lA,"isFrame");var r$=Object.defineProperty,st=(e,t)=>r$(e,"name",{value:t,configurable:!0});function cA(e,t){return g.useReducer((r,i)=>t[r][i]??r,e)}st(cA,"useStateMachine");var uA="ScrollArea",[dA]=Cn(uA),[i$,an]=dA(uA),n$=g.forwardRef(st(function(t,r){const{__scopeScrollArea:i,type:s="hover",dir:o,scrollHideDelay:u=600,...d}=t,[m,h]=g.useState(null),[v,p]=g.useState(null),[x,b]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(null),[N,k]=g.useState(0),[R,M]=g.useState(0),[L,$]=g.useState(!1),[D,q]=g.useState(!1),G=rt(r,h),W=id(o);return l.jsx(i$,{scope:i,type:s,dir:W,scrollHideDelay:u,scrollArea:m,viewport:v,onViewportChange:p,content:x,onContentChange:b,scrollbarX:w,onScrollbarXChange:C,scrollbarXEnabled:L,onScrollbarXEnabledChange:$,scrollbarY:E,onScrollbarYChange:S,scrollbarYEnabled:D,onScrollbarYEnabledChange:q,onCornerWidthChange:k,onCornerHeightChange:M,children:l.jsx(We.div,{dir:W,...d,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":R+"px",...t.style}})})},"ScrollArea")),s$="ScrollAreaViewport",a$=g.forwardRef(st(function(t,r){const{__scopeScrollArea:i,children:s,nonce:o,...u}=t,d=an(s$,i),m=g.useRef(null),h=rt(r,m,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx(o$,{nonce:o}),l.jsx(We.div,{"data-radix-scroll-area-viewport":"",...u,ref:h,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),o$=g.memo(st(function({nonce:t}){return l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),zs="ScrollAreaScrollbar",hA=g.forwardRef(st(function(t,r){const{forceMount:i,...s}=t,o=an(zs,t.__scopeScrollArea),{onScrollbarXEnabledChange:u,onScrollbarYEnabledChange:d}=o,m=t.orientation==="horizontal";return g.useEffect(()=>(m?u(!0):d(!0),()=>{m?u(!1):d(!1)}),[m,u,d]),o.type==="hover"?l.jsx(l$,{...s,ref:r,forceMount:i}):o.type==="scroll"?l.jsx(c$,{...s,ref:r,forceMount:i}):o.type==="auto"?l.jsx(fA,{...s,ref:r,forceMount:i}):o.type==="always"?l.jsx(oy,{...s,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),l$=g.forwardRef(st(function(t,r){const{forceMount:i,...s}=t,o=an(zs,t.__scopeScrollArea),[u,d]=g.useState(!1);return g.useEffect(()=>{const m=o.scrollArea;let h=0;if(m){const v=st(()=>{window.clearTimeout(h),d(!0)},"handlePointerEnter"),p=st(()=>{h=window.setTimeout(()=>d(!1),o.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",v),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(h),m.removeEventListener("pointerenter",v),m.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(Sm,{present:i||u,children:l.jsx(fA,{"data-state":u?"visible":"hidden",...s,ref:r})})},"ScrollAreaScrollbarHover")),c$=g.forwardRef(st(function(t,r){const{forceMount:i,...s}=t,o=an(zs,t.__scopeScrollArea),u=t.orientation==="horizontal",d=cd(()=>h("SCROLL_END"),100),[m,h]=cA("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(m==="idle"){const v=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(v)}},[m,o.scrollHideDelay,h]),g.useEffect(()=>{const v=o.viewport,p=u?"scrollLeft":"scrollTop";if(v){let x=v[p];const b=st(()=>{const w=v[p];x!==w&&(h("SCROLL"),d()),x=w},"handleScroll");return v.addEventListener("scroll",b),()=>v.removeEventListener("scroll",b)}},[o.viewport,u,h,d]),l.jsx(Sm,{present:i||m!=="hidden",children:l.jsx(oy,{"data-state":m==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:ka(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:ka(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),fA=g.forwardRef(st(function(t,r){const i=an(zs,t.__scopeScrollArea),{forceMount:s,...o}=t,[u,d]=g.useState(!1),m=t.orientation==="horizontal",h=cd(()=>{if(i.viewport){const v=i.viewport.offsetWidth<i.viewport.scrollWidth,p=i.viewport.offsetHeight<i.viewport.scrollHeight;d(m?v:p)}},10);return No(i.viewport,h),No(i.content,h),l.jsx(Sm,{present:s||u,children:l.jsx(oy,{"data-state":u?"visible":"hidden",...o,ref:r})})},"ScrollAreaScrollbarAuto")),oy=g.forwardRef(st(function(t,r){const{orientation:i="vertical",...s}=t,o=an(zs,t.__scopeScrollArea),u=g.useRef(null),d=g.useRef(0),[m,h]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),v=ly(m.viewport,m.content),p={...s,sizes:m,onSizesChange:h,hasThumb:v>0&&v<1,onThumbChange:st(b=>u.current=b,"onThumbChange"),onThumbPointerUp:st(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:st(b=>d.current=b,"onThumbPointerDown")};function x(b,w){return vA(b,d.current,m,w)}return st(x,"getScrollPosition"),i==="horizontal"?l.jsx(u$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollLeft,w=e0(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=x(b,o.dir))}}):i==="vertical"?l.jsx(d$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollTop,w=e0(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=x(b))}}):null},"ScrollAreaScrollbarVisible")),u$=g.forwardRef(st(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=an(zs,t.__scopeScrollArea),[d,m]=g.useState(),h=g.useRef(null),v=rt(r,h,u.onScrollbarXChange);return g.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(pA,{"data-orientation":"horizontal",...o,ref:v,sizes:i,style:{bottom:0,left:u.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:u.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ld(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,x)=>{if(u.viewport){const b=u.viewport.scrollLeft+p.deltaX;t.onWheelScroll(b),uy(b,x)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollWidth,viewport:u.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Uu(d.paddingLeft),paddingEnd:Uu(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),d$=g.forwardRef(st(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=an(zs,t.__scopeScrollArea),[d,m]=g.useState(),h=g.useRef(null),v=rt(r,h,u.onScrollbarYChange);return g.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(pA,{"data-orientation":"vertical",...o,ref:v,sizes:i,style:{top:0,right:u.dir==="ltr"?0:void 0,left:u.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ld(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,x)=>{if(u.viewport){const b=u.viewport.scrollTop+p.deltaY;t.onWheelScroll(b),uy(b,x)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollHeight,viewport:u.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Uu(d.paddingTop),paddingEnd:Uu(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[h$,mA]=dA(zs),pA=g.forwardRef(st(function(t,r){const{__scopeScrollArea:i,sizes:s,hasThumb:o,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:h,onDragScroll:v,onWheelScroll:p,onResize:x,...b}=t,w=an(zs,i),[C,E]=g.useState(null),S=rt(r,E),N=g.useRef(null),k=g.useRef(""),R=w.viewport,M=s.content-s.viewport,L=vr(p),$=vr(h),D=cd(x,10);function q(G){if(N.current){const W=G.clientX-N.current.left,B=G.clientY-N.current.top;v({x:W,y:B})}}return st(q,"handleDragScroll"),g.useEffect(()=>{const G=st(W=>{const B=W.target;(C==null?void 0:C.contains(B))&&L(W,M)},"handleWheel");return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[R,C,M,L]),g.useEffect($,[s,$]),No(C,D),No(w.content,D),l.jsx(h$,{scope:i,scrollbar:C,hasThumb:o,onThumbChange:vr(u),onThumbPointerUp:vr(d),onThumbPositionChange:$,onThumbPointerDown:vr(m),children:l.jsx(We.div,{...b,ref:S,style:{position:"absolute",...b.style},onPointerDown:ka(t.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),N.current=C.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),q(G))}),onPointerMove:ka(t.onPointerMove,q),onPointerUp:ka(t.onPointerUp,G=>{const W=G.target;W.hasPointerCapture(G.pointerId)&&W.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=k.current,w.viewport&&(w.viewport.style.scrollBehavior=""),N.current=null})})})},"ScrollAreaScrollbarImpl")),J_="ScrollAreaThumb",f$=g.forwardRef(st(function(t,r){const{forceMount:i,...s}=t,o=mA(J_,t.__scopeScrollArea);return l.jsx(Sm,{present:i||o.hasThumb,children:l.jsx(m$,{ref:r,...s})})},"ScrollAreaThumb")),m$=g.forwardRef(st(function(t,r){const{__scopeScrollArea:i,style:s,...o}=t,u=an(J_,i),d=mA(J_,i),{onThumbPositionChange:m}=d,h=rt(r,d.onThumbChange),v=g.useRef(void 0),p=cd(()=>{v.current&&(v.current(),v.current=void 0)},100);return g.useEffect(()=>{const x=u.viewport;if(x){const b=st(()=>{if(p(),!v.current){const w=v$(x,m);v.current=w,m()}},"handleScroll");return m(),x.addEventListener("scroll",b),()=>x.removeEventListener("scroll",b)}},[u.viewport,p,m]),l.jsx(We.div,{"data-state":d.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:ka(t.onPointerDownCapture,x=>{const w=x.target.getBoundingClientRect(),C=x.clientX-w.left,E=x.clientY-w.top;d.onThumbPointerDown({x:C,y:E})}),onPointerUp:ka(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),gA="ScrollAreaCorner",p$=g.forwardRef(st(function(t,r){const i=an(gA,t.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?l.jsx(g$,{...t,ref:r}):null},"ScrollAreaCorner")),g$=g.forwardRef(st(function(t,r){const{__scopeScrollArea:i,...s}=t,o=an(gA,i),[u,d]=g.useState(0),[m,h]=g.useState(0),v=!!(u&&m),{onCornerWidthChange:p,onCornerHeightChange:x}=o;return No(o.scrollbarX,()=>{var w;const b=((w=o.scrollbarX)==null?void 0:w.offsetHeight)||0;o.onCornerHeightChange(b),h(b)}),No(o.scrollbarY,()=>{var w;const b=((w=o.scrollbarY)==null?void 0:w.offsetWidth)||0;o.onCornerWidthChange(b),d(b)}),g.useEffect(()=>()=>{p(0),x(0)},[p,x]),v?l.jsx(We.div,{...s,ref:r,style:{width:u,height:m,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Uu(e){return e?parseInt(e,10):0}st(Uu,"toInt");function ly(e,t){const r=e/t;return isNaN(r)?0:r}st(ly,"getThumbRatio");function ld(e){const t=ly(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=(e.scrollbar.size-r)*t;return Math.max(i,18)}st(ld,"getThumbSize");function vA(e,t,r,i="ltr"){const s=ld(r),o=s/2,u=t||o,d=s-u,m=r.scrollbar.paddingStart+u,h=r.scrollbar.size-r.scrollbar.paddingEnd-d,v=r.content-r.viewport,p=i==="ltr"?[0,v]:[v*-1,0];return cy([m,h],p)(e)}st(vA,"getScrollPositionFromPointer");function e0(e,t,r="ltr"){const i=ld(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,u=t.content-t.viewport,d=o-i,m=r==="ltr"?[0,u]:[u*-1,0],h=Z_(e,m);return cy([0,u],[0,d])(h)}st(e0,"getThumbOffsetFromScroll");function cy(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])}}st(cy,"linearScale");function uy(e,t){return e>0&&e<t}st(uy,"isScrollingWithinScrollbarBounds");var v$=st((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},i=0;return st((function s(){const o={left:e.scrollLeft,top:e.scrollTop},u=r.left!==o.left,d=r.top!==o.top;(u||d)&&t(),r=o,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function cd(e,t){const r=vr(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])}st(cd,"useDebounceCallback");function No(e,t){const r=vr(t);Zt(()=>{let i=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(i),s.unobserve(e)}}},[e,r])}st(No,"useResizeObserver");var _A=n$,_$=a$,x$=p$;const bn=g.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:i,viewportProps:s,scrollbars:o="vertical",type:u="auto",...d},m)=>l.jsxs(_A,{ref:m,"data-slot":"scroll-area",type:u,className:ct("relative overflow-hidden",e),...d,children:[l.jsx(_$,{ref:i,"data-slot":"scroll-area-viewport",className:ct("size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45",o==="vertical"&&"[&>div]:!block [&>div]:min-w-0 [&>div]:w-full",r),...s,children:t}),o!=="horizontal"&&l.jsx(t0,{orientation:"vertical"}),o!=="vertical"&&l.jsx(t0,{orientation:"horizontal"}),l.jsx(x$,{"data-slot":"scroll-area-corner"})]}));bn.displayName=_A.displayName;const t0=g.forwardRef(({className:e,orientation:t="vertical",style:r,...i},s)=>l.jsx(hA,{ref:s,"data-slot":"scroll-area-scrollbar",orientation:t,className:ct("group flex touch-none select-none p-px transition-colors",t==="vertical"&&"h-full w-2",t==="horizontal"&&"h-2 flex-col",e),style:{...t==="vertical"?{right:2}:{bottom:2},...r},...i,children:l.jsx(f$,{"data-slot":"scroll-area-thumb",className:ct("relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]",t==="vertical"?"min-h-8 w-full":"h-full min-w-8")})}));t0.displayName=hA.displayName;function y$(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),b$="VisuallyHidden",w$=g.forwardRef((e,t)=>l.jsx(We.span,{...e,ref:t,style:{...xA,...e.style}}));w$.displayName=b$;var S$=[" ","Enter","ArrowUp","ArrowDown"],C$=[" ","Enter"],Ao="Select",[Cm,Em,E$]=Wx(Ao),[zo]=Cn(Ao,[E$,vm]),Rm=vm(),[R$,Fa]=zo(Ao),[k$,N$]=zo(Ao),A$="SelectProvider";function yA(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:s,onOpenChange:o,value:u,defaultValue:d,onValueChange:m,dir:h,name:v,autoComplete:p,disabled:x,required:b,form:w,internal_do_not_use_render:C}=e,E=Rm(t),[S,N]=g.useState(null),[k,R]=g.useState(null),[M,L]=g.useState(!1),$=id(h),[D,q]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:Ao}),[G,W]=Eo({prop:u,defaultProp:d,onChange:m,caller:Ao}),B=g.useRef(null),j=g.useRef(G);g.useEffect(()=>{const Y=w?S==null?void 0:S.ownerDocument.getElementById(w):S==null?void 0:S.form;if(Y instanceof HTMLFormElement){const K=()=>W(j.current);return Y.addEventListener("reset",K),()=>Y.removeEventListener("reset",K)}},[w,S,W]);const O=S?!!w||!!S.closest("form"):!0,[z,T]=g.useState(new Set),U=_n(),H=Array.from(z).map(Y=>Y.props.value).join(";"),F=g.useCallback(Y=>{T(K=>new Set(K).add(Y))},[]),V=g.useCallback(Y=>{T(K=>{const ee=new Set(K);return ee.delete(Y),ee})},[]),I={required:b,trigger:S,onTriggerChange:N,valueNode:k,onValueNodeChange:R,valueNodeHasChildren:M,onValueNodeHasChildrenChange:L,contentId:U,value:G,onValueChange:W,open:D,onOpenChange:q,dir:$,triggerPointerDownPosRef:B,disabled:x,name:v,autoComplete:p,form:w,nativeOptions:z,nativeSelectKey:H,isFormControl:O};return l.jsx(uN,{...E,children:l.jsx(R$,{scope:t,...I,children:l.jsx(Cm.Provider,{scope:t,children:l.jsx(k$,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:V,children:F$(C)?C(I):r})})})})}yA.displayName=A$;var bA=e=>{const{__scopeSelect:t,children:r,...i}=e;return l.jsx(yA,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:s})=>l.jsxs(l.Fragment,{children:[r,s?l.jsx(UA,{__scopeSelect:t}):null]})})};bA.displayName=Ao;var wA="SelectTrigger",dy=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,o=Rm(r),u=Fa(wA,r),d=u.disabled||i,m=rt(t,u.onTriggerChange),h=Em(r),v=g.useRef("touch"),[p,x,b]=HA(C=>{const E=h().filter(k=>!k.disabled),S=E.find(k=>k.value===u.value),N=FA(E,C,S);N!==void 0&&u.onValueChange(N.value)}),w=C=>{d||(u.onOpenChange(!0),b()),C&&(u.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return l.jsx(dN,{asChild:!0,...o,children:l.jsx(We.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":km(u.value)?"":void 0,...s,ref:m,onClick:Be(s.onClick,C=>{C.currentTarget.focus(),v.current!=="mouse"&&w(C)}),onPointerDown:Be(s.onPointerDown,C=>{v.current=C.pointerType;const E=C.target;E.hasPointerCapture(C.pointerId)&&E.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(w(C),C.preventDefault())}),onKeyDown:Be(s.onKeyDown,C=>{const E=p.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&x(C.key),!(E&&C.key===" ")&&S$.includes(C.key)&&(w(),C.preventDefault())})})})});dy.displayName=wA;var SA="SelectValue",hy=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,children:o,placeholder:u="",...d}=e,m=Fa(SA,r),{onValueNodeHasChildrenChange:h}=m,v=o!==void 0,p=rt(t,m.onValueNodeChange);Zt(()=>{h(v)},[h,v]);const x=km(m.value);return l.jsx(We.span,{...d,asChild:x?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:l.jsx(g.Fragment,{children:x?u:o},x?"placeholder":"value")})});hy.displayName=SA;var T$="SelectIcon",CA=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...s}=e;return l.jsx(We.span,{"aria-hidden":!0,...s,ref:t,children:i||"▼"})});CA.displayName=T$;var EA="SelectPortal",[M$,j$]=zo(EA,{forceMount:void 0}),RA=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return l.jsx(M$,{scope:e.__scopeSelect,forceMount:r,children:l.jsx(im,{asChild:!0,...i})})};RA.displayName=EA;var Da="SelectContent",fy=g.forwardRef((e,t)=>{const r=j$(Da,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=Fa(Da,e.__scopeSelect),[u,d]=g.useState();return Zt(()=>{d(new DocumentFragment)},[]),l.jsx(En,{present:i||o.open,children:({present:m})=>m?l.jsx(AA,{...s,ref:t}):l.jsx(kA,{...s,fragment:u})})});fy.displayName=Da;var kA=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?za.createPortal(l.jsx(NA,{scope:r,children:l.jsx(Cm.Slot,{scope:r,children:l.jsx("div",{ref:t,children:i})})}),s):null});kA.displayName="SelectContentFragment";var pn=10,[NA,Wa]=zo(Da),D$="SelectContentImpl",L$=Ro("SelectContent.RemoveScroll"),AA=g.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:u,side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E,...S}=e,N=Fa(Da,r),[k,R]=g.useState(null),[M,L]=g.useState(null),$=rt(t,R),[D,q]=g.useState(null),[G,W]=g.useState(null),B=Em(r),[j,O]=g.useState(!1),z=g.useRef(!1);g.useEffect(()=>{if(k)return Bx(k)},[k]),Ox();const T=g.useCallback(Z=>{const[le,...ie]=B().map(Ce=>Ce.ref.current),[Se]=ie.slice(-1),be=document.activeElement;for(const Ce of Z)if(Ce===be||(Ce==null||Ce.scrollIntoView({block:"nearest"}),Ce===le&&M&&(M.scrollTop=0),Ce===Se&&M&&(M.scrollTop=M.scrollHeight),Ce==null||Ce.focus(),document.activeElement!==be))return},[B,M]),U=g.useCallback(()=>T([D,k]),[T,D,k]);g.useEffect(()=>{j&&U()},[j,U]);const{onOpenChange:H,triggerPointerDownPosRef:F}=N;g.useEffect(()=>{if(k){let Z={x:0,y:0};const le=Se=>{var be,Ce;Z={x:Math.abs(Math.round(Se.pageX)-(((be=F.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(Se.pageY)-(((Ce=F.current)==null?void 0:Ce.y)??0))}},ie=Se=>{Z.x<=10&&Z.y<=10?Se.preventDefault():Se.composedPath().includes(k)||H(!1),document.removeEventListener("pointermove",le),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",ie,{capture:!0})}}},[k,H,F]),g.useEffect(()=>{const Z=()=>H(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[H]);const[V,I]=HA(Z=>{const le=B().filter(be=>!be.disabled),ie=le.find(be=>be.ref.current===document.activeElement),Se=FA(le,Z,ie);Se&&setTimeout(()=>{var be;return(be=Se.ref.current)==null?void 0:be.focus()})}),Y=g.useCallback((Z,le,ie)=>{const Se=!z.current&&!ie;(N.value!==void 0&&N.value===le||Se)&&(q(Z),Se&&(z.current=!0))},[N.value]),K=g.useCallback(()=>k==null?void 0:k.focus(),[k]),ee=g.useCallback((Z,le,ie)=>{const Se=!z.current&&!ie;(N.value!==void 0&&N.value===le||Se)&&W(Z)},[N.value]),oe=i==="popper"?r0:TA,ce=oe===r0?{side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:p,collisionBoundary:x,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E}:{};return l.jsx(NA,{scope:r,content:k,viewport:M,onViewportChange:L,itemRefCallback:Y,selectedItem:D,onItemLeave:K,itemTextRefCallback:ee,focusSelectedItem:U,selectedItemText:G,position:i,isPositioned:j,searchRef:V,children:l.jsx(sm,{as:L$,allowPinchZoom:!0,children:l.jsx(rm,{asChild:!0,trapped:N.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Be(s,Z=>{var le;(le=N.trigger)==null||le.focus({preventScroll:!0}),Z.preventDefault()}),children:l.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Z=>Z.preventDefault(),...S,...ce,onPlaced:()=>O(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,Z=>{const le=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!le&&Z.key.length===1&&I(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let Se=B().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(Se=Se.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const be=Z.target,Ce=Se.indexOf(be);Se=Se.slice(Ce+1)}setTimeout(()=>T(Se)),Z.preventDefault()}})})})})})})});AA.displayName=D$;var O$="SelectItemAlignedPosition",TA=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,o=Fa(Da,r),u=Wa(Da,r),[d,m]=g.useState(null),[h,v]=g.useState(null),p=rt(t,v),x=Em(r),b=g.useRef(!1),w=g.useRef(!0),{viewport:C,selectedItem:E,selectedItemText:S,focusSelectedItem:N}=u,k=g.useCallback(()=>{if(o.trigger&&o.valueNode&&d&&h&&C&&E&&S){const $=o.trigger.getBoundingClientRect(),D=h.getBoundingClientRect(),q=o.valueNode.getBoundingClientRect(),G=S.getBoundingClientRect();if(o.dir!=="rtl"){const be=G.left-D.left,Ce=q.left-be,Q=$.left-Ce,re=$.width+Q,ye=Math.max(re,D.width),me=window.innerWidth-pn,Ae=Z_(Ce,[pn,Math.max(pn,me-ye)]);d.style.minWidth=re+"px",d.style.left=Ae+"px"}else{const be=D.right-G.right,Ce=window.innerWidth-q.right-be,Q=window.innerWidth-$.right-Ce,re=$.width+Q,ye=Math.max(re,D.width),me=window.innerWidth-pn,Ae=Z_(Ce,[pn,Math.max(pn,me-ye)]);d.style.minWidth=re+"px",d.style.right=Ae+"px"}const W=x(),B=window.innerHeight-pn*2,j=C.scrollHeight,O=window.getComputedStyle(h),z=parseInt(O.borderTopWidth,10),T=parseInt(O.paddingTop,10),U=parseInt(O.borderBottomWidth,10),H=parseInt(O.paddingBottom,10),F=z+T+j+H+U,V=Math.min(E.offsetHeight*5,F),I=window.getComputedStyle(C),Y=parseInt(I.paddingTop,10),K=parseInt(I.paddingBottom,10),ee=$.top+$.height/2-pn,oe=B-ee,ce=E.offsetHeight/2,Z=E.offsetTop+ce,le=z+T+Z,ie=F-le;if(le<=ee){const be=W.length>0&&E===W[W.length-1].ref.current;d.style.bottom="0px";const Ce=h.clientHeight-C.offsetTop-C.offsetHeight,Q=Math.max(oe,ce+(be?K:0)+Ce+U),re=le+Q;d.style.height=re+"px"}else{const be=W.length>0&&E===W[0].ref.current;d.style.top="0px";const Q=Math.max(ee,z+C.offsetTop+(be?Y:0)+ce)+ie;d.style.height=Q+"px",C.scrollTop=le-ee+C.offsetTop}d.style.margin=`${pn}px 0`,d.style.minHeight=V+"px",d.style.maxHeight=B+"px",i==null||i(),requestAnimationFrame(()=>b.current=!0)}},[x,o.trigger,o.valueNode,d,h,C,E,S,o.dir,i]);Zt(()=>k(),[k]);const[R,M]=g.useState();Zt(()=>{h&&M(window.getComputedStyle(h).zIndex)},[h]);const L=g.useCallback($=>{$&&w.current===!0&&(k(),N==null||N(),w.current=!1)},[k,N]);return l.jsx(P$,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:b,onScrollButtonChange:L,children:l.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:l.jsx(We.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});TA.displayName=O$;var B$="SelectPopperPosition",r0=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=pn,...o}=e,u=Rm(r);return l.jsx(hN,{...u,...o,ref:t,align:i,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});r0.displayName=B$;var[P$,my]=zo(Da,{}),i0="SelectViewport",MA=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...s}=e,o=Wa(i0,r),u=my(i0,r),d=rt(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(Cm.Slot,{scope:r,children:l.jsx(We.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Be(s.onScroll,h=>{const v=h.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&p){const b=Math.abs(m.current-v.scrollTop);if(b>0){const w=window.innerHeight-pn*2,C=parseFloat(p.style.minHeight),E=parseFloat(p.style.height),S=Math.max(C,E);if(S<w){const N=S+b,k=Math.min(w,N),R=N-k;p.style.height=k+"px",p.style.bottom==="0px"&&(v.scrollTop=R>0?R:0,p.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});MA.displayName=i0;var jA="SelectGroup",[I$,z$]=zo(jA),py=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=_n();return l.jsx(I$,{scope:r,id:s,children:l.jsx(We.div,{role:"group","aria-labelledby":s,...i,ref:t})})});py.displayName=jA;var DA="SelectLabel",gy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=z$(DA,r);return l.jsx(We.div,{id:s.id,...i,ref:t})});gy.displayName=DA;var If="SelectItem",[$$,LA]=zo(If),vy=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...u}=e,d=Fa(If,r),m=Wa(If,r),h=d.value===i,[v,p]=g.useState(o??""),[x,b]=g.useState(!1),w=vr(k=>{var R;return(R=m.itemRefCallback)==null?void 0:R.call(m,k,i,s)}),C=rt(t,w),E=_n(),S=g.useRef("touch"),N=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return l.jsx($$,{scope:r,value:i,disabled:s,textId:E,isSelected:h,onItemTextChange:g.useCallback(k=>{p(R=>R||((k==null?void 0:k.textContent)??"").trim())},[]),children:l.jsx(Cm.ItemSlot,{scope:r,value:i,disabled:s,textValue:v,children:l.jsx(We.div,{role:"option","aria-labelledby":E,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:C,onFocus:Be(u.onFocus,()=>b(!0)),onBlur:Be(u.onBlur,()=>b(!1)),onClick:Be(u.onClick,()=>{S.current!=="mouse"&&N()}),onPointerUp:Be(u.onPointerUp,()=>{S.current==="mouse"&&N()}),onPointerDown:Be(u.onPointerDown,k=>{S.current=k.pointerType}),onPointerMove:Be(u.onPointerMove,k=>{var R;S.current=k.pointerType,s?(R=m.onItemLeave)==null||R.call(m):S.current==="mouse"&&k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(u.onPointerLeave,k=>{var R;k.currentTarget===document.activeElement&&((R=m.onItemLeave)==null||R.call(m))}),onKeyDown:Be(u.onKeyDown,k=>{var M;s||k.target!==k.currentTarget||((M=m.searchRef)==null?void 0:M.current)!==""&&k.key===" "||(C$.includes(k.key)&&N(),k.key===" "&&k.preventDefault())})})})})});vy.displayName=If;var wu="SelectItemText",OA=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,...o}=e,u=Fa(wu,r),d=Wa(wu,r),m=LA(wu,r),h=N$(wu,r),[v,p]=g.useState(null),x=vr(N=>{var k;return(k=d.itemTextRefCallback)==null?void 0:k.call(d,N,m.value,m.disabled)}),b=rt(t,p,m.onItemTextChange,x),w=v==null?void 0:v.textContent,C=g.useMemo(()=>l.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:S}=h;return Zt(()=>(E(C),()=>S(C)),[E,S,C]),l.jsxs(l.Fragment,{children:[l.jsx(We.span,{id:m.textId,...o,ref:b}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!km(u.value)?za.createPortal(o.children,u.valueNode):null]})});OA.displayName=wu;var BA="SelectItemIndicator",PA=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return LA(BA,r).isSelected?l.jsx(We.span,{"aria-hidden":!0,...i,ref:t}):null});PA.displayName=BA;var n0="SelectScrollUpButton",_y=g.forwardRef((e,t)=>{const r=Wa(n0,e.__scopeSelect),i=my(n0,e.__scopeSelect),[s,o]=g.useState(!1),u=rt(t,i.onScrollButtonChange);return Zt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollTop>0;o(h)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(IA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});_y.displayName=n0;var s0="SelectScrollDownButton",xy=g.forwardRef((e,t)=>{const r=Wa(s0,e.__scopeSelect),i=my(s0,e.__scopeSelect),[s,o]=g.useState(!1),u=rt(t,i.onScrollButtonChange);return Zt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<h;o(v)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(IA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});xy.displayName=s0;var IA=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,o=Wa("SelectScrollButton",r),u=g.useRef(null),d=Em(r),m=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>m(),[m]),Zt(()=>{var v;const h=d().find(p=>p.ref.current===document.activeElement);(v=h==null?void 0:h.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),l.jsx(We.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Be(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Be(s.onPointerMove,()=>{var h;(h=o.onItemLeave)==null||h.call(o),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Be(s.onPointerLeave,()=>{m()})})}),U$="SelectSeparator",yy=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return l.jsx(We.div,{"aria-hidden":!0,...i,ref:t})});yy.displayName=U$;var zA="SelectArrow",H$=g.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=Rm(r);return Wa(zA,r).position==="popper"?l.jsx(fN,{...s,...i,ref:t}):null});H$.displayName=zA;var $A="SelectBubbleInput",UA=g.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Fa($A,e),{value:s,onValueChange:o,required:u,disabled:d,name:m,autoComplete:h,form:v}=i,{nativeOptions:p,nativeSelectKey:x}=i,b=g.useRef(null),w=rt(r,b),C=s??"",E=y$(C),S=Array.from(p).some(N=>(N.props.value??"")==="");return g.useEffect(()=>{const N=b.current;if(!N)return;const k=window.HTMLSelectElement.prototype,M=Object.getOwnPropertyDescriptor(k,"value").set;if(E!==C&&M){const L=new Event("change",{bubbles:!0});M.call(N,C),N.dispatchEvent(L)}},[E,C]),l.jsxs(We.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:h,disabled:d,form:v,onChange:N=>o(N.target.value),...t,style:{...xA,...t.style},ref:w,defaultValue:C,children:[km(s)&&!S?l.jsx("option",{value:""}):null,Array.from(p)]},x)});UA.displayName=$A;function F$(e){return typeof e=="function"}function km(e){return e===""||e===void 0}function HA(e){const t=vr(e),r=g.useRef(""),i=g.useRef(0),s=g.useCallback(u=>{const d=r.current+u;t(d),(function m(h){r.current=h,window.clearTimeout(i.current),h!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),o=g.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,o]}function FA(e,t,r){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let u=W$(e,Math.max(o,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function W$(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function Nm(e){return l.jsx(bA,{"data-slot":"select",...e})}const a0=g.forwardRef(({className:e,...t},r)=>l.jsx(py,{ref:r,"data-slot":"select-group",className:ct("scroll-my-1 p-1",e),...t}));a0.displayName=py.displayName;const ud=g.forwardRef((e,t)=>l.jsx(hy,{ref:t,"data-slot":"select-value",...e}));ud.displayName=hy.displayName;const dd=g.forwardRef(({className:e,size:t="default",children:r,...i},s)=>l.jsxs(dy,{ref:s,"data-slot":"select-trigger","data-size":t,className:ct("flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[r,l.jsx(CA,{asChild:!0,children:l.jsx(Nx,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));dd.displayName=dy.displayName;const WA=g.forwardRef(({className:e,...t},r)=>l.jsx(_y,{ref:r,"data-slot":"select-scroll-up-button",className:ct("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Z4,{"aria-hidden":"true"})}));WA.displayName=_y.displayName;const qA=g.forwardRef(({className:e,...t},r)=>l.jsx(xy,{ref:r,"data-slot":"select-scroll-down-button",className:ct("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:l.jsx(Nx,{"aria-hidden":"true"})}));qA.displayName=xy.displayName;const hd=g.forwardRef(({className:e,children:t,position:r="popper",align:i="center",sideOffset:s=4,collisionPadding:o=8,...u},d)=>l.jsx(RA,{children:l.jsxs(fy,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:i,sideOffset:s,collisionPadding:o,className:ct("cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...u,children:[l.jsx(WA,{}),l.jsx(MA,{"data-position":r,className:ct("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(qA,{})]})}));hd.displayName=fy.displayName;const o0=g.forwardRef(({className:e,...t},r)=>l.jsx(gy,{ref:r,"data-slot":"select-label",className:ct("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));o0.displayName=gy.displayName;const Zn=g.forwardRef(({className:e,children:t,...r},i)=>l.jsxs(vy,{ref:i,"data-slot":"select-item",className:ct("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[l.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:l.jsx(PA,{children:l.jsx(Pa,{"aria-hidden":"true",className:"pointer-events-none"})})}),l.jsx(OA,{children:t})]}));Zn.displayName=vy.displayName;const by=g.forwardRef(({className:e,...t},r)=>l.jsx(yy,{ref:r,"data-slot":"select-separator",className:ct("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));by.displayName=yy.displayName;var q$=Object.defineProperty,nc=(e,t)=>q$(e,"name",{value:t,configurable:!0}),VA=!!(typeof window<"u"&&window.document&&window.document.createElement);function wy(e,t,{checkForDefaultPrevented:r=!0}={}){return nc(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}nc(wy,"composeEventHandlers");function V$(e){var t;if(!VA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}nc(V$,"getOwnerWindow");function l0(e){if(!VA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}nc(l0,"getOwnerDocument");function GA(e,t=!1){const{activeElement:r}=l0(e);if(!(r!=null&&r.nodeName))return null;if(YA(r)&&r.contentDocument)return GA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=l0(r).getElementById(i);if(s)return s}}return r}nc(GA,"getActiveElement");function YA(e){return e.tagName==="IFRAME"}nc(YA,"isFrame");var G$=Object.defineProperty,Sy=(e,t)=>G$(e,"name",{value:t,configurable:!0});function c0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Sy(c0,"setRef");function KA(...e){return t=>{let r=!1;const i=e.map(s=>{const o=c0(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():c0(e[s],null)}}}}Sy(KA,"composeRefs");function Am(...e){return g.useCallback(KA(...e),e)}Sy(Am,"useComposedRefs");var Y$=Object.defineProperty,Xi=(e,t)=>Y$(e,"name",{value:t,configurable:!0});function K$(e,t){const r=g.createContext(t);r.displayName=e+"Context";const i=Xi(o=>{const{children:u,...d}=o,m=g.useMemo(()=>d,Object.values(d));return l.jsx(r.Provider,{value:m,children:u})},"Provider");i.displayName=e+"Provider";function s(o,u={}){const{optional:d=!1}=u,m=g.useContext(r);if(m)return m;if(t!==void 0)return t;if(!d)throw new Error(`\`${o}\` must be used within \`${e}\``)}return Xi(s,"useContext"),[i,s]}Xi(K$,"createContext");function XA(e,t=[]){let r=[];function i(o,u){const d=g.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=Xi(p=>{var S;const{scope:x,children:b,...w}=p,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})},"Provider");h.displayName=o+"Provider";function v(p,x,b={}){var S;const{optional:w=!1}=b,C=((S=x==null?void 0:x[e])==null?void 0:S[m])||d,E=g.useContext(C);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return Xi(v,"useContext"),[h,v]}Xi(i,"createContext");const s=Xi(()=>{const o=r.map(u=>g.createContext(u));return Xi(function(d){const m=(d==null?void 0:d[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return s.scopeName=e,[i,ZA(s,...t)]}Xi(XA,"createContextScope");function ZA(...e){const t=e[0];if(e.length===1)return t;const r=Xi(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Xi(function(o){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}Xi(ZA,"composeContextScopes");var Cy=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},X$=Object.defineProperty,Z$=(e,t)=>X$(e,"name",{value:t,configurable:!0}),VC=Oa[" useEffectEvent ".trim().toString()],GC=Oa[" useInsertionEffect ".trim().toString()];function QA(e){if(typeof VC=="function")return VC(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof GC=="function"?GC(()=>{t.current=e}):Cy(()=>{t.current=e}),g.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}Z$(QA,"useEffectEvent");var Q$=Object.defineProperty,fd=(e,t)=>Q$(e,"name",{value:t,configurable:!0}),J$=Oa[" useInsertionEffect ".trim().toString()]||Cy;function JA({prop:e,defaultProp:t,onChange:r=fd(()=>{},"onChange"),caller:i}){const[s,o,u]=eT({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s,h=g.useCallback(v=>{var p;if(d){const x=tT(v)?v(e):v;x!==e&&((p=u.current)==null||p.call(u,x))}else o(v)},[d,e,o,u]);return[m,h]}fd(JA,"useControllableState");function eT({defaultProp:e,onChange:t}){const[r,i]=g.useState(e),s=g.useRef(r),o=g.useRef(t);return J$(()=>{o.current=t},[t]),g.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}fd(eT,"useUncontrolledState");function tT(e){return typeof e=="function"}fd(tT,"isFunction");var YC=Symbol("RADIX:SYNC_STATE");function e9(e,t,r,i){const{prop:s,defaultProp:o,onChange:u,caller:d}=t,m=s!==void 0,h=QA(u),v=[{...r,state:o}];i&&v.push(i);const[p,x]=g.useReducer((E,S)=>{if(S.type===YC)return{...E,state:S.state};const N=e(E,S);return m&&!Object.is(N.state,E.state)&&h(N.state),N},...v),b=p.state,w=g.useRef(b);g.useEffect(()=>{w.current!==b&&(w.current=b,m||h(b))},[b,w,m]);const C=g.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return g.useEffect(()=>{m&&!Object.is(s,p.state)&&x({type:YC,state:s})},[s,p.state,m]),[C,x]}fd(e9,"useControllableStateReducer");var t9=Object.defineProperty,r9=(e,t)=>t9(e,"name",{value:t,configurable:!0});function rT(e){const[t,r]=g.useState(void 0);return Cy(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}r9(rT,"useSize");var i9=Object.defineProperty,on=(e,t)=>i9(e,"name",{value:t,configurable:!0}),n9=on(((e,t)=>{const r={...t};for(const i in t){const s=e[i],o=t[i];if(/^on[A-Z]/.test(i))if(s&&o){const d=typeof s=="function",m=typeof o=="function";r[i]=(...h)=>{const v=m?o(...h):void 0;return d&&s(...h),v}}else s&&(r[i]=s);else i==="style"?r[i]={...typeof s=="object"?s:null,...typeof o=="object"?o:null}:i==="className"?r[i]=[s,o].filter(Boolean).join(" "):i==="aria-describedby"&&(r[i]=iT(o,s))}return{...e,...r}}),"mergeProps");function iT(...e){const t=new Set;for(const r of e)if(typeof r=="string")for(const i of String(r).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}on(iT,"concatAriaDescribedby");var nT=g.createContext(n9);nT.displayName="SlotContext";function sT(e){const t=g.forwardRef((r,i)=>{const s=g.useContext(nT);let{children:o,mergeProps:u=s,...d}=r,m=null,h=!1;const v=[];u0(o)&&typeof Uh=="function"&&(o=Uh(o._payload)),g.Children.forEach(o,w=>{var C;if(lT(w)){h=!0;const E=w;let S="child"in E.props?E.props.child:E.props.children;u0(S)&&typeof Uh=="function"&&(S=Uh(S._payload)),m=a9(E,S),v.push((C=m==null?void 0:m.props)==null?void 0:C.children)}else v.push(w)}),m?m=g.cloneElement(m,void 0,v):!h&&g.Children.count(o)===1&&g.isValidElement(o)&&(m=o);const p=m?oT(m):void 0,x=Am(i,p);if(!m){if(o||o===0)throw new Error(h?c9(e):l9(e));return o}const b=u(d,m.props??{});return m.type!==g.Fragment&&(b.ref=i?x:p),g.cloneElement(m,b)});return t.displayName=`${e}.Slot`,t}on(sT,"createSlot");var aT=Symbol.for("radix.slottable");function s9(e){const t=on(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=aT,t}on(s9,"createSlottable");var a9=on((e,t)=>{if("child"in e.props){const r=e.props.child;return g.isValidElement(r)?g.cloneElement(r,void 0,e.props.children(r.props.children)):null}return g.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function oT(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}on(oT,"getElementRef");function lT(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===aT}on(lT,"isSlottable");var o9=Symbol.for("react.lazy");function u0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===o9&&"_payload"in e&&cT(e._payload)}on(u0,"isLazyComponent");function cT(e){return typeof e=="object"&&e!==null&&"then"in e}on(cT,"isPromiseLike");var l9=on(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),c9=on(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Uh=Oa[" use ".trim().toString()],u9=Object.defineProperty,d9=(e,t)=>u9(e,"name",{value:t,configurable:!0}),h9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ey=h9.reduce((e,t)=>{const r=sT(`Primitive.${t}`),i=g.forwardRef((s,o)=>{const{asChild:u,...d}=s,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...d,ref:o})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function f9(e,t){e&&za.flushSync(()=>e.dispatchEvent(t))}d9(f9,"dispatchDiscreteCustomEvent");var m9=Object.defineProperty,La=(e,t)=>m9(e,"name",{value:t,configurable:!0}),Ry="Switch",[p9,EZ]=XA(Ry),[g9,ky]=p9(Ry);function uT(e){const{__scopeSwitch:t,checked:r,children:i,defaultChecked:s,disabled:o,form:u,name:d,onCheckedChange:m,required:h,value:v="on",internal_do_not_use_render:p}=e,[x,b]=JA({prop:r,defaultProp:s??!1,onChange:m,caller:Ry}),[w,C]=g.useState(null),[E,S]=g.useState(null),N=g.useRef(!1),[k,R]=g.useReducer($=>$+1,0),M=w?!!u||!!w.closest("form"):!0,L={checked:x,setChecked:b,disabled:o,control:w,setControl:C,name:d,form:u,value:v,hasConsumerStoppedPropagationRef:N,userInteractionCount:k,onUserInteraction:R,required:h,defaultChecked:s,isFormControl:M,bubbleInput:E,setBubbleInput:S};return l.jsx(g9,{scope:t,...L,children:hT(p)?p(L):i})}La(uT,"SwitchProvider");var v9="SwitchTrigger",_9=g.forwardRef(La(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,form:u,value:d,disabled:m,checked:h,required:v,setControl:p,setChecked:x,hasConsumerStoppedPropagationRef:b,onUserInteraction:w,isFormControl:C,bubbleInput:E}=ky(v9,t),S=Am(s,p),N=g.useRef(h);return g.useEffect(()=>{const k=u?o==null?void 0:o.ownerDocument.getElementById(u):o==null?void 0:o.form;if(k instanceof HTMLFormElement){const R=La(()=>x(N.current),"reset");return k.addEventListener("reset",R),()=>k.removeEventListener("reset",R)}},[o,u,x]),l.jsx(Ey.button,{type:"button",role:"switch","aria-checked":h,"aria-required":v,"data-state":Ny(h),"data-disabled":m?"":void 0,disabled:m,value:d,...i,ref:S,onClick:wy(r,k=>{w(),x(R=>!R),E&&C&&(b.current=k.isPropagationStopped(),b.current||k.stopPropagation())})})},"SwitchTrigger")),dT=g.forwardRef(La(function(t,r){const{__scopeSwitch:i,name:s,checked:o,defaultChecked:u,required:d,disabled:m,value:h,onCheckedChange:v,form:p,...x}=t;return l.jsx(uT,{__scopeSwitch:i,checked:o,defaultChecked:u,disabled:m,required:d,onCheckedChange:v,name:s,form:p,value:h,internal_do_not_use_render:({isFormControl:b})=>l.jsxs(l.Fragment,{children:[l.jsx(_9,{...x,ref:r,__scopeSwitch:i}),b&&l.jsx(w9,{__scopeSwitch:i})]})})},"Switch")),x9="SwitchThumb",y9=g.forwardRef(La(function(t,r){const{__scopeSwitch:i,...s}=t,o=ky(x9,i);return l.jsx(Ey.span,{"data-state":Ny(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})},"SwitchThumb")),b9="SwitchBubbleInput",w9=g.forwardRef(La(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:m,defaultChecked:h,required:v,disabled:p,name:x,value:b,form:w,bubbleInput:C,setBubbleInput:E}=ky(b9,t),S=Am(s,E),N=rT(o),k=g.useRef(!1),R=g.useRef(m),M=g.useRef(d);g.useEffect(()=>{const $=C;if(!$)return;const D=window.HTMLInputElement.prototype,G=Object.getOwnPropertyDescriptor(D,"checked").set,W=d!==M.current;M.current=d;const B=R.current!==m;R.current=m;const j=!(W&&u.current);if(B&&G){k.current=!W;const O=new Event("click",{bubbles:j});G.call($,m),$.dispatchEvent(O),k.current=!1}},[C,m,u,d]);const L=g.useRef(m);return l.jsx(Ey.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??L.current,required:v,disabled:p,name:x,value:b,form:w,...i,tabIndex:-1,ref:S,onClick:wy(r,$=>{k.current&&$.stopPropagation()}),style:{...i.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function hT(e){return typeof e=="function"}La(hT,"isFunction");function Ny(e){return e?"checked":"unchecked"}La(Ny,"getState");const fT=g.forwardRef(({className:e,size:t="default",...r},i)=>l.jsx(dT,{ref:i,"data-slot":"switch","data-size":t,className:ct("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80",e),...r,children:l.jsx(y9,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"})}));fT.displayName=dT.displayName;var Tm="Tabs",[S9]=Cn(Tm,[_m]),mT=_m(),[C9,Ay]=S9(Tm),pT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:s,defaultValue:o,orientation:u="horizontal",dir:d,activationMode:m="automatic",...h}=e,v=id(d),[p,x]=Eo({prop:i,onChange:s,defaultProp:o??"",caller:Tm});return l.jsx(C9,{scope:r,baseId:_n(),value:p,onValueChange:x,orientation:u,dir:v,activationMode:m,children:l.jsx(We.div,{dir:v,"data-orientation":u,...h,ref:t})})});pT.displayName=Tm;var gT="TabsList",vT=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:i=!0,...s}=e,o=Ay(gT,r),u=mT(r);return l.jsx(yN,{asChild:!0,...u,orientation:o.orientation,dir:o.dir,loop:i,children:l.jsx(We.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});vT.displayName=gT;var _T="TabsTrigger",xT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,disabled:s=!1,...o}=e,u=Ay(_T,r),d=mT(r),m=wT(u.baseId,i),h=ST(u.baseId,i),v=i===u.value;return l.jsx(bN,{asChild:!0,...d,focusable:!s,active:v,children:l.jsx(We.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":h,"data-state":v?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:m,...o,ref:t,onMouseDown:Be(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?u.onValueChange(i):p.preventDefault()}),onKeyDown:Be(e.onKeyDown,p=>{s||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&u.onValueChange(i)}),onFocus:Be(e.onFocus,()=>{const p=u.activationMode!=="manual";!v&&!s&&p&&u.onValueChange(i)})})})});xT.displayName=_T;var yT="TabsContent",bT=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,forceMount:s,children:o,...u}=e,d=Ay(yT,r),m=wT(d.baseId,i),h=ST(d.baseId,i),v=i===d.value,p=g.useRef(v);return g.useEffect(()=>{const x=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(x)},[]),l.jsx(En,{present:s||v,children:({present:x})=>l.jsx(We.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:h,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:x&&o})})});bT.displayName=yT;function wT(e,t){return`${e}-trigger-${t}`}function ST(e,t){return`${e}-content-${t}`}var E9=pT,R9=vT,k9=xT,N9=bT;const dt={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",runtimes:"/settings/runtimes",providers:"/settings/providers",agents:"/settings/agents",skills:"/settings/skills",channels:"/settings/channels",instances:"/settings/instances",localRuntime:"/settings/local-runtime",computerUse:"/settings/computer-use"},Hu="/settings",d0=dt.overview,A9="/runtimes/:runtimeSelector/sessions",T9="/runtimes/:runtimeSelector/sessions/:sessionId",Fu="!invalid-runtime-owner",M9=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,j9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",agents:"/agents",skills:"/skills",channels:"/channels",instances:"/instances"},D9={"/settings/updates":`${dt.overview}#software-update`,"/settings/daemon":`${dt.localRuntime}#runtime`,"/settings/command":`${dt.localRuntime}#terminal-command`,"/settings/computer":`${dt.computerUse}#permissions`,"/settings/inspection":`${dt.computerUse}#chrome-inspection`},CT=["localRuntime","computerUse"];function L9(e){return CT.includes(e)}function ET(e,t){return!L9(e)||t}function RT(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(h0(t)||t===dt.sessions||t.startsWith(`${dt.sessions}/`))return"sessions";const r=Object.entries(dt).find(([,i])=>i===t);return(r==null?void 0:r[0])??"sessions"}function O9(e,t=!0){const r=RT(e);return r==="sessions"||!ET(r,t)?null:r}function h0(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return NT(decodeURIComponent(t[1]))}catch{return Fu}}function kT(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?Fu:NT(t[0])}function NT(e){return M9.test(e)?e:Fu}function uf(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function xo(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function AT(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==Hu&&!r.startsWith(`${Hu}/`)?r:t}class yo extends Error{constructor(r,i,s,o){super(r);Wr(this,"status");Wr(this,"code");Wr(this,"outcome");this.name="ApiRequestError",this.status=i,this.code=s,this.outcome=o}}function Ty(e){return e instanceof yo&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const B9="/api/runtimes/capability",P9="x-rynx-runtime-capability";let Il;async function I9(e,t,r){const i=location.protocol==="https:"?"wss":"ws",s=await Wu(r.refreshCapability),o=new URLSearchParams({capability:s,role:r.role??"owner",cols:String(r.cols),rows:String(r.rows)});return`${i}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${o.toString()}`}function z9(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 $9(e,t,r,i){const s=i?`${Pr(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 Nt(s,o):await Ke(s,o)).disposition}async function Ke(e,t={}){return TT(e,{},t)}async function TT(e,t,r={}){const i=new Headers(r.headers);r.body&&!i.has("content-type")&&i.set("content-type","application/json");const s=await fetch(e,{...r,headers:i});if(!s.ok){let u=`${s.status}`,d,m;try{const h=await s.json();typeof h.error=="string"&&(d=h.error,u=h.error),(h.outcome==="not_started"||h.outcome==="unknown")&&(m=h.outcome)}catch{}throw new yo(u,s.status,d,m)}const o=await s.text();return o?JSON.parse(o):t}async function Wu(e=!1){return e&&(Il=void 0),Il||(Il=Ke(B9,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw Il=void 0,t})),Il}async function Nt(e,t){const r=async s=>{const o=new Headers(t.headers);return o.set(P9,s),Ke(e,{...t,headers:o})},i=await Wu();try{return await r(i)}catch(s){if(!(s instanceof Error)||s.message!=="invalid_runtime_capability")throw s;return Il=void 0,r(await Wu())}}async function xv(e,t={}){const r=new Headers(t.headers),i=await fetch(e,{...t,headers:r});if(!i.ok){let s=`${i.status}`;try{const o=await i.json();o.error&&(s=o.error)}catch{}throw new Error(s)}return i.blob()}async function KC(e,t,r,i){const s=new Headers({"content-type":"application/json"}),o=await fetch(e,{method:"POST",headers:s,body:t===void 0?void 0:JSON.stringify(t),signal:i});await MT(o,r)}async function U9(e,t,r){const i=await fetch(e,{signal:r});await MT(i,t)}async function MT(e,t){if(!e.ok||!e.body){let o=`${e.status}`;try{const u=await e.json();u.error&&(o=u.error)}catch{}throw new Error(o)}const r=e.body.getReader(),i=new TextDecoder;let s="";for(;;){const{done:o,value:u}=await r.read();if(o)break;s+=i.decode(u,{stream:!0});let d;for(;(d=s.indexOf(`
521
-
522
- `))!==-1;){const m=s.slice(0,d);s=s.slice(d+2);const h=H9(m);h&&t(h)}}}function H9(e){let t="message",r="";for(const s of e.split(`
523
- `))s.startsWith("event:")?t=s.slice(6).trim():s.startsWith("data:")&&(r+=s.slice(5).trim());if(!t&&!r)return null;let i={};try{r&&(i=JSON.parse(r))}catch{}return{event:t,data:i}}function f0(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function nu(e,t,r){const i=f0(e,t);return e?Nt(i,r):Ke(i,r)}function Pr(e,t,r){const i=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return i;const s=`${i}/${encodeURIComponent(t)}`;return r?`${s}/${r}`:s}function zl(e,t,...r){const i=`${Pr(e,t)}/browser`;return r.length===0?i:`${i}/${r.map(s=>encodeURIComponent(s)).join("/")}`}function ho(e,t,r){const i=`${Pr(e,t)}/emulator`;return r?`${i}/${r}`:i}function F9(e,t,r){const i=new URLSearchParams({bindingId:r});return`${Pr(e,t)}/emulator/frame?${i.toString()}`}function su(e,t,r,i,s){return Nt(zl(e,t,"pages",i,s),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function yv(e,t,r){return e?Pr(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const xe={meta:()=>Ke("/api/meta"),listRuntimeShareAddresses:()=>Ke("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>Nt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Ke("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>Nt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>Nt(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>Ke("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Ke(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>Nt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Ke(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>Nt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>Nt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>Nt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>TT(zl(e,t),null),openRuntimeBrowser:(e,t,r)=>Nt(zl(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>Nt(zl(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,i)=>Nt(zl(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...i===void 0?{}:{url:i}})}),closeRuntimeBrowserPage:(e,t,r,i)=>su(e,t,r,i,"close"),activateRuntimeBrowserPage:(e,t,r,i)=>su(e,t,r,i,"activate"),navigateRuntimeBrowserPage:(e,t,r,i,s)=>Nt(zl(e,t,"pages",i,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:s})}),backRuntimeBrowserPage:(e,t,r,i)=>su(e,t,r,i,"back"),forwardRuntimeBrowserPage:(e,t,r,i)=>su(e,t,r,i,"forward"),reloadRuntimeBrowserPage:(e,t,r,i)=>su(e,t,r,i,"reload"),getSessionEmulator:(e,t)=>Ke(ho(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Ke(ho(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>Nt(ho(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>Nt(ho(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,i,s)=>Nt(ho(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:i,y:s})}),gestureSessionEmulator:(e,t,r,i)=>Nt(ho(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:i})}),buttonSessionEmulator:(e,t,r,i)=>Nt(ho(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:i})}),sessionEmulatorFrameBlob:(e,t,r,i)=>xv(F9(e,t,r),{signal:i,cache:"no-store"}),channelTypes:()=>Ke("/api/channel-types").then(e=>e.channelTypes),listChannels:()=>Ke("/api/channels").then(e=>e.channels),createChannel:e=>Ke("/api/channels",{method:"POST",body:JSON.stringify(e)}),updateChannel:(e,t)=>Ke(`/api/channels/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteChannel:e=>Ke(`/api/channels/${encodeURIComponent(e)}`,{method:"DELETE"}),authorizeChannel:(e,t,r)=>KC(`/api/channels/${encodeURIComponent(e)}/authorize`,void 0,t,r),listInstances:()=>Ke("/api/instances").then(e=>e.instances),createInstance:e=>Ke("/api/instances",{method:"POST",body:JSON.stringify(e)}),updateInstance:(e,t)=>Ke(`/api/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),instanceAction:(e,t)=>Ke(`/api/instances/${encodeURIComponent(e)}/${t}`,{method:"POST"}),deleteInstance:e=>Ke(`/api/instances/${encodeURIComponent(e)}`,{method:"DELETE"}),emulatorDevices:e=>Ke(f0(e,"devices")).then(t=>t.devices),activeEmulator:e=>Ke(f0(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>nu(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,i)=>nu(i,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>nu(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>nu(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>nu(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>xv(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>Ke("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>xv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Ke("/api/agents").then(e=>e.agents),getAgent:e=>Ke(`/api/agents/${encodeURIComponent(e)}`),writeAgent:e=>Ke("/api/agents",{method:"POST",body:JSON.stringify(e)}),deleteAgent:e=>Ke(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listSkills:()=>Ke("/api/skills").then(e=>e.skills),getSkill:e=>Ke(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Ke(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Ke("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),deleteSkill:e=>Ke(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),listSessions:e=>Ke(e?Pr(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Ke(`${Pr(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Ke(`${Pr(e)}/launch-options`),createSession:(e,t)=>{const r=t?Pr(t):"/api/sessions",i={method:"POST",body:JSON.stringify(e)};return t?Nt(r,i):Ke(r,i)},sendSessionMessage:(e,t,r,i,s)=>s?Nt(Pr(s,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:i}).then(()=>{}):KC(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,i),getSessionResourcePolicy:(e,t)=>Ke(`${Pr(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,i,s)=>Nt(Pr(e,t,"resources"),{method:"POST",body:r,signal:s,headers:{"content-type":r.type,"x-rynx-upload-id":i,"x-rynx-filename":encodeURIComponent(r.name)}}).then(o=>o.resource),deleteSessionResource:(e,t,r)=>Nt(`${Pr(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>`${Pr(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`,enqueueSessionMessage:(e,t,r)=>Nt(Pr(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t,r)=>Nt(Pr(e,t,"terminal/start"),{method:"POST",body:"{}",signal:r}),streamSession:(e,t,r,i)=>U9(yv(i,e,"stream"),t,r),getSessionHistory:e=>Ke(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Ke(yv(r,e,"snapshot"),{signal:t}),closeSession:(e,t)=>{const r=t?Pr(t,e):`/api/sessions/${encodeURIComponent(e)}`,i={method:"DELETE"};return t?Nt(r,i):Ke(r,i)},interruptSession:(e,t)=>{const r=yv(t,e,"interrupt"),i={method:"POST"};return t?Nt(r,i):Ke(r,i)}},jT="rynx.control.runtime-target.v1",DT={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function W9(e){var t;if(!e)return"local";try{return((t=e.getItem(jT))==null?void 0:t.trim())||"local"}catch{return"local"}}function XC(e,t){if(e)try{e.setItem(jT,t)}catch{}}function q9(e){const t=new Map;for(const r of e)!r.selector||t.has(r.selector)||t.set(r.selector,r);return t.has("local")||t.set("local",DT),[...t.values()].sort((r,i)=>r.selector==="local"?-1:i.selector==="local"?1:r.displayName.localeCompare(i.displayName))}const LT=g.createContext(null);function V9({children:e}){const t=Hr(),r=Ba(),i=h0(t.pathname)??(t.pathname===dt.sessions?kT(t.search):null),[s,o]=g.useState(()=>W9(typeof window>"u"?void 0:window.localStorage)),u=i??s,[d,m]=g.useState([DT]),h=g.useCallback(b=>{m(q9(b))},[]),v=g.useCallback(async()=>{try{h(await xe.listRuntimes())}catch(b){_e.error(`Failed to load Runtimes: ${b.message}`)}},[h]);g.useEffect(()=>{v()},[v]),g.useEffect(()=>{!i||i===Fu||(o(i),XC(typeof window>"u"?void 0:window.localStorage,i))},[i]);const p=g.useCallback(b=>{const w=b.trim();if(!w)return;o(w),XC(typeof window>"u"?void 0:window.localStorage,w),(t.pathname===dt.sessions||t.pathname.startsWith(`${dt.sessions}/`)||h0(t.pathname)!==null)&&i!==w&&r(xo(w))},[t.pathname,r,i]),x=g.useMemo(()=>{const b=d.find(C=>C.selector===u)??(u===Fu?{selector:u,daemonId:u,displayName:"Invalid Runtime URL",binding:"direct"}:{selector:u,daemonId:u,displayName:`${u} (unavailable)`,binding:u==="local"?"local":"direct"}),w=u!=="local";return{runtimes:d,runtimeSelector:u,runtimeRoute:w?u:void 0,selectedRuntime:b,isRemoteRuntime:w,selectRuntime:p,refreshRuntimes:v,updateRuntimes:h}},[v,u,d,p,h]);return l.jsx(LT.Provider,{value:x,children:e})}function sc(){const e=g.useContext(LT);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const ZC="!add-runtime";function G9(){const e=Hr(),t=Ba(),{runtimes:r,runtimeSelector:i,selectedRuntime:s,selectRuntime:o}=sc(),u=r.some(m=>m.selector===i)?r:[...r,s],d=m=>{if(m===ZC){t(dt.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(Nm,{value:i,onValueChange:d,children:[l.jsxs(dd,{className:"h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7","aria-label":"Active Runtime",children:[l.jsx("span",{className:"hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline",children:"Runtime ·"}),l.jsx(ud,{placeholder:"Select Runtime"})]}),l.jsxs(hd,{align:"end",children:[u.map(m=>{const h=m.binding==="local"?DR:ed;return l.jsx(Zn,{value:m.selector,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(h,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),l.jsx(by,{}),l.jsx(Zn,{value:ZC,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(en,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function ac(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function OT(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function df(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||e.globalCli.state==="development"||OT(e)&&t}const BT=g.createContext({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function Y9({children:e}){const t=ac(),[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState(null);g.useEffect(()=>{if(!t)return;let p=!0;const x=t.onAppUpdateStatus(b=>{p&&(i(b),b.error||d(null))});return t.getAppUpdateStatus().then(b=>{p&&i(b)}).catch(b=>{p&&d(bv(b))}),()=>{p=!1,x()}},[t]);const m=g.useCallback(async()=>{if(!t)return null;o("check"),d(null);try{const p=await t.checkForAppUpdates();return i(p),p}catch(p){return d(bv(p)),null}finally{o(null)}},[t]),h=g.useCallback(async()=>{if(!t)return null;o("install"),d(null);try{const p=await t.installAppUpdate();return i(p),p}catch(p){return d(bv(p)),null}finally{o(null)}},[t]),v=g.useMemo(()=>({status:r,operation:s,error:u,checkForUpdates:m,installUpdate:h}),[m,u,h,s,r]);return l.jsx(BT.Provider,{value:v,children:e})}function My(){return g.useContext(BT)}function bv(e){return e instanceof Error?e.message:String(e)}function K9(){const{status:e,operation:t,error:r,installUpdate:i}=My();if(!(e!=null&&e.availableVersion)||e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="installing")return null;const s=t==="install"||e.phase==="installing",o=e.phase==="ready"&&!s,u=r??e.error;return l.jsxs("div",{className:"group/update relative flex shrink-0 items-center",children:[l.jsxs(he,{variant:"ghost",size:"icon-xs",className:"relative text-[var(--primary)] hover:text-[var(--primary)]","aria-label":`Rynx ${e.availableVersion} update available`,"aria-haspopup":"dialog",children:[e.phase==="downloading"||s?l.jsx(Ve,{className:"animate-spin"}):l.jsx(Mu,{}),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(Mu,{className:"size-4"}):e.phase==="downloading"?l.jsx(Mx,{className:"size-4"}):l.jsx(Ve,{className:"size-4 animate-spin"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-xs font-semibold text-[var(--foreground)]",children:o?"Update ready":s?"Preparing update":"Downloading update"}),l.jsx("p",{className:"mt-0.5 text-[11px] leading-4 text-[var(--muted-foreground)]",children:o?`${e.appName} ${e.availableVersion} is ready to install.`:s?"Rynx will restart when the local Runtime is safe to stop.":`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),o&&l.jsxs(he,{size:"sm",className:"mt-3 w-full",onClick:()=>void i(),children:[l.jsx(Mu,{}),"Restart to update"]}),u&&l.jsx("p",{className:"mt-2 text-[10px] leading-4 text-[var(--destructive)]",children:u})]})})]})}function Fe(...e){return zk(Ux(e))}function X9({children:e,theme:t,onToggleTheme:r}){const i=Hr(),{runtimeSelector:s}=sc(),o=RT(i.pathname),u=i.pathname===Hu||i.pathname.startsWith(`${Hu}/`),d=AT(i.state,xo(s)),m=u?d:d0,h=u?void 0:{returnTo:`${i.pathname}${i.search}${i.hash}`};return l.jsxs("div",{className:"grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]",children:[l.jsx("main",{className:"min-h-0 overflow-hidden focus:outline-none",children:e}),l.jsxs("footer",{className:"app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3",children:[l.jsx("span",{className:"hidden truncate uppercase tracking-[0.12em] min-[480px]:block",children:u?o==="emulator"?"Emulator · local device":"Settings · local configuration":"Session workbench"}),l.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[u?l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[l.jsx("span",{className:"text-[var(--foreground)]",children:"Control Plane"}),l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{children:"This device"})]}):l.jsx(G9,{}),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(K9,{}),l.jsx(he,{variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:r,"aria-label":t==="dark"?"Use light mode":"Use dark mode",title:t==="dark"?"Light mode":"Dark mode",children:t==="dark"?l.jsx(WB,{}):l.jsx(JO,{})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"icon-xs",className:Fe("shrink-0",u&&"text-[var(--primary)]"),children:l.jsx(Ca,{to:m,state:h,"aria-label":u?"Back to app":"Settings",title:u?"Back to app":"Settings",children:l.jsx(AB,{})})})]})]})]})]})}const zf="/assets/rynx-wordmark-LL1QRYHD.png";function Z9({bridge:e,children:t}){const[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState("refresh"),[m,h]=g.useState(!1),v=g.useCallback(async(E=!1)=>{d("refresh"),o(null);try{const S=await e.getStatus(E);df(S,!1)?i(await e.completeOnboarding()):i(S)}catch(S){o(S.message)}finally{d(null)}},[e]);g.useEffect(()=>{e.initialOnboardingCompleted||v()},[e.initialOnboardingCompleted,v]);const p=r?df(r,m):!1;async function x(){const E=r==null?void 0:r.globalCli.path;if(E){d("install"),o(null);try{const S=await e.installCli(E);h(!1),df(S,!1)?i(await e.completeOnboarding()):i(S)}catch(S){o(S.message);try{i(await e.getStatus(!0))}catch{}}finally{d(null)}}}async function 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:zf,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(Q9,{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(J9,{status:r,pending:u,acknowledged:m,onAcknowledgedChange:h,onInstall:()=>void x(),onRefresh:()=>void v(!0),onContinue:()=>void w()}):l.jsx(eU,{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(Ve,{className:"size-4 animate-spin"}),u==="refresh"?"Getting Rynx ready…":"Setup status is unavailable."]})}),s&&l.jsxs("div",{role:"alert",className:"mt-5 flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(ec,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})})]})]})}function Q9({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 J9({status:e,pending:t,acknowledged:r,onAcknowledgedChange:i,onInstall:s,onRefresh:o,onContinue:u}){const d=e.globalCli.state==="installed",m=e.globalCli.state==="development",h=d&&!e.globalCli.canInstall,v=OT(e),p=df(e,r);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:h?"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:h?l.jsx(Pa,{className:"size-4"}):l.jsx(Tx,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h2",{className:"text-sm font-medium",children:"Terminal command"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:tU(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:x=>i(x.target.checked),className:"mt-0.5 size-4 shrink-0 accent-[var(--primary)]"}),l.jsxs("span",{children:["Continue without Terminal access. I'll resolve the"," ",l.jsx("code",{className:"font-mono",children:"rynx"})," command later."]})]}),l.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[e.globalCli.canInstall&&l.jsxs(he,{disabled:t!==null,onClick:s,children:[t==="install"&&l.jsx(Ve,{className:"animate-spin"}),"Install command"]}),(h||m||v)&&l.jsxs(he,{disabled:t!==null||!p,onClick:u,children:["Continue",l.jsx(kR,{})]}),l.jsxs(he,{variant:"outline",disabled:t!==null,onClick:o,children:[l.jsx(At,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function eU({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(ec,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h2",{className:"text-sm font-medium",children:e.builtinSkill.ready?"Rynx couldn’t finish starting":"Rynx needs to be reinstalled"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:e.builtinSkill.ready?"Try again to continue.":"A required app component is unavailable. Reinstall Rynx, then open it again."}),e.builtinSkill.ready&&l.jsxs(he,{className:"mt-4",variant:"outline",disabled:t!==null,onClick:r,children:[t==="runtime"&&l.jsx(Ve,{className:"animate-spin"}),"Try again"]})]})]})}function tU(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 rU({bridge:e}){const[t,r]=g.useState(null),[i,s]=g.useState(!1),[o,u]=g.useState(null),d=g.useRef(!1),m=g.useRef(0),h=g.useCallback(b=>{b.requestId<=m.current||(m.current=b.requestId,r(b),s(!1),u(null),d.current=!1)},[]);g.useEffect(()=>{let b=!0;const w=e.onQuitPrompt(C=>{b&&h(C)});return e.getPendingQuitPrompt().then(C=>{b&&C&&h(C)}).catch(()=>{}),()=>{b=!1,w()}},[h,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"){s(!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,s(!0),u(null);try{const b=await e.respondToQuit(t.requestId,"force");b.outcome==="failed"?(u(b.message),s(!1)):b.outcome==="cancelled"&&(r(null),s(!1))}catch{u("Rynx couldn’t stop the running work. Try again."),s(!1)}finally{d.current=!1}}},[e,t]),x=(t==null?void 0:t.kind)==="active-work";return l.jsx(kn,{open:t!==null,onOpenChange:b=>{b||v()},children:l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsx(o8,{className:"bg-destructive/10 text-destructive",children:l.jsx(Ra,{"aria-hidden":"true"})}),l.jsx(rn,{children:x?"Quit Rynx?":"Rynx couldn’t quit"}),l.jsx(nn,{children:x?"Work is still running. Quitting now will stop it and close the open workspace.":"Rynx couldn’t stop its local service safely. Keep the app open and try again."})]}),o&&l.jsx("p",{role:"alert",className:"text-sm text-destructive",children:o}),l.jsxs(An,{children:[l.jsx(sn,{disabled:i,children:x?"Keep working":"Close"}),x&&l.jsx(he,{type:"button",variant:"destructive",disabled:i,onClick:()=>void p(),children:i?l.jsxs(l.Fragment,{children:[l.jsx(Ve,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const iU=[{label:"General",items:[{id:"overview",label:"Overview",icon:IO}]},{label:"Connections",items:[{id:"localRuntime",label:"Local Runtime",icon:Tx},{id:"runtimes",label:"Runtimes",icon:ed}]},{label:"AI Capabilities",items:[{id:"providers",label:"Providers",icon:Dx},{id:"agents",label:"Agents",icon:Rx},{id:"skills",label:"Skills",icon:zR}]},{label:"Integrations",items:[{id:"computerUse",label:"Computer Use",icon:LR},{id:"emulator",label:"Emulator",icon:Yl},{id:"channels",label:"Channels",icon:kx},{id:"instances",label:"Instances",icon:NR}]}];function nU({activeView:e,desktopIntegrationAvailable:t,children:r}){const i=Ba(),s=Hr(),{runtimeSelector:o}=sc(),u=AT(s.state,xo(o)),d={returnTo:u},m=iU.map(v=>({...v,items:v.items.filter(({id:p})=>ET(p,t))})).filter(v=>v.items.length>0),h=m.flatMap(v=>v.items);return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[l.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[l.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:l.jsxs(Ca,{to:u,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[l.jsx("img",{src:zf,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),l.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:l.jsxs(Ca,{to:u,children:[l.jsx(Gl,{className:"size-3.5"}),"Back to app"]})})]}),l.jsx(bn,{className:"min-h-0 flex-1",children:l.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:m.map(v=>l.jsxs("div",{children:[l.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:v.label}),l.jsx("div",{className:"grid gap-0.5",children:v.items.map(({id:p,label:x,icon:b})=>l.jsxs(Ca,{to:dt[p],state:d,"aria-current":e===p?"page":void 0,className:Fe("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"}),x]},p))})]},v.label))})})]}),l.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[l.jsx(Ca,{to:u,className:"app-no-drag shrink-0","aria-label":"Rynx",children:l.jsx("img",{src:zf,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:l.jsxs(Ca,{to:u,children:[l.jsx(Gl,{className:"size-3.5"}),"Back"]})}),l.jsx(ja,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:v=>i(dt[v.target.value],{state:d}),children:h.map(({id:v,label:p})=>l.jsx("option",{value:v,children:p},v))})]}),e==="emulator"?l.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:r}):l.jsx(bn,{className:"min-h-0 flex-1",children:l.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var sU="Label",PT=g.forwardRef((e,t)=>l.jsx(We.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));PT.displayName=sU;var aU=PT;const Ur=g.forwardRef(({className:e,...t},r)=>l.jsx(aU,{ref:r,className:Fe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));Ur.displayName="Label";function IT({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[i,s]=g.useState(!1),[o,u]=g.useState(""),[d,m]=g.useState(""),[h,v]=g.useState(""),[p,x]=g.useState(!1);function b(){u(""),m(""),v("")}const w=(()=>{const N=o.trim();return!N||!d.trim()?N:`${N}#${d.trim()}`})(),C=!!d.trim()&&o.includes("#");async function E(){const N=w;if(N){if(C){_e.error("Source already pins a ref with '#' — clear one of the two.");return}x(!0);try{const k=await xe.installSkill({tool:"skills-cli",source:N,...h.trim()?{skill:h.trim()}:{}});_e.success(`Installed ${h.trim()||N}`),e(k),b(),s(!1)}catch(k){_e.error(`Install failed: ${k.message}`)}finally{x(!1)}}}const S=["npx skills add",w||"<source>",h.trim()&&`--skill ${h.trim()}`].filter(Boolean).join(" ");return l.jsxs(Oo,{open:i,onOpenChange:N=>{s(N),N||b()},children:[l.jsx(Hk,{asChild:!0,children:l.jsxs(he,{size:"sm",variant:r,children:[l.jsx(en,{})," ",t]})}),l.jsxs(Ua,{children:[l.jsxs(Bo,{children:[l.jsx(Ha,{children:"Install a skill"}),l.jsxs(hm,{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(Ur,{children:["Source ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(Et,{value:o,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:N=>u(N.target.value)}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",l.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{children:"Skill"}),l.jsx(Et,{value:h,placeholder:"find-skills",onChange:N=>v(N.target.value)}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{children:"Branch"}),l.jsx(Et,{value:d,placeholder:"main",onChange:N=>m(N.target.value)}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Optional — a git ref, sent as ",l.jsx("code",{children:"#<branch>"}),"."]})]})]}),l.jsx("pre",{className:"overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]",children:S})]}),l.jsxs(rd,{children:[l.jsx(he,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),l.jsx(he,{onClick:E,disabled:p||!o.trim(),children:p?"Installing…":"Install"})]})]})]})}const oU=["codex","traex","claude"],lU=["none","minimal","low","medium","high","xhigh","max","ultra"],cU=["read-only","workspace-write","danger-full-access"],uU=["never","on-failure","on-request","untrusted"],dU=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function hU({value:e,onChange:t}){return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(nr,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:l.jsx(Et,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),l.jsx(nr,{label:"Description",children:l.jsx(Et,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),l.jsx(nr,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:l.jsx(wm,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function fU({value:e,onChange:t}){const r=e.executor??{},i=r.retry??{},s=u=>t({...e,executor:{...r,...u}}),o=u=>t({...e,executor:{...r,retry:{...i,...u}}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(nr,{label:"Runtime",children:l.jsx(ju,{value:r.runtime,options:oU,required:!0,onChange:u=>s({runtime:u})})}),l.jsx(nr,{label:"Reasoning effort",children:l.jsx(ju,{value:r.reasoningEffort,options:lU,onChange:u=>s({reasoningEffort:u})})})]}),l.jsx(nr,{label:"Model",help:"Blank inherits the runtime default.",children:l.jsx(Et,{value:r.model??"",placeholder:"runtime default",onChange:u=>s({model:u.target.value||void 0})})}),l.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(nr,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:l.jsx(au,{value:r.timeout,onChange:u=>s({timeout:u})})}),l.jsx(nr,{label:"Max iterations",help:"claude only (→ --max-turns).",children:l.jsx(au,{value:r.maxIterations,onChange:u=>s({maxIterations:u})})}),l.jsx(nr,{label:"Context window",help:"codex/traex token budget.",children:l.jsx(au,{value:r.contextWindow,onChange:u=>s({contextWindow:u})})}),l.jsx(nr,{label:"Retry: max retries",children:l.jsx(au,{value:i.maxRetries,onChange:u=>o({maxRetries:u})})}),l.jsx(nr,{label:"Retry: timeout/req (s)",children:l.jsx(au,{value:i.timeoutPerRequestSeconds,onChange:u=>o({timeoutPerRequestSeconds:u})})})]})]})}function mU({value:e,onChange:t}){var o;const r=e.osEnv??{},i=u=>t({...e,osEnv:{...r,...u}}),s=((o=e.executor)==null?void 0:o.runtime)??"codex";return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s==="claude"?l.jsx(nr,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:l.jsx(ju,{value:r.permissionMode,options:dU,onChange:u=>i({permissionMode:u})})}):l.jsxs(l.Fragment,{children:[l.jsx(nr,{label:"Sandbox",children:l.jsx(ju,{value:r.sandbox,options:cU,onChange:u=>i({sandbox:u})})}),l.jsx(nr,{label:"Approval policy",help:"Codex's approval axis.",children:l.jsx(ju,{value:r.approvalPolicy,options:uU,onChange:u=>i({approvalPolicy:u})})})]}),l.jsx(nr,{label:"Working directory (cwd)",children:l.jsx(Et,{value:r.cwd??"",placeholder:"(inherit)",onChange:u=>i({cwd:u.target.value||void 0})})}),l.jsx(nr,{label:"Full auto",children:l.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[l.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:u=>i({fullAuto:u.target.checked||void 0})}),l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]}),l.jsx(nr,{label:"Allowed dirs",help:"Extra writable roots beyond the base allow-list.",children:l.jsx(p0,{items:r.allowedDirs??[],placeholder:"/path/to/dir",onChange:u=>i({allowedDirs:u})})})]})}function pU({value:e,onChange:t}){const r=e.tools??{},i=s=>t({...e,tools:{...r,...s}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(nr,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:l.jsx(p0,{items:r.allowed??[],placeholder:"ToolName",onChange:s=>i({allowed:s})})}),l.jsx(nr,{label:"Disallowed tools",children:l.jsx(p0,{items:r.disallowed??[],placeholder:"ToolName",onChange:s=>i({disallowed:s})})}),l.jsx(nr,{label:"MCP servers",help:"HTTP transport only.",children:l.jsx(vU,{rows:r.mcp??[],onChange:s=>i({mcp:s})})})]})}function gU({value:e,onChange:t}){const r=e.skills??[],[i,s]=g.useState(null);g.useEffect(()=>{xe.listSkills().then(s).catch(v=>{s([]),_e.error(`Load skills failed: ${v.message}`)})},[]);const o=new Set(r.map(v=>v.name)),u=v=>{v.ref&&t({...e,skills:[...r,{...v.ref}]})},d=v=>t({...e,skills:r.filter(p=>p.name!==v)}),m=new Set((i??[]).map(v=>v.name)),h=r.map(v=>v.name).filter(v=>!m.has(v));return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(nr,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:i===null?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):i.length===0&&h.length===0?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):l.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[i.map(v=>l.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(v.ref?"cursor-pointer hover:bg-[var(--muted)]/50":"opacity-60"),children:[l.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",disabled:!v.ref,checked:o.has(v.name),onChange:p=>p.target.checked?u(v):d(v.name)}),l.jsxs("span",{className:"grid",children:[l.jsxs("span",{className:"font-mono text-sm",children:[v.name,!v.ref&&l.jsx("span",{className:"ml-1 text-xs text-[var(--warning)]",children:"(no install recipe — reinstall to make selectable)"})]}),l.jsx("span",{className:"line-clamp-2 text-xs text-[var(--muted-foreground)]",children:v.description})]})]},v.name)),h.map(v=>l.jsxs("label",{className:"flex items-center gap-2 rounded-sm p-1.5",children:[l.jsx("input",{type:"checkbox",className:"size-4 shrink-0",checked:!0,onChange:()=>d(v)}),l.jsxs("span",{className:"font-mono text-sm",children:[v," ",l.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},v))]})}),l.jsx("div",{children:l.jsx(IT,{onInstalled:s,triggerVariant:"outline"})})]})}function zT(e){const{skills:t,...r}=e,i=m0(r)??{};return Array.isArray(t)&&t.length>0&&(i.skills=t),i}function m0(e){if(Array.isArray(e)){const t=e.map(m0).filter(r=>r!==void 0);return t.length>0?t:void 0}if(e&&typeof e=="object"){const t={};for(const[r,i]of Object.entries(e)){const s=m0(i);s!==void 0&&(t[r]=s)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function nr({label:e,help:t,children:r}){return l.jsxs("div",{className:"grid content-start gap-1.5",children:[l.jsx(Ur,{children:e}),r,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const wv="__default__";function ju({value:e,options:t,onChange:r,disabled:i,required:s}){return l.jsxs(Nm,{value:e??(s?t[0]:wv),disabled:i,onValueChange:o=>r(o===wv?void 0:o),children:[l.jsx(dd,{children:l.jsx(ud,{})}),l.jsxs(hd,{children:[!s&&l.jsx(Zn,{value:wv,children:l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(o=>l.jsx(Zn,{value:o,children:o},o))]})]})}function au({value:e,onChange:t}){return l.jsx(Et,{type:"number",value:e??"",onChange:r=>{const i=r.target.value;t(i===""?void 0:Number(i))}})}function p0({items:e,placeholder:t,onChange:r}){const i=(o,u)=>r(e.map((d,m)=>m===o?u:d)),s=o=>r(e.filter((u,d)=>d!==o));return l.jsxs("div",{className:"grid gap-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(Et,{value:o,placeholder:t,onChange:d=>i(u,d.target.value)}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>s(u),children:l.jsx(Aa,{})})]},u)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[l.jsx(en,{})," Add"]})]})}function vU({rows:e,onChange:t}){const r=g.useRef(0),[i,s]=g.useState(()=>e.map(()=>r.current++)),o=(m,h)=>t(e.map((v,p)=>p===m?{...v,...h}:v)),u=m=>{t(e.filter((h,v)=>v!==m)),s(i.filter((h,v)=>v!==m))},d=()=>{t([...e,{name:"",url:""}]),s([...i,r.current++])};return l.jsxs("div",{className:"grid gap-2",children:[e.map((m,h)=>l.jsxs("div",{className:"grid gap-2 rounded-md border border-[var(--border)] p-3",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(Et,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:v=>o(h,{name:v.target.value})}),l.jsx("span",{className:"label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:"HTTP"}),l.jsx(Et,{value:m.url??"",placeholder:"https://server/mcp",onChange:v=>o(h,{url:v.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:l.jsx(Aa,{})})]}),l.jsx(_U,{headers:m.headers??{},onChange:v=>o(h,{headers:v})})]},i[h]??h)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[l.jsx(en,{})," Add MCP server"]})]})}function _U({headers:e,onChange:t}){const[r,i]=g.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function s(d){i(d);const m={};for(const{k:h,v}of d){const p=h.trim();p&&(m[p]=v)}t(Object.keys(m).length>0?m:void 0)}const o=(d,m)=>s(r.map((h,v)=>v===d?{...h,...m}:h)),u=d=>s(r.filter((m,h)=>h!==d));return l.jsxs("div",{className:"grid gap-1.5",children:[r.map((d,m)=>l.jsxs("div",{className:"flex gap-1.5",children:[l.jsx(Et,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:h=>o(m,{k:h.target.value})}),l.jsx(Et,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:h=>o(m,{v:h.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(m),children:l.jsx(Aa,{})})]},m)),l.jsxs(he,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>s([...r,{k:"",v:""}]),children:[l.jsx(en,{})," Add header"]})]})}function Yr({className:e,...t}){return l.jsx("div",{className:Fe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function _i({className:e,...t}){return l.jsx("div",{className:Fe("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function Jr({className:e,...t}){return l.jsx("h3",{className:Fe("text-sm font-semibold tracking-tight",e),...t})}function ei({className:e,...t}){return l.jsx("div",{className:Fe("p-5",e),...t})}const Sv=/^[a-z0-9][a-z0-9-]{0,63}$/,g0=[{id:"identity",label:"Identity",blurb:"Name, description, and system instructions."},{id:"model",label:"Model & Budget",blurb:"Runtime, model, reasoning effort, and execution limits."},{id:"environment",label:"Environment",blurb:"Sandbox, per-runtime approvals, working dir, writable roots."},{id:"tools",label:"Tools & MCP",blurb:"Allowed/disallowed tools and MCP servers."},{id:"skills",label:"Skills",blurb:"Which skills this agent can use."},{id:"review",label:"Review",blurb:"Confirm and save."}];function xU({initial:e,onClose:t,onSaved:r}){const i=e.id==="",[s,o]=g.useState(e.id),[u,d]=g.useState(e.spec),[m,h]=g.useState("identity"),[v,p]=g.useState("form"),[x,b]=g.useState(()=>JSON.stringify(e.spec,null,2)),[w,C]=g.useState(!1);function E(N){if(N!==v)if(N==="json")b(JSON.stringify(u,null,2)),p("json");else try{d(JSON.parse(x)),p("form")}catch(k){_e.error(`Invalid JSON: ${k.message}`)}}async function S(){const N=s.trim();if(i&&!Sv.test(N))return h("identity"),_e.error(N?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let k;if(v==="json")try{k=JSON.parse(x)}catch(R){return _e.error(`Invalid JSON: ${R.message}`)}else k=u;C(!0);try{await xe.writeAgent({...zT(k),id:s.trim()}),_e.success(`Agent "${s}" saved`),await r()}catch(R){_e.error(`Save failed: ${R.message}`)}finally{C(!1)}}return l.jsxs("div",{className:"grid gap-5",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]",children:[l.jsx(Gl,{className:"size-3.5"})," Agents"]}),l.jsx("h1",{className:"text-xl font-semibold",children:i?"New agent":`Edit "${e.id}"`})]}),l.jsx("div",{className:"inline-flex rounded-md border border-[var(--border)] p-0.5",children:["form","json"].map(N=>l.jsx("button",{type:"button",onClick:()=>E(N),className:Fe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",v===N?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:N},N))})]}),v==="json"?l.jsx(wm,{value:x,onChange:N=>b(N.target.value),className:"min-h-[28rem] font-mono text-xs"}):l.jsxs("div",{className:"grid grid-cols-[12rem_1fr] gap-6",children:[l.jsx("nav",{className:"sticky top-6 grid h-fit gap-0.5",children:g0.map(N=>l.jsx("button",{type:"button",onClick:()=>h(N.id),className:Fe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===N.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:N.label},N.id))}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"mb-4",children:[l.jsx("h2",{className:"text-base font-semibold",children:QC(m).label}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:QC(m).blurb})]}),l.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs(Ur,{children:["Agent ID ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(Et,{value:s,disabled:!i,onChange:N=>o(N.target.value),placeholder:"polly","aria-invalid":i&&s.trim()!==""&&!Sv.test(s.trim())}),i&&s.trim()!==""&&!Sv.test(s.trim())?l.jsx("p",{className:"text-xs text-[var(--destructive)]",children:"Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit."}):l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["The config directory name. References (",l.jsx("code",{children:"/agent <id>"}),", bindings) use it; it can't change after creation."]})]}),l.jsx(hU,{value:u,onChange:d})]}),m==="model"&&l.jsx(fU,{value:u,onChange:d}),m==="environment"&&l.jsx(mU,{value:u,onChange:d}),m==="tools"&&l.jsx(pU,{value:u,onChange:d}),m==="skills"&&l.jsx(gU,{value:u,onChange:d}),m==="review"&&l.jsx(yU,{id:s,spec:u})]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[l.jsx(he,{variant:"outline",onClick:t,children:"Cancel"}),l.jsx(he,{onClick:S,disabled:w,children:w?"Saving…":"Save"})]})]})}function QC(e){return g0.find(t=>t.id===e)??g0[0]}function yU({id:e,spec:t}){var s,o,u,d,m,h;const r=zT(t),i=[["Agent ID",e||"—"],["Display name",((s=t.name)==null?void 0:s.trim())||"—"],["Runtime",((o=t.executor)==null?void 0:o.runtime)??"default"],["Model",((d=(u=t.executor)==null?void 0:u.model)==null?void 0:d.trim())||"runtime default"],["Skills",bU(t.skills)],["MCP servers",String(((h=(m=t.tools)==null?void 0:m.mcp)==null?void 0:h.filter(v=>{var p;return(p=v.url)==null?void 0:p.trim()}).length)??0)]];return l.jsxs("div",{className:"grid gap-4",children:[l.jsx("dl",{className:"grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm",children:i.map(([v,p])=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-[var(--muted-foreground)]",children:v}),l.jsx("dd",{className:"font-medium",children:p})]},v))}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{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 bU(e){return e!=null&&e.length?`${e.length} declared`:"None"}const wU={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 SU({agents:e,onChange:t}){const[r,i]=g.useState(null);function s(){i({id:"",spec:structuredClone(wU)})}async function o(u){try{const d=await xe.getAgent(u);delete d.id,i({id:u,spec:d})}catch(d){_e.error(`Load failed: ${d.message}`)}}return r?l.jsx(xU,{initial:r,onClose:()=>i(null),onSaved:async()=>{i(null),await t()}}):l.jsxs(Yr,{children:[l.jsxs(_i,{children:[l.jsxs(Jr,{children:["Agents ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:s,children:[l.jsx(en,{})," New agent"]})]}),l.jsx(ei,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Agent"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Runtime"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Model"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:"No agents yet."})}),e.map(u=>l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:u.name??u.id}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:u.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:u.runtime??"—"}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:u.model??"—"}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>void o(u.id),children:[l.jsx(gB,{})," Edit"]}),l.jsx(CU,{id:u.id,onChange:t})]})})]},u.id))]})]})})]})}function CU({id:e,onChange:t}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Ia,{})})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:['Delete agent "',e,'"?']}),l.jsx(nn,{children:"Removes its config directory. Instances bound to it fall back to defaults."})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:async()=>{try{await xe.deleteAgent(e),_e.success(`Agent "${e}" deleted`),await t()}catch(r){_e.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}const EU=$k("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",{variants:{variant:{default:"border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]",success:"border-transparent bg-[var(--success)]/15 text-[var(--success)]",warning:"border-transparent bg-[var(--warning)]/15 text-[var(--warning)]",destructive:"border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]",outline:"text-[var(--muted-foreground)]"}},defaultVariants:{variant:"default"}});function _t({className:e,variant:t,...r}){return l.jsx("span",{className:Fe(EU({variant:t}),e),...r})}var Ml={},Cv,JC;function RU(){return JC||(JC=1,Cv=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Cv}var Ev={},ma={},e2;function $o(){if(e2)return ma;e2=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return ma.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},ma.getSymbolTotalCodewords=function(i){return t[i]},ma.getBCHDigit=function(r){let i=0;for(;r!==0;)i++,r>>>=1;return i},ma.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},ma.isKanjiModeEnabled=function(){return typeof e<"u"},ma.toSJIS=function(i){return e(i)},ma}var Rv={},t2;function jy(){return t2||(t2=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,s){if(e.isValid(i))return i;try{return t(i)}catch{return s}}})(Rv)),Rv}var kv,r2;function kU(){if(r2)return kv;r2=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let i=0;i<r;i++)this.putBit((t>>>r-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},kv=e,kv}var Nv,i2;function NU(){if(i2)return Nv;i2=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,i,s){const o=t*this.size+r;this.data[o]=i,s&&(this.reservedBit[o]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,i){this.data[t*this.size+r]^=i},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},Nv=e,Nv}var Av={},n2;function AU(){return n2||(n2=1,(function(e){const t=$o().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,o=t(i),u=o===145?26:Math.ceil((o-13)/(2*s-2))*2,d=[o-7];for(let m=1;m<s-1;m++)d[m]=d[m-1]-u;return d.push(6),d.reverse()},e.getPositions=function(i){const s=[],o=e.getRowColCoords(i),u=o.length;for(let d=0;d<u;d++)for(let m=0;m<u;m++)d===0&&m===0||d===0&&m===u-1||d===u-1&&m===0||s.push([o[d],o[m]]);return s}})(Av)),Av}var Tv={},s2;function TU(){if(s2)return Tv;s2=1;const e=$o().getSymbolSize,t=7;return Tv.getPositions=function(i){const s=e(i);return[[0,0],[s-t,0],[0,s-t]]},Tv}var Mv={},a2;function MU(){return a2||(a2=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const o=s.size;let u=0,d=0,m=0,h=null,v=null;for(let p=0;p<o;p++){d=m=0,h=v=null;for(let x=0;x<o;x++){let b=s.get(p,x);b===h?d++:(d>=5&&(u+=t.N1+(d-5)),h=b,d=1),b=s.get(x,p),b===v?m++:(m>=5&&(u+=t.N1+(m-5)),v=b,m=1)}d>=5&&(u+=t.N1+(d-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(s){const o=s.size;let u=0;for(let d=0;d<o-1;d++)for(let m=0;m<o-1;m++){const h=s.get(d,m)+s.get(d,m+1)+s.get(d+1,m)+s.get(d+1,m+1);(h===4||h===0)&&u++}return u*t.N2},e.getPenaltyN3=function(s){const o=s.size;let u=0,d=0,m=0;for(let h=0;h<o;h++){d=m=0;for(let v=0;v<o;v++)d=d<<1&2047|s.get(h,v),v>=10&&(d===1488||d===93)&&u++,m=m<<1&2047|s.get(v,h),v>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(s){let o=0;const u=s.data.length;for(let m=0;m<u;m++)o+=s.data[m];return Math.abs(Math.ceil(o*100/u/5)-10)*t.N4};function r(i,s,o){switch(i){case e.Patterns.PATTERN000:return(s+o)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(s+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return s*o%2+s*o%3===0;case e.Patterns.PATTERN110:return(s*o%2+s*o%3)%2===0;case e.Patterns.PATTERN111:return(s*o%3+(s+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(s,o){const u=o.size;for(let d=0;d<u;d++)for(let m=0;m<u;m++)o.isReserved(m,d)||o.xor(m,d,r(s,m,d))},e.getBestMask=function(s,o){const u=Object.keys(e.Patterns).length;let d=0,m=1/0;for(let h=0;h<u;h++){o(h),e.applyMask(h,s);const v=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(h,s),v<m&&(m=v,d=h)}return d}})(Mv)),Mv}var Hh={},o2;function $T(){if(o2)return Hh;o2=1;const e=jy(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Hh.getBlocksCount=function(s,o){switch(o){case e.L:return t[(s-1)*4+0];case e.M:return t[(s-1)*4+1];case e.Q:return t[(s-1)*4+2];case e.H:return t[(s-1)*4+3];default:return}},Hh.getTotalCodewordsCount=function(s,o){switch(o){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},Hh}var jv={},ou={},l2;function jU(){if(l2)return ou;l2=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)e[s]=i,t[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),ou.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},ou.exp=function(i){return e[i]},ou.mul=function(i,s){return i===0||s===0?0:e[t[i]+t[s]]},ou}var c2;function DU(){return c2||(c2=1,(function(e){const t=jU();e.mul=function(i,s){const o=new Uint8Array(i.length+s.length-1);for(let u=0;u<i.length;u++)for(let d=0;d<s.length;d++)o[u+d]^=t.mul(i[u],s[d]);return o},e.mod=function(i,s){let o=new Uint8Array(i);for(;o.length-s.length>=0;){const u=o[0];for(let m=0;m<s.length;m++)o[m]^=t.mul(s[m],u);let d=0;for(;d<o.length&&o[d]===0;)d++;o=o.slice(d)}return o},e.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let o=0;o<i;o++)s=e.mul(s,new Uint8Array([1,t.exp(o)]));return s}})(jv)),jv}var Dv,u2;function LU(){if(u2)return Dv;u2=1;const e=DU();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const o=e.mod(s,this.genPoly),u=this.degree-o.length;if(u>0){const d=new Uint8Array(this.degree);return d.set(o,u),d}return o},Dv=t,Dv}var Lv={},Ov={},Bv={},d2;function UT(){return d2||(d2=1,Bv.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Bv}var zn={},h2;function HT(){if(h2)return zn;h2=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
524
- ]))+`;zn.KANJI=new RegExp(r,"g"),zn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),zn.BYTE=new RegExp(i,"g"),zn.NUMERIC=new RegExp(e,"g"),zn.ALPHANUMERIC=new RegExp(t,"g");const s=new RegExp("^"+r+"$"),o=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return zn.testKanji=function(m){return s.test(m)},zn.testNumeric=function(m){return o.test(m)},zn.testAlphanumeric=function(m){return u.test(m)},zn}var f2;function Uo(){return f2||(f2=1,(function(e){const t=UT(),r=HT();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,u){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?o.ccBits[0]:u<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return r.testNumeric(o)?e.NUMERIC:r.testAlphanumeric(o)?e.ALPHANUMERIC:r.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(o,u){if(e.isValid(o))return o;try{return i(o)}catch{return u}}})(Ov)),Ov}var m2;function OU(){return m2||(m2=1,(function(e){const t=$o(),r=$T(),i=jy(),s=Uo(),o=UT(),u=7973,d=t.getBCHDigit(u);function m(x,b,w){for(let C=1;C<=40;C++)if(b<=e.getCapacity(C,w,x))return C}function h(x,b){return s.getCharCountIndicator(x,b)+4}function v(x,b){let w=0;return x.forEach(function(C){const E=h(C.mode,b);w+=E+C.getBitsLength()}),w}function p(x,b){for(let w=1;w<=40;w++)if(v(x,w)<=e.getCapacity(w,b,s.MIXED))return w}e.from=function(b,w){return o.isValid(b)?parseInt(b,10):w},e.getCapacity=function(b,w,C){if(!o.isValid(b))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=s.BYTE);const E=t.getSymbolTotalCodewords(b),S=r.getTotalCodewordsCount(b,w),N=(E-S)*8;if(C===s.MIXED)return N;const k=N-h(C,b);switch(C){case s.NUMERIC:return Math.floor(k/10*3);case s.ALPHANUMERIC:return Math.floor(k/11*2);case s.KANJI:return Math.floor(k/13);case s.BYTE:default:return Math.floor(k/8)}},e.getBestVersionForData=function(b,w){let C;const E=i.from(w,i.M);if(Array.isArray(b)){if(b.length>1)return p(b,E);if(b.length===0)return 1;C=b[0]}else C=b;return m(C.mode,C.getLength(),E)},e.getEncodedBits=function(b){if(!o.isValid(b)||b<7)throw new Error("Invalid QR Code version");let w=b<<12;for(;t.getBCHDigit(w)-d>=0;)w^=u<<t.getBCHDigit(w)-d;return b<<12|w}})(Lv)),Lv}var Pv={},p2;function BU(){if(p2)return Pv;p2=1;const e=$o(),t=1335,r=21522,i=e.getBCHDigit(t);return Pv.getEncodedBits=function(o,u){const d=o.bit<<3|u;let m=d<<10;for(;e.getBCHDigit(m)-i>=0;)m^=t<<e.getBCHDigit(m)-i;return(d<<10|m)^r},Pv}var Iv={},zv,g2;function PU(){if(g2)return zv;g2=1;const e=Uo();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let s,o,u;for(s=0;s+3<=this.data.length;s+=3)o=this.data.substr(s,3),u=parseInt(o,10),i.put(u,10);const d=this.data.length-s;d>0&&(o=this.data.substr(s),u=parseInt(o,10),i.put(u,d*3+1))},zv=t,zv}var $v,v2;function IU(){if(v2)return $v;v2=1;const e=Uo(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(i){this.mode=e.ALPHANUMERIC,this.data=i}return r.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let o;for(o=0;o+2<=this.data.length;o+=2){let u=t.indexOf(this.data[o])*45;u+=t.indexOf(this.data[o+1]),s.put(u,11)}this.data.length%2&&s.put(t.indexOf(this.data[o]),6)},$v=r,$v}var Uv,_2;function zU(){if(_2)return Uv;_2=1;const e=Uo();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let i=0,s=this.data.length;i<s;i++)r.put(this.data[i],8)},Uv=t,Uv}var Hv,x2;function $U(){if(x2)return Hv;x2=1;const e=Uo(),t=$o();function r(i){this.mode=e.KANJI,this.data=i}return r.getBitsLength=function(s){return s*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let o=t.toSJIS(this.data[s]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
525
- Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},Hv=r,Hv}var Fv={exports:{}},y2;function UU(){return y2||(y2=1,(function(e){var t={single_source_shortest_paths:function(r,i,s){var o={},u={};u[i]=0;var d=t.PriorityQueue.make();d.push(i,0);for(var m,h,v,p,x,b,w,C,E;!d.empty();){m=d.pop(),h=m.value,p=m.cost,x=r[h]||{};for(v in x)x.hasOwnProperty(v)&&(b=x[v],w=p+b,C=u[v],E=typeof u[v]>"u",(E||C>w)&&(u[v]=w,d.push(v,w),o[v]=h))}if(typeof s<"u"&&typeof u[s]>"u"){var S=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(S)}return o},extract_shortest_path_from_predecessor_list:function(r,i){for(var s=[],o=i;o;)s.push(o),r[o],o=r[o];return s.reverse(),s},find_path:function(r,i,s){var o=t.single_source_shortest_paths(r,i,s);return t.extract_shortest_path_from_predecessor_list(o,s)},PriorityQueue:{make:function(r){var i=t.PriorityQueue,s={},o;r=r||{};for(o in i)i.hasOwnProperty(o)&&(s[o]=i[o]);return s.queue=[],s.sorter=r.sorter||i.default_sorter,s},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var s={value:r,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Fv)),Fv.exports}var b2;function HU(){return b2||(b2=1,(function(e){const t=Uo(),r=PU(),i=IU(),s=zU(),o=$U(),u=HT(),d=$o(),m=UU();function h(S){return unescape(encodeURIComponent(S)).length}function v(S,N,k){const R=[];let M;for(;(M=S.exec(k))!==null;)R.push({data:M[0],index:M.index,mode:N,length:M[0].length});return R}function p(S){const N=v(u.NUMERIC,t.NUMERIC,S),k=v(u.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,M;return d.isKanjiModeEnabled()?(R=v(u.BYTE,t.BYTE,S),M=v(u.KANJI,t.KANJI,S)):(R=v(u.BYTE_KANJI,t.BYTE,S),M=[]),N.concat(k,R,M).sort(function($,D){return $.index-D.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function x(S,N){switch(N){case t.NUMERIC:return r.getBitsLength(S);case t.ALPHANUMERIC:return i.getBitsLength(S);case t.KANJI:return o.getBitsLength(S);case t.BYTE:return s.getBitsLength(S)}}function b(S){return S.reduce(function(N,k){const R=N.length-1>=0?N[N.length-1]:null;return R&&R.mode===k.mode?(N[N.length-1].data+=k.data,N):(N.push(k),N)},[])}function w(S){const N=[];for(let k=0;k<S.length;k++){const R=S[k];switch(R.mode){case t.NUMERIC:N.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:N.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:N.push([R,{data:R.data,mode:t.BYTE,length:h(R.data)}]);break;case t.BYTE:N.push([{data:R.data,mode:t.BYTE,length:h(R.data)}])}}return N}function C(S,N){const k={},R={start:{}};let M=["start"];for(let L=0;L<S.length;L++){const $=S[L],D=[];for(let q=0;q<$.length;q++){const G=$[q],W=""+L+q;D.push(W),k[W]={node:G,lastCount:0},R[W]={};for(let B=0;B<M.length;B++){const j=M[B];k[j]&&k[j].node.mode===G.mode?(R[j][W]=x(k[j].lastCount+G.length,G.mode)-x(k[j].lastCount,G.mode),k[j].lastCount+=G.length):(k[j]&&(k[j].lastCount=G.length),R[j][W]=x(G.length,G.mode)+4+t.getCharCountIndicator(G.mode,N))}}M=D}for(let L=0;L<M.length;L++)R[M[L]].end=0;return{map:R,table:k}}function E(S,N){let k;const R=t.getBestModeForData(S);if(k=t.from(N,R),k!==t.BYTE&&k.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(k)+`.
526
- Suggested mode is: `+t.toString(R));switch(k===t.KANJI&&!d.isKanjiModeEnabled()&&(k=t.BYTE),k){case t.NUMERIC:return new r(S);case t.ALPHANUMERIC:return new i(S);case t.KANJI:return new o(S);case t.BYTE:return new s(S)}}e.fromArray=function(N){return N.reduce(function(k,R){return typeof R=="string"?k.push(E(R,null)):R.data&&k.push(E(R.data,R.mode)),k},[])},e.fromString=function(N,k){const R=p(N,d.isKanjiModeEnabled()),M=w(R),L=C(M,k),$=m.find_path(L.map,"start","end"),D=[];for(let q=1;q<$.length-1;q++)D.push(L.table[$[q]].node);return e.fromArray(b(D))},e.rawSplit=function(N){return e.fromArray(p(N,d.isKanjiModeEnabled()))}})(Iv)),Iv}var w2;function FU(){if(w2)return Ev;w2=1;const e=$o(),t=jy(),r=kU(),i=NU(),s=AU(),o=TU(),u=MU(),d=$T(),m=LU(),h=OU(),v=BU(),p=Uo(),x=HU();function b(L,$){const D=L.size,q=o.getPositions($);for(let G=0;G<q.length;G++){const W=q[G][0],B=q[G][1];for(let j=-1;j<=7;j++)if(!(W+j<=-1||D<=W+j))for(let O=-1;O<=7;O++)B+O<=-1||D<=B+O||(j>=0&&j<=6&&(O===0||O===6)||O>=0&&O<=6&&(j===0||j===6)||j>=2&&j<=4&&O>=2&&O<=4?L.set(W+j,B+O,!0,!0):L.set(W+j,B+O,!1,!0))}}function w(L){const $=L.size;for(let D=8;D<$-8;D++){const q=D%2===0;L.set(D,6,q,!0),L.set(6,D,q,!0)}}function C(L,$){const D=s.getPositions($);for(let q=0;q<D.length;q++){const G=D[q][0],W=D[q][1];for(let B=-2;B<=2;B++)for(let j=-2;j<=2;j++)B===-2||B===2||j===-2||j===2||B===0&&j===0?L.set(G+B,W+j,!0,!0):L.set(G+B,W+j,!1,!0)}}function E(L,$){const D=L.size,q=h.getEncodedBits($);let G,W,B;for(let j=0;j<18;j++)G=Math.floor(j/3),W=j%3+D-8-3,B=(q>>j&1)===1,L.set(G,W,B,!0),L.set(W,G,B,!0)}function S(L,$,D){const q=L.size,G=v.getEncodedBits($,D);let W,B;for(W=0;W<15;W++)B=(G>>W&1)===1,W<6?L.set(W,8,B,!0):W<8?L.set(W+1,8,B,!0):L.set(q-15+W,8,B,!0),W<8?L.set(8,q-W-1,B,!0):W<9?L.set(8,15-W-1+1,B,!0):L.set(8,15-W-1,B,!0);L.set(q-8,8,1,!0)}function N(L,$){const D=L.size;let q=-1,G=D-1,W=7,B=0;for(let j=D-1;j>0;j-=2)for(j===6&&j--;;){for(let O=0;O<2;O++)if(!L.isReserved(G,j-O)){let z=!1;B<$.length&&(z=($[B]>>>W&1)===1),L.set(G,j-O,z),W--,W===-1&&(B++,W=7)}if(G+=q,G<0||D<=G){G-=q,q=-q;break}}}function k(L,$,D){const q=new r;D.forEach(function(O){q.put(O.mode.bit,4),q.put(O.getLength(),p.getCharCountIndicator(O.mode,L)),O.write(q)});const G=e.getSymbolTotalCodewords(L),W=d.getTotalCodewordsCount(L,$),B=(G-W)*8;for(q.getLengthInBits()+4<=B&&q.put(0,4);q.getLengthInBits()%8!==0;)q.putBit(0);const j=(B-q.getLengthInBits())/8;for(let O=0;O<j;O++)q.put(O%2?17:236,8);return R(q,L,$)}function R(L,$,D){const q=e.getSymbolTotalCodewords($),G=d.getTotalCodewordsCount($,D),W=q-G,B=d.getBlocksCount($,D),j=q%B,O=B-j,z=Math.floor(q/B),T=Math.floor(W/B),U=T+1,H=z-T,F=new m(H);let V=0;const I=new Array(B),Y=new Array(B);let K=0;const ee=new Uint8Array(L.buffer);for(let ie=0;ie<B;ie++){const Se=ie<O?T:U;I[ie]=ee.slice(V,V+Se),Y[ie]=F.encode(I[ie]),V+=Se,K=Math.max(K,Se)}const oe=new Uint8Array(q);let ce=0,Z,le;for(Z=0;Z<K;Z++)for(le=0;le<B;le++)Z<I[le].length&&(oe[ce++]=I[le][Z]);for(Z=0;Z<H;Z++)for(le=0;le<B;le++)oe[ce++]=Y[le][Z];return oe}function M(L,$,D,q){let G;if(Array.isArray(L))G=x.fromArray(L);else if(typeof L=="string"){let z=$;if(!z){const T=x.rawSplit(L);z=h.getBestVersionForData(T,D)}G=x.fromString(L,z||40)}else throw new Error("Invalid data");const W=h.getBestVersionForData(G,D);if(!W)throw new Error("The amount of data is too big to be stored in a QR Code");if(!$)$=W;else if($<W)throw new Error(`
527
- The chosen QR Code version cannot contain this amount of data.
528
- Minimum version required to store current data is: `+W+`.
529
- `);const B=k($,D,G),j=e.getSymbolSize($),O=new i(j);return b(O,$),w(O),C(O,$),S(O,D,0),$>=7&&E(O,$),N(O,B),isNaN(q)&&(q=u.getBestMask(O,S.bind(null,O,D))),u.applyMask(q,O),S(O,D,q),{modules:O,version:$,errorCorrectionLevel:D,maskPattern:q,segments:G}}return Ev.create=function($,D){if(typeof $>"u"||$==="")throw new Error("No input text");let q=t.M,G,W;return typeof D<"u"&&(q=t.from(D.errorCorrectionLevel,t.M),G=h.from(D.version),W=u.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),M($,G,q,W)},Ev}var Wv={},qv={},S2;function FT(){return S2||(S2=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,u=i.scale||4;return{width:o,scale:o?4:u,margin:s,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},e.getImageWidth=function(i,s){const o=e.getScale(i,s);return Math.floor((i+s.margin*2)*o)},e.qrToImageData=function(i,s,o){const u=s.modules.size,d=s.modules.data,m=e.getScale(u,o),h=Math.floor((u+o.margin*2)*m),v=o.margin*m,p=[o.color.light,o.color.dark];for(let x=0;x<h;x++)for(let b=0;b<h;b++){let w=(x*h+b)*4,C=o.color.light;if(x>=v&&b>=v&&x<h-v&&b<h-v){const E=Math.floor((x-v)/m),S=Math.floor((b-v)/m);C=p[d[E*u+S]?1:0]}i[w++]=C.r,i[w++]=C.g,i[w++]=C.b,i[w]=C.a}}})(qv)),qv}var C2;function WU(){return C2||(C2=1,(function(e){const t=FT();function r(s,o,u){s.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=u,o.width=u,o.style.height=u+"px",o.style.width=u+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,u,d){let m=d,h=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(h=i()),m=t.getOptions(m);const v=t.getImageWidth(o.modules.size,m),p=h.getContext("2d"),x=p.createImageData(v,v);return t.qrToImageData(x.data,o,m),r(p,h,v),p.putImageData(x,0,0),h},e.renderToDataURL=function(o,u,d){let m=d;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const h=e.render(o,u,m),v=m.type||"image/png",p=m.rendererOpts||{};return h.toDataURL(v,p.quality)}})(Wv)),Wv}var Vv={},E2;function qU(){if(E2)return Vv;E2=1;const e=FT();function t(s,o){const u=s.a/255,d=o+'="'+s.hex+'"';return u<1?d+" "+o+'-opacity="'+u.toFixed(2).slice(1)+'"':d}function r(s,o,u){let d=s+o;return typeof u<"u"&&(d+=" "+u),d}function i(s,o,u){let d="",m=0,h=!1,v=0;for(let p=0;p<s.length;p++){const x=Math.floor(p%o),b=Math.floor(p/o);!x&&!h&&(h=!0),s[p]?(v++,p>0&&x>0&&s[p-1]||(d+=h?r("M",x+u,.5+b+u):r("m",m,0),m=0,h=!1),x+1<o&&s[p+1]||(d+=r("h",v),v=0)):m++}return d}return Vv.render=function(o,u,d){const m=e.getOptions(u),h=o.modules.size,v=o.modules.data,p=h+m.margin*2,x=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+p+"v"+p+'H0z"/>':"",b="<path "+t(m.color.dark,"stroke")+' d="'+i(v,h,m.margin)+'"/>',w='viewBox="0 0 '+p+" "+p+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+w+' shape-rendering="crispEdges">'+x+b+`</svg>
530
- `;return typeof d=="function"&&d(null,E),E},Vv}var R2;function VU(){if(R2)return Ml;R2=1;const e=RU(),t=FU(),r=WU(),i=qU();function s(o,u,d,m,h){const v=[].slice.call(arguments,1),p=v.length,x=typeof v[p-1]=="function";if(!x&&!e())throw new Error("Callback required as last argument");if(x){if(p<2)throw new Error("Too few arguments provided");p===2?(h=d,d=u,u=m=void 0):p===3&&(u.getContext&&typeof h>"u"?(h=m,m=void 0):(h=m,m=d,d=u,u=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(d=u,u=m=void 0):p===2&&!u.getContext&&(m=d,d=u,u=void 0),new Promise(function(b,w){try{const C=t.create(d,m);b(o(C,u,m))}catch(C){w(C)}})}try{const b=t.create(d,m);h(null,o(b,u,m))}catch(b){h(b)}}return Ml.create=t.create,Ml.toCanvas=s.bind(null,r.render),Ml.toDataURL=s.bind(null,r.renderToDataURL),Ml.toString=s.bind(null,function(o,u,d){return i.render(o,d)}),Ml}var GU=VU();const YU=gx(GU);function k2({lines:e}){const t=g.useRef(null);return g.useEffect(()=>{var r;(r=t.current)==null||r.scrollTo({top:t.current.scrollHeight})},[e]),e.length===0?null:l.jsx("div",{ref:t,className:"max-h-48 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2 font-mono text-xs",children:e.map((r,i)=>l.jsx("div",{className:"whitespace-pre-wrap break-all",children:r},i))})}function WT({channelId:e,onDone:t,onCancel:r}){const[i,s]=g.useState("running"),[o,u]=g.useState(),[d,m]=g.useState(),[h,v]=g.useState([]),[p,x]=g.useState();return g.useEffect(()=>{const b=new AbortController;let w=!1;const C=E=>{switch(E.event){case"qr":{const S=String(E.data.url??"");m(S),YU.toDataURL(S,{margin:1,width:224}).then(u).catch(()=>{});break}case"link":m(String(E.data.url??""));break;case"status":v(S=>[...S,String(E.data.text??"")]);break;case"done":w=!0,s("done"),t();break;case"error":w=!0,s("error"),x(String(E.data.message??"authorization failed"));break;default:E.data.url?m(String(E.data.url)):v(S=>[...S,JSON.stringify(E.data)])}};return xe.authorizeChannel(e,C,b.signal).then(()=>{w||(s("error"),x("connection closed before completion"))}).catch(E=>{b.signal.aborted||w||(s("error"),x(E instanceof Error?E.message:String(E)))}),()=>b.abort()},[e,t]),i==="done"?l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Authorized — credentials saved."}):i==="error"?l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("p",{className:"text-sm text-[var(--destructive)]",children:["Authorization failed: ",p]}),l.jsx(k2,{lines:h}),l.jsx(he,{variant:"outline",size:"sm",onClick:r,children:"Close"})]}):l.jsxs("div",{className:"grid gap-3 text-center",children:[o?l.jsx("img",{src:o,alt:"Scan to authorize",className:"mx-auto rounded-md border border-[var(--border)] bg-white p-2",width:224,height:224}):l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Starting authorization…"}),d&&l.jsx("a",{href:d,target:"_blank",rel:"noreferrer",className:"break-all text-xs text-[var(--primary)] underline",children:"Or open this link"}),l.jsx(k2,{lines:h}),l.jsx(he,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function KU(e,t){const r={};for(const i of e){const s=t[i.key]??i.default;if(i.type==="boolean"){r[i.key]=typeof s=="boolean"?s:!1;continue}if(s==null||String(s).trim()===""){if(i.required)throw new Error(`${i.label} is required`);continue}if(i.type==="number"){const o=typeof s=="number"?s:Number(s);if(!Number.isFinite(o))throw new Error(`${i.label} must be a number`);r[i.key]=o;continue}r[i.key]=String(s).trim()}return r}function XU({schema:e,values:t,onChange:r}){function i(s,o){r({...t,[s]:o})}return l.jsx("div",{className:"grid gap-3",children:e.map(s=>l.jsx(ZU,{label:s.label,help:s.help,required:s.required,children:s.type==="boolean"?l.jsx("input",{type:"checkbox",className:"size-4",checked:!!(t[s.key]??s.default??!1),onChange:o=>i(s.key,o.target.checked)}):s.type==="select"?l.jsx(ja,{className:"w-full",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value),children:(s.options??[]).map(o=>l.jsx("option",{value:o.value,children:o.label},o.value))}):l.jsx(Et,{type:s.type==="secret"?"password":s.type==="number"?"number":"text",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value)})},s.key))})}function ZU({label:e,help:t,required:r,children:i}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs(Ur,{children:[e,r&&l.jsx("span",{className:"ml-0.5 text-[var(--destructive)]",children:"*"})]}),i,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}function QU(e){return!!(e.options&&Object.keys(e.options).length>0)}function JU({channels:e,channelTypes:t,onChange:r}){const[i,s]=g.useState(!1),[o,u]=g.useState(null),d=g.useMemo(()=>new Map(t.map(h=>[h.type,h])),[t]);async function m(h,v){try{await v(),_e.success(h),await r()}catch(p){_e.error(`${h} failed: ${p.message}`)}}return l.jsxs(Yr,{children:[l.jsxs(_i,{children:[l.jsxs(Jr,{children:["Channels ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:()=>s(!0),disabled:t.length===0,children:[l.jsx(en,{})," Add channel"]})]}),l.jsx(ei,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Credentials"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:4,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No chat plugins installed. Install one via: rynx plugin manage install <source>.":"No channels. Add one to configure a connection."})}),e.map(h=>{var v;return l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:h.name}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:h.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:h.type}),l.jsx("td",{className:"px-3 py-3",children:QU(h)?l.jsx(_t,{variant:"success",children:"● set"}):l.jsx(_t,{variant:"outline",children:"○ needs setup"})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[((v=d.get(h.type))==null?void 0:v.authorize)&&l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:[l.jsx(jR,{})," Authorize"]}),l.jsx(eH,{name:h.name,onDeleted:()=>m("Deleted",()=>xe.deleteChannel(h.id))})]})})]},h.id)})]})]})}),i&&l.jsx(tH,{channelTypes:t,onClose:()=>s(!1),onAdded:async()=>{s(!1),await r()}}),o&&l.jsx(Oo,{open:!0,onOpenChange:h=>!h&&u(null),children:l.jsxs(Ua,{children:[l.jsx(Bo,{children:l.jsxs(Ha,{children:['Authorize "',o.name,'"']})}),l.jsx(WT,{channelId:o.id,onDone:()=>{_e.success("Authorized"),u(null),r()},onCancel:()=>u(null)})]})})]})}function eH({name:e,onDeleted:t}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Ia,{})})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:['Delete channel "',e,'"?']}),l.jsx(nn,{children:"This removes its credentials and any instance bound to it (which is stopped first)."})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function tH({channelTypes:e,onClose:t,onAdded:r}){var N;const[i,s]=g.useState(""),[o,u]=g.useState(((N=e[0])==null?void 0:N.type)??""),[d,m]=g.useState("manual"),[h,v]=g.useState({}),[p,x]=g.useState(null),b=g.useMemo(()=>e.find(k=>k.type===o),[e,o]),w=(b==null?void 0:b.configSchema)??[],C=!!(b!=null&&b.authorize);function E(k){u(k),v({});const R=e.find(M=>M.type===k);m(R!=null&&R.authorize?"authorize":"manual")}async function S(){if(!i.trim())return _e.error("Channel name is required");if(!o)return _e.error("Pick a channel type");try{if(d==="authorize"){const{id:k}=await xe.createChannel({name:i.trim(),type:o});x(k)}else await xe.createChannel({name:i.trim(),type:o,options:KU(w,h)}),_e.success(`Channel "${i}" created`),await r()}catch(k){_e.error(`Create failed: ${k.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:k=>!k&&t(),children:l.jsxs(Ua,{children:[l.jsx(Bo,{children:l.jsx(Ha,{children:"Add channel"})}),p?l.jsx(WT,{channelId:p,onDone:async()=>{_e.success(`Channel "${i}" authorized`),await r()},onCancel:()=>void r()}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsx(Gv,{label:"Channel name",children:l.jsx(Et,{value:i,onChange:k=>s(k.target.value),placeholder:"lark-prod"})}),l.jsx(Gv,{label:"Type",children:l.jsx(ja,{value:o,onChange:k=>E(k.target.value),className:"w-full",children:e.map(k=>l.jsx("option",{value:k.type,children:k.type},k.type))})}),C&&l.jsx(Gv,{label:"Setup",children:l.jsxs(ja,{value:d,onChange:k=>m(k.target.value),className:"w-full",children:[l.jsx("option",{value:"authorize",children:"Scan / authorize"}),l.jsx("option",{value:"manual",children:"Enter credentials manually"})]})}),d==="manual"&&w.length>0&&l.jsx(XU,{schema:w,values:h,onChange:v})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:S,children:d==="authorize"?"Create & authorize":"Create"})]})]})]})})}function Gv({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{children:e}),t]})}async function qT(e,t){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{return await navigator.clipboard.writeText(e),"clipboard"}catch{}if(!t||typeof document>"u")return"unavailable";t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);try{if(typeof document.execCommand=="function"&&document.execCommand("copy"))return"selection"}catch{}return"selected"}const N2="127.0.0.1:9333";function rH({embedded:e=!1}={}){const t=ac(),r=g.useRef(null),[i,s]=g.useState(null),[o,u]=g.useState(null),[d,m]=g.useState("load"),h=g.useCallback(async()=>{if(!t){m(null),u("Chrome inspection is available only in the Rynx app.");return}m("load"),u(null);try{s(await t.getChromeInspectionStatus())}catch(w){u(w.message)}finally{m(null)}},[t]);g.useEffect(()=>{h()},[h]);async function v(w){if(t){m("save"),u(null);try{s(await t.configureChromeInspection(w))}catch(C){const E=C.message;u(E),_e.error(`Could not update Chrome inspection: ${E}`)}finally{m(null)}}}async function p(){const w=await qT(N2,r.current);w==="clipboard"||w==="selection"?_e.success("Address copied"):w==="selected"?_e.info("Address selected — copy it manually"):_e.error("Copy is unavailable")}const x=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(Yr,{"aria-busy":d!==null,children:[l.jsxs(_i,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Jr,{children:"DevTools discovery"}),i&&l.jsx(iH,{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(he,{variant:"outline",size:"sm",disabled:b,onClick:()=>void h(),children:[l.jsx(At,{className:d==="load"?"animate-spin":""}),"Check"]})]}),l.jsxs(ei,{className:"grid gap-5",children:[i&&x?l.jsxs(l.Fragment,{children:[l.jsx(nH,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:l.jsx(fT,{"aria-label":"Enable Chrome inspection",checked:x.enabled,disabled:b,onCheckedChange:w=>void v({...x,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(A2,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:x.includeLocal,disabled:b||!x.enabled,onChange:w=>void v({...x,includeLocal:w})}),i.remotes.map(w=>l.jsx(A2,{title:w.displayName,detail:aH(w.status),badge:w.status,checked:x.remoteDaemonIds.includes(w.daemonId),disabled:b||!x.enabled||w.status==="incompatible",onChange:C=>void v({...x,remoteDaemonIds:C?[...x.remoteDaemonIds,w.daemonId]:x.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(Et,{ref:r,value:N2,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),l.jsxs(he,{variant:"outline",onClick:()=>void p(),"aria-label":"Copy Chrome inspection address",children:[l.jsx(TR,{}),"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(Ra,{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(Ra,{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(Ve,{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(Ra,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:o})]})]})]})]})}function iH({status:e}){return e.runtime.state==="listening"?l.jsxs(_t,{variant:"success",children:[l.jsx(Pa,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?l.jsx(_t,{variant:"warning",children:"Needs attention"}):l.jsx(_t,{variant:"outline",children:"Off"})}function nH({title:e,description:t,children:r}){return l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-sm font-medium",children:e}),l.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:t})]}),r]})}function A2({title:e,detail:t,badge:r,checked:i,disabled:s,onChange:o}){return l.jsxs("label",{className:Fe("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",s&&"opacity-55"),children:[l.jsx("input",{type:"checkbox",checked:i,disabled:s,onChange:u=>o(u.target.checked),className:"size-4 accent-[var(--primary)]"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e,r&&l.jsx(_t,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:sH(r)})]}),l.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function sH(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function aH(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function oH({embedded:e=!1}={}){const t=ac(),[r,i]=g.useState(null),[s,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 h(v){if(t){d("permission"),o(null);try{await t.openSystemSettings(v),_e.message("After granting access, return to Rynx and click Check again.")}catch(p){const x=p.message;o(x),_e.error(`Could not open System Settings: ${x}`)}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(Yr,{"aria-busy":u!==null,children:[l.jsxs(_i,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Jr,{children:"macOS permissions"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This page checks readiness only. Permissions remain under your control in System Settings."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(),children:[l.jsx(At,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(ei,{className:"grid gap-3",children:[r?l.jsxs(l.Fragment,{children:[l.jsx(T2,{icon:l.jsx(SB,{className:"size-4"}),ready:r.permissions.accessibility==="granted",title:"Accessibility",description:M2(r.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:r.permissions.accessibility!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void h("accessibility"),children:[l.jsx(sC,{}),"Open Settings"]}):void 0}),l.jsx(T2,{icon:l.jsx(XO,{className:"size-4"}),ready:r.permissions.screenRecording==="granted",title:"Screen Recording",description:M2(r.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:r.permissions.screenRecording!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void h("screen-recording"),children:[l.jsx(sC,{}),"Open Settings"]}):void 0})]}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="refresh"&&l.jsx(Ve,{className:"size-4 animate-spin"}),u==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),s&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(ec,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})]})]})}function T2({icon:e,ready:t,title:r,description:i,action:s}){return l.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[l.jsx("span",{className:t?"grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:t?l.jsx(Pa,{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(_t,{variant:t?"success":"warning",children:t?"Ready":"Needs access"})]}),l.jsx("p",{className:"mt-1 break-words text-xs leading-5 text-[var(--muted-foreground)]",children:i})]}),s&&l.jsx("div",{className:"sm:justify-self-end",children:s})]})}function M2(e,t){switch(e){case"granted":return t;case"not-granted":return"Not granted. Open System Settings to allow access.";case"unknown":return"Rynx could not determine this permission. Open System Settings to verify it."}}function lH(){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(oH,{embedded:!0}),l.jsx(rH,{embedded:!0})]})}const cH=700,uH=250,j2=33333,hf=new Uint8Array([0,0,0,1]);function dH(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Yv(e,t){for(let r=t;r<=e.length-3;r+=1)if(!(e[r]!==0||e[r+1]!==0)){if(e[r+2]===1)return{index:r,length:3};if(r<=e.length-4&&e[r+2]===0&&e[r+3]===1)return{index:r,length:4}}return null}function D2(e,t){const r=dH(e,t),i=Yv(r,0);if(!i)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const s=[];let o=i.index,u=i.index+i.length,d=Yv(r,u);for(;d;)d.index>u&&s.push(r.slice(u,d.index)),o=d.index,u=d.index+d.length,d=Yv(r,u);return{nals:s,pending:r.slice(o)}}function Mm(e){return e[0]&31}function hH(e){if(Mm(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 fH(e){const t=e.reduce((s,o)=>s+hf.length+o.length,0),r=new Uint8Array(t);let i=0;for(const s of e)r.set(hf,i),i+=hf.length,r.set(s,i),i+=s.length;return r}function L2(e){const t=Mm(e);return t===1||t===5}function mH(e){return e.some(t=>Mm(t)===5)}function Kv(e,t,r,i){(e.width!==r||e.height!==i)&&(e.width=r,e.height=i);const s=e.getContext("2d");s&&s.drawImage(t,0,0,r,i)}function pH(e,t){return new Promise((r,i)=>{if(t.aborted){i(t.reason);return}const s=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(s),i(t.reason)},{once:!0})})}function O2(e){return e instanceof Error?e.message:String(e)}function gH(e){return e instanceof DOMException&&e.name==="AbortError"}function vH({device:e,alt:t,mediaRef:r,onFrameSize:i}){const s=g.useRef(null),o=g.useRef(!1),u=g.useRef(!1),d=g.useRef(null),[m,h]=g.useState("video"),[v,p]=g.useState(!1),[x,b]=g.useState("Loading preview..."),w=g.useCallback(S=>{s.current=S,r==null||r(S)},[r]),C=g.useCallback(()=>{o.current||(o.current=!0,p(!0),b(""))},[]),E=g.useCallback((S,N)=>{const k=d.current;(k==null?void 0:k.width)===S&&k.height===N||(d.current={width:S,height:N},i==null||i(S,N))},[i]);return g.useEffect(()=>{o.current=!1,u.current=!1,d.current=null,p(!1),b("Loading preview..."),h("video")},[e]),g.useEffect(()=>{if(m!=="video"||o.current)return;let S=!1;return(async()=>{try{const k=await xe.emulatorFrameBlob(e);if(S||o.current)return;const R=await createImageBitmap(k);try{const M=s.current;M&&!o.current&&(Kv(M,R,R.width,R.height),E(R.width,R.height),C())}finally{R.close()}}catch{}})(),()=>{S=!0}},[e,C,m,E]),g.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){b("Video decoder unavailable"),h("fallback");return}const S=new AbortController,N=R=>{const M=s.current;try{if(M){const L=R.displayWidth||R.codedWidth,$=R.displayHeight||R.codedHeight;Kv(M,R,L,$),E(L,$),u.current=!0,C()}}finally{R.close()}};return(async()=>{for(;!S.signal.aborted;){let R=null,M=null,L=new Uint8Array,$=[],D=!1,q=0,G="avc1.42E01F";const W=async()=>{if(R)return R;const O={codec:G,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(O)).supported)throw new Error(`Unsupported Android video codec: ${G}`);return R=new VideoDecoder({output:N,error:T=>{b(T.message)}}),R.configure(O),R},B=async()=>{if(!D){$=[];return}const O=await W(),z=mH($),T=fH($),U=q;q+=j2,$=[],D=!1,!(O.decodeQueueSize>2&&!z)&&O.decode(new EncodedVideoChunk({type:z?"key":"delta",timestamp:U,duration:j2,data:T}))},j=async O=>{const z=hH(O);z&&(G=z),(Mm(O)===9||L2(O))&&D&&await B(),$.push(O),L2(O)&&(D=!0)};try{const O=await fetch(xe.emulatorVideoStreamUrl(e),{cache:"no-store",signal:S.signal});if(!O.ok||!O.body)throw new Error(`Android video stream failed: ${O.status}`);for(M=O.body.getReader();;){const{done:T,value:U}=await M.read();if(T)break;const H=D2(L,U);L=H.pending;for(const F of H.nals)await j(F)}const z=D2(L,hf);for(const T of z.nals)await j(T);await B(),(R==null?void 0:R.state)==="configured"&&await R.flush()}catch(O){if(S.signal.aborted||gH(O))break;if(b(O2(O)),!u.current){h("fallback");break}}finally{try{M==null||M.releaseLock()}catch{}(R==null?void 0:R.state)!=="closed"&&(R==null||R.close())}S.signal.aborted||await pH(uH,S.signal).catch(()=>{})}})(),()=>{S.abort()}},[e,C,m,E]),g.useEffect(()=>{if(m!=="fallback")return;let S=!1,N;const k=async()=>{try{const R=await xe.emulatorFrameBlob(e);if(S)return;const M=await createImageBitmap(R);try{const L=s.current;L&&(Kv(L,M,M.width,M.height),E(M.width,M.height),C())}finally{M.close()}}catch(R){S||b(O2(R))}finally{S||(N=window.setTimeout(k,cH))}};return k(),()=>{S=!0,N&&window.clearTimeout(N)}},[e,C,m,E]),l.jsxs("div",{className:"relative h-full w-full",children:[l.jsx("canvas",{ref:w,"aria-label":t,width:720,height:1520,className:"pointer-events-none h-full w-full select-none object-contain"}),!v&&l.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:x})]})}const B2=8,_H=.012,xH=1500,yH=35,bH=260,wH=40,SH=3,CH=5e3,EH=750;function P2(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function I2(e,t,r){return Math.max(t,Math.min(r,e))}function z2(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function RH(e){const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const r="naturalWidth"in e?e.naturalWidth||t.width:e.width||t.width,i="naturalHeight"in e?e.naturalHeight||t.height:e.height||t.height;if(r<=0||i<=0)return t;const s=r/i;if(t.width/t.height>s){const d=t.height*s;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const u=t.width/s;return new DOMRect(t.left,t.top+(t.height-u)/2,t.width,u)}function Xv(e,t,r){if(!e)return null;const i=RH(e);if(!i)return null;const s=(t.clientX-i.left)/i.width,o=(t.clientY-i.top)/i.height;return!r&&(s<0||s>1||o<0||o>1)?null:{x:I2(s,0,1),y:I2(o,0,1)}}function kH(e){return new Promise(t=>setTimeout(t,e))}function NH(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=SH,r.set(t,1),r.buffer}function AH(){const[e,t]=g.useState([]),[r,i]=g.useState(null),[s,o]=g.useState(!0),[u,d]=g.useState(null),[m,h]=g.useState(null),[v,p]=g.useState(!1),[x,b]=g.useState(null),[w,C]=g.useState(null),[E,S]=g.useState(!1),[N,k]=g.useState(0),R=g.useRef(null),M=g.useRef(null),L=g.useRef(null),$=g.useRef(null),D=g.useRef(null),q=g.useRef(null),G=g.useCallback(async()=>{o(!0);try{const[Q,re]=await Promise.all([xe.emulatorDevices(),xe.activeEmulator()]);t(Q),i(re)}catch(Q){_e.error(`Failed to load emulator: ${Q.message}`)}finally{o(!1)}},[]);g.useEffect(()=>{G()},[G]),g.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current),M.current!==null&&window.clearTimeout(M.current)},[]),g.useEffect(()=>()=>{var re;const Q=(re=$.current)==null?void 0:re.socket;$.current=null,Q&&Q.readyState!==WebSocket.CLOSED&&Q.close()},[r==null?void 0:r.wsUrl]),g.useEffect(()=>{var Q;if((r==null?void 0:r.backend)!=="android"){const re=(Q=D.current)==null?void 0:Q.socket;D.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close();return}return oe(r.deviceUdid).catch(()=>{}),()=>{var ye;const re=(ye=D.current)==null?void 0:ye.socket;D.current=null,re&&re.readyState!==WebSocket.CLOSED&&re.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const W=(r==null?void 0:r.streamUrl)??null,B=W&&N>0?`${W}${W.includes("?")?"&":"?"}rynx_preview_retry=${N}`:W,j=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,O=!!(W||j),z=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},T=g.useCallback((Q,re)=>{if(!Number.isFinite(Q)||!Number.isFinite(re)||Q<=0||re<=0)return;const ye=Q/re;C(me=>me!==null&&Math.abs(me-ye)<1e-4?me:ye)},[]),U=g.useCallback(()=>{M.current!==null&&(window.clearTimeout(M.current),M.current=null)},[]),H=g.useCallback((Q,re)=>{U(),T(Q,re),S(!0)},[U,T]),F=g.useCallback(()=>{S(!1),M.current===null&&(M.current=window.setTimeout(()=>{M.current=null,k(Q=>Q+1)},EH))},[]);g.useEffect(()=>{if(U(),C(null),S(!1),k(0),!W)return;const Q=()=>{const ye=R.current;ye instanceof HTMLImageElement&&ye.naturalWidth>0&&ye.naturalHeight>0&&H(ye.naturalWidth,ye.naturalHeight)};Q();const re=window.setInterval(Q,500);return()=>window.clearInterval(re)},[U,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,H,W]),g.useEffect(()=>{if(!W||E)return;const Q=window.setTimeout(F,CH);return()=>window.clearTimeout(Q)},[N,E,W,F]);async function V(Q){if(r){b("home");try{await xe.buttonEmulator(Q,r.deviceUdid)}catch(re){_e.error(`${Q==="appswitch"?"App switcher":"Home"} failed: ${re.message}`)}finally{b(null)}}}function I(){if(!(!r||x)){if(L.current!==null){window.clearTimeout(L.current),L.current=null,V("appswitch");return}L.current=window.setTimeout(()=>{L.current=null,V("home")},bH)}}async function Y(Q,re){const ye=(r==null?void 0:r.deviceUdid)===Q;L.current!==null&&(window.clearTimeout(L.current),L.current=null),h(Q),ye&&b("shutdown");try{await xe.shutdownEmulator(Q),ye&&i(null),_e.success(`Shutdown ${re}`),G()}catch(me){_e.error(`Shutdown failed: ${me.message}`)}finally{h(null),ye&&b(null)}}async function K(Q){d(Q.id);try{const re=await xe.attachEmulator(Q.id);i(re),_e.success(`Attached ${re.deviceName??re.deviceUdid}`),G()}catch(re){_e.error(`Attach failed: ${re.message}`)}finally{d(null)}}function ee(Q){var Ae;const re=$.current;if((re==null?void 0:re.url)===Q){if(((Ae=re.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const ye={url:Q,socket:null,connecting:null},me=new Promise((Le,je)=>{const Ye=new WebSocket(Q),at=window.setTimeout(()=>{Ye.close(),je(new Error("Timed out connecting to emulator gesture stream."))},1500),qe=()=>window.clearTimeout(at);Ye.binaryType="arraybuffer",Ye.addEventListener("open",()=>{qe(),ye.socket=Ye,ye.connecting=null,Le(Ye)},{once:!0}),Ye.addEventListener("error",()=>{qe(),ye.connecting=null,je(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),Ye.addEventListener("close",()=>{var Pt;((Pt=$.current)==null?void 0:Pt.socket)===Ye&&($.current=null)})});return ye.connecting=me,$.current=ye,me}function oe(Q){var Ae;const re=D.current;if((re==null?void 0:re.device)===Q){if(((Ae=re.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(re.socket);if(re.connecting)return re.connecting}else re!=null&&re.socket&&re.socket.readyState!==WebSocket.CLOSED&&re.socket.close();const ye={device:Q,socket:null,connecting:null},me=new Promise((Le,je)=>{const Ye=new WebSocket(z9(Q));let at=!1;const qe=window.setTimeout(()=>{at||(at=!0,Ye.close(),je(new Error("Timed out connecting to Android touch stream.")))},xH),Pt=()=>window.clearTimeout(qe);Ye.addEventListener("message",Ie=>{if(!at&&typeof Ie.data=="string")try{const Mt=JSON.parse(Ie.data);Mt.t==="opened"?(at=!0,Pt(),ye.socket=Ye,ye.connecting=null,Le(Ye)):Mt.t==="error"&&(at=!0,Pt(),ye.connecting=null,je(new Error(Mt.message??"Android touch stream failed.")))}catch{}}),Ye.addEventListener("error",()=>{at||(at=!0,Pt(),ye.connecting=null,je(new Error("Failed to connect to Android touch stream.")))},{once:!0}),Ye.addEventListener("close",()=>{var Ie;Pt(),ye.connecting=null,at||(at=!0,je(new Error("Android touch stream closed before it was ready."))),((Ie=D.current)==null?void 0:Ie.socket)===Ye&&(D.current=null)})});return ye.connecting=me,D.current=ye,me}async function ce(Q,re){if(Q.backend==="android"){if(Q.liveFailed)return!1;try{return(await oe(Q.device)).send(JSON.stringify(re)),Q.sentLiveFrames+=1,!0}catch(ye){return Q.liveFailed=!0,Q.sentLiveFrames>0&&_e.error(`Android touch stream failed: ${ye.message}`),!1}}if(!Q.wsUrl||Q.liveFailed)return!1;try{return(await ee(Q.wsUrl)).send(NH(re)),Q.sentLiveFrames+=1,!0}catch(ye){return Q.liveFailed=!0,Q.sentLiveFrames>0&&_e.error(`Gesture stream failed: ${ye.message}`),!1}}function Z(Q,re){xe.gestureEmulator([{type:"begin",x:Q.x,y:Q.y}],re).catch(ye=>{_e.error(`Tap failed: ${ye.message}`)})}function le(Q,re){xe.gestureEmulator(Q,re).catch(ye=>{_e.error(`Gesture failed: ${ye.message}`)})}function ie(Q){if(!r||!O||!Q.isPrimary||Q.pointerType==="mouse"&&Q.button!==0)return;const re=Xv(R.current,Q,!1);re&&(Q.preventDefault(),Q.currentTarget.setPointerCapture(Q.pointerId),q.current={backend:r.backend,pointerId:Q.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:Q.clientX,startClientY:Q.clientY,lastPoint:re,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:re.x,y:re.y}]},ce(q.current,{type:"begin",x:re.x,y:re.y}),p(!0))}function Se(Q){const re=q.current;if(!re||re.pointerId!==Q.pointerId)return;const ye=Xv(R.current,Q,!0);if(!ye)return;Q.preventDefault();const me=Math.hypot(Q.clientX-re.startClientX,Q.clientY-re.startClientY)>B2,Ae=z2(ye,re.lastPoint)>_H;if(re.lastPoint=ye,me&&(Ae||!re.moved)){re.moved=!0;const Le={type:"move",x:ye.x,y:ye.y};re.points.push(Le),ce(re,Le)}}async function be(Q){const re=q.current;if(!re||re.pointerId!==Q.pointerId)return;Q.preventDefault();const ye=Xv(R.current,Q,!0)??re.lastPoint,me=Math.hypot(Q.clientX-re.startClientX,Q.clientY-re.startClientY)>B2;q.current=null,p(!1);try{Q.currentTarget.releasePointerCapture(Q.pointerId)}catch{}const Ae={type:"end",x:ye.x,y:ye.y};if((re.backend==="android"||re.wsUrl)&&!re.liveFailed&&(!re.moved&&!me&&await kH(re.backend==="android"?yH:wH),await ce(re,Ae)||re.sentLiveFrames>0))return;if(!re.moved&&!me){Z(ye,re.device);return}const Le=[...re.points],je=Le[Le.length-1];je&&z2(je,ye)<=.001?Le[Le.length-1]=Ae:Le.push(Ae),le(Le,re.device)}function Ce(Q){const re=q.current;!re||re.pointerId!==Q.pointerId||(q.current=null,p(!1),(re.backend==="android"||re.wsUrl)&&!re.liveFailed&&ce(re,{type:"end",x:re.lastPoint.x,y:re.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(Yr,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(_i,{className:"px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(Jr,{className:"flex items-center gap-2",children:[l.jsx(LR,{className:"size-4"}),"Preview"]}),l.jsx("div",{className:"label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]",children:r?`This device · ${r.backend} · ${r.deviceName??r.deviceUdid}`:"This device · not attached"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:I,disabled:!r||x!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:l.jsx(MR,{className:Fe(x==="home"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&Y(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||x!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:l.jsx(z_,{className:Fe(x==="shutdown"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void G(),disabled:s,"aria-label":"Refresh emulator",title:"Refresh",children:l.jsx(At,{className:Fe(s&&"animate-spin")})})]})]}),l.jsxs(ei,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":O&&!E,children:[O?l.jsx("div",{className:Fe("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?z:void 0,onPointerDown:ie,onPointerMove:Se,onPointerUp:be,onPointerCancel:Ce,children:W?l.jsx("img",{ref:Q=>{R.current=Q},src:B??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:Q=>{H(Q.currentTarget.naturalWidth,Q.currentTarget.naturalHeight)},onError:F,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${N}`):r&&j?l.jsx(vH,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:Q=>{R.current=Q},onFrameSize:H},r.deviceUdid):null}):l.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),O&&!E&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[l.jsx(At,{className:"size-4 animate-spin text-[var(--primary)]"}),l.jsx("span",{children:"Loading preview…"})]})})]})]}),l.jsxs(Yr,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(_i,{children:[l.jsxs(Jr,{className:"flex items-center gap-2",children:[l.jsx(Yl,{className:"size-4"}),"Devices"]}),l.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),l.jsx(ei,{className:"min-h-0 flex-1 p-0",children:e.length===0?l.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:s?"Loading...":"No devices"}):l.jsx(bn,{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(Q=>{const re=(r==null?void 0:r.deviceUdid)===Q.id,ye=u===Q.id,me=m===Q.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(Yl,{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:Q.name}),l.jsxs(_t,{variant:Q.state==="booted"?"success":Q.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"}),Q.state]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:P2(Q),children:P2(Q)})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(he,{size:"xs",variant:re?"outline":"default",onClick:()=>void K(Q),disabled:ye||m!==null,children:ye?"Attaching…":re?"Reattach":"Attach"}),Q.state==="booted"&&l.jsx(he,{size:"icon-xs",variant:"destructive",onClick:()=>void Y(Q.id,Q.name),disabled:u!==null||m!==null,"aria-label":`Shutdown ${Q.name}`,title:`Shutdown ${Q.name}`,children:l.jsx(z_,{className:Fe(me&&"animate-pulse")})})]})]},`${Q.backend}:${Q.id}`)})})})})]})]})}function VT({inst:e}){return e.running?e.connected===!1||e.lastError?l.jsx(_t,{variant:"destructive",children:"● error"}):e.connected&&!e.lastEventAt?l.jsx(_t,{variant:"default",children:"● connected (idle)"}):e.connected?l.jsx(_t,{variant:"success",children:"● connected"}):l.jsx(_t,{variant:"default",children:"● running"}):l.jsx(_t,{variant:"outline",children:"● stopped"})}function TH({instances:e,channels:t,agents:r,onChange:i}){const[s,o]=g.useState(!1),u=g.useMemo(()=>new Set(e.map(h=>h.channelId)),[e]),d=t.filter(h=>!u.has(h.id));async function m(h,v){try{await v(),_e.success(h),await i()}catch(p){_e.error(`${h} failed: ${p.message}`)}}return l.jsxs(Yr,{children:[l.jsxs(_i,{children:[l.jsxs(Jr,{children:["Instances ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void i(),children:[l.jsx(At,{})," Refresh"]}),l.jsxs(he,{size:"sm",onClick:()=>o(!0),disabled:d.length===0,children:[l.jsx(en,{})," Add instance"]})]})]}),l.jsx(ei,{className:"p-0",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"label-caps border-b border-[var(--border)] text-left text-xs text-[var(--muted-foreground)]",children:[l.jsx("th",{className:"px-5 py-2.5 font-medium",children:"Channel"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Type"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Status"}),l.jsx("th",{className:"px-3 py-2.5 font-medium",children:"Agent"}),l.jsx("th",{className:"px-5 py-2.5 text-right font-medium",children:"Actions"})]})}),l.jsxs("tbody",{children:[e.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:5,className:"px-5 py-8 text-center text-[var(--muted-foreground)]",children:t.length===0?"No channels yet. Configure one on the Channels tab first.":"No instances. Bind a channel to an agent to start it."})}),e.map(h=>l.jsxs("tr",{className:"border-b border-[var(--border)] last:border-0 hover:bg-[var(--muted)]/40",children:[l.jsxs("td",{className:"px-5 py-3",children:[l.jsx("div",{className:"font-medium",children:h.channelName}),l.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:h.id})]}),l.jsx("td",{className:"px-3 py-3 text-[var(--muted-foreground)]",children:h.type}),l.jsxs("td",{className:"px-3 py-3",children:[l.jsx(VT,{inst:h}),h.lastError&&l.jsx("div",{className:"mt-0.5 max-w-[16rem] truncate text-xs text-[var(--destructive)]",children:h.lastError})]}),l.jsx("td",{className:"px-3 py-3",children:l.jsxs(ja,{value:h.agent??"",onChange:v=>void m("Agent updated",()=>xe.updateInstance(h.id,{agent:v.target.value||void 0})),children:[l.jsx("option",{value:"",children:"(none)"}),r.map(v=>l.jsx("option",{value:v.id,children:v.name??v.id},v.id))]})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[h.enabled?l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Disabled",()=>xe.instanceAction(h.id,"disable")),children:[l.jsx(mB,{})," Disable"]}):l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Enabled",()=>xe.instanceAction(h.id,"enable")),children:[l.jsx(BR,{})," Enable"]}),l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>void m("Restarted",()=>xe.instanceAction(h.id,"restart")),children:[l.jsx(PR,{})," Restart"]}),l.jsx(MH,{name:h.channelName,onDeleted:()=>m("Deleted",()=>xe.deleteInstance(h.id))})]})})]},h.id))]})]})}),s&&l.jsx(jH,{freeChannels:d,agents:r,onClose:()=>o(!1),onAdded:async()=>{o(!1),await i()}})]})}function MH({name:e,onDeleted:t}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Ia,{})})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:['Delete instance for "',e,'"?']}),l.jsx(nn,{children:"This stops the binding. The channel + its credentials stay; you can re-bind it later."})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function jH({freeChannels:e,agents:t,onClose:r,onAdded:i}){var h;const[s,o]=g.useState(((h=e[0])==null?void 0:h.id)??""),[u,d]=g.useState("");async function m(){if(!s)return _e.error("Pick a channel");try{await xe.createInstance({channelId:s,agent:u||void 0}),_e.success("Instance created"),await i()}catch(v){_e.error(`Create failed: ${v.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:v=>!v&&r(),children:l.jsxs(Ua,{children:[l.jsx(Bo,{children:l.jsx(Ha,{children:"Add instance"})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsx($2,{label:"Channel",children:l.jsx(ja,{value:s,onChange:v=>o(v.target.value),className:"w-full",children:e.map(v=>l.jsxs("option",{value:v.id,children:[v.name," (",v.type,")"]},v.id))})}),l.jsx($2,{label:"Agent",children:l.jsxs(ja,{value:u,onChange:v=>d(v.target.value),className:"w-full",children:[l.jsx("option",{value:"",children:"(none)"}),t.map(v=>l.jsx("option",{value:v.id,children:v.name??v.id},v.id))]})})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:m,children:"Create"})]})]})})}function $2({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{children:e}),t]})}function DH({embedded:e=!1}={}){const t=ac(),[r,i]=g.useState(null),[s,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 h(p){if(!(!t||p===(r==null?void 0:r.runtime.lifecycleMode))){d(!0),o(null);try{i(await t.setDaemonLifecycleMode(p)),_e.success(p==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(x){const b=x.message;o(b),_e.error(`Could not change Runtime mode: ${b}`)}finally{d(!1)}}}async function v(){if(t){d(!0),o(null);try{i(await t.restartDaemon()),_e.success("Local Runtime restarted")}catch(p){const x=p.message;o(x),_e.error(`Could not restart Runtime: ${x}`)}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(Yr,{"aria-busy":u,children:[l.jsxs(_i,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Jr,{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(he,{variant:"outline",size:"sm",disabled:u,onClick:()=>void m(),children:[l.jsx(At,{className:u?"animate-spin":""}),"Check"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:u,onClick:()=>void v(),children:[l.jsx(At,{}),"Restart"]})]})]}),l.jsxs(ei,{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(ed,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium",children:"Runtime status"}),l.jsx(_t,{variant:r.runtime.ready?"success":"warning",children:LH(r.runtime.state)}),l.jsx(_t,{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??OH(r)})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Ur,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),l.jsxs(ja,{id:"daemon-lifecycle-mode",value:r.runtime.lifecycleMode,disabled:u,className:"max-w-sm",onChange:p=>void h(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(Ve,{className:"size-4 animate-spin"}),u?"Checking Runtime…":"Runtime status is unavailable."]}),s&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(ec,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})]})]})}function LH(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function OH(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 BH({embedded:e=!1}={}){const t=ac(),[r,i]=g.useState(null),[s,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 h(C){if(t){d("install"),o(null);try{i(await t.installCli(C)),_e.success("Terminal command installed")}catch(E){const S=E.message;o(S),_e.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)),_e.success("Terminal command removed")}catch(E){const S=E.message;o(S),_e.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,x=(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(Yr,{"aria-busy":u!==null,children:[l.jsxs(_i,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Jr,{children:"Shell access"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Removing the command does not uninstall Rynx or delete its data."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void m(!0),children:[l.jsx(At,{className:u==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(ei,{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:x?"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:x?l.jsx(Pa,{className:"size-5"}):l.jsx(Tx,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"font-mono text-sm font-medium",children:"rynx"}),l.jsx(_t,{variant:x?"success":b?"outline":"warning",children:PH(p.state)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:IH(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(he,{variant:"outline",size:"sm",disabled:u!==null,onClick:()=>p.path&&void h(p.path),children:[u==="install"&&l.jsx(Ve,{className:"animate-spin"}),w?"Move command":p.state==="stale"?"Repair command":"Install command"]}),p.canRemove&&l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsxs(he,{variant:"outline",size:"sm",disabled:u!==null,children:[l.jsx(Ia,{}),"Remove command"]})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsx(rn,{children:"Remove the Terminal command?"}),l.jsx(nn,{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(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{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(Ve,{className:"size-4 animate-spin"}),u==="refresh"?"Checking command…":"Command status is unavailable."]}),s&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(ec,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})]})]})}function PH(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 IH(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 zH(){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(DH,{embedded:!0}),l.jsx(BH,{embedded:!0})]})}function $H(){const{status:e,operation:t,error:r,checkForUpdates:i,installUpdate:s}=My(),o=t!==null||(e==null?void 0:e.phase)==="checking"||(e==null?void 0:e.phase)==="downloading"||(e==null?void 0:e.phase)==="installing",u=r??(e==null?void 0:e.error);async function d(){const m=await i();m&&(m.error?_e.error(`Could not check for updates: ${m.error}`):m.phase==="idle"?_e.success(`${m.appName} is up to date`):m.availableVersion&&_e.message(`Rynx ${m.availableVersion} is available`))}return l.jsxs(Yr,{id:"software-update",className:"scroll-mt-6","aria-busy":o,children:[l.jsxs(_i,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Jr,{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(he,{variant:"outline",size:"sm",disabled:o||!(e!=null&&e.supported),onClick:()=>void d(),children:[l.jsx(At,{className:t==="check"||(e==null?void 0:e.phase)==="checking"?"animate-spin":""}),"Check for updates"]})]}),l.jsxs(ei,{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:HH(e),children:l.jsx(UH,{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(_t,{variant:"outline",children:["Version ",e.currentVersion]}),l.jsx(_t,{variant:e.channel==="preview"?"warning":"default",children:WH(e.channel)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:FH(e)}),e.lastCheckedAt&&l.jsxs("p",{className:"mt-1 text-[10px] text-[var(--muted-foreground)]",children:["Last checked ",qH(e.lastCheckedAt)]})]}),e.phase==="ready"&&l.jsxs(he,{size:"sm",disabled:t==="install",onClick:()=>void s(),children:[t==="install"?l.jsx(Ve,{className:"animate-spin"}):l.jsx(Mu,{}),"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(Ve,{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(ec,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:u})]})]})]})}function UH({status:e}){return e.phase==="checking"||e.phase==="installing"?l.jsx(Ve,{className:"size-5 animate-spin"}):e.phase==="downloading"?l.jsx(Mx,{className:"size-5"}):e.phase==="ready"?l.jsx(Mu,{className:"size-5"}):l.jsx(Ax,{className:"size-5"})}function HH(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 FH(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 WH(e){switch(e){case"local":return"Local build";case"preview":return"Preview channel";case"stable":return"Stable channel"}}function qH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function VH(e){return!!(e.options&&Object.keys(e.options).length>0)}function GH({instances:e,channels:t,agents:r,desktopIntegrationAvailable:i}){const s=Ba(),o=h=>s(dt[h]),u=e.filter(h=>h.running).length,d=e.filter(h=>h.connected).length,m=t.filter(VH).length;return l.jsxs("div",{className:"grid gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Overview"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Channels, agents, and the instances binding them together."})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[l.jsx(Zv,{icon:NR,label:"Instances",value:e.length,sub:`${u} running · ${d} connected`,onClick:()=>o("instances")}),l.jsx(Zv,{icon:kx,label:"Channels",value:t.length,sub:`${m} configured`,onClick:()=>o("channels")}),l.jsx(Zv,{icon:Rx,label:"Agents",value:r.length,sub:r.length===1?"1 defined":`${r.length} defined`,onClick:()=>o("agents")})]}),l.jsxs(Yr,{children:[l.jsxs(_i,{children:[l.jsx(Jr,{children:"Instances"}),l.jsx(he,{variant:"outline",size:"sm",onClick:()=>o("instances"),children:"Manage"})]}),l.jsx(ei,{className:"p-0",children:e.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:[t.length===0?"No channels yet — add one to get started.":"No instances yet — bind a channel to an agent.",l.jsx("div",{className:"mt-3",children:l.jsx(he,{size:"sm",onClick:()=>o(t.length===0?"channels":"instances"),children:t.length===0?"Add channel":"Add instance"})})]}):l.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(h=>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:h.channelName}),l.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[h.type,h.agent?` · ${h.agent}`:""]})]}),l.jsx(VT,{inst:h})]},h.id))})})]}),i&&l.jsx($H,{})]})}function Zv({icon:e,label:t,value:r,sub:i,onClick:s}){return l.jsx(Yr,{children:l.jsxs("button",{onClick:s,className:"flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(e,{className:"size-5"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-3xl font-semibold leading-none tabular-nums",children:r}),l.jsx("div",{className:"label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]",children:t}),l.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:i})]})]})})}const Qv="local",YH={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function KH(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[s,o]=g.useState(!1),[u,d]=g.useState({}),m=g.useRef(0),h=g.useCallback(async(p=!1)=>{const x=++m.current;p&&o(!0),i(null);try{const b=await xe.listProviderClis(Qv);x===m.current&&t(b)}catch(b){x===m.current&&(t(null),i(b instanceof Error?b.message:String(b)))}finally{x===m.current&&o(!1)}},[]);g.useEffect(()=>{h()},[h]);const v=async(p,x)=>{try{let b=(await xe.startProviderCliOperation(Qv,p,x)).job;for(d(w=>({...w,[p]:b}));b.state==="running";)await rF(750),b=await xe.getProviderCliJob(Qv,b.id),d(w=>({...w,[p]:b}));b.state==="succeeded"?(_e.success(`${U2(p)} ${x} completed`),await h(),d(w=>{const C={...w};return delete C[p],C})):_e.error(b.error??`${U2(p)} ${x} failed`)}catch(b){_e.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(he,{variant:"outline",size:"sm",disabled:s,onClick:()=>void h(!0),children:[l.jsx(At,{className:s?"animate-spin":""}),"Refresh"]})})]}),r&&l.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[l.jsx(Ra,{className:"size-4"})," Could not inspect Providers"]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),l.jsxs(he,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void h(!0),children:[l.jsx(At,{})," Retry"]})]}),e===null&&!r?l.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>l.jsx(ZH,{},p))}):l.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>l.jsx(XH,{provider:p,job:u[p.id],readOnly:e.management==="read_only",onOperation:v},p.id))})]})}function XH({provider:e,job:t,readOnly:r,onOperation:i}){const s=e.availability!=="installed"?e.canInstall?"install":void 0:e.updateState==="available"&&e.canUpdate?"update":void 0,o=(t==null?void 0:t.state)==="running";return l.jsx(Yr,{className:"min-w-0",children:l.jsxs(ei,{className:"grid gap-3 p-4 text-xs",children:[l.jsxs("div",{className:"grid gap-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[l.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Dx,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx(Jr,{children:e.name}),l.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),l.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2 lg:grid-cols-[minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(10rem,0.8fr)]",children:[l.jsx(Jv,{icon:qO,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),l.jsx(Jv,{icon:At,label:"Version",value:eF(e),mono:!0,noWrap:!0}),l.jsx(Jv,{icon:jR,label:"Authentication",value:tF(e)})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:max-w-56 xl:justify-end",children:[l.jsx(QH,{provider:e}),!r&&s&&l.jsx(JH,{provider:e,operation:s,disabled:o,onConfirm:()=>i(e.id,s)})]})]}),e.error&&l.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[o?l.jsx(At,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?l.jsx(Ax,{className:"size-3.5 text-[var(--success)]"}):l.jsx(Ra,{className:"size-3.5 text-[var(--destructive)]"}),l.jsx("span",{children:t.error??YH[t.stage]})]})]})})}function ZH(){return l.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 xl:grid-cols-[12rem_minmax(0,1fr)_auto] xl:items-center",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"size-9 rounded-lg bg-[var(--muted)]"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"h-3.5 w-20 rounded bg-[var(--muted)]"}),l.jsx("div",{className:"h-2.5 w-12 rounded bg-[var(--muted)]"})]})]}),l.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:["w-full","w-24","w-32"].map((e,t)=>l.jsxs("div",{className:"grid gap-2",children:[l.jsx("div",{className:"h-2.5 w-16 rounded bg-[var(--muted)]"}),l.jsx("div",{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t))}),l.jsxs("div",{className:"flex items-center gap-2 xl:justify-end",children:[l.jsx("div",{className:"h-5 w-24 rounded-full bg-[var(--muted)]"}),l.jsx("div",{className:"h-8 w-24 rounded-md bg-[var(--muted)]"})]})]})}function QH({provider:e}){return e.availability==="missing"?l.jsx(_t,{variant:"warning",children:"Not installed"}):e.availability==="broken"?l.jsx(_t,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?l.jsx(_t,{variant:"warning",children:"New version"}):l.jsx(_t,{variant:"success",children:"Installed"})}function Jv({icon:e,label:t,value:r,mono:i=!1,noWrap:s=!1}){return l.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[l.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),l.jsx("div",{className:Fe("mt-0.5",i&&"font-mono text-[11px]",i&&!s&&"break-all",s&&"whitespace-nowrap"),children:r})]})]})}function JH({provider:e,operation:t,disabled:r,onConfirm:i}){const s=t==="install"?"Install":"Update";return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsxs(he,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?l.jsx(At,{className:"animate-spin"}):l.jsx(Mx,{}),r?"Working…":s]})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:[s," ",e.name,"?"]}),l.jsxs(nn,{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(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{onClick:()=>void i(),children:s})]})]})]})}function eF(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 tF(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function U2(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function rF(e){return new Promise(t=>window.setTimeout(t,e))}function iF(e,t){if(e instanceof yo)switch(e.code){case"offer_expired":return"This Share Link has expired. Generate a new link on the remote Host and try again.";case"offer_rejected":return"The remote Host rejected this Share Link. It may already have been used, expired, or revoked. Generate a new link and use it once.";case"invalid_offer":return"This is not a valid Rynx Share Link. Copy and paste the complete link from the remote Host."}return`${t} failed: ${e instanceof Error?e.message:String(e)}`}function nF(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=sc(),[i,s]=g.useState(null),[o,u]=g.useState(!1),[d,m]=g.useState(null),[h,v]=g.useState(null),[p,x]=g.useState({}),[b,w]=g.useState({});async function C(){try{const N=await xe.listRuntimes();s(N),r(N)}catch(N){s([]),_e.error(`Failed to load Runtimes: ${N.message}`)}}g.useEffect(()=>{C()},[]);async function E(N){v(N.selector);try{const k=await xe.testRuntime(N.selector);x(R=>({...R,[N.selector]:k})),w(R=>{const M={...R};return delete M[N.selector],M}),_e.success(`${N.displayName} is reachable`)}catch(k){x(M=>{const L={...M};return delete L[N.selector],L});const R={code:k instanceof yo?k.code:void 0,message:k.message};w(M=>({...M,[N.selector]:R})),_e.error(R.code==="authentication_failed"?"Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.":`Connection test failed: ${R.message}`)}finally{v(null)}}async function S(N){try{await xe.forgetRuntime(N.daemonId),x(k=>{const R={...k};return delete R[N.selector],R}),w(k=>{const R={...k};return delete R[N.selector],R}),_e.success(`Forgot ${N.displayName}`),e===N.selector&&t("local"),await C()}catch(k){_e.error(`Forget failed: ${k.message}`)}}return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(sF,{}),l.jsxs(Yr,{children:[l.jsxs(_i,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Jr,{children:["Runtimes"," ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(i==null?void 0:i.length)??0})]}),l.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),l.jsxs(he,{size:"sm",onClick:()=>u(!0),children:[l.jsx(en,{})," Add Runtime"]})]}),l.jsx(ei,{className:"p-0",children:l.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[i===null&&l.jsx("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Loading Runtimes…"}),i==null?void 0:i.map(N=>{const k=p[N.selector],R=b[N.selector],M=(R==null?void 0:R.code)==="authentication_failed";return l.jsxs("article",{className:"grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[l.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[l.jsx("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:N.binding==="local"?l.jsx(DR,{className:"size-4"}):l.jsx(ed,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"font-medium",children:N.displayName}),l.jsx(_t,{variant:N.binding==="local"?"default":"outline",children:N.binding}),k&&l.jsxs(_t,{variant:"success",children:[l.jsx(Ax,{className:"mr-1 size-3"})," reachable"]}),M&&l.jsxs(_t,{variant:"warning",children:[l.jsx(jx,{className:"size-3"})," authorization required"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:N.daemonId}),N.endpoint&&l.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:N.endpoint}),N.identityKeyFingerprint&&l.jsxs("div",{className:"mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:[l.jsx(Rf,{className:"size-3 shrink-0"}),N.identityKeyFingerprint]}),k&&l.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",k.status.daemonInstanceId]})]})]}),l.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[N.binding==="direct"&&l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>m(N),children:[l.jsx(Rf,{}),"Reauthorize"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:h===N.selector,onClick:()=>void E(N),children:[l.jsx(At,{className:h===N.selector?"animate-spin":""}),"Test"]}),N.binding==="direct"&&l.jsx(uF,{target:N,onForget:()=>S(N)})]})]},N.selector)})]})})]}),l.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]",children:"Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device."}),l.jsx(W2,{open:o,onOpenChange:u,onAdded:async N=>{x(k=>({...k,[N.target.selector]:N})),await C()}}),l.jsx(W2,{open:d!==null,target:d,onOpenChange:N=>{N||m(null)},onAdded:async N=>{x(k=>({...k,[N.target.selector]:N})),w(k=>{const R={...k};return delete R[N.target.selector],R}),await C()}})]})}const H2="__rynx_custom_share_address__";function sF(){const[e,t]=g.useState(null),[r,i]=g.useState(null),[s,o]=g.useState(null),[u,d]=g.useState(!1),[m,h]=g.useState(!1),[v,p]=g.useState(""),[x,b]=g.useState(!1),[w,C]=g.useState(""),[E,S]=g.useState(!1),[N,k]=g.useState(null),R=g.useRef(null),[M,L]=g.useState(null),[$,D]=g.useState(null),[q,G]=g.useState(!1),[W,B]=g.useState(null),[j,O]=g.useState(null),z=g.useCallback(async(Z=!1)=>{G(!0);try{L(await xe.listRuntimeAccess()),D(null),Z&&_e.success("Shared access refreshed")}catch(le){const ie=le.message;D(ie),Z&&_e.error(`Failed to refresh shared access: ${ie}`)}finally{G(!1)}},[]),T=g.useCallback(async(Z=!1)=>{d(!0);try{const le=await xe.listRuntimeShareAddresses();t(le),o(null),i(ie=>(ie==null?void 0:ie.kind)==="custom"||ie&&le.some(Se=>Se.address===ie.address)?ie:le[0]?{kind:"detected",address:le[0].address}:null),Z&&_e.success("Network addresses refreshed")}catch(le){const ie=le.message;t(Se=>Se??[]),o(ie),Z&&_e.error(`Failed to refresh network addresses: ${ie}`)}finally{d(!1)}},[]);g.useEffect(()=>{z(),T()},[z,T]);const U=(r==null?void 0:r.address)??"",H=w.trim(),F=N&&N.address===U.trim()&&N.clientLabel===H?N.code:"";function V(Z){if(Z===H2){p((r==null?void 0:r.kind)==="custom"?r.address:""),b(!1),h(!0);return}Z!==e_(r)&&e!=null&&e.some(le=>le.address===Z)&&i({kind:"detected",address:Z})}function I(){const Z=v.trim();if(!oF(Z)){b(!0);return}i({kind:"custom",address:Z}),h(!1),b(!1)}async function Y(){const Z=U.trim();if(!Z){_e.error("Choose an address that the other device can reach");return}S(!0);try{const le=await xe.shareRuntime({address:Z,...H?{clientLabel:H}:{}});k({code:le.pairingCode,address:Z,clientLabel:H}),_e.success("Pairing link generated"),await z()}catch(le){_e.error(`Failed to generate pairing link: ${le.message}`)}finally{S(!1)}}async function K(){if(!F)return;const Z=await qT(F,R.current);Z==="clipboard"||Z==="selection"?_e.success("Pairing link copied"):Z==="selected"?_e.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):_e.error("Copy is unavailable — select the pairing link and copy it manually")}async function ee(Z){B(Z.grantId);try{const le=await xe.revokeRuntimeAccess(Z.grantId);_e.success(`Revoked ${Du(Z)}${le.closedConnections>0?` and closed ${le.closedConnections} active connection${le.closedConnections===1?"":"s"}`:""}`),await z()}catch(le){_e.error(`Revoke failed: ${le.message}`)}finally{B(null)}}async function oe(Z){O(Z.grantId);try{await xe.deleteRevokedRuntimeAccess(Z.grantId),_e.success(`Removed revoked access record for ${Du(Z)}`),await z()}catch(le){_e.error(`Remove failed: ${le.message}`)}finally{O(null)}}const ce=(M==null?void 0:M.filter(Z=>Z.revokedAt===null).length)??0;return l.jsxs(Yr,{children:[l.jsx(_i,{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(MB,{className:"size-4"})}),l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Jr,{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(ei,{className:"grid gap-6",children:[l.jsxs("form",{className:"grid gap-3",onSubmit:Z=>{Z.preventDefault(),Y()},children:[l.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{htmlFor:"runtime-share-address",children:"Connection address"}),l.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[l.jsxs(Nm,{value:(r==null?void 0:r.kind)==="custom"?e_(r):r==null?void 0:r.address,onValueChange:V,disabled:e===null,children:[l.jsx(dd,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:l.jsx(ud,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?aF(e??[],r.address):void 0})}),l.jsxs(hd,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&l.jsxs(Zn,{value:e_(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Z=>l.jsx(Zn,{value:Z.address,children:GT(Z)},Z.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&l.jsx(by,{}),l.jsx(Zn,{value:H2,children:"Enter custom address…"})]})]}),l.jsx(he,{type:"button",variant:"outline",size:"icon",disabled:u,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void T(!0),children:l.jsx(At,{className:u?"animate-spin":""})})]})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{htmlFor:"runtime-share-label",children:"Client label"}),l.jsx(Et,{id:"runtime-share-label",value:w,onChange:Z=>C(Z.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),l.jsxs(he,{type:"submit",disabled:E||!r,children:[E?l.jsx(At,{className:"animate-spin"}):l.jsx($O,{}),"Generate Link"]})]}),l.jsx("p",{id:"runtime-share-address-help",className:s?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:s?"alert":void 0,children:s?`Could not refresh network addresses: ${s}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),F&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[l.jsx(Ur,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),l.jsxs("div",{className:"flex min-w-0 gap-2",children:[l.jsx(Et,{id:"runtime-pairing-code",ref:R,value:F,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),l.jsxs(he,{type:"button",variant:"outline",onClick:()=>void K(),children:[l.jsx(TR,{})," Copy"]})]}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),l.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",l.jsx("span",{className:"text-[var(--muted-foreground)]",children: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(he,{type:"button",variant:"ghost",size:"icon-sm",disabled:q,"aria-label":"Refresh shared access",onClick:()=>void z(!0),children:l.jsx(At,{className:q?"animate-spin":""})})]}),M===null&&!$&&l.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),$&&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: ",$]}),l.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>void z(),children:"Retry"})]}),(M==null?void 0:M.length)===0&&!$&&l.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),M&&M.length>0&&l.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:M.map(Z=>l.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium",children:Du(Z)}),l.jsxs(_t,{variant:Z.revokedAt?"destructive":"success",children:[Z.revokedAt?l.jsx(jx,{className:"size-3"}):l.jsx(Rf,{className:"size-3"}),Z.revokedAt?"revoked":"active"]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:Z.grantId}),l.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:Z.lastUsedAt?`Last used ${F2(Z.lastUsedAt)}`:`Created ${F2(Z.createdAt)} · never connected`})]}),Z.revokedAt?l.jsx(cF,{client:Z,disabled:j===Z.grantId,onRemove:()=>oe(Z)}):l.jsx(lF,{client:Z,disabled:W===Z.grantId,onRevoke:()=>ee(Z)})]},Z.grantId))})]})]}),l.jsx(Oo,{open:m,onOpenChange:Z=>{h(Z),Z||b(!1)},children:l.jsxs(Ua,{className:"sm:max-w-md",children:[l.jsxs(Bo,{children:[l.jsx(Ha,{children:"Enter custom address"}),l.jsx(hm,{children:"Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:Z=>{Z.preventDefault(),I()},children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),l.jsx(Et,{id:"runtime-custom-share-address",value:v,onChange:Z=>{p(Z.target.value),Z.target.value.trim()&&b(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":x,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),l.jsx("p",{id:"runtime-custom-share-address-help",className:x?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:x?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(he,{type:"submit",disabled:!v.trim(),children:"Use Address"})]})]})]})})]})}function GT(e){return`${e.interfaceName} (${e.address})`}function aF(e,t){const r=e.find(i=>i.address===t);return r?GT(r):t}function e_(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function oF(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function lF({client:e,disabled:t,onRevoke:r}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?l.jsx(At,{className:"animate-spin"}):l.jsx(jx,{}),"Revoke"]})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:["Revoke access for “",Du(e),"”?"]}),l.jsx(nn,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function cF({client:e,disabled:t,onRemove:r}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?l.jsx(At,{className:"animate-spin"}):l.jsx(Ia,{}),"Remove Record"]})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:["Remove revoked record for “",Du(e),"”?"]}),l.jsx(nn,{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(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Du(e){return e.clientLabel??e.clientId}function F2(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function W2({open:e,target:t=null,onOpenChange:r,onAdded:i}){const[s,o]=g.useState(""),[u,d]=g.useState(""),[m,h]=g.useState(!1),v=t!==null;g.useEffect(()=>{e&&(o((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function p(){const x=u.trim();if(x){h(!0);try{const b=await xe.pairRuntime({offer:x,...s.trim()?{displayName:s.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});_e.success(v?`Reauthorized ${b.target.displayName}`:`Paired ${b.target.displayName}`),await i(b),o(""),d(""),r(!1)}catch(b){_e.error(iF(b,v?"Reauthorization":"Pairing"))}finally{h(!1)}}}return l.jsx(Oo,{open:e,onOpenChange:r,children:l.jsxs(Ua,{className:"sm:max-w-lg",children:[l.jsxs(Bo,{children:[l.jsx(Ha,{children:v?"Reauthorize Runtime":"Add Runtime"}),l.jsx(hm,{children:v?"Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.":"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:x=>{x.preventDefault(),p()},children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{htmlFor:"runtime-name",children:"Display name"}),l.jsx(Et,{id:"runtime-name",value:s,onChange:x=>o(x.target.value),placeholder:"Remote lab",maxLength:128})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx(Ur,{htmlFor:"runtime-offer",children:"Pairing link"}),l.jsx(Et,{id:"runtime-offer",value:u,onChange:x=>d(x.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",l.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),l.jsxs(rd,{children:[l.jsx(td,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsxs(he,{type:"submit",disabled:m||!u.trim(),children:[m?l.jsx(At,{className:"animate-spin"}):l.jsx(Rf,{}),v?"Reauthorize":"Add Runtime"]})]})]})]})})}function uF({target:e,onForget:t}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsxs(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[l.jsx(Ia,{}),l.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:["Forget “",e.displayName,"”?"]}),l.jsxs(nn,{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(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}function dF(e,t){return t==="install"||(e==null?void 0:e.phase)==="installing"}const hF="rynx.control.session-launch-selection.v2";function YT(e){return`${e.kind}:${e.id}`}function KT(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 fF(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function mF(e,t){const r=t?KT(t):null;if(r&&fF(r,e)&&(r.kind==="agent"&&e.agents.some(o=>o.id===r.id&&o.ready)||r.kind==="provider"&&e.providers.some(o=>o.id===r.id&&o.ready)))return r;for(const o of["claude","codex","traex"])if(e.providers.some(u=>u.id===o&&u.ready))return{kind:"provider",id:o};const i=e.providers.find(o=>o.ready);if(i)return{kind:"provider",id:i.id};const s=e.agents.find(o=>o.ready);return s?{kind:"agent",id:s.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function pF(e,t){if(!t)return null;try{return t.getItem(XT(e))}catch{return null}}function gF(e,t,r){if(t)try{t.setItem(XT(e),YT(r))}catch{}}function XT(e){return`${hF}:${encodeURIComponent(e)}`}function vF(e,t){return e.kind==="provider"?{provider:e.id,title:t}:{agent:e.id,title:t}}function _F(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function xF(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function t_(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function qu(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function v0(e,t){if(!e)return null;if(e.kind==="provider")return t.providers.find(i=>i.id===e.id)??null;const r=t.agents.find(i=>i.id===e.id);return r?{name:r.name??r.id,ready:r.ready,...r.reason?{reason:r.reason}:{},...r.readiness?{readiness:r.readiness}:{}}:null}const ZT=E9,QT=g.forwardRef(({className:e,...t},r)=>l.jsx(R9,{ref:r,className:Fe("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));QT.displayName="TabsList";const _0=g.forwardRef(({className:e,...t},r)=>l.jsx(k9,{ref:r,className:Fe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));_0.displayName="TabsTrigger";const Vu=g.forwardRef(({className:e,...t},r)=>l.jsx(N9,{ref:r,className:Fe("mt-4 focus-visible:outline-none",e),...t}));Vu.displayName="TabsContent";function Lu(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function yF(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function bF(e){var i;const t=e.data.content.flatMap((s,o)=>"text"in s?[o]:[]);return t.length!==1?!1:((i=e.truncations)==null?void 0:i.some(({field:s})=>s===`data.content[${t[0]}].text`))===!0}function wF(e){return e.filter(t=>t.type==="input_image")}function SF(e,t){return e.length===t.length&&e.every((r,i)=>{var s;return r.resourceId===((s=t[i])==null?void 0:s.resourceId)})}function Fh(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const i=t[r],s=t[r-1];i.type!=="reasoning"||i.data.model!=="traex"||s.type!=="message"||s.data.role!=="assistant"||s.data.model!=="traex"||s.responseId!==i.responseId||i.createdAt<s.createdAt||i.createdAt-s.createdAt>500||(t[r]=s,t[r-1]=i)}return t}function Vn(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 vi(e,t,r){e.items[t]=r}function gn(e,t){const r=e.items.length;return e.items.push(t),r}function q2(e,t,r){if(!r)return;const i=e.turns[t];e.turns[t]=i?{...i,model:i.model??r}:{status:"completed",model:r}}function JT(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=JT(r.children));return t}function bo(e){e.waitingForInteraction=JT(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function eM(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function x0(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?eM(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:x0(r.children,t)}:r)}function y0(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&y0(r.children,t);return t}function V2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:o})=>o.interactionId));for(const[o,u]of Object.entries(e.childStates)){const d=Vn(u);d.items=x0(d.items,r),bo(d),e.childStates[o]=d;const m=e.callIndex[o];if(m!==void 0){const h=e.items[m];vi(e,m,{...h,children:d.items})}}e.items=x0(e.items,r);const i=y0(e.items);for(const o of Object.values(e.childStates))y0(o.items,i);for(const{responseId:o,interaction:u}of t.pendingInteractions){if(i.has(u.interactionId))continue;const d={kind:"interaction",id:u.interactionId,responseId:o,request:u,status:"pending"};e.interactionIndex[u.interactionId]=gn(e,d),i.add(u.interactionId)}const s=new Set(t.activeResponseIds);for(const[o,u]of Object.entries(e.turns))s.has(o)||u.status==="running"&&(e.turns[o]={...u,status:"completed"},b0(e,o));EF(e,s);for(const o of s)e.turns[o]={...e.turns[o],status:"running"};e.runStatus=t.status,e.waitingForInteraction=r.size>0}function G2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function Y2(e,t,r,i){const s=e.byId[t];if(s!==void 0)return s;const o=gn(e,i());return e.byId[t]=o,o}function jm(e,t){e.items.splice(t,1);for(const r of[e.byId,e.callIndex,e.interactionIndex])for(const[i,s]of Object.entries(r))s===t?delete r[i]:s>t&&(r[i]=s-1)}function CF(e,t,r){const i=Vn(e.childStates[t]??Lu());Ts(i,{...r,parentToolCallId:void 0}),bo(i),e.childStates[t]=i;const s=e.callIndex[t];if(s!==void 0){const o=e.items[s];vi(e,s,{...o,children:i.items})}}function Ts(e,t){var r;if(t.parentToolCallId){CF(e,t.parentToolCallId,t);return}switch(t.type){case"message":{q2(e,t.responseId,t.data.model);const i={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:yF(t.data.content),images:wF(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...bF(t)?{textPrefixTruncated:!0}:{}},s=e.byId[t.id];if(s!==void 0){vi(e,s,i);return}if(t.data.role==="user"){const o=e.items.findIndex(u=>u.kind==="message"&&u.optimistic&&u.role==="user"&&u.text===i.text&&SF(u.images,i.images));if(o!==-1){const u=e.items[o];delete e.byId[u.id],vi(e,o,i),e.byId[t.id]=o;return}}e.byId[t.id]=gn(e,i);return}case"reasoning":{q2(e,t.responseId,t.data.model);const i={kind:"reasoning",id:t.id,responseId:t.responseId,summary:t.data.summary.map(o=>o.text),model:t.data.model,streaming:!1},s=e.byId[t.id];s!==void 0?vi(e,s,i):e.byId[t.id]=gn(e,i);return}case"function_call":{const i=t.data.callId,s=e.pendingOutputs[i],o=(r=e.childStates[i])==null?void 0:r.items,u={kind:"tool",id:i,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:s?s.status??"completed":t.status,output:s==null?void 0:s.output,exitCode:s==null?void 0:s.exitCode,...o&&o.length?{children:o}:{}};s&&delete e.pendingOutputs[i];const d=e.callIndex[i];d!==void 0?vi(e,d,u):e.callIndex[i]=gn(e,u);return}case"function_call_output":{const i=t.data.callId,s=e.callIndex[i];if(s===void 0){e.pendingOutputs[i]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const o=e.items[s];vi(e,s,{...o,output:t.data.output,status:t.data.status??"completed",exitCode:t.data.exitCode});return}case"terminal_command":{const i={kind:"terminal_command",id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},s=e.byId[t.id];s!==void 0?vi(e,s,i):e.byId[t.id]=gn(e,i);return}case"interaction_request":{const i=t.data.interaction,s=i.interactionId,o=e.interactionIndex[s],u=e.pendingInteractionResolutions[s],d=o===void 0?void 0:e.items[o];let m={kind:"interaction",id:s,responseId:t.responseId,request:i,status:(d==null?void 0:d.status)??"pending",...d!=null&&d.resolution?{resolution:d.resolution}:{},...d!=null&&d.reason?{reason:d.reason}:{},...(d==null?void 0:d.resolvedAt)!==void 0?{resolvedAt:d.resolvedAt}:{}};u&&(m=G2(m,u),delete e.pendingInteractionResolutions[s]),o===void 0?e.interactionIndex[s]=gn(e,m):vi(e,o,m),e.byId[t.id]=e.interactionIndex[s];return}case"interaction_resolution":{const i=t.data,s=e.interactionIndex[i.interactionId];if(s===void 0){e.pendingInteractionResolutions[i.interactionId]={...i,responseId:t.responseId,itemId:t.id};return}const o=e.items[s];vi(e,s,G2(o,i)),e.byId[t.id]=s;return}case"error":{const i={kind:"error",id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},s=e.byId[t.id];s!==void 0?vi(e,s,i):e.byId[t.id]=gn(e,i);return}}}function b0(e,t){const r=i=>i===t;$f(e,r),e.items=w0(e.items,t);for(const[i,s]of Object.entries(e.childStates)){const o=Vn(s);$f(o,r),o.items=w0(o.items,t),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];vi(e,u,{...d,children:o.items})}}}function EF(e,t){const r=i=>!t.has(i);$f(e,r);for(const[i,s]of Object.entries(e.childStates)){const o=Vn(s);$f(o,r),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];vi(e,u,{...d,children:o.items})}}}function $f(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&&jm(e,r)}}function RF(e,t){const r=e.items.filter(i=>i.kind==="message"&&i.responseId===t&&i.role==="assistant"&&i.liveDraft!==!0);if(r.length!==0)for(let i=e.items.length-1;i>=0;i-=1){const s=e.items[i];(s==null?void 0:s.kind)==="message"&&s.responseId===t&&s.role==="assistant"&&s.liveDraft===!0&&r.some(o=>o.text===s.text||o.textPrefixTruncated===!0&&o.text.length>0&&s.text.startsWith(o.text))&&jm(e,i)}}function w0(e,t){return e.map(r=>{const i=r.kind==="tool"&&r.children?{...r,children:w0(r.children,t)}:r;return i.responseId!==t?i:i.kind==="tool"&&i.status==="in_progress"?{...i,status:"incomplete"}:(i.kind==="message"||i.kind==="reasoning")&&i.streaming?{...i,streaming:!1}:i.kind==="interaction"&&i.status==="pending"?{...i,status:"inactive",reason:"Turn ended before this interaction was resolved"}:i})}function K2(e){return Object.values(e.turns).some(t=>t.status==="running")}function hn(e){e.note=void 0,e.statusKind=void 0}function kF(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",hn(e);return}case"response.output_text.delta":{hn(e);const i=e.byId[t.itemId],s=i===void 0?void 0:e.items[i];if(t.discard===!0){i!==void 0&&(s==null?void 0:s.kind)==="message"&&s.role==="assistant"&&s.responseId===t.responseId&&s.liveDraft===!0&&jm(e,i);return}const o=(r=e.turns[t.responseId])==null?void 0:r.status;if(o==="completed"||o==="failed"||(s==null?void 0:s.kind)==="message"&&s.role==="assistant"&&s.liveDraft!==!0)return;const u=Y2(e,t.itemId,t.responseId,()=>({kind:"message",id:t.itemId,responseId:t.responseId,role:"assistant",text:"",images:[],streaming:!0,liveDraft:!0})),d=e.items[u];e.items[u]={...d,text:d.text+t.delta,streaming:!0},t.final&&RF(e,t.responseId);return}case"response.reasoning_summary_text.delta":{hn(e);const i=Y2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),s=e.items[i],o=s.summary.slice();o[t.summaryIndex]=(o[t.summaryIndex]??"")+t.delta,e.items[i]={...s,summary:o,streaming:!0};return}case"response.function_call_output.delta":{hn(e);const i=e.callIndex[t.callId];if(i===void 0){const o=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...o,output:(o.output??"")+t.delta};return}const s=e.items[i];e.items[i]={...s,output:(s.output??"")+t.delta};return}case"session.interaction.requested":{hn(e),Ts(e,t.item);const i=e.interactionIndex[t.interaction.interactionId];if(i!==void 0){const s=e.items[i];(s.status==="pending"||s.status==="inactive")&&vi(e,i,eM(s))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{hn(e),Ts(e,t.item);return}case"response.output_item.done":{hn(e),Ts(e,t.item);return}case"response.completed":{hn(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"completed",usage:t.usage},b0(e,t.responseId),!K2(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{hn(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)||gn(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),b0(e,t.responseId),e.runStatus=K2(e)?"running":"idle";return}case"session.input.consumed":{hn(e),Ts(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{gn(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",hn(e);return}}}function NF(e,t){var r;switch(t.kind){case"reset":return Lu();case"snapshot":{const i=Lu();for(const s of Fh(t.items))Ts(i,s);return V2(i,t.runtime),i.historyLoaded=!0,i}case"reconcile_snapshot":{const i=Vn(e);for(const s of Fh(t.items))Ts(i,s);return V2(i,t.runtime),i.historyLoaded=!0,i.error=void 0,i}case"history":{const i=Lu();for(const s of Fh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i}case"reconcile_history":{const i=Vn(e);for(const s of Fh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i.error=void 0,i}case"event":{const i=Vn(e);return kF(i,t.event),bo(i),i}case"optimistic_user":{const i=Vn(e),s={kind:"message",id:t.id,responseId:t.id,role:"user",text:t.text,images:t.images??[],streaming:!1,optimistic:!0};return i.byId[t.id]=gn(i,s),i}case"discard_optimistic_user":{const i=e.byId[t.id];if(i===void 0||((r=e.items[i])==null?void 0:r.kind)!=="message"||!e.items[i].optimistic)return e;const s=Vn(e);return jm(s,i),s}case"stream_error":{const i=Vn(e);return i.error=t.message,i}case"stream_done":return e}}function AF(e){let t;for(const r of e.items){const i=e.turns[r.responseId];i&&(t=i)}return t}function TF(e){let t=!1;const r=e.map(i=>i.kind!=="error"?i:i.code==="codex_error"&&i.message==="Codex turn was interrupted"||i.code==="traex_error"&&i.message==="Traex turn was interrupted"?(t=!0,{...i,code:"response_stopped",message:"Response stopped"}):i.code==="codex_error"&&i.message==="Codex turn failed"||i.code==="traex_error"&&i.message==="Traex turn failed"||i.code==="claude_error"&&i.message==="claude turn failed"?(t=!0,{...i,code:"agent_error",message:"Agent turn failed"}):i);return t?r:e}const S0="browser:",C0="emulator:",X2=.44,Su=360,MF=420;function jF(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(S0)?{type:"browser",pageId:e.slice(S0.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(C0)?{type:"emulator",bindingId:e.slice(C0.length).trim()||null}:null:null}function Fn(e){return e?`${S0}${e}`:"browser"}function Wn(e){return e?`${C0}${e}`:"emulator"}function Z2(e,t){const r=new Set(t),i=new Set,s=[];for(const o of e)!r.has(o)||i.has(o)||(i.add(o),s.push(o));for(const o of t)i.has(o)||(i.add(o),s.push(o));return s}function Wh(e,t){const r=Math.max(0,e),i=Math.max(0,r-MF),s=Math.min(Su,i);return Math.min(i,Math.max(s,t))}function DF(e,t,r){var i;return!e||e.pages.length===0?null:t&&e.pages.some(s=>s.pageId===t)?t:r&&e.pages.some(s=>s.pageId===r)?r:e.activePageId&&e.pages.some(s=>s.pageId===e.activePageId)?e.activePageId:((i=e.pages[0])==null?void 0:i.pageId)??null}function LF(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}let r_=0;function Gu(e){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return`${e}_${t.randomUUID()}`;if(typeof(t==null?void 0:t.getRandomValues)=="function"){const r=t.getRandomValues(new Uint8Array(16));return`${e}_${Array.from(r,i=>i.toString(16).padStart(2,"0")).join("")}`}return r_=r_+1>>>0,`${e}_${Date.now().toString(36)}_${r_.toString(36)}`}const OF=256,BF=4*1024*1024;function PF(e,t,r,i){return e||(r?t:i)}function IF(e){return e.type==="response.created"}function Q2(e,t,r){return r&&e!==null&&t===e}function zF(e,t){return e&&t}function $F(e,{runtimeSelector:t,allowSend:r=!0}={}){const[i,s]=g.useReducer(NF,void 0,Lu),[o,u]=g.useState(!1),[d,m]=g.useState(!1),h=g.useRef(null),v=g.useRef(0),p=g.useRef(null),x=g.useRef(null),b=g.useRef(0);g.useEffect(()=>{if(s({kind:"reset"}),p.current=null,x.current=null,u(!1),m(!1),!e)return;const E=new AbortController;let S=!1,N=!0,k;return(async()=>{let M=500;for(;!E.signal.aborted;){const L=new AbortController,$=()=>L.abort();E.signal.addEventListener("abort",$,{once:!0});let D=!1,q=!1,G=!1;const W={events:[],utf8Bytes:0};let B,j;const O=new Promise((U,H)=>{B=U,j=H}),z=xe.streamSession(e,U=>{if(!(S||L.signal.aborted))if(U.event==="ready"){const H=HF(k,U.data);k=H.daemonInstanceId,H.changed&&(N=!0,s({kind:"reset"}),m(!1)),B()}else if(U.event==="event"){const H=U.data,F=p.current;F!==null&&IF(H)&&(x.current=F,Q2(p.current,x.current,D)&&(p.current=null,x.current=null,u(!1))),D?s({kind:"event",event:H}):UF(W,H)||(G=!0,L.abort())}else U.event==="error"&&s({kind:"stream_error",message:String(U.data.message??"stream error")})},L.signal,t).then(()=>(j(new Error("session stream closed before ready")),{error:void 0})).catch(U=>(j(U),{error:U}));try{await O,M=500;let U=500;for(;;){const H=new AbortController,F=()=>H.abort();L.signal.addEventListener("abort",F,{once:!0}),L.signal.aborted&&H.abort();const V=xe.getSessionSnapshot(e,H.signal,t).then(ee=>({kind:"snapshot",snapshot:ee})).catch(ee=>({kind:"snapshot_error",error:ee})),I=await Promise.race([V,z.then(()=>({kind:"stream_ended"}))]);if(L.signal.removeEventListener("abort",F),I.kind==="stream_ended"){H.abort();break}if(S||E.signal.aborted)return;if(G)break;if(I.kind==="snapshot"){const{snapshot:ee}=I;s({kind:N?"snapshot":"reconcile_snapshot",items:ee.items,runtime:ee.runtime}),q=!0,N=!1;break}const{error:Y}=I;s({kind:"stream_error",message:Y instanceof Error?Y.message:String(Y)});const K=await Promise.race([z.then(()=>"stream_ended"),J2(U,E.signal).then(()=>"retry")]);if(E.signal.aborted)return;if(K==="stream_ended")break;U=Math.min(U*2,8e3)}}catch(U){!S&&!E.signal.aborted&&!G&&s({kind:"stream_error",message:U instanceof Error?U.message:String(U)})}finally{if(G||(D=!0),!S&&!E.signal.aborted&&!G){for(const U of W.events.splice(0))s({kind:"event",event:U});W.utf8Bytes=0,q&&(m(!0),Q2(p.current,x.current,!0)&&(p.current=null,x.current=null,u(!1)))}}const T=await z;if(S||m(!1),E.signal.removeEventListener("abort",$),L.abort(),E.signal.aborted)return;T.error,await J2(M,E.signal),M=Math.min(M*2,8e3)}})(),()=>{var M;S=!0,E.abort(),(M=h.current)==null||M.abort()}},[t,e]);const w=g.useCallback(async E=>{if(!e||!r)return;const S=typeof E=="string"?E:E.text,N=typeof E=="string"?[]:E.images,k=typeof E=="string"?void 0:E.clientMessageId??Gu("msg"),R=new AbortController,M=++v.current;h.current=R,p.current=M,x.current=null,u(!0);const L=`optimistic_${b.current++}`;s({kind:"optimistic_user",id:L,text:S,images:N});try{await xe.sendSessionMessage(e,N.length===0?S:{content:[...N.map($=>({type:"input_image",resourceId:$.resourceId,mediaType:$.mediaType,...$.filename?{filename:$.filename}:{},...$.byteLength?{byteLength:$.byteLength}:{},...$.width?{width:$.width}:{},...$.height?{height:$.height}:{}})),...S?[{type:"input_text",text:S}]:[]],clientMessageId:k},()=>{},R.signal,t)}catch($){throw R.signal.aborted||(Ty($)&&s({kind:"discard_optimistic_user",id:L}),s({kind:"stream_error",message:$.message})),p.current===M&&(p.current=null,x.current=null,u(!1)),$}finally{h.current===R&&(h.current=null)}},[r,t,e]),C=g.useCallback(async()=>{var E;if((E=h.current)==null||E.abort(),p.current=null,x.current=null,u(!1),!!e)try{await xe.interruptSession(e,t)}catch{}},[t,e]);return g.useEffect(()=>{if(!o)return;if(zF(d,i.runStatus==="running"||i.waitingForInteraction)){p.current=null,x.current=null,u(!1);return}const E=p.current,S=window.setTimeout(()=>{p.current===E&&(p.current=null,x.current=null,u(!1))},15e3);return()=>window.clearTimeout(S)},[d,o,i.runStatus,i.waitingForInteraction]),{state:i,pendingSend:o,current:d,send:w,stop:C}}function UF(e,t,r={}){const i=r.events??OF,s=r.utf8Bytes??BF;let o;try{o=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=i||o>s||e.utf8Bytes+o>s?!1:(e.events.push(t),e.utf8Bytes+=o,!0)}function HF(e,t){const r=t&&typeof t=="object"&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof r!="string"||r.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:r,changed:e!==void 0&&e!==r}}function J2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const i=window.setTimeout(s,e);t.addEventListener("abort",s,{once:!0});function s(){window.clearTimeout(i),t.removeEventListener("abort",s),r()}})}const Dy="desktop-direct-view",FF=1,e5=32*1024,t5=4*1024*1024,WF=4096,qF=4096,VF=8847360,GF=4*1024,E0=512,YF=1024,r5=new Uint8Array([82,66,83,70]),jl=38,KF=1,XF=2,Uf=new TextEncoder,ZF=new TextDecoder("utf-8",{fatal:!0});function QF(e){const t=eW(e);switch(t.type){case"browser.surface.ready":{i_(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=Hf(t.sourceWidth,"sourceWidth"),i=Hf(t.sourceHeight,"sourceHeight");return tM(r,i),{type:"browser.surface.ready",subscriptionId:Cu(t.subscriptionId,"subscriptionId"),browserGeneration:i5(t.browserGeneration,"browserGeneration"),viewportRevision:iW(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:i,deviceScaleFactor:sW(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:aW(t.format),grantedRole:ff(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{i_(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=ff(t.driver,["none","desktop","stream"],"driver"),i=t.driverSubscriptionId===void 0?void 0:Cu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(i!==void 0))throw Ht("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:Cu(t.subscriptionId,"subscriptionId"),browserGeneration:i5(t.browserGeneration,"browserGeneration"),driver:r,...i===void 0?{}:{driverSubscriptionId:i}}}case"browser.surface.closed":{i_(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:rW(t.message,"message",YF);return{type:"browser.surface.closed",subscriptionId:Cu(t.subscriptionId,"subscriptionId"),reason:ff(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw Ht("unknown Browser Surface server frame type")}}function JF(e){if(!(e instanceof Uint8Array)||e.byteLength<jl+1||e.byteLength>jl+E0+t5)throw Ht("Browser Surface image frame has an invalid byte length");for(let x=0;x<r5.length;x+=1)if(e[x]!==r5[x])throw Ht("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==FF||t.getUint16(6,!1)!==0)throw Ht("Browser Surface image frame header is unsupported");const r=t.getUint8(5),i=r===KF?"jpeg":r===XF?"png":void 0;if(i===void 0)throw Ht("Browser Surface image frame format is unsupported");const s=t.getUint16(32,!1),o=t.getUint32(34,!1);if(s===0||s>E0||o===0||o>t5||jl+s+o!==e.byteLength)throw Ht("Browser Surface image frame lengths are invalid");let u;try{u=ZF.decode(e.subarray(jl,jl+s))}catch{throw Ht("subscriptionId must be valid UTF-8")}u=Cu(u,"subscriptionId");const d=n5(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),h=n5(t.getBigUint64(20,!1),"timestampMilliseconds"),v=Hf(t.getUint16(28,!1),"width"),p=Hf(t.getUint16(30,!1),"height");return tM(v,p),{subscriptionId:u,frameSequence:d,viewportRevision:m,timestampMilliseconds:h,width:v,height:p,format:i,encodedBytes:new Uint8Array(e.subarray(jl+s))}}function eW(e){let t=e;if(typeof e=="string"){if(Uf.encode(e).byteLength>e5)throw Ht("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw Ht("Browser Surface control frame must be valid JSON")}}const r=tW(t,"Browser Surface control frame");let i;try{i=JSON.stringify(r)}catch{throw Ht("Browser Surface control frame must be serializable")}if(Uf.encode(i).byteLength>e5)throw Ht("Browser Surface control frame exceeds its byte limit");return r}function tW(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw Ht(`${t} must be an object`);return e}function i_(e,t,r,i=!1){const s=Object.keys(e),o=i?t.length-1:t.length;if(s.length<o||s.length>t.length||s.some(u=>!t.includes(u))||t.slice(0,o).some(u=>!Object.hasOwn(e,u)))throw Ht(`${r} contains unknown or missing fields`)}function Cu(e,t){if(typeof e!="string"||e.length===0||Uf.encode(e).byteLength>E0||!/^[\x21-\x7e]+$/.test(e))throw Ht(`${t} must be a bounded opaque identifier`);return e}function rW(e,t,r){if(typeof e!="string"||e.includes("\0")||Uf.encode(e).byteLength>r)throw Ht(`${t} exceeds its text byte limit`);return e}function i5(e,t){if(!Number.isSafeInteger(e)||e<1)throw Ht(`${t} must be a positive safe integer`);return e}function iW(e,t){if(!Number.isSafeInteger(e)||e<0)throw Ht(`${t} must be a nonnegative safe integer`);return e}function nW(e,t,r,i){if(!Number.isInteger(e)||e<t||e>r)throw Ht(`${i} must be an integer from ${t} to ${r}`);return e}function sW(e,t,r,i){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw Ht(`${i} must be a finite number from ${t} to ${r}`);return e}function Hf(e,t){const r=t.toLowerCase().includes("height")?qF:WF;return nW(e,1,r,t)}function tM(e,t){if(e*t>VF)throw Ht("Browser Surface viewport exceeds its maximum pixels")}function aW(e){return ff(e,["jpeg","png"],"format")}function ff(e,t,r){if(typeof e!="string"||!t.includes(e))throw Ht(`${r} is unsupported`);return e}function n5(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw Ht(`${t} exceeds a safe integer`);return Number(e)}function Ht(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const s5=1e4,oW=16,n_=1,a5=[500,1e3,2e3,4e3,8e3,15e3];function lW(e){const t=Math.max(0,Math.min(Math.trunc(e),a5.length-1));return a5[t]}function cW(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function uW(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function rM(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function qh(e){return!(e instanceof Error)||!e.message?"Browser operation failed":e.message==="failed_precondition"?"Browser Host is unavailable. On a headless Runtime, run `rynx browser install` on that host.":e.message.replaceAll("_"," ")}function dW(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(Dy)}function hW(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function fW(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(Dy)}async function mW(e,t){var o,u,d,m;const r=e.pages.findIndex(h=>h.pageId===e.activePageId);await t.close(e.browserGeneration);let i=await t.open((o=e.pages[0])==null?void 0:o.url);(u=t.onProgress)==null||u.call(t,i);for(const h of e.pages.slice(1))i=await t.createPage(i.browserGeneration,h.url),(d=t.onProgress)==null||d.call(t,i);const s=r>=0?i.pages[r]:void 0;return s&&i.activePageId!==s.pageId&&(i=await t.activatePage(i.browserGeneration,s.pageId),(m=t.onProgress)==null||m.call(t,i)),i}function pW({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:i=t}){const s=Math.max(0,r-t),o=r-i>n_;return{hasOverflow:o,canScrollLeft:o&&e>n_,canScrollRight:o&&e<s-n_}}function gW(e){return Math.max(120,e*.75)}function vW({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:i,inset:s=4}){const o=e,u=e+t,d=Math.max(0,r-s),m=r+i+s;return d<o?d-o:m>u?m-u:0}function _W(e,t,r,i){return{deltaX:o5(e+r),deltaY:o5(t+i)}}function o5(e){return Number.isFinite(e)?Math.max(-s5,Math.min(s5,e)):0}function xW(e){if(!e)return[];const t=new TextEncoder,r=[];let i="",s=0;for(const o of e){const u=t.encode(o).byteLength;if(s+u>GF){if(r.push(i),r.length>=oW)throw new RangeError("Browser text input is too large");i="",s=0}i+=o,s+=u}return i&&r.push(i),r}function yW(e,t){if(t.type==="pointerdown"){const i=l5(t.button);return i&&e.set(t.pointerId,i),i}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??l5(t.button)}function l5(e){if(e===0)return"left";if(e===1)return"middle";if(e===2)return"right";if(e===3)return"back";if(e===4)return"forward"}const bW=1,wW=2;function SW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i,toolbarHost:s}){const o=g.useRef(null),u=g.useRef(null),d=g.useRef(void 0),m=g.useRef(void 0),h=g.useRef(0),v=g.useRef(0),p=g.useRef(0),x=g.useRef(0),b=g.useRef(void 0),w=g.useRef(!1),C=g.useRef(!1),E=g.useRef(!1),S=g.useRef(void 0),N=g.useRef(void 0),k=g.useRef(void 0),R=g.useRef(new Map),[M,L]=g.useState("connecting"),[$,D]=g.useState(),[q,G]=g.useState(),[W,B]=g.useState("none"),[j,O]=g.useState(),[z,T]=g.useState(!1),[U,H]=g.useState(!1),F=W==="stream"&&j===(q==null?void 0:q.subscriptionId),V=g.useCallback(()=>{k.current!==void 0&&(window.cancelAnimationFrame(k.current),k.current=void 0),S.current=void 0,N.current=void 0,R.current.clear()},[]),I=g.useCallback(()=>{b.current!==void 0&&(window.clearTimeout(b.current),b.current=void 0)},[]),Y=g.useCallback(async({refreshCapability:me=!1,preserveFrame:Ae=!1}={})=>{var Ye;I();const Le=++p.current;(Ye=d.current)==null||Ye.close(1e3,"Browser Surface reconnecting"),d.current=void 0,m.current=void 0,h.current=0,v.current=0,E.current=!1,C.current=!1,V(),L("connecting"),D(void 0),G(void 0),B("none"),O(void 0),H(!1),Ae||(w.current=!1,T(!1));const je=at=>{if(p.current!==Le)return;D(at),L("connecting");const qe=lW(x.current++);b.current=window.setTimeout(()=>{b.current=void 0,Y({preserveFrame:!0})},qe)};try{const at=await Wu(me);if(p.current!==Le)return;const qe=new WebSocket(RW({runtimeSelector:e,sessionId:t,pageId:i,browserGeneration:r,capability:at}));qe.binaryType="arraybuffer",d.current=qe;let Pt=me,Ie=!1;qe.onmessage=Mt=>{var Jt;if(p.current!==Le||d.current!==qe)return;if(typeof Mt.data=="string"){try{const xt=JSON.parse(Mt.data);if(xt&&typeof xt=="object"&&"type"in xt&&xt.type==="error"){const ni="message"in xt&&typeof xt.message=="string"?xt.message:"Browser Surface failed";D(ni);return}const Tt=QF(xt);if(Tt.type==="browser.surface.ready"){m.current=Tt,h.current=Tt.viewportRevision,I(),G(Tt),L("ready");return}if(Tt.type==="browser.surface.driver.changed"){const ni=Tt.driver==="stream"&&Tt.driverSubscriptionId===((Jt=m.current)==null?void 0:Jt.subscriptionId);E.current=ni,ni||V(),B(Tt.driver),O(Tt.driverSubscriptionId);return}E.current=!1,V();const Ft=Tt.message??kW(Tt.reason);Ie=!0,uW(Tt.reason)?(je(Ft),qe.close(1e3,"recovering Browser Surface")):(D(Ft),L("closed"))}catch{Ie=!0,D("Browser Surface sent an invalid control frame"),L("closed"),qe.close(4400,"invalid Browser Surface control")}return}if(!(Mt.data instanceof ArrayBuffer)){D("Browser Surface sent an invalid image frame"),qe.close(4400,"invalid Browser Surface image");return}const pt=()=>p.current===Le&&d.current===qe;CW(Mt.data,qe,o.current,m.current,pt).then(xt=>{xt===void 0||!pt()||(h.current=xt,w.current=!0,C.current=!0,x.current=0,T(!0),H(!0))}).catch(()=>{pt()&&(Ie=!0,D("Browser preview could not be decoded"),L("closed"),qe.close(4400,"Browser Surface image decode failed"))})},qe.onclose=Mt=>{if(!(p.current!==Le||d.current!==qe)&&(d.current=void 0,E.current=!1,V(),!Ie)){if((Mt.code===4403||Mt.code===1006)&&!Pt){Pt=!0,Y({refreshCapability:!0,preserveFrame:!0});return}if(cW(Mt.code)){je(d5(Mt.code));return}L("closed"),D(pt=>pt??d5(Mt.code))}},qe.onerror=()=>{d.current===qe&&D("Browser preview transport failed")}}catch(at){if(p.current!==Le)return;je(at instanceof Error?at.message:"Browser preview could not connect")}},[e,t,i,r,V,I]);g.useEffect(()=>(Y(),()=>{var me;p.current+=1,I(),V(),(me=d.current)==null||me.close(1e3,"Browser Surface view unmounted"),d.current=void 0}),[Y,V,I]);const K=g.useCallback(()=>{x.current=0,Y({preserveFrame:!0})},[Y]),ee=g.useCallback(me=>{const Ae=d.current;return!Ae||Ae.readyState!==WebSocket.OPEN?!1:(Ae.send(JSON.stringify(me)),!0)},[]),oe=g.useCallback(()=>{var Ae;const me=m.current;!me||!C.current||(ee({type:"browser.surface.driver.take",subscriptionId:me.subscriptionId,browserGeneration:me.browserGeneration,viewportRevision:h.current}),(Ae=u.current)==null||Ae.focus())},[ee]),ce=g.useCallback(()=>{const me=m.current;me&&(V(),u.current&&(u.current.value=""),ee({type:"browser.surface.driver.release",subscriptionId:me.subscriptionId,browserGeneration:me.browserGeneration}))},[ee,V]),Z=g.useCallback(me=>{const Ae=m.current;return!Ae||!C.current||!E.current?!1:ee({type:"browser.surface.input",subscriptionId:Ae.subscriptionId,browserGeneration:Ae.browserGeneration,viewportRevision:h.current,inputSequence:v.current++,event:me})},[ee]),le=g.useCallback(me=>{let Ae;try{Ae=xW(me)}catch{return D("Text input is limited to 64 KiB at a time."),!1}let Le=!1;for(const je of Ae){if(!Z({type:"text.insert",text:je}))return Le;Le=!0}return Le},[Z]),ie=g.useCallback(()=>{k.current!==void 0&&(window.cancelAnimationFrame(k.current),k.current=void 0);const me=S.current,Ae=N.current;S.current=void 0,N.current=void 0,E.current&&(me&&Z({...me}),Ae&&Z({...Ae}))},[Z]),Se=g.useCallback(()=>{k.current===void 0&&(k.current=window.requestAnimationFrame(ie))},[ie]);g.useEffect(()=>{E.current=F,F||(V(),u.current&&(u.current.value="",u.current.blur()))},[F,V]);const be=g.useCallback(me=>{var at;if(!F)return;const Ae=c5(me.currentTarget,me.clientX,me.clientY);if(!Ae)return;if(me.type==="pointermove"){S.current={type:"pointer.move",...Ae,modifiers:Vh(me)},Se(),me.preventDefault();return}ie(),me.type==="pointerdown"&&((at=u.current)==null||at.focus(),me.currentTarget.setPointerCapture(me.pointerId));const Le=me.type==="pointerdown"?"pointer.down":"pointer.up",je=yW(R.current,me);if(!je)return;const Ye={type:Le,...Ae,button:je,modifiers:Vh(me)};Z(Ye)&&me.preventDefault()},[F,Z,ie,Se]),Ce=g.useCallback(me=>{if(!F)return;const Ae=c5(me.currentTarget,me.clientX,me.clientY);if(!Ae)return;const Le=me.deltaMode===bW?16:me.deltaMode===wW?Math.max(1,me.currentTarget.clientHeight):1,je=N.current,Ye=_W((je==null?void 0:je.deltaX)??0,(je==null?void 0:je.deltaY)??0,me.deltaX*Le,me.deltaY*Le);N.current={type:"wheel",...Ae,...Ye,modifiers:Vh(me)},Se(),me.preventDefault()},[F,Se]),Q=g.useCallback(me=>{if(me.nativeEvent.isComposing||me.key==="Process"||me.key==="Dead")return;ie();const Ae=Z({type:me.type==="keydown"?"key.down":"key.up",key:me.key,code:me.code,repeat:me.repeat,modifiers:Vh(me)}),Le=EW({type:me.type,key:me.key,altKey:me.altKey,ctrlKey:me.ctrlKey,metaKey:me.metaKey,isComposing:me.nativeEvent.isComposing}),je=Le===void 0?!1:le(Le);(Ae||je)&&me.preventDefault()},[Z,le,ie]),re=g.useCallback(me=>{ie();const Ae=me.clipboardData.getData("text/plain");Ae&&le(Ae)&&me.preventDefault()},[le,ie]),ye=g.useCallback(me=>{const Ae=me.data||me.currentTarget.value;me.currentTarget.value="",Ae&&le(Ae)},[le]);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:be,onPointerDown:be,onPointerUp:be,onPointerCancel:be,onWheel:Ce}),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:Q,onKeyUp:Q,onPaste:re,onCompositionEnd:ye}),M==="connecting"&&l.jsx(u5,{preserveFrame:z,icon:l.jsx(Ve,{className:"size-5 animate-spin"}),label:z?"Reconnecting preview…":"Connecting preview…"}),M==="ready"&&!U&&l.jsx(u5,{icon:l.jsx(Ve,{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:$??"The Browser Surface ended."})]})}),s&&za.createPortal(l.jsx("div",{className:"flex items-center",children:M==="closed"?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:K,children:l.jsx(At,{className:"size-4"})}):M!=="ready"||!U?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":w.current?"Reconnecting browser preview":"Connecting browser preview",title:w.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:l.jsx(Ve,{className:"size-4 animate-spin"})}):F?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:ce,children:l.jsx(tB,{className:"size-4"})}):l.jsx(he,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:oe,children:l.jsx(iB,{className:"size-4"})})}),s),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:$??(F?"Browser control active":`Browser preview ${M}`)})]})}async function CW(e,t,r,i,s){const o=JF(new Uint8Array(e));if(!i||o.subscriptionId!==i.subscriptionId||o.format!==i.format)throw new Error("Browser Surface image does not match the active subscription");const u=await createImageBitmap(new Blob([o.encodedBytes],{type:o.format==="jpeg"?"image/jpeg":"image/png"}));try{if(!s()||!r||t.readyState!==WebSocket.OPEN)return;r.width=o.width,r.height=o.height;const d=r.getContext("2d",{alpha:!1});if(!d)throw new Error("Browser preview canvas is unavailable");return d.drawImage(u,0,0,o.width,o.height),t.send(JSON.stringify({type:"browser.surface.frame.ack",subscriptionId:i.subscriptionId,frameSequence:o.frameSequence})),o.viewportRevision}finally{u.close()}}function EW(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 RW(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({generation:String(e.browserGeneration),role:"control",format:"jpeg",quality:"75",maximumFrameRate:"15",capability:e.capability});return`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${r.toString()}`}function c5(e,t,r){const i=e.getBoundingClientRect();if(!(i.width<=0||i.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-i.left)*e.width/i.width)),y:Math.max(0,Math.min(e.height,(r-i.top)*e.height/i.height))}}function Vh(e){const t=[];return e.altKey&&t.push("alt"),e.ctrlKey&&t.push("control"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift"),t}function u5({icon:e,label:t,preserveFrame:r=!1}){return l.jsx("div",{className:r?"absolute inset-0 grid place-items-center bg-[#111318]/55 text-white":"absolute inset-0 grid place-items-center bg-[#111318] text-white/70",children:l.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 text-sm",children:[e,t]})})}function kW(e){return e==="replaced"?"This preview was opened somewhere else.":e==="generation_changed"?"The Browser was restarted.":e==="page_closed"?"This Browser page was closed.":e==="idle_timeout"?"The Browser preview timed out.":e==="unauthorized"?"Browser preview authorization expired.":"The Browser preview ended."}function d5(e){return e===4403?"Browser preview authorization failed.":e===4406?"The selected Runtime cannot provide this Browser preview.":e===4408?"The Browser preview client was too slow.":e===1012?"The selected Runtime disconnected.":"The Browser preview connection closed."}const NW=400;function AW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}){const s=g.useRef(null),[o,u]=g.useState(0),[d,m]=g.useState("mounting"),[h,v]=g.useState("unavailable"),[p,x]=g.useState(!1),[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,N=s.current;if(!S||!N){m("unavailable");return}let k=!1,R=0,M;const L=s_(C),$=async()=>{if(k)return;const B=TW(N.getBoundingClientRect());if(!B){S.park(C);return}try{const j=await S.mount(C,B);if(k)return;if(j==="mounted"){m("mounted"),M!==void 0&&window.clearTimeout(M),M=void 0;return}}catch{}k||(m("mounting"),M=window.setTimeout(()=>void $(),NW))},D=()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>void $())},q=new ResizeObserver(D);q.observe(N),window.addEventListener("resize",D),window.addEventListener("scroll",D,!0);const G=S.onState(B=>{if(s_(B.resource)===L){if(B.state==="closed"){m("unavailable");return}D()}}),W=S.onDriver(B=>{s_(B.resource)===L&&(v(B.driver),B.driver==="desktop"&&(x(!1),w(void 0)))});return v(S.getDriver(C)),m("mounting"),D(),()=>{k=!0,q.disconnect(),G(),W(),window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0),window.cancelAnimationFrame(R),M!==void 0&&window.clearTimeout(M),S.park(C)}},[C,o]);const E=async()=>{const S=window.rynxDesktopBrowser;if(!(!S||p)){x(!0),w(void 0);try{if(await S.takeBack(C)!=="taken")throw new Error("The remote controller is no longer available.")}catch(N){x(!1),w(N instanceof Error?N.message:"Could not take back browser control.")}}};return l.jsxs("div",{ref:s,className:"relative flex min-h-0 flex-1 overflow-hidden bg-white","aria-label":"Embedded session browser page",children:[d!=="mounted"&&l.jsx("div",{className:"absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center",children:d==="mounting"?l.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ve,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),l.jsxs(he,{size:"sm",variant:"outline",onClick:()=>u(S=>S+1),children:[l.jsx(At,{}),"Retry"]})]})}),d==="mounted"&&h==="stream"&&l.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:l.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[l.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),l.jsxs(he,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void E(),children:[p?l.jsx(Ve,{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 TW(e){const t=Math.max(0,Math.ceil(e.left)),r=Math.max(0,Math.ceil(e.top)),i=Math.min(window.innerWidth,Math.floor(e.right)),s=Math.min(window.innerHeight,Math.floor(e.bottom));return i<=t||s<=r?null:{x:t,y:r,width:i-t,height:s-r}}function s_(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const MW="size-11 sm:size-8";function jW({sessionId:e,runtimeSelector:t,pageId:r,browserResource:i}){const{browser:s,loading:o,pendingAction:u,error:d,disabled:m,load:h,openBrowser:v,closeBrowser:p,recreateForDesktop:x,navigatePage:b,backPage:w,forwardPage:C,reloadPage:E}=i,S=g.useMemo(()=>s==null?void 0:s.pages.find(D=>D.pageId===r),[s,r]),N=s!==null&&dW(t,s,typeof window.rynxDesktopBrowser<"u"),k=s!==null&&s.sessionId===e&&hW(t,s,typeof window.rynxDesktopBrowser<"u"),R=s!==null&&s.sessionId===e&&fW(t,s,typeof window.rynxDesktopBrowser<"u"),M=g.useRef(null),[L,$]=g.useState(null);return g.useEffect(()=>{const D=`${t}
531
- ${e}`;!k||M.current===D||(M.current=D,x())},[k,x,t,e]),o&&s===null?l.jsx(a_,{label:"Loading browser…"}):s===null?l.jsx(DW,{error:d,pending:u!==null,onOpen:D=>void v(D),onRetry:()=>void h(!0)}):l.jsxs("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]","aria-label":"Session browser page",children:[l.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[l.jsx(Gh,{label:"Go back",disabled:m||!(S!=null&&S.canGoBack),onClick:()=>S&&void w(S.pageId),children:l.jsx(Gl,{})}),l.jsx(Gh,{label:"Go forward",disabled:m||!(S!=null&&S.canGoForward),onClick:()=>S&&void C(S.pageId),children:l.jsx(kR,{})}),l.jsx(Gh,{label:"Reload page",disabled:m||!S,onClick:()=>S&&void E(S.pageId),children:l.jsx(PR,{className:S!=null&&S.loading?"animate-spin":void 0})})]}),S?l.jsx(LW,{page:S,disabled:m,onNavigate:D=>void b(S.pageId,D)},`${S.pageId}
532
- ${S.url}`):l.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!N&&l.jsx("div",{ref:$,className:"flex shrink-0 items-center"}),R&&l.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void x(),children:"Open in app"}),l.jsx(Gh,{label:"Stop browser",disabled:u!==null,onClick:()=>void p(),children:l.jsx(z_,{})})]}),l.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[k?l.jsx(a_,{label:"Opening in Desktop…"}):s.status==="ready"&&S?N?l.jsx(AW,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:S.pageId}):l.jsx(SW,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:S.pageId,toolbarHost:L}):s.status==="ready"?l.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]",children:"No browser page is open."}):s.status==="unavailable"?l.jsx(OW,{error:d,pending:u!==null,onRestart:()=>void v()}):l.jsx(a_,{label:s.status==="closing"?"Closing browser…":"Starting browser…"}),d&&s.status!=="unavailable"&&l.jsx("div",{role:"alert",className:"absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm",children:d})]}),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:u??d??(s.status==="ready"?"Browser ready":`Browser ${s.status}`)})]})}function DW({error:e,pending:t,onOpen:r,onRetry:i}){const[s,o]=g.useState(""),u=d=>{d.preventDefault(),r(rM(s))};return l.jsx(bn,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:l.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:l.jsxs("form",{onSubmit:u,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Pu,{className:"size-5"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"text-base font-semibold",children:"Open a browser for this session"}),l.jsx("p",{className:"mt-1 text-sm leading-5 text-[var(--muted-foreground)]",children:"The browser runs on the selected Runtime, beside the agent using it."})]})]}),l.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[l.jsx(Et,{value:s,onChange:d=>o(d.target.value),"aria-label":"Initial browser address",placeholder:"https://example.com (optional)",className:"h-11 flex-1 sm:h-9",disabled:t,autoFocus:!0}),l.jsxs(he,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?l.jsx(Ve,{className:"animate-spin"}):l.jsx(Pu,{}),t?"Opening…":"Open browser"]})]}),e&&l.jsxs("div",{role:"alert",className:"mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",children:[l.jsx("span",{children:e}),l.jsx(he,{type:"button",variant:"ghost",size:"sm",onClick:i,children:"Retry"})]}),l.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function LW({page:e,disabled:t,onNavigate:r}){const[i,s]=g.useState(e.url),o=u=>{u.preventDefault();const d=rM(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(Et,{value:i,onChange:u=>s(u.target.value),"aria-label":"Browser address",className:"h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8",disabled:t,spellCheck:!1})})}function Gh({label:e,disabled:t,onClick:r,children:i}){return l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:MW,"aria-label":e,title:e,disabled:t,onClick:r,children:i})}function a_({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(Ve,{className:"size-4 animate-spin"}),e]})}function OW({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(At,{className:"size-5 text-[var(--muted-foreground)]"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&l.jsx(Ve,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function BW(e,t,r,i){return r===i?t:e}new TextEncoder;const PW=4,IW=5*1024*1024,zW=20*1024*1024,$W=8192,UW=4e7,HW=["image/png","image/jpeg","image/webp"];function FW(){return{enabled:!0,mediaTypes:[...HW],maxImagesPerMessage:PW,maxImageBytes:IW,maxMessageBytes:zW,maxImageSide:$W,maxImagePixels:UW}}function iM(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const R0=FW(),h5={...R0,enabled:!1};function nM({policy:e,upload:t,deleteResource:r,onChange:i}){const[s,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 h=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=Gu("attachment"),N=Gu("upl"),k=URL.createObjectURL(E),R=E.type;if(!e.mediaTypes.includes(R)){m($=>[...$,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:"Unsupported image type"}]);continue}if(E.size<=0||E.size>e.maxImageBytes){m($=>[...$,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:`Image must be smaller than ${WW(e.maxImageBytes)}`}]);continue}const M={id:S,file:E,clientUploadId:N,previewUrl:k,state:t?"uploading":"ready"};if(m($=>[...$,M]),!t)continue;const L=new AbortController;d.current.set(S,L),t(E,N,L.signal).then($=>{if(d.current.delete(S),!u.current.some(D=>D.id===S)){r==null||r($).catch(()=>{});return}m(D=>D.map(q=>q.id===S?{...q,state:"ready",resource:$}:q))}).catch($=>{d.current.delete(S),!L.signal.aborted&&m(D=>D.map(q=>q.id===S?{...q,state:"failed",error:$ instanceof Error?$.message:"Upload failed"}:q))})}}},[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(),h(w))},[h]),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]),x=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:s,addFiles:h,onPaste:v,remove:p,clear:x,hasPending:s.some(b=>b.state==="uploading"),hasFailed:s.some(b=>b.state==="failed"),readyResources:s.flatMap(b=>b.state==="ready"&&b.resource?[b.resource]:[]),readyUploads:s.flatMap(b=>b.state==="ready"?[{file:b.file,clientUploadId:b.clientUploadId}]:[])}}function sM({images:e,disabled:t,onRemove:r,className:i}){return e.length===0?null:l.jsx("div",{className:Fe("flex gap-2 overflow-x-auto px-2 pb-2",i),"aria-label":"Attached images",children:e.map(s=>l.jsxs("div",{className:"group relative size-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",title:s.error??s.file.name,children:[l.jsx("img",{src:s.previewUrl,alt:s.file.name,className:"size-full object-cover"}),s.state==="uploading"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:l.jsx(Ve,{className:"size-5 animate-spin"})}),s.state==="failed"&&l.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white",children:"Upload failed"}),l.jsx("button",{type:"button",className:"absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45","aria-label":`Remove ${s.file.name}`,disabled:t,onClick:()=>r(s),children:l.jsx(Aa,{className:"size-3"})})]},s.id))})}function aM({policy:e,imageCount:t,disabled:r,onFiles:i,className:s}){const o=g.useRef(null);function u(d){i(Array.from(d.target.files??[])),d.target.value=""}return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:o,type:"file",accept:e.mediaTypes.join(","),multiple:!0,className:"hidden",onChange:u}),l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:Fe("size-8 shrink-0",s),disabled:r||!e.enabled||t>=e.maxImagesPerMessage,"aria-label":"Attach images",title:`Attach up to ${e.maxImagesPerMessage} images`,onClick:()=>{var d;return(d=o.current)==null?void 0:d.click()},children:t>0?l.jsx(LO,{}):l.jsx(hB,{})})]})}function WW(e){return`${Math.round(e/(1024*1024))} MB`}const o_=200;function qW({initialDraft:e,model:t,running:r,disabled:i,sessionId:s,runtimeSelector:o,onSend:u,onStop:d}){const[m,h]=g.useState(e??""),[v,p]=g.useState(h5),[x,b]=g.useState(!1),w=g.useRef(null),C=g.useRef(!1),E=g.useRef(void 0),S=g.useRef(0),N=g.useRef(!1),k=nM({policy:v,upload:(L,$,D)=>xe.uploadSessionResource(o,s,L,$,D),deleteResource:L=>xe.deleteSessionResource(o,s,L.resourceId),onChange:()=>{E.current=void 0}});g.useEffect(()=>{let L=!1;return xe.getSessionResourcePolicy(o,s).then($=>{L||p($)}).catch(()=>{L||p(h5)}),()=>{L=!0}},[o,s]),g.useLayoutEffect(()=>{const L=w.current;if(!L)return;L.style.height="auto";const $=L.scrollHeight;L.style.height=`${Math.min($,o_)}px`,L.style.overflowY=$>o_?"auto":"hidden"},[m]);async function R(){if(N.current)return;const L=m,$=S.current,D=m.trim(),q=k.readyResources;if(!D&&q.length===0||k.hasPending||k.hasFailed)return;const G=q.length>0?E.current??Gu("msg"):void 0;G&&(E.current=G),N.current=!0,b(!0),h("");try{await u({text:D,images:q,clientMessageId:G}),k.clear(),E.current=void 0}catch(W){_e.error(`Could not send message: ${W instanceof Error?W.message:"unknown error"}`),Ty(W)?h(B=>BW(B,L,S.current,$)):(k.clear(),E.current=void 0)}finally{N.current=!1,b(!1)}}const M=!i&&!x&&!k.hasPending&&!k.hasFailed&&(!!m.trim()||k.images.length>0);return l.jsx("div",{className:"px-4 pb-3 pt-1",children:l.jsxs("div",{className:"mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]",children:[l.jsx(sM,{images:k.images,disabled:x,onRemove:k.remove}),l.jsx("textarea",{ref:w,value:m,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:i,onChange:L=>{S.current+=1,E.current=void 0,h(L.target.value)},onPaste:L=>{x||k.onPaste(L)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!C.current&&!L.nativeEvent.isComposing&&L.keyCode!==229&&(L.preventDefault(),M&&R())},className:Fe("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:o_}}),l.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[l.jsx(aM,{policy:v,imageCount:k.images.length,disabled:i||x,onFiles:k.addFiles}),t&&l.jsx("span",{className:"min-w-0 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]",children:t}),r?l.jsxs(he,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:d,title:"Stop the running turn",children:[l.jsx(HB,{})," Stop"]}):l.jsxs(he,{className:"ml-auto h-8 shrink-0",onClick:R,disabled:!M,children:[l.jsx(IR,{})," Send"]})]})]})})}const oM=24,VW={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function GW({pages:e,order:t,selectedPageId:r,selectionDisabled:i,mutationDisabled:s,createDisabled:o,createPending:u,emulatorAttached:d,emulator:m,onSelectPage:h,onClosePage:v,onCreatePage:p,onSelectEmulator:x,onCloseEmulator:b,onAddEmulator:w,headerLeadingAction:C,leadingAction:E,trailingAction:S}){const N=g.useRef(null),k=g.useRef(null),R=g.useRef(null),M=g.useRef(null),L=g.useRef(null),$=g.useRef(null),[D,q]=g.useState(VW),G=t.flatMap(F=>{if(F===Wn())return m?[{type:"emulator",key:F,emulator:m}]:[];const V=e.find(I=>Fn(I.pageId)===F);return V?[{type:"browser",key:F,page:V}]:[]}),W=G.map(F=>F.key).join(`
533
- `),B=G.length,j=g.useCallback(()=>{const F=N.current,V=k.current,I=R.current;if(!(!F||!V||!I))return pW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,contentWidth:I.scrollWidth,availableWidth:F.clientWidth})},[]),O=g.useCallback(()=>{const F=j();F&&q(V=>YW(V,F)?V:F)},[j]),z=g.useCallback(()=>{L.current===null&&(L.current=window.requestAnimationFrame(()=>{L.current=null,O()}))},[O]),T=g.useCallback(F=>{const V=k.current,I=M.current;if(!V||!I)return;const Y=V.getBoundingClientRect(),K=I.getBoundingClientRect(),ee=vW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,tabLeft:V.scrollLeft+K.left-Y.left,tabWidth:K.width,inset:oM});ee!==0&&V.scrollBy({left:ee,behavior:F})},[]),U=g.useCallback(F=>{const V=k.current;if(!V)return;const I=gW(V.clientWidth);V.scrollBy({left:F==="left"?-I:I,behavior:m5()})},[]);g.useEffect(()=>()=>{L.current!==null&&window.cancelAnimationFrame(L.current)},[]),g.useLayoutEffect(()=>{const F=N.current,V=k.current,I=R.current;if(!F||!V||!I)return;const Y=()=>{const ee=V.clientWidth,oe=$.current===null||Math.abs(ee-$.current)>1;$.current=ee,z(),oe&&T("auto")},K=typeof ResizeObserver>"u"?void 0:new ResizeObserver(Y);return K==null||K.observe(F),K==null||K.observe(V),K==null||K.observe(I),window.addEventListener("resize",Y),O(),()=>{K==null||K.disconnect(),window.removeEventListener("resize",Y)}},[T,z,O]),g.useEffect(()=>{const F=k.current;if(!F)return;const V=I=>{if(I.ctrlKey||I.deltaY===0||Math.abs(I.deltaY)<=Math.abs(I.deltaX))return;const Y=j();(I.deltaY<0?Y!=null&&Y.canScrollLeft:Y!=null&&Y.canScrollRight)&&(I.preventDefault(),F.scrollLeft+=I.deltaY,z())};return F.addEventListener("wheel",V,{passive:!1}),()=>F.removeEventListener("wheel",V)},[j,z]),g.useLayoutEffect(()=>{T(m5()),z()},[W,T,z,D.hasOverflow,r]);function H(F,V){var K;let I;if(F.key==="ArrowLeft"?I=(V-1+B)%B:F.key==="ArrowRight"?I=(V+1)%B:F.key==="Home"?I=0:F.key==="End"&&(I=B-1),I===void 0||I===V)return;F.preventDefault();const Y=(K=R.current)==null?void 0:K.querySelectorAll('[role="tab"]').item(I);Y==null||Y.focus(),Y==null||Y.click()}return l.jsxs("div",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[C&&l.jsx("div",{className:"mb-1 flex h-8 shrink-0 items-center",children:C}),l.jsxs("div",{ref:N,className:"flex min-w-0 flex-1 items-end gap-1",children:[D.hasOverflow&&l.jsx(f5,{direction:"left",disabled:!D.canScrollLeft,onClick:()=>U("left")}),l.jsx("div",{ref:k,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:KW(D),onScroll:z,children:l.jsx("div",{ref:R,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:G.map((F,V)=>{if(F.type==="emulator"){const ee=F.emulator;return l.jsxs("div",{ref:ee.selected?M:void 0,role:"presentation",className:ee.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":ee.selected,"aria-label":ee.label,title:ee.label,tabIndex:ee.selected?0:-1,onClick:x,onKeyDown:oe=>H(oe,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[ee.busy?l.jsx(Ve,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Yl,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:ee.label})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:b,className:"ml-1",children:l.jsx(Aa,{className:"size-3"})})]},F.key)}const I=F.page,Y=I.pageId===r,K=I.title||I.url||"New page";return l.jsxs("div",{ref:Y?M:void 0,role:"presentation",className:Y?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":Y,"aria-label":K,title:K,tabIndex:Y?0:-1,disabled:i,onClick:()=>h(I.pageId),onKeyDown:ee=>H(ee,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[I.loading?l.jsx(Ve,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Pu,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:K})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${K}`,title:`Close ${K}`,disabled:s,onClick:()=>v(I.pageId),className:"ml-1",children:l.jsx(Aa,{className:"size-3"})})]},F.key)})})}),D.hasOverflow&&l.jsx(f5,{direction:"right",disabled:!D.canScrollRight,onClick:()=>U("right")})]}),E&&l.jsx("div",{className:"mb-1 shrink-0",children:E}),l.jsxs(K_,{children:[l.jsx(Of,{asChild:!0,children:l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:l.jsx(en,{})})}),l.jsxs(Bf,{align:"end",children:[l.jsxs(Pf,{disabled:o,"aria-busy":u,onSelect:p,children:[u?l.jsx(Ve,{className:"animate-spin"}):l.jsx(Pu,{}),u?"Creating browser tab…":"New browser tab"]}),l.jsxs(Pf,{onSelect:w,children:[l.jsx(Yl,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),S&&l.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:S})]})}function f5({direction:e,disabled:t,onClick:r}){const i=e==="left"?AR:jo;return l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-7","aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:r,children:l.jsx(i,{})})}function m5(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function YW(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function KW(e){const t=`${oM}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 XW=8,ZW=256,QW=4e3;function JW({sessionId:e,runtimeSelector:t,controller:r}){return r.binding?l.jsx(tq,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r}):l.jsx(eq,{controller:r})}function eq({controller:e}){const[t,r]=g.useState(null),i=async s=>{r(s);try{await e.attach(s)}catch(o){_e.error(`Could not attach Emulator: ${o.message}`)}finally{r(null)}};return l.jsx(bn,{className:"min-h-0 flex-1",children:l.jsx("div",{className:"p-4 sm:p-5",children:l.jsxs("div",{className:"mx-auto max-w-2xl",children:[l.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),l.jsx(he,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:l.jsx(At,{className:Fe("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(cM,{icon:l.jsx(Ve,{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(I_,{className:"mx-auto mb-3 size-6 text-[var(--muted-foreground)]"}),l.jsx("p",{className:"text-sm font-medium",children:"No Emulator is available"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Boot a simulator on this Runtime, or release one from another Session."})]}):l.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.devices.map(s=>l.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void i(s.id),className:"group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60",children:[l.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]",children:t===s.id?l.jsx(Ve,{className:"size-4 animate-spin"}):l.jsx(I_,{className:"size-4"})}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate text-sm font-medium",children:s.name}),l.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[l.jsx(lM,{state:s.state}),l.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:s.backend})]})]})]},`${s.backend}:${s.id}`))})]})})})}function tq({sessionId:e,runtimeSelector:t,binding:r,controller:i}){const[s,o]=g.useState(null),[u,d]=g.useState(!1),[m,h]=g.useState(null),[v,p]=g.useState(null),x=g.useRef(null),b=g.useRef(null),w=g.useRef(null),C=g.useRef(null),E=g.useRef(null);g.useEffect(()=>{o(null),d(!1),p(null),h(null);let D=!1,q,G,W=0,B=0,j=!1,O=null,z,T="png";const U=()=>{G!==void 0&&window.clearTimeout(G),G=void 0,h(null)},H=(Y,K=!1)=>{if(G!==void 0&&window.clearTimeout(G),K||O===null){h(Y);return}G=window.setTimeout(()=>{G=void 0,D||h(Y)},QW)},F=Y=>{if(D)return;const K=URL.createObjectURL(Y),ee=O;O=K,o(K),U(),W=0,j=!1,ee&&window.setTimeout(()=>URL.revokeObjectURL(ee),1e3)},V=(Y,K=!1)=>{if(D)return;q!==void 0&&window.clearTimeout(q);const ee=K?0:Math.min(8e3,500*2**W++);q=window.setTimeout(()=>void Y(K),ee)},I=async(Y=!1)=>{const K=++B;try{const ee=await Wu(Y);if(D||K!==B)return;const oe=new WebSocket(rq({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:ee}));z=oe,oe.binaryType="arraybuffer",oe.onmessage=ce=>{if(D||K!==B||z!==oe)return;if(typeof ce.data=="string"){try{const ie=JSON.parse(ce.data);if(ie.type!=="emulator.surface.ready"||typeof ie.surfaceId!="string"||ie.format!=="png"&&ie.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");T=ie.format,b.current={socket:oe,surfaceId:ie.surfaceId,inputSequence:0}}catch{oe.close(4400,"invalid Emulator Surface ready frame")}return}const Z=ce.data instanceof ArrayBuffer||ce.data instanceof Blob?ce.data:null,le=T==="jpeg"?"image/jpeg":"image/png";Z instanceof Blob?F(new Blob([Z],{type:le})):Z&&F(new Blob([Z],{type:le}))},oe.onclose=ce=>{var le;if(D||K!==B||z!==oe)return;((le=b.current)==null?void 0:le.socket)===oe&&(b.current=null);const Z=new Error(ce.code===4406?"emulator_surface_upgrade_required":ce.reason||"Remote Emulator Surface disconnected");H(Z,ce.code===4406),ce.code!==4406&&((ce.code===4403||ce.code===1006)&&!j?(j=!0,V(I,!0)):V(I))},oe.onerror=()=>{}}catch(ee){if(D||K!==B)return;H(ee instanceof Error?ee:new Error(String(ee))),V(I)}};return I(),()=>{D=!0,B+=1,b.current=null,z==null||z.close(1e3,"Session Emulator pane closed"),q!==void 0&&window.clearTimeout(q),G!==void 0&&window.clearTimeout(G),O&&URL.revokeObjectURL(O)}},[r.backend,r.bindingId,t,e]);const S=g.useCallback((D,q,G)=>{const W=b.current;if(!W||W.socket.readyState!==WebSocket.OPEN||G!==void 0&&W.surfaceId!==G)return!1;try{return W.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:W.surfaceId,inputSequence:W.inputSequence++,phase:D,...q})),!0}catch{return!1}},[]),N=g.useCallback(()=>{C.current!==null&&window.cancelAnimationFrame(C.current),C.current=null;const D=w.current;w.current=null,D&&S("move",D,D.surfaceId)},[S]),k=g.useCallback(D=>{const q=x.current;if(!q)return null;const G=q.getBoundingClientRect();return G.width<=0||G.height<=0?null:{x:Math.max(0,Math.min(1,(D.clientX-G.left)/G.width)),y:Math.max(0,Math.min(1,(D.clientY-G.top)/G.height))}},[]),R=D=>{var B;if(i.mutating)return;const q=k(D.nativeEvent);if(!q)return;D.currentTarget.setPointerCapture(D.pointerId);const G=((B=b.current)==null?void 0:B.surfaceId)??null,W=G!==null&&S("begin",q,G);E.current={pointerId:D.pointerId,startX:D.clientX,startY:D.clientY,lastPoint:q,points:[{type:"begin",...q}],live:W,surfaceId:W?G:null}},M=D=>{const q=E.current;if(!q||q.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);G&&q.live?(q.lastPoint=G,w.current=q.surfaceId?{...G,surfaceId:q.surfaceId}:null,C.current===null&&(C.current=window.requestAnimationFrame(()=>N()))):G&&q.points.length<ZW-1&&(q.lastPoint=G,q.points.push({type:"move",...G}))},L=D=>{const q=E.current;if(E.current=null,!q||q.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);if(!G)return;if(q.live){N(),q.surfaceId&&S("end",G,q.surfaceId);return}(Math.hypot(D.clientX-q.startX,D.clientY-q.startY)>XW?i.gesture([...q.points,{type:"end",...G}]):i.tap(G.x,G.y)).catch(j=>_e.error(`Emulator input failed: ${j.message}`))},$=async()=>{try{await i.detach()}catch(D){_e.error(`Could not detach Emulator: ${D.message}`)}};return l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-[var(--background)]",children:[l.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate text-xs font-medium",children:r.deviceName??r.deviceId}),l.jsx(lM,{state:r.deviceState}),!r.available&&l.jsx(_t,{variant:"outline",children:"Unavailable"}),m&&s&&l.jsxs(_t,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[l.jsx(Ve,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(he,{variant:"ghost",size:"icon-sm",disabled:!r.available||i.mutating,title:"Home","aria-label":"Home",onClick:()=>void i.button("home").catch(D=>_e.error(`Home failed: ${D.message}`)),children:l.jsx(MR,{})}),l.jsxs(he,{variant:"ghost",size:"sm",disabled:i.mutating,title:"Detach from this session",onClick:()=>void $(),children:[i.mutating?l.jsx(Ve,{className:"animate-spin"}):l.jsx(XB,{}),"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(cM,{icon:l.jsx(Ve,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),m&&!s&&l.jsxs("div",{className:"max-w-sm text-center",children:[l.jsx(I_,{className:"mx-auto mb-3 size-7 text-[var(--muted-foreground)]"}),l.jsx("p",{className:"text-sm font-medium",children:t==="local"?"Preview is unavailable":"Remote Emulator Surface is unavailable"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:m.message==="emulator_surface_upgrade_required"?"Upgrade the selected Runtime daemon to a version with Emulator Surface support.":m.message})]}),s&&l.jsx("img",{ref:x,src:s,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:D=>{p({width:D.currentTarget.naturalWidth,height:D.currentTarget.naturalHeight}),d(!0)},onPointerDown:R,onPointerMove:M,onPointerUp:L,onPointerCancel:()=>{const D=E.current;E.current=null,D!=null&&D.live&&(N(),D.surfaceId&&S("end",D.lastPoint,D.surfaceId))},className:"max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]",style:v?{aspectRatio:`${v.width} / ${v.height}`}:void 0})]})]})}function rq(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 lM({state:e}){return l.jsxs(_t,{variant:"outline",className:Fe("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:Fe("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function cM({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 uM="rynx.control.theme";function iq(){const e=localStorage.getItem(uM);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ly(){const[e,t]=g.useState(iq);return g.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(uM,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
534
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
535
- * @license MIT
536
- *
537
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
538
- * @license MIT
539
- *
540
- * Originally forked from (with the author's permission):
541
- * Fabrice Bellard's javascript vt100 for jslinux:
542
- * http://bellard.org/jslinux/
543
- * Copyright (c) 2011 Fabrice Bellard
544
- */var nq=2,sq=1,aq=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var p;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(r.getPropertyValue("height")),s=Math.max(0,parseInt(r.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),u={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},d=u.top+u.bottom,m=u.right+u.left,h=i-d,v=s-m-t;return{cols:Math.max(nq,Math.floor(v/e.css.cell.width)),rows:Math.max(sq,Math.floor(h/e.css.cell.height))}}};/**
545
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
546
- * @license MIT
547
- *
548
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
549
- * @license MIT
550
- *
551
- * Originally forked from (with the author's permission):
552
- * Fabrice Bellard's javascript vt100 for jslinux:
553
- * http://bellard.org/jslinux/
554
- * Copyright (c) 2011 Fabrice Bellard
555
- */var oq=class{constructor(t,r,i,s={}){this._terminal=t,this._regex=r,this._handler=i,this._options=s}provideLinks(t,r){let i=cq.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(i,s)=>{if(this._options.hover){let{range:o}=r;this._options.hover(i,s,o)}},r))}};function lq(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 cq=class mf{static computeLink(t,r,i,s){let o=new RegExp(r.source,(r.flags||"")+"g"),[u,d]=mf._getWindowedLineStrings(t-1,i),m=u.join(""),h,v=[];for(;h=o.exec(m);){let p=h[0];if(!lq(p))continue;let[x,b]=mf._mapStrIdx(i,d,0,h.index),[w,C]=mf._mapStrIdx(i,x,b,p.length);if(x===-1||b===-1||w===-1||C===-1)continue;let E={start:{x:b+1,y:x+1},end:{x:C,y:w+1}};v.push({range:E,text:p,activate:s})}return v}static _getWindowedLineStrings(t,r){let i,s=t,o=t,u=0,d="",m=[];if(i=r.buffer.active.getLine(t)){let h=i.translateToString(!0);if(i.isWrapped&&h[0]!==" "){for(u=0;(i=r.buffer.active.getLine(--s))&&u<2048&&(d=i.translateToString(!0),u+=d.length,m.push(d),!(!i.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(h),u=0;(i=r.buffer.active.getLine(++o))&&i.isWrapped&&u<2048&&(d=i.translateToString(!0),u+=d.length,m.push(d),d.indexOf(" ")===-1););}return[m,s]}static _mapStrIdx(t,r,i,s){let o=t.buffer.active,u=o.getNullCell(),d=i;for(;s;){let m=o.getLine(r);if(!m)return[-1,-1];for(let h=d;h<m.length;++h){m.getCell(h,u);let v=u.getChars();if(u.getWidth()&&(s-=v.length||1,h===m.length-1&&v==="")){let p=o.getLine(r+1);p&&p.isWrapped&&(p.getCell(0,u),u.getWidth()===2&&(s+=1))}if(s<0)return[r,h]}r++,d=0}return[r,d]}},uq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function dq(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 hq=class{constructor(t=dq,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,i=r.urlRegex||uq;this._linkProvider=this._terminal.registerLinkProvider(new oq(this._terminal,i,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
556
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
557
- * @license MIT
558
- *
559
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
560
- * @license MIT
561
- *
562
- * Originally forked from (with the author's permission):
563
- * Fabrice Bellard's javascript vt100 for jslinux:
564
- * http://bellard.org/jslinux/
565
- * Copyright (c) 2011 Fabrice Bellard
566
- */var fq=(e,t,r,i)=>{for(var s=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=u(s)||s);return s},mq=(e,t)=>(r,i)=>t(r,i,e),pq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?p5.isErrorNoTelemetry(e)?new p5(e.message+`
567
-
568
- `+e.stack):new Error(e.message+`
569
-
570
- `+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)}},gq=new pq;function l_(e){vq(e)||gq.onUnexpectedError(e)}var k0="Canceled";function vq(e){return e instanceof _q?!0:e instanceof Error&&e.name===k0&&e.message===k0}var _q=class extends Error{constructor(){super(k0),this.name=this.message}},p5=class N0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof N0)return t;let r=new N0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},xq;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(xq||(xq={}));function yq(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var dM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(R){yield R}e.single=s;function o(R){return t(R)?R:s(R)}e.wrap=o;function u(R){return R||r}e.from=u;function*d(R){for(let M=R.length-1;M>=0;M--)yield R[M]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,M){let L=0;for(let $ of R)if(M($,L++))return!0;return!1}e.some=v;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*x(R,M){for(let L of R)M(L)&&(yield L)}e.filter=x;function*b(R,M){let L=0;for(let $ of R)yield M($,L++)}e.map=b;function*w(R,M){let L=0;for(let $ of R)yield*M($,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let $=L;for(let D of R)$=M($,D);return $}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let $=R[Symbol.iterator]();for(let D=0;D<M;D++){let q=$.next();if(q.done)return[L,e.empty()];L.push(q.value)}return[L,{[Symbol.iterator](){return $}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(dM||(dM={}));function hM(e){if(dM.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 fM(...e){return Gr(()=>hM(e))}function Gr(e){return{dispose:yq(()=>{e()})}}var mM=class pM{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{hM(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?pM.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)}};mM.DISABLE_DISPOSED_WARNING=!1;var Vl=mM,wn=class{constructor(){this._store=new Vl,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)}};wn.None=Object.freeze({dispose(){}});var lu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Oy=typeof process<"u"&&"title"in process,Dm=Oy?"node":navigator.userAgent,bq=Oy?"node":navigator.platform,wq=Dm.includes("Firefox"),Sq=Dm.includes("Edge"),gM=/^((?!chrome|android).)*safari/i.test(Dm);function Cq(){if(!gM)return 0;let e=Dm.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}bq.indexOf("Linux")>=0;var Eq="",Cr=0,Er=0,Rr=0,Kt=0,qi={css:"#00000000",rgba:0},Qr;(e=>{function t(s,o,u,d){return d!==void 0?`#${fo(s)}${fo(o)}${fo(u)}${fo(d)}`:`#${fo(s)}${fo(o)}${fo(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(Qr||(Qr={}));var Eu;(e=>{function t(m,h){if(Kt=(h.rgba&255)/255,Kt===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,p=h.rgba>>16&255,x=h.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Cr=b+Math.round((v-b)*Kt),Er=w+Math.round((p-w)*Kt),Rr=C+Math.round((x-C)*Kt);let E=Qr.toCss(Cr,Er,Rr),S=Qr.toRgba(Cr,Er,Rr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,v){let p=wo.ensureContrastRatio(m.rgba,h.rgba,v);if(p)return Qr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[Cr,Er,Rr]=wo.toChannels(h),{css:Qr.toCss(Cr,Er,Rr),rgba:h}}e.opaque=s;function o(m,h){return Kt=Math.round(h*255),[Cr,Er,Rr]=wo.toChannels(m.rgba),{css:Qr.toCss(Cr,Er,Rr,Kt),rgba:Qr.toRgba(Cr,Er,Rr,Kt)}}e.opacity=o;function u(m,h){return Kt=m.rgba&255,o(m,Kt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Eu||(Eu={}));var Rq;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Cr=parseInt(s.slice(1,2).repeat(2),16),Er=parseInt(s.slice(2,3).repeat(2),16),Rr=parseInt(s.slice(3,4).repeat(2),16),Qr.toColor(Cr,Er,Rr);case 5:return Cr=parseInt(s.slice(1,2).repeat(2),16),Er=parseInt(s.slice(2,3).repeat(2),16),Rr=parseInt(s.slice(3,4).repeat(2),16),Kt=parseInt(s.slice(4,5).repeat(2),16),Qr.toColor(Cr,Er,Rr,Kt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Cr=parseInt(o[1]),Er=parseInt(o[2]),Rr=parseInt(o[3]),Kt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Qr.toColor(Cr,Er,Rr,Kt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Cr,Er,Rr,Kt]=t.getImageData(0,0,1,1).data,Kt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qr.toRgba(Cr,Er,Rr,Kt),css:s}}e.toColor=i})(Rq||(Rq={}));var Xr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let u=i/255,d=s/255,m=o/255,h=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(Xr||(Xr={}));var wo;(e=>{function t(u,d){if(Kt=(d&255)/255,Kt===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,b=u>>8&255;return Cr=p+Math.round((m-p)*Kt),Er=x+Math.round((h-x)*Kt),Rr=b+Math.round((v-b)*Kt),Qr.toRgba(Cr,Er,Rr)}e.blend=t;function r(u,d,m){let h=Xr.relativeLuminance(u>>8),v=Xr.relativeLuminance(d>>8);if(Es(h,v)<m){if(v<h){let b=i(u,d,m),w=Es(h,Xr.relativeLuminance(b>>8));if(w<m){let C=s(u,d,m),E=Es(h,Xr.relativeLuminance(C>>8));return w>E?b:C}return b}let p=s(u,d,m),x=Es(h,Xr.relativeLuminance(p>>8));if(x<m){let b=i(u,d,m),w=Es(h,Xr.relativeLuminance(b>>8));return x>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Es(Xr.relativeLuminance2(x,b,w),Xr.relativeLuminance2(h,v,p));for(;C<m&&(x>0||b>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Es(Xr.relativeLuminance2(x,b,w),Xr.relativeLuminance2(h,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Es(Xr.relativeLuminance2(x,b,w),Xr.relativeLuminance2(h,v,p));for(;C<m&&(x<255||b<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Es(Xr.relativeLuminance2(x,b,w),Xr.relativeLuminance2(h,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(wo||(wo={}));function fo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Es(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function ur(e){if(!e)throw new Error("value must not be falsy");return e}function By(e){return 57508<=e&&e<=57558}function kq(e){return 57520<=e&&e<=57527}function Nq(e){return 57344<=e&&e<=63743}function Aq(e){return 9472<=e&&e<=9631}function Tq(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 Mq(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!Tq(e)&&!By(e)&&!Nq(e)}function vM(e){return By(e)||Aq(e)}function jq(){return{css:{canvas:Yh(),cell:Yh()},device:{canvas:Yh(),cell:Yh(),char:{width:0,height:0,left:0,top:0}}}}function Yh(){return{width:0,height:0}}function Dq(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Br=0,wr=0,$n=!1,Rs=!1,Kh=!1,mi,c_=0,Lq=class{constructor(e,t,r,i,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,wr=0,Br=0,Rs=!1,$n=!1,Kh=!1,mi=this._themeService.colors,c_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));c_=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",s=>{s.backgroundColorRGB&&(wr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Br=s.foregroundColorRGB.rgba>>8&16777215,$n=!0)}),Kh=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Kh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:wr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:wr=(this.result.fg&16777215)<<8|255;break;case 0:default:wr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:wr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:wr=(this.result.bg&16777215)<<8|255;break}wr=wo.blend(wr,(this._coreBrowserService.isFocused?mi.selectionBackgroundOpaque:mi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else wr=(this._coreBrowserService.isFocused?mi.selectionBackgroundOpaque:mi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Rs=!0,mi.selectionForeground&&(Br=mi.selectionForeground.rgba>>8&16777215,$n=!0),vM(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Br=(this._coreBrowserService.isFocused?mi.selectionBackgroundOpaque:mi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Br=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Br=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Br=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Br=(this.result.fg&16777215)<<8|255;break;case 0:default:Br=this._themeService.colors.foreground.rgba}Br=wo.blend(Br,(this._coreBrowserService.isFocused?mi.selectionBackgroundOpaque:mi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}$n=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",s=>{s.backgroundColorRGB&&(wr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Br=s.foregroundColorRGB.rgba>>8&16777215,$n=!0)}),Rs&&(Kh?wr=e.bg&-16777216&-134217729|wr|50331648:wr=e.bg&-16777216|wr|50331648),$n&&(Br=e.fg&-16777216&-67108865|Br|50331648),this.result.fg&67108864&&(Rs&&!$n&&((this.result.bg&50331648)===0?Br=this.result.fg&-134217728|mi.background.rgba>>8&16777215&16777215|50331648:Br=this.result.fg&-134217728|this.result.bg&67108863,$n=!0),!Rs&&$n&&((this.result.fg&50331648)===0?wr=this.result.bg&-67108864|mi.foreground.rgba>>8&16777215&16777215|50331648:wr=this.result.bg&-67108864|this.result.fg&67108863,Rs=!0)),mi=void 0,this.result.bg=Rs?wr:this.result.bg,this.result.fg=$n?Br:this.result.fg,this.result.ext&=536870911,this.result.ext|=c_<<29&3758096384}},Oq=.5,_M=wq||Sq?"bottom":"ideographic",Bq={"▀":[{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}]},Pq={"░":[[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]]},Iq={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Yu={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Yu[""]=Yu[""];Yu[""]=Yu[""];function zq(e,t,r,i,s,o,u,d){let m=Bq[t];if(m)return $q(e,m,r,i,s,o),!0;let h=Pq[t];if(h)return Uq(e,h,r,i,s,o),!0;let v=Iq[t];if(v)return Hq(e,v,r,i,s,o,d),!0;let p=Yu[t];return p?(Fq(e,p,r,i,s,o,u,d),!0):!1}function $q(e,t,r,i,s,o){for(let u=0;u<t.length;u++){let d=t[u],m=s/8,h=o/8;e.fillRect(r+d.x*m,i+d.y*h,d.w*m,d.h*h)}}var g5=new Map;function Uq(e,t,r,i,s,o){let u=g5.get(t);u||(u=new Map,g5.set(t,u));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let m=u.get(d);if(!m){let h=t[0].length,v=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=h,p.height=v;let x=ur(p.getContext("2d")),b=new ImageData(h,v),w,C,E,S;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),C=parseInt(d.slice(3,5),16),E=parseInt(d.slice(5,7),16),S=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,C,E,S]=d.substring(5,d.length-1).split(",").map(N=>parseFloat(N));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let N=0;N<v;N++)for(let k=0;k<h;k++)b.data[(N*h+k)*4]=w,b.data[(N*h+k)*4+1]=C,b.data[(N*h+k)*4+2]=E,b.data[(N*h+k)*4+3]=t[N][k]*(S*255);x.putImageData(b,0,0),m=ur(e.createPattern(p,null)),u.set(d,m)}e.fillStyle=m,e.fillRect(r,i,s,o)}function Hq(e,t,r,i,s,o,u){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(d);let h;if(typeof m=="function"){let v=.15/o*s;h=m(.15,v)}else h=m;for(let v of h.split(" ")){let p=v[0],x=xM[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||x(e,yM(b,s,o,r,i,!0,u))}e.stroke(),e.closePath()}}function Fq(e,t,r,i,s,o,u,d){let m=new Path2D;m.rect(r,i,s,o),e.clip(m),e.beginPath();let h=u/12;e.lineWidth=d*h;for(let v of t.d.split(" ")){let p=v[0],x=xM[p];if(!x){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=v.substring(1).split(",");!b[0]||!b[1]||x(e,yM(b,s,o,r,i,!1,d,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function v5(e,t,r=0){return Math.max(Math.min(e,t),r)}var xM={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 yM(e,t,r,i,s,o,u,d=0,m=0){let h=e.map(v=>parseFloat(v)||parseInt(v));if(h.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<h.length;v+=2)h[v]*=t-d*u-m*u,o&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,t,0)),h[v]+=i+d*u;for(let v=1;v<h.length;v+=2)h[v]*=r,o&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,r,0)),h[v]+=s;return h}var _5=class{constructor(){this._data={}}set(t,r,i){this._data[t]||(this._data[t]={}),this._data[t][r]=i}get(t,r){return this._data[t]?this._data[t][r]:void 0}clear(){this._data={}}},x5=class{constructor(){this._data=new _5}set(e,t,r,i,s){this._data.get(e,t)||this._data.set(e,t,new _5),this._data.get(e,t).set(r,i,s)}get(e,t,r,i){var s;return(s=this._data.get(e,t))==null?void 0:s.get(r,i)}clear(){this._data.clear()}},bM=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},Wq=class extends bM{_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())}}},qq=class extends bM{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Vq=!Oy&&"requestIdleCallback"in window?qq:Wq,Ul=class wM{constructor(){this.fg=0,this.bg=0,this.extended=new SM}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 wM;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}},SM=class CM{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 CM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Gq=globalThis.performance&&typeof globalThis.performance.now=="function",Yq=class EM{static create(t){return new EM(t)}constructor(t){this._now=Gq&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ms;(e=>{e.None=()=>wn.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,z)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,z),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h((z,T=null,U)=>B(H=>z.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h((z,T=null,U)=>B(H=>{j(H),z.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h((z,T=null,U)=>B(H=>j(H)&&z.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,z)=>{let T=fM(...B.map(U=>U(H=>j.call(O,H))));return v(T,z)}}e.any=d;function m(B,j,O,z){let T=O;return i(B,U=>(T=j(T,U),T),z)}e.reduce=m;function h(B,j){let O,z={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new Bt(z);return j==null||j.add(T),T.event}function v(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,z=!1,T=!1,U,H){let F,V,I,Y=0,K,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(ce=>{Y++,V=j(V,ce),z&&!I&&(oe.fire(V),V=void 0),K=()=>{let Z=V;V=void 0,I=void 0,(!z||Y>1)&&oe.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(K,O)):I===void 0&&(I=0,queueMicrotask(K))})},onWillRemoveListener(){T&&Y>0&&(K==null||K())},onDidRemoveLastListener(){K=void 0,F.dispose()}},oe=new Bt(ee);return H==null||H.add(oe),oe.event}e.debounce=p;function x(B,j=0,O){return e.debounce(B,(z,T)=>z?(z.push(T),z):[T],j,void 0,!0,void 0,O)}e.accumulate=x;function b(B,j=(z,T)=>z===T,O){let z=!0,T;return o(B,U=>{let H=z||!j(U,T);return z=!1,T=U,H},O)}e.latch=b;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,z=>!j(z),O)]}e.split=w;function C(B,j=!1,O=[],z){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});z&&z.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new Bt({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),z&&z.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return z&&z.add(F),F.event}e.buffer=C;function E(B,j){return(O,z,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call(z,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let z=O;return this.steps.push(T=>(z=j(z,T),z)),this}latch(j=(O,z)=>O===z){let O=!0,z;return this.steps.push(T=>{let U=O||!j(T,z);return O=!1,z=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=z=>z){let z=(...F)=>H.fire(O(...F)),T=()=>B.on(j,z),U=()=>B.removeListener(j,z),H=new Bt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=z=>z){let z=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,z),U=()=>B.removeEventListener(j,z),H=new Bt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new Bt;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function $(B,j){return B(O=>j.fire(O))}e.forward=$;function D(B,j,O){return j(O),B(z=>j(z))}e.runAndSubscribe=D;class q{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new Bt(z),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new q(B,j).emitter.event}e.fromObservable=G;function W(B){return(j,O,z)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return z instanceof Vl?z.add(F):Array.isArray(z)&&z.push(F),F}}e.fromObservableLight=W})(Ms||(Ms={}));var A0=class T0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${T0._idPool++}`,T0.all.add(this)}start(t){this._stopWatch=new Yq,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};A0.all=new Set,A0._idPool=0;var Kq=A0,Xq=-1,RM=class kM{constructor(t,r,i=(kM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let m=new Jq(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};RM._idPool=1;var Zq=RM,Qq=class NM{constructor(t){this.value=t}static create(){let t=new Error;return new NM(t.stack??"")}print(){console.warn(this.value.split(`
571
- `).slice(2).join(`
572
- `))}},Jq=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},eV=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},tV=0,u_=class{constructor(e){this.value=e,this.id=tV++}},rV=2,iV,Bt=class{constructor(t){var r,i,s,o;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new Zq((t==null?void 0:t.onListenerError)??l_,((i=this._options)==null?void 0:i.leakWarningThreshold)??Xq):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Kq(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,r,i,s;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(t,r,i)=>{var d,m,h,v,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let x=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(x);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new eV(`${x}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((d=this._options)==null?void 0:d.onListenerError)||l_)(w),wn.None}if(this._disposed)return wn.None;r&&(t=t.bind(r));let s=new u_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Qq.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof u_?(this._deliveryQueue??(this._deliveryQueue=new nV),this._listeners=[this._listeners,s]):this._listeners.push(s):((h=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||h.call(m,this),this._listeners=s,(p=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||p.call(v,this)),this._size++;let u=Gr(()=>{o==null||o(),this._removeListener(s)});return i instanceof Vl?i.add(u):Array.isArray(i)&&i.push(u),u}),this._event}_removeListener(t){var o,u,d,m;if((u=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||u.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(m=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d,this),this._size=0;return}let r=this._listeners,i=r.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*rV<=r.length){let h=0;for(let v=0;v<r.length;v++)r[v]?r[h++]=r[v]:s&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=h}}_deliver(t,r){var s;if(!t)return;let i=((s=this._options)==null?void 0:s.onListenerError)||l_;if(!i){t.value(r);return}try{t.value(r)}catch(o){i(o)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,i,s,o;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof u_)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}},nV=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},y5={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},cu=2,uu,ya=class $l{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new x5,this._cacheMapCombined=new x5,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ul,this._textureSize=512,this._onAddTextureAtlasCanvas=new Bt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Bt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=AM(t,this._config.deviceCellWidth*4+cu*2,this._config.deviceCellHeight+cu*2),this._tmpCtx=ur(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 Vq;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let i=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if($l.maxAtlasPages&&this._pages.length>=Math.max(4,$l.maxAtlasPages)){let r=this._pages.filter(h=>h.canvas.width*2<=($l.maxTextureSize||4096)).sort((h,v)=>v.canvas.width!==h.canvas.width?v.canvas.width-h.canvas.width:v.percentageUsed-h.percentageUsed),i=-1,s=0;for(let h=0;h<r.length;h++)if(r[h].canvas.width!==s)i=h,s=r[h].canvas.width;else if(h-i===3)break;let o=r.slice(i,i+4),u=o.map(h=>h.glyphs[0].texturePage).sort((h,v)=>h>v?1:-1),d=this.pages.length-o.length,m=this._mergePages(o,d);m.version++;for(let h=u.length-1;h>=0;h--)this._deletePage(u[h]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new d_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let i=t[0].canvas.width*2,s=new d_(this._document,i,t);for(let[o,u]of t.entries()){let d=o*u.canvas.width%i,m=Math.floor(o/2)*u.canvas.height;s.ctx.drawImage(u.canvas,d,m);for(let v of u.glyphs)v.texturePage=r,v.sizeClipSpace.x=v.size.x/i,v.sizeClipSpace.y=v.size.y/i,v.texturePosition.x+=d,v.texturePosition.y+=m,v.texturePositionClipSpace.x=v.texturePosition.x/i,v.texturePositionClipSpace.y=v.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let h=this._activePages.indexOf(u);h!==-1&&this._activePages.splice(h,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let i=this._pages[r];for(let s of i.glyphs)s.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,r,i,s,o,u){return this._getFromCacheMap(this._cacheMapCombined,t,r,i,s,o,u)}getRasterizedGlyph(t,r,i,s,o,u){return this._getFromCacheMap(this._cacheMap,t,r,i,s,o,u)}_getFromCacheMap(t,r,i,s,o,u,d){return uu=t.get(r,i,s,o),uu||(uu=this._drawToCache(r,i,s,o,u,d),t.set(r,i,s,o,uu)),uu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,s){if(this._config.allowTransparency)return qi;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(r);break;case 50331648:let u=Ul.toColorRGB(r);o=Qr.toColor(u[0],u[1],u[2]);break;case 0:default:i?o=Eu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Eu.opaque(o)),o}_getForegroundColor(t,r,i,s,o,u,d,m,h,v){let p=this._getMinimumContrastColor(t,r,i,s,o,u,d,h,m,v);if(p)return p;let x;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&u<8&&(u+=8),x=this._getColorFromAnsiIndex(u);break;case 50331648:let b=Ul.toColorRGB(u);x=Qr.toColor(b[0],b[1],b[2]);break;case 0:default:d?x=this._config.colors.background:x=this._config.colors.foreground}return this._config.allowTransparency&&(x=Eu.opaque(x)),m&&(x=Eu.multiplyOpacity(x,Oq)),x}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,i,s,o,u,d,m,h,v){if(this._config.minimumContrastRatio===1||v)return;let p=this._getContrastCache(h),x=p.getColor(t,s);if(x!==void 0)return x||void 0;let b=this._resolveBackgroundRgba(r,i,d),w=this._resolveForegroundRgba(o,u,d,m),C=wo.ensureContrastRatio(b,w,this._config.minimumContrastRatio/(h?2:1));if(!C){p.setColor(t,s,null);return}let E=Qr.toColor(C>>24&255,C>>16&255,C>>8&255);return p.setColor(t,s,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,i,s,o,u){let d=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+cu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let h=Math.min(this._config.deviceCellHeight+cu*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return y5;let v=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),x=!!this._workAttributeData.isDim(),b=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),N=this._workAttributeData.getFgColorMode(),k=this._workAttributeData.getBgColor(),R=this._workAttributeData.getBgColorMode();if(p){let V=S;S=k,k=V;let I=N;N=R,R=I}let M=this._getBackgroundColor(R,k,p,x);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=v?this._config.fontWeightBold:this._config.fontWeight,$=b?"italic":"";this._tmpCtx.font=`${$} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=_M;let D=d.length===1&&By(d.charCodeAt(0)),q=d.length===1&&kq(d.charCodeAt(0)),G=this._getForegroundColor(r,R,k,i,N,S,p,x,v,vM(d.charCodeAt(0)));this._tmpCtx.fillStyle=G.css;let W=q?0:cu*2,B=!1;this._config.customGlyphs!==!1&&(B=zq(this._tmpCtx,d,W,W,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let j=!D,O;if(typeof t=="number"?O=this._unicodeService.wcwidth(t):O=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;if(this._tmpCtx.lineWidth=V,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())j=!1,this._tmpCtx.strokeStyle=`rgb(${Ul.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{j=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let Y=W,K=Math.ceil(W+this._config.deviceCharHeight)-I-(o?V*2:0),ee=K+V,oe=K+V*2,ce=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<O;Z++){this._tmpCtx.save();let le=Y+Z*this._config.deviceCellWidth,ie=Y+(Z+1)*this._config.deviceCellWidth,Se=le+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(le,K),this._tmpCtx.lineTo(ie,K),this._tmpCtx.moveTo(le,oe),this._tmpCtx.lineTo(ie,oe);break;case 3:let be=V<=1?oe:Math.ceil(W+this._config.deviceCharHeight-V/2)-I,Ce=V<=1?K:Math.ceil(W+this._config.deviceCharHeight+V/2)-I,Q=new Path2D;Q.rect(le,K,this._config.deviceCellWidth,oe-K),this._tmpCtx.clip(Q),this._tmpCtx.moveTo(le-this._config.deviceCellWidth/2,ee),this._tmpCtx.bezierCurveTo(le-this._config.deviceCellWidth/2,Ce,le,Ce,le,ee),this._tmpCtx.bezierCurveTo(le,be,Se,be,Se,ee),this._tmpCtx.bezierCurveTo(Se,Ce,ie,Ce,ie,ee),this._tmpCtx.bezierCurveTo(ie,be,ie+this._config.deviceCellWidth/2,be,ie+this._config.deviceCellWidth/2,ee);break;case 4:let re=ce===0?0:ce>=V?V*2-ce:V-ce;ce>=V||re===0?(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(le+re,K),this._tmpCtx.lineTo(ie,K)):(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(le,K),this._tmpCtx.lineTo(le+re,K),this._tmpCtx.moveTo(le+re+V,K),this._tmpCtx.lineTo(ie,K)),ce=Dq(ie-le,V,ce);break;case 5:let ye=.6,me=.3,Ae=ie-le,Le=Math.floor(ye*Ae),je=Math.floor(me*Ae),Ye=Ae-Le-je;this._tmpCtx.setLineDash([Le,je,Ye]),this._tmpCtx.moveTo(le,K),this._tmpCtx.lineTo(ie,K);break;case 1:default:this._tmpCtx.moveTo(le,K),this._tmpCtx.lineTo(ie,K);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!B&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let le=new Path2D;le.rect(Y,K-Math.ceil(V/2),this._config.deviceCellWidth*O,oe-K+Math.ceil(V/2)),this._tmpCtx.clip(le),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(d,W,W+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+I),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*O,W+I),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,W,W+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let V=h_(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j);if(V)for(let I=1;I<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,W,W+this._config.deviceCharHeight-I),V=h_(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j),!!V);I++);}if(C){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),I=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*O,W+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.stroke()}this._tmpCtx.restore();let z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=sV(z):T=h_(z,M,G,j),T)return y5;let U=this._findGlyphBoundingBox(z,this._workBoundingBox,m,q,B,W),H,F;for(;;){if(this._activePages.length===0){let V=this._createNewPage();H=V,F=V.currentRow,F.height=U.size.y;break}H=this._activePages[this._activePages.length-1],F=H.currentRow;for(let V of this._activePages)U.size.y<=V.currentRow.height&&(H=V,F=V.currentRow);for(let V=this._activePages.length-1;V>=0;V--)for(let I of this._activePages[V].fixedRows)I.height<=F.height&&U.size.y<=I.height&&(H=this._activePages[V],F=I);if(U.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new d_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),H=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+U.size.x>=H.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+U.size.y>=H.canvas.height||F.height>U.size.y+2){let V=!1;if(H.currentRow.y+H.currentRow.height+U.size.y>=H.canvas.height){let I;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+U.size.y<Y.canvas.height){I=Y;break}if(I)H=I;else if($l.maxAtlasPages&&this._pages.length>=$l.maxAtlasPages&&F.y+U.size.y<=H.canvas.height&&F.height>=U.size.y&&F.x+U.size.x<=H.canvas.width)V=!0;else{let Y=this._createNewPage();H=Y,F=Y.currentRow,F.height=U.size.y,V=!0}}V||(H.currentRow.height>0&&H.fixedRows.push(H.currentRow),F={x:0,y:H.currentRow.y+H.currentRow.height,height:U.size.y},H.fixedRows.push(F),H.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+U.size.x<=H.canvas.width)break;F===H.currentRow?(F.x=0,F.y+=F.height,F.height=0):H.fixedRows.splice(H.fixedRows.indexOf(F),1)}return U.texturePage=this._pages.indexOf(H),U.texturePosition.x=F.x,U.texturePosition.y=F.y,U.texturePositionClipSpace.x=F.x/H.canvas.width,U.texturePositionClipSpace.y=F.y/H.canvas.height,U.sizeClipSpace.x/=H.canvas.width,U.sizeClipSpace.y/=H.canvas.height,F.height=Math.max(F.height,U.size.y),F.x+=U.size.x,H.ctx.putImageData(z,U.texturePosition.x-this._workBoundingBox.left,U.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,U.size.x,U.size.y),H.addGlyph(U),H.version++,U}_findGlyphBoundingBox(t,r,i,s,o,u){r.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,m=s?this._config.deviceCellWidth:i,h=!1;for(let v=0;v<d;v++){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.top=v,h=!0;break}}if(h)break}r.left=0,h=!1;for(let v=0;v<u+m;v++){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.left=v,h=!0;break}}if(h)break}r.right=m,h=!1;for(let v=u+m-1;v>=u;v--){for(let p=0;p<d;p++){let x=p*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.right=v,h=!0;break}}if(h)break}r.bottom=d,h=!1;for(let v=d-1;v>=0;v--){for(let p=0;p<m;p++){let x=v*this._tmpCanvas.width*4+p*4+3;if(t.data[x]!==0){r.bottom=v,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+u+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+u+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},d_=class{constructor(t,r,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=AM(t,r,r),this.ctx=ur(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 h_(e,t,r,i){let s=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,h=r.rgba>>>8&255,v=Math.floor((Math.abs(s-d)+Math.abs(o-m)+Math.abs(u-h))/12),p=!0;for(let x=0;x<e.data.length;x+=4)e.data[x]===s&&e.data[x+1]===o&&e.data[x+2]===u||i&&Math.abs(e.data[x]-s)+Math.abs(e.data[x+1]-o)+Math.abs(e.data[x+2]-u)<v?e.data[x+3]=0:p=!1;return p}function sV(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function AM(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function aV(e,t,r,i,s,o,u,d){let m={foreground:o.foreground,background:o.background,cursor:qi,cursorAccent:qi,selectionForeground:qi,selectionBackgroundTransparent:qi,selectionBackgroundOpaque:qi,selectionInactiveBackgroundTransparent:qi,selectionInactiveBackgroundOpaque:qi,overviewRulerBorder:qi,scrollbarSliderBackground:qi,scrollbarSliderHoverBackground:qi,scrollbarSliderActiveBackground:qi,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:m}}function b5(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function oV(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Ki=[];function TM(e,t,r,i,s,o,u,d,m){let h=aV(i,s,o,u,t,r,d,m);for(let x=0;x<Ki.length;x++){let b=Ki[x],w=b.ownedBy.indexOf(e);if(w>=0){if(b5(b.config,h))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),Ki.splice(x,1)):b.ownedBy.splice(w,1);break}}for(let x=0;x<Ki.length;x++){let b=Ki[x];if(b5(b.config,h))return b.ownedBy.push(e),b.atlas}let v=e._core,p={atlas:new ya(document,h,v.unicodeService),config:h,ownedBy:[e]};return Ki.push(p),p.atlas}function w5(e){for(let t=0;t<Ki.length;t++){let r=Ki[t].ownedBy.indexOf(e);if(r!==-1){Ki[t].ownedBy.length===1?(Ki[t].atlas.dispose(),Ki.splice(t,1)):Ki[t].ownedBy.splice(r,1);break}}}var Xh=600,lV=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Xh){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Xh-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Xh-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Xh)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function S5(e,t,r){let i=new t.ResizeObserver(s=>{let o=s.find(m=>m.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i==null||i.disconnect(),i=void 0;return}let u=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;u>0&&d>0&&r(u,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Gr(()=>i==null?void 0:i.disconnect())}function cV(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var C5=class MM extends Ul{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new SM,this.combinedData=""}static fromCharData(t){let r=new MM;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?cV(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},jM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function DM(e,t,r){let i=ur(e.createProgram());if(e.attachShader(i,ur(E5(e,e.VERTEX_SHADER,t))),e.attachShader(i,ur(E5(e,e.FRAGMENT_SHADER,r))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function E5(e,t,r){let i=ur(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 uV(e,t){let r=Math.min(e.length*2,t),i=new Float32Array(r);for(let s=0;s<e.length;s++)i[s]=e[s];return i}var dV=class{constructor(t){this.texture=t,this.version=-1}},hV=`#version 300 es
573
- layout (location = 0) in vec2 a_unitquad;
574
- layout (location = 1) in vec2 a_cellpos;
575
- layout (location = 2) in vec2 a_offset;
576
- layout (location = 3) in vec2 a_size;
577
- layout (location = 4) in float a_texpage;
578
- layout (location = 5) in vec2 a_texcoord;
579
- layout (location = 6) in vec2 a_texsize;
580
-
581
- uniform mat4 u_projection;
582
- uniform vec2 u_resolution;
583
-
584
- out vec2 v_texcoord;
585
- flat out int v_texpage;
586
-
587
- void main() {
588
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
589
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
590
- v_texpage = int(a_texpage);
591
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
592
- }`;function fV(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
593
- precision lowp float;
594
-
595
- in vec2 v_texcoord;
596
- flat in int v_texpage;
597
-
598
- uniform sampler2D u_texture[${e}];
599
-
600
- out vec4 outColor;
601
-
602
- void main() {
603
- if (v_texpage == 0) {
604
- outColor = texture(u_texture[0], v_texcoord);
605
- } ${t}
606
- }`}var ba=11,Dl=ba*Float32Array.BYTES_PER_ELEMENT,mV=2,Yt=0,Lt,f_=0,du=0,pV=class extends wn{constructor(t,r,i,s){super(),this._terminal=t,this._gl=r,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;ya.maxAtlasPages===void 0&&(ya.maxAtlasPages=Math.min(32,ur(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ya.maxTextureSize=ur(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=ur(DM(o,hV,fV(ya.maxAtlasPages))),this._register(Gr(()=>o.deleteProgram(this._program))),this._projectionLocation=ur(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ur(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ur(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(Gr(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let m=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Gr(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,m,o.STATIC_DRAW),this._attributesBuffer=ur(o.createBuffer()),this._register(Gr(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Dl,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Dl,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Dl,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Dl,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Dl,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Dl,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let v=new Int32Array(ya.maxAtlasPages);for(let p=0;p<ya.maxAtlasPages;p++)v[p]=p;o.uniform1iv(this._textureLocation,v),o.uniformMatrix4fv(this._projectionLocation,!1,jM),this._atlasTextures=[];for(let p=0;p<ya.maxAtlasPages;p++){let x=new dV(ur(o.createTexture()));this._register(Gr(()=>o.deleteTexture(x.texture))),o.activeTexture(o.TEXTURE0+p),o.bindTexture(o.TEXTURE_2D,x.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[p]=x}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,i,s,o,u,d,m,h){this._updateCell(this._vertices.attributes,t,r,i,s,o,u,d,m,h)}_updateCell(t,r,i,s,o,u,d,m,h,v){if(Yt=(i*this._terminal.cols+r)*ba,s===0||s===void 0){t.fill(0,Yt,Yt+ba-1-mV);return}this._atlas&&(m&&m.length>1?Lt=this._atlas.getRasterizedGlyphCombinedChar(m,o,u,d,!1,this._terminal.element):Lt=this._atlas.getRasterizedGlyph(s,o,u,d,!1,this._terminal.element),f_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==v&&Lt.offset.x>f_?(du=Lt.offset.x-f_,t[Yt]=-(Lt.offset.x-du)+this._dimensions.device.char.left,t[Yt+1]=-Lt.offset.y+this._dimensions.device.char.top,t[Yt+2]=(Lt.size.x-du)/this._dimensions.device.canvas.width,t[Yt+3]=Lt.size.y/this._dimensions.device.canvas.height,t[Yt+4]=Lt.texturePage,t[Yt+5]=Lt.texturePositionClipSpace.x+du/this._atlas.pages[Lt.texturePage].canvas.width,t[Yt+6]=Lt.texturePositionClipSpace.y,t[Yt+7]=Lt.sizeClipSpace.x-du/this._atlas.pages[Lt.texturePage].canvas.width,t[Yt+8]=Lt.sizeClipSpace.y):(t[Yt]=-Lt.offset.x+this._dimensions.device.char.left,t[Yt+1]=-Lt.offset.y+this._dimensions.device.char.top,t[Yt+2]=Lt.size.x/this._dimensions.device.canvas.width,t[Yt+3]=Lt.size.y/this._dimensions.device.canvas.height,t[Yt+4]=Lt.texturePage,t[Yt+5]=Lt.texturePositionClipSpace.x,t[Yt+6]=Lt.texturePositionClipSpace.y,t[Yt+7]=Lt.sizeClipSpace.x,t[Yt+8]=Lt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Mq(s,h,Lt.size.x,this._dimensions.device.cell.width)&&(t[Yt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*ba;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==r?this._vertices.attributesBuffers[i]=new Float32Array(r):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=r,i=0;for(let s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=ba}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*ba,d=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*ba);i.set(d,s),s+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,i.subarray(0,s),r.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(r,this._atlas,o);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,s/ba)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=r.pages[i].version}setDimensions(t){this._dimensions=t}},gV=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,r,i,s=!1){if(this.selectionStart=r,this.selectionEnd=i,!r||!i||r[0]===i[0]&&r[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,u=r[1]-o,d=i[1]-o,m=Math.max(u,0),h=Math.min(d,t.rows-1);if(m>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=u,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=h,this.startCol=r[0],this.endCol=i[0]}isCellSelected(t,r,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&i>=this.viewportCappedStartRow&&r<this.endCol&&i<=this.viewportCappedEndRow:r<this.startCol&&i>=this.viewportCappedStartRow&&r>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&r>=this.startCol):!1}};function vV(){return new gV}var Ff=4,pf=1,gf=2,m_=3,_V=2147483648,xV=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=vV()}resize(t,r){let i=t*r*Ff;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)}},yV=`#version 300 es
607
- layout (location = 0) in vec2 a_position;
608
- layout (location = 1) in vec2 a_size;
609
- layout (location = 2) in vec4 a_color;
610
- layout (location = 3) in vec2 a_unitquad;
611
-
612
- uniform mat4 u_projection;
613
-
614
- out vec4 v_color;
615
-
616
- void main() {
617
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
618
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
619
- v_color = a_color;
620
- }`,bV=`#version 300 es
621
- precision lowp float;
622
-
623
- in vec4 v_color;
624
-
625
- out vec4 outColor;
626
-
627
- void main() {
628
- outColor = v_color;
629
- }`,As=8,p_=As*Float32Array.BYTES_PER_ELEMENT,wV=20*As,R5=class{constructor(){this.attributes=new Float32Array(wV),this.count=0}},ks=0,k5=0,N5=0,A5=0,T5=0,M5=0,j5=0,SV=class extends wn{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new R5,this._verticesCursor=new R5;let s=this._gl;this._program=ur(DM(s,yV,bV)),this._register(Gr(()=>s.deleteProgram(this._program))),this._projectionLocation=ur(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=s.createBuffer();this._register(Gr(()=>s.deleteBuffer(u))),s.bindBuffer(s.ARRAY_BUFFER,u),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=s.createBuffer();this._register(Gr(()=>s.deleteBuffer(m))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=ur(s.createBuffer()),this._register(Gr(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,p_,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,p_,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,p_,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,jM),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,i=1,s,o,u,d,m,h,v,p,x,b,w;for(s=0;s<t.rows;s++){for(u=-1,d=0,m=0,h=!1,o=0;o<t.cols;o++)v=(s*t.cols+o)*Ff,p=e.cells[v+pf],x=e.cells[v+gf],b=!!(x&67108864),(p!==d||x!==m&&(h||b))&&((d!==0||h&&m!==0)&&(w=i++*As,this._updateRectangle(r,w,m,d,u,o,s)),u=o,d=p,m=x,h=b);(d!==0||h&&m!==0)&&(w=i++*As,this._updateRectangle(r,w,m,d,u,t.cols,s))}r.count=i}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let i,s=0;(r.style==="bar"||r.style==="outline")&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(i=s++*As,this._addRectangleFloat(t.attributes,i,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),i=s++*As,this._addRectangleFloat(t.attributes,i,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,r,i,s,o,u){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:ks=(r&16777215)<<8;break;case 0:default:ks=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:ks=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ks=(i&16777215)<<8;break;case 0:default:ks=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=uV(e.attributes,this._terminal.rows*this._terminal.cols*As)),k5=s*this._dimensions.device.cell.width,N5=u*this._dimensions.device.cell.height,A5=(ks>>24&255)/255,T5=(ks>>16&255)/255,M5=(ks>>8&255)/255,j5=1,this._addRectangle(e.attributes,t,k5,N5,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,A5,T5,M5,j5)}_addRectangle(e,t,r,i,s,o,u,d,m,h){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u,e[t+5]=d,e[t+6]=m,e[t+7]=h}_addRectangleFloat(e,t,r,i,s,o,u){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},CV=class extends wn{constructor(t,r,i,s,o,u,d,m){super(),this._container=r,this._alpha=o,this._coreBrowserService=u,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(Gr(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ur(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,i){}handleSelectionChanged(t,r,i,s=!1){}_setTransparency(t,r){if(r===this._alpha)return;let i=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=TM(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,r,i,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,r,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=_M,this._clipCell(i,s,r.getWidth()),this._ctx.fillText(r.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,i){let s=r?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},EV=class extends CV{constructor(t,r,i,s,o,u,d){super(i,t,"link",r,!0,o,u,d),this._register(s.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(s.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&oV(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},vo=typeof window=="object"?window:globalThis,M0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Bt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Bt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};M0.INSTANCE=new M0;var LM=M0;function RV(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}LM.INSTANCE.onDidChangeZoomLevel;LM.INSTANCE.onDidChangeFullscreen;var oc=typeof navigator=="object"?navigator.userAgent:"";oc.indexOf("Firefox")>=0;oc.indexOf("AppleWebKit")>=0;var kV=oc.indexOf("Chrome")>=0;!kV&&oc.indexOf("Safari")>=0;oc.indexOf("Electron/")>=0;oc.indexOf("Android")>=0;var g_=!1;if(typeof vo.matchMedia=="function"){let e=vo.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=vo.matchMedia("(display-mode: fullscreen)");g_=e.matches,RV(vo,e,({matches:r})=>{g_&&t.matches||(g_=r)})}var Hl="en",v_=!1,OM=!1,Zh,vf=Hl,D5=Hl,NV,fn,So=globalThis,Ir,XE;typeof So.vscode<"u"&&typeof So.vscode.process<"u"?Ir=So.vscode.process:typeof process<"u"&&typeof((XE=process==null?void 0:process.versions)==null?void 0:XE.node)=="string"&&(Ir=process);var ZE,AV=typeof((ZE=Ir==null?void 0:Ir.versions)==null?void 0:ZE.electron)=="string",TV=AV&&(Ir==null?void 0:Ir.type)==="renderer",QE;if(typeof Ir=="object"){Ir.platform,Ir.platform,v_=Ir.platform==="linux",v_&&Ir.env.SNAP&&Ir.env.SNAP_REVISION,Ir.env.CI||Ir.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zh=Hl,vf=Hl;let e=Ir.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zh=t.userLocale,D5=t.osLocale,vf=t.resolvedLanguage||Hl,NV=(QE=t.languagePack)==null?void 0:QE.translationsConfigFile}catch{}OM=!0}else typeof navigator=="object"&&!TV?(fn=navigator.userAgent,fn.indexOf("Windows")>=0,fn.indexOf("Macintosh")>=0,(fn.indexOf("Macintosh")>=0||fn.indexOf("iPad")>=0||fn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,v_=fn.indexOf("Linux")>=0,(fn==null?void 0:fn.indexOf("Mobi"))>=0,vf=globalThis._VSCODE_NLS_LANGUAGE||Hl,Zh=navigator.language.toLowerCase(),D5=Zh):console.error("Unable to resolve platform.");var L5=OM,Jn=fn,pa=vf,MV;(e=>{function t(){return pa}e.value=t;function r(){return pa.length===2?pa==="en":pa.length>=3?pa[0]==="e"&&pa[1]==="n"&&pa[2]==="-":!1}e.isDefaultVariant=r;function i(){return pa==="en"}e.isDefault=i})(MV||(MV={}));var jV=typeof So.postMessage=="function"&&!So.importScripts;(()=>{if(jV){let e=[];So.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),So.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var DV=!!(Jn&&Jn.indexOf("Chrome")>=0);Jn&&Jn.indexOf("Firefox")>=0;!DV&&Jn&&Jn.indexOf("Safari")>=0;Jn&&Jn.indexOf("Edg/")>=0;Jn&&Jn.indexOf("Android")>=0;var Ll=typeof navigator=="object"?navigator:{};L5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ll&&Ll.clipboard&&Ll.clipboard.writeText,L5||Ll&&Ll.clipboard&&Ll.clipboard.readText;var Py=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},__=new Py,O5=new Py,B5=new Py;new Array(230);var LV;(e=>{function t(d){return __.keyCodeToStr(d)}e.toString=t;function r(d){return __.strToKeyCode(d)}e.fromString=r;function i(d){return O5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return B5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return O5.strToKeyCode(d)||B5.strToKeyCode(d)}e.fromUserSettings=o;function u(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return __.keyCodeToStr(d)}e.toElectronAccelerator=u})(LV||(LV={}));var BM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),OV;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof BV?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ms.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:BM})})(OV||(OV={}));var BV=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?BM:(this._emitter||(this._emitter=new Bt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},PV;(e=>{async function t(i){let s,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(u){o(u)}})}e.withAsyncBody=r})(PV||(PV={}));var P5=class Vi{static fromArray(t){return new Vi(r=>{r.emitMany(t)})}static fromPromise(t){return new Vi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Vi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Vi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Bt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ms.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Vi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Vi.map(this,t)}static filter(t,r){return new Vi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Vi.filter(this,t)}static coalesce(t){return Vi.filter(t,r=>!!r)}coalesce(){return Vi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Vi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};P5.EMPTY=P5.fromArray([]);var{getWindow:IV}=(function(){let e=new Map,t={window:vo,disposables:new Vl};e.set(vo.vscodeWindowId,t);let r=new Bt,i=new Bt,s=new Bt;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return wn.None;let d=new Vl,m={window:u,disposables:d.add(new Vl)};return e.set(u.vscodeWindowId,m),d.add(Gr(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(j0(u,$V.BEFORE_UNLOAD,()=>{s.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){var h;let d=u;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:vo},getDocument(u){return IV(u).document}}})(),zV=class{constructor(t,r,i,s){this._node=t,this._type=r,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function j0(e,t,r,i){return new zV(e,t,r,i)}var $V={BEFORE_UNLOAD:"beforeunload"},UV=class extends wn{constructor(t,r,i,s,o,u,d,m,h){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=u,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new lu,this._charAtlasDisposable=this._register(new lu),this._observerDisposable=this._register(new lu),this._model=new xV,this._workCell=new C5,this._workCell2=new C5,this._rectangleRenderer=this._register(new lu),this._glyphRenderer=this._register(new lu),this._onChangeTextureAtlas=this._register(new Bt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Bt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Bt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Bt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Bt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",v),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Lq(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new EV(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=jq(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(j0(this._canvas,"webglcontextlost",p=>{console.log("webglcontextlost event received"),p.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(p)},3e3)})),this._register(j0(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,w5(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=S5(this._canvas,this._coreBrowserService.window,(p,x)=>this._setCanvasDevicePixelDimensions(p,x)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=S5(this._canvas,p,(x,b)=>this._setCanvasDevicePixelDimensions(x,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Gr(()=>{var p;for(let x of this._renderLayers)x.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),w5(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,r){var i,s,o,u;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let d of this._renderLayers)d.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(o=this._glyphRenderer.value)==null||o.setDimensions(this.dimensions),(u=this._glyphRenderer.value)==null||u.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let r of this._renderLayers)r.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let r of this._renderLayers)r.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,t,r,i);this._model.selection.update(this._core,t,r,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let r of this._renderLayers)r.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new SV(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new pV(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=TM(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=fM(Ms.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ms.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(r=this._glyphRenderer.value)==null||r.setAtlas(this._charAtlas)}_clearModel(t){var r;this._model.clear(),t&&((r=this._glyphRenderer.value)==null||r.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let r of this._renderLayers)r.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,r){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new lV(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let i=this._core,s=this._workCell,o,u,d,m,h,v,p=0,x=!0,b,w,C,E,S,N,k,R,M;t=I5(t,i.rows-1,0),r=I5(r,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",$=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=$-i.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),G=-1,W=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(u=t;u<=r;u++)for(d=u+i.buffer.ydisp,m=i.buffer.lines.get(d),this._model.lineLengths[u]=0,C=$===d,p=0,h=this._characterJoinerService.getJoinedCharacters(d),R=0;R<i.cols;R++){if(o=this._cellColorResolver.result.bg,m.loadCell(R,s),R===0&&(o=this._cellColorResolver.result.bg),v=!1,x=R>=p,b=R,h.length>0&&R===h[0][0]&&x){w=h.shift();let j=this._model.selection.isCellSelected(this._terminal,w[0],d);for(k=w[0]+1;k<w[1];k++)x&&(x=j===this._model.selection.isCellSelected(this._terminal,k,d));x&&(x=!C||q<w[0]||q>=w[1]),x?(v=!0,s=new HV(s,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),b=w[1]-1):p=w[1]}if(E=s.getChars(),S=s.getCode(),k=(u*i.cols+R)*Ff,this._cellColorResolver.resolve(s,R,d,this.dimensions.device.cell.width),W&&d===$&&(R===q&&(this._model.cursor={x:q,y:D,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},G=q+s.getWidth()-1),R>=q&&R<=G&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),S!==0&&(this._model.lineLengths[u]=R+1),!(this._model.cells[k]===S&&this._model.cells[k+pf]===this._cellColorResolver.result.bg&&this._model.cells[k+gf]===this._cellColorResolver.result.fg&&this._model.cells[k+m_]===this._cellColorResolver.result.ext)&&(B=!0,E.length>1&&(S|=_V),this._model.cells[k]=S,this._model.cells[k+pf]=this._cellColorResolver.result.bg,this._model.cells[k+gf]=this._cellColorResolver.result.fg,this._model.cells[k+m_]=this._cellColorResolver.result.ext,N=s.getWidth(),this._glyphRenderer.value.updateCell(R,u,S,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,E,N,o),v)){for(s=this._workCell,R++;R<=b;R++)M=(u*i.cols+R)*Ff,this._glyphRenderer.value.updateCell(R,u,0,0,0,0,Eq,0,0),this._model.cells[M]=0,this._model.cells[M+pf]=this._cellColorResolver.result.bg,this._model.cells[M+gf]=this._cellColorResolver.result.fg,this._model.cells[M+m_]=this._cellColorResolver.result.ext;R--}}B&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},HV=class extends Ul{constructor(t,r,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function I5(e,t,r=0){return Math.max(Math.min(e,t),r)}var z5="di$target",$5="di$dependencies",x_=new Map;function is(e){if(x_.has(e))return x_.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");FV(t,r,s)};return t._id=e,x_.set(e,t),t}function FV(e,t,r){t[z5]===t?t[$5].push({id:e,index:r}):(t[$5]=[{id:e,index:r}],t[z5]=t)}is("BufferService");is("CoreMouseService");is("CoreService");is("CharsetService");is("InstantiationService");is("LogService");var WV=is("OptionsService");is("OscLinkService");is("UnicodeService");is("DecorationService");var qV={trace:0,debug:1,info:2,warn:3,error:4,off:5},VV="xterm.js: ",U5=class extends wn{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=qV[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?"":VV)+r,...i)}trace(t,...r){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,r)}debug(t,...r){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,r)}info(t,...r){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,r)}warn(t,...r){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,r)}error(t,...r){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,r)}};U5=fq([mq(0,WV)],U5);var GV=class extends wn{constructor(t){if(gM&&Cq()<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 Bt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Bt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Bt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Bt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=r.coreService,s=r.optionsService,o=r,u=o._renderService,d=o._characterJoinerService,m=o._charSizeService,h=o._coreBrowserService,v=o._decorationService;o._logService;let p=o._themeService;this._renderer=this._register(new UV(t,d,m,h,i,v,s,p,this._preserveDrawingBuffer)),this._register(Ms.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ms.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ms.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ms.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Gr(()=>{if(this._terminal._core._store._isDisposed)return;let x=this._terminal._core._renderService;x.setRenderer(this._terminal._core._createRenderer()),x.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
630
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
631
- * @license MIT
632
- *
633
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
634
- * @license MIT
635
- *
636
- * Originally forked from (with the author's permission):
637
- * Fabrice Bellard's javascript vt100 for jslinux:
638
- * http://bellard.org/jslinux/
639
- * Copyright (c) 2011 Fabrice Bellard
640
- */var PM=Object.defineProperty,YV=Object.getOwnPropertyDescriptor,KV=(e,t)=>{for(var r in t)PM(e,r,{get:t[r],enumerable:!0})},Qt=(e,t,r,i)=>{for(var s=i>1?void 0:i?YV(t,r):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(s=(i?u(t,r,s):u(s))||s);return i&&s&&PM(t,r,s),s},Ne=(e,t)=>(r,i)=>t(r,i,e),H5="Terminal input",D0={get:()=>H5,set:e=>H5=e},F5="Too much output to announce, navigate to rows manually to read",L0={get:()=>F5,set:e=>F5=e};function XV(e){return e.replace(/\r?\n/g,"\r")}function ZV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function QV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function JV(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");IM(s,t,r,i)}}function IM(e,t,r,i){e=XV(e),e=ZV(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function zM(e,t,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function W5(e,t,r,i,s){zM(e,t,r),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Sa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Lm(e,t=0,r=e.length){let i="";for(let s=t;s<r;++s){let o=e[s];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var eG=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let o=e.charCodeAt(s++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=s;o<r;++o){let u=e.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return this._interim=u,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(u-55296)*1024+d-56320+65536:(t[i++]=u,t[i++]=d);continue}u!==65279&&(t[i++]=u)}return i}},tG=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let i=0,s,o,u,d,m=0,h=0;if(this.interim[0]){let x=!1,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(;h<S;){if(h>=r)return 0;if(C=e[h++],(C&192)!==128){h--,x=!0;break}else this.interim[w++]=C,b<<=6,b|=C&63}x||(E===2?b<128?h--: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=h;for(;p<r;){for(;p<v&&!((s=e[p])&128)&&!((o=e[p+1])&128)&&!((u=e[p+2])&128)&&!((d=e[p+3])&128);)t[i++]=s,t[i++]=o,t[i++]=u,t[i++]=d,p+=4;if(s=e[p++],s<128)t[i++]=s;else if((s&224)===192){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(m=(s&31)<<6|o&63,m<128){p--;continue}t[i++]=m}else if((s&240)===224){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(m=(s&15)<<12|(o&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[i++]=m}else if((s&248)===240){if(p>=r)return this.interim[0]=s,i;if(o=e[p++],(o&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,i;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=r)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=u,i;if(d=e[p++],(d&192)!==128){p--;continue}if(m=(s&7)<<18|(o&63)<<12|(u&63)<<6|d&63,m<65536||m>1114111)continue;t[i++]=m}}return i}},$M="",Ea=" ",md=class UM{constructor(){this.fg=0,this.bg=0,this.extended=new Wf}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 UM;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}},Wf=class HM{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 HM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Qi=class FM extends md{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wf,this.combinedData=""}static fromCharData(t){let r=new FM;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?Sa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},q5="di$target",O0="di$dependencies",y_=new Map;function rG(e){return e[O0]||[]}function Tr(e){if(y_.has(e))return y_.get(e);let t=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");iG(t,r,s)};return t._id=e,y_.set(e,t),t}function iG(e,t,r){t[q5]===t?t[O0].push({id:e,index:r}):(t[O0]=[{id:e,index:r}],t[q5]=t)}var ri=Tr("BufferService"),WM=Tr("CoreMouseService"),Ho=Tr("CoreService"),nG=Tr("CharsetService"),Iy=Tr("InstantiationService"),qM=Tr("LogService"),ii=Tr("OptionsService"),VM=Tr("OscLinkService"),sG=Tr("UnicodeService"),pd=Tr("DecorationService"),B0=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var v;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,o=new Qi,u=r.getTrimmedLength(),d=-1,m=-1,h=!1;for(let p=0;p<u;p++)if(!(m===-1&&!r.hasContent(p))){if(r.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(m===-1){m=p,d=o.extended.urlId;continue}else h=o.extended.urlId!==d;else m!==-1&&(h=!0);if(h||m!==-1&&p===u-1){let x=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(x){let b={start:{x:m+1,y:e},end:{x:p+(!h&&p===u-1?1:0),y:e}},w=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let C=new URL(x);["http:","https:"].includes(C.protocol)||(w=!0)}catch{w=!0}w||i.push({text:x,range:b,activate:(C,E)=>s?s.activate(C,E,b):aG(C,E),hover:(C,E)=>{var S;return(S=s==null?void 0:s.hover)==null?void 0:S.call(s,C,E,b)},leave:(C,E)=>{var S;return(S=s==null?void 0:s.leave)==null?void 0:S.call(s,C,E,b)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(m=p,d=o.extended.urlId):(m=-1,d=-1)}}t(i)}};B0=Qt([Ne(0,ri),Ne(1,ii),Ne(2,VM)],B0);function aG(e,t){if(confirm(`Do you want to navigate to ${t}?
641
-
642
- 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 Om=Tr("CharSizeService"),$s=Tr("CoreBrowserService"),zy=Tr("MouseService"),Us=Tr("RenderService"),oG=Tr("SelectionService"),GM=Tr("CharacterJoinerService"),lc=Tr("ThemeService"),YM=Tr("LinkProviderService"),lG=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?V5.isErrorNoTelemetry(e)?new V5(e.message+`
643
-
644
- `+e.stack):new Error(e.message+`
645
-
646
- `+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)}},cG=new lG;function _f(e){uG(e)||cG.onUnexpectedError(e)}var P0="Canceled";function uG(e){return e instanceof dG?!0:e instanceof Error&&e.name===P0&&e.message===P0}var dG=class extends Error{constructor(){super(P0),this.name=this.message}};function hG(e){return new Error(`Illegal argument: ${e}`)}var V5=class I0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof I0)return t;let r=new I0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},z0=class KM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,KM.prototype)}};function Ai(e,t=0){return e[e.length-(1+t)]}var fG;(e=>{function t(o){return o<0}e.isLessThan=t;function r(o){return o<=0}e.isLessThanOrEqual=r;function i(o){return o>0}e.isGreaterThan=i;function s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(fG||(fG={}));function mG(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var XM;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(R){yield R}e.single=s;function o(R){return t(R)?R:s(R)}e.wrap=o;function u(R){return R||r}e.from=u;function*d(R){for(let M=R.length-1;M>=0;M--)yield R[M]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,M){let L=0;for(let $ of R)if(M($,L++))return!0;return!1}e.some=v;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*x(R,M){for(let L of R)M(L)&&(yield L)}e.filter=x;function*b(R,M){let L=0;for(let $ of R)yield M($,L++)}e.map=b;function*w(R,M){let L=0;for(let $ of R)yield*M($,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let $=L;for(let D of R)$=M($,D);return $}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let $=R[Symbol.iterator]();for(let D=0;D<M;D++){let q=$.next();if(q.done)return[L,e.empty()];L.push(q.value)}return[L,{[Symbol.iterator](){return $}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(XM||(XM={}));function To(e){if(XM.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 pG(...e){return zt(()=>To(e))}function zt(e){return{dispose:mG(()=>{e()})}}var ZM=class QM{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{To(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?QM.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)}};ZM.DISABLE_DISPOSED_WARNING=!1;var Na=ZM,tt=class{constructor(){this._store=new Na,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};tt.None=Object.freeze({dispose(){}});var Zl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},js=typeof window=="object"?window:globalThis,$0=class U0{constructor(t){this.element=t,this.next=U0.Undefined,this.prev=U0.Undefined}};$0.Undefined=new $0(void 0);var $t=$0,G5=class{constructor(){this._first=$t.Undefined,this._last=$t.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===$t.Undefined}clear(){let e=this._first;for(;e!==$t.Undefined;){let t=e.next;e.prev=$t.Undefined,e.next=$t.Undefined,e=t}this._first=$t.Undefined,this._last=$t.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new $t(e);if(this._first===$t.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==$t.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==$t.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==$t.Undefined&&e.next!==$t.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===$t.Undefined&&e.next===$t.Undefined?(this._first=$t.Undefined,this._last=$t.Undefined):e.next===$t.Undefined?(this._last=this._last.prev,this._last.next=$t.Undefined):e.prev===$t.Undefined&&(this._first=this._first.next,this._first.prev=$t.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==$t.Undefined;)yield e.element,e=e.next}},gG=globalThis.performance&&typeof globalThis.performance.now=="function",vG=class JM{static create(t){return new JM(t)}constructor(t){this._now=gG&&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}},$r;(e=>{e.None=()=>tt.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,z)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,z),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h((z,T=null,U)=>B(H=>z.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h((z,T=null,U)=>B(H=>{j(H),z.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h((z,T=null,U)=>B(H=>j(H)&&z.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,z)=>{let T=pG(...B.map(U=>U(H=>j.call(O,H))));return v(T,z)}}e.any=d;function m(B,j,O,z){let T=O;return i(B,U=>(T=j(T,U),T),z)}e.reduce=m;function h(B,j){let O,z={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new we(z);return j==null||j.add(T),T.event}function v(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,z=!1,T=!1,U,H){let F,V,I,Y=0,K,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(ce=>{Y++,V=j(V,ce),z&&!I&&(oe.fire(V),V=void 0),K=()=>{let Z=V;V=void 0,I=void 0,(!z||Y>1)&&oe.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(K,O)):I===void 0&&(I=0,queueMicrotask(K))})},onWillRemoveListener(){T&&Y>0&&(K==null||K())},onDidRemoveLastListener(){K=void 0,F.dispose()}},oe=new we(ee);return H==null||H.add(oe),oe.event}e.debounce=p;function x(B,j=0,O){return e.debounce(B,(z,T)=>z?(z.push(T),z):[T],j,void 0,!0,void 0,O)}e.accumulate=x;function b(B,j=(z,T)=>z===T,O){let z=!0,T;return o(B,U=>{let H=z||!j(U,T);return z=!1,T=U,H},O)}e.latch=b;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,z=>!j(z),O)]}e.split=w;function C(B,j=!1,O=[],z){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});z&&z.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new we({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),z&&z.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return z&&z.add(F),F.event}e.buffer=C;function E(B,j){return(O,z,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call(z,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let z=O;return this.steps.push(T=>(z=j(z,T),z)),this}latch(j=(O,z)=>O===z){let O=!0,z;return this.steps.push(T=>{let U=O||!j(T,z);return O=!1,z=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=z=>z){let z=(...F)=>H.fire(O(...F)),T=()=>B.on(j,z),U=()=>B.removeListener(j,z),H=new we({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=z=>z){let z=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,z),U=()=>B.removeEventListener(j,z),H=new we({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new we;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function $(B,j){return B(O=>j.fire(O))}e.forward=$;function D(B,j,O){return j(O),B(z=>j(z))}e.runAndSubscribe=D;class q{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let z={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new we(z),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new q(B,j).emitter.event}e.fromObservable=G;function W(B){return(j,O,z)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return z instanceof Na?z.add(F):Array.isArray(z)&&z.push(F),F}}e.fromObservableLight=W})($r||($r={}));var H0=class F0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${F0._idPool++}`,F0.all.add(this)}start(t){this._stopWatch=new vG,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};H0.all=new Set,H0._idPool=0;var _G=H0,xG=-1,ej=class tj{constructor(t,r,i=(tj._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${u}):`;console.warn(d),console.warn(o);let m=new wG(d,o);this._errorHandler(m)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[i,s]of this._stacks)(!t||r<s)&&(t=[i,s],r=s);return t}};ej._idPool=1;var yG=ej,bG=class rj{constructor(t){this.value=t}static create(){let t=new Error;return new rj(t.stack??"")}print(){console.warn(this.value.split(`
647
- `).slice(2).join(`
648
- `))}},wG=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},SG=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},CG=0,b_=class{constructor(e){this.value=e,this.id=CG++}},EG=2,RG,we=class{constructor(e){var t,r,i,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new yG((e==null?void 0:e.onListenerError)??_f,((r=this._options)==null?void 0:r.leakWarningThreshold)??xG):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new _G(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var u,d,m,h,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new SG(`${p}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((u=this._options)==null?void 0:u.onListenerError)||_f)(b),tt.None}if(this._disposed)return tt.None;t&&(e=e.bind(t));let i=new b_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=bG.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof b_?(this._deliveryQueue??(this._deliveryQueue=new kG),this._listeners=[this._listeners,i]):this._listeners.push(i):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=i,(v=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||v.call(h,this)),this._size++;let o=zt(()=>{s==null||s(),this._removeListener(i)});return r instanceof Na?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var s,o,u,d;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||d.call(u,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*EG<=t.length){let m=0;for(let h=0;h<t.length;h++)t[h]?t[m++]=t[h]:i&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var i;if(!e)return;let r=((i=this._options)==null?void 0:i.onListenerError)||_f;if(!r){e.value(t);return}try{e.value(t)}catch(s){r(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,i,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof b_)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},kG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},W0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};W0.INSTANCE=new W0;var $y=W0;function NG(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}$y.INSTANCE.onDidChangeZoomLevel;function AG(e){return $y.INSTANCE.getZoomFactor(e)}$y.INSTANCE.onDidChangeFullscreen;var cc=typeof navigator=="object"?navigator.userAgent:"",q0=cc.indexOf("Firefox")>=0,TG=cc.indexOf("AppleWebKit")>=0,Uy=cc.indexOf("Chrome")>=0,MG=!Uy&&cc.indexOf("Safari")>=0;cc.indexOf("Electron/")>=0;cc.indexOf("Android")>=0;var w_=!1;if(typeof js.matchMedia=="function"){let e=js.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=js.matchMedia("(display-mode: fullscreen)");w_=e.matches,NG(js,e,({matches:r})=>{w_&&t.matches||(w_=r)})}var Fl="en",V0=!1,G0=!1,xf=!1,ij=!1,Qh,yf=Fl,Y5=Fl,jG,mn,Co=globalThis,zr,JE;typeof Co.vscode<"u"&&typeof Co.vscode.process<"u"?zr=Co.vscode.process:typeof process<"u"&&typeof((JE=process==null?void 0:process.versions)==null?void 0:JE.node)=="string"&&(zr=process);var eR,DG=typeof((eR=zr==null?void 0:zr.versions)==null?void 0:eR.electron)=="string",LG=DG&&(zr==null?void 0:zr.type)==="renderer",tR;if(typeof zr=="object"){V0=zr.platform==="win32",G0=zr.platform==="darwin",xf=zr.platform==="linux",xf&&zr.env.SNAP&&zr.env.SNAP_REVISION,zr.env.CI||zr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Qh=Fl,yf=Fl;let e=zr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Qh=t.userLocale,Y5=t.osLocale,yf=t.resolvedLanguage||Fl,jG=(tR=t.languagePack)==null?void 0:tR.translationsConfigFile}catch{}ij=!0}else typeof navigator=="object"&&!LG?(mn=navigator.userAgent,V0=mn.indexOf("Windows")>=0,G0=mn.indexOf("Macintosh")>=0,(mn.indexOf("Macintosh")>=0||mn.indexOf("iPad")>=0||mn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xf=mn.indexOf("Linux")>=0,(mn==null?void 0:mn.indexOf("Mobi"))>=0,yf=globalThis._VSCODE_NLS_LANGUAGE||Fl,Qh=navigator.language.toLowerCase(),Y5=Qh):console.error("Unable to resolve platform.");var nj=V0,Qn=G0,OG=xf,K5=ij,es=mn,ga=yf,BG;(e=>{function t(){return ga}e.value=t;function r(){return ga.length===2?ga==="en":ga.length>=3?ga[0]==="e"&&ga[1]==="n"&&ga[2]==="-":!1}e.isDefaultVariant=r;function i(){return ga==="en"}e.isDefault=i})(BG||(BG={}));var PG=typeof Co.postMessage=="function"&&!Co.importScripts;(()=>{if(PG){let e=[];Co.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let o=e[i];if(o.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return r=>{let i=++t;e.push({id:i,callback:r}),Co.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var IG=!!(es&&es.indexOf("Chrome")>=0);es&&es.indexOf("Firefox")>=0;!IG&&es&&es.indexOf("Safari")>=0;es&&es.indexOf("Edg/")>=0;es&&es.indexOf("Android")>=0;var Ol=typeof navigator=="object"?navigator:{};K5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ol&&Ol.clipboard&&Ol.clipboard.writeText,K5||Ol&&Ol.clipboard&&Ol.clipboard.readText;var Hy=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},S_=new Hy,X5=new Hy,Z5=new Hy,zG=new Array(230),sj;(e=>{function t(d){return S_.keyCodeToStr(d)}e.toString=t;function r(d){return S_.strToKeyCode(d)}e.fromString=r;function i(d){return X5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return Z5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return X5.strToKeyCode(d)||Z5.strToKeyCode(d)}e.fromUserSettings=o;function u(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return S_.keyCodeToStr(d)}e.toElectronAccelerator=u})(sj||(sj={}));var $G=class aj{constructor(t,r,i,s,o){this.ctrlKey=t,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=o}equals(t){return t instanceof aj&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new UG([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},UG=class{constructor(e){if(e.length===0)throw hG("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 HG(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return sj.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(q0)switch(t){case 59:return 85;case 60:if(OG)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Qn)return 57;break}else if(TG&&(Qn&&t===93||!Qn&&t===92))return 57;return zG[t]||0}var FG=Qn?256:2048,WG=512,qG=1024,VG=Qn?2048:256,Q5=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=HG(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|=FG),this.altKey&&(t|=WG),this.shiftKey&&(t|=qG),this.metaKey&&(t|=VG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new $G(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},J5=new WeakMap;function GG(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 YG=class{static getSameOriginWindowChain(e){let t=J5.get(e);if(!t){t=[],J5.set(e,t);let r=e,i;do i=GG(r),i?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,i=0,s=this.getSameOriginWindowChain(e);for(let o of s){let u=o.window.deref();if(r+=(u==null?void 0:u.scrollY)??0,i+=(u==null?void 0:u.scrollX)??0,u===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();r+=d.top,i+=d.left}return{top:r,left:i}}},Jh=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=YG.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},eE=class{constructor(e,t=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let i=!1;if(Uy){let o=navigator.userAgent.match(/Chrome\/(\d+)/);i=(o?parseInt(o[1]):123)<=122}if(e){let o=e,u=e,d=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")i?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?q0&&!Qn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")MG&&nj?this.deltaX=-(o.wheelDeltaX/120):i?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?q0&&!Qn?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()}},oj=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),KG;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof XG?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$r.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:oj})})(KG||(KG={}));var XG=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?oj:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Fy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new z0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new z0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},ZG=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new z0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=zt(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},QG;(e=>{async function t(i){let s,o=await Promise.all(i.map(u=>u.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function r(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(u){o(u)}})}e.withAsyncBody=r})(QG||(QG={}));var tE=class Gi{static fromArray(t){return new Gi(r=>{r.emitMany(t)})}static fromPromise(t){return new Gi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Gi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Gi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new we,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await $r.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 Gi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Gi.map(this,t)}static filter(t,r){return new Gi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Gi.filter(this,t)}static coalesce(t){return Gi.filter(t,r=>!!r)}coalesce(){return Gi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Gi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};tE.EMPTY=tE.fromArray([]);var{getWindow:Kn,getWindowId:JG,onDidRegisterWindow:eY}=(function(){let e=new Map,t={window:js,disposables:new Na};e.set(js.vscodeWindowId,t);let r=new we,i=new we,s=new we;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return tt.None;let d=new Na,m={window:u,disposables:d.add(new Na)};return e.set(u.vscodeWindowId,m),d.add(zt(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(He(u,Sr.BEFORE_UNLOAD,()=>{s.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){var h;let d=u;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:js},getDocument(u){return Kn(u).document}}})(),tY=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 He(e,t,r,i){return new tY(e,t,r,i)}var rE=function(e,t,r,i){return He(e,t,r,i)},Wy,rY=class extends ZG{constructor(e){super(),this.defaultTarget=e&&Kn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},iE=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){_f(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,i=new Map,s=o=>{r.set(o,!1);let u=e.get(o)??[];for(t.set(o,u),e.set(o,[]),i.set(o,!0);u.length>0;)u.sort(iE.sort),u.shift().execute();i.set(o,!1)};Wy=(o,u,d=0)=>{let m=JG(o),h=new iE(u,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(h),r.get(m)||(r.set(m,!0),o.requestAnimationFrame(()=>s(m))),h}})();function iY(e){let t=e.getBoundingClientRect(),r=Kn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Sr={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"},nY=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=pi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=pi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=pi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=pi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=pi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=pi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=pi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=pi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=pi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=pi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=pi(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=pi(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=pi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=pi(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 pi(e){return typeof e=="number"?`${e}px`:e}function Ou(e){return new nY(e)}var lj=class{constructor(){this._hooks=new Na,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let o=e;try{e.setPointerCapture(t),this._hooks.add(zt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Kn(e)}this._hooks.add(He(o,Sr.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(He(o,Sr.POINTER_UP,u=>this.stopMonitoring(!0)))}};function sY(e,t,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let o=`$memoize$${t}`;r[i]=function(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,u)}),this[o]}}var qn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(qn||(qn={}));var Ru=class Vr extends tt{constructor(){super(),this.dispatched=!1,this.targets=new G5,this.ignoreTargets=new G5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register($r.runAndSubscribe(eY,({window:t,disposables:r})=>{r.add(He(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(He(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(He(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:js,disposables:this._store}))}static addTarget(t){if(!Vr.isTouchDevice())return tt.None;Vr.INSTANCE||(Vr.INSTANCE=new Vr);let r=Vr.INSTANCE.targets.push(t);return zt(r)}static ignoreTarget(t){if(!Vr.isTouchDevice())return tt.None;Vr.INSTANCE||(Vr.INSTANCE=new Vr);let r=Vr.INSTANCE.ignoreTargets.push(t);return zt(r)}static isTouchDevice(){return"ontouchstart"in js||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:r,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[r],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let u=this.newGestureEvent(qn.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,u=r.changedTouches.length;o<u;o++){let d=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],h=Date.now()-m.initialTimeStamp;if(h<Vr.HOLD_DELAY&&Math.abs(m.initialPageX-Ai(m.rollingPageX))<30&&Math.abs(m.initialPageY-Ai(m.rollingPageY))<30){let v=this.newGestureEvent(qn.Tap,m.initialTarget);v.pageX=Ai(m.rollingPageX),v.pageY=Ai(m.rollingPageY),this.dispatchEvent(v)}else if(h>=Vr.HOLD_DELAY&&Math.abs(m.initialPageX-Ai(m.rollingPageX))<30&&Math.abs(m.initialPageY-Ai(m.rollingPageY))<30){let v=this.newGestureEvent(qn.Contextmenu,m.initialTarget);v.pageX=Ai(m.rollingPageX),v.pageY=Ai(m.rollingPageY),this.dispatchEvent(v)}else if(s===1){let v=Ai(m.rollingPageX),p=Ai(m.rollingPageY),x=Ai(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)/x,b>0?1:-1,v,Math.abs(w)/x,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(qn.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===qn.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Vr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===qn.Change||t.type===qn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,o=t.initialTarget;for(;o&&o!==i;)s++,o=o.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,s,o,u,d,m,h){this.handle=Wy(t,()=>{let v=Date.now(),p=v-i,x=0,b=0,w=!0;s+=Vr.SCROLL_FRICTION*p,d+=Vr.SCROLL_FRICTION*p,s>0&&(w=!1,x=o*s*p),d>0&&(w=!1,b=m*d*p);let C=this.newGestureEvent(qn.Change);C.translationX=x,C.translationY=b,r.forEach(E=>E.dispatchEvent(C)),w||this.inertia(t,r,v,s,o,u+x,d,m,h+b)})}onTouchMove(t){let r=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let u=this.activeTouches[o.identifier],d=this.newGestureEvent(qn.Change,u.initialTarget);d.translationX=o.pageX-Ai(u.rollingPageX),d.translationY=o.pageY-Ai(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)}};Ru.SCROLL_FRICTION=-.005,Ru.HOLD_DELAY=700,Ru.CLEAR_TAP_COUNT_TIME=400,Qt([sY],Ru,"isTouchDevice",1);var aY=Ru,qy=class extends tt{onclick(e,t){this._register(He(e,Sr.CLICK,r=>t(new Jh(Kn(e),r))))}onmousedown(e,t){this._register(He(e,Sr.MOUSE_DOWN,r=>t(new Jh(Kn(e),r))))}onmouseover(e,t){this._register(He(e,Sr.MOUSE_OVER,r=>t(new Jh(Kn(e),r))))}onmouseleave(e,t){this._register(He(e,Sr.MOUSE_LEAVE,r=>t(new Jh(Kn(e),r))))}onkeydown(e,t){this._register(He(e,Sr.KEY_DOWN,r=>t(new Q5(r))))}onkeyup(e,t){this._register(He(e,Sr.KEY_UP,r=>t(new Q5(r))))}oninput(e,t){this._register(He(e,Sr.INPUT,t))}onblur(e,t){this._register(He(e,Sr.BLUR,t))}onfocus(e,t){this._register(He(e,Sr.FOCUS,t))}onchange(e,t){this._register(He(e,Sr.CHANGE,t))}ignoreGesture(e){return aY.ignoreTarget(e)}},nE=11,oY=class extends qy{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=nE+"px",this.domNode.style.height=nE+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new lj),this._register(rE(this.bgDomNode,Sr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(rE(this.domNode,Sr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new rY),this._pointerdownScheduleRepeatTimer=this._register(new Fy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Kn(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()}},lY=class Y0{constructor(t,r,i,s,o,u,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,o=o|0,u=u|0,d=d|0),this.rawScrollLeft=s,this.rawScrollTop=d,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),o<0&&(o=0),d+o>u&&(d=u-o),d<0&&(d=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=o,this.scrollHeight=u,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Y0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Y0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let i=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:o,heightChanged:u,scrollHeightChanged:d,scrollTopChanged:m}}},cY=class extends tt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new lY(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;t?i=new aE(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=aE.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},sE=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function C_(e,t){let r=t-e;return function(i){return e+r*hY(i)}}function uY(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var aE=class K0{constructor(t,r,i,s){this.from=t,this.to=r,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,i){if(Math.abs(t-r)>2.5*i){let s,o;return t<r?(s=t+.75*i,o=r-.75*i):(s=t-.75*i,o=r+.75*i),uY(C_(t,s),C_(o,r),.33)}return C_(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new sE(i,s,!1)}return new sE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return K0.start(t,r,i)}static start(t,r,i){i=i+10;let s=Date.now()-10;return new K0(t,r,s,i)}};function dY(e){return Math.pow(e,3)}function hY(e){return 1-dY(1-e)}var fY=class extends tt{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Fy)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},mY=140,cj=class extends qy{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new fY(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new lj),this._shouldRender=!0,this.domNode=Ou(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(He(this.domNode.domNode,Sr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new oY(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=Ou(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(He(this.slider.domNode,Sr.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let s=iY(this.domNode.domNode);t=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let o=this._sliderOrthogonalPointerPosition(s),u=Math.abs(o-r);if(nj&&u>mY){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},uj=class X0{constructor(t,r,i,s,o,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=o,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new X0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,i,s,o){let u=Math.max(0,i-t),d=Math.max(0,u-2*r),m=s>0&&s>i;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(i*d/s))),v=(d-h)/(s-i),p=o*v;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:v,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=X0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},pY=class extends cj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new uj(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},gY=class extends cj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new uj(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},vY=500,oE=50,_Y=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},Z0=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,i=1,s=this._rear;do{let o=s===this._front?t:Math.pow(2,-i);if(t-=o,r+=this._memory[s].score*o,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Uy){let r=Kn(t.browserEvent),i=AG(r);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,i){let s=null,o=new _Y(t,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,s)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),r){let s=Math.abs(t.deltaX),o=Math.abs(t.deltaY),u=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(s,u),1),h=Math.max(Math.min(o,d),1),v=Math.max(s,u),p=Math.max(o,d);v%m===0&&p%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Z0.INSTANCE=new Z0;var xY=Z0,yY=class extends qy{constructor(e,t,r){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=wY(t),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new gY(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new pY(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ou(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ou(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ou(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Fy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=To(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Qn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new eE(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=To(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new eE(r))};this._mouseWheelToDispose.push(He(this._listenOnDomNode,Sr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=xY.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=!Qn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!u&&(u=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),h={};if(o){let v=oE*o,p=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(h,p)}if(u){let v=oE*u,p=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(h,p)}h=this._scrollable.validateScrollPosition(h),(m.scrollLeft!==h.scrollLeft||m.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",s=t?" top":"",o=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),vY)}},bY=class extends yY{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 wY(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,Qn&&(t.className+=" mac"),t}var Q0=class extends tt{constructor(e,t,r,i,s,o,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new cY({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Wy(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new bY(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register($r.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(zt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(zt(()=>this._styleElement.remove())),this._register($r.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(`
649
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Q0=Qt([Ne(2,ri),Ne(3,$s),Ne(4,WM),Ne(5,lc),Ne(6,ii),Ne(7,Us)],Q0);var J0=class extends tt{constructor(e,t,r,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(zt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};J0=Qt([Ne(1,ri),Ne(2,$s),Ne(3,pd),Ne(4,Us)],J0);var SY=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)}},Un={full:0,left:0,center:0,right:0},va={full:0,left:0,center:0,right:0},hu={full:0,left:0,center:0,right:0},qf=class extends tt{constructor(e,t,r,i,s,o,u,d){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=o,this._themeService=u,this._coreBrowserService=d,this._colorZoneStore=new SY,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(zt(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);va.full=this._canvas.width,va.left=e,va.center=t,va.right=e,this._refreshDrawHeightConstants(),hu.full=1,hu.left=1,hu.center=1+va.left,hu.right=1+va.left+va.center}_refreshDrawHeightConstants(){Un.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);Un.left=t,Un.center=t,Un.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Un.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Un.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Un.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Un.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(hu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Un[e.position||"full"]/2),va[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Un[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=Qt([Ne(2,ri),Ne(3,pd),Ne(4,Us),Ne(5,ii),Ne(6,lc),Ne(7,$s)],qf);var ve;(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=`
650
- `,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=""))(ve||(ve={}));var bf;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(bf||(bf={}));var dj;(e=>e.ST=`${ve.ESC}\\`)(dj||(dj={}));var ex=class{constructor(e,t,r,i,s,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ex=Qt([Ne(2,ri),Ne(3,ii),Ne(4,Ho),Ne(5,Us)],ex);var kr=0,Nr=0,Ar=0,Xt=0,lE={css:"#00000000",rgba:0},dr;(e=>{function t(s,o,u,d){return d!==void 0?`#${mo(s)}${mo(o)}${mo(u)}${mo(d)}`:`#${mo(s)}${mo(o)}${mo(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(dr||(dr={}));var Ot;(e=>{function t(m,h){if(Xt=(h.rgba&255)/255,Xt===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,p=h.rgba>>16&255,x=h.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;kr=b+Math.round((v-b)*Xt),Nr=w+Math.round((p-w)*Xt),Ar=C+Math.round((x-C)*Xt);let E=dr.toCss(kr,Nr,Ar),S=dr.toRgba(kr,Nr,Ar);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,v){let p=wf.ensureContrastRatio(m.rgba,h.rgba,v);if(p)return dr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[kr,Nr,Ar]=wf.toChannels(h),{css:dr.toCss(kr,Nr,Ar),rgba:h}}e.opaque=s;function o(m,h){return Xt=Math.round(h*255),[kr,Nr,Ar]=wf.toChannels(m.rgba),{css:dr.toCss(kr,Nr,Ar,Xt),rgba:dr.toRgba(kr,Nr,Ar,Xt)}}e.opacity=o;function u(m,h){return Xt=m.rgba&255,o(m,Xt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Ot||(Ot={}));var Ut;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return kr=parseInt(s.slice(1,2).repeat(2),16),Nr=parseInt(s.slice(2,3).repeat(2),16),Ar=parseInt(s.slice(3,4).repeat(2),16),dr.toColor(kr,Nr,Ar);case 5:return kr=parseInt(s.slice(1,2).repeat(2),16),Nr=parseInt(s.slice(2,3).repeat(2),16),Ar=parseInt(s.slice(3,4).repeat(2),16),Xt=parseInt(s.slice(4,5).repeat(2),16),dr.toColor(kr,Nr,Ar,Xt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return kr=parseInt(o[1]),Nr=parseInt(o[2]),Ar=parseInt(o[3]),Xt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),dr.toColor(kr,Nr,Ar,Xt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[kr,Nr,Ar,Xt]=t.getImageData(0,0,1,1).data,Xt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:dr.toRgba(kr,Nr,Ar,Xt),css:s}}e.toColor=i})(Ut||(Ut={}));var Zr;(e=>{function t(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function r(i,s,o){let u=i/255,d=s/255,m=o/255,h=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),p=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+p*.0722}e.relativeLuminance2=r})(Zr||(Zr={}));var wf;(e=>{function t(u,d){if(Xt=(d&255)/255,Xt===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,p=u>>24&255,x=u>>16&255,b=u>>8&255;return kr=p+Math.round((m-p)*Xt),Nr=x+Math.round((h-x)*Xt),Ar=b+Math.round((v-b)*Xt),dr.toRgba(kr,Nr,Ar)}e.blend=t;function r(u,d,m){let h=Zr.relativeLuminance(u>>8),v=Zr.relativeLuminance(d>>8);if(Ns(h,v)<m){if(v<h){let b=i(u,d,m),w=Ns(h,Zr.relativeLuminance(b>>8));if(w<m){let C=s(u,d,m),E=Ns(h,Zr.relativeLuminance(C>>8));return w>E?b:C}return b}let p=s(u,d,m),x=Ns(h,Zr.relativeLuminance(p>>8));if(x<m){let b=i(u,d,m),w=Ns(h,Zr.relativeLuminance(b>>8));return x>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Ns(Zr.relativeLuminance2(x,b,w),Zr.relativeLuminance2(h,v,p));for(;C<m&&(x>0||b>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Ns(Zr.relativeLuminance2(x,b,w),Zr.relativeLuminance2(h,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,v=u>>16&255,p=u>>8&255,x=d>>24&255,b=d>>16&255,w=d>>8&255,C=Ns(Zr.relativeLuminance2(x,b,w),Zr.relativeLuminance2(h,v,p));for(;C<m&&(x<255||b<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Ns(Zr.relativeLuminance2(x,b,w),Zr.relativeLuminance2(h,v,p));return(x<<24|b<<16|w<<8|255)>>>0}e.increaseLuminance=s;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(wf||(wf={}));function mo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ns(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var CY=class extends md{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Vf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Qi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),s=0,o=0,u=0,d=t.getFg(0),m=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(h-s>1){let v=this._getJoinedRanges(i,u,o,t,s);for(let p=0;p<v.length;p++)r.push(v[p])}s=h,u=o,d=this._workCell.fg,m=this._workCell.bg}o+=this._workCell.getChars().length||Ea.length}if(this._bufferService.cols-s>1){let h=this._getJoinedRanges(i,u,o,t,s);for(let v=0;v<h.length;v++)r.push(h[v])}return r}_getJoinedRanges(e,t,r,i,s){let o=e.substring(t,r),u=[];try{u=this._characterJoiners[0].handler(o)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(o);for(let h=0;h<m.length;h++)Vf._mergeRanges(u,m[h])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,i,s),u}_stringRangesToCellRanges(e,t,r){let i=0,s=!1,o=0,u=e[i];if(u){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),h=t.getString(d).length||Ea.length;if(m!==0){if(!s&&u[0]<=o&&(u[0]=d,s=!0),u[1]<=o){if(u[1]=d,u=e[++i],!u)break;u[0]<=o?(u[0]=d,s=!0):s=!1}o+=h}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Vf=Qt([Ne(0,ri)],Vf);function EY(e){return 57508<=e&&e<=57558}function RY(e){return 9472<=e&&e<=9631}function kY(e){return EY(e)||RY(e)}function NY(){return{css:{canvas:ef(),cell:ef()},device:{canvas:ef(),cell:ef(),char:{width:0,height:0,left:0,top:0}}}}function ef(){return{width:0,height:0}}var tx=class{constructor(e,t,r,i,s,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=o,this._themeService=u,this._workCell=new Qi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,s,o,u,d,m,h,v){let p=[],x=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<o+1&&(w=o+1);let C,E=0,S="",N=0,k=0,R=0,M=0,L=!1,$=0,D=!1,q=0,G=0,W=[],B=h!==-1&&v!==-1;for(let j=0;j<w;j++){e.loadCell(j,this._workCell);let O=this._workCell.getWidth();if(O===0)continue;let z=!1,T=j>=G,U=j,H=this._workCell;if(x.length>0&&j===x[0][0]&&T){let Q=x.shift(),re=this._isCellInSelection(Q[0],t);for(N=Q[0]+1;N<Q[1];N++)T&&(T=re===this._isCellInSelection(N,t));T&&(T=!r||o<Q[0]||o>=Q[1]),T?(z=!0,H=new CY(this._workCell,e.translateToString(!0,Q[0],Q[1]),Q[1]-Q[0]),U=Q[1]-1,O=H.getWidth()):G=Q[1]}let F=this._isCellInSelection(j,t),V=r&&j===o,I=B&&j>=h&&j<=v,Y=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,Q=>{Y=!0});let K=H.getChars()||Ea;if(K===" "&&(H.isUnderline()||H.isOverline())&&(K=" "),q=O*d-m.get(K,H.isBold(),H.isItalic()),!C)C=this._document.createElement("span");else if(E&&(F&&D||!F&&!D&&H.bg===k)&&(F&&D&&b.selectionForeground||H.fg===R)&&H.extended.ext===M&&I===L&&q===$&&!V&&!z&&!Y&&T){H.isInvisible()?S+=Ea:S+=K,E++;continue}else E&&(C.textContent=S),C=this._document.createElement("span"),E=0,S="";if(k=H.bg,R=H.fg,M=H.extended.ext,L=I,$=q,D=F,z&&o>=j&&o<=U&&(o=j),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&W.push("xterm-cursor-blink"),W.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(H.isBold()&&W.push("xterm-bold"),H.isItalic()&&W.push("xterm-italic"),H.isDim()&&W.push("xterm-dim"),H.isInvisible()?S=Ea:S=H.getChars()||Ea,H.isUnderline()&&(W.push(`xterm-underline-${H.extended.underlineStyle}`),S===" "&&(S=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${md.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let Q=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&Q<8&&(Q+=8),C.style.textDecorationColor=b.ansi[Q].css}H.isOverline()&&(W.push("xterm-overline"),S===" "&&(S=" ")),H.isStrikethrough()&&W.push("xterm-strikethrough"),I&&(C.style.textDecoration="underline");let ee=H.getFgColor(),oe=H.getFgColorMode(),ce=H.getBgColor(),Z=H.getBgColorMode(),le=!!H.isInverse();if(le){let Q=ee;ee=ce,ce=Q;let re=oe;oe=Z,Z=re}let ie,Se,be=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,Q=>{Q.options.layer!=="top"&&be||(Q.backgroundColorRGB&&(Z=50331648,ce=Q.backgroundColorRGB.rgba>>8&16777215,ie=Q.backgroundColorRGB),Q.foregroundColorRGB&&(oe=50331648,ee=Q.foregroundColorRGB.rgba>>8&16777215,Se=Q.foregroundColorRGB),be=Q.options.layer==="top")}),!be&&F&&(ie=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ce=ie.rgba>>8&16777215,Z=50331648,be=!0,b.selectionForeground&&(oe=50331648,ee=b.selectionForeground.rgba>>8&16777215,Se=b.selectionForeground)),be&&W.push("xterm-decoration-top");let Ce;switch(Z){case 16777216:case 33554432:Ce=b.ansi[ce],W.push(`xterm-bg-${ce}`);break;case 50331648:Ce=dr.toColor(ce>>16,ce>>8&255,ce&255),this._addStyle(C,`background-color:#${cE((ce>>>0).toString(16),"0",6)}`);break;case 0:default:le?(Ce=b.foreground,W.push("xterm-bg-257")):Ce=b.background}switch(ie||H.isDim()&&(ie=Ot.multiplyOpacity(Ce,.5)),oe){case 16777216:case 33554432:H.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(C,Ce,b.ansi[ee],H,ie,void 0)||W.push(`xterm-fg-${ee}`);break;case 50331648:let Q=dr.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(C,Ce,Q,H,ie,Se)||this._addStyle(C,`color:#${cE(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,Ce,b.foreground,H,ie,Se)||le&&W.push("xterm-fg-257")}W.length&&(C.className=W.join(" "),W.length=0),!V&&!z&&!Y&&T?E++:C.textContent=S,q!==this.defaultSpacing&&(C.style.letterSpacing=`${q}px`),p.push(C),j=U}return C&&E&&(C.textContent=S),p}_applyMinimumContrast(e,t,r,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||kY(i.getCode()))return!1;let u=this._getContrastCache(i),d;if(!s&&!o&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Ot.ensureContrastRatio(s||t,o||r,m),u.setColor((s||t).rgba,(o||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};tx=Qt([Ne(1,GM),Ne(2,ii),Ne(3,$s),Ne(4,Ho),Ne(5,pd),Ne(6,lc)],tx);function cE(e,t,r){for(;e.length<r;)e=t+e;return e}var AY=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,i,s,o],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,r,i){e===this._font&&t===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,r){let i=0;if(!t&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let s=e;t&&(s+="B"),r&&(s+="I");let o=this._holey.get(s);if(o===void 0){let u=0;t&&(u|=1),r&&(u|=2),o=this._measure(e,u),o>0&&this._holey.set(s,o)}return o}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},TY=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,i=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,o=t[1]-s,u=r[1]-s,d=Math.max(o,0),m=Math.min(u,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=u,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function MY(){return new TY}var E_="xterm-dom-renderer-owner-",Wi="xterm-rows",tf="xterm-fg-",uE="xterm-bg-",fu="xterm-focus",rf="xterm-selection",jY=1,rx=class extends tt{constructor(e,t,r,i,s,o,u,d,m,h,v,p,x,b){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=o,this._linkifier2=u,this._charSizeService=m,this._optionsService=h,this._bufferService=v,this._coreService=p,this._coreBrowserService=x,this._themeService=b,this._terminalClass=jY++,this._rowElements=[],this._selectionRenderModel=MY(),this.onRequestRedraw=this._register(new we).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Wi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(rf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=NY(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(tx,document),this._element.classList.add(E_+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(zt(()=>{this._element.classList.remove(E_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new AY(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} .${Wi} 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} .${Wi} { 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} .${Wi} .xterm-dim { color: ${Ot.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Wi}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${fu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${rf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${tf}${o} { color: ${u.css}; }${this._terminalSelector} .${tf}${o}.xterm-dim { color: ${Ot.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${uE}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${tf}257 { color: ${Ot.opaque(e.background).css}; }${this._terminalSelector} .${tf}257.xterm-dim { color: ${Ot.multiplyOpacity(Ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${uE}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(fu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(fu),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(o,m?t[0]:e[0],m?e[0]:t[0],u-o+1))}else{let m=i===o?e[0]:0,h=o===s?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,m,h));let v=u-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,v)),o!==u){let p=s===u?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(u,0,p))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,i=1){let s=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(r-t);return o+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-o),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${u}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let h=m+r.ydisp,v=this._rowElements[m],p=r.lines.get(h);if(!v||!p)break;v.replaceChildren(...this._rowFactory.createRow(p,h,h===i,u,d,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,i,s,o){r<0&&(e=0),i<0&&(t=0);let u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),i=Math.max(Math.min(i,u),0),s=Math.min(s,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,h=Math.min(d.x,s-1),v=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let 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,x,h,v,this.dimensions.css.cell.width,this._widthCache,o?b===r?e:0:-1,o?(b===i?t:s)-1:-1))}}};rx=Qt([Ne(7,Iy),Ne(8,Om),Ne(9,ii),Ne(10,ri),Ne(11,Ho),Ne(12,$s),Ne(13,lc)],rx);var ix=class extends tt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new LY(this._optionsService))}catch{this._measureStrategy=this._register(new DY(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=Qt([Ne(2,ii)],ix);var hj=class extends tt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},DY=class extends hj{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}},LY=class extends hj{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}},OY=class extends tt{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new BY(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register($r.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(He(this._textarea,"focus",()=>this._isFocused=!0)),this._register(He(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}},BY=class extends tt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Zl),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=He(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)}},PY=class extends tt{constructor(){super(),this.linkProviders=[],this._register(zt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Vy(e,t,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),o=parseInt(s.getPropertyValue("padding-left")),u=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function IY(e,t,r,i,s,o,u,d,m){if(!o)return;let h=Vy(e,t,r);if(h)return h[0]=Math.ceil((h[0]+(m?u/2:0))/u),h[1]=Math.ceil(h[1]/d),h[0]=Math.min(Math.max(h[0],1),i+(m?1:0)),h[1]=Math.min(Math.max(h[1],1),s),h}var nx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,s){return IY(window,e,t,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let r=Vy(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};nx=Qt([Ne(0,Us),Ne(1,Om)],nx);var zY=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=[]}},fj={};KV(fj,{getSafariVersion:()=>UY,isChromeOS:()=>vj,isFirefox:()=>mj,isIpad:()=>HY,isIphone:()=>FY,isLegacyEdge:()=>$Y,isLinux:()=>Gy,isMac:()=>Gf,isNode:()=>Bm,isSafari:()=>pj,isWindows:()=>gj});var Bm=typeof process<"u"&&"title"in process,gd=Bm?"node":navigator.userAgent,vd=Bm?"node":navigator.platform,mj=gd.includes("Firefox"),$Y=gd.includes("Edge"),pj=/^((?!chrome|android).)*safari/i.test(gd);function UY(){if(!pj)return 0;let e=gd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Gf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vd),HY=vd==="iPad",FY=vd==="iPhone",gj=["Windows","Win16","Win32","WinCE"].includes(vd),Gy=vd.indexOf("Linux")>=0,vj=/\bCrOS\b/.test(gd),_j=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),s=e.timeRemaining(),r*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},WY=class extends _j{_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())}}},qY=class extends _j{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Yf=!Bm&&"requestIdleCallback"in window?qY:WY,VY=class{constructor(){this._queue=new Yf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sx=class extends tt{constructor(e,t,r,i,s,o,u,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=d,this._renderer=this._register(new Zl),this._pausedResizeTask=new VY,this._observerDisposable=this._register(new Zl),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 we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new zY((h,v)=>this._renderRows(h,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new GY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=zt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};sx=Qt([Ne(2,ii),Ne(3,Om),Ne(4,Ho),Ne(5,pd),Ne(6,ri),Ne(7,$s),Ne(8,lc)],sx);var GY=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 YY(e,t,r,i){let s=r.buffer.x,o=r.buffer.y;if(!r.buffer.hasScrollback)return ZY(s,o,e,t,r,i)+Pm(o,t,r,i)+QY(s,o,e,t,r,i);let u;if(o===t)return u=s>e?"D":"C",Xu(Math.abs(s-e),Ku(u,i));u=o>t?"D":"C";let d=Math.abs(o-t),m=XY(o>t?e:s,r)+(d-1)*r.cols+1+KY(o>t?s:e);return Xu(m,Ku(u,i))}function KY(e,t){return e-1}function XY(e,t){return t.cols-e}function ZY(e,t,r,i,s,o){return Pm(t,i,s,o).length===0?"":Xu(yj(e,t,e,t-Mo(t,s),!1,s).length,Ku("D",o))}function Pm(e,t,r,i){let s=e-Mo(e,r),o=t-Mo(t,r),u=Math.abs(s-o)-JY(e,t,r);return Xu(u,Ku(xj(e,t),i))}function QY(e,t,r,i,s,o){let u;Pm(t,i,s,o).length>0?u=i-Mo(i,s):u=t;let d=i,m=eK(e,t,r,i,s,o);return Xu(yj(e,u,r,d,m==="C",s).length,Ku(m,o))}function JY(e,t,r){var u;let i=0,s=e-Mo(e,r),o=t-Mo(t,r);for(let d=0;d<Math.abs(s-o);d++){let m=xj(e,t)==="A"?-1:1;(u=r.buffer.lines.get(s+m*d))!=null&&u.isWrapped&&i++}return i}function Mo(e,t){let r=0,i=t.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<t.rows;)r++,i=t.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function eK(e,t,r,i,s,o){let u;return Pm(r,i,s,o).length>0?u=i-Mo(i,s):u=t,e<r&&u<=i||e>=r&&u<i?"C":"D"}function xj(e,t){return e>t?"A":"B"}function yj(e,t,r,i,s,o){let u=e,d=t,m="";for(;(u!==r||d!==i)&&d>=0&&d<o.buffer.lines.length;)u+=s?1:-1,s&&u>o.cols-1?(m+=o.buffer.translateBufferLineToString(d,!1,e,u),u=0,e=0,d++):!s&&u<0&&(m+=o.buffer.translateBufferLineToString(d,!1,0,e+1),u=o.cols-1,e=u,d--);return m+o.buffer.translateBufferLineToString(d,!1,e,u)}function Ku(e,t){let r=t?"O":"[";return ve.ESC+r+e}function Xu(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var tK=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function dE(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var R_=50,rK=15,iK=50,nK=500,sK=" ",aK=new RegExp(sK,"g"),ax=class extends tt{constructor(e,t,r,i,s,o,u,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=o,this._optionsService=u,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Qi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new tK(this._bufferService),this._activeSelectionMode=0,this._register(zt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let d=r.translateBufferLineToString(u,!0,s,o);i.push(d)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let o=e[1]+1;o<=t[1]-1;o++){let u=r.lines.get(o),d=r.translateBufferLineToString(o,!0);u!=null&&u.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(s=>s.replace(aK," ")).join(gj?`\r
651
- `:`
652
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Gy&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!t?!1:this._areCoordsInSelection(t,r,i)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,t],r,i)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,o;let r=(o=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=dE(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Vy(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-R_),R_),t/=R_,t/Math.abs(t)+Math.round(t*(rK-1)))}shouldForceSelection(e){return Gf?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(),iK)}_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&&!(Gf&&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<nK&&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=YY(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let i=0;t>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&t!==i&&(r+=s-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let u=s.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),m=d,h=e[0]-d,v=0,p=0,x=0,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 N=o.getString(S).length;for(N>1&&(b+=N-1,m+=N-1);E>0&&d>0&&!this._isCharWordSeparator(o.loadCell(E-1,this._workCell));){o.loadCell(E-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):k>1&&(x+=k-1,d-=k-1),d--,E--}for(;S<o.length&&m+1<u.length&&!this._isCharWordSeparator(o.loadCell(S+1,this._workCell));){o.loadCell(S+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,S++):k>1&&(b+=k-1,m+=k-1),m++,S++}}m++;let w=d+h-v+x,C=Math.min(this._bufferService.cols,m-d+v+p-x-b);if(!(!t&&u.slice(d,m).trim()==="")){if(r&&w===0&&o.getCodePoint(0)!==32){let E=s.lines.get(e[1]-1);if(E&&o.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let N=this._bufferService.cols-S.start;w-=N,C+=N}}}if(i&&w+C===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let E=s.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(C+=S.length)}}return{start:w,length:C}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=dE(r,this._bufferService.cols)}};ax=Qt([Ne(3,ri),Ne(4,Ho),Ne(5,zy),Ne(6,ii),Ne(7,Us),Ne(8,$s)],ax);var hE=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},fE=class{constructor(){this._color=new hE,this._css=new hE}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},pr=Object.freeze((()=>{let e=[Ut.toColor("#2e3436"),Ut.toColor("#cc0000"),Ut.toColor("#4e9a06"),Ut.toColor("#c4a000"),Ut.toColor("#3465a4"),Ut.toColor("#75507b"),Ut.toColor("#06989a"),Ut.toColor("#d3d7cf"),Ut.toColor("#555753"),Ut.toColor("#ef2929"),Ut.toColor("#8ae234"),Ut.toColor("#fce94f"),Ut.toColor("#729fcf"),Ut.toColor("#ad7fa8"),Ut.toColor("#34e2e2"),Ut.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],s=t[r/6%6|0],o=t[r%6];e.push({css:dr.toCss(i,s,o),rgba:dr.toRgba(i,s,o)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:dr.toCss(i,i,i),rgba:dr.toRgba(i,i,i)})}return e})()),po=Ut.toColor("#ffffff"),ku=Ut.toColor("#000000"),mE=Ut.toColor("#ffffff"),pE=ku,mu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},oK=po,ox=class extends tt{constructor(e){super(),this._optionsService=e,this._contrastCache=new fE,this._halfContrastCache=new fE,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:po,background:ku,cursor:mE,cursorAccent:pE,selectionForeground:void 0,selectionBackgroundTransparent:mu,selectionBackgroundOpaque:Ot.blend(ku,mu),selectionInactiveBackgroundTransparent:mu,selectionInactiveBackgroundOpaque:Ot.blend(ku,mu),scrollbarSliderBackground:Ot.opacity(po,.2),scrollbarSliderHoverBackground:Ot.opacity(po,.4),scrollbarSliderActiveBackground:Ot.opacity(po,.5),overviewRulerBorder:po,ansi:pr.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=Ct(e.foreground,po),t.background=Ct(e.background,ku),t.cursor=Ot.blend(t.background,Ct(e.cursor,mE)),t.cursorAccent=Ot.blend(t.background,Ct(e.cursorAccent,pE)),t.selectionBackgroundTransparent=Ct(e.selectionBackground,mu),t.selectionBackgroundOpaque=Ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ct(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ct(e.selectionForeground,lE):void 0,t.selectionForeground===lE&&(t.selectionForeground=void 0),Ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ot.opacity(t.selectionBackgroundTransparent,.3)),Ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ct(e.scrollbarSliderBackground,Ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ct(e.scrollbarSliderHoverBackground,Ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ct(e.scrollbarSliderActiveBackground,Ot.opacity(t.foreground,.5)),t.overviewRulerBorder=Ct(e.overviewRulerBorder,oK),t.ansi=pr.slice(),t.ansi[0]=Ct(e.black,pr[0]),t.ansi[1]=Ct(e.red,pr[1]),t.ansi[2]=Ct(e.green,pr[2]),t.ansi[3]=Ct(e.yellow,pr[3]),t.ansi[4]=Ct(e.blue,pr[4]),t.ansi[5]=Ct(e.magenta,pr[5]),t.ansi[6]=Ct(e.cyan,pr[6]),t.ansi[7]=Ct(e.white,pr[7]),t.ansi[8]=Ct(e.brightBlack,pr[8]),t.ansi[9]=Ct(e.brightRed,pr[9]),t.ansi[10]=Ct(e.brightGreen,pr[10]),t.ansi[11]=Ct(e.brightYellow,pr[11]),t.ansi[12]=Ct(e.brightBlue,pr[12]),t.ansi[13]=Ct(e.brightMagenta,pr[13]),t.ansi[14]=Ct(e.brightCyan,pr[14]),t.ansi[15]=Ct(e.brightWhite,pr[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]=Ct(e.extendedAnsi[i],pr[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};ox=Qt([Ne(0,ii)],ox);function Ct(e,t){if(e!==void 0)try{return Ut.toColor(e)}catch{}return t}var lK=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)}},cK=class{constructor(){this._services=new lK,this._services.set(Iy,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=rG(e).sort((o,u)=>o.index-u.index),i=[];for(let o of r){let u=this._services.get(o.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(u)}let s=r.length>0?r[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},uK={trace:0,debug:1,info:2,warn:3,error:4,off:5},dK="xterm.js: ",lx=class extends tt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=uK[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?"":dK)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};lx=Qt([Ne(0,ii)],lx);var gE=class extends tt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=t-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Je=3,cr=Object.freeze(new md),nf=0,k_=2,Nu=class bj{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Je);let s=r||Qi.fromCharData([0,$M,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let r=this._data[t*Je+0],i=r&2097151;return[this._data[t*Je+1],r&2097152?this._combined[t]:i?Sa(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?Sa(r&2097151):""}isProtected(t){return this._data[t*Je+2]&536870912}loadCell(t,r){return nf=t*Je,r.content=this._data[nf+0],r.fg=this._data[nf+1],r.bg=this._data[nf+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Je+0]=r.content,this._data[t*Je+1]=r.fg,this._data[t*Je+2]=r.bg}setCellFromCodepoint(t,r,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Je+0]=r|i<<22,this._data[t*Je+1]=s.fg,this._data[t*Je+2]=s.bg}addCodepointToCell(t,r,i){let s=this._data[t*Je+0];s&2097152?this._combined[t]+=Sa(r):s&2097151?(this._combined[t]=Sa(s&2097151)+Sa(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*Je+0]=s}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let s=new Qi;for(let o=this.length-t-r-1;o>=0;--o)this.setCell(t+r+o,this.loadCell(t+o,s));for(let o=0;o<r;++o)this.setCell(t+o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let s=new Qi;for(let o=0;o<this.length-t-r;++o)this.setCell(t+o,this.loadCell(t+r+o,s));for(let o=this.length-r;o<this.length;++o)this.setCell(o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*k_<this._data.buffer.byteLength;let i=t*Je;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let u=0;u<s.length;u++){let d=parseInt(s[u],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let u=0;u<o.length;u++){let d=parseInt(o[u],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*k_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*k_<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 bj(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303)return t+(this._data[t*Je+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303||this._data[t*Je+2]&50331648)return t+(this._data[t*Je+0]>>22);return 0}copyCellsFrom(t,r,i,s,o){let u=t._data;if(o)for(let m=s-1;m>=0;m--){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let h=parseInt(d[m],10);h>=r&&(this._combined[h-r+i]=t._combined[h])}}translateToString(t,r,i,s){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let o="";for(;r<i;){let u=this._data[r*Je+0],d=u&2097151,m=u&2097152?this._combined[r]:d?Sa(d):Ea;if(o+=m,s)for(let h=0;h<m.length;++h)s.push(r);r+=u>>22||1}return s&&s.push(r),o}};function hK(e,t,r,i,s,o){let u=[];for(let d=0;d<e.length-1;d++){let m=d,h=e.get(++m);if(!h.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&h.isWrapped;)v.push(h),h=e.get(++m);if(!o&&i>=d&&i<m){d+=v.length-1;continue}let p=0,x=Zu(v,p,t),b=1,w=0;for(;b<v.length;){let E=Zu(v,b,t),S=E-w,N=r-x,k=Math.min(S,N);v[p].copyCellsFrom(v[b],w,x,k,!1),x+=k,x===r&&(p++,x=0),w+=k,w===E&&(b++,w=0),x===0&&p!==0&&v[p-1].getWidth(r-1)===2&&(v[p].copyCellsFrom(v[p-1],r-1,x++,1,!1),v[p-1].setCell(r-1,s))}v[p].replaceCells(x,r,s);let C=0;for(let E=v.length-1;E>0&&(E>p||v[E].getTrimmedLength()===0);E--)C++;C>0&&(u.push(d+v.length-C),u.push(C)),d+=v.length-1}return u}function fK(e,t){let r=[],i=0,s=t[i],o=0;for(let u=0;u<e.length;u++)if(s===u){let d=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:d}),u+=d-1,o+=d,s=t[++i]}else r.push(u);return{layout:r,countRemoved:o}}function mK(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 pK(e,t,r){let i=[],s=e.map((m,h)=>Zu(e,h,t)).reduce((m,h)=>m+h),o=0,u=0,d=0;for(;d<s;){if(s-d<r){i.push(s-d);break}o+=r;let m=Zu(e,u,t);o>m&&(o-=m,u++);let h=e[u].getWidth(o-1)===2;h&&o--;let v=h?r-1:r;i.push(v),d+=v}return i}function Zu(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,s=e[t+1].getWidth(0)===2;return i&&s?r-1:r}var wj=class Sj{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Sj._nextId++,this._onDispose=this.register(new we),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),To(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};wj._nextId=1;var gK=wj,_r={},go=_r.B;_r[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:"≥","{":"π","|":"≠","}":"£","~":"·"};_r.A={"#":"£"};_r.B=void 0;_r[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};_r.C=_r[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_r.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};_r.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};_r.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};_r.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};_r.E=_r[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};_r.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};_r.H=_r[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_r["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var vE=4294967295,_E=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=cr.clone(),this.savedCharset=go,this.markers=[],this._nullCell=Qi.fromCharData([0,$M,1,0]),this._whitespaceCell=Qi.fromCharData([0,Ea,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Yf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new gE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Wf),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 Wf),this._whitespaceCell}getBlankLine(e,t){return new Nu(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>vE?vE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=cr);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new gE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(cr),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,r);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Nu(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 Nu(e,r)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let u=this.lines.length-s;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=hK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(cr),r);if(i.length>0){let s=fK(this.lines,i);mK(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(cr),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Nu(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(cr),s=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),m.unshift(d);if(!r){let k=this.ybase+this.y;if(k>=u&&k<u+m.length)continue}let h=m[m.length-1].getTrimmedLength(),v=pK(m,this._cols,e),p=v.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+p):x=Math.max(0,this.lines.length-this.lines.maxLength+p);let b=[];for(let k=0;k<p;k++){let R=this.getBlankLine(cr,!0);b.push(R)}b.length>0&&(s.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=h;for(;E>=0;){let k=Math.min(S,C);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[E],S-k,C-k,k,!0),C-=k,C===0&&(w--,C=v[w]),S-=k,S===0){E--;let R=Math.max(E,0);S=Zu(m,R,this._cols)}}for(let k=0;k<m.length;k++)v[k]<e&&m[k].setCell(v[k],i);let N=p-x;for(;N-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(s.length>0){let u=[],d=[];for(let C=0;C<this.lines.length;C++)d.push(this.lines.get(C));let m=this.lines.length,h=m-1,v=0,p=s[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let x=0;for(let C=Math.min(this.lines.maxLength-1,m+o-1);C>=0;C--)if(p&&p.start>h+x){for(let E=p.newLines.length-1;E>=0;E--)this.lines.set(C--,p.newLines[E]);C++,u.push({index:h+1,amount:p.newLines.length}),x+=p.newLines.length,p=s[++v]}else this.lines.set(C,d[h--]);let 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 s=this.lines.get(e);return s?s.translateToString(t,r,i):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new gK(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)}},vK=class extends tt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new _E(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new _E(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Cj=2,Ej=1,cx=class extends tt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Cj),this.rows=Math.max(e.rawOptions.rows||0,Ej),this.buffers=this._register(new vK(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(r.scrollTop===0){let u=r.lines.isFull;o===r.lines.length-1?u?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(o+1,0,i.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=o-s+1;r.lines.shiftElements(s+1,u-1,-1),r.lines.set(o,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};cx=Qt([Ne(0,ii)],cx);var Bl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Gf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},_K=["normal","bold","100","200","300","400","500","600","700","800","900"],xK=class extends tt{constructor(e){super(),this._onOptionChange=this._register(new we),this.onOptionChange=this._onOptionChange.event;let t={...Bl};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(zt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Bl[e]),!yK(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_K.includes(t)?t:Bl[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function yK(e){return e==="block"||e==="underline"||e==="bar"}function Au(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]&&Au(e[i],t-1);return r}var xE=Object.freeze({insertMode:!1}),yE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ux=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Au(xE),this.decPrivateModes=Au(yE)}reset(){this.modes=Au(xE),this.decPrivateModes=Au(yE)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};ux=Qt([Ne(0,ri),Ne(1,qM),Ne(2,ii)],ux);var bE={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function N_(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 A_=String.fromCharCode,wE={DEFAULT:e=>{let t=[N_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${A_(t[0])}${A_(t[1])}${A_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${N_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${N_(e,!0)};${e.x};${e.y}${t}`}},dx=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new we),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(bE))this.addProtocol(i,bE[i]);for(let i of Object.keys(wE))this.addEncoding(i,wE[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let i=t/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};dx=Qt([Ne(0,ri),Ne(1,Ho),Ne(2,ii)],dx);var T_=[[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]],bK=[[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]],gr;function wK(e,t){let r=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>t[s][1])r=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var SK=class{constructor(){if(this.version="6",!gr){gr=new Uint8Array(65536),gr.fill(1),gr[0]=0,gr.fill(0,1,32),gr.fill(0,127,160),gr.fill(2,4352,4448),gr[9001]=2,gr[9002]=2,gr.fill(2,11904,42192),gr[12351]=1,gr.fill(2,44032,55204),gr.fill(2,63744,64256),gr.fill(2,65040,65050),gr.fill(2,65072,65136),gr.fill(2,65280,65377),gr.fill(2,65504,65511);for(let e=0;e<T_.length;++e)gr.fill(0,T_[e][0],T_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?gr[e]:wK(e,bK)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),i=r===0&&t!==0;if(i){let s=_o.extractWidth(t);s===0?i=!1:s>r&&(r=s)}return _o.createPropertyValue(0,r,i)}},_o=class Sf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let t=new SK;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,i=!1){return(t&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,i=0,s=t.length;for(let o=0;o<s;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=s)return r+this.wcwidth(u);let h=t.charCodeAt(o);56320<=h&&h<=57343?u=(u-55296)*1024+h-56320+65536:r+=this.wcwidth(h)}let d=this.charProperties(u,i),m=Sf.extractWidth(d);Sf.extractShouldJoin(d)&&(m-=Sf.extractWidth(i)),r+=m,i=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},CK=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function SE(e){var i;let t=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var pu=2147483647,EK=256,Rj=class hx{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>EK)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new hx;if(!t.length)return r;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let o=0;o<s.length;++o)r.addSubParam(s[o]);else r.addParam(s)}return r}clone(){let t=new hx(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>pu?pu: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>pu?pu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(t[r]=this._subParams.slice(i,s))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+t,pu):t}},gu=[],RK=class{constructor(){this._state=0,this._active=gu,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=gu}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=gu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||gu,!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",Lm(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=gu,this._id=-1,this._state=0}}},Ti=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+=Lm(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}},vu=[],kK=class{constructor(){this._handlers=Object.create(null),this._active=vu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vu}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=vu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||vu,!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",Lm(e,t,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=vu,this._ident=0}},Tu=new Rj;Tu.addParam(0);var CE=class{constructor(e){this._handler=e,this._data="",this._params=Tu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Tu,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=Lm(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=Tu,this._data="",this._hitLimit=!1,r));return this._params=Tu,this._data="",this._hitLimit=!1,t}},NK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=r<<4|i}},Yi=160,AK=(function(){let e=new NK(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Yi,0,2,0),e.add(Yi,8,5,8),e.add(Yi,6,0,6),e.add(Yi,11,0,11),e.add(Yi,13,13,13),e})(),TK=class extends tt{constructor(e=AK){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 Rj,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(zt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new RK),this._dcsParser=this._register(new kK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let o=e.intermediates.charCodeAt(s);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,r){let i=0,s=0,o=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],u=this._oscParser.end(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],s=this._transitions.table[this.currentState<<8|(i<160?i:Yi)],s>>4){case 2:for(let x=d+1;;++x){if(x>=t||(i=e[x])<32||i>126&&i<Yi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Yi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Yi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(i=e[x])<32||i>126&&i<Yi){this._printHandler(e,d,x),d=x-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|i],h=m?m.length-1:-1;for(;h>=0&&(u=m[h](this._params),u!==!0);h--)if(u instanceof Promise)return this._preserveStack(3,m,h,s,d),u;h<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++d<t&&(i=e[d])>47&&i<60);d--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let v=this._escHandlers[this._collect<<8|i],p=v?v.length-1:-1;for(;p>=0&&(u=v[p](),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(4,v,p,s,d),u;p<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let x=d+1;;++x)if(x>=t||(i=e[x])===24||i===26||i===27||i>127&&i<Yi){this._dcsParser.put(e,d,x),d=x-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,s,d),u;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let x=d+1;;x++)if(x>=t||(i=e[x])<32||i>127&&i<Yi){this._oscParser.put(e,d,x),d=x-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,s,d),u;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},MK=/^([\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})$/,jK=/^[\da-f]+$/;function EE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=MK.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),jK.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let o=parseInt(t.slice(r*s,r*s+r),16);i[s]=r===1?o<<4:r===2?o:r===3?o>>4:o>>8}return i}}function M_(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 DK(e,t=16){let[r,i,s]=e;return`rgb:${M_(r,t)}/${M_(i,t)}/${M_(s,t)}`}var LK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},_a=131072,RE=10;function kE(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var NE=5e3,AE=0,OK=class extends tt{constructor(e,t,r,i,s,o,u,d,m=new TK){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new eG,this._utf8Decoder=new tG,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=cr.clone(),this._eraseAttrDataInternal=cr.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new fx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:v.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,v,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:v,data:p})}),this._parser.setDcsHandlerFallback((h,v,p)=>{v==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:v,payload:p})}),this._parser.setPrintHandler((h,v,p)=>this.print(h,v,p)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(bf.IND,()=>this.index()),this._parser.setExecuteHandler(bf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(bf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ti(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ti(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ti(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ti(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ti(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ti(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ti(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ti(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ti(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ti(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ti(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ti(h=>this.restoreCursorColor(h))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let h in _r)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new CE((h,v)=>this.requestStatusString(h,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),NE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${NE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,o=0,u=this._parseStack.paused;if(u){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>_a&&(o=this._parseStack.position+_a)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<_a&&(this._parseBuffer=new Uint32Array(Math.min(e.length,_a))),u||this._dirtyRowTracker.clearRange(),e.length>_a)for(let h=o;h<e.length;h+=_a){let v=h+_a<e.length?h+_a:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(h,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,p))return this._preserveStack(i,s,p,h),this._logSlowResolvingAsync(r),r}else if(!u){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,s,h,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let i,s,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,v=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let x=this._parser.precedingJoinState;for(let 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,x);s=_o.extractWidth(w);let C=_o.extractShouldJoin(w),E=C?_o.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(Sa(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-E>d){if(m){let S=p,N=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&p instanceof Nu&&p.copyCellsFrom(S,N,0,E,!1);N<d;)S.setCellFromCodepoint(N++,0,1,v)}else if(this._activeBuffer.x=d-1,s===2)continue}if(C&&this._activeBuffer.x){let S=p.getWidth(this._activeBuffer.x-1)?1:2;p.addCodepointToCell(this._activeBuffer.x-S,i,s);for(let N=s-E;--N>=0;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(h&&(p.insertCells(this._activeBuffer.x,s-E,this._activeBuffer.getNullCell(v)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,v)),p.setCellFromCodepoint(this._activeBuffer.x++,i,s,v),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=x,this._activeBuffer.x<d&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>kE(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new CE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ti(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(cr));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,i=_o.extractWidth(t),s=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),u=new Uint32Array(o.length*r),d=0;for(let h=0;h<o.length;){let v=o.codePointAt(h)||0;u[d++]=v,h+=v>65535?2:1}let m=d;for(let h=1;h<r;++h)u.copyWithin(m,0,d),m+=d;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.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,go),this._charsetService.setgCharset(1,go),this._charsetService.setgCharset(2,go),this._charsetService.setgCharset(3,go);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:h,alt:v}=d,p=this._optionsService.rawOptions,x=(C,E)=>(u.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${C};${E}$y`),!0),b=C=>C?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,b(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,b(p.convertEol)):x(w,0):w===1?x(w,b(i.applicationCursorKeys)):w===3?x(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?x(w,b(i.origin)):w===7?x(w,b(i.wraparound)):w===8?x(w,3):w===9?x(w,b(s==="X10")):w===12?x(w,b(p.cursorBlink)):w===25?x(w,b(!u.isCursorHidden)):w===45?x(w,b(i.reverseWraparound)):w===66?x(w,b(i.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,b(s==="VT200")):w===1002?x(w,b(s==="DRAG")):w===1003?x(w,b(s==="ANY")):w===1004?x(w,b(i.sendFocus)):w===1005?x(w,4):w===1006?x(w,b(o==="SGR")):w===1015?x(w,4):w===1016?x(w,b(o==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,b(h===v)):w===2004?x(w,b(i.bracketedPasteMode)):w===2026?x(w,b(i.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,r,i,s){return t===2?(e|=50331648,e&=-16777216,e|=md.fromColorRGB([r,i,s])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],s=0,o=0;do{if(i[o+s]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),d=0;do i[1]===5&&(s=1),i[o+d+1+s]=u[d];while(++d<u.length&&d+o+1+s<i.length);break}if(i[1]===5&&o+s>=2||i[1]===2&&o+s>=5)break;i[1]&&(s=1)}while(++o+t<e.length&&o+s<i.length);for(let u=2;u<i.length;++u)i[u]===-1&&(i[u]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=cr.fg,e.bg=cr.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let s=0;s<t;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=cr.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=cr.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=cr.fg&16777215,i.bg&=-67108864,i.bg|=cr.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.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(`${ve.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=cr.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!kE(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>RE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>RE&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(TE(o))if(s==="?")t.push({type:0,index:o});else{let u=EE(s);u&&t.push({type:1,index:o,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(o=>o.startsWith("id="));return s!==-1&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let i=0;i<r.length&&!(t>=this._specialColors.length);++i,++t)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=EE(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);TE(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,go),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(LK[e[0]],_r[e[1]]||go),!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=cr.clone(),this._eraseAttrDataInternal=cr.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 Qi;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(`${ve.ESC}${u}${ve.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},fx=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(AE=e,e=t,t=AE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};fx=Qt([Ne(0,ri)],fx);function TE(e){return 0<=e&&e<256}var BK=5e7,ME=12,PK=50,IK=class extends tt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new we),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>BK)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,t);if(s){let u=d=>performance.now()-r>=ME?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);s.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(u);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=ME)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>PK&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},mx=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let o=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mx=Qt([Ne(0,ri)],mx);var jE=!1,zK=class extends tt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Zl),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new cK,this.optionsService=this._register(new xK(e)),this._instantiationService.setService(ii,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(cx)),this._instantiationService.setService(ri,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(lx)),this._instantiationService.setService(qM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ux)),this._instantiationService.setService(Ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(dx)),this._instantiationService.setService(WM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(_o)),this._instantiationService.setService(sG,this.unicodeService),this._charsetService=this._instantiationService.createInstance(CK),this._instantiationService.setService(nG,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mx),this._instantiationService.setService(VM,this._oscLinkService),this._inputHandler=this._register(new OK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register($r.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register($r.forward(this._bufferService.onResize,this._onResize)),this._register($r.forward(this.coreService.onData,this._onData)),this._register($r.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 IK((t,r)=>this._inputHandler.parse(t,r))),this._register($r.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!jE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),jE=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Cj),t=Math.max(t,Ej),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(SE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(SE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zt(()=>{for(let t of e)t.dispose()})}}},$K={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 UK(e,t,r,i){var u;let s={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=ve.ESC+"OA":s.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=ve.ESC+"OD":s.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=ve.ESC+"OC":s.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=ve.ESC+"OB":s.key=ve.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(s.key=ve.ESC+s.key);break;case 9:if(e.shiftKey){s.key=ve.ESC+"[Z";break}s.key=ve.HT,s.cancel=!0;break;case 13:s.key=e.altKey?ve.ESC+ve.CR:ve.CR,s.cancel=!0;break;case 27:s.key=ve.ESC,e.altKey&&(s.key=ve.ESC+ve.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=ve.ESC+"[1;"+(o+1)+"D":t?s.key=ve.ESC+"OD":s.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=ve.ESC+"[1;"+(o+1)+"C":t?s.key=ve.ESC+"OC":s.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=ve.ESC+"[1;"+(o+1)+"A":t?s.key=ve.ESC+"OA":s.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=ve.ESC+"[1;"+(o+1)+"B":t?s.key=ve.ESC+"OB":s.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=ve.ESC+"[2~");break;case 46:o?s.key=ve.ESC+"[3;"+(o+1)+"~":s.key=ve.ESC+"[3~";break;case 36:o?s.key=ve.ESC+"[1;"+(o+1)+"H":t?s.key=ve.ESC+"OH":s.key=ve.ESC+"[H";break;case 35:o?s.key=ve.ESC+"[1;"+(o+1)+"F":t?s.key=ve.ESC+"OF":s.key=ve.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=ve.ESC+"[5;"+(o+1)+"~":s.key=ve.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=ve.ESC+"[6;"+(o+1)+"~":s.key=ve.ESC+"[6~";break;case 112:o?s.key=ve.ESC+"[1;"+(o+1)+"P":s.key=ve.ESC+"OP";break;case 113:o?s.key=ve.ESC+"[1;"+(o+1)+"Q":s.key=ve.ESC+"OQ";break;case 114:o?s.key=ve.ESC+"[1;"+(o+1)+"R":s.key=ve.ESC+"OR";break;case 115:o?s.key=ve.ESC+"[1;"+(o+1)+"S":s.key=ve.ESC+"OS";break;case 116:o?s.key=ve.ESC+"[15;"+(o+1)+"~":s.key=ve.ESC+"[15~";break;case 117:o?s.key=ve.ESC+"[17;"+(o+1)+"~":s.key=ve.ESC+"[17~";break;case 118:o?s.key=ve.ESC+"[18;"+(o+1)+"~":s.key=ve.ESC+"[18~";break;case 119:o?s.key=ve.ESC+"[19;"+(o+1)+"~":s.key=ve.ESC+"[19~";break;case 120:o?s.key=ve.ESC+"[20;"+(o+1)+"~":s.key=ve.ESC+"[20~";break;case 121:o?s.key=ve.ESC+"[21;"+(o+1)+"~":s.key=ve.ESC+"[21~";break;case 122:o?s.key=ve.ESC+"[23;"+(o+1)+"~":s.key=ve.ESC+"[23~";break;case 123:o?s.key=ve.ESC+"[24;"+(o+1)+"~":s.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=ve.DEL:e.keyCode===219?s.key=ve.ESC:e.keyCode===220?s.key=ve.FS:e.keyCode===221&&(s.key=ve.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let d=(u=$K[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)s.key=ve.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(m);e.shiftKey&&(h=h.toUpperCase()),s.key=ve.ESC+h}else if(e.keyCode===32)s.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),s.key=ve.ESC+m,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=ve.US),e.key==="@"&&(s.key=ve.NUL));break}return s}var ir=0,HK=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Yf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Yf,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,o)=>this._getKey(s)-this._getKey(o)),t=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(i[s]=e[t],t++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(ir=this._search(t),ir===-1)||this._getKey(this._array[ir])!==t)return!1;do if(this._array[ir]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ir),!0;while(++ir<this._array.length&&this._getKey(this._array[ir])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ir=this._search(e),!(ir<0||ir>=this._array.length)&&this._getKey(this._array[ir])===e))do yield this._array[ir];while(++ir<this._array.length&&this._getKey(this._array[ir])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ir=this._search(e),!(ir<0||ir>=this._array.length)&&this._getKey(this._array[ir])===e))do t(this._array[ir]);while(++ir<this._array.length&&this._getKey(this._array[ir])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},j_=0,DE=0,FK=class extends tt{constructor(){super(),this._decorations=new HK(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new WK(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let i=0,s=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,s=i+(o.options.width??1),e>=i&&e<s&&(!r||(o.options.layer??"bottom")===r)&&(yield o)}forEachDecorationAtCell(e,t,r,i){this._decorations.forEachByKey(t,s=>{j_=s.options.x??0,DE=j_+(s.options.width??1),e>=j_&&e<DE&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},WK=class extends Na{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),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=Ut.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ut.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},qK=1e3,VK=class{constructor(e,t=qK){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,o=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},LE=20,Kf=class extends tt{constructor(e,t,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new VK(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(`
653
- `))),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(He(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(zt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<LE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
654
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===LE+1&&(this._liveRegion.textContent+=L0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=t;s++){let o=r.lines.get(r.ydisp+s),u=[],d=(o==null?void 0:o.translateToString(!0,void 0,void 0,u))||"",m=(r.ydisp+s+1).toString(),h=this._rowElements[s];h&&(d.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=d,this._rowColumns.set(h,u)),h.setAttribute("aria-posinset",m),h.setAttribute("aria-setsize",i),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===o||e.relatedTarget!==i)return;let u,d;if(t===0?(u=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(u=this._rowElements.shift(),d=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((d=i.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:m,offset:h})=>{let v=m instanceof Text?m.parentNode:m,p=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let x=this._rowColumns.get(v);if(!x)return console.warn("columns is null. Race condition?"),null;let b=h<x.length?x[h]:x.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},o=s(t),u=s(r);if(!(!o||!u)){if(o.row>u.row||o.row===u.row&&o.column>=u.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(u.row-o.row)*this._terminal.cols-o.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,o;e.style.transform="";let t=e.getBoundingClientRect().width,r=(o=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:o[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Kf=Qt([Ne(1,Iy),Ne(2,$s),Ne(3,Us)],Kf);var px=class extends tt{constructor(e,t,r,i,s){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zt(()=>{var o;To(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(He(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(He(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(He(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(He(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(o=>{o==null||o.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[o,u]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(o)&&(r=this._checkLinkProviderResult(o,e,r)):u.provideLinks(e.y,d=>{var h,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(p=>({link:p}));(h=this._activeProviderReplies)==null||h.set(o,m),r=this._checkLinkProviderResult(o,e,r),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let i=0;i<t.size;i++){let s=t.get(i);if(s)for(let o=0;o<s.length;o++){let u=s[o],d=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let h=d;h<=m;h++){if(r.has(h)){s.splice(o--,1);break}r.add(h)}}}}_checkLinkProviderResult(e,t,r){var o;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let u=0;u<e;u++)(!this._activeProviderReplies.has(u)||this._activeProviderReplies.get(u))&&(s=!0);if(!s&&i){let u=i.find(d=>this._linkAtPosition(d.link,t));u&&(r=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let u=0;u<this._activeProviderReplies.size;u++){let d=(o=this._activeProviderReplies.get(u))==null?void 0:o.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&GK(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,To(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,o;(i=this._currentLink)!=null&&i.state&&((o=(s=this._currentLink)==null?void 0:s.state)==null?void 0:o.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return r<=s&&s<=i}_positionFromMouseEvent(e,t,r){let i=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,i,s){return{x1:e,y1:t,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};px=Qt([Ne(1,zy),Ne(2,Us),Ne(3,ri),Ne(4,YM)],px);function GK(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 YK=class extends zK{constructor(e={}){super(e),this._linkifier=this._register(new Zl),this.browser=fj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Zl),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(FK),this._instantiationService.setService(pd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(PY),this._instantiationService.setService(YM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(B0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register($r.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register($r.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register($r.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register($r.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(zt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Ot.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ve.ESC}]${i};${DK(s)}${dj.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=dr.toColor(...t.color));else{let o=r;this._themeService.modifyColors(u=>u[o]=dr.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(Kf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.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(ve.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,u=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=u+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(He(this.element,"copy",t=>{this.hasSelection()&&QV(t,this._selectionService)}));let e=t=>JV(t,this.textarea,this.coreService,this.optionsService);this._register(He(this.textarea,"paste",e)),this._register(He(this.element,"paste",e)),mj?this._register(He(this.element,"mousedown",t=>{t.button===2&&W5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(He(this.element,"contextmenu",t=>{W5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Gy&&this._register(He(this.element,"auxclick",t=>{t.button===1&&zM(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(He(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(He(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(He(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(He(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(He(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(He(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(He(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(He(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",D0.get()),vj||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(OY,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($s,this._coreBrowserService),this._register(He(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(He(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ix,this._document,this._helperContainer),this._instantiationService.setService(Om,this._charSizeService),this._themeService=this._instantiationService.createInstance(ox),this._instantiationService.setService(lc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Vf),this._instantiationService.setService(GM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sx,this.rows,this.screenElement)),this._instantiationService.setService(Us,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ex,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(nx),this._instantiationService.setService(zy,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(px,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Q0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ax,this.element,this.screenElement,i)),this._instantiationService.setService(oG,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($r.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(J0,this.screenElement)),this._register(He(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(Kf,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(rx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(o){var h,v,p,x,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,(x=(p=(v=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:v.device)==null?void 0:p.cell)==null?void 0:x.height,(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},s={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(He(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(He(t,"wheel",o=>{var u,d,m,h,v;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(m=(d=(u=e._renderService)==null?void 0:u.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:h.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(o,!0);let p=ve.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){IM(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=UK(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===ve.ETX||r.key===ve.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)&&(KK(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(cr));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(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.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(`${ve.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function KK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var XK=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)}},ZK=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 Qi)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},OE=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new ZK(t)}getNullCell(){return new Qi}},QK=class extends tt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new OE(this._core.buffers.normal,"normal"),this._alternate=new OE(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},JK=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)}},eX=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}},tX=["cols","rows"],Hn=0,rX=class extends tt{constructor(e){super(),this._core=this._register(new YK(e)),this._addonManager=this._register(new XK),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(tX.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 JK(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new eX(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 QK(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
655
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return D0.get()},set promptLabel(e){D0.set(e)},get tooMuchOutput(){return L0.get()},set tooMuchOutput(e){L0.set(e)}}}_verifyIntegers(...e){for(Hn of e)if(Hn===1/0||isNaN(Hn)||Hn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Hn of e)if(Hn&&(Hn===1/0||isNaN(Hn)||Hn%1!==0||Hn<0))throw new Error("This API only accepts positive integers")}};function BE(e,t){if(typeof document>"u")return t;try{const r=document.createElement("span");r.style.color=`var(${e})`,r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);const i=getComputedStyle(r).color;return r.remove(),i||t}catch{return t}}function PE(){const e=BE("--card","#0b0b12"),t=BE("--foreground","#e5e5ef"),r=typeof document<"u"&&document.documentElement.classList.contains("dark");return{background:e,foreground:t,cursor:"#a855f7",cursorAccent:e,selectionBackground:"#9333ea55",...r?{}:{black:t,white:"#3f3f46",brightWhite:t,brightBlack:"#a1a1aa"}}}function iX(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function nX(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 sX(e){return e===1001||e===1006||e===1012||e===1013}function aX(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 oX="\x1B[13;2u";function lX(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?oX:null}const IE=new TextEncoder,cX=750,uX=2048;function dX(e,t){return t<cX&&e<=uX}function hX(e){let t;try{t=new GV}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function fX(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class mX{constructor(t,r,i){Wr(this,"term");Wr(this,"fit");Wr(this,"webgl");Wr(this,"listenerCtl");Wr(this,"resizeObserver");Wr(this,"ws",null);Wr(this,"dataDispose",null);Wr(this,"lastUserInputAt",0);Wr(this,"disposed",!1);Wr(this,"connectedOnce",!1);Wr(this,"connectionGeneration",0);Wr(this,"layoutVisible",!1);this.url=r,this.onState=i,this.term=new rX({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:PE(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0}),this.fit=new aq,this.term.loadAddon(this.fit),this.term.loadAddon(new hq(iX)),this.term.open(t),this.webgl=hX(this.term),this.listenerCtl=new AbortController;const{signal:s}=this.listenerCtl;t.addEventListener("copy",o=>fX(o,this.term.getSelection()),{capture:!0,signal:s}),this.onState({kind:"connecting"}),this.resizeObserver=new ResizeObserver(o=>{var m;if(this.disposed)return;const u=(m=o[0])==null?void 0:m.contentRect,d=!!u&&u.width>0&&u.height>0;if(this.layoutVisible=d,!this.connectedOnce&&!this.ws){d&&this.connect();return}d&&this.sendResize()}),this.resizeObserver.observe(t)}async connect(){var o;if(this.disposed)return;const t=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let r;try{if(r=typeof this.url=="function"?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||t!==this.connectionGeneration)return;const u=new URL(r);u.searchParams.set("cols",String(this.term.cols)),u.searchParams.set("rows",String(this.term.rows)),r=u.toString()}catch(u){if(this.disposed||t!==this.connectionGeneration)return;aX(u)?this.onState({kind:"closed",code:1006,reason:"Terminal connection temporarily unavailable"}):this.onState({kind:"error",message:u instanceof Error?u.message:"Could not prepare terminal connection"});return}let i;try{i=new WebSocket(r)}catch(u){if(this.disposed||t!==this.connectionGeneration)return;this.onState({kind:"error",message:u instanceof Error?u.message:"Could not open terminal connection"});return}i.binaryType="arraybuffer",this.ws=i;let s=null;i.addEventListener("open",()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),i.addEventListener("message",u=>{if(u.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(u.data));return}if(typeof u.data!="string")return;const d=nX(u.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(s=d.message,this.onState({kind:"error",message:d.message}))},{signal:this.listenerCtl.signal}),i.addEventListener("close",u=>{var d;this.ws===i&&(this.ws=null,(d=this.dataDispose)==null||d.dispose(),this.dataDispose=null,!(s!==null&&u.code===4500)&&this.onState({kind:"closed",reason:u.reason||`code ${u.code}`,code:u.code}))},{signal:this.listenerCtl.signal}),i.addEventListener("error",()=>{this.ws===i&&this.onState({kind:"error",message:"Terminal WebSocket error"})},{signal:this.listenerCtl.signal}),(o=this.dataDispose)==null||o.dispose(),this.dataDispose=this.term.onData(u=>{this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(IE.encode(u))}),this.term.attachCustomKeyEventHandler(u=>{const d=lX(u);return d===null?!0:(u.type==="keydown"&&(u.preventDefault(),this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(IE.encode(d))),!1)})}setTheme(){this.term.options.theme=PE()}reconnect({silent:t=!1}={}){var i;if(this.disposed)return;const r=this.ws;this.ws=null,(i=this.dataDispose)==null||i.dispose(),this.dataDispose=null;try{r==null||r.close()}catch{}this.onState({kind:t?"probing":"connecting"}),this.connect()}dispose(){var r,i;if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),(r=this.dataDispose)==null||r.dispose();const t=this.ws;this.ws=null;try{t==null||t.close()}catch{}(i=this.webgl)==null||i.dispose(),this.term.dispose()}writeOutput(t){if(dX(t.length,performance.now()-this.lastUserInputAt)){const r=this.term._core;if(typeof(r==null?void 0:r.writeSync)=="function")try{r.writeSync(t,1);return}catch{}}this.term.write(t)}sendResize(){if(!(!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:"resize",cols:this.term.cols,rows:this.term.rows}))}}}const zE=[500,1e3,2e3,4e3,8e3],pX=3e4,gX=15e3;function vX({sessionId:e,runtimeSelector:t,active:r,role:i="owner",setup:s}){const[o,u]=g.useState({kind:"connecting"}),[d,m]=g.useState(0),[h,v]=g.useState(!1),[p,x]=g.useState(!1),[b,w]=g.useState(null),C=g.useRef(0),E=g.useRef(null),S=g.useRef(null),N=`${t}\0${e}`,k=g.useRef(N);k.current=N;const{theme:R}=Ly(),M=g.useCallback(q=>u(q),[]);g.useEffect(()=>{var q;(q=S.current)==null||q.setTheme()},[R]),g.useEffect(()=>{w(null),x(!1)},[N]);const L=g.useCallback(q=>{if(q===null)return;M({kind:"connecting"});let G=null,W=!1;return queueMicrotask(()=>{W||(G=new mX(q,({cols:B,rows:j})=>I9(t,e,{role:i,cols:B,rows:j,refreshCapability:!0}),M),S.current=G)}),()=>{W=!0,G==null||G.dispose(),S.current=null}},[e,t,i,M]);g.useEffect(()=>{if(o.kind==="connected"){E.current=Date.now(),v(!1);return}if(o.kind!=="closed")return;if(!r){v(!1);return}if(!sX(o.code)){v(!1);return}if(E.current!==null&&Date.now()-E.current>=pX&&(C.current=0),E.current=null,C.current>=zE.length){v(!1);return}const q=zE[C.current];C.current+=1,v(!0);let G=!1;const W=()=>{G||(G=!0,S.current?S.current.reconnect():m(O=>O+1))},B=window.setTimeout(W,q),j=()=>{document.visibilityState==="visible"&&W()};return document.addEventListener("visibilitychange",j),()=>{window.clearTimeout(B),document.removeEventListener("visibilitychange",j)}},[r,o]);const $=g.useCallback(()=>{C.current=0,E.current=null,v(!1),S.current?S.current.reconnect():m(q=>q+1)},[]),D=g.useCallback(async()=>{if(p)return;const q=N,G=new AbortController,W=window.setTimeout(()=>G.abort(),gX);x(!0),w(null);try{if(await xe.startSessionTerminal(t,e,G.signal),k.current!==q)return;$()}catch(B){if(k.current!==q)return;w(G.signal.aborted?"Terminal start timed out. Try again.":B instanceof Error?B.message:"Could not start terminal")}finally{window.clearTimeout(W),k.current===q&&x(!1)}},[$,t,e,p,N]);return l.jsxs("div",{"data-state":o.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[l.jsx("div",{ref:L,className:"h-full w-full overflow-hidden"},d),o.kind!=="connected"&&l.jsx(yX,{state:o,reconnectPending:h,startingTerminal:p,startError:b,onRetry:$,onStartTerminal:()=>void D(),setup:s})]}),l.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:l.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:xX(_X())})})]})}function _X(){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 xX(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function yX({state:e,reconnectPending:t,startingTerminal:r,startError:i,onRetry:s,onStartTerminal:o,setup:u}){return l.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]",children:[e.kind==="connecting"&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Ve,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Ve,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?l.jsx(bX,{starting:r,error:i,onStart:o,setup:u}):l.jsx($E,{message:e.reason||"Terminal connection closed",onRetry:s})),e.kind==="probing"&&l.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[l.jsx(Ve,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&l.jsx($E,{message:e.message,onRetry:s})]})}function bX({starting:e,error:t,onStart:r,setup:i}){const s=(i==null?void 0:i.target)??"Provider",o=(i==null?void 0:i.kind)==="delivery_unknown"?"Task delivery needs confirmation":(i==null?void 0:i.kind)==="required"?`${s} needs setup`:"Terminal is not running",u=(i==null?void 0:i.kind)==="delivery_unknown"?"Rynx could not confirm whether the queued task was accepted. Open the terminal and check its history before retrying.":(i==null?void 0:i.kind)==="required"?i.taskQueued?`Complete login or first-run setup. The queued task will start automatically when ${s} is ready.`:i.reason??`Complete ${s} login or first-run setup before starting this Session.`:"Start it when you need terminal access for this Session.",d=(i==null?void 0:i.kind)==="required"?`Open ${s} setup`:"Start terminal";return l.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx("span",{className:"font-medium",children:o}),l.jsx("span",{className:"text-[var(--muted-foreground)]",children:u})]}),t&&l.jsx("span",{className:"text-[var(--destructive)]",children:t}),l.jsxs(he,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?l.jsx(Ve,{className:"animate-spin"}):l.jsx(BR,{}),e?"Opening…":d]})]})}function $E({message:e,onRetry:t}){return l.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[l.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),l.jsxs(he,{variant:"outline",size:"sm",onClick:t,children:[l.jsx(At,{})," Retry"]})]})}var Im="Collapsible",[wX]=Cn(Im),[SX,Yy]=wX(Im),kj=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:u,...d}=e,[m,h]=Eo({prop:i,defaultProp:s??!1,onChange:u,caller:Im});return l.jsx(SX,{scope:r,disabled:o,contentId:_n(),open:m,onOpenToggle:g.useCallback(()=>h(v=>!v),[h]),children:l.jsx(We.div,{"data-state":Xy(m),"data-disabled":o?"":void 0,...d,ref:t})})});kj.displayName=Im;var Nj="CollapsibleTrigger",Aj=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,s=Yy(Nj,r);return l.jsx(We.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Xy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:t,onClick:Be(e.onClick,s.onOpenToggle)})});Aj.displayName=Nj;var Ky="CollapsibleContent",Tj=g.forwardRef((e,t)=>{const{forceMount:r,...i}=e,s=Yy(Ky,e.__scopeCollapsible);return l.jsx(En,{present:r||s.open,children:({present:o})=>l.jsx(CX,{...i,ref:t,present:o})})});Tj.displayName=Ky;var CX=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=e,u=Yy(Ky,r),[d,m]=g.useState(i),h=g.useRef(null),v=rt(t,h),p=g.useRef(0),x=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 N=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(N)},[]),Zt(()=>{const N=h.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();p.current=k.height,b.current=k.width,E.current||(N.style.transitionDuration=S.current.transitionDuration,N.style.animationName=S.current.animationName),m(i)}},[u.open,i]),l.jsx(We.div,{"data-state":Xy(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!C,...o,ref:v,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:C&&s})});function Xy(e){return e?"open":"closed"}var EX=kj,RX=Aj,kX=Tj;const zm=EX,$m=RX,Um=kX;function NX({status:e}){return e==="completed"?l.jsx(Pa,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?l.jsx(Ve,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):l.jsx(uO,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function AX({todos:e}){const[t,r]=g.useState(!0);if(e.length===0)return null;const i=e.filter(s=>s.status==="completed").length;return l.jsxs(zm,{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($m,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[l.jsx(jo,{className:Fe("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(Um,{className:"overflow-hidden px-3 pb-2",children:l.jsx("ul",{className:"space-y-1",children:e.map(s=>l.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[l.jsx(NX,{status:s.status}),l.jsx("span",{className:Fe("truncate",s.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:s.subject})]},s.id))})})]})}function UE(e,t,r={},i={},s=!0){const o={},u={};for(const d of e){if(d.type==="text"){const b=typeof t[d.id]=="string"?t[d.id]:"";s&&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)),h=d.allowOther===!0&&i[d.id]===!0,v=h?(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),s&&h&&!v?u[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&w.length===0?u[d.id]=`${d.label} is required`:w.length>0&&(o[d.id]=w);continue}const p=typeof t[d.id]=="string"?t[d.id]:"",x=h?v:m.has(p)?p:"";s&&h&&!v?u[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&!x?u[d.id]=`${d.label} is required`:x&&(o[d.id]=x)}return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:o}}function TX({sessionId:e,item:t,canResolve:r=!0}){var j;const{runtimeSelector:i}=sc(),s=g.useId().replaceAll(":",""),[o,u]=g.useState({}),[d,m]=g.useState({}),[h,v]=g.useState({}),[p,x]=g.useState({}),[b,w]=g.useState(()=>{var O;return(O=t.request.fields[0])==null?void 0:O.id}),[C,E]=g.useState(),[S,N]=g.useState(),k=t.status==="pending";function R(O){x(z=>{if(!z[O])return z;const T={...z};return delete T[O],T})}function M(O,z){u(T=>({...T,[O]:z})),R(O)}function L(O,z){v(T=>({...T,[O]:z})),R(O)}function $(O){const z=t.request.fields,T=Math.max(z.findIndex(H=>H.id===b),0),U=z.findIndex(H=>H.id===O);if(!(U<0)){if(U>T){const H=z[T];if(H){const F=UE([H],o,d,h);if(!F.ok){x(V=>({...V,...F.errors}));return}R(H.id)}}w(O)}}async function D(O){if(!r)return;const z=UE(t.request.fields,o,d,h,O.requiresAnswers);if(!z.ok){x(z.errors);const T=t.request.fields.find(U=>z.errors[U.id]);T&&w(T.id);return}x({}),E(void 0),N(O.id);try{await $9(e,t.id,{actionId:O.id,...Object.keys(z.answers).length>0?{answers:z.answers}:{}},i)}catch(T){N(void 0),E(T instanceof Error?T.message:String(T))}}const q=t.request.kind==="permission"?DB:t.request.kind==="form"?HO:rO,G=Math.max(t.request.fields.findIndex(O=>O.id===b),0),W=t.request.fields.length===0||G===t.request.fields.length-1,B=t.request.actions.filter(O=>!O.requiresAnswers||W);return l.jsxs("section",{"aria-labelledby":`${s}-title`,"aria-busy":S!==void 0,className:Fe("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(q,{"aria-hidden":"true",className:Fe("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{id:`${s}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&l.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),l.jsx(MX,{item:t}),k&&!r?l.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):k?l.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[l.jsx(Q7,{idPrefix:s,fields:t.request.fields,activeFieldId:b,answers:o,otherValues:d,otherSelections:h,errors:p,disabled:S!==void 0,onNavigate:$,onAnswerChange:M,onOtherSelectionChange:L,onOtherValueChange:(O,z)=>{m(T=>({...T,[O]:z})),R(O)}}),C&&l.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",C]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[B.map(O=>l.jsxs(he,{type:"button",size:"sm",variant:DX(O),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:S!==void 0,title:O.description,"aria-label":O.description?`${O.label}. ${O.description}`:void 0,onClick:()=>void D(O),children:[S===O.id&&l.jsx(Ve,{"aria-hidden":"true",className:"animate-spin"}),O.label]},O.id)),S&&l.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(j=t.request.actions.find(O=>O.id===S))==null?void 0:j.label,"…"]})]})]}):l.jsx(jX,{item:t})]})}function MX({item:e}){const t=e.request.context;return t?l.jsxs("div",{className:"mt-3 grid min-w-0 gap-1.5",children:[t.summary&&l.jsx("p",{className:"break-words leading-relaxed text-[var(--muted-foreground)]",children:t.summary}),t.toolName&&l.jsxs("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["tool · ",t.toolName]}),t.command&&l.jsx(HE,{value:t.command}),t.cwd&&l.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]",children:t.cwd}),t.diff&&l.jsx(HE,{value:t.diff,tall:!0})]}):null}function HE({value:e,tall:t=!1}){return l.jsx("pre",{className:Fe("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 jX({item:e}){var i;if(e.status!=="resolved"){const s=e.status==="expired"?"Expired":e.status==="inactive"?"No longer active":"Cancelled";return l.jsxs("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:[s,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(s=>{var o;return s.id===((o=e.resolution)==null?void 0:o.actionId)}),r=e.request.fields.flatMap(s=>{var d,m;const o=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[s.id];if(o===void 0)return[];const u=s.type==="text"&&s.secret?"••••••••":Array.isArray(o)?o.join(", "):o;return[{id:s.id,label:s.label,value:u}]});return l.jsxs("div",{"aria-live":"polite",className:"mt-3 grid gap-1.5 text-[var(--muted-foreground)]",children:[l.jsxs("div",{children:["Resolved · ",(t==null?void 0:t.label)??((i=e.resolution)==null?void 0:i.actionId)??"answered"]}),r.map(s=>l.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[l.jsx("span",{children:s.label}),l.jsx("span",{className:"break-words text-[var(--foreground)]",children:s.value})]},s.id))]})}function DX(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function LX({item:e}){const t=e.rotateKind==="fork"?AO:_O;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 OX({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(aO,{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(Ra,{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 BX="modulepreload",PX=function(e){return"/"+e},FE={},IX=function(t,r,i){let s=Promise.resolve();if(r&&r.length>0){let u=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(r.map(h=>{if(h=PX(h),h in FE)return;FE[h]=!0;const v=h.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":BX,v||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),v)return new Promise((b,w)=>{x.addEventListener("load",b),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},zX=g.lazy(()=>IX(()=>import("./mermaid-GHXKKRXX-BDikE3W1.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),$X=Fe("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 Mj({children:e,className:t}){return l.jsx(g.Suspense,{fallback:l.jsx("div",{className:Fe("whitespace-pre-wrap break-words text-sm",t),children:e}),children:l.jsx(zX,{shikiTheme:["github-light","github-dark"],className:Fe($X,t),children:e})})}function UX({item:e,sessionId:t,runtimeSelector:r}){const[i,s]=g.useState(null),[o,u]=g.useState(()=>new Set),d=e.images??[],m=d.find(h=>h.resourceId===i);return g.useEffect(()=>{if(!i)return;const h=v=>{v.key==="Escape"&&s(null)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[i]),e.role==="user"?l.jsx("div",{className:"flex justify-end",children:l.jsxs("div",{className:"max-w-[85%] rounded-md rounded-br-sm bg-[var(--primary)]/10 p-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35",children:[d.length>0&&l.jsx("div",{className:`grid gap-1.5 ${d.length===1?"grid-cols-1":"grid-cols-2"}`,children:d.map(h=>{const v=xe.sessionResourceContentUrl(r,t,h),p=o.has(h.resourceId);return l.jsx("button",{type:"button",className:"group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36",onClick:()=>{p||s(h.resourceId)},"aria-label":`Open ${h.filename??"attached image"}`,children:p?l.jsxs("span",{className:"flex size-full items-center justify-center gap-2 px-3 text-xs",children:[l.jsx(jO,{className:"size-4"}),"Image unavailable"]}):l.jsx("img",{src:v,alt:h.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>u(x=>new Set(x).add(h.resourceId))})},h.resourceId)})}),e.text&&l.jsx("div",{className:`whitespace-pre-wrap break-words px-1 ${d.length?"pt-2":""}`,children:e.text}),m&&l.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":m.filename??"Image preview",className:"fixed inset-0 z-50 grid min-h-0 min-w-0 place-items-center overflow-hidden bg-black/80 p-4",onClick:()=>s(null),children:[l.jsx("button",{type:"button",className:"absolute right-4 top-4 grid size-9 place-items-center rounded-full bg-black/60 text-white","aria-label":"Close image preview",onClick:()=>s(null),children:l.jsx(Aa,{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:h=>h.stopPropagation()})]})]})}):l.jsx("div",{className:"flex justify-start",children:l.jsxs("div",{className:"min-w-0 max-w-[90%] rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&l.jsx(Mj,{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 HX({item:e}){const t=e.summary.filter(Boolean).join(`
656
-
657
- `).trim(),[r,i]=g.useState(e.streaming??!1);return g.useEffect(()=>{i(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:l.jsxs(zm,{open:r,onOpenChange:i,className:"my-0.5",children:[l.jsxs($m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:Fe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),l.jsx(zR,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:Fe("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),l.jsx(Um,{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(Mj,{children:t}):l.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const WE=12e3;function qE(e){return e.length<=WE?{text:e,truncated:!1}:{text:e.slice(0,WE),truncated:!0}}function FX({item:e}){const[t,r]=g.useState(!1),i=e.stdout?qE(e.stdout):null,s=e.stderr?qE(e.stderr):null,o=!!(i||s);return l.jsxs(zm,{open:t,onOpenChange:r,className:"my-0.5",children:[l.jsxs($m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:Fe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx(Dx,{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(Um,{className:"overflow-hidden pl-7",children:[i&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[l.jsx("code",{children:i.text}),i.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),s&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]",children:[l.jsx("code",{children:s.text}),s.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),!o&&l.jsx("div",{className:"mt-1 text-[11px] text-[var(--muted-foreground)]",children:"(no output)"})]})]})}const VE=80,GE=12e3;function WX(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function qX(e){try{const t=JSON.parse(e);for(const i of["command","cmd","path","file","file_path","query","url","pattern","description"]){const s=t[i];if(typeof s=="string"&&s)return s}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function VX(e){let t=e,r=!1;const i=t.split(`
658
- `);return i.length>VE&&(t=i.slice(0,VE).join(`
659
- `),r=!0),t.length>GE&&(t=t.slice(0,GE),r=!0),{text:t,truncated:r}}function GX({status:e}){return e==="in_progress"?l.jsx(Ve,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?l.jsx(lO,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?l.jsx(nO,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):l.jsx(Pa,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function YX({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){const[s,o]=g.useState(!1),u=qX(e.arguments),d=e.output?VX(e.output):null,m=!!e.arguments&&e.arguments!=="{}",h=e.children??[];return l.jsxs(zm,{open:s,onOpenChange:o,className:"my-0.5",children:[l.jsxs($m,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:Fe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",s&&"rotate-90")}),l.jsx(GX,{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(Um,{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:WX(e.arguments)})}),d&&l.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[l.jsx("code",{children:d.text}),d.truncated&&l.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),e.exitCode!=null&&e.exitCode!==0&&l.jsxs("div",{className:"mt-1 text-[11px] text-[var(--destructive)]",children:["exit code ",e.exitCode]}),h.length>0&&l.jsxs("div",{className:"mt-1 border-l border-[var(--primary)]/30 pl-2",children:[l.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]",children:[l.jsx(QB,{className:"size-3 shrink-0 text-[var(--primary)]"}),l.jsxs("span",{className:"font-mono",children:[h.length," sub-agent step",h.length===1?"":"s"]})]}),h.map(v=>l.jsx(jj,{item:v,sessionId:t,runtimeSelector:r,canResolveInteractions:i},v.id))]})]})]})}function jj({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){switch(e.kind){case"message":return e.isMeta?null:l.jsx(UX,{item:e,sessionId:t,runtimeSelector:r});case"tool":return l.jsx(YX,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i});case"reasoning":return l.jsx(HX,{item:e});case"terminal_command":return l.jsx(FX,{item:e});case"divider":return l.jsx(LX,{item:e});case"error":return l.jsx(OX,{item:e});case"interaction":return l.jsx(TX,{sessionId:t,item:e,canResolve:i})}}function KX(){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 XX(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function ZX({message:e}){const t=g.useRef(Date.now()),[r,i]=g.useState(0);return g.useEffect(()=>{const s=()=>i(Math.floor((Date.now()-t.current)/1e3));s();const o=window.setInterval(s,1e3);return()=>window.clearInterval(o)},[]),l.jsxs("div",{role:"status","aria-live":"polite",className:"flex gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--card))] px-3 py-2.5",children:[l.jsx(Ve,{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 ",XX(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 QX({items:e,historyLoaded:t,running:r,waitingForInteraction:i,queueStatus:s,sessionId:o,runtimeSelector:u}){const d=g.useRef(null),[m,h]=g.useState(!0),v=e[e.length-1],p=(v==null?void 0:v.kind)==="message"&&v.role==="assistant"&&!!v.streaming,x=r&&!p&&!i&&!s;return g.useEffect(()=>{m&&d.current&&(d.current.scrollTop=d.current.scrollHeight)},[e,r,s,m]),l.jsx(bn,{className:"min-w-0 flex-1",viewportRef:d,viewportProps:{onScroll:b=>{const w=b.currentTarget;h(w.scrollHeight-w.scrollTop-w.clientHeight<40)},"aria-busy":!t},children:l.jsx("div",{className:"mx-auto w-full max-w-3xl space-y-3 px-4 py-3",children:!t&&e.length===0&&!s?l.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Ve,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),l.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r&&!s?l.jsx("p",{className:"py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Send a message to start a turn."}):l.jsxs(l.Fragment,{children:[e.map(b=>l.jsx(jj,{item:b,sessionId:o,runtimeSelector:u,canResolveInteractions:!0},b.id)),s&&l.jsx(ZX,{message:s}),x&&l.jsx(KX,{})]})})})}const JX=2500,_u=new Map;function eZ({sessionId:e,runtimeSelector:t,active:r,polling:i=r}){const s=`${t}
660
- ${e}`,o=g.useRef(s);o.current=s;const u=g.useRef(r);u.current=r;const d=g.useRef(0),m=g.useRef(0),h=g.useRef(!1),v=g.useRef(null),p=g.useRef(null),[x,b]=g.useState(()=>_u.get(s)??null),[w,C]=g.useState(()=>!_u.has(s)),[E,S]=g.useState(null),[N,k]=g.useState(null),R=g.useCallback(B=>{p.current=B,k(B)},[]),M=g.useCallback(B=>{v.current=B,_u.set(s,B),b(B)},[s]),L=g.useCallback(async B=>{if(!u.current||h.current)return;const j=s,O=d.current,z=m.current;B&&C(!0);try{const T=await xe.getRuntimeBrowserState(t,e);return!u.current||d.current!==O||m.current!==z||o.current!==j||h.current?void 0:(M(T),B&&R(null),T)}catch(T){if(!u.current||d.current!==O||m.current!==z||o.current!==j)return;B&&R(qh(T));return}finally{u.current&&d.current===O&&m.current===z&&o.current===j&&B&&C(!1)}},[s,t,e,M,R]);g.useEffect(()=>{const B=++d.current,j=_u.has(s);return M(_u.get(s)??null),R(null),C(!j),S(null),h.current=!1,L(!j),()=>{d.current===B&&(d.current+=1)}},[s,r,L,M,R]),g.useEffect(()=>{if(!i)return;const B=window.setInterval(()=>void L(!1),JX);return()=>window.clearInterval(B)},[r,L,i]);const $=g.useCallback(async(B,j)=>{if(!u.current||h.current)return;const O=s,z=d.current;m.current+=1,h.current=!0,S(B),R(null);try{const T=await j();return u.current&&d.current===z&&o.current===O?(M(T),T):void 0}catch(T){u.current&&d.current===z&&o.current===O&&R(qh(T));return}finally{u.current&&d.current===z&&o.current===O&&(h.current=!1,S(null),C(!1))}},[s,M,R]),D=g.useCallback((B,j)=>{const O=v.current;return O?$(B,()=>j(O.browserGeneration)):Promise.resolve(void 0)},[$]),q=g.useCallback(B=>$("Starting browser",()=>xe.openRuntimeBrowser(t,e,B)),[t,e,$]),G=g.useCallback(async()=>{const B=v.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Closing browser"),R(null);try{await xe.closeRuntimeBrowser(t,e,B.browserGeneration),u.current&&d.current===O&&o.current===j&&M(null)}catch(z){u.current&&d.current===O&&o.current===j&&R(qh(z))}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null))}},[s,t,e,M,R]),W=g.useCallback(async()=>{const B=v.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Opening in Desktop"),R(null);try{const z=await mW(B,{close:T=>xe.closeRuntimeBrowser(t,e,T).then(()=>{}),open:T=>xe.openRuntimeBrowser(t,e,T),createPage:(T,U)=>xe.createRuntimeBrowserPage(t,e,T,U),activatePage:(T,U)=>xe.activateRuntimeBrowserPage(t,e,T,U),onProgress:T=>{u.current&&d.current===O&&o.current===j&&(M(T),S("Restoring browser tabs"))}});return u.current&&d.current===O&&o.current===j?(M(z),(z.executionBackend!=="embedded-electron"||!z.capabilities.includes(Dy))&&R("Desktop Browser Host is unavailable; using streamed browser"),z):void 0}catch(z){const T=await xe.getRuntimeBrowserState(t,e).catch(()=>{});u.current&&d.current===O&&o.current===j&&(T!==void 0&&M(T),R(qh(z)));return}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null),C(!1))}},[s,t,e,M,R]);return{browser:x,loading:w,pendingAction:E,error:N,currentError:()=>p.current,disabled:E!==null||(x==null?void 0:x.status)!=="ready",createDisabled:E!==null,load:L,openBrowser:q,closeBrowser:G,recreateForDesktop:W,createPage:()=>D("Creating page",B=>xe.createRuntimeBrowserPage(t,e,B)),closePage:B=>D("Closing page",j=>xe.closeRuntimeBrowserPage(t,e,j,B)),activatePage:B=>D("Switching page",j=>xe.activateRuntimeBrowserPage(t,e,j,B)),navigatePage:(B,j)=>D("Navigating",O=>xe.navigateRuntimeBrowserPage(t,e,O,B,j)),backPage:B=>D("Going back",j=>xe.backRuntimeBrowserPage(t,e,j,B)),forwardPage:B=>D("Going forward",j=>xe.forwardRuntimeBrowserPage(t,e,j,B)),reloadPage:B=>D("Reloading page",j=>xe.reloadRuntimeBrowserPage(t,e,j,B))}}const tZ=2500,xu=new Map;function rZ({sessionId:e,runtimeSelector:t,active:r,polling:i=r,devicesActive:s=!1}){const o=`${t}
661
- ${e}`,[u,d]=g.useState(()=>xu.get(o)??null),[m,h]=g.useState([]),[v,p]=g.useState(()=>!xu.has(o)),[x,b]=g.useState(!1),[w,C]=g.useState(!1),[E,S]=g.useState(null),N=g.useRef(0),k=g.useRef(0),R=g.useRef(!1),M=g.useRef(!1),L=g.useRef(!1),$=g.useRef(null);$.current=u;const D=g.useCallback(z=>{$.current=z,xu.set(o,z),d(z)},[o]),q=g.useCallback(async()=>{if(R.current)return;const z=N.current,T=k.current;M.current||p(!0);try{const U=await xe.getSessionEmulator(t,e);if(N.current!==z||k.current!==T||R.current)return;D(U),S(null)}catch(U){if(N.current!==z||k.current!==T||R.current)return;S(D_(U))}finally{N.current===z&&k.current===T&&!R.current&&(M.current=!0,p(!1))}},[t,e,D]),G=g.useCallback(async()=>{if(R.current)return;const z=N.current,T=k.current;b(!0);try{const U=await xe.listSessionEmulatorDevices(t,e);if(N.current!==z||k.current!==T||R.current)return;h(U),S(null)}catch(U){if(N.current!==z||k.current!==T||R.current)return;S(D_(U))}finally{N.current===z&&k.current===T&&!R.current&&(L.current=!0,b(!1))}},[t,e]);g.useEffect(()=>{N.current+=1;const z=xu.has(o);D(xu.get(o)??null),h([]),S(null),p(!z),b(!1),C(!1),R.current=!1,M.current=z,L.current=!1,q()},[r,q,o,D]),g.useEffect(()=>{if(!i)return;const z=window.setInterval(()=>void q(),tZ);return()=>window.clearInterval(z)},[r,i,q]),g.useEffect(()=>{!s||v||w||u||L.current||G()},[r,u,s,v,w,G]);const W=g.useCallback(async(z,T)=>{const U=N.current,H=++k.current;R.current=!0,C(!0),S(null);try{const F=await z();return N.current!==U||k.current!==H?null:(T==null||T(F),F)}catch(F){throw N.current===U&&k.current===H&&S(D_(F)),F}finally{N.current===U&&k.current===H&&(R.current=!1,C(!1))}},[]),B=g.useCallback(z=>W(()=>xe.attachSessionEmulator(t,e,z),T=>D(T)),[W,t,e]),j=g.useCallback(async()=>{const z=$.current;return z?await W(()=>xe.detachSessionEmulator(t,e,z.bindingId),()=>D(null))!==null:!1},[W,t,e]),O=g.useCallback(async z=>{const T=$.current;if(!T)throw new Error("This Session has no Emulator attached");await W(()=>z(T))},[W]);return{binding:u,devices:m,loading:v,devicesLoading:x,mutating:w,error:E,reload:q,reloadDevices:G,attach:B,detach:j,tap:(z,T)=>O(U=>xe.tapSessionEmulator(t,e,U.bindingId,z,T)),gesture:z=>O(T=>xe.gestureSessionEmulator(t,e,T.bindingId,z)),button:z=>O(T=>xe.buttonSessionEmulator(t,e,T.bindingId,z))}}function D_(e){return e instanceof Error?e:new Error(String(e))}const Dj="rynx.session-resource-dock-width";function iZ({session:e,runtimeSelector:t,leadingControls:r,initialDraft:i,terminalSetup:s}){var yi,ns,ss,Mn,bi,$e;const[o,u]=j4(),d=o.get("view"),m=d==="terminal"?"terminal":"chat",h=jF(o.get("surface")),v=o.get("panel")==="resources",p=d==="browser"||h!==null||v,x=(h==null?void 0:h.type)==="browser"?h.pageId:null,b=g.useRef(null),w=g.useRef(null),C=g.useRef("browser"),E=g.useRef(null),S=g.useRef(0),N=g.useRef(null),[k]=g.useState(nZ),R=g.useRef(k),M=g.useRef(null),L=g.useRef(null),$=g.useRef(null),D=g.useRef(null),q=g.useRef(null),G=g.useRef(null),W=g.useRef(!1),[B,j]=g.useState(!1),[O,z]=g.useState(!1),[T,U]=g.useState(null),[H,F]=g.useState(Su),[V,I]=g.useState(!1),[Y,K]=g.useState(!1),[ee,oe]=g.useState([]),{state:ce,pendingSend:Z,current:le,send:ie,stop:Se}=$F(e.id,{runtimeSelector:t,allowSend:!0}),be=eZ({sessionId:e.id,runtimeSelector:t,active:!0,polling:p}),Ce=rZ({sessionId:e.id,runtimeSelector:t,active:!0,polling:p,devicesActive:(h==null?void 0:h.type)==="emulator"}),Q=g.useMemo(()=>DF(be.browser,x,b.current),[be.browser,x]),re=PF(Z,ce.runStatus==="running"||ce.waitingForInteraction,le,e.status==="running"),ye=e.agent??(e.provider?qu(e.provider):void 0),me=(yi=AF(ce))==null?void 0:yi.model,Ae=g.useMemo(()=>TF(ce.items),[ce.items]),Le=((ns=be.browser)==null?void 0:ns.pages)??[],je=(h==null?void 0:h.type)==="emulator"||B,Ye=be.loading||Ce.loading,at=Le.length>0||je,qe=g.useMemo(()=>[...Le.map(pe=>Fn(pe.pageId)),...je?[Wn()]:[]],[Le,je]),Pt=g.useMemo(()=>Z2(ee,qe),[qe,ee]);g.useEffect(()=>{oe(pe=>{const ke=Z2(pe,qe);return sZ(pe,ke)?pe:ke})},[qe]),g.useEffect(()=>{const pe=N.current;if(!pe)return;const ke=()=>{const yt=pe.getBoundingClientRect().width,Ze=Wh(yt,Number.POSITIVE_INFINITY);F(Ze);const Wt=R.current,si=Wh(yt,Wt??yt*X2);Wt!==null&&pe.style.setProperty("--session-resource-dock-width",`${si}px`),M.current=si,U(si)};ke();const Ue=new ResizeObserver(ke);return Ue.observe(pe),()=>Ue.disconnect()},[]),g.useEffect(()=>()=>{var pe;$.current!==null&&window.cancelAnimationFrame($.current),(pe=q.current)==null||pe.call(q),YE(G)},[]),g.useEffect(()=>{b.current=null,w.current=null,C.current="browser",E.current=null,j(!1),K(!1),oe([]),S.current+=1},[t,e.id]);const Ie=(pe,ke=!0)=>{ke&&(S.current+=1);const Ue=new URLSearchParams(o);pe?(Ue.set("surface",pe),Ue.delete("panel")):(Ue.delete("surface"),Ue.set("panel","resources")),Ue.get("view")==="browser"&&Ue.set("view","chat"),u(Ue,{replace:!0})},Mt=()=>{S.current+=1,K(!1);const pe=new URLSearchParams(o);pe.delete("surface"),pe.delete("panel"),pe.get("view")==="browser"&&pe.set("view","chat"),u(pe,{replace:!0})},pt=()=>{if(C.current==="emulator"&&B){Ie(Wn(E.current));return}if(b.current){Ie(Fn(b.current));return}if(B){Ie(Wn(E.current));return}Ie(null)};g.useEffect(()=>{h&&(C.current=h.type,h.type==="emulator"&&j(!0))},[h==null?void 0:h.type]),g.useEffect(()=>{var ke;const pe=((ke=Ce.binding)==null?void 0:ke.bindingId)??null;pe&&(E.current&&pe!==E.current?j(!0):E.current||j(!0),E.current=pe)},[(ss=Ce.binding)==null?void 0:ss.bindingId]),g.useEffect(()=>{if(d!=="browser")return;const pe=new URLSearchParams(o);pe.set("view","chat"),pe.set("surface",Fn(Q)),pe.delete("panel"),u(pe,{replace:!0})},[d,o,Q,u]),g.useEffect(()=>{if((h==null?void 0:h.type)!=="browser")return;Q&&(b.current=Q);const pe=Fn(Q);if(o.get("surface")===pe)return;const ke=new URLSearchParams(o);ke.set("surface",pe),u(ke,{replace:!0})},[h==null?void 0:h.type,o,Q,u]),g.useEffect(()=>{const pe=Le.map(Ue=>Ue.pageId),ke=LF(w.current,be.browser);w.current=pe,!(!ke||(h==null?void 0:h.type)!=="browser")&&(b.current=ke,Ie(Fn(ke),!1))},[Le,be.browser,h==null?void 0:h.type]),g.useEffect(()=>{var Ue;if((h==null?void 0:h.type)!=="emulator")return;const pe=Wn((Ue=Ce.binding)==null?void 0:Ue.bindingId);if(o.get("surface")===pe)return;const ke=new URLSearchParams(o);ke.set("surface",pe),u(ke,{replace:!0})},[(Mn=Ce.binding)==null?void 0:Mn.bindingId,h==null?void 0:h.type,o,u]),g.useEffect(()=>{var pe,ke;if(!(!p||Ye)){if(!at){h&&Ie(null,!1);return}(h==null?void 0:h.type)==="browser"&&Q||(h==null?void 0:h.type)==="emulator"&&je||(C.current==="emulator"&&je?Ie(Wn((pe=Ce.binding)==null?void 0:pe.bindingId),!1):Q?Ie(Fn(Q),!1):je&&Ie(Wn((ke=Ce.binding)==null?void 0:ke.bindingId),!1))}},[(bi=Ce.binding)==null?void 0:bi.bindingId,je,at,h==null?void 0:h.type,p,Ye,Q]);const Jt=async()=>{var ke,Ue;if(W.current)return;W.current=!0,z(!0);const pe=S.current;try{const yt=((ke=be.browser)==null?void 0:ke.status)==="ready"?await be.createPage():await be.openBrowser(),Ze=(yt==null?void 0:yt.activePageId)??((Ue=yt==null?void 0:yt.pages.at(-1))==null?void 0:Ue.pageId);if(!yt){_e.error(`Could not create Browser tab: ${be.currentError()??"Browser is unavailable"}`);return}Ze&&S.current===pe&&Ie(Fn(Ze),!1)}finally{W.current=!1,z(!1)}},xt=pe=>{const ke=N.current;if(!ke)return null;const Ue=Wh(ke.getBoundingClientRect().width,pe);return ke.style.setProperty("--session-resource-dock-width",`${Ue}px`),M.current=Ue,Ue},Tt=pe=>{const ke=N.current;return ke?xt(ke.getBoundingClientRect().right-pe):null},Ft=pe=>{if(pe!==null){R.current=pe,U(pe);try{window.localStorage.setItem(Dj,String(Math.round(pe)))}catch{}}},ni=pe=>{D.current=pe,$.current===null&&($.current=window.requestAnimationFrame(()=>{$.current=null;const ke=D.current;D.current=null,ke!==null&&Tt(ke)}))},xi=(pe,ke,Ue)=>{var Ze;if(L.current!==ke)return;$.current!==null&&(window.cancelAnimationFrame($.current),$.current=null),D.current=null;const yt=Ue===void 0?M.current:Tt(Ue);Ft(yt),L.current=null,(Ze=q.current)==null||Ze.call(q),q.current=null,pe.hasPointerCapture(ke)&&pe.releasePointerCapture(ke),YE(G),I(!1)},Fr=pe=>{var si;if(pe.button!==0)return;pe.preventDefault(),(si=q.current)==null||si.call(q),L.current=pe.pointerId;const ke=pe.currentTarget;ke.setPointerCapture(pe.pointerId);const Ue=qt=>{L.current===qt.pointerId&&ni(qt.clientX)},yt=qt=>{xi(ke,qt.pointerId,qt.clientX)},Ze=qt=>{xi(ke,qt.pointerId)};window.addEventListener("pointermove",Ue,!0),window.addEventListener("pointerup",yt,!0),window.addEventListener("pointercancel",Ze,!0),q.current=()=>{window.removeEventListener("pointermove",Ue,!0),window.removeEventListener("pointerup",yt,!0),window.removeEventListener("pointercancel",Ze,!0)};const Wt=document.documentElement.style;G.current={cursor:Wt.cursor,userSelect:Wt.userSelect},Wt.cursor="col-resize",Wt.userSelect="none",I(!0),Tt(pe.clientX)},er=pe=>{const ke=N.current;if(!ke)return;const Ue=M.current??Wh(ke.getBoundingClientRect().width,ke.getBoundingClientRect().width*X2),yt=pe.shiftKey?32:16;let Ze=null;pe.key==="ArrowLeft"&&(Ze=Ue+yt),pe.key==="ArrowRight"&&(Ze=Ue-yt),pe.key==="Home"&&(Ze=0),pe.key==="End"&&(Ze=Number.POSITIVE_INFINITY),Ze!==null&&(pe.preventDefault(),Ft(xt(Ze)))},Rt=pe=>{S.current+=1;const ke=new URLSearchParams(o);ke.set("view",pe),u(ke,{replace:!0})},xr=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":m==="chat"?"Open terminal":"Open chat",title:m==="chat"?"Open terminal":"Open chat",onClick:()=>Rt(m==="chat"?"terminal":"chat"),children:m==="chat"?l.jsx(VB,{}):l.jsx(GO,{})}),qa=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":p?"Hide Session resources":"Show Session resources",title:p?"Hide Session resources":"Show Session resources",onClick:p?Mt:pt,children:p?l.jsx(lB,{}):l.jsx(uB,{})}),Hs=l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"hidden size-8 shrink-0 lg:inline-flex","aria-label":Y?"Restore split view":"Expand resource pane","aria-pressed":Y,title:Y?"Restore split view":"Expand resource pane",onClick:()=>K(pe=>!pe),children:Y?l.jsx(PB,{}):l.jsx(yO,{})});return l.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:l.jsxs("div",{ref:N,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[l.jsxs("section",{"aria-hidden":Y,className:Fe("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??ye??"session"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[xr,!p&&qa]})]}),l.jsxs(ZT,{value:m,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[l.jsxs(Vu,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[l.jsx(AX,{todos:ce.todos}),l.jsx(QX,{items:Ae,historyLoaded:ce.historyLoaded,running:re,waitingForInteraction:ce.waitingForInteraction,queueStatus:ce.statusKind==="queue"?ce.note:void 0,sessionId:e.id,runtimeSelector:t}),l.jsx(qW,{initialDraft:i,model:me,running:re,sessionId:e.id,runtimeSelector:t,onSend:ie,onStop:Se})]}),l.jsx(Vu,{value:"terminal",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:l.jsx(vX,{sessionId:e.id,runtimeSelector:t,active:m==="terminal",setup:s})})]})]}),p&&l.jsxs(l.Fragment,{children:[!Y&&l.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(Su,H),"aria-valuemax":H,"aria-valuenow":Math.round(T??Su),"aria-valuetext":`${Math.round(T??Su)} 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:Fr,onKeyDown:er,children:l.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${V?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),l.jsxs("aside",{className:Fe("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:[at&&l.jsx(GW,{pages:Le,order:Pt,selectedPageId:(h==null?void 0:h.type)==="browser"?Q:null,selectionDisabled:be.pendingAction!==null,mutationDisabled:be.disabled,createDisabled:be.createDisabled||O,createPending:O,emulatorAttached:!!Ce.binding,emulator:je?{selected:(h==null?void 0:h.type)==="emulator",label:(($e=Ce.binding)==null?void 0:$e.deviceName)??"Emulator",busy:Ce.loading||Ce.mutating}:null,onSelectPage:pe=>{var ke;b.current=pe,Ie(Fn(pe)),((ke=be.browser)==null?void 0:ke.status)==="ready"&&be.activatePage(pe)},onClosePage:pe=>{S.current+=1,b.current===pe&&(b.current=null),be.closePage(pe)},onCreatePage:()=>void Jt(),onSelectEmulator:()=>{var pe;j(!0),Ie(Wn((pe=Ce.binding)==null?void 0:pe.bindingId))},onCloseEmulator:()=>{j(!1),C.current="browser",Ie(Q?Fn(Q):null)},onAddEmulator:()=>{var pe;j(!0),Ie(Wn((pe=Ce.binding)==null?void 0:pe.bindingId))},headerLeadingAction:Y?r:void 0,leadingAction:Hs,trailingAction:qa}),!at&&l.jsxs(l.Fragment,{children:[Y&&r&&l.jsx("div",{className:"absolute left-3 top-1.5 z-10 flex h-8 items-center",children:r}),l.jsxs("div",{className:"absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4",children:[Hs,qa]})]}),at?(h==null?void 0:h.type)==="emulator"?l.jsx(JW,{sessionId:e.id,runtimeSelector:t,controller:Ce}):(h==null?void 0:h.type)==="browser"?l.jsx(jW,{sessionId:e.id,runtimeSelector:t,pageId:Q,browserResource:be}):l.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[l.jsx(Ve,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),l.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):l.jsx(aZ,{browserBusy:be.createDisabled||O,emulatorBusy:Ce.mutating,onOpenBrowser:()=>void Jt(),onOpenEmulator:()=>{var pe;j(!0),Ie(Wn((pe=Ce.binding)==null?void 0:pe.bindingId))}})]})]})]})})}function nZ(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(Dj));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function YE(e){const t=e.current;!t||typeof document>"u"||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function sZ(e,t){return e.length===t.length&&e.every((r,i)=>r===t[i])}function aZ({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(Ve,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Pu,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Browser"})]}),l.jsxs("button",{type:"button",disabled:t,onClick:i,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[t?l.jsx(Ve,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Yl,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Emulator"})]})]})})}const oZ=400,lZ=160;function cZ({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:i,loading:s,selectedId:o,onCollapsedChange:u,onSelect:d,onNew:m,onRetry:h,onDeleted:v}){const[p,x]=g.useState(""),b=p.trim().toLocaleLowerCase(),w=g.useMemo(()=>b?e.filter(E=>[E.title,E.id,E.provider,E.provider?qu(E.provider):void 0,E.agent,E.source].some(S=>S==null?void 0:S.toLocaleLowerCase().includes(b))):e,[b,e]);async function C(E){try{await xe.closeSession(E,t)}catch(S){_e.error(`Delete session failed: ${S instanceof Error?S.message:String(S)}`);return}v(E)}return l.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[l.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[l.jsxs(Ca,{to:xo(t),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[l.jsx("img",{src:zf,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),l.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]}),l.jsx(he,{variant:"ghost",size:"icon-sm",className:"app-no-drag ml-auto hidden md:inline-flex",onClick:()=>u(!0),title:"Collapse session list","aria-label":"Collapse session list","aria-expanded":"true",children:l.jsx(sB,{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(EB,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(Et,{value:p,onChange:E=>x(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),l.jsx(he,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:l.jsx(en,{})})]})]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[l.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:i}),l.jsx(he,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:h,children:"Retry"})]}),l.jsx(bn,{className:"min-h-0 flex-1",children:s&&e.length===0?l.jsx(dZ,{}):e.length===0?l.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),l.jsxs(he,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[l.jsx(en,{})," New session"]})]}):w.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",p.trim(),"”."]}):l.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:w.map(E=>l.jsx(uZ,{session:E,runtimeLabel:r,selected:o===E.id,onSelect:()=>d(E.id),onDelete:()=>C(E.id)},E.id))})})]})}function uZ({session:e,runtimeLabel:t,selected:r,onSelect:i,onDelete:s}){const[o,u]=g.useState(!1),[d,m]=g.useState(!1),[h,v]=g.useState(!1),p=g.useRef(null),x=g.useRef(null),b=hZ(e.updatedAt??e.createdAt),w=e.agent??(e.provider?qu(e.provider):void 0)??e.source,C=e.title??w??"Untitled session";g.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current),x.current!==null&&window.clearTimeout(x.current)},[]);const E=()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},S=()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null)},N=()=>{E(),S(),!h&&m(!0)},k=()=>{S(),!(h||d||p.current!==null)&&(p.current=window.setTimeout(()=>{p.current=null,m(!0)},oZ))},R=()=>{E(),S(),m(!1)},M=()=>{E(),S(),d&&(x.current=window.setTimeout(()=>{x.current=null,m(!1)},lZ))};return l.jsxs("li",{className:Fe("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:k,onMouseLeave:M,children:[l.jsxs(K_,{modal:!1,open:d,onOpenChange:L=>{L?N():R()},children:[l.jsx(Of,{asChild:!0,children:l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),l.jsxs(Bf,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${C}`,onMouseEnter:N,onMouseLeave:M,onOpenAutoFocus:L=>L.preventDefault(),onCloseAutoFocus:L=>L.preventDefault(),children:[l.jsxs("div",{className:"mb-2.5 flex min-w-0 items-center justify-between gap-3",children:[l.jsx("p",{className:"min-w-0 truncate text-xs font-medium",children:C}),l.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:b})]}),l.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${w}`,children:[l.jsx(Rx,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 truncate",children:w})]}),l.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[l.jsx(kx,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 truncate",children:e.source})]}),l.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":`Session: ${e.id}`,children:[l.jsx(EO,{"aria-hidden":"true",className:"mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"min-w-0 select-text break-all",children:e.id})]})]})]})]}),l.jsx("button",{type:"button",className:"min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-current":r?"page":void 0,onClick:i,onFocus:N,onBlur:M,children:l.jsx("span",{className:"block truncate text-sm font-medium",children:C})}),l.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:R,onMouseLeave:k,children:[e.status==="running"&&l.jsx("span",{role:"status","aria-label":"Running",title:"Running",className:"pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0",children:l.jsx(Ve,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),l.jsxs(K_,{open:h,onOpenChange:L=>{v(L),L&&R()},children:[l.jsx(Of,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"icon",className:"absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",title:`Session actions for ${C}`,"aria-label":`Session actions for ${C}`,children:l.jsx(gO,{})})}),l.jsx(Bf,{align:"end",children:l.jsxs(Pf,{variant:"destructive",onSelect:()=>u(!0),children:[l.jsx(Ia,{}),"Delete session"]})})]}),l.jsx(kn,{open:o,onOpenChange:u,children:l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsx(rn,{children:"Delete this session?"}),l.jsxs(nn,{children:["“",C,"” will be deleted from ",t,". This cannot be undone."]})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:()=>void s(),children:"Delete"})]})]})})]})]})}function dZ(){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 hZ(e){const t=Date.parse(e);if(!Number.isFinite(t))return"unknown";const r=Math.max(0,Math.round((Date.now()-t)/1e3));return r<60?"now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}function fZ({runtimeLabel:e,options:t,selection:r,loading:i,submitting:s,error:o,listCollapsed:u,onShowSessions:d,onRetryOptions:m,onSelectionChange:h,onSubmit:v}){const[p,x]=g.useState(""),b=g.useRef(null),w=g.useRef(!1),C=g.useRef(void 0),E=nM({policy:R0,onChange:()=>{C.current=void 0}}),S=v0(r,t),N=!!((p.trim()||E.images.length>0)&&r&&!i&&!s&&!E.hasPending&&!E.hasFailed);async function k(){const R=p.trim();if(!R&&E.images.length===0||!r||i||s||E.hasPending||E.hasFailed)return;const M=E.images.length>0?C.current??Gu("msg"):void 0;M&&(C.current=M),await v({text:R,images:E.readyUploads,...M?{clientMessageId:M}:{}})&&(E.clear(),x(""),C.current=void 0)}return l.jsxs("main",{className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]",children:[u&&l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex",onClick:d,title:"Show session list","aria-label":"Show session list",children:l.jsx(OR,{className:"size-3.5"})}),l.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),l.jsx(bn,{className:"h-full",viewportClassName:"[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col",children:l.jsxs("div",{className:"mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12",children:[l.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:l.jsxs(he,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:d,children:[l.jsx(Gl,{})," 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:b,onSubmit:R=>{R.preventDefault(),k()},children:[l.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]","aria-busy":s,children:[l.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),l.jsx(sM,{images:E.images,disabled:s,onRemove:E.remove,className:"px-5 pt-4"}),l.jsx(wm,{id:"session-initial-prompt",value:p,disabled:s,rows:7,className:"min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base",placeholder:"Fix a bug, build a feature, or investigate the codebase…",onChange:R=>{C.current=void 0,x(R.target.value)},onPaste:E.onPaste,onCompositionStart:()=>{w.current=!0},onCompositionEnd:()=>{w.current=!1},onKeyDown:R=>{var M;R.key!=="Enter"||R.shiftKey||w.current||R.nativeEvent.isComposing||R.keyCode===229||(R.preventDefault(),(M=b.current)==null||M.requestSubmit())}}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4",children:[l.jsx(aM,{policy:R0,imageCount:E.images.length,disabled:s,onFiles:E.addFiles}),l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-xs text-[var(--muted-foreground)]",children:[l.jsx(ed,{className:"size-3.5 shrink-0","aria-hidden":"true"}),l.jsx("span",{className:"truncate",children:e})]}),l.jsx("label",{htmlFor:"session-launch-target",className:"sr-only",children:"Run with"}),l.jsxs(Nm,{value:r?YT(r):void 0,disabled:i||s,onValueChange:R=>{const M=KT(R);M&&h(M)},children:[l.jsx(dd,{id:"session-launch-target",className:"h-11 w-[min(100%,17rem)] bg-[var(--background)] md:h-9 md:w-56","aria-label":"Run with",children:l.jsx(ud,{placeholder:i?"Loading…":"Choose how to run",children:S&&l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"truncate",children:S.name}),l.jsx(L_,{status:t_(S)})]})})}),l.jsxs(hd,{align:"end",children:[t.providers.length>0&&l.jsxs(a0,{children:[l.jsx(o0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers"}),t.providers.map(R=>l.jsx(Zn,{value:`provider:${R.id}`,textValue:R.name,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(L_,{status:t_(R)}),l.jsx("span",{children:R.name})]})},`provider:${R.id}`))]}),t.agents.length>0&&l.jsxs(a0,{children:[l.jsx(o0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),t.agents.map(R=>l.jsx(Zn,{value:`agent:${R.id}`,textValue:R.name??R.id,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(L_,{status:t_(R)}),l.jsx("span",{children:R.name??R.id})]})},`agent:${R.id}`))]})]})]}),l.jsx(he,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!N,"aria-label":s?"Starting session":"Start session",children:s?l.jsx(Ve,{className:"animate-spin"}):l.jsx(IR,{})})]})]}),l.jsxs("div",{className:"mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]",children:[l.jsxs("span",{className:"flex items-center gap-2",role:o?"alert":"status","aria-live":o?"assertive":"polite",children:[l.jsx("span",{children:o??(S&&!S.ready?`${S.reason??`${S.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:"A session is created only when you start.")}),o&&t.providers.length===0&&t.agents.length===0&&!i&&l.jsx(he,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:m,children:"Retry"})]}),l.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function L_({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 O_(){const e=Ba(),{sessionId:t}=xR(),{runtimeSelector:r,selectedRuntime:i}=sc(),{status:s,operation:o}=My(),u=dF(s,o),[d,m]=g.useState([]),[h,v]=g.useState({providers:[],agents:[]}),[p,x]=g.useState(null),[b,w]=g.useState(!0),[C,E]=g.useState(),[S,N]=g.useState(),[k,R]=g.useState(!0),[M,L]=g.useState(!1),[$,D]=g.useState(!1),[q,G]=g.useState(!1),[W,B]=g.useState(),j=g.useRef(!1),O=g.useRef(0),z=g.useRef(0),T=g.useRef(0),U=g.useRef(),H=g.useRef(r),F=g.useRef(r),V=g.useRef(u);V.current=u;const I=g.useRef({selector:r});I.current.selector!==r&&(I.current={selector:r});const Y=I.current,K=t??null,ee=g.useRef(K);g.useEffect(()=>()=>{T.current+=1},[]),g.useEffect(()=>{ee.current!==K&&(ee.current=K,T.current+=1)},[K]);const oe=g.useCallback(async(Q=!1)=>{if(V.current)return;const re=++O.current;Q&&R(!0);try{const ye=await xe.listSessions(r);if(O.current!==re)return;H.current=r,m(ye),N(void 0)}catch(ye){if(O.current!==re||V.current)return;N(`Could not load sessions: ${ye.message}`)}finally{O.current===re&&R(!1)}},[r]);g.useEffect(()=>{F.current!==r&&(F.current=r,U.current=void 0,O.current+=1,m([]),N(void 0),R(!0))},[r]),g.useEffect(()=>{if(u){O.current+=1,N(void 0),R(!1);return}oe(!0);const Q=setInterval(()=>void oe(),4e3);return()=>clearInterval(Q)},[oe,u]);const ce=g.useCallback(async()=>{if(V.current)return;const Q=++z.current;w(!0),E(void 0);try{let re;try{re=await xe.listSessionLaunchOptions(r)}catch(me){if(!(me instanceof yo)||me.code!=="incompatible"&&me.code!=="method_not_found")throw me;re=xF(await xe.listSessionAgentOptions(r))}if(z.current!==Q)return;const ye=pF(r,typeof window>"u"?void 0:window.localStorage);v(re),x(mF(re,ye))}catch(re){if(z.current!==Q||V.current)return;v({providers:[],agents:[]}),x(null),E(`Could not load launch options: ${re.message}`)}finally{z.current===Q&&w(!1)}},[r]);g.useEffect(()=>{if(u){z.current+=1,E(void 0),w(!1);return}return v({providers:[],agents:[]}),x(null),w(!0),E(void 0),D(!1),B(void 0),ce(),()=>{z.current+=1}},[ce,u]);const Z=g.useCallback(async Q=>{var Pt;if(j.current)return!1;const re=Q.text,ye=p;if(!ye)return E("Choose a provider or Agent before starting."),!1;const me=v0(ye,h);if(!me)return E("Choose a provider or Agent before starting."),!1;const Ae=!me.ready&&me.readiness!=="unverified";if(Ae&&Q.images.length>0)return E(`${me.name} must finish login or first-run setup before starting with images.`),!1;const Le=I.current,je=i.displayName,Ye=++T.current,at=_F(re||((Pt=Q.images[0])==null?void 0:Pt.file.name)||"Image");let qe;j.current=!0,G(!0),E(void 0);try{const Ie=U.current,pt=Ie&&Ie.selector===Le.selector&&Ie.selection.kind===ye.kind&&Ie.selection.id===ye.id?Ie.sessionId:(await xe.createSession(vF(ye,at),Le.selector)).sessionId;qe=pt,U.current={selector:Le.selector,selection:ye,sessionId:pt};let Jt,xt=!1,Tt=!1;if(Ae)try{await xe.enqueueSessionMessage(Le.selector,pt,re),xt=!0}catch(Fr){Jt=Fr}else try{if(Q.images.length===0)Tt=!0,await xe.sendSessionMessage(pt,re,()=>{},void 0,Le.selector);else{if(!(await xe.getSessionResourcePolicy(Le.selector,pt)).enabled)throw new yo("Session image resources are unavailable on this Runtime",409,"failed_precondition","not_started");const er=await Promise.all(Q.images.map(Rt=>xe.uploadSessionResource(Le.selector,pt,Rt.file,Rt.clientUploadId)));Tt=!0,await xe.sendSessionMessage(pt,{content:[...er.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}:{}})),...re?[{type:"input_text",text:re}]:[]],clientMessageId:Q.clientMessageId},()=>{},void 0,Le.selector)}}catch(Fr){Jt=Fr}const Ft=!!(!xt&&(Q.images.length>0&&!Tt&&Jt||Ty(Jt)));if(I.current!==Le)return U.current=void 0,Jt?Ft?_e.error(`Session created on ${je}, but the first message was not sent: ${Jt.message}`):_e.warning(`Session created on ${je}, but message delivery is unknown. Check its history before retrying.`):_e.success(`Session started on ${je}; switch back to view it.`),!0;if(T.current!==Ye)return U.current=void 0,Jt?Ft?_e.error(`Session created on ${je}, but the first message was not sent. Open it to retry.`):_e.warning(`Session created on ${je}, but message delivery is unknown. Check its history before retrying.`):_e.success(`Session started on ${je} in the background.`),!0;if(Q.images.length>0&&Ft)return E(`Session created, but the first image message was not sent: ${Jt.message}. Retry will reuse this Session.`),oe(),!1;const ni=new Date().toISOString(),xi={id:pt,...ye.kind==="provider"?{provider:ye.id}:{agent:ye.id},title:at,status:Ft?"idle":"running",createdAt:ni,updatedAt:ni,source:"console",...xt?{setupStatus:"waiting_for_provider"}:{}};return H.current=Le.selector,m(Fr=>[xi,...Fr.filter(er=>er.id!==pt)]),B(Ft?{sessionId:pt,message:re}:void 0),D(!1),U.current=void 0,e(xt?`${uf(Le.selector,pt)}?view=terminal`:uf(Le.selector,pt)),oe(),xt?_e.info(`${me.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):Jt&&(Ft?_e.error(`Session created, but the first message was not sent: ${Jt.message}`):_e.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(Ie){const Mt=Ie instanceof yo&&Ie.outcome==="unknown",pt=qe?`Session created, but its first message was not sent: ${Ie.message}. Retry will reuse this Session.`:Mt?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${Ie.message}`;return I.current===Le&&T.current===Ye?E(pt):Mt?_e.warning(`Session creation on ${je} may have succeeded. Check its Session list before retrying.`):_e.error(`Could not start Session on ${je}: ${Ie.message}`),!qe&&Mt?(U.current=void 0,!0):!1}finally{j.current=!1,G(!1)}},[h,p,e,oe,i.displayName]),le=H.current===r?d:[],ie=le.find(Q=>Q.id===K)??null,Se=ie?v0(ie.provider?{kind:"provider",id:ie.provider}:ie.agent?{kind:"agent",id:ie.agent}:null,h):null,be=(ie==null?void 0:ie.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(Se==null?void 0:Se.name)??(ie.provider?qu(ie.provider):ie.agent)}:ie&&(ie.setupStatus==="waiting_for_provider"||(Se==null?void 0:Se.ready)===!1)?{kind:"required",target:(Se==null?void 0:Se.name)??(ie.provider?qu(ie.provider):ie.agent),taskQueued:ie.setupStatus==="waiting_for_provider",...Se!=null&&Se.reason?{reason:Se.reason}:{}}:void 0;g.useEffect(()=>{(W==null?void 0:W.sessionId)===(ie==null?void 0:ie.id)&&B(void 0)},[W,ie==null?void 0:ie.id]);const Ce=ie?l.jsxs("div",{className:Fe("flex shrink-0 items-center gap-1",M&&"desktop-macos-titlebar-leading-inset"),children:[l.jsx(he,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{D(!0),e(xo(r),{replace:!0})},children:l.jsx(Gl,{})}),M&&l.jsx(he,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>L(!1),children:l.jsx(OR,{className:"size-3.5"})})]}):void 0;return l.jsxs("div",{className:Fe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",M?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!M&&l.jsx("div",{className:Fe("min-h-0 min-w-0 border-r border-[var(--border)]",(!$||ie)&&"hidden md:block"),children:l.jsx(cZ,{sessions:le,runtimeSelector:r,runtimeLabel:i.displayName,listError:S,loading:k,selectedId:K,onCollapsedChange:L,onSelect:Q=>{T.current+=1,U.current=void 0,D(!1),B(void 0),e(uf(r,Q))},onNew:()=>{T.current+=1,U.current=void 0,D(!1),B(void 0),e(xo(r))},onRetry:()=>void oe(!0),onDeleted:Q=>{I.current===Y&&(K===Q&&e(xo(r),{replace:!0}),oe())}},r)}),ie?l.jsx(iZ,{session:ie,runtimeSelector:r,leadingControls:Ce,initialDraft:(W==null?void 0:W.sessionId)===ie.id?W.message:void 0,terminalSetup:be},`${r}:${ie.id}`):K&&k?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(Ve,{className:"size-4 animate-spin"})," Loading session…"]})}):l.jsx("div",{className:Fe("min-h-0 min-w-0",$&&!M&&"hidden md:block"),children:l.jsx(fZ,{runtimeLabel:i.displayName,options:h,selection:p,loading:b,submitting:q,error:C??S??(K?"Session not found. Start a new session or choose another from the list.":void 0),listCollapsed:M,onShowSessions:()=>{T.current+=1,L(!1),D(!0)},onRetryOptions:()=>{ce()},onSelectionChange:Q=>{U.current=void 0,x(Q),E(void 0),gF(r,typeof window>"u"?void 0:window.localStorage,Q)},onSubmit:Z},r)})]})}function mZ({name:e,onClose:t}){const[r,i]=g.useState(null),[s,o]=g.useState("meta"),[u,d]=g.useState(null),[m,h]=g.useState(""),[v,p]=g.useState(!1),[x,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),h("");return}o("meta");let C=!1;return xe.getSkill(e).then(E=>{var S;C||(i(E),b(new Set(pZ(E.files))),d(((S=E.files.find(N=>N.path==="SKILL.md")??E.files[0])==null?void 0:S.path)??null))}).catch(E=>_e.error(`Load skill failed: ${E.message}`)),()=>{C=!0}},[e]),g.useEffect(()=>{if(!e||!u){h("");return}let C=!1;return p(!0),xe.readSkillFile(e,u).then(E=>!C&&h(E.content)).catch(E=>!C&&h(`⚠ ${E.message}`)).finally(()=>!C&&p(!1)),()=>{C=!0}},[e,u]),l.jsx(Oo,{open:e!=null,onOpenChange:C=>!C&&t(),children:l.jsxs(Ua,{className:"flex max-h-[85vh] max-w-3xl flex-col overflow-hidden",children:[l.jsx(Bo,{children:l.jsx(Ha,{className:"font-mono",children:e})}),l.jsxs(ZT,{value:s,onValueChange:o,className:"flex min-h-0 flex-1 flex-col gap-3",children:[l.jsxs(QT,{className:"self-start",children:[l.jsx(_0,{value:"meta",children:"Meta"}),l.jsxs(_0,{value:"files",children:["Files",r?` (${r.files.length})`:""]})]}),l.jsx(Vu,{value:"meta",className:"mt-0 min-h-0 flex-1",children:l.jsx(bn,{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=iM((E=r.ref)==null?void 0:E.install);return l.jsxs(l.Fragment,{children:[l.jsx(yu,{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(yu,{label:"Version",children:l.jsx("span",{className:"font-mono text-xs",children:C.version})}),((S=r.ref)==null?void 0:S.contentHash)&&l.jsx(yu,{label:"Content",children:l.jsx("span",{className:"break-all font-mono text-xs",children:r.ref.contentHash})})]})})(),l.jsx(yu,{label:"Files",children:r.files.length}),l.jsx(yu,{label:"Size",children:Lj(r.totalSize)})]})]})})}),l.jsx(Vu,{value:"files",className:"mt-0 flex min-h-0 flex-1 flex-col",children:l.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[14rem_1fr] gap-3",children:[l.jsx(bn,{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(Bj,{nodes:gZ(r.files),depth:0,active:u,onSelect:d,collapsed:x,onToggle:w})})}),l.jsx("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:v?"Loading…":m})]})})]})]})})}function yu({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 Lj(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:"—"}function pZ(e){const t=new Set;for(const r of e){const i=r.path.split("/");for(let s=0;s<i.length-1;s++)t.add(i.slice(0,s+1).join("/"))}return[...t]}function gZ(e){const t={children:[]};for(const r of e){const i=r.path.split("/");let s=t;i.forEach((o,u)=>{const d=u===i.length-1;let m=s.children.find(h=>h.name===o);m||(m={name:o,path:i.slice(0,u+1).join("/"),isDir:!d,children:[]},d&&(m.size=r.size),s.children.push(m)),s=m})}return Oj(t),t.children}function Oj(e){e.children.sort((t,r)=>t.isDir===r.isDir?t.name.localeCompare(r.name):t.isDir?-1:1),e.children.forEach(Oj)}function Bj({nodes:e,depth:t,active:r,onSelect:i,collapsed:s,onToggle:o}){const u=d=>({paddingLeft:d*14+8});return l.jsx(l.Fragment,{children:e.map(d=>d.isDir?l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>o(d.path),style:u(t),className:"flex w-full items-center gap-1.5 rounded-sm py-1 pr-2 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:Fe("size-3 shrink-0 transition-transform",!s.has(d.path)&&"rotate-90")}),l.jsx(kO,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:"truncate font-mono",children:d.name})]}),!s.has(d.path)&&l.jsx(Bj,{nodes:d.children,depth:t+1,active:r,onSelect:i,collapsed:s,onToggle:o})]},d.path):l.jsxs("button",{type:"button",onClick:()=>i(d.path),style:u(t),className:Fe("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(SO,{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:Lj(d.size??0)})]},d.path))})}function vZ(){const[e,t]=g.useState(null),[r,i]=g.useState(null);async function s(){try{t(await xe.listSkills())}catch(o){t([]),_e.error(`Failed to load skills: ${o.message}`)}}return g.useEffect(()=>{s()},[]),l.jsxs(Yr,{children:[l.jsxs(_i,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Jr,{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(IT,{onInstalled:t})})]}),l.jsx(ei,{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=iM((d=o.ref)==null?void 0:d.install);return u.source?l.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:[u.source,u.version?`@${u.version}`:""]}):null})()]})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>i(o.name),children:"View"}),l.jsx(_Z,{name:o.name,onDeleted:s})]})})]},o.name))]})]})}),l.jsx(mZ,{name:r,onClose:()=>i(null)})]})}function _Z({name:e,onDeleted:t}){return l.jsxs(kn,{children:[l.jsx(ts,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Ia,{})})}),l.jsxs(tn,{children:[l.jsxs(Nn,{children:[l.jsxs(rn,{children:['Remove skill "',e,'"?']}),l.jsx(nn,{children:"Deletes it from the global catalog. Agents that reference it will no longer resolve it."})]}),l.jsxs(An,{children:[l.jsx(sn,{children:"Cancel"}),l.jsx(Tn,{variant:"destructive",onClick:async()=>{try{await xe.deleteSkill(e),_e.success(`Skill "${e}" removed`),await t()}catch(r){_e.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function xZ(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function yZ(){const e=ac();return e?l.jsxs(l.Fragment,{children:[l.jsx(Z9,{bridge:e,children:l.jsx(KE,{desktopIntegrationAvailable:!0})}),l.jsx(rU,{bridge:e})]}):l.jsx(KE,{desktopIntegrationAvailable:!1})}function KE({desktopIntegrationAvailable:e}){const{theme:t,toggle:r}=Ly(),i=Hr(),s=O9(i.pathname,e),o=g.useRef(null),[u,d]=g.useState([]),[m,h]=g.useState([]),[v,p]=g.useState([]),[x,b]=g.useState([]),[w,C]=g.useState(!1),E=g.useCallback(async()=>{try{d(await xe.listAgents())}catch(R){_e.error(`Failed to load agents: ${R.message}`)}},[]),S=g.useCallback(async()=>{const R=await Promise.allSettled([xe.channelTypes(),xe.listChannels(),xe.listInstances(),xe.listAgents()]);R[0].status==="fulfilled"&&h(R[0].value),R[1].status==="fulfilled"&&p(R[1].value),R[2].status==="fulfilled"&&b(R[2].value),R[3].status==="fulfilled"&&d(R[3].value)},[]);g.useEffect(()=>{s&&s!=="emulator"&&S()},[S,s]),g.useEffect(()=>{let R=!0;const M=async()=>{try{const $=await xe.meta();R&&C(xZ($))}catch{}};M();const L=window.setInterval(()=>void M(),15e3);return()=>{R=!1,window.clearInterval(L)}},[]),g.useEffect(()=>{const R=window.requestAnimationFrame(()=>{var M;return(M=o.current)==null?void 0:M.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(R)},[i.pathname]);const N=WL([{path:"/",element:l.jsx(wa,{replace:!0,to:dt.sessions})},{path:Hu,element:l.jsx(wa,{replace:!0,to:d0})},{path:dt.overview,element:l.jsx(GH,{instances:x,channels:v,agents:u,desktopIntegrationAvailable:e})},{path:dt.runtimes,element:l.jsx(nF,{})},{path:dt.providers,element:l.jsx(KH,{})},{path:dt.instances,element:l.jsx(TH,{instances:x,channels:v,agents:u,onChange:S})},{path:dt.channels,element:l.jsx(JU,{channels:v,channelTypes:m,onChange:S})},{path:dt.agents,element:l.jsx(SU,{agents:u,onChange:E})},{path:dt.skills,element:l.jsx(vZ,{})},{path:A9,element:l.jsx(O_,{})},{path:T9,element:l.jsx(O_,{})},{path:dt.sessions,element:l.jsx(O_,{})},{path:`${dt.sessions}/:sessionId`,element:l.jsx(bZ,{})},{path:dt.emulator,element:l.jsx(AH,{})},...e?[{path:dt.localRuntime,element:l.jsx(zH,{})},{path:dt.computerUse,element:l.jsx(lH,{})}]:CT.map(R=>({path:dt[R],element:l.jsx(wa,{replace:!0,to:d0})})),...Object.entries(j9).map(([R,M])=>({path:M,element:l.jsx(wa,{replace:!0,to:dt[R]})})),...Object.entries(D9).map(([R,M])=>({path:R,element:l.jsx(wa,{replace:!0,to:M})})),{path:"*",element:l.jsx(wa,{replace:!0,to:dt.sessions})}]),k=s?l.jsx(nU,{activeView:s,desktopIntegrationAvailable:e,children:N}):N;return l.jsx(X9,{theme:t,onToggleTheme:r,children:l.jsxs("div",{ref:o,id:"main-content",tabIndex:-1,className:"flex h-full min-h-0 flex-col overflow-hidden focus:outline-none",children:[w&&l.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]",children:[l.jsx(Ra,{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:k})]})})}function bZ(){const{sessionId:e}=xR(),t=Hr();if(!e)return l.jsx(wa,{replace:!0,to:dt.sessions});const r=kT(t.search)??"local";return l.jsx(wa,{replace:!0,to:uf(r,e)})}function wZ(e){const{theme:t}=Ly();return l.jsx(k6,{theme:t,...e})}var rR;((rR=window.rynxDesktopIntegration)==null?void 0:rR.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");sL.createRoot(document.getElementById("root")).render(l.jsx(g.StrictMode,{children:l.jsx(N4,{children:l.jsx(V9,{children:l.jsxs(Y9,{children:[l.jsx(yZ,{}),l.jsx(wZ,{richColors:!0,position:"top-right"})]})})})}));export{IX as _,za as a,Ux as c,gx as g,l as j,g as r,zk as t};