@rynx-ai/server 0.1.9 → 0.1.10-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.
- package/dist/browser-surface-ws.d.ts +2 -0
- package/dist/browser-surface-ws.js +1 -0
- package/dist/control-api.d.ts +17 -0
- package/dist/control-api.js +809 -9
- package/dist/control-web/assets/{highlighted-body-OFNGDK62-e-w61YLy.js → highlighted-body-OFNGDK62-DHu2g-rk.js} +1 -1
- package/dist/control-web/assets/index-B6Pb5j9M.js +666 -0
- package/dist/control-web/assets/index-BU-_Qud_.css +32 -0
- package/dist/control-web/assets/{mermaid-GHXKKRXX-DZn7Hbr2.js → mermaid-GHXKKRXX-CSYzOmBR.js} +3 -3
- package/dist/control-web/index.html +2 -2
- package/dist/desktop-browser-host.d.ts +20 -3
- package/dist/desktop-browser-host.js +126 -44
- package/dist/direct-runtime-browser-inspect-server.d.ts +72 -0
- package/dist/direct-runtime-browser-inspect-server.js +749 -0
- package/dist/direct-runtime-server.d.ts +6 -0
- package/dist/direct-runtime-server.js +29 -1
- package/dist/emulator-surface-ws.d.ts +2 -0
- package/dist/emulator-surface-ws.js +1 -0
- package/dist/machine-session-service.d.ts +88 -5
- package/dist/machine-session-service.js +283 -20
- package/dist/remote-runtime-dispatcher.d.ts +1 -1
- package/dist/remote-runtime-dispatcher.js +25 -2
- package/dist/remote-runtime-session-projection.js +10 -0
- package/dist/runtime-web-auth.d.ts +5 -0
- package/dist/runtime-web-auth.js +43 -3
- package/dist/server.d.ts +78 -8
- package/dist/server.js +42 -17
- package/dist/session-browser-service.d.ts +30 -0
- package/dist/session-browser-service.js +89 -3
- package/dist/session-browser-surface-coordinator.d.ts +4 -3
- package/dist/session-browser-surface-coordinator.js +374 -268
- package/dist/session-runtime-index.d.ts +6 -0
- package/dist/session-runtime-index.js +10 -0
- package/dist/session-terminal-host.d.ts +6 -1
- package/dist/session-terminal-host.js +18 -0
- package/dist/terminal-ws.d.ts +3 -0
- package/dist/terminal-ws.js +1 -0
- package/package.json +12 -7
- package/dist/control-web/assets/index-BQ7XVBKO.css +0 -32
- package/dist/control-web/assets/index-ClpzuBJx.js +0 -606
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
var WD=Object.defineProperty;var qD=(e,t,r)=>t in e?WD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Hr=(e,t,r)=>qD(e,typeof t!="symbol"?t+"":t,r);function VD(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 mx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qg={exports:{}},Zc={};/**
|
|
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 IS;function GD(){if(IS)return Zc;IS=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 Zc.Fragment=t,Zc.jsx=r,Zc.jsxs=r,Zc}var zS;function YD(){return zS||(zS=1,Qg.exports=GD()),Qg.exports}var l=YD(),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 $S;function KD(){if($S)return Ge;$S=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"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.iterator;function b(I){return I===null||typeof I!="object"?null:(I=y&&I[y]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function S(I,Y,X){this.props=I,this.context=Y,this.refs=E,this.updater=X||w}S.prototype.isReactComponent={},S.prototype.setState=function(I,Y){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,Y,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=S.prototype;function k(I,Y,X){this.props=I,this.context=Y,this.refs=E,this.updater=X||w}var R=k.prototype=new N;R.constructor=k,C(R,S.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function L(){}var z={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function W(I,Y,X){var ee=X.ref;return{$$typeof:e,type:I,key:Y,ref:ee!==void 0?ee:null,props:X}}function G(I,Y){return W(I.type,Y,I.props)}function q(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function B(I){var Y={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(X){return Y[X]})}var j=/\/+/g;function O(I,Y){return typeof I=="object"&&I!==null&&I.key!=null?B(""+I.key):Y.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(L,L):(I.status="pending",I.then(function(Y){I.status==="pending"&&(I.status="fulfilled",I.value=Y)},function(Y){I.status==="pending"&&(I.status="rejected",I.reason=Y)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function T(I,Y,X,ee,re){var oe=typeof I;(oe==="undefined"||oe==="boolean")&&(I=null);var Z=!1;if(I===null)Z=!0;else switch(oe){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(I.$$typeof){case e:case t:Z=!0;break;case g:return Z=I._init,T(Z(I._payload),Y,X,ee,re)}}if(Z)return re=re(I),Z=ee===""?"."+O(I,0):ee,M(re)?(X="",Z!=null&&(X=Z.replace(j,"$&/")+"/"),T(re,Y,X,"",function(we){return we})):re!=null&&(q(re)&&(re=G(re,X+(re.key==null||I&&I.key===re.key?"":(""+re.key).replace(j,"$&/")+"/")+Z)),Y.push(re)),1;Z=0;var ce=ee===""?".":ee+":";if(M(I))for(var ne=0;ne<I.length;ne++)ee=I[ne],oe=ce+O(ee,ne),Z+=T(ee,Y,X,oe,re);else if(ne=b(I),typeof ne=="function")for(I=ne.call(I),ne=0;!(ee=I.next()).done;)ee=ee.value,oe=ce+O(ee,ne++),Z+=T(ee,Y,X,oe,re);else if(oe==="object"){if(typeof I.then=="function")return T($(I),Y,X,ee,re);throw Y=String(I),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Z}function U(I,Y,X){if(I==null)return I;var ee=[],re=0;return T(I,ee,"","",function(oe){return Y.call(X,oe,re++)}),ee}function H(I){if(I._status===-1){var Y=I._result;Y=Y(),Y.then(function(X){(I._status===0||I._status===-1)&&(I._status=1,I._result=X)},function(X){(I._status===0||I._status===-1)&&(I._status=2,I._result=X)}),I._status===-1&&(I._status=0,I._result=Y)}if(I._status===1)return I._result.default;throw I._result}var F=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},V={map:U,forEach:function(I,Y,X){U(I,function(){Y.apply(this,arguments)},X)},count:function(I){var Y=0;return U(I,function(){Y++}),Y},toArray:function(I){return U(I,function(Y){return Y})||[]},only:function(I){if(!q(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return 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=z,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(I){return z.H.useMemoCache(I)}},Ge.cache=function(I){return function(){return I.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(I,Y,X){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ee=C({},I.props),re=I.key;if(Y!=null)for(oe in Y.key!==void 0&&(re=""+Y.key),Y)!D.call(Y,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&Y.ref===void 0||(ee[oe]=Y[oe]);var oe=arguments.length-2;if(oe===1)ee.children=X;else if(1<oe){for(var Z=Array(oe),ce=0;ce<oe;ce++)Z[ce]=arguments[ce+2];ee.children=Z}return W(I.type,re,ee)},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,X){var ee,re={},oe=null;if(Y!=null)for(ee in Y.key!==void 0&&(oe=""+Y.key),Y)D.call(Y,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(re[ee]=Y[ee]);var Z=arguments.length-2;if(Z===1)re.children=X;else if(1<Z){for(var ce=Array(Z),ne=0;ne<Z;ne++)ce[ne]=arguments[ne+2];re.children=ce}if(I&&I.defaultProps)for(ee in Z=I.defaultProps,Z)re[ee]===void 0&&(re[ee]=Z[ee]);return W(I,oe,re)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(I){return{$$typeof:d,render:I}},Ge.isValidElement=q,Ge.lazy=function(I){return{$$typeof:g,_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=z.T,X={};z.T=X;try{var ee=I(),re=z.S;re!==null&&re(X,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(L,F)}catch(oe){F(oe)}finally{Y!==null&&X.types!==null&&(Y.types=X.types),z.T=Y}},Ge.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ge.use=function(I){return z.H.use(I)},Ge.useActionState=function(I,Y,X){return z.H.useActionState(I,Y,X)},Ge.useCallback=function(I,Y){return z.H.useCallback(I,Y)},Ge.useContext=function(I){return z.H.useContext(I)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(I,Y){return z.H.useDeferredValue(I,Y)},Ge.useEffect=function(I,Y){return z.H.useEffect(I,Y)},Ge.useEffectEvent=function(I){return z.H.useEffectEvent(I)},Ge.useId=function(){return z.H.useId()},Ge.useImperativeHandle=function(I,Y,X){return z.H.useImperativeHandle(I,Y,X)},Ge.useInsertionEffect=function(I,Y){return z.H.useInsertionEffect(I,Y)},Ge.useLayoutEffect=function(I,Y){return z.H.useLayoutEffect(I,Y)},Ge.useMemo=function(I,Y){return z.H.useMemo(I,Y)},Ge.useOptimistic=function(I,Y){return z.H.useOptimistic(I,Y)},Ge.useReducer=function(I,Y,X){return z.H.useReducer(I,Y,X)},Ge.useRef=function(I){return z.H.useRef(I)},Ge.useState=function(I){return z.H.useState(I)},Ge.useSyncExternalStore=function(I,Y,X){return z.H.useSyncExternalStore(I,Y,X)},Ge.useTransition=function(){return z.H.useTransition()},Ge.version="19.2.7",Ge}var US;function px(){return US||(US=1,Jg.exports=KD()),Jg.exports}var v=px();const Ce=mx(v),La=VD({__proto__:null,default:Ce},[v]);var ev={exports:{}},Qc={},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 HS;function XD(){return HS||(HS=1,(function(e){function t(T,U){var H=T.length;T.push(U);e:for(;0<H;){var F=H-1>>>1,V=T[F];if(0<s(V,U))T[F]=U,T[H]=V,H=F;else break e}}function r(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var U=T[0],H=T.pop();if(H!==U){T[0]=H;e:for(var F=0,V=T.length,I=V>>>1;F<I;){var Y=2*(F+1)-1,X=T[Y],ee=Y+1,re=T[ee];if(0>s(X,H))ee<V&&0>s(re,X)?(T[F]=re,T[ee]=H,F=ee):(T[F]=X,T[Y]=H,F=Y);else if(ee<V&&0>s(re,H))T[F]=re,T[ee]=H,F=ee;else break e}}return U}function s(T,U){var H=T.sortIndex-U.sortIndex;return H!==0?H:T.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],h=[],g=1,p=null,y=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&&$(M,U.startTime-T)}}var L=!1,z=-1,D=5,W=-1;function G(){return E?!0:!(e.unstable_now()-W<D)}function q(){if(E=!1,L){var T=e.unstable_now();W=T;var U=!0;try{e:{w=!1,C&&(C=!1,N(z),z=-1),b=!0;var H=y;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,y=p.priorityLevel;var V=F(p.expirationTime<=T);if(T=e.unstable_now(),typeof V=="function"){p.callback=V,R(T),U=!0;break t}p===r(m)&&i(m),R(T)}else i(m);p=r(m)}if(p!==null)U=!0;else{var I=r(h);I!==null&&$(M,I.startTime-T),U=!1}}break e}finally{p=null,y=H,b=!1}U=void 0}}finally{U?B():L=!1}}}var B;if(typeof k=="function")B=function(){k(q)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,O=j.port2;j.port1.onmessage=q,B=function(){O.postMessage(null)}}else B=function(){S(q,0)};function $(T,U){z=S(function(){T(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(T){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var H=y;y=U;try{return T()}finally{y=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=y;y=T;try{return U()}finally{y=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:g++,callback:U,priorityLevel:T,startTime:H,expirationTime:V,sortIndex:-1},H>F?(T.sortIndex=H,t(h,T),r(m)===null&&T===r(h)&&(C?(N(z),z=-1):C=!0,$(M,H-F))):(T.sortIndex=V,t(m,T),w||b||(w=!0,L||(L=!0,B()))),T},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(T){var U=y;return function(){var H=y;y=U;try{return T.apply(this,arguments)}finally{y=H}}}})(rv)),rv}var FS;function ZD(){return FS||(FS=1,tv.exports=XD()),tv.exports}var iv={exports:{}},Fr={};/**
|
|
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 WS;function QD(){if(WS)return Fr;WS=1;var e=px();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+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,g){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:g}}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 Fr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Fr.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,g)},Fr.flushSync=function(m){var h=u.T,g=i.p;try{if(u.T=null,i.p=2,m)return m()}finally{u.T=h,i.p=g,i.d.f()}},Fr.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))},Fr.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},Fr.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?i.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:y,fetchPriority:b}):g==="script"&&i.d.X(m,{crossOrigin:p,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Fr.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);i.d.M(m,{crossOrigin:g,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)},Fr.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,p=d(g,h.crossOrigin);i.d.L(m,g,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Fr.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=d(h.as,h.crossOrigin);i.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(m)},Fr.requestFormReset=function(m){i.d.r(m)},Fr.unstable_batchedUpdates=function(m,h){return m(h)},Fr.useFormState=function(m,h,g){return u.H.useFormState(m,h,g)},Fr.useFormStatus=function(){return u.H.useHostTransitionStatus()},Fr.version="19.2.7",Fr}var qS;function JE(){if(qS)return iv.exports;qS=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=QD(),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 VS;function JD(){if(VS)return Qc;VS=1;var e=ZD(),t=px(),r=JE();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 x=_.alternate;if(x===null){if(f=_.return,f!==null){c=f;continue}break}if(_.child===x.child){for(x=_.child;x;){if(x===c)return m(_),n;if(x===f)return m(_),a;x=x.sibling}throw Error(i(188))}if(c.return!==f.return)c=_,f=x;else{for(var A=!1,P=_.child;P;){if(P===c){A=!0,c=_,f=x;break}if(P===f){A=!0,f=_,c=x;break}P=P.sibling}if(!A){for(P=x.child;P;){if(P===c){A=!0,c=x,f=_;break}if(P===f){A=!0,f=x,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 g(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=g(n),a!==null)return a;n=n.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=q&&n[q]||n["@@iterator"],typeof n=="function"?n:null)}var j=Symbol.for("react.client.reference");function O(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===j?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case C:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case M:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case w:return"Portal";case k:return n.displayName||"Context";case N:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return a=n.displayName||null,a!==null?a:O(n.type)||"Memo";case D:a=n._payload,n=n._init;try{return O(n(a))}catch{}}return null}var $=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},F=[],V=-1;function I(n){return{current:n}}function Y(n){0>V||(n.current=F[V],F[V]=null,V--)}function X(n,a){V++,F[V]=n.current,n.current=a}var ee=I(null),re=I(null),oe=I(null),Z=I(null);function ce(n,a){switch(X(oe,a),X(re,n),X(ee,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?oS(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=oS(a),n=lS(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Y(ee),X(ee,n)}function ne(){Y(ee),Y(re),Y(oe)}function we(n){n.memoizedState!==null&&X(Z,n);var a=ee.current,c=lS(a,n.type);a!==c&&(X(re,n),X(ee,c))}function _e(n){re.current===n&&(Y(ee),Y(re)),Z.current===n&&(Y(Z),Gc._currentValue=H)}var ye,J;function ie(n){if(ye===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ye=a&&a[1]||"",J=-1<c.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+ye+n+J}var Ee=!1;function ve(n,a){if(!n||Ee)return"";Ee=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ue){var le=ue}Reflect.construct(n,[],pe)}else{try{pe.call()}catch(ue){le=ue}n.call(pe.prototype)}}else{try{throw Error()}catch(ue){le=ue}(pe=n())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ue){if(ue&&le&&typeof ue.stack=="string")return[ue.stack,le.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),A=x[0],P=x[1];if(A&&P){var K=A.split(`
|
|
44
|
+
`),ae=P.split(`
|
|
45
|
+
`);for(_=f=0;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;for(;_<ae.length&&!ae[_].includes("DetermineComponentFrameRoot");)_++;if(f===K.length||_===ae.length)for(f=K.length-1,_=ae.length-1;1<=f&&0<=_&&K[f]!==ae[_];)_--;for(;1<=f&&0<=_;f--,_--)if(K[f]!==ae[_]){if(f!==1||_!==1)do if(f--,_--,0>_||K[f]!==ae[_]){var de=`
|
|
46
|
+
`+K[f].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=f&&0<=_);break}}}finally{Ee=!1,Error.prepareStackTrace=c}return(c=n?n.displayName||n.name:"")?ie(c):""}function Ae(n,a){switch(n.tag){case 26:case 27:case 5:return ie(n.type);case 16:return ie("Lazy");case 13:return n.child!==a&&a!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return ve(n.type,!1);case 11:return ve(n.type.render,!1);case 1:return ve(n.type,!0);case 31:return ie("Activity");default:return""}}function Ie(n){try{var a="",c=null;do a+=Ae(n,c),c=n,n=n.return;while(n);return a}catch(f){return`
|
|
47
|
+
Error generating stack: `+f.message+`
|
|
48
|
+
`+f.stack}}var Oe=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,rt=e.unstable_cancelCallback,Be=e.unstable_shouldYield,dt=e.unstable_requestPaint,He=e.unstable_now,Ot=e.unstable_getCurrentPriorityLevel,Ht=e.unstable_ImmediatePriority,gi=e.unstable_UserBlockingPriority,Bt=e.unstable_NormalPriority,gt=e.unstable_LowPriority,ur=e.unstable_IdlePriority,At=e.log,an=e.unstable_setDisableYieldValue,is=null,Ar=null;function vi(n){if(typeof At=="function"&&an(n),Ar&&typeof Ar.setStrictMode=="function")try{Ar.setStrictMode(is,n)}catch{}}var vr=Math.clz32?Math.clz32:_i,Wa=Math.log,Hs=Math.LN2;function _i(n){return n>>>=0,n===0?32:31-(Wa(n)/Hs|0)|0}var ns=256,ss=262144,Tn=4194304;function xi(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ue(n,a,c){var f=n.pendingLanes;if(f===0)return 0;var _=0,x=n.suspendedLanes,A=n.pingedLanes;n=n.warmLanes;var P=f&134217727;return P!==0?(f=P&~x,f!==0?_=xi(f):(A&=P,A!==0?_=xi(A):c||(c=P&~n,c!==0&&(_=xi(c))))):(P=f&~x,P!==0?_=xi(P):A!==0?_=xi(A):c||(c=f&~n,c!==0&&(_=xi(c)))),_===0?0:a!==0&&a!==_&&(a&x)===0&&(x=_&-_,c=a&-a,x>=c||x===32&&(c&4194048)!==0)?a:_}function me(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function ke(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Fe(){var n=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),n}function yt(n){for(var a=[],c=0;31>c;c++)a.push(n);return a}function Xe(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ft(n,a,c,f,_,x){var A=n.pendingLanes;n.pendingLanes=c,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=c,n.entangledLanes&=c,n.errorRecoveryDisabledLanes&=c,n.shellSuspendCounter=0;var P=n.entanglements,K=n.expirationTimes,ae=n.hiddenUpdates;for(c=A&~c;0<c;){var de=31-vr(c),pe=1<<de;P[de]=0,K[de]=-1;var le=ae[de];if(le!==null)for(ae[de]=null,de=0;de<le.length;de++){var ue=le[de];ue!==null&&(ue.lane&=-536870913)}c&=~pe}f!==0&&ri(n,f,0),x!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=x&~(A&~a))}function ri(n,a,c){n.pendingLanes|=a,n.suspendedLanes&=~a;var f=31-vr(a);n.entangledLanes|=a,n.entanglements[f]=n.entanglements[f]|1073741824|c&261930}function Wt(n,a){var c=n.entangledLanes|=a;for(n=n.entanglements;c;){var f=31-vr(c),_=1<<f;_&a|n[f]&a&&(n[f]|=a),c&=~_}}function ii(n,a){var c=a&-a;return c=(c&42)!==0?1:Fo(c),(c&(n.suspendedLanes|a))!==0?0:c}function Fo(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function on(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Hm(){var n=U.p;return n!==0?n:(n=window.event,n===void 0?32:MS(n.type))}function Gy(n,a){var c=U.p;try{return U.p=n,a()}finally{U.p=c}}var Fs=Math.random().toString(36).slice(2),Tr="__reactFiber$"+Fs,ni="__reactProps$"+Fs,Wo="__reactContainer$"+Fs,Fm="__reactEvents$"+Fs,Dj="__reactListeners$"+Fs,Lj="__reactHandles$"+Fs,Yy="__reactResources$"+Fs,lc="__reactMarker$"+Fs;function Wm(n){delete n[Tr],delete n[ni],delete n[Fm],delete n[Dj],delete n[Lj]}function qo(n){var a=n[Tr];if(a)return a;for(var c=n.parentNode;c;){if(a=c[Wo]||c[Tr]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(n=pS(n);n!==null;){if(c=n[Tr])return c;n=pS(n)}return a}n=c,c=n.parentNode}return null}function Vo(n){if(n=n[Tr]||n[Wo]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function cc(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[Yy];return a||(a=n[Yy]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function _r(n){n[lc]=!0}var Ky=new Set,Xy={};function qa(n,a){Yo(n,a),Yo(n+"Capture",a)}function Yo(n,a){for(Xy[n]=a,n=0;n<a.length;n++)Ky.add(a[n])}var Oj=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]*$"),Zy={},Qy={};function Bj(n){return Oe.call(Qy,n)?!0:Oe.call(Zy,n)?!1:Oj.test(n)?Qy[n]=!0:(Zy[n]=!0,!1)}function vd(n,a,c){if(Bj(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 _d(n,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+c)}}function as(n,a,c,f){if(f===null)n.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(c);return}n.setAttributeNS(a,c,""+f)}}function ji(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Jy(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Pj(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,x=f.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return _.call(this)},set:function(A){c=""+A,x.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=Jy(n)?"checked":"value";n._valueTracker=Pj(n,a,""+n[a])}}function eb(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return n&&(f=Jy(n)?n.checked?"true":"false":n.value),n=f,n!==c?(a.setValue(n),!0):!1}function xd(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 Ij=/[\n"\\]/g;function Di(n){return n.replace(Ij,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Vm(n,a,c,f,_,x,A,P){n.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.type=A:n.removeAttribute("type"),a!=null?A==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ji(a)):n.value!==""+ji(a)&&(n.value=""+ji(a)):A!=="submit"&&A!=="reset"||n.removeAttribute("value"),a!=null?Gm(n,A,ji(a)):c!=null?Gm(n,A,ji(c)):f!=null&&n.removeAttribute("value"),_==null&&x!=null&&(n.defaultChecked=!!x),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?n.name=""+ji(P):n.removeAttribute("name")}function tb(n,a,c,f,_,x,A,P){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.type=x),a!=null||c!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){qm(n);return}c=c!=null?""+ji(c):"",a=a!=null?""+ji(a):c,P||a===n.value||(n.value=a),n.defaultValue=a}f=f??_,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=P?n.checked:!!f,n.defaultChecked=!!f,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(n.name=A),qm(n)}function Gm(n,a,c){a==="number"&&xd(n.ownerDocument)===n||n.defaultValue===""+c||(n.defaultValue=""+c)}function Ko(n,a,c,f){if(n=n.options,a){a={};for(var _=0;_<c.length;_++)a["$"+c[_]]=!0;for(c=0;c<n.length;c++)_=a.hasOwnProperty("$"+n[c].value),n[c].selected!==_&&(n[c].selected=_),_&&f&&(n[c].defaultSelected=!0)}else{for(c=""+ji(c),a=null,_=0;_<n.length;_++){if(n[_].value===c){n[_].selected=!0,f&&(n[_].defaultSelected=!0);return}a!==null||n[_].disabled||(a=n[_])}a!==null&&(a.selected=!0)}}function rb(n,a,c){if(a!=null&&(a=""+ji(a),a!==n.value&&(n.value=a),c==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=c!=null?""+ji(c):""}function ib(n,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(i(92));if($(f)){if(1<f.length)throw Error(i(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=ji(a),n.defaultValue=c,f=n.textContent,f===c&&f!==""&&f!==null&&(n.value=f),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 zj=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 nb(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||zj.has(a)?a==="float"?n.cssFloat=c:n[a]=(""+c).trim():n[a]=c+"px"}function sb(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&&nb(n,_,f)}else for(var x in a)a.hasOwnProperty(x)&&nb(n,x,a[x])}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 $j=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"]]),Uj=/^[\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 yd(n){return Uj.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 ab(n){var a=Vo(n);if(a&&(n=a.stateNode)){var c=n[ni]||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="'+Di(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==n&&f.form===n.form){var _=f[ni]||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&&eb(f)}break e;case"textarea":rb(n,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Ko(n,!!c.multiple,a,!1)}}}var Zm=!1;function ob(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)&&(oh(),Zo&&(a=Zo,n=Qo,Qo=Zo=null,ab(a),n)))for(a=0;a<n.length;a++)ab(n[a])}}function uc(n,a){var c=n.stateNode;if(c===null)return null;var f=c[ni]||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 dc={};Object.defineProperty(dc,"passive",{get:function(){Qm=!0}}),window.addEventListener("test",dc,dc),window.removeEventListener("test",dc,dc)}catch{Qm=!1}var Ws=null,Jm=null,bd=null;function lb(){if(bd)return bd;var n,a=Jm,c=a.length,f,_="value"in Ws?Ws.value:Ws.textContent,x=_.length;for(n=0;n<c&&a[n]===_[n];n++);var A=c-n;for(f=1;f<=A&&a[c-f]===_[x-f];f++);return bd=_.slice(n,1<f?1-f:void 0)}function wd(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 Sd(){return!0}function cb(){return!1}function si(n){function a(c,f,_,x,A){this._reactName=c,this._targetInst=_,this.type=f,this.nativeEvent=x,this.target=A,this.currentTarget=null;for(var P in n)n.hasOwnProperty(P)&&(c=n[P],this[P]=c?c(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Sd:cb,this.isPropagationStopped=cb,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=Sd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Sd)},persist:function(){},isPersistent:Sd}),a}var Va={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cd=si(Va),hc=p({},Va,{view:0,detail:0}),Hj=si(hc),ep,tp,fc,Ed=p({},hc,{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!==fc&&(fc&&n.type==="mousemove"?(ep=n.screenX-fc.screenX,tp=n.screenY-fc.screenY):tp=ep=0,fc=n),ep)},movementY:function(n){return"movementY"in n?n.movementY:tp}}),ub=si(Ed),Fj=p({},Ed,{dataTransfer:0}),Wj=si(Fj),qj=p({},hc,{relatedTarget:0}),rp=si(qj),Vj=p({},Va,{animationName:0,elapsedTime:0,pseudoElement:0}),Gj=si(Vj),Yj=p({},Va,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Kj=si(Yj),Xj=p({},Va,{data:0}),db=si(Xj),Zj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qj={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"},Jj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function e3(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=Jj[n])?!!a[n]:!1}function ip(){return e3}var t3=p({},hc,{key:function(n){if(n.key){var a=Zj[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=wd(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Qj[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"?wd(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?wd(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),r3=si(t3),i3=p({},Ed,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hb=si(i3),n3=p({},hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ip}),s3=si(n3),a3=p({},Va,{propertyName:0,elapsedTime:0,pseudoElement:0}),o3=si(a3),l3=p({},Ed,{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}),c3=si(l3),u3=p({},Va,{newState:0,oldState:0}),d3=si(u3),h3=[9,13,27,32],np=ls&&"CompositionEvent"in window,mc=null;ls&&"documentMode"in document&&(mc=document.documentMode);var f3=ls&&"TextEvent"in window&&!mc,fb=ls&&(!np||mc&&8<mc&&11>=mc),mb=" ",pb=!1;function gb(n,a){switch(n){case"keyup":return h3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vb(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Jo=!1;function m3(n,a){switch(n){case"compositionend":return vb(a);case"keypress":return a.which!==32?null:(pb=!0,mb);case"textInput":return n=a.data,n===mb&&pb?null:n;default:return null}}function p3(n,a){if(Jo)return n==="compositionend"||!np&&gb(n,a)?(n=lb(),bd=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 fb&&a.locale!=="ko"?null:a.data;default:return null}}var g3={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 _b(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!g3[n.type]:a==="textarea"}function xb(n,a,c,f){Zo?Qo?Qo.push(f):Qo=[f]:Zo=f,a=mh(a,"onChange"),0<a.length&&(c=new Cd("onChange","change",null,c,f),n.push({event:c,listeners:a}))}var pc=null,gc=null;function v3(n){tS(n,0)}function Rd(n){var a=cc(n);if(eb(a))return n}function yb(n,a){if(n==="change")return a}var bb=!1;if(ls){var sp;if(ls){var ap="oninput"in document;if(!ap){var wb=document.createElement("div");wb.setAttribute("oninput","return;"),ap=typeof wb.oninput=="function"}sp=ap}else sp=!1;bb=sp&&(!document.documentMode||9<document.documentMode)}function Sb(){pc&&(pc.detachEvent("onpropertychange",Cb),gc=pc=null)}function Cb(n){if(n.propertyName==="value"&&Rd(gc)){var a=[];xb(a,gc,n,Xm(n)),ob(v3,a)}}function _3(n,a,c){n==="focusin"?(Sb(),pc=a,gc=c,pc.attachEvent("onpropertychange",Cb)):n==="focusout"&&Sb()}function x3(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Rd(gc)}function y3(n,a){if(n==="click")return Rd(a)}function b3(n,a){if(n==="input"||n==="change")return Rd(a)}function w3(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var yi=typeof Object.is=="function"?Object.is:w3;function vc(n,a){if(yi(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var c=Object.keys(n),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var _=c[f];if(!Oe.call(a,_)||!yi(n[_],a[_]))return!1}return!0}function Eb(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Rb(n,a){var c=Eb(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=Eb(c)}}function kb(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?kb(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Nb(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=xd(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=xd(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 S3=ls&&"documentMode"in document&&11>=document.documentMode,el=null,lp=null,_c=null,cp=!1;function Ab(n,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;cp||el==null||el!==xd(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}),_c&&vc(_c,f)||(_c=f,f=mh(lp,"onSelect"),0<f.length&&(a=new Cd("onSelect","select",null,a,c),n.push({event:a,listeners:f}),a.target=el)))}function Ga(n,a){var c={};return c[n.toLowerCase()]=a.toLowerCase(),c["Webkit"+n]="webkit"+a,c["Moz"+n]="moz"+a,c}var tl={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},up={},Tb={};ls&&(Tb=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function Ya(n){if(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 Tb)return up[n]=a[c];return n}var Mb=Ya("animationend"),jb=Ya("animationiteration"),Db=Ya("animationstart"),C3=Ya("transitionrun"),E3=Ya("transitionstart"),R3=Ya("transitioncancel"),Lb=Ya("transitionend"),Ob=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 ln(n,a){Ob.set(n,a),qa(a,[n])}var kd=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Li=[],rl=0,hp=0;function Nd(){for(var n=rl,a=hp=rl=0;a<n;){var c=Li[a];Li[a++]=null;var f=Li[a];Li[a++]=null;var _=Li[a];Li[a++]=null;var x=Li[a];if(Li[a++]=null,f!==null&&_!==null){var A=f.pending;A===null?_.next=_:(_.next=A.next,A.next=_),f.pending=_}x!==0&&Bb(c,_,x)}}function Ad(n,a,c,f){Li[rl++]=n,Li[rl++]=a,Li[rl++]=c,Li[rl++]=f,hp|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function fp(n,a,c,f){return Ad(n,a,c,f),Td(n)}function Ka(n,a){return Ad(n,null,null,a),Td(n)}function Bb(n,a,c){n.lanes|=c;var f=n.alternate;f!==null&&(f.lanes|=c);for(var _=!1,x=n.return;x!==null;)x.childLanes|=c,f=x.alternate,f!==null&&(f.childLanes|=c),x.tag===22&&(n=x.stateNode,n===null||n._visibility&1||(_=!0)),n=x,x=x.return;return n.tag===3?(x=n.stateNode,_&&a!==null&&(_=31-vr(c),n=x.hiddenUpdates,f=n[_],f===null?n[_]=[a]:f.push(a),a.lane=c|536870912),x):null}function Td(n){if(50<$c)throw $c=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 k3(n,a,c,f){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bi(n,a,c,f){return new k3(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=bi(n.tag,a,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=a,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&65011712,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,a=n.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c.refCleanup=n.refCleanup,c}function Pb(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 Md(n,a,c,f,_,x){var A=0;if(f=n,typeof n=="function")mp(n)&&(A=1);else if(typeof n=="string")A=jD(n,c,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case W:return n=bi(31,c,a,_),n.elementType=W,n.lanes=x,n;case C:return Xa(c.children,_,x,a);case E:A=8,_|=24;break;case S:return n=bi(12,c,a,_|2),n.elementType=S,n.lanes=x,n;case M:return n=bi(13,c,a,_),n.elementType=M,n.lanes=x,n;case L:return n=bi(19,c,a,_),n.elementType=L,n.lanes=x,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case k:A=10;break e;case N:A=9;break e;case R:A=11;break e;case z:A=14;break e;case D:A=16,f=null;break e}A=29,c=Error(i(130,n===null?"null":typeof n,"")),f=null}return a=bi(A,c,a,_),a.elementType=n,a.type=f,a.lanes=x,a}function Xa(n,a,c,f){return n=bi(7,n,f,a),n.lanes=c,n}function pp(n,a,c){return n=bi(6,n,null,a),n.lanes=c,n}function Ib(n){var a=bi(18,null,null,0);return a.stateNode=n,a}function gp(n,a,c){return a=bi(4,n.children!==null?n.children:[],n.key,a),a.lanes=c,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var zb=new WeakMap;function Oi(n,a){if(typeof n=="object"&&n!==null){var c=zb.get(n);return c!==void 0?c:(a={value:n,source:a,stack:Ie(a)},zb.set(n,a),a)}return{value:n,source:a,stack:Ie(a)}}var nl=[],sl=0,jd=null,xc=0,Bi=[],Pi=0,qs=null,Mn=1,jn="";function us(n,a){nl[sl++]=xc,nl[sl++]=jd,jd=n,xc=a}function $b(n,a,c){Bi[Pi++]=Mn,Bi[Pi++]=jn,Bi[Pi++]=qs,qs=n;var f=Mn;n=jn;var _=32-vr(f)-1;f&=~(1<<_),c+=1;var x=32-vr(a)+_;if(30<x){var A=_-_%5;x=(f&(1<<A)-1).toString(32),f>>=A,_-=A,Mn=1<<32-vr(a)+_|c<<_|f,jn=x+n}else Mn=1<<x|c<<_|f,jn=n}function vp(n){n.return!==null&&(us(n,1),$b(n,1,0))}function _p(n){for(;n===jd;)jd=nl[--sl],nl[sl]=null,xc=nl[--sl],nl[sl]=null;for(;n===qs;)qs=Bi[--Pi],Bi[Pi]=null,jn=Bi[--Pi],Bi[Pi]=null,Mn=Bi[--Pi],Bi[Pi]=null}function Ub(n,a){Bi[Pi++]=Mn,Bi[Pi++]=jn,Bi[Pi++]=qs,Mn=a.id,jn=a.overflow,qs=n}var Mr=null,Tt=null,ut=!1,Vs=null,Ii=!1,xp=Error(i(519));function Gs(n){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yc(Oi(a,n)),xp}function Hb(n){var a=n.stateNode,c=n.type,f=n.memoizedProps;switch(a[Tr]=n,a[ni]=f,c){case"dialog":st("cancel",a),st("close",a);break;case"iframe":case"object":case"embed":st("load",a);break;case"video":case"audio":for(c=0;c<Hc.length;c++)st(Hc[c],a);break;case"source":st("error",a);break;case"img":case"image":case"link":st("error",a),st("load",a);break;case"details":st("toggle",a);break;case"input":st("invalid",a),tb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":st("invalid",a);break;case"textarea":st("invalid",a),ib(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||sS(a.textContent,c)?(f.popover!=null&&(st("beforetoggle",a),st("toggle",a)),f.onScroll!=null&&st("scroll",a),f.onScrollEnd!=null&&st("scrollend",a),f.onClick!=null&&(a.onclick=os),a=!0):a=!1,a||Gs(n,!0)}function Fb(n){for(Mr=n.return;Mr;)switch(Mr.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mr=Mr.return}}function al(n){if(n!==Mr)return!1;if(!ut)return Fb(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&&Tt&&Gs(n),Fb(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Tt=mS(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));Tt=mS(n)}else a===27?(a=Tt,oa(n.type)?(n=Hg,Hg=null,Tt=n):Tt=a):Tt=Mr?$i(n.stateNode.nextSibling):null;return!0}function Za(){Tt=Mr=null,ut=!1}function yp(){var n=Vs;return n!==null&&(ci===null?ci=n:ci.push.apply(ci,n),Vs=null),n}function yc(n){Vs===null?Vs=[n]:Vs.push(n)}var bp=I(null),Qa=null,ds=null;function Ys(n,a,c){X(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 x=_.dependencies;if(x!==null){var A=_.child;x=x.firstContext;e:for(;x!==null;){var P=x;x=_;for(var K=0;K<a.length;K++)if(P.context===a[K]){x.lanes|=c,P=x.alternate,P!==null&&(P.lanes|=c),wp(x.return,c,n),f||(A=null);break e}x=P.next}}else if(_.tag===18){if(A=_.return,A===null)throw Error(i(341));A.lanes|=c,x=A.alternate,x!==null&&(x.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,x=!1;_!==null;){if(!x){if((_.flags&524288)!==0)x=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var A=_.alternate;if(A===null)throw Error(i(387));if(A=A.memoizedProps,A!==null){var P=_.type;yi(_.pendingProps.value,A.value)||(n!==null?n.push(P):n=[P])}}else if(_===Z.current){if(A=_.alternate,A===null)throw Error(i(387));A.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push(Gc):n=[Gc])}_=_.return}n!==null&&Sp(a,n,c,f),a.flags|=262144}function Dd(n){for(n=n.firstContext;n!==null;){if(!yi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ja(n){Qa=n,ds=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function jr(n){return Wb(Qa,n)}function Ld(n,a){return Qa===null&&Ja(n),Wb(n,a)}function Wb(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 N3=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()})}},A3=e.unstable_scheduleCallback,T3=e.unstable_NormalPriority,rr={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cp(){return{controller:new N3,data:new Map,refCount:0}}function bc(n){n.refCount--,n.refCount===0&&A3(T3,function(){n.controller.abort()})}var wc=null,Ep=0,ll=0,cl=null;function M3(n,a){if(wc===null){var c=wc=[];Ep=0,ll=Ng(),cl={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Ep++,a.then(qb,qb),a}function qb(){if(--Ep===0&&wc!==null){cl!==null&&(cl.status="fulfilled");var n=wc;wc=null,ll=0,cl=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function j3(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 Vb=T.S;T.S=function(n,a){Aw=He(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&M3(n,a),Vb!==null&&Vb(n,a)};var eo=I(null);function Rp(){var n=eo.current;return n!==null?n:Rt.pooledCache}function Od(n,a){a===null?X(eo,eo.current):X(eo,a.pool)}function Gb(){var n=Rp();return n===null?null:{parent:rr._currentValue,pool:n}}var ul=Error(i(460)),kp=Error(i(474)),Bd=Error(i(542)),Pd={then:function(){}};function Yb(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Kb(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,Zb(n),n;default:if(typeof a.status=="string")a.then(os,os);else{if(n=Rt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=a,n.status="pending",n.then(function(f){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=f}},function(f){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,Zb(n),n}throw ro=a,ul}}function to(n){try{var a=n._init;return a(n._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(ro=c,ul):c}}var ro=null;function Xb(){if(ro===null)throw Error(i(459));var n=ro;return ro=null,n}function Zb(n){if(n===ul||n===Bd)throw Error(i(483))}var dl=null,Sc=0;function Id(n){var a=Sc;return Sc+=1,dl===null&&(dl=[]),Kb(dl,n,a)}function Cc(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function zd(n,a){throw a.$$typeof===y?Error(i(525)):(n=Object.prototype.toString.call(a),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Qb(n){function a(te,Q){if(n){var se=te.deletions;se===null?(te.deletions=[Q],te.flags|=16):se.push(Q)}}function c(te,Q){if(!n)return null;for(;Q!==null;)a(te,Q),Q=Q.sibling;return null}function f(te){for(var Q=new Map;te!==null;)te.key!==null?Q.set(te.key,te):Q.set(te.index,te),te=te.sibling;return Q}function _(te,Q){return te=cs(te,Q),te.index=0,te.sibling=null,te}function x(te,Q,se){return te.index=se,n?(se=te.alternate,se!==null?(se=se.index,se<Q?(te.flags|=67108866,Q):se):(te.flags|=67108866,Q)):(te.flags|=1048576,Q)}function A(te){return n&&te.alternate===null&&(te.flags|=67108866),te}function P(te,Q,se,fe){return Q===null||Q.tag!==6?(Q=pp(se,te.mode,fe),Q.return=te,Q):(Q=_(Q,se),Q.return=te,Q)}function K(te,Q,se,fe){var Pe=se.type;return Pe===C?de(te,Q,se.props.children,fe,se.key):Q!==null&&(Q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&to(Pe)===Q.type)?(Q=_(Q,se.props),Cc(Q,se),Q.return=te,Q):(Q=Md(se.type,se.key,se.props,null,te.mode,fe),Cc(Q,se),Q.return=te,Q)}function ae(te,Q,se,fe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==se.containerInfo||Q.stateNode.implementation!==se.implementation?(Q=gp(se,te.mode,fe),Q.return=te,Q):(Q=_(Q,se.children||[]),Q.return=te,Q)}function de(te,Q,se,fe,Pe){return Q===null||Q.tag!==7?(Q=Xa(se,te.mode,fe,Pe),Q.return=te,Q):(Q=_(Q,se),Q.return=te,Q)}function pe(te,Q,se){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=pp(""+Q,te.mode,se),Q.return=te,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return se=Md(Q.type,Q.key,Q.props,null,te.mode,se),Cc(se,Q),se.return=te,se;case w:return Q=gp(Q,te.mode,se),Q.return=te,Q;case D:return Q=to(Q),pe(te,Q,se)}if($(Q)||B(Q))return Q=Xa(Q,te.mode,se,null),Q.return=te,Q;if(typeof Q.then=="function")return pe(te,Id(Q),se);if(Q.$$typeof===k)return pe(te,Ld(te,Q),se);zd(te,Q)}return null}function le(te,Q,se,fe){var Pe=Q!==null?Q.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return Pe!==null?null:P(te,Q,""+se,fe);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case b:return se.key===Pe?K(te,Q,se,fe):null;case w:return se.key===Pe?ae(te,Q,se,fe):null;case D:return se=to(se),le(te,Q,se,fe)}if($(se)||B(se))return Pe!==null?null:de(te,Q,se,fe,null);if(typeof se.then=="function")return le(te,Q,Id(se),fe);if(se.$$typeof===k)return le(te,Q,Ld(te,se),fe);zd(te,se)}return null}function ue(te,Q,se,fe,Pe){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(se)||null,P(Q,te,""+fe,Pe);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?se:fe.key)||null,K(Q,te,fe,Pe);case w:return te=te.get(fe.key===null?se:fe.key)||null,ae(Q,te,fe,Pe);case D:return fe=to(fe),ue(te,Q,se,fe,Pe)}if($(fe)||B(fe))return te=te.get(se)||null,de(Q,te,fe,Pe,null);if(typeof fe.then=="function")return ue(te,Q,se,Id(fe),Pe);if(fe.$$typeof===k)return ue(te,Q,se,Ld(Q,fe),Pe);zd(Q,fe)}return null}function je(te,Q,se,fe){for(var Pe=null,ht=null,De=Q,Ze=Q=0,lt=null;De!==null&&Ze<se.length;Ze++){De.index>Ze?(lt=De,De=null):lt=De.sibling;var ft=le(te,De,se[Ze],fe);if(ft===null){De===null&&(De=lt);break}n&&De&&ft.alternate===null&&a(te,De),Q=x(ft,Q,Ze),ht===null?Pe=ft:ht.sibling=ft,ht=ft,De=lt}if(Ze===se.length)return c(te,De),ut&&us(te,Ze),Pe;if(De===null){for(;Ze<se.length;Ze++)De=pe(te,se[Ze],fe),De!==null&&(Q=x(De,Q,Ze),ht===null?Pe=De:ht.sibling=De,ht=De);return ut&&us(te,Ze),Pe}for(De=f(De);Ze<se.length;Ze++)lt=ue(De,te,Ze,se[Ze],fe),lt!==null&&(n&<.alternate!==null&&De.delete(lt.key===null?Ze:lt.key),Q=x(lt,Q,Ze),ht===null?Pe=lt:ht.sibling=lt,ht=lt);return n&&De.forEach(function(ha){return a(te,ha)}),ut&&us(te,Ze),Pe}function $e(te,Q,se,fe){if(se==null)throw Error(i(151));for(var Pe=null,ht=null,De=Q,Ze=Q=0,lt=null,ft=se.next();De!==null&&!ft.done;Ze++,ft=se.next()){De.index>Ze?(lt=De,De=null):lt=De.sibling;var ha=le(te,De,ft.value,fe);if(ha===null){De===null&&(De=lt);break}n&&De&&ha.alternate===null&&a(te,De),Q=x(ha,Q,Ze),ht===null?Pe=ha:ht.sibling=ha,ht=ha,De=lt}if(ft.done)return c(te,De),ut&&us(te,Ze),Pe;if(De===null){for(;!ft.done;Ze++,ft=se.next())ft=pe(te,ft.value,fe),ft!==null&&(Q=x(ft,Q,Ze),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return ut&&us(te,Ze),Pe}for(De=f(De);!ft.done;Ze++,ft=se.next())ft=ue(De,te,Ze,ft.value,fe),ft!==null&&(n&&ft.alternate!==null&&De.delete(ft.key===null?Ze:ft.key),Q=x(ft,Q,Ze),ht===null?Pe=ft:ht.sibling=ft,ht=ft);return n&&De.forEach(function(FD){return a(te,FD)}),ut&&us(te,Ze),Pe}function St(te,Q,se,fe){if(typeof se=="object"&&se!==null&&se.type===C&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case b:e:{for(var Pe=se.key;Q!==null;){if(Q.key===Pe){if(Pe=se.type,Pe===C){if(Q.tag===7){c(te,Q.sibling),fe=_(Q,se.props.children),fe.return=te,te=fe;break e}}else if(Q.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===D&&to(Pe)===Q.type){c(te,Q.sibling),fe=_(Q,se.props),Cc(fe,se),fe.return=te,te=fe;break e}c(te,Q);break}else a(te,Q);Q=Q.sibling}se.type===C?(fe=Xa(se.props.children,te.mode,fe,se.key),fe.return=te,te=fe):(fe=Md(se.type,se.key,se.props,null,te.mode,fe),Cc(fe,se),fe.return=te,te=fe)}return A(te);case w:e:{for(Pe=se.key;Q!==null;){if(Q.key===Pe)if(Q.tag===4&&Q.stateNode.containerInfo===se.containerInfo&&Q.stateNode.implementation===se.implementation){c(te,Q.sibling),fe=_(Q,se.children||[]),fe.return=te,te=fe;break e}else{c(te,Q);break}else a(te,Q);Q=Q.sibling}fe=gp(se,te.mode,fe),fe.return=te,te=fe}return A(te);case D:return se=to(se),St(te,Q,se,fe)}if($(se))return je(te,Q,se,fe);if(B(se)){if(Pe=B(se),typeof Pe!="function")throw Error(i(150));return se=Pe.call(se),$e(te,Q,se,fe)}if(typeof se.then=="function")return St(te,Q,Id(se),fe);if(se.$$typeof===k)return St(te,Q,Ld(te,se),fe);zd(te,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,Q!==null&&Q.tag===6?(c(te,Q.sibling),fe=_(Q,se),fe.return=te,te=fe):(c(te,Q),fe=pp(se,te.mode,fe),fe.return=te,te=fe),A(te)):c(te,Q)}return function(te,Q,se,fe){try{Sc=0;var Pe=St(te,Q,se,fe);return dl=null,Pe}catch(De){if(De===ul||De===Bd)throw De;var ht=bi(29,De,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var io=Qb(!0),Jb=Qb(!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=Td(n),Bb(n,null,c),a}return Ad(n,f,a,c),Td(n)}function Ec(n,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,Wt(n,c)}}function Tp(n,a){var c=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var _=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var A={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?_=x=A:x=x.next=A,c=c.next}while(c!==null);x===null?_=x=a:x=x.next=a}else _=x=a;c={baseState:f.baseState,firstBaseUpdate:_,lastBaseUpdate:x,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 Rc(){if(Mp){var n=cl;if(n!==null)throw n}}function kc(n,a,c,f){Mp=!1;var _=n.updateQueue;Ks=!1;var x=_.firstBaseUpdate,A=_.lastBaseUpdate,P=_.shared.pending;if(P!==null){_.shared.pending=null;var K=P,ae=K.next;K.next=null,A===null?x=ae:A.next=ae,A=K;var de=n.alternate;de!==null&&(de=de.updateQueue,P=de.lastBaseUpdate,P!==A&&(P===null?de.firstBaseUpdate=ae:P.next=ae,de.lastBaseUpdate=K))}if(x!==null){var pe=_.baseState;A=0,de=ae=K=null,P=x;do{var le=P.lane&-536870913,ue=le!==P.lane;if(ue?(ot&le)===le:(f&le)===le){le!==0&&le===ll&&(Mp=!0),de!==null&&(de=de.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var je=n,$e=P;le=a;var St=c;switch($e.tag){case 1:if(je=$e.payload,typeof je=="function"){pe=je.call(St,pe,le);break e}pe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=$e.payload,le=typeof je=="function"?je.call(St,pe,le):je,le==null)break e;pe=p({},pe,le);break e;case 2:Ks=!0}}le=P.callback,le!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[le]:ue.push(le))}else ue={lane:le,tag:P.tag,payload:P.payload,callback:P.callback,next:null},de===null?(ae=de=ue,K=pe):de=de.next=ue,A|=le;if(P=P.next,P===null){if(P=_.shared.pending,P===null)break;ue=P,P=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);de===null&&(K=pe),_.baseState=K,_.firstBaseUpdate=ae,_.lastBaseUpdate=de,x===null&&(_.shared.lanes=0),ra|=A,n.lanes=A,n.memoizedState=pe}}function e1(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function t1(n,a){var c=n.callbacks;if(c!==null)for(n.callbacks=null,n=0;n<c.length;n++)e1(c[n],a)}var hl=I(null),$d=I(0);function r1(n,a){n=bs,X($d,n),X(hl,a),bs=n|a.baseLanes}function jp(){X($d,bs),X(hl,hl.current)}function Dp(){bs=$d.current,Y(hl),Y($d)}var wi=I(null),zi=null;function Qs(n){var a=n.alternate;X(Qt,Qt.current&1),X(wi,n),zi===null&&(a===null||hl.current!==null||a.memoizedState!==null)&&(zi=n)}function Lp(n){X(Qt,Qt.current),X(wi,n),zi===null&&(zi=n)}function i1(n){n.tag===22?(X(Qt,Qt.current),X(wi,n),zi===null&&(zi=n)):Js()}function Js(){X(Qt,Qt.current),X(wi,wi.current)}function Si(n){Y(wi),zi===n&&(zi=null),Y(Qt)}var Qt=I(0);function Ud(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,Ke=null,bt=null,ir=null,Hd=!1,fl=!1,no=!1,Fd=0,Nc=0,ml=null,D3=0;function qt(){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(!yi(n[c],a[c]))return!1;return!0}function Bp(n,a,c,f,_,x){return fs=x,Ke=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,T.H=n===null||n.memoizedState===null?$1:Zp,no=!1,x=c(f,_),no=!1,fl&&(x=s1(a,c,f,_)),n1(n),x}function n1(n){T.H=Mc;var a=bt!==null&&bt.next!==null;if(fs=0,ir=bt=Ke=null,Hd=!1,Nc=0,ml=null,a)throw Error(i(300));n===null||nr||(n=n.dependencies,n!==null&&Dd(n)&&(nr=!0))}function s1(n,a,c,f){Ke=n;var _=0;do{if(fl&&(ml=null),Nc=0,fl=!1,25<=_)throw Error(i(301));if(_+=1,ir=bt=null,n.updateQueue!=null){var x=n.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}T.H=U1,x=a(c,f)}while(fl);return x}function L3(){var n=T.H,a=n.useState()[0];return a=typeof a.then=="function"?Ac(a):a,n=n.useState()[0],(bt!==null?bt.memoizedState:null)!==n&&(Ke.flags|=1024),a}function Pp(){var n=Fd!==0;return Fd=0,n}function Ip(n,a,c){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~c}function zp(n){if(Hd){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Hd=!1}fs=0,ir=bt=Ke=null,fl=!1,Nc=Fd=0,ml=null}function Gr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ir===null?Ke.memoizedState=ir=n:ir=ir.next=n,ir}function Jt(){if(bt===null){var n=Ke.alternate;n=n!==null?n.memoizedState:null}else n=bt.next;var a=ir===null?Ke.memoizedState:ir.next;if(a!==null)ir=a,bt=n;else{if(n===null)throw Ke.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},ir===null?Ke.memoizedState=ir=n:ir=ir.next=n}return ir}function Wd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ac(n){var a=Nc;return Nc+=1,ml===null&&(ml=[]),n=Kb(ml,n,a),a=Ke,(ir===null?a.memoizedState:ir.next)===null&&(a=a.alternate,T.H=a===null||a.memoizedState===null?$1:Zp),n}function qd(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ac(n);if(n.$$typeof===k)return jr(n)}throw Error(i(438,String(n)))}function $p(n){var a=null,c=Ke.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Ke.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=Wd(),Ke.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 Vd(n){var a=Jt();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,x=f.pending;if(x!==null){if(_!==null){var A=_.next;_.next=x.next,x.next=A}a.baseQueue=_=x,f.pending=null}if(x=n.baseState,_===null)n.memoizedState=x;else{a=_.next;var P=A=null,K=null,ae=a,de=!1;do{var pe=ae.lane&-536870913;if(pe!==ae.lane?(ot&pe)===pe:(fs&pe)===pe){var le=ae.revertLane;if(le===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),pe===ll&&(de=!0);else if((fs&le)===le){ae=ae.next,le===ll&&(de=!0);continue}else pe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(P=K=pe,A=x):K=K.next=pe,Ke.lanes|=le,ra|=le;pe=ae.action,no&&c(x,pe),x=ae.hasEagerState?ae.eagerState:c(x,pe)}else le={lane:pe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(P=K=le,A=x):K=K.next=le,Ke.lanes|=pe,ra|=pe;ae=ae.next}while(ae!==null&&ae!==a);if(K===null?A=x:K.next=P,!yi(x,n.memoizedState)&&(nr=!0,de&&(c=cl,c!==null)))throw c;n.memoizedState=x,n.baseState=A,n.baseQueue=K,f.lastRenderedState=x}return _===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function Hp(n){var a=Jt(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=n;var f=c.dispatch,_=c.pending,x=a.memoizedState;if(_!==null){c.pending=null;var A=_=_.next;do x=n(x,A.action),A=A.next;while(A!==_);yi(x,a.memoizedState)||(nr=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),c.lastRenderedState=x}return[x,f]}function a1(n,a,c){var f=Ke,_=Jt(),x=ut;if(x){if(c===void 0)throw Error(i(407));c=c()}else c=a();var A=!yi((bt||_).memoizedState,c);if(A&&(_.memoizedState=c,nr=!0),_=_.queue,qp(c1.bind(null,f,_,n),[n]),_.getSnapshot!==a||A||ir!==null&&ir.memoizedState.tag&1){if(f.flags|=2048,pl(9,{destroy:void 0},l1.bind(null,f,_,c,a),null),Rt===null)throw Error(i(349));x||(fs&127)!==0||o1(f,a,c)}return c}function o1(n,a,c){n.flags|=16384,n={getSnapshot:a,value:c},a=Ke.updateQueue,a===null?(a=Wd(),Ke.updateQueue=a,a.stores=[n]):(c=a.stores,c===null?a.stores=[n]:c.push(n))}function l1(n,a,c,f){a.value=c,a.getSnapshot=f,u1(a)&&d1(n)}function c1(n,a,c){return c(function(){u1(a)&&d1(n)})}function u1(n){var a=n.getSnapshot;n=n.value;try{var c=a();return!yi(n,c)}catch{return!0}}function d1(n){var a=Ka(n,2);a!==null&&ui(a,n,2)}function Fp(n){var a=Gr();if(typeof n=="function"){var c=n;if(n=c(),no){vi(!0);try{c()}finally{vi(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},a}function h1(n,a,c,f){return n.baseState=c,Up(n,bt,typeof f=="function"?f:ms)}function O3(n,a,c,f,_){if(Kd(n))throw Error(i(485));if(n=a.action,n!==null){var x={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){x.listeners.push(A)}};T.T!==null?c(!0):x.isTransition=!1,f(x),c=a.pending,c===null?(x.next=a.pending=x,f1(a,x)):(x.next=c.next,a.pending=c.next=x)}}function f1(n,a){var c=a.action,f=a.payload,_=n.state;if(a.isTransition){var x=T.T,A={};T.T=A;try{var P=c(_,f),K=T.S;K!==null&&K(A,P),m1(n,a,P)}catch(ae){Wp(n,a,ae)}finally{x!==null&&A.types!==null&&(x.types=A.types),T.T=x}}else try{x=c(_,f),m1(n,a,x)}catch(ae){Wp(n,a,ae)}}function m1(n,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){p1(n,a,f)},function(f){return Wp(n,a,f)}):p1(n,a,c)}function p1(n,a,c){a.status="fulfilled",a.value=c,g1(a),n.state=c,a=n.pending,a!==null&&(c=a.next,c===a?n.pending=null:(c=c.next,a.next=c,f1(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,g1(a),a=a.next;while(a!==f)}n.action=null}function g1(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function v1(n,a){return a}function _1(n,a){if(ut){var c=Rt.formState;if(c!==null){e:{var f=Ke;if(ut){if(Tt){t:{for(var _=Tt,x=Ii;_.nodeType!==8;){if(!x){_=null;break t}if(_=$i(_.nextSibling),_===null){_=null;break t}}x=_.data,_=x==="F!"||x==="F"?_:null}if(_){Tt=$i(_.nextSibling),f=_.data==="F!";break e}}Gs(f)}f=!1}f&&(a=c[0])}}return c=Gr(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:v1,lastRenderedState:a},c.queue=f,c=P1.bind(null,Ke,f),f.dispatch=c,f=Fp(!1),x=Xp.bind(null,Ke,!1,f.queue),f=Gr(),_={state:a,dispatch:null,action:n,pending:null},f.queue=_,c=O3.bind(null,Ke,_,x,c),_.dispatch=c,f.memoizedState=n,[a,c,!1]}function x1(n){var a=Jt();return y1(a,bt,n)}function y1(n,a,c){if(a=Up(n,a,v1)[0],n=Vd(ms)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Ac(a)}catch(A){throw A===ul?Bd:A}else f=a;a=Jt();var _=a.queue,x=_.dispatch;return c!==a.memoizedState&&(Ke.flags|=2048,pl(9,{destroy:void 0},B3.bind(null,_,c),null)),[f,x,n]}function B3(n,a){n.action=a}function b1(n){var a=Jt(),c=bt;if(c!==null)return y1(a,c,n);Jt(),a=a.memoizedState,c=Jt();var f=c.queue.dispatch;return c.memoizedState=n,[a,f,!1]}function pl(n,a,c,f){return n={tag:n,create:c,deps:f,inst:a,next:null},a=Ke.updateQueue,a===null&&(a=Wd(),Ke.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 w1(){return Jt().memoizedState}function Gd(n,a,c,f){var _=Gr();Ke.flags|=n,_.memoizedState=pl(1|a,{destroy:void 0},c,f===void 0?null:f)}function Yd(n,a,c,f){var _=Jt();f=f===void 0?null:f;var x=_.memoizedState.inst;bt!==null&&f!==null&&Op(f,bt.memoizedState.deps)?_.memoizedState=pl(a,x,c,f):(Ke.flags|=n,_.memoizedState=pl(1|a,x,c,f))}function S1(n,a){Gd(8390656,8,n,a)}function qp(n,a){Yd(2048,8,n,a)}function P3(n){Ke.flags|=4;var a=Ke.updateQueue;if(a===null)a=Wd(),Ke.updateQueue=a,a.events=[n];else{var c=a.events;c===null?a.events=[n]:c.push(n)}}function C1(n){var a=Jt().memoizedState;return P3({ref:a,nextImpl:n}),function(){if((mt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function E1(n,a){return Yd(4,2,n,a)}function R1(n,a){return Yd(4,4,n,a)}function k1(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 N1(n,a,c){c=c!=null?c.concat([n]):null,Yd(4,4,k1.bind(null,a,n),c)}function Vp(){}function A1(n,a){var c=Jt();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 T1(n,a){var c=Jt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&Op(a,f[1]))return f[0];if(f=n(),no){vi(!0);try{n()}finally{vi(!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=Mw(),Ke.lanes|=n,ra|=n,c)}function M1(n,a,c,f){return yi(c,a)?c:hl.current!==null?(n=Gp(n,c,f),yi(n,a)||(nr=!0),n):(fs&42)===0||(fs&1073741824)!==0&&(ot&261930)===0?(nr=!0,n.memoizedState=c):(n=Mw(),Ke.lanes|=n,ra|=n,a)}function j1(n,a,c,f,_){var x=U.p;U.p=x!==0&&8>x?x:8;var A=T.T,P={};T.T=P,Xp(n,!1,a,c);try{var K=_(),ae=T.S;if(ae!==null&&ae(P,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var de=j3(K,f);Tc(n,a,de,Ri(n))}else Tc(n,a,f,Ri(n))}catch(pe){Tc(n,a,{then:function(){},status:"rejected",reason:pe},Ri())}finally{U.p=x,A!==null&&P.types!==null&&(A.types=P.types),T.T=A}}function I3(){}function Yp(n,a,c,f){if(n.tag!==5)throw Error(i(476));var _=D1(n).queue;j1(n,_,a,H,c===null?I3:function(){return L1(n),c(f)})}function D1(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 L1(n){var a=D1(n);a.next===null&&(a=n.alternate.memoizedState),Tc(n,a.next.queue,{},Ri())}function Kp(){return jr(Gc)}function O1(){return Jt().memoizedState}function B1(){return Jt().memoizedState}function z3(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var c=Ri();n=Xs(c);var f=Zs(a,n,c);f!==null&&(ui(f,a,c),Ec(f,a,c)),a={cache:Cp()},n.payload=a;return}a=a.return}}function $3(n,a,c){var f=Ri();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Kd(n)?I1(a,c):(c=fp(n,a,c,f),c!==null&&(ui(c,n,f),z1(c,a,f)))}function P1(n,a,c){var f=Ri();Tc(n,a,c,f)}function Tc(n,a,c,f){var _={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Kd(n))I1(a,_);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var A=a.lastRenderedState,P=x(A,c);if(_.hasEagerState=!0,_.eagerState=P,yi(P,A))return Ad(n,a,_,0),Rt===null&&Nd(),!1}catch{}finally{}if(c=fp(n,a,_,f),c!==null)return ui(c,n,f),z1(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},Kd(n)){if(a)throw Error(i(479))}else a=fp(n,c,f,2),a!==null&&ui(a,n,2)}function Kd(n){var a=n.alternate;return n===Ke||a!==null&&a===Ke}function I1(n,a){fl=Hd=!0;var c=n.pending;c===null?a.next=a:(a.next=c.next,c.next=a),n.pending=a}function z1(n,a,c){if((c&4194048)!==0){var f=a.lanes;f&=n.pendingLanes,c|=f,a.lanes=c,Wt(n,c)}}var Mc={readContext:jr,use:qd,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};Mc.useEffectEvent=qt;var $1={readContext:jr,use:qd,useCallback:function(n,a){return Gr().memoizedState=[n,a===void 0?null:a],n},useContext:jr,useEffect:S1,useImperativeHandle:function(n,a,c){c=c!=null?c.concat([n]):null,Gd(4194308,4,k1.bind(null,a,n),c)},useLayoutEffect:function(n,a){return Gd(4194308,4,n,a)},useInsertionEffect:function(n,a){Gd(4,2,n,a)},useMemo:function(n,a){var c=Gr();a=a===void 0?null:a;var f=n();if(no){vi(!0);try{n()}finally{vi(!1)}}return c.memoizedState=[f,a],f},useReducer:function(n,a,c){var f=Gr();if(c!==void 0){var _=c(a);if(no){vi(!0);try{c(a)}finally{vi(!1)}}}else _=a;return f.memoizedState=f.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},f.queue=n,n=n.dispatch=$3.bind(null,Ke,n),[f.memoizedState,n]},useRef:function(n){var a=Gr();return n={current:n},a.memoizedState=n},useState:function(n){n=Fp(n);var a=n.queue,c=P1.bind(null,Ke,a);return a.dispatch=c,[n.memoizedState,c]},useDebugValue:Vp,useDeferredValue:function(n,a){var c=Gr();return Gp(c,n,a)},useTransition:function(){var n=Fp(!1);return n=j1.bind(null,Ke,n.queue,!0,!1),Gr().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,c){var f=Ke,_=Gr();if(ut){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),Rt===null)throw Error(i(349));(ot&127)!==0||o1(f,a,c)}_.memoizedState=c;var x={value:c,getSnapshot:a};return _.queue=x,S1(c1.bind(null,f,x,n),[n]),f.flags|=2048,pl(9,{destroy:void 0},l1.bind(null,f,x,c,a),null),c},useId:function(){var n=Gr(),a=Rt.identifierPrefix;if(ut){var c=jn,f=Mn;c=(f&~(1<<32-vr(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Fd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=D3++,a="_"+a+"r_"+c.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Kp,useFormState:_1,useActionState:_1,useOptimistic:function(n){var a=Gr();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,Ke,!0,c),c.dispatch=a,[n,a]},useMemoCache:$p,useCacheRefresh:function(){return Gr().memoizedState=z3.bind(null,Ke)},useEffectEvent:function(n){var a=Gr(),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:jr,use:qd,useCallback:A1,useContext:jr,useEffect:qp,useImperativeHandle:N1,useInsertionEffect:E1,useLayoutEffect:R1,useMemo:T1,useReducer:Vd,useRef:w1,useState:function(){return Vd(ms)},useDebugValue:Vp,useDeferredValue:function(n,a){var c=Jt();return M1(c,bt.memoizedState,n,a)},useTransition:function(){var n=Vd(ms)[0],a=Jt().memoizedState;return[typeof n=="boolean"?n:Ac(n),a]},useSyncExternalStore:a1,useId:O1,useHostTransitionStatus:Kp,useFormState:x1,useActionState:x1,useOptimistic:function(n,a){var c=Jt();return h1(c,bt,n,a)},useMemoCache:$p,useCacheRefresh:B1};Zp.useEffectEvent=C1;var U1={readContext:jr,use:qd,useCallback:A1,useContext:jr,useEffect:qp,useImperativeHandle:N1,useInsertionEffect:E1,useLayoutEffect:R1,useMemo:T1,useReducer:Hp,useRef:w1,useState:function(){return Hp(ms)},useDebugValue:Vp,useDeferredValue:function(n,a){var c=Jt();return bt===null?Gp(c,n,a):M1(c,bt.memoizedState,n,a)},useTransition:function(){var n=Hp(ms)[0],a=Jt().memoizedState;return[typeof n=="boolean"?n:Ac(n),a]},useSyncExternalStore:a1,useId:O1,useHostTransitionStatus:Kp,useFormState:b1,useActionState:b1,useOptimistic:function(n,a){var c=Jt();return bt!==null?h1(c,bt,n,a):(c.baseState=n,[n,c.queue.dispatch])},useMemoCache:$p,useCacheRefresh:B1};U1.useEffectEvent=C1;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=Ri(),_=Xs(f);_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(ui(a,n,f),Ec(a,n,f))},enqueueReplaceState:function(n,a,c){n=n._reactInternals;var f=Ri(),_=Xs(f);_.tag=1,_.payload=a,c!=null&&(_.callback=c),a=Zs(n,_,f),a!==null&&(ui(a,n,f),Ec(a,n,f))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var c=Ri(),f=Xs(c);f.tag=2,a!=null&&(f.callback=a),a=Zs(n,f,c),a!==null&&(ui(a,n,c),Ec(a,n,c))}};function H1(n,a,c,f,_,x,A){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,x,A):a.prototype&&a.prototype.isPureReactComponent?!vc(c,f)||!vc(_,x):!0}function F1(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 so(n,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(n=n.defaultProps){c===a&&(c=p({},c));for(var _ in n)c[_]===void 0&&(c[_]=n[_])}return c}function W1(n){kd(n)}function q1(n){console.error(n)}function V1(n){kd(n)}function Xd(n,a){try{var c=n.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function G1(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(){Xd(n,a)},c}function Y1(n){return n=Xs(n),n.tag=3,n}function K1(n,a,c,f){var _=c.type.getDerivedStateFromError;if(typeof _=="function"){var x=f.value;n.payload=function(){return _(x)},n.callback=function(){G1(a,c,f)}}var A=c.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(n.callback=function(){G1(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 U3(n,a,c,f,_){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&ol(a,c,_,!0),c=wi.current,c!==null){switch(c.tag){case 31:case 13:return zi===null?lh():c.alternate===null&&Vt===0&&(Vt=3),c.flags&=-257,c.flags|=65536,c.lanes=_,f===Pd?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===Pd?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,_),lh(),!1}if(ut)return a=wi.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,f!==xp&&(n=Error(i(422),{cause:f}),yc(Oi(n,c)))):(f!==xp&&(a=Error(i(423),{cause:f}),yc(Oi(a,c))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,f=Oi(f,c),_=eg(n.stateNode,f,_),Tp(n,_),Vt!==4&&(Vt=2)),!1;var x=Error(i(520),{cause:f});if(x=Oi(x,c),zc===null?zc=[x]:zc.push(x),Vt!==4&&(Vt=2),a===null)return!0;f=Oi(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,n=_&-_,c.lanes|=n,n=eg(c.stateNode,f,n),Tp(c,n),!1;case 1:if(a=c.type,x=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ia===null||!ia.has(x))))return c.flags|=65536,_&=-_,c.lanes|=_,_=Y1(_),K1(_,n,c,f),Tp(c,_),!1}c=c.return}while(c!==null);return!1}var tg=Error(i(461)),nr=!1;function Dr(n,a,c,f){a.child=n===null?Jb(a,null,c,f):io(a,n.child,c,f)}function X1(n,a,c,f,_){c=c.render;var x=a.ref;if("ref"in f){var A={};for(var P in f)P!=="ref"&&(A[P]=f[P])}else A=f;return Ja(a),f=Bp(n,a,c,A,x,_),P=Pp(),n!==null&&!nr?(Ip(n,a,_),ps(n,a,_)):(ut&&P&&vp(a),a.flags|=1,Dr(n,a,f,_),a.child)}function Z1(n,a,c,f,_){if(n===null){var x=c.type;return typeof x=="function"&&!mp(x)&&x.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=x,Q1(n,a,x,f,_)):(n=Md(c.type,null,f,a,a.mode,_),n.ref=a.ref,n.return=a,a.child=n)}if(x=n.child,!cg(n,_)){var A=x.memoizedProps;if(c=c.compare,c=c!==null?c:vc,c(A,f)&&n.ref===a.ref)return ps(n,a,_)}return a.flags|=1,n=cs(x,f),n.ref=a.ref,n.return=a,a.child=n}function Q1(n,a,c,f,_){if(n!==null){var x=n.memoizedProps;if(vc(x,f)&&n.ref===a.ref)if(nr=!1,a.pendingProps=f=x,cg(n,_))(n.flags&131072)!==0&&(nr=!0);else return a.lanes=n.lanes,ps(n,a,_)}return rg(n,a,c,f,_)}function J1(n,a,c,f){var _=f.children,x=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(x=x!==null?x.baseLanes|c:c,n!==null){for(f=a.child=n.child,_=0;f!==null;)_=_|f.lanes|f.childLanes,f=f.sibling;f=_&~x}else f=0,a.child=null;return ew(n,a,x,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Od(a,x!==null?x.cachePool:null),x!==null?r1(a,x):jp(),i1(a);else return f=a.lanes=536870912,ew(n,a,x!==null?x.baseLanes|c:c,c,f)}else x!==null?(Od(a,x.cachePool),r1(a,x),Js(),a.memoizedState=null):(n!==null&&Od(a,null),jp(),Js());return Dr(n,a,_,c),a.child}function jc(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function ew(n,a,c,f,_){var x=Rp();return x=x===null?null:{parent:rr._currentValue,pool:x},a.memoizedState={baseLanes:c,cachePool:x},n!==null&&Od(a,null),jp(),i1(a),n!==null&&ol(n,a,f,!0),a.childLanes=_,null}function Zd(n,a){return a=Jd({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function tw(n,a,c){return io(a,n.child,null,c),n=Zd(a,a.pendingProps),n.flags|=2,Si(a),a.memoizedState=null,n}function H3(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=Zd(a,f),a.lanes=536870912,jc(null,n);if(Lp(a),(n=Tt)?(n=fS(n,Ii),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:Mn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},c=Ib(n),c.return=a,a.child=c,Mr=a,Tt=null)):n=null,n===null)throw Gs(a);return a.lanes=536870912,null}return Zd(a,f)}var x=n.memoizedState;if(x!==null){var A=x.dehydrated;if(Lp(a),_)if(a.flags&256)a.flags&=-257,a=tw(n,a,c);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(i(558));else if(nr||ol(n,a,c,!1),_=(c&n.childLanes)!==0,nr||_){if(f=Rt,f!==null&&(A=ii(f,c),A!==0&&A!==x.retryLane))throw x.retryLane=A,Ka(n,A),ui(f,n,A),tg;lh(),a=tw(n,a,c)}else n=x.treeContext,Tt=$i(A.nextSibling),Mr=a,ut=!0,Vs=null,Ii=!1,n!==null&&Ub(a,n),a=Zd(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 Qd(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 Ja(a),c=Bp(n,a,c,f,void 0,_),f=Pp(),n!==null&&!nr?(Ip(n,a,_),ps(n,a,_)):(ut&&f&&vp(a),a.flags|=1,Dr(n,a,c,_),a.child)}function rw(n,a,c,f,_,x){return Ja(a),a.updateQueue=null,c=s1(a,f,c,_),n1(n),f=Pp(),n!==null&&!nr?(Ip(n,a,x),ps(n,a,x)):(ut&&f&&vp(a),a.flags|=1,Dr(n,a,c,x),a.child)}function iw(n,a,c,f,_){if(Ja(a),a.stateNode===null){var x=il,A=c.contextType;typeof A=="object"&&A!==null&&(x=jr(A)),x=new c(f,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Jp,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=f,x.state=a.memoizedState,x.refs={},Np(a),A=c.contextType,x.context=typeof A=="object"&&A!==null?jr(A):il,x.state=a.memoizedState,A=c.getDerivedStateFromProps,typeof A=="function"&&(Qp(a,c,A,f),x.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(A=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),A!==x.state&&Jp.enqueueReplaceState(x,x.state,null),kc(a,f,x,_),Rc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(n===null){x=a.stateNode;var P=a.memoizedProps,K=so(c,P);x.props=K;var ae=x.context,de=c.contextType;A=il,typeof de=="object"&&de!==null&&(A=jr(de));var pe=c.getDerivedStateFromProps;de=typeof pe=="function"||typeof x.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,de||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(P||ae!==A)&&F1(a,x,f,A),Ks=!1;var le=a.memoizedState;x.state=le,kc(a,f,x,_),Rc(),ae=a.memoizedState,P||le!==ae||Ks?(typeof pe=="function"&&(Qp(a,c,pe,f),ae=a.memoizedState),(K=Ks||H1(a,c,K,f,le,ae,A))?(de||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ae),x.props=f,x.state=ae,x.context=A,f=K):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{x=a.stateNode,Ap(n,a),A=a.memoizedProps,de=so(c,A),x.props=de,pe=a.pendingProps,le=x.context,ae=c.contextType,K=il,typeof ae=="object"&&ae!==null&&(K=jr(ae)),P=c.getDerivedStateFromProps,(ae=typeof P=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A!==pe||le!==K)&&F1(a,x,f,K),Ks=!1,le=a.memoizedState,x.state=le,kc(a,f,x,_),Rc();var ue=a.memoizedState;A!==pe||le!==ue||Ks||n!==null&&n.dependencies!==null&&Dd(n.dependencies)?(typeof P=="function"&&(Qp(a,c,P,f),ue=a.memoizedState),(de=Ks||H1(a,c,de,f,le,ue,K)||n!==null&&n.dependencies!==null&&Dd(n.dependencies))?(ae||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ue,K),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ue,K)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ue),x.props=f,x.state=ue,x.context=K,f=de):(typeof x.componentDidUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&le===n.memoizedState||(a.flags|=1024),f=!1)}return x=f,Qd(n,a),f=(a.flags&128)!==0,x||f?(x=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,n!==null&&f?(a.child=io(a,n.child,null,_),a.child=io(a,null,c,_)):Dr(n,a,c,_),a.memoizedState=x.state,n=a.child):n=ps(n,a,_),n}function nw(n,a,c,f){return Za(),a.flags|=256,Dr(n,a,c,f),a.child}var ig={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ng(n){return{baseLanes:n,cachePool:Gb()}}function sg(n,a,c){return n=n!==null?n.childLanes&~c:0,a&&(n|=Ei),n}function sw(n,a,c){var f=a.pendingProps,_=!1,x=(a.flags&128)!==0,A;if((A=x)||(A=n!==null&&n.memoizedState===null?!1:(Qt.current&2)!==0),A&&(_=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,n===null){if(ut){if(_?Qs(a):Js(),(n=Tt)?(n=fS(n,Ii),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:qs!==null?{id:Mn,overflow:jn}:null,retryLane:536870912,hydrationErrors:null},c=Ib(n),c.return=a,a.child=c,Mr=a,Tt=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=Jd({mode:"hidden",children:P},_),f=Xa(f,_,c,null),P.return=a,f.return=a,P.sibling=f,a.child=P,f=a.child,f.memoizedState=ng(c),f.childLanes=sg(n,A,c),a.memoizedState=ig,jc(null,f)):(Qs(a),ag(a,P))}var K=n.memoizedState;if(K!==null&&(P=K.dehydrated,P!==null)){if(x)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=Jd({mode:"visible",children:f.children},_),P=Xa(P,_,c,null),P.flags|=2,f.return=a,P.return=a,f.sibling=P,a.child=f,io(a,n.child,null,c),f=a.child,f.memoizedState=ng(c),f.childLanes=sg(n,A,c),a.memoizedState=ig,a=jc(null,f));else if(Qs(a),Ug(P)){if(A=P.nextSibling&&P.nextSibling.dataset,A)var ae=A.dgst;A=ae,f=Error(i(419)),f.stack="",f.digest=A,yc({value:f,source:null,stack:null}),a=og(n,a,c)}else if(nr||ol(n,a,c,!1),A=(c&n.childLanes)!==0,nr||A){if(A=Rt,A!==null&&(f=ii(A,c),f!==0&&f!==K.retryLane))throw K.retryLane=f,Ka(n,f),ui(A,n,f),tg;$g(P)||lh(),a=og(n,a,c)}else $g(P)?(a.flags|=192,a.child=n.child,a=null):(n=K.treeContext,Tt=$i(P.nextSibling),Mr=a,ut=!0,Vs=null,Ii=!1,n!==null&&Ub(a,n),a=ag(a,f.children),a.flags|=4096);return a}return _?(Js(),P=f.fallback,_=a.mode,K=n.child,ae=K.sibling,f=cs(K,{mode:"hidden",children:f.children}),f.subtreeFlags=K.subtreeFlags&65011712,ae!==null?P=cs(ae,P):(P=Xa(P,_,c,null),P.flags|=2),P.return=a,f.return=a,f.sibling=P,a.child=f,jc(null,f),f=a.child,P=n.child.memoizedState,P===null?P=ng(c):(_=P.cachePool,_!==null?(K=rr._currentValue,_=_.parent!==K?{parent:K,pool:K}:_):_=Gb(),P={baseLanes:P.baseLanes|c,cachePool:_}),f.memoizedState=P,f.childLanes=sg(n,A,c),a.memoizedState=ig,jc(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=Jd({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Jd(n,a){return n=bi(22,n,null,a),n.lanes=0,n}function og(n,a,c){return io(a,n.child,null,c),n=ag(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function aw(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,_,x){var A=n.memoizedState;A===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:_,treeForkCount:x}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=f,A.tail=c,A.tailMode=_,A.treeForkCount=x)}function ow(n,a,c){var f=a.pendingProps,_=f.revealOrder,x=f.tail;f=f.children;var A=Qt.current,P=(A&2)!==0;if(P?(A=A&1|2,a.flags|=128):A&=1,X(Qt,A),Dr(n,a,f,c),f=ut?xc:0,!P&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&aw(n,c,a);else if(n.tag===19)aw(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&&Ud(n)===null&&(_=c),c=c.sibling;c=_,c===null?(_=a.child,a.child=null):(_=c.sibling,c.sibling=null),lg(a,!1,_,c,x,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,_=a.child,a.child=null;_!==null;){if(n=_.alternate,n!==null&&Ud(n)===null){a.child=_;break}n=_.sibling,_.sibling=c,c=_,_=n}lg(a,!0,c,null,x,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&&Dd(n)))}function F3(n,a,c){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Ys(a,rr,n.memoizedState.cache),Za();break;case 27:case 5:we(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Ys(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,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?sw(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 ow(n,a,c);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),X(Qt,Qt.current),f)break;return null;case 22:return a.lanes=0,J1(n,a,c,a.pendingProps);case 24:Ys(a,rr,n.memoizedState.cache)}return ps(n,a,c)}function lw(n,a,c){if(n!==null)if(n.memoizedProps!==a.pendingProps)nr=!0;else{if(!cg(n,c)&&(a.flags&128)===0)return nr=!1,F3(n,a,c);nr=(n.flags&131072)!==0}else nr=!1,ut&&(a.flags&1048576)!==0&&$b(a,xc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(n=to(a.elementType),a.type=n,typeof n=="function")mp(n)?(f=so(n,f),a.tag=1,a=iw(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=X1(null,a,n,f,c);break e}else if(_===z){a.tag=14,a=Z1(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,_=so(f,a.pendingProps),iw(n,a,f,_,c);case 3:e:{if(ce(a,a.stateNode.containerInfo),n===null)throw Error(i(387));f=a.pendingProps;var x=a.memoizedState;_=x.element,Ap(n,a),kc(a,f,null,c);var A=a.memoizedState;if(f=A.cache,Ys(a,rr,f),f!==x.cache&&Sp(a,[rr],c,!0),Rc(),f=A.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=nw(n,a,f,c);break e}else if(f!==_){_=Oi(Error(i(424)),a),yc(_),a=nw(n,a,f,c);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Tt=$i(n.firstChild),Mr=a,ut=!0,Vs=null,Ii=!0,c=Jb(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Za(),f===_){a=ps(n,a,c);break e}Dr(n,a,f,c)}a=a.child}return a;case 26:return Qd(n,a),n===null?(c=xS(a.type,null,a.pendingProps,null))?a.memoizedState=c:ut||(c=a.type,n=a.pendingProps,f=ph(oe.current).createElement(c),f[Tr]=a,f[ni]=n,Lr(f,c,n),_r(f),a.stateNode=f):a.memoizedState=xS(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return we(a),n===null&&ut&&(f=a.stateNode=gS(a.type,a.pendingProps,oe.current),Mr=a,Ii=!0,_=Tt,oa(a.type)?(Hg=_,Tt=$i(f.firstChild)):Tt=_),Dr(n,a,a.pendingProps.children,c),Qd(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&ut&&((_=f=Tt)&&(f=xD(f,a.type,a.pendingProps,Ii),f!==null?(a.stateNode=f,Mr=a,Tt=$i(f.firstChild),Ii=!1,_=!0):_=!1),_||Gs(a)),we(a),_=a.type,x=a.pendingProps,A=n!==null?n.memoizedProps:null,f=x.children,Pg(_,x)?f=null:A!==null&&Pg(_,A)&&(a.flags|=32),a.memoizedState!==null&&(_=Bp(n,a,L3,null,null,c),Gc._currentValue=_),Qd(n,a),Dr(n,a,f,c),a.child;case 6:return n===null&&ut&&((n=c=Tt)&&(c=yD(c,a.pendingProps,Ii),c!==null?(a.stateNode=c,Mr=a,Tt=null,n=!0):n=!1),n||Gs(a)),null;case 13:return sw(n,a,c);case 4:return ce(a,a.stateNode.containerInfo),f=a.pendingProps,n===null?a.child=io(a,null,f,c):Dr(n,a,f,c),a.child;case 11:return X1(n,a,a.type,a.pendingProps,c);case 7:return Dr(n,a,a.pendingProps,c),a.child;case 8:return Dr(n,a,a.pendingProps.children,c),a.child;case 12:return Dr(n,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,Ys(a,a.type,f.value),Dr(n,a,f.children,c),a.child;case 9:return _=a.type._context,f=a.pendingProps.children,Ja(a),_=jr(_),f=f(_),a.flags|=1,Dr(n,a,f,c),a.child;case 14:return Z1(n,a,a.type,a.pendingProps,c);case 15:return Q1(n,a,a.type,a.pendingProps,c);case 19:return ow(n,a,c);case 31:return H3(n,a,c);case 22:return J1(n,a,c,a.pendingProps);case 24:return Ja(a),f=jr(rr),n===null?(_=Rp(),_===null&&(_=Rt,x=Cp(),_.pooledCache=x,x.refCount++,x!==null&&(_.pooledCacheLanes|=c),_=x),a.memoizedState={parent:f,cache:_},Np(a),Ys(a,rr,_)):((n.lanes&c)!==0&&(Ap(n,a),kc(a,null,null,c),Rc()),_=n.memoizedState,x=a.memoizedState,_.parent!==f?(_={parent:f,cache:f},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),Ys(a,rr,f)):(f=x.cache,Ys(a,rr,f),f!==_.cache&&Sp(a,[rr],c,!0))),Dr(n,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function gs(n){n.flags|=4}function 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(Ow())n.flags|=8192;else throw ro=Pd,kp}else n.flags&=-16777217}function cw(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!CS(a))if(Ow())n.flags|=8192;else throw ro=Pd,kp}function eh(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Fe():536870912,n.lanes|=a,xl|=a)}function Dc(n,a){if(!ut)switch(n.tailMode){case"hidden":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function Mt(n){var a=n.alternate!==null&&n.alternate.child===n.child,c=0,f=0;if(a)for(var _=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags&65011712,f|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)c|=_.lanes|_.childLanes,f|=_.subtreeFlags,f|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=f,n.childLanes=c,a}function W3(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 Mt(a),null;case 1:return Mt(a),null;case 3:return c=a.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),hs(rr),ne(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(n===null||n.child===null)&&(al(a)?gs(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,yp())),Mt(a),null;case 26:var _=a.type,x=a.memoizedState;return n===null?(gs(a),x!==null?(Mt(a),cw(a,x)):(Mt(a),ug(a,_,null,f,c))):x?x!==n.memoizedState?(gs(a),Mt(a),cw(a,x)):(Mt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==f&&gs(a),Mt(a),ug(a,_,n,f,c)),null;case 27:if(_e(a),c=oe.current,_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Mt(a),null}n=ee.current,al(a)?Hb(a):(n=gS(_,f,c),a.stateNode=n,gs(a))}return Mt(a),null;case 5:if(_e(a),_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==f&&gs(a);else{if(!f){if(a.stateNode===null)throw Error(i(166));return Mt(a),null}if(x=ee.current,al(a))Hb(a);else{var A=ph(oe.current);switch(x){case 1:x=A.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:x=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":x=A.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":x=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":x=A.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?A.createElement("select",{is:f.is}):A.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?A.createElement(_,{is:f.is}):A.createElement(_)}}x[Tr]=a,x[ni]=f;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)x.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=x;e:switch(Lr(x,_,f),_){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&gs(a)}}return Mt(a),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=oe.current,al(a)){if(n=a.stateNode,c=a.memoizedProps,f=null,_=Mr,_!==null)switch(_.tag){case 27:case 5:f=_.memoizedProps}n[Tr]=a,n=!!(n.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||sS(n.nodeValue,c)),n||Gs(a,!0)}else n=ph(n).createTextNode(f),n[Tr]=a,a.stateNode=n}return Mt(a),null;case 31:if(c=a.memoizedState,n===null||n.memoizedState!==null){if(f=al(a),c!==null){if(n===null){if(!f)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Tr]=a}else Za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),n=!1}else c=yp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=c),n=!0;if(!n)return a.flags&256?(Si(a),a):(Si(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Mt(a),null;case 13:if(f=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=al(a),f!==null&&f.dehydrated!==null){if(n===null){if(!_)throw Error(i(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(i(317));_[Tr]=a}else Za(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),_=!1}else _=yp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Si(a),a):(Si(a),null)}return Si(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,n=n!==null&&n.memoizedState!==null,c&&(f=a.child,_=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(_=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==_&&(f.flags|=2048)),c!==n&&c&&(a.child.flags|=8192),eh(a,a.updateQueue),Mt(a),null);case 4:return ne(),n===null&&jg(a.stateNode.containerInfo),Mt(a),null;case 10:return hs(a.type),Mt(a),null;case 19:if(Y(Qt),f=a.memoizedState,f===null)return Mt(a),null;if(_=(a.flags&128)!==0,x=f.rendering,x===null)if(_)Dc(f,!1);else{if(Vt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(x=Ud(n),x!==null){for(a.flags|=128,Dc(f,!1),n=x.updateQueue,a.updateQueue=n,eh(a,n),a.subtreeFlags=0,n=c,c=a.child;c!==null;)Pb(c,n),c=c.sibling;return X(Qt,Qt.current&1|2),ut&&us(a,f.treeForkCount),a.child}n=n.sibling}f.tail!==null&&He()>sh&&(a.flags|=128,_=!0,Dc(f,!1),a.lanes=4194304)}else{if(!_)if(n=Ud(x),n!==null){if(a.flags|=128,_=!0,n=n.updateQueue,a.updateQueue=n,eh(a,n),Dc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!ut)return Mt(a),null}else 2*He()-f.renderingStartTime>sh&&c!==536870912&&(a.flags|=128,_=!0,Dc(f,!1),a.lanes=4194304);f.isBackwards?(x.sibling=a.child,a.child=x):(n=f.last,n!==null?n.sibling=x:a.child=x,f.last=x)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=He(),n.sibling=null,c=Qt.current,X(Qt,_?c&1|2:c&1),ut&&us(a,f.treeForkCount),n):(Mt(a),null);case 22:case 23:return Si(a),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&&(Mt(a),a.subtreeFlags&6&&(a.flags|=8192)):Mt(a),c=a.updateQueue,c!==null&&eh(a,c.retryQueue),c=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),n!==null&&Y(eo),null;case 24:return c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),hs(rr),Mt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function q3(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(rr),ne(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return _e(a),null;case 31:if(a.memoizedState!==null){if(Si(a),a.alternate===null)throw Error(i(340));Za()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Si(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Za()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Y(Qt),null;case 4:return ne(),null;case 10:return hs(a.type),null;case 22:case 23:return Si(a),Dp(),n!==null&&Y(eo),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return hs(rr),null;case 25:return null;default:return null}}function uw(n,a){switch(_p(a),a.tag){case 3:hs(rr),ne();break;case 26:case 27:case 5:_e(a);break;case 4:ne();break;case 31:a.memoizedState!==null&&Si(a);break;case 13:Si(a);break;case 19:Y(Qt);break;case 10:hs(a.type);break;case 22:case 23:Si(a),Dp(),n!==null&&Y(eo);break;case 24:hs(rr)}}function Lc(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 x=c.create,A=c.inst;f=x(),A.destroy=f}c=c.next}while(c!==_)}}catch(P){_t(a,a.return,P)}}function ea(n,a,c){try{var f=a.updateQueue,_=f!==null?f.lastEffect:null;if(_!==null){var x=_.next;f=x;do{if((f.tag&n)===n){var A=f.inst,P=A.destroy;if(P!==void 0){A.destroy=void 0,_=a;var K=c,ae=P;try{ae()}catch(de){_t(_,K,de)}}}f=f.next}while(f!==x)}}catch(de){_t(a,a.return,de)}}function dw(n){var a=n.updateQueue;if(a!==null){var c=n.stateNode;try{t1(a,c)}catch(f){_t(n,n.return,f)}}}function hw(n,a,c){c.props=so(n.type,n.memoizedProps),c.state=n.memoizedState;try{c.componentWillUnmount()}catch(f){_t(n,a,f)}}function Oc(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(_){_t(n,a,_)}}function Dn(n,a){var c=n.ref,f=n.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(_){_t(n,a,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(_){_t(n,a,_)}else c.current=null}function fw(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(_){_t(n,n.return,_)}}function dg(n,a,c){try{var f=n.stateNode;fD(f,n.type,c,a),f[ni]=a}catch(_){_t(n,n.return,_)}}function mw(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||mw(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 th(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(th(n,a,c),n=n.sibling;n!==null;)th(n,a,c),n=n.sibling}function pw(n){var a=n.stateNode,c=n.memoizedProps;try{for(var f=n.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);Lr(a,f,c),a[Tr]=n,a[ni]=c}catch(x){_t(n,n.return,x)}}var vs=!1,sr=!1,mg=!1,gw=typeof WeakSet=="function"?WeakSet:Set,xr=null;function V3(n,a){if(n=n.containerInfo,Og=wh,n=Nb(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,x=f.focusNode;f=f.focusOffset;try{c.nodeType,x.nodeType}catch{c=null;break e}var A=0,P=-1,K=-1,ae=0,de=0,pe=n,le=null;t:for(;;){for(var ue;pe!==c||_!==0&&pe.nodeType!==3||(P=A+_),pe!==x||f!==0&&pe.nodeType!==3||(K=A+f),pe.nodeType===3&&(A+=pe.nodeValue.length),(ue=pe.firstChild)!==null;)le=pe,pe=ue;for(;;){if(pe===n)break t;if(le===c&&++ae===_&&(P=A),le===x&&++de===f&&(K=A),(ue=pe.nextSibling)!==null)break;pe=le,le=pe.parentNode}pe=ue}c=P===-1||K===-1?null:{start:P,end:K}}else c=null}c=c||{start:0,end:0}}else c=null;for(Bg={focusedElem:n,selectionRange:c},wh=!1,xr=a;xr!==null;)if(a=xr,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,xr=n;else for(;xr!==null;){switch(a=xr,x=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&&x!==null){n=void 0,c=a,_=x.memoizedProps,x=x.memoizedState,f=c.stateNode;try{var je=so(c.type,_);n=f.getSnapshotBeforeUpdate(je,x),f.__reactInternalSnapshotBeforeUpdate=n}catch($e){_t(c,c.return,$e)}}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,xr=n;break}xr=a.return}}function vw(n,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:xs(n,c),f&4&&Lc(5,c);break;case 1:if(xs(n,c),f&4)if(n=c.stateNode,a===null)try{n.componentDidMount()}catch(A){_t(c,c.return,A)}else{var _=so(c.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(_,a,n.__reactInternalSnapshotBeforeUpdate)}catch(A){_t(c,c.return,A)}}f&64&&dw(c),f&512&&Oc(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{t1(n,a)}catch(A){_t(c,c.return,A)}}break;case 27:a===null&&f&4&&pw(c);case 26:case 5:xs(n,c),a===null&&f&4&&fw(c),f&512&&Oc(c,c.return);break;case 12:xs(n,c);break;case 31:xs(n,c),f&4&&yw(n,c);break;case 13:xs(n,c),f&4&&bw(n,c),f&64&&(n=c.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(c=tD.bind(null,c),bD(n,c))));break;case 22:if(f=c.memoizedState!==null||vs,!f){a=a!==null&&a.memoizedState!==null||sr,_=vs;var x=sr;vs=f,(sr=a)&&!x?ys(n,c,(c.subtreeFlags&8772)!==0):xs(n,c),vs=_,sr=x}break;case 30:break;default:xs(n,c)}}function _w(n){var a=n.alternate;a!==null&&(n.alternate=null,_w(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 Pt=null,ai=!1;function _s(n,a,c){for(c=c.child;c!==null;)xw(n,a,c),c=c.sibling}function xw(n,a,c){if(Ar&&typeof Ar.onCommitFiberUnmount=="function")try{Ar.onCommitFiberUnmount(is,c)}catch{}switch(c.tag){case 26:sr||Dn(c,a),_s(n,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:sr||Dn(c,a);var f=Pt,_=ai;oa(c.type)&&(Pt=c.stateNode,ai=!1),_s(n,a,c),Wc(c.stateNode),Pt=f,ai=_;break;case 5:sr||Dn(c,a);case 6:if(f=Pt,_=ai,Pt=null,_s(n,a,c),Pt=f,ai=_,Pt!==null)if(ai)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(c.stateNode)}catch(x){_t(c,a,x)}else try{Pt.removeChild(c.stateNode)}catch(x){_t(c,a,x)}break;case 18:Pt!==null&&(ai?(n=Pt,dS(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,c.stateNode),kl(n)):dS(Pt,c.stateNode));break;case 4:f=Pt,_=ai,Pt=c.stateNode.containerInfo,ai=!0,_s(n,a,c),Pt=f,ai=_;break;case 0:case 11:case 14:case 15:ea(2,c,a),sr||ea(4,c,a),_s(n,a,c);break;case 1:sr||(Dn(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&hw(c,a,f)),_s(n,a,c);break;case 21:_s(n,a,c);break;case 22:sr=(f=sr)||c.memoizedState!==null,_s(n,a,c),sr=f;break;default:_s(n,a,c)}}function yw(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{kl(n)}catch(c){_t(a,a.return,c)}}}function bw(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){_t(a,a.return,c)}}function G3(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new gw),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new gw),a;default:throw Error(i(435,n.tag))}}function rh(n,a){var c=G3(n);a.forEach(function(f){if(!c.has(f)){c.add(f);var _=rD.bind(null,n,f);f.then(_,_)}})}function oi(n,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var _=c[f],x=n,A=a,P=A;e:for(;P!==null;){switch(P.tag){case 27:if(oa(P.type)){Pt=P.stateNode,ai=!1;break e}break;case 5:Pt=P.stateNode,ai=!1;break e;case 3:case 4:Pt=P.stateNode.containerInfo,ai=!0;break e}P=P.return}if(Pt===null)throw Error(i(160));xw(x,A,_),Pt=null,ai=!1,x=_.alternate,x!==null&&(x.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)ww(a,n),a=a.sibling}var cn=null;function ww(n,a){var c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:oi(a,n),li(n),f&4&&(ea(3,n,n.return),Lc(3,n),ea(5,n,n.return));break;case 1:oi(a,n),li(n),f&512&&(sr||c===null||Dn(c,c.return)),f&64&&vs&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(c=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var _=cn;if(oi(a,n),li(n),f&512&&(sr||c===null||Dn(c,c.return)),f&4){var x=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":x=_.getElementsByTagName("title")[0],(!x||x[lc]||x[Tr]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=_.createElement(f),_.head.insertBefore(x,_.querySelector("head > title"))),Lr(x,f,c),x[Tr]=n,_r(x),f=x;break e;case"link":var A=wS("link","href",_).get(f+(c.href||""));if(A){for(var P=0;P<A.length;P++)if(x=A[P],x.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&x.getAttribute("rel")===(c.rel==null?null:c.rel)&&x.getAttribute("title")===(c.title==null?null:c.title)&&x.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){A.splice(P,1);break t}}x=_.createElement(f),Lr(x,f,c),_.head.appendChild(x);break;case"meta":if(A=wS("meta","content",_).get(f+(c.content||""))){for(P=0;P<A.length;P++)if(x=A[P],x.getAttribute("content")===(c.content==null?null:""+c.content)&&x.getAttribute("name")===(c.name==null?null:c.name)&&x.getAttribute("property")===(c.property==null?null:c.property)&&x.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&x.getAttribute("charset")===(c.charSet==null?null:c.charSet)){A.splice(P,1);break t}}x=_.createElement(f),Lr(x,f,c),_.head.appendChild(x);break;default:throw Error(i(468,f))}x[Tr]=n,_r(x),f=x}n.stateNode=f}else SS(_,n.type,n.stateNode);else n.stateNode=bS(_,f,n.memoizedProps);else x!==f?(x===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):x.count--,f===null?SS(_,n.type,n.stateNode):bS(_,f,n.memoizedProps)):f===null&&n.stateNode!==null&&dg(n,n.memoizedProps,c.memoizedProps)}break;case 27:oi(a,n),li(n),f&512&&(sr||c===null||Dn(c,c.return)),c!==null&&f&4&&dg(n,n.memoizedProps,c.memoizedProps);break;case 5:if(oi(a,n),li(n),f&512&&(sr||c===null||Dn(c,c.return)),n.flags&32){_=n.stateNode;try{Xo(_,"")}catch(je){_t(n,n.return,je)}}f&4&&n.stateNode!=null&&(_=n.memoizedProps,dg(n,_,c!==null?c.memoizedProps:_)),f&1024&&(mg=!0);break;case 6:if(oi(a,n),li(n),f&4){if(n.stateNode===null)throw Error(i(162));f=n.memoizedProps,c=n.stateNode;try{c.nodeValue=f}catch(je){_t(n,n.return,je)}}break;case 3:if(_h=null,_=cn,cn=gh(a.containerInfo),oi(a,n),cn=_,li(n),f&4&&c!==null&&c.memoizedState.isDehydrated)try{kl(a.containerInfo)}catch(je){_t(n,n.return,je)}mg&&(mg=!1,Sw(n));break;case 4:f=cn,cn=gh(n.stateNode.containerInfo),oi(a,n),li(n),cn=f;break;case 12:oi(a,n),li(n);break;case 31:oi(a,n),li(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,rh(n,f)));break;case 13:oi(a,n),li(n),n.child.flags&8192&&n.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(nh=He()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,rh(n,f)));break;case 22:_=n.memoizedState!==null;var K=c!==null&&c.memoizedState!==null,ae=vs,de=sr;if(vs=ae||_,sr=de||K,oi(a,n),sr=de,vs=ae,li(n),f&8192)e:for(a=n.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(c===null||K||vs||sr||ao(n)),c=null,a=n;;){if(a.tag===5||a.tag===26){if(c===null){K=c=a;try{if(x=K.stateNode,_)A=x.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{P=K.stateNode;var pe=K.memoizedProps.style,le=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;P.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(je){_t(K,K.return,je)}}}else if(a.tag===6){if(c===null){K=a;try{K.stateNode.nodeValue=_?"":K.memoizedProps}catch(je){_t(K,K.return,je)}}}else if(a.tag===18){if(c===null){K=a;try{var ue=K.stateNode;_?hS(ue,!0):hS(K.stateNode,!1)}catch(je){_t(K,K.return,je)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=n.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,rh(n,c))));break;case 19:oi(a,n),li(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,rh(n,f)));break;case 30:break;case 21:break;default:oi(a,n),li(n)}}function li(n){var a=n.flags;if(a&2){try{for(var c,f=n.return;f!==null;){if(mw(f)){c=f;break}f=f.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var _=c.stateNode,x=hg(n);th(n,x,_);break;case 5:var A=c.stateNode;c.flags&32&&(Xo(A,""),c.flags&=-33);var P=hg(n);th(n,P,A);break;case 3:case 4:var K=c.stateNode.containerInfo,ae=hg(n);fg(n,ae,K);break;default:throw Error(i(161))}}catch(de){_t(n,n.return,de)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Sw(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Sw(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;)vw(n,a.alternate,a),a=a.sibling}function ao(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ea(4,a,a.return),ao(a);break;case 1:Dn(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&hw(a,a.return,c),ao(a);break;case 27:Wc(a.stateNode);case 26:case 5:Dn(a,a.return),ao(a);break;case 22:a.memoizedState===null&&ao(a);break;case 30:ao(a);break;default:ao(a)}n=n.sibling}}function ys(n,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,_=n,x=a,A=x.flags;switch(x.tag){case 0:case 11:case 15:ys(_,x,c),Lc(4,x);break;case 1:if(ys(_,x,c),f=x,_=f.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ae){_t(f,f.return,ae)}if(f=x,_=f.updateQueue,_!==null){var P=f.stateNode;try{var K=_.shared.hiddenCallbacks;if(K!==null)for(_.shared.hiddenCallbacks=null,_=0;_<K.length;_++)e1(K[_],P)}catch(ae){_t(f,f.return,ae)}}c&&A&64&&dw(x),Oc(x,x.return);break;case 27:pw(x);case 26:case 5:ys(_,x,c),c&&f===null&&A&4&&fw(x),Oc(x,x.return);break;case 12:ys(_,x,c);break;case 31:ys(_,x,c),c&&A&4&&yw(_,x);break;case 13:ys(_,x,c),c&&A&4&&bw(_,x);break;case 22:x.memoizedState===null&&ys(_,x,c),Oc(x,x.return);break;case 30:break;default:ys(_,x,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&&bc(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&&bc(n))}function un(n,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Cw(n,a,c,f),a=a.sibling}function Cw(n,a,c,f){var _=a.flags;switch(a.tag){case 0:case 11:case 15:un(n,a,c,f),_&2048&&Lc(9,a);break;case 1:un(n,a,c,f);break;case 3:un(n,a,c,f),_&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&bc(n)));break;case 12:if(_&2048){un(n,a,c,f),n=a.stateNode;try{var x=a.memoizedProps,A=x.id,P=x.onPostCommit;typeof P=="function"&&P(A,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(K){_t(a,a.return,K)}}else un(n,a,c,f);break;case 31:un(n,a,c,f);break;case 13:un(n,a,c,f);break;case 23:break;case 22:x=a.stateNode,A=a.alternate,a.memoizedState!==null?x._visibility&2?un(n,a,c,f):Bc(n,a):x._visibility&2?un(n,a,c,f):(x._visibility|=2,gl(n,a,c,f,(a.subtreeFlags&10256)!==0||!1)),_&2048&&pg(A,a);break;case 24:un(n,a,c,f),_&2048&&gg(a.alternate,a);break;default:un(n,a,c,f)}}function gl(n,a,c,f,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=n,A=a,P=c,K=f,ae=A.flags;switch(A.tag){case 0:case 11:case 15:gl(x,A,P,K,_),Lc(8,A);break;case 23:break;case 22:var de=A.stateNode;A.memoizedState!==null?de._visibility&2?gl(x,A,P,K,_):Bc(x,A):(de._visibility|=2,gl(x,A,P,K,_)),_&&ae&2048&&pg(A.alternate,A);break;case 24:gl(x,A,P,K,_),_&&ae&2048&&gg(A.alternate,A);break;default:gl(x,A,P,K,_)}a=a.sibling}}function Bc(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=n,f=a,_=f.flags;switch(f.tag){case 22:Bc(c,f),_&2048&&pg(f.alternate,f);break;case 24:Bc(c,f),_&2048&&gg(f.alternate,f);break;default:Bc(c,f)}a=a.sibling}}var Pc=8192;function vl(n,a,c){if(n.subtreeFlags&Pc)for(n=n.child;n!==null;)Ew(n,a,c),n=n.sibling}function Ew(n,a,c){switch(n.tag){case 26:vl(n,a,c),n.flags&Pc&&n.memoizedState!==null&&DD(c,cn,n.memoizedState,n.memoizedProps);break;case 5:vl(n,a,c);break;case 3:case 4:var f=cn;cn=gh(n.stateNode.containerInfo),vl(n,a,c),cn=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=Pc,Pc=16777216,vl(n,a,c),Pc=f):vl(n,a,c));break;default:vl(n,a,c)}}function Rw(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 Ic(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];xr=f,Nw(f,n)}Rw(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)kw(n),n=n.sibling}function kw(n){switch(n.tag){case 0:case 11:case 15:Ic(n),n.flags&2048&&ea(9,n,n.return);break;case 3:Ic(n);break;case 12:Ic(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,ih(n)):Ic(n);break;default:Ic(n)}}function ih(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];xr=f,Nw(f,n)}Rw(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ea(8,a,a.return),ih(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,ih(a));break;default:ih(a)}n=n.sibling}}function Nw(n,a){for(;xr!==null;){var c=xr;switch(c.tag){case 0:case 11:case 15:ea(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:bc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,xr=f;else e:for(c=n;xr!==null;){f=xr;var _=f.sibling,x=f.return;if(_w(f),f===c){xr=null;break e}if(_!==null){_.return=x,xr=_;break e}xr=x}}}var Y3={getCacheForType:function(n){var a=jr(rr),c=a.data.get(n);return c===void 0&&(c=n(),a.data.set(n,c)),c},cacheSignal:function(){return jr(rr).controller.signal}},K3=typeof WeakMap=="function"?WeakMap:Map,mt=0,Rt=null,nt=null,ot=0,vt=0,Ci=null,ta=!1,_l=!1,vg=!1,bs=0,Vt=0,ra=0,oo=0,_g=0,Ei=0,xl=0,zc=null,ci=null,xg=!1,nh=0,Aw=0,sh=1/0,ah=null,ia=null,dr=0,na=null,yl=null,ws=0,yg=0,bg=null,Tw=null,$c=0,wg=null;function Ri(){return(mt&2)!==0&&ot!==0?ot&-ot:T.T!==null?Ng():Hm()}function Mw(){if(Ei===0)if((ot&536870912)===0||ut){var n=ss;ss<<=1,(ss&3932160)===0&&(ss=262144),Ei=n}else Ei=536870912;return n=wi.current,n!==null&&(n.flags|=32),Ei}function ui(n,a,c){(n===Rt&&(vt===2||vt===9)||n.cancelPendingCommit!==null)&&(bl(n,0),sa(n,ot,Ei,!1)),Xe(n,c),((mt&2)===0||n!==Rt)&&(n===Rt&&((mt&2)===0&&(oo|=c),Vt===4&&sa(n,ot,Ei,!1)),Ln(n))}function jw(n,a,c){if((mt&6)!==0)throw Error(i(327));var f=!c&&(a&127)===0&&(a&n.expiredLanes)===0||me(n,a),_=f?Q3(n,a):Cg(n,a,!0),x=f;do{if(_===0){_l&&!f&&sa(n,a,0,!1);break}else{if(c=n.current.alternate,x&&!X3(c)){_=Cg(n,a,!1),x=!1;continue}if(_===2){if(x=a,n.errorRecoveryDisabledLanes&x)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;_=zc;var K=P.current.memoizedState.isDehydrated;if(K&&(bl(P,A).flags|=256),A=Cg(P,A,!1),A!==2){if(vg&&!K){P.errorRecoveryDisabledLanes|=x,oo|=x,_=4;break e}x=ci,ci=_,x!==null&&(ci===null?ci=x:ci.push.apply(ci,x))}_=A}if(x=!1,_!==2)continue}}if(_===1){bl(n,0),sa(n,a,0,!0);break}e:{switch(f=n,x=_,x){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:sa(f,a,Ei,!ta);break e;case 2:ci=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(_=nh+300-He(),10<_)){if(sa(f,a,Ei,!ta),Ue(f,0,!0)!==0)break e;ws=a,f.timeoutHandle=cS(Dw.bind(null,f,c,ci,ah,xg,a,Ei,oo,xl,ta,x,"Throttled",-0,0),_);break e}Dw(f,c,ci,ah,xg,a,Ei,oo,xl,ta,x,null,-0,0)}}break}while(!0);Ln(n)}function Dw(n,a,c,f,_,x,A,P,K,ae,de,pe,le,ue){if(n.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:os},Ew(a,x,pe);var je=(x&62914560)===x?nh-He():(x&4194048)===x?Aw-He():0;if(je=LD(pe,je),je!==null){ws=x,n.cancelPendingCommit=je(Uw.bind(null,n,a,x,c,f,_,A,P,K,de,pe,null,le,ue)),sa(n,x,A,!ae);return}}Uw(n,a,x,c,f,_,A,P,K)}function X3(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],x=_.getSnapshot;_=_.value;try{if(!yi(x(),_))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&=~oo,n.suspendedLanes|=a,n.pingedLanes&=~a,f&&(n.warmLanes|=a),f=n.expirationTimes;for(var _=a;0<_;){var x=31-vr(_),A=1<<x;f[x]=-1,_&=~A}c!==0&&ri(n,c,a)}function oh(){return(mt&6)===0?(Uc(0),!1):!0}function Sg(){if(nt!==null){if(vt===0)var n=nt.return;else n=nt,ds=Qa=null,zp(n),dl=null,Sc=0,n=nt;for(;n!==null;)uw(n.alternate,n),n=n.return;nt=null}}function bl(n,a){var c=n.timeoutHandle;c!==-1&&(n.timeoutHandle=-1,gD(c)),c=n.cancelPendingCommit,c!==null&&(n.cancelPendingCommit=null,c()),ws=0,Sg(),Rt=n,nt=c=cs(n.current,null),ot=a,vt=0,Ci=null,ta=!1,_l=me(n,a),vg=!1,xl=Ei=_g=oo=ra=Vt=0,ci=zc=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-vr(f),x=1<<_;a|=n[_],f&=~x}return bs=a,Nd(),c}function Lw(n,a){Ke=null,T.H=Mc,a===ul||a===Bd?(a=Xb(),vt=3):a===kp?(a=Xb(),vt=4):vt=a===tg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ci=a,nt===null&&(Vt=1,Xd(n,Oi(a,n.current)))}function Ow(){var n=wi.current;return n===null?!0:(ot&4194048)===ot?zi===null:(ot&62914560)===ot||(ot&536870912)!==0?n===zi:!1}function Bw(){var n=T.H;return T.H=Mc,n===null?Mc:n}function Pw(){var n=T.A;return T.A=Y3,n}function lh(){Vt=4,ta||(ot&4194048)!==ot&&wi.current!==null||(_l=!0),(ra&134217727)===0&&(oo&134217727)===0||Rt===null||sa(Rt,ot,Ei,!1)}function Cg(n,a,c){var f=mt;mt|=2;var _=Bw(),x=Pw();(Rt!==n||ot!==a)&&(ah=null,bl(n,a)),a=!1;var A=Vt;e:do try{if(vt!==0&&nt!==null){var P=nt,K=Ci;switch(vt){case 8:Sg(),A=6;break e;case 3:case 2:case 9:case 6:wi.current===null&&(a=!0);var ae=vt;if(vt=0,Ci=null,wl(n,P,K,ae),c&&_l){A=0;break e}break;default:ae=vt,vt=0,Ci=null,wl(n,P,K,ae)}}Z3(),A=Vt;break}catch(de){Lw(n,de)}while(!0);return a&&n.shellSuspendCounter++,ds=Qa=null,mt=f,T.H=_,T.A=x,nt===null&&(Rt=null,ot=0,Nd()),A}function Z3(){for(;nt!==null;)Iw(nt)}function Q3(n,a){var c=mt;mt|=2;var f=Bw(),_=Pw();Rt!==n||ot!==a?(ah=null,sh=He()+500,bl(n,a)):_l=me(n,a);e:do try{if(vt!==0&&nt!==null){a=nt;var x=Ci;t:switch(vt){case 1:vt=0,Ci=null,wl(n,a,x,1);break;case 2:case 9:if(Yb(x)){vt=0,Ci=null,zw(a);break}a=function(){vt!==2&&vt!==9||Rt!==n||(vt=7),Ln(n)},x.then(a,a);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Yb(x)?(vt=0,Ci=null,zw(a)):(vt=0,Ci=null,wl(n,a,x,7));break;case 5:var A=null;switch(nt.tag){case 26:A=nt.memoizedState;case 5:case 27:var P=nt;if(A?CS(A):P.stateNode.complete){vt=0,Ci=null;var K=P.sibling;if(K!==null)nt=K;else{var ae=P.return;ae!==null?(nt=ae,ch(ae)):nt=null}break t}}vt=0,Ci=null,wl(n,a,x,5);break;case 6:vt=0,Ci=null,wl(n,a,x,6);break;case 8:Sg(),Vt=6;break e;default:throw Error(i(462))}}J3();break}catch(de){Lw(n,de)}while(!0);return ds=Qa=null,T.H=f,T.A=_,mt=c,nt!==null?0:(Rt=null,ot=0,Nd(),Vt)}function J3(){for(;nt!==null&&!Be();)Iw(nt)}function Iw(n){var a=lw(n.alternate,n,bs);n.memoizedProps=n.pendingProps,a===null?ch(n):nt=a}function zw(n){var a=n,c=a.alternate;switch(a.tag){case 15:case 0:a=rw(c,a,a.pendingProps,a.type,void 0,ot);break;case 11:a=rw(c,a,a.pendingProps,a.type.render,a.ref,ot);break;case 5:zp(a);default:uw(c,a),a=nt=Pb(a,bs),a=lw(c,a,bs)}n.memoizedProps=n.pendingProps,a===null?ch(n):nt=a}function wl(n,a,c,f){ds=Qa=null,zp(a),dl=null,Sc=0;var _=a.return;try{if(U3(n,_,a,c,ot)){Vt=1,Xd(n,Oi(c,n.current)),nt=null;return}}catch(x){if(_!==null)throw nt=_,x;Vt=1,Xd(n,Oi(c,n.current)),nt=null;return}a.flags&32768?(ut||f===1?n=!0:_l||(ot&536870912)!==0?n=!1:(ta=n=!0,(f===2||f===9||f===3||f===6)&&(f=wi.current,f!==null&&f.tag===13&&(f.flags|=16384))),$w(a,n)):ch(a)}function ch(n){var a=n;do{if((a.flags&32768)!==0){$w(a,ta);return}n=a.return;var c=W3(a.alternate,a,bs);if(c!==null){nt=c;return}if(a=a.sibling,a!==null){nt=a;return}nt=a=n}while(a!==null);Vt===0&&(Vt=5)}function $w(n,a){do{var c=q3(n.alternate,n);if(c!==null){c.flags&=32767,nt=c;return}if(c=n.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(n=n.sibling,n!==null)){nt=n;return}nt=n=c}while(n!==null);Vt=6,nt=null}function Uw(n,a,c,f,_,x,A,P,K){n.cancelPendingCommit=null;do uh();while(dr!==0);if((mt&6)!==0)throw Error(i(327));if(a!==null){if(a===n.current)throw Error(i(177));if(x=a.lanes|a.childLanes,x|=hp,Ft(n,c,x,A,P,K),n===Rt&&(nt=Rt=null,ot=0),yl=a,na=n,ws=c,yg=x,bg=_,Tw=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,iD(Bt,function(){return Vw(),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{V3(n,a,c)}finally{mt=A,U.p=_,T.T=f}}dr=1,Hw(),Fw(),Ww()}}function Hw(){if(dr===1){dr=0;var n=na,a=yl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=mt;mt|=4;try{ww(a,n);var x=Bg,A=Nb(n.containerInfo),P=x.focusedElem,K=x.selectionRange;if(A!==P&&P&&P.ownerDocument&&kb(P.ownerDocument.documentElement,P)){if(K!==null&&op(P)){var ae=K.start,de=K.end;if(de===void 0&&(de=ae),"selectionStart"in P)P.selectionStart=ae,P.selectionEnd=Math.min(de,P.value.length);else{var pe=P.ownerDocument||document,le=pe&&pe.defaultView||window;if(le.getSelection){var ue=le.getSelection(),je=P.textContent.length,$e=Math.min(K.start,je),St=K.end===void 0?$e:Math.min(K.end,je);!ue.extend&&$e>St&&(A=St,St=$e,$e=A);var te=Rb(P,$e),Q=Rb(P,St);if(te&&Q&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var se=pe.createRange();se.setStart(te.node,te.offset),ue.removeAllRanges(),$e>St?(ue.addRange(se),ue.extend(Q.node,Q.offset)):(se.setEnd(Q.node,Q.offset),ue.addRange(se))}}}}for(pe=[],ue=P;ue=ue.parentNode;)ue.nodeType===1&&pe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<pe.length;P++){var fe=pe[P];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}wh=!!Og,Bg=Og=null}finally{mt=_,U.p=f,T.T=c}}n.current=a,dr=2}}function Fw(){if(dr===2){dr=0;var n=na,a=yl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=T.T,T.T=null;var f=U.p;U.p=2;var _=mt;mt|=4;try{vw(n,a.alternate,a)}finally{mt=_,U.p=f,T.T=c}}dr=3}}function Ww(){if(dr===4||dr===3){dr=0,dt();var n=na,a=yl,c=ws,f=Tw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?dr=5:(dr=0,yl=na=null,qw(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(ia=null),on(c),a=a.stateNode,Ar&&typeof Ar.onCommitFiberRoot=="function")try{Ar.onCommitFiberRoot(is,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=T.T,_=U.p,U.p=2,T.T=null;try{for(var x=n.onRecoverableError,A=0;A<f.length;A++){var P=f[A];x(P.value,{componentStack:P.stack})}}finally{T.T=a,U.p=_}}(ws&3)!==0&&uh(),Ln(n),_=n.pendingLanes,(c&261930)!==0&&(_&42)!==0?n===wg?$c++:($c=0,wg=n):$c=0,Uc(0)}}function qw(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,bc(a)))}function uh(){return Hw(),Fw(),Ww(),Vw()}function Vw(){if(dr!==5)return!1;var n=na,a=yg;yg=0;var c=on(ws),f=T.T,_=U.p;try{U.p=32>c?32:c,T.T=null,c=bg,bg=null;var x=na,A=ws;if(dr=0,yl=na=null,ws=0,(mt&6)!==0)throw Error(i(331));var P=mt;if(mt|=4,kw(x.current),Cw(x,x.current,A,c),mt=P,Uc(0,!1),Ar&&typeof Ar.onPostCommitFiberRoot=="function")try{Ar.onPostCommitFiberRoot(is,x)}catch{}return!0}finally{U.p=_,T.T=f,qw(n,a)}}function Gw(n,a,c){a=Oi(c,a),a=eg(n.stateNode,a,2),n=Zs(n,a,2),n!==null&&(Xe(n,2),Ln(n))}function _t(n,a,c){if(n.tag===3)Gw(n,n,c);else for(;a!==null;){if(a.tag===3){Gw(a,n,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ia===null||!ia.has(f))){n=Oi(c,n),c=Y1(2),f=Zs(a,c,2),f!==null&&(K1(c,f,a,n),Xe(f,2),Ln(f));break}}a=a.return}}function Eg(n,a,c){var f=n.pingCache;if(f===null){f=n.pingCache=new K3;var _=new Set;f.set(a,_)}else _=f.get(a),_===void 0&&(_=new Set,f.set(a,_));_.has(c)||(vg=!0,_.add(c),n=eD.bind(null,n,a,c),a.then(n,n))}function eD(n,a,c){var f=n.pingCache;f!==null&&f.delete(a),n.pingedLanes|=n.suspendedLanes&c,n.warmLanes&=~c,Rt===n&&(ot&c)===c&&(Vt===4||Vt===3&&(ot&62914560)===ot&&300>He()-nh?(mt&2)===0&&bl(n,0):_g|=c,xl===ot&&(xl=0)),Ln(n)}function Yw(n,a){a===0&&(a=Fe()),n=Ka(n,a),n!==null&&(Xe(n,a),Ln(n))}function tD(n){var a=n.memoizedState,c=0;a!==null&&(c=a.retryLane),Yw(n,c)}function rD(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),Yw(n,c)}function iD(n,a){return ze(n,a)}var dh=null,Sl=null,Rg=!1,hh=!1,kg=!1,aa=0;function Ln(n){n!==Sl&&n.next===null&&(Sl===null?dh=Sl=n:Sl=Sl.next=n),hh=!0,Rg||(Rg=!0,sD())}function Uc(n,a){if(!kg&&hh){kg=!0;do for(var c=!1,f=dh;f!==null;){if(n!==0){var _=f.pendingLanes;if(_===0)var x=0;else{var A=f.suspendedLanes,P=f.pingedLanes;x=(1<<31-vr(42|n)+1)-1,x&=_&~(A&~P),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Qw(f,x))}else x=ot,x=Ue(f,f===Rt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||me(f,x)||(c=!0,Qw(f,x));f=f.next}while(c);kg=!1}}function nD(){Kw()}function Kw(){hh=Rg=!1;var n=0;aa!==0&&pD()&&(n=aa);for(var a=He(),c=null,f=dh;f!==null;){var _=f.next,x=Xw(f,a);x===0?(f.next=null,c===null?dh=_:c.next=_,_===null&&(Sl=c)):(c=f,(n!==0||(x&3)!==0)&&(hh=!0)),f=_}dr!==0&&dr!==5||Uc(n),aa!==0&&(aa=0)}function Xw(n,a){for(var c=n.suspendedLanes,f=n.pingedLanes,_=n.expirationTimes,x=n.pendingLanes&-62914561;0<x;){var A=31-vr(x),P=1<<A,K=_[A];K===-1?((P&c)===0||(P&f)!==0)&&(_[A]=ke(P,a)):K<=a&&(n.expiredLanes|=P),x&=~P}if(a=Rt,c=ot,c=Ue(n,n===a?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,c===0||n===a&&(vt===2||vt===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&rt(f),n.callbackNode=null,n.callbackPriority=0;if((c&3)===0||me(n,c)){if(a=c&-c,a===n.callbackPriority)return a;switch(f!==null&&rt(f),on(c)){case 2:case 8:c=gi;break;case 32:c=Bt;break;case 268435456:c=ur;break;default:c=Bt}return f=Zw.bind(null,n),c=ze(c,f),n.callbackPriority=a,n.callbackNode=c,a}return f!==null&&f!==null&&rt(f),n.callbackPriority=2,n.callbackNode=null,2}function Zw(n,a){if(dr!==0&&dr!==5)return n.callbackNode=null,n.callbackPriority=0,null;var c=n.callbackNode;if(uh()&&n.callbackNode!==c)return null;var f=ot;return f=Ue(n,n===Rt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(jw(n,f,a),Xw(n,He()),n.callbackNode!=null&&n.callbackNode===c?Zw.bind(null,n):null)}function Qw(n,a){if(uh())return null;jw(n,a,!0)}function sD(){vD(function(){(mt&6)!==0?ze(Ht,nD):Kw()})}function Ng(){if(aa===0){var n=ll;n===0&&(n=ns,ns<<=1,(ns&261888)===0&&(ns=256)),aa=n}return aa}function Jw(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:yd(""+n)}function eS(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 aD(n,a,c,f,_){if(a==="submit"&&c&&c.stateNode===_){var x=Jw((_[ni]||null).action),A=f.submitter;A&&(a=(a=A[ni]||null)?Jw(a.formAction):A.getAttribute("formAction"),a!==null&&(x=a,A=null));var P=new Cd("action","action",null,f,_);n.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(aa!==0){var K=A?eS(_,A):new FormData(_);Yp(c,{pending:!0,data:K,method:_.method,action:x},null,K)}}else typeof x=="function"&&(P.preventDefault(),K=A?eS(_,A):new FormData(_),Yp(c,{pending:!0,data:K,method:_.method,action:x},x,K))},currentTarget:_}]})}}for(var Ag=0;Ag<dp.length;Ag++){var Tg=dp[Ag],oD=Tg.toLowerCase(),lD=Tg[0].toUpperCase()+Tg.slice(1);ln(oD,"on"+lD)}ln(Mb,"onAnimationEnd"),ln(jb,"onAnimationIteration"),ln(Db,"onAnimationStart"),ln("dblclick","onDoubleClick"),ln("focusin","onFocus"),ln("focusout","onBlur"),ln(C3,"onTransitionRun"),ln(E3,"onTransitionStart"),ln(R3,"onTransitionCancel"),ln(Lb,"onTransitionEnd"),Yo("onMouseEnter",["mouseout","mouseover"]),Yo("onMouseLeave",["mouseout","mouseover"]),Yo("onPointerEnter",["pointerout","pointerover"]),Yo("onPointerLeave",["pointerout","pointerover"]),qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hc="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(" "),cD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hc));function tS(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 x=void 0;if(a)for(var A=f.length-1;0<=A;A--){var P=f[A],K=P.instance,ae=P.currentTarget;if(P=P.listener,K!==x&&_.isPropagationStopped())break e;x=P,_.currentTarget=ae;try{x(_)}catch(de){kd(de)}_.currentTarget=null,x=K}else for(A=0;A<f.length;A++){if(P=f[A],K=P.instance,ae=P.currentTarget,P=P.listener,K!==x&&_.isPropagationStopped())break e;x=P,_.currentTarget=ae;try{x(_)}catch(de){kd(de)}_.currentTarget=null,x=K}}}}function st(n,a){var c=a[Fm];c===void 0&&(c=a[Fm]=new Set);var f=n+"__bubble";c.has(f)||(rS(a,n,2,!1),c.add(f))}function Mg(n,a,c){var f=0;a&&(f|=4),rS(c,n,f,a)}var fh="_reactListening"+Math.random().toString(36).slice(2);function jg(n){if(!n[fh]){n[fh]=!0,Ky.forEach(function(c){c!=="selectionchange"&&(cD.has(c)||Mg(c,!1,n),Mg(c,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[fh]||(a[fh]=!0,Mg("selectionchange",!1,a))}}function rS(n,a,c,f){switch(MS(a)){case 2:var _=PD;break;case 8:_=ID;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 x=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var A=f.tag;if(A===3||A===4){var P=f.stateNode.containerInfo;if(P===_)break;if(A===4)for(A=f.return;A!==null;){var K=A.tag;if((K===3||K===4)&&A.stateNode.containerInfo===_)return;A=A.return}for(;P!==null;){if(A=qo(P),A===null)return;if(K=A.tag,K===5||K===6||K===26||K===27){f=x=A;continue e}P=P.parentNode}}f=f.return}ob(function(){var ae=x,de=Xm(c),pe=[];e:{var le=Ob.get(n);if(le!==void 0){var ue=Cd,je=n;switch(n){case"keypress":if(wd(c)===0)break e;case"keydown":case"keyup":ue=r3;break;case"focusin":je="focus",ue=rp;break;case"focusout":je="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=ub;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Wj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=s3;break;case Mb:case jb:case Db:ue=Gj;break;case Lb:ue=o3;break;case"scroll":case"scrollend":ue=Hj;break;case"wheel":ue=c3;break;case"copy":case"cut":case"paste":ue=Kj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=hb;break;case"toggle":case"beforetoggle":ue=d3}var $e=(a&4)!==0,St=!$e&&(n==="scroll"||n==="scrollend"),te=$e?le!==null?le+"Capture":null:le;$e=[];for(var Q=ae,se;Q!==null;){var fe=Q;if(se=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||se===null||te===null||(fe=uc(Q,te),fe!=null&&$e.push(Fc(Q,fe,se))),St)break;Q=Q.return}0<$e.length&&(le=new ue(le,je,null,c,de),pe.push({event:le,listeners:$e}))}}if((a&7)===0){e:{if(le=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",le&&c!==Km&&(je=c.relatedTarget||c.fromElement)&&(qo(je)||je[Wo]))break e;if((ue||le)&&(le=de.window===de?de:(le=de.ownerDocument)?le.defaultView||le.parentWindow:window,ue?(je=c.relatedTarget||c.toElement,ue=ae,je=je?qo(je):null,je!==null&&(St=o(je),$e=je.tag,je!==St||$e!==5&&$e!==27&&$e!==6)&&(je=null)):(ue=null,je=ae),ue!==je)){if($e=ub,fe="onMouseLeave",te="onMouseEnter",Q="mouse",(n==="pointerout"||n==="pointerover")&&($e=hb,fe="onPointerLeave",te="onPointerEnter",Q="pointer"),St=ue==null?le:cc(ue),se=je==null?le:cc(je),le=new $e(fe,Q+"leave",ue,c,de),le.target=St,le.relatedTarget=se,fe=null,qo(de)===ae&&($e=new $e(te,Q+"enter",je,c,de),$e.target=se,$e.relatedTarget=St,fe=$e),St=fe,ue&&je)t:{for($e=uD,te=ue,Q=je,se=0,fe=te;fe;fe=$e(fe))se++;fe=0;for(var Pe=Q;Pe;Pe=$e(Pe))fe++;for(;0<se-fe;)te=$e(te),se--;for(;0<fe-se;)Q=$e(Q),fe--;for(;se--;){if(te===Q||Q!==null&&te===Q.alternate){$e=te;break t}te=$e(te),Q=$e(Q)}$e=null}else $e=null;ue!==null&&iS(pe,le,ue,$e,!1),je!==null&&St!==null&&iS(pe,St,je,$e,!0)}}e:{if(le=ae?cc(ae):window,ue=le.nodeName&&le.nodeName.toLowerCase(),ue==="select"||ue==="input"&&le.type==="file")var ht=yb;else if(_b(le))if(bb)ht=b3;else{ht=x3;var De=_3}else ue=le.nodeName,!ue||ue.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&Ym(ae.elementType)&&(ht=yb):ht=y3;if(ht&&(ht=ht(n,ae))){xb(pe,ht,c,de);break e}De&&De(n,le,ae),n==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&Gm(le,"number",le.value)}switch(De=ae?cc(ae):window,n){case"focusin":(_b(De)||De.contentEditable==="true")&&(el=De,lp=ae,_c=null);break;case"focusout":_c=lp=el=null;break;case"mousedown":cp=!0;break;case"contextmenu":case"mouseup":case"dragend":cp=!1,Ab(pe,c,de);break;case"selectionchange":if(S3)break;case"keydown":case"keyup":Ab(pe,c,de)}var Ze;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?gb(n,c)&&(lt="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(lt="onCompositionStart");lt&&(fb&&c.locale!=="ko"&&(Jo||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Jo&&(Ze=lb()):(Ws=de,Jm="value"in Ws?Ws.value:Ws.textContent,Jo=!0)),De=mh(ae,lt),0<De.length&&(lt=new db(lt,n,null,c,de),pe.push({event:lt,listeners:De}),Ze?lt.data=Ze:(Ze=vb(c),Ze!==null&&(lt.data=Ze)))),(Ze=f3?m3(n,c):p3(n,c))&&(lt=mh(ae,"onBeforeInput"),0<lt.length&&(De=new db("onBeforeInput","beforeinput",null,c,de),pe.push({event:De,listeners:lt}),De.data=Ze)),aD(pe,n,ae,c,de)}tS(pe,a)})}function Fc(n,a,c){return{instance:n,listener:a,currentTarget:c}}function mh(n,a){for(var c=a+"Capture",f=[];n!==null;){var _=n,x=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||x===null||(_=uc(n,c),_!=null&&f.unshift(Fc(n,_,x)),_=uc(n,a),_!=null&&f.push(Fc(n,_,x))),n.tag===3)return f;n=n.return}return[]}function uD(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function iS(n,a,c,f,_){for(var x=a._reactName,A=[];c!==null&&c!==f;){var P=c,K=P.alternate,ae=P.stateNode;if(P=P.tag,K!==null&&K===f)break;P!==5&&P!==26&&P!==27||ae===null||(K=ae,_?(ae=uc(c,x),ae!=null&&A.unshift(Fc(c,ae,K))):_||(ae=uc(c,x),ae!=null&&A.push(Fc(c,ae,K)))),c=c.return}A.length!==0&&n.push({event:a,listeners:A})}var dD=/\r\n?/g,hD=/\u0000|\uFFFD/g;function nS(n){return(typeof n=="string"?n:""+n).replace(dD,`
|
|
49
|
+
`).replace(hD,"")}function sS(n,a){return a=nS(a),nS(n)===a}function wt(n,a,c,f,_,x){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":_d(n,"class",f);break;case"tabIndex":_d(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":_d(n,c,f);break;case"style":sb(n,f,x);break;case"data":if(a!=="object"){_d(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=yd(""+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 x=="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=yd(""+f),n.setAttribute(c,f);break;case"onClick":f!=null&&(n.onclick=os);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}c=yd(""+f),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""+f):n.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,""):n.removeAttribute(c);break;case"capture":case"download":f===!0?n.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(c,f):n.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(c,f):n.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(c):n.setAttribute(c,f);break;case"popover":st("beforetoggle",n),st("toggle",n),vd(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":vd(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=$j.get(c)||c,vd(n,c,f))}}function Lg(n,a,c,f,_,x){switch(c){case"style":sb(n,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(c=f.__html,c!=null){if(_.children!=null)throw Error(i(60));n.innerHTML=c}}break;case"children":typeof f=="string"?Xo(n,f):(typeof f=="number"||typeof f=="bigint")&&Xo(n,""+f);break;case"onScroll":f!=null&&st("scroll",n);break;case"onScrollEnd":f!=null&&st("scrollend",n);break;case"onClick":f!=null&&(n.onclick=os);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xy.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(_=c.endsWith("Capture"),a=c.slice(2,_?c.length-7:void 0),x=n[ni]||null,x=x!=null?x[c]:null,typeof x=="function"&&n.removeEventListener(a,x,_),typeof f=="function")){typeof x!="function"&&x!==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,""):vd(n,c,f)}}}function Lr(n,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var f=!1,_=!1,x;for(x in c)if(c.hasOwnProperty(x)){var A=c[x];if(A!=null)switch(x){case"src":f=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:wt(n,a,x,A,c,null)}}_&&wt(n,a,"srcSet",c.srcSet,c,null),f&&wt(n,a,"src",c.src,c,null);return;case"input":st("invalid",n);var P=x=A=_=null,K=null,ae=null;for(f in c)if(c.hasOwnProperty(f)){var de=c[f];if(de!=null)switch(f){case"name":_=de;break;case"type":A=de;break;case"checked":K=de;break;case"defaultChecked":ae=de;break;case"value":x=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)}}tb(n,x,P,K,ae,A,_,!1);return;case"select":st("invalid",n),f=A=x=null;for(_ in c)if(c.hasOwnProperty(_)&&(P=c[_],P!=null))switch(_){case"value":x=P;break;case"defaultValue":A=P;break;case"multiple":f=P;default:wt(n,a,_,P,c,null)}a=x,c=A,n.multiple=!!f,a!=null?Ko(n,!!f,a,!1):c!=null&&Ko(n,!!f,c,!0);return;case"textarea":st("invalid",n),x=_=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":x=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(91));break;default:wt(n,a,A,P,c,null)}ib(n,f,_,x);return;case"option":for(K in c)if(c.hasOwnProperty(K)&&(f=c[K],f!=null))switch(K){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:wt(n,a,K,f,c,null)}return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(f=0;f<Hc.length;f++)st(Hc[f],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(f=c[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:wt(n,a,ae,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 fD(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,x=null,A=null,P=null,K=null,ae=null,de=null;for(ue in c){var pe=c[ue];if(c.hasOwnProperty(ue)&&pe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=pe;default:f.hasOwnProperty(ue)||wt(n,a,ue,null,f,pe)}}for(var le in f){var ue=f[le];if(pe=c[le],f.hasOwnProperty(le)&&(ue!=null||pe!=null))switch(le){case"type":x=ue;break;case"name":_=ue;break;case"checked":ae=ue;break;case"defaultChecked":de=ue;break;case"value":A=ue;break;case"defaultValue":P=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:ue!==pe&&wt(n,a,le,ue,f,pe)}}Vm(n,A,P,K,ae,de,x,_);return;case"select":ue=A=P=le=null;for(x in c)if(K=c[x],c.hasOwnProperty(x)&&K!=null)switch(x){case"value":break;case"multiple":ue=K;default:f.hasOwnProperty(x)||wt(n,a,x,null,f,K)}for(_ in f)if(x=f[_],K=c[_],f.hasOwnProperty(_)&&(x!=null||K!=null))switch(_){case"value":le=x;break;case"defaultValue":P=x;break;case"multiple":A=x;default:x!==K&&wt(n,a,_,x,f,K)}a=P,c=A,f=ue,le!=null?Ko(n,!!c,le,!1):!!f!=!!c&&(a!=null?Ko(n,!!c,a,!0):Ko(n,!!c,c?[]:"",!1));return;case"textarea":ue=le=null;for(P in c)if(_=c[P],c.hasOwnProperty(P)&&_!=null&&!f.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:wt(n,a,P,null,f,_)}for(A in f)if(_=f[A],x=c[A],f.hasOwnProperty(A)&&(_!=null||x!=null))switch(A){case"value":le=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(i(91));break;default:_!==x&&wt(n,a,A,_,f,x)}rb(n,le,ue);return;case"option":for(var je in c)if(le=c[je],c.hasOwnProperty(je)&&le!=null&&!f.hasOwnProperty(je))switch(je){case"selected":n.selected=!1;break;default:wt(n,a,je,null,f,le)}for(K in f)if(le=f[K],ue=c[K],f.hasOwnProperty(K)&&le!==ue&&(le!=null||ue!=null))switch(K){case"selected":n.selected=le&&typeof le!="function"&&typeof le!="symbol";break;default:wt(n,a,K,le,f,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var $e in c)le=c[$e],c.hasOwnProperty($e)&&le!=null&&!f.hasOwnProperty($e)&&wt(n,a,$e,null,f,le);for(ae in f)if(le=f[ae],ue=c[ae],f.hasOwnProperty(ae)&&le!==ue&&(le!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(i(137,a));break;default:wt(n,a,ae,le,f,ue)}return;default:if(Ym(a)){for(var St in c)le=c[St],c.hasOwnProperty(St)&&le!==void 0&&!f.hasOwnProperty(St)&&Lg(n,a,St,void 0,f,le);for(de in f)le=f[de],ue=c[de],!f.hasOwnProperty(de)||le===ue||le===void 0&&ue===void 0||Lg(n,a,de,le,f,ue);return}}for(var te in c)le=c[te],c.hasOwnProperty(te)&&le!=null&&!f.hasOwnProperty(te)&&wt(n,a,te,null,f,le);for(pe in f)le=f[pe],ue=c[pe],!f.hasOwnProperty(pe)||le===ue||le==null&&ue==null||wt(n,a,pe,le,f,ue)}function aS(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function mD(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var _=c[f],x=_.transferSize,A=_.initiatorType,P=_.duration;if(x&&P&&aS(A)){for(A=0,P=_.responseEnd,f+=1;f<c.length;f++){var K=c[f],ae=K.startTime;if(ae>P)break;var de=K.transferSize,pe=K.initiatorType;de&&aS(pe)&&(K=K.responseEnd,A+=de*(K<P?1:(P-ae)/(K-ae)))}if(--f,a+=8*(x+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 ph(n){return n.nodeType===9?n:n.ownerDocument}function oS(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 lS(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 pD(){var n=window.event;return n&&n.type==="popstate"?n===Ig?!1:(Ig=n,!0):(Ig=null,!1)}var cS=typeof setTimeout=="function"?setTimeout:void 0,gD=typeof clearTimeout=="function"?clearTimeout:void 0,uS=typeof Promise=="function"?Promise:void 0,vD=typeof queueMicrotask=="function"?queueMicrotask:typeof uS<"u"?function(n){return uS.resolve(null).then(n).catch(_D)}:cS;function _D(n){setTimeout(function(){throw n})}function oa(n){return n==="head"}function dS(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")Wc(n.ownerDocument.documentElement);else if(c==="head"){c=n.ownerDocument.head,Wc(c);for(var x=c.firstChild;x;){var A=x.nextSibling,P=x.nodeName;x[lc]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&x.rel.toLowerCase()==="stylesheet"||c.removeChild(x),x=A}}else c==="body"&&Wc(n.ownerDocument.body);c=_}while(c);kl(a)}function hS(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 xD(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[lc])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(x=n.getAttribute("rel"),x==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(x!==_.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(x=n.getAttribute("src"),(x!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&x&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var x=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===x)return n}else return n;if(n=$i(n.nextSibling),n===null)break}return null}function yD(n,a,c){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!c||(n=$i(n.nextSibling),n===null))return null;return n}function fS(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=$i(n.nextSibling),n===null))return null;return n}function $g(n){return n.data==="$?"||n.data==="$~"}function Ug(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function bD(n,a){var c=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function $i(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Hg=null;function mS(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"||c==="/&"){if(a===0)return $i(n.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}n=n.nextSibling}return null}function pS(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 gS(n,a,c){switch(a=ph(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 Wc(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Wm(n)}var Ui=new Map,vS=new Set;function gh(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ss=U.d;U.d={f:wD,r:SD,D:CD,C:ED,L:RD,m:kD,X:AD,S:ND,M:TD};function wD(){var n=Ss.f(),a=oh();return n||a}function SD(n){var a=Vo(n);a!==null&&a.tag===5&&a.type==="form"?L1(a):Ss.r(n)}var Cl=typeof document>"u"?null:document;function _S(n,a,c){var f=Cl;if(f&&typeof a=="string"&&a){var _=Di(a);_='link[rel="'+n+'"][href="'+_+'"]',typeof c=="string"&&(_+='[crossorigin="'+c+'"]'),vS.has(_)||(vS.add(_),n={rel:n,crossOrigin:c,href:a},f.querySelector(_)===null&&(a=f.createElement("link"),Lr(a,"link",n),_r(a),f.head.appendChild(a)))}}function CD(n){Ss.D(n),_S("dns-prefetch",n,null)}function ED(n,a){Ss.C(n,a),_S("preconnect",n,a)}function RD(n,a,c){Ss.L(n,a,c);var f=Cl;if(f&&n&&a){var _='link[rel="preload"][as="'+Di(a)+'"]';a==="image"&&c&&c.imageSrcSet?(_+='[imagesrcset="'+Di(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(_+='[imagesizes="'+Di(c.imageSizes)+'"]')):_+='[href="'+Di(n)+'"]';var x=_;switch(a){case"style":x=El(n);break;case"script":x=Rl(n)}Ui.has(x)||(n=p({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:n,as:a},c),Ui.set(x,n),f.querySelector(_)!==null||a==="style"&&f.querySelector(qc(x))||a==="script"&&f.querySelector(Vc(x))||(a=f.createElement("link"),Lr(a,"link",n),_r(a),f.head.appendChild(a)))}}function kD(n,a){Ss.m(n,a);var c=Cl;if(c&&n){var f=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+Di(f)+'"][href="'+Di(n)+'"]',x=_;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Rl(n)}if(!Ui.has(x)&&(n=p({rel:"modulepreload",href:n},a),Ui.set(x,n),c.querySelector(_)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Vc(x)))return}f=c.createElement("link"),Lr(f,"link",n),_r(f),c.head.appendChild(f)}}}function ND(n,a,c){Ss.S(n,a,c);var f=Cl;if(f&&n){var _=Go(f).hoistableStyles,x=El(n);a=a||"default";var A=_.get(x);if(!A){var P={loading:0,preload:null};if(A=f.querySelector(qc(x)))P.loading=5;else{n=p({rel:"stylesheet",href:n,"data-precedence":a},c),(c=Ui.get(x))&&Fg(n,c);var K=A=f.createElement("link");_r(K),Lr(K,"link",n),K._p=new Promise(function(ae,de){K.onload=ae,K.onerror=de}),K.addEventListener("load",function(){P.loading|=1}),K.addEventListener("error",function(){P.loading|=2}),P.loading|=4,vh(A,a,f)}A={type:"stylesheet",instance:A,count:1,state:P},_.set(x,A)}}}function AD(n,a){Ss.X(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),x=f.get(_);x||(x=c.querySelector(Vc(_)),x||(n=p({src:n,async:!0},a),(a=Ui.get(_))&&Wg(n,a),x=c.createElement("script"),_r(x),Lr(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(_,x))}}function TD(n,a){Ss.M(n,a);var c=Cl;if(c&&n){var f=Go(c).hoistableScripts,_=Rl(n),x=f.get(_);x||(x=c.querySelector(Vc(_)),x||(n=p({src:n,async:!0,type:"module"},a),(a=Ui.get(_))&&Wg(n,a),x=c.createElement("script"),_r(x),Lr(x,"link",n),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(_,x))}}function xS(n,a,c,f){var _=(_=oe.current)?gh(_):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 x=Go(_).hoistableStyles,A=x.get(n);if(A||(_=_.ownerDocument||_,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(n,A),(x=_.querySelector(qc(n)))&&!x._p&&(A.instance=x,A.state.loading=5),Ui.has(n)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ui.set(n,c),x||MD(_,n,c,A.state))),a&&f===null)throw Error(i(528,""));return A}if(a&&f!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Rl(c),c=Go(_).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function El(n){return'href="'+Di(n)+'"'}function qc(n){return'link[rel="stylesheet"]['+n+"]"}function yS(n){return p({},n,{"data-precedence":n.precedence,precedence:null})}function MD(n,a,c,f){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=n.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Lr(a,"link",c),_r(a),n.head.appendChild(a))}function Rl(n){return'[src="'+Di(n)+'"]'}function Vc(n){return"script[async]"+n}function bS(n,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=n.querySelector('style[data-href~="'+Di(c.href)+'"]');if(f)return a.instance=f,_r(f),f;var _=p({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),_r(f),Lr(f,"style",_),vh(f,c.precedence,n),a.instance=f;case"stylesheet":_=El(c.href);var x=n.querySelector(qc(_));if(x)return a.state.loading|=4,a.instance=x,_r(x),x;f=yS(c),(_=Ui.get(_))&&Fg(f,_),x=(n.ownerDocument||n).createElement("link"),_r(x);var A=x;return A._p=new Promise(function(P,K){A.onload=P,A.onerror=K}),Lr(x,"link",f),a.state.loading|=4,vh(x,c.precedence,n),a.instance=x;case"script":return x=Rl(c.src),(_=n.querySelector(Vc(x)))?(a.instance=_,_r(_),_):(f=c,(_=Ui.get(x))&&(f=p({},c),Wg(f,_)),n=n.ownerDocument||n,_=n.createElement("script"),_r(_),Lr(_,"link",f),n.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,vh(f,c.precedence,n));return a.instance}function vh(n,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=f.length?f[f.length-1]:null,x=_,A=0;A<f.length;A++){var P=f[A];if(P.dataset.precedence===a)x=P;else if(x!==_)break}x?x.parentNode.insertBefore(n,x.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 _h=null;function wS(n,a,c){if(_h===null){var f=new Map,_=_h=new Map;_.set(c,f)}else _=_h,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 x=c[_];if(!(x[lc]||x[Tr]||n==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var A=x.getAttribute(a)||"";A=n+A;var P=f.get(A);P?P.push(x):f.set(A,[x])}}return f}function SS(n,a,c){n=n.ownerDocument||n,n.head.insertBefore(c,a==="title"?n.querySelector("head > title"):null)}function jD(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 CS(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function DD(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),x=a.querySelector(qc(_));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=xh.bind(n),a.then(n,n)),c.state.loading|=4,c.instance=x,_r(x);return}x=a.ownerDocument||a,f=yS(f),(_=Ui.get(_))&&Fg(f,_),x=x.createElement("link"),_r(x);var A=x;A._p=new Promise(function(P,K){A.onload=P,A.onerror=K}),Lr(x,"link",f),c.instance=x}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(n.count++,c=xh.bind(n),a.addEventListener("load",c),a.addEventListener("error",c))}}var qg=0;function LD(n,a){return n.stylesheets&&n.count===0&&bh(n,n.stylesheets),0<n.count||0<n.imgCount?function(c){var f=setTimeout(function(){if(n.stylesheets&&bh(n,n.stylesheets),n.unsuspend){var x=n.unsuspend;n.unsuspend=null,x()}},6e4+a);0<n.imgBytes&&qg===0&&(qg=62500*mD());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&bh(n,n.stylesheets),n.unsuspend)){var x=n.unsuspend;n.unsuspend=null,x()}},(n.imgBytes>qg?50:800)+a);return n.unsuspend=c,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(_)}}:null}function xh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bh(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var yh=null;function bh(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,yh=new Map,a.forEach(OD,n),yh=null,xh.call(n))}function OD(n,a){if(!(a.state.loading&4)){var c=yh.get(n);if(c)var f=c.get(null);else{c=new Map,yh.set(n,c);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<_.length;x++){var A=_[x];(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"),x=c.get(A)||f,x===f&&c.set(null,_),c.set(A,_),this.count++,f=xh.bind(this),_.addEventListener("load",f),_.addEventListener("error",f),x?x.parentNode.insertBefore(_,x.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),a.state.loading|=4}}var Gc={$$typeof:k,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function BD(n,a,c,f,_,x,A,P,K){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=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=x,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function ES(n,a,c,f,_,x,A,P,K,ae,de,pe){return n=new BD(n,a,c,A,K,ae,de,pe,P),a=1,x===!0&&(a|=24),x=bi(3,null,null,a),n.current=x,x.stateNode=n,a=Cp(),a.refCount++,n.pooledCache=a,a.refCount++,x.memoizedState={element:f,isDehydrated:c,cache:a},Np(x),n}function RS(n){return n?(n=il,n):il}function kS(n,a,c,f,_,x){_=RS(_),f.context===null?f.context=_:f.pendingContext=_,f=Xs(a),f.payload={element:c},x=x===void 0?null:x,x!==null&&(f.callback=x),c=Zs(n,f,a),c!==null&&(ui(c,n,a),Ec(c,n,a))}function NS(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){NS(n,a),(n=n.alternate)&&NS(n,a)}function AS(n){if(n.tag===13||n.tag===31){var a=Ka(n,67108864);a!==null&&ui(a,n,67108864),Vg(n,67108864)}}function TS(n){if(n.tag===13||n.tag===31){var a=Ri();a=Fo(a);var c=Ka(n,a);c!==null&&ui(c,n,a),Vg(n,a)}}var wh=!0;function PD(n,a,c,f){var _=T.T;T.T=null;var x=U.p;try{U.p=2,Gg(n,a,c,f)}finally{U.p=x,T.T=_}}function ID(n,a,c,f){var _=T.T;T.T=null;var x=U.p;try{U.p=8,Gg(n,a,c,f)}finally{U.p=x,T.T=_}}function Gg(n,a,c,f){if(wh){var _=Yg(f);if(_===null)Dg(n,a,f,Sh,c),jS(n,f);else if($D(_,n,a,c,f))f.stopPropagation();else if(jS(n,f),a&4&&-1<zD.indexOf(n)){for(;_!==null;){var x=Vo(_);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var A=xi(x.pendingLanes);if(A!==0){var P=x;for(P.pendingLanes|=2,P.entangledLanes|=2;A;){var K=1<<31-vr(A);P.entanglements[1]|=K,A&=~K}Ln(x),(mt&6)===0&&(sh=He()+500,Uc(0))}}break;case 31:case 13:P=Ka(x,2),P!==null&&ui(P,x,2),oh(),Vg(x,2)}if(x=Yg(f),x===null&&Dg(n,a,f,Sh,c),x===_)break;_=x}_!==null&&f.stopPropagation()}else Dg(n,a,f,null,c)}}function Yg(n){return n=Xm(n),Kg(n)}var Sh=null;function Kg(n){if(Sh=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 Sh=n,null}function MS(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ot()){case Ht:return 2;case gi:return 8;case Bt:case gt:return 32;case ur:return 268435456;default:return 32}default:return 32}}var Xg=!1,la=null,ca=null,ua=null,Yc=new Map,Kc=new Map,da=[],zD="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 jS(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":Yc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kc.delete(a.pointerId)}}function Xc(n,a,c,f,_,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:x,targetContainers:[_]},a!==null&&(a=Vo(a),a!==null&&AS(a)),n):(n.eventSystemFlags|=f,a=n.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),n)}function $D(n,a,c,f,_){switch(a){case"focusin":return la=Xc(la,n,a,c,f,_),!0;case"dragenter":return ca=Xc(ca,n,a,c,f,_),!0;case"mouseover":return ua=Xc(ua,n,a,c,f,_),!0;case"pointerover":var x=_.pointerId;return Yc.set(x,Xc(Yc.get(x)||null,n,a,c,f,_)),!0;case"gotpointercapture":return x=_.pointerId,Kc.set(x,Xc(Kc.get(x)||null,n,a,c,f,_)),!0}return!1}function DS(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,Gy(n.priority,function(){TS(c)});return}}else if(a===31){if(a=d(c),a!==null){n.blockedOn=a,Gy(n.priority,function(){TS(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 Ch(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&&AS(a),n.blockedOn=c,!1;a.shift()}return!0}function LS(n,a,c){Ch(n)&&c.delete(a)}function UD(){Xg=!1,la!==null&&Ch(la)&&(la=null),ca!==null&&Ch(ca)&&(ca=null),ua!==null&&Ch(ua)&&(ua=null),Yc.forEach(LS),Kc.forEach(LS)}function Eh(n,a){n.blockedOn===a&&(n.blockedOn=null,Xg||(Xg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UD)))}var Rh=null;function OS(n){Rh!==n&&(Rh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Rh===n&&(Rh=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 x=Vo(c);x!==null&&(n.splice(a,3),a-=3,Yp(x,{pending:!0,data:_,method:c.method,action:f},f,_))}}))}function kl(n){function a(K){return Eh(K,n)}la!==null&&Eh(la,n),ca!==null&&Eh(ca,n),ua!==null&&Eh(ua,n),Yc.forEach(a),Kc.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);)DS(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],x=c[f+1],A=_[ni]||null;if(typeof x=="function")A||OS(c);else if(A){var P=null;if(x&&x.hasAttribute("formAction")){if(_=x,A=x[ni]||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),OS(c)}}}function BS(){function n(x){x.canIntercept&&x.info==="react-transition"&&x.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 x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.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}kh.prototype.render=Zg.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,f=Ri();kS(c,f,n,a,null,null)},kh.prototype.unmount=Zg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;kS(n.current,2,null,n,null,null),oh(),a[Wo]=null}};function kh(n){this._internalRoot=n}kh.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&&DS(n)}};var PS=t.version;if(PS!=="19.2.7")throw Error(i(527,PS,"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?g(n):null,n=n===null?null:n.stateNode,n};var HD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nh.isDisabled&&Nh.supportsFiber)try{is=Nh.inject(HD),Ar=Nh}catch{}}return Qc.createRoot=function(n,a){if(!s(n))throw Error(i(299));var c=!1,f="",_=W1,x=q1,A=V1;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&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=ES(n,1,!1,null,null,c,f,null,_,x,A,BS),n[Wo]=a.current,jg(n),new Zg(a)},Qc.hydrateRoot=function(n,a,c){if(!s(n))throw Error(i(299));var f=!1,_="",x=W1,A=q1,P=V1,K=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(_=c.identifierPrefix),c.onUncaughtError!==void 0&&(x=c.onUncaughtError),c.onCaughtError!==void 0&&(A=c.onCaughtError),c.onRecoverableError!==void 0&&(P=c.onRecoverableError),c.formState!==void 0&&(K=c.formState)),a=ES(n,1,!0,a,c??null,f,_,K,x,A,P,BS),a.context=RS(null),c=a.current,f=Ri(),f=Fo(f),_=Xs(f),_.callback=null,Zs(c,_,f),c=f,a.current.lanes=c,Xe(a,c),Ln(a),n[Wo]=a.current,jg(n),new kh(a)},Qc.version="19.2.7",Qc}var GS;function eL(){if(GS)return ev.exports;GS=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=JD(),ev.exports}var tL=eL();/**
|
|
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 gx=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,eR=/^[\\/]{2}/;function rL(e,t){return t+e.replace(/\\/g,"/")}var YS="popstate";function KS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function iL(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 O_("",{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:Du(s)}return sL(t,r,null,e)}function cr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function nL(){return Math.random().toString(36).substring(2,10)}function XS(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 O_(e,t,r=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ku(t):t,state:r,key:t&&t.key||i||nL(),mask:s}}function Du({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 Ku(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 sL(e,t,r,i={}){let{window:s=document.defaultView,v5Compat:o=!1}=i,u=s.history,d="POP",m=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function p(){d="POP";let E=g(),S=E==null?null:E-h;h=E,m&&m({action:d,location:C.location,delta:S})}function y(E,S){d="PUSH";let N=KS(E)?E:O_(C.location,E,S);h=g()+1;let k=XS(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=KS(E)?E:O_(C.location,E,S);h=g();let k=XS(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 aL(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(YS,p),m=E,()=>{s.removeEventListener(YS,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:y,replace:b,go(E){return u.go(E)}};return C}function aL(e,t,r=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),cr(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Du(t);return s=s.replace(/ $/,"%20"),!r&&eR.test(s)&&(s=i+s),new URL(s,i)}function tR(e,t,r="/"){return oL(e,t,r,!1)}function oL(e,t,r,i,s){let o=typeof t=="string"?Ku(t):t,u=Ds(o.pathname||"/",r);if(u==null)return null;let d=lL(e),m=null,h=xL(u);for(let g=0;m==null&&g<d.length;++g)m=_L(d[g],h,i);return m}function lL(e){let t=rR(e);return cL(t),t}function rR(e,t=[],r=[],i="",s=!1){let o=(u,d,m=s,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&m)return;cr(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let p=gn([i,g.relativePath]),y=r.concat(g);u.children&&u.children.length>0&&(cr(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),rR(u.children,t,y,p,m)),!(u.path==null&&!u.index)&&t.push({path:p,score:gL(p,u.index),routesMeta:y.map((b,w)=>{let[C,E]=sR(b.relativePath,b.caseSensitive,w===y.length-1);return{...b,matcher:C,compiledParams:E}})})};return e.forEach((u,d)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))o(u,d);else for(let h of iR(u.path))o(u,d,!0,h)}),t}function iR(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=iR(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 cL(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:vL(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var uL=/^:[\w-]+$/,dL=3,hL=2,fL=1,mL=10,pL=-2,ZS=e=>e==="*";function gL(e,t){let r=e.split("/"),i=r.length;return r.some(ZS)&&(i+=pL),t&&(i+=hL),r.filter(s=>!ZS(s)).reduce((s,o)=>s+(uL.test(o)?dL:o===""?fL:mL),i)}function vL(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 _L(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,g=o==="/"?t:t.slice(o.length)||"/",p={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},y=m.matcher&&m.compiledParams?nR(p,g,m.matcher,m.compiledParams):Sf(p,g),b=m.route;if(!y&&h&&r&&!i[i.length-1].route.index&&(y=Sf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!y)return null;Object.assign(s,y.params),u.push({params:s,pathname:gn([o,y.pathname]),pathnameBase:wL(gn([o,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(o=gn([o,y.pathnameBase]))}return u}function Sf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=sR(e.path,e.caseSensitive,e.end);return nR(e,t,r,i)}function nR(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:g,isOptional:p},y)=>{if(g==="*"){let w=d[y]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const b=d[y];return p&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:u,pattern:e}}function sR(e,t=!1,r=!0){Zi(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,h,g)=>{if(i.push({paramName:d,isOptional:m!=null}),m){let p=g.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 xL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zi(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ds(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function yL(e,t="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?Ku(e):e,o;return r?(r=aR(r),r.startsWith("/")?o=QS(r.substring(1),"/"):o=QS(r,t)):o=t,{pathname:o,search:SL(i),hash:CL(s)}}function QS(e,t){let r=Cf(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 bL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function vx(e){let t=bL(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=Ku(e):(s={...e},cr(!s.pathname||!s.pathname.includes("?"),nv("?","pathname","search",s)),cr(!s.pathname||!s.pathname.includes("#"),nv("#","pathname","hash",s)),cr(!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 y=u.split("/");for(;y[0]==="..";)y.shift(),p-=1;s.pathname=y.join("/")}d=p>=0?t[p]:"/"}let m=yL(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(o||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var aR=e=>e.replace(/[\\/]{2,}/g,"/"),gn=e=>aR(e.join("/")),Cf=e=>e.replace(/\/+$/,""),wL=e=>Cf(e).replace(/^\/*/,"/"),SL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CL=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,EL=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 RL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kL(e){let t=e.map(r=>r.route.path).filter(Boolean);return gn(t)||"/"}var oR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lR(e,t){let r=e;if(typeof r!="string"||!gx.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(oR)try{let o=new URL(window.location.href),u=eR.test(r)?new URL(rL(r,o.protocol)):new URL(r),d=Ds(u.pathname,t);u.origin===o.origin&&d!=null?r=d+u.search+u.hash:s=!0}catch{Zi(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var cR=["POST","PUT","PATCH","DELETE"];new Set(cR);var NL=["GET",...cR];new Set(NL);var AL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function TL(e){try{return AL.includes(new URL(e).protocol)}catch{return!1}}var Ql=v.createContext(null);Ql.displayName="DataRouter";var Zf=v.createContext(null);Zf.displayName="DataRouterState";var uR=v.createContext(!1);function ML(){return v.useContext(uR)}var dR=v.createContext({isTransitioning:!1});dR.displayName="ViewTransition";var jL=v.createContext(new Map);jL.displayName="Fetchers";var DL=v.createContext(null);DL.displayName="Await";var Mi=v.createContext(null);Mi.displayName="Navigation";var Qf=v.createContext(null);Qf.displayName="Location";var wn=v.createContext({outlet:null,matches:[],isDataRoute:!1});wn.displayName="Route";var _x=v.createContext(null);_x.displayName="RouteError";var hR="REACT_ROUTER_ERROR",LL="REDIRECT",OL="ROUTE_ERROR_RESPONSE";function BL(e){if(e.startsWith(`${hR}:${LL}:{`))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 PL(e){if(e.startsWith(`${hR}:${OL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new EL(t.status,t.statusText,t.data)}catch{}}function IL(e,{relative:t}={}){cr(Jl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=v.useContext(Mi),{hash:s,pathname:o,search:u}=Xu(e,{relative:t}),d=o;return r!=="/"&&(d=o==="/"?r:gn([r,o])),i.createHref({pathname:d,search:u,hash:s})}function Jl(){return v.useContext(Qf)!=null}function Ur(){return cr(Jl(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Qf).location}var fR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function mR(e){v.useContext(Mi).static||v.useLayoutEffect(e)}function Oa(){let{isDataRoute:e}=v.useContext(wn);return e?ZL():zL()}function zL(){cr(Jl(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Ql),{basename:t,navigator:r}=v.useContext(Mi),{matches:i}=v.useContext(wn),{pathname:s}=Ur(),o=JSON.stringify(vx(i)),u=v.useRef(!1);return mR(()=>{u.current=!0}),v.useCallback((m,h={})=>{if(Zi(u.current,fR),!u.current)return;if(typeof m=="number"){r.go(m);return}let g=Xf(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:gn([t,g.pathname])),(h.replace?r.replace:r.push)(g,h.state,h)},[t,r,o,s,e])}v.createContext(null);function pR(){let{matches:e}=v.useContext(wn),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Xu(e,{relative:t}={}){let{matches:r}=v.useContext(wn),{pathname:i}=Ur(),s=JSON.stringify(vx(r));return v.useMemo(()=>Xf(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function $L(e,t){return gR(e)}function gR(e,t,r){cr(Jl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(Mi),{matches:s}=v.useContext(wn),o=s[s.length-1],u=o?o.params:{},d=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let E=h&&h.path||"";_R(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 g=Ur(),p;p=g;let y=p.pathname||"/",b=y;if(m!=="/"){let E=m.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(E=>Object.assign(E,{route:r.manifest[E.route.id]||E.route})):tR(e,{pathname:b});return Zi(h||w!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Zi(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),qL(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:gn([m,i.encodeLocation?i.encodeLocation(E.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:gn([m,i.encodeLocation?i.encodeLocation(E.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,r)}function UL(){let e=XL(),t=RL(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=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:s},r):null,u)}var HL=v.createElement(UL,null),vR=class extends v.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=PL(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(wn.Provider,{value:this.props.routeContext},v.createElement(_x.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(FL,{error:e},t):t}};vR.contextType=uR;var sv=new WeakMap;function FL({children:e,error:t}){let{basename:r}=v.useContext(Mi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=BL(t.digest);if(i){let s=sv.get(t);if(s)throw s;let o=lR(i.location,r),u=o.absoluteURL||o.to;if(TL(u))throw new Error("Invalid redirect location");if(oR&&!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 v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function WL({routeContext:e,match:t,children:r}){let i=v.useContext(Ql);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(wn.Provider,{value:e},r)}function qL(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 g=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);cr(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let u=!1,d=-1;if(r&&i){u=i.renderFallback;for(let g=0;g<s.length;g++){let p=s[g];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=g),p.route.id){let{loaderData:y,errors:b}=i,w=p.route.loader&&!y.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||w){r.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=r==null?void 0:r.onError,h=i&&m?(g,p)=>{var y,b;m(g,{location:i.location,params:((b=(y=i.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:kL(i.matches),errorInfo:p})}:void 0;return s.reduceRight((g,p,y)=>{let b,w=!1,C=null,E=null;i&&(b=o&&p.route.id?o[p.route.id]:void 0,C=p.route.errorElement||HL,u&&(d<0&&y===0?(_R("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,E=null):d===y&&(w=!0,E=p.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),N=()=>{let k;return b?k=C:w?k=E:p.route.Component?k=v.createElement(p.route.Component,null):p.route.element?k=p.route.element:k=g,v.createElement(WL,{match:p,routeContext:{outlet:g,matches:S,isDataRoute:i!=null},children:k})};return i&&(p.route.ErrorBoundary||p.route.errorElement||y===0)?v.createElement(vR,{location:i.location,revalidation:i.revalidation,component:C,error:b,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):N()},null)}function xx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VL(e){let t=v.useContext(Ql);return cr(t,xx(e)),t}function GL(e){let t=v.useContext(Zf);return cr(t,xx(e)),t}function YL(e){let t=v.useContext(wn);return cr(t,xx(e)),t}function yx(e){let t=YL(e),r=t.matches[t.matches.length-1];return cr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function KL(){return yx("useRouteId")}function XL(){var i;let e=v.useContext(_x),t=GL("useRouteError"),r=yx("useRouteError");return e!==void 0?e:(i=t.errors)==null?void 0:i[r]}function ZL(){let{router:e}=VL("useNavigate"),t=yx("useNavigate"),r=v.useRef(!1);return mR(()=>{r.current=!0}),v.useCallback(async(s,o={})=>{Zi(r.current,fR),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var JS={};function _R(e,t,r){!t&&!JS[e]&&(JS[e]=!0,Zi(!1,r))}v.memo(QL);function QL({routes:e,manifest:t,future:r,state:i,isStatic:s,onError:o}){return gR(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function go({to:e,replace:t,state:r,relative:i}){cr(Jl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=v.useContext(Mi);Zi(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=v.useContext(wn),{pathname:u}=Ur(),d=Oa(),m=Xf(e,vx(o),u,i==="path"),h=JSON.stringify(m);return v.useEffect(()=>{d(JSON.parse(h),{replace:t,state:r,relative:i})},[d,h,i,t,r]),null}function JL({basename:e="/",children:t=null,location:r,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:u}){cr(!Jl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=v.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:u,future:{}}),[d,s,o,u]);typeof r=="string"&&(r=Ku(r));let{pathname:h="/",search:g="",hash:p="",state:y=null,key:b="default",mask:w}=r,C=v.useMemo(()=>{let E=Ds(h,d);return E==null?null:{location:{pathname:E,search:g,hash:p,state:y,key:b,mask:w},navigationType:i}},[d,h,g,p,y,b,i,w]);return Zi(C!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${p}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:v.createElement(Mi.Provider,{value:m},v.createElement(Qf.Provider,{children:t,value:C}))}var nf="get",sf="application/x-www-form-urlencoded";function Jf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function e4(e){return Jf(e)&&e.tagName.toLowerCase()==="button"}function t4(e){return Jf(e)&&e.tagName.toLowerCase()==="form"}function r4(e){return Jf(e)&&e.tagName.toLowerCase()==="input"}function i4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function n4(e,t){return e.button===0&&(!t||t==="_self")&&!i4(e)}function B_(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 s4(e,t){let r=B_(e);return t&&t.forEach((i,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}var Ah=null;function a4(){if(Ah===null)try{new FormData(document.createElement("form"),0),Ah=!1}catch{Ah=!0}return Ah}var o4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function av(e){return e!=null&&!o4.has(e)?(Zi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${sf}"`),null):e}function l4(e,t){let r,i,s,o,u;if(t4(e)){let d=e.getAttribute("action");i=d?Ds(d,t):null,r=e.getAttribute("method")||nf,s=av(e.getAttribute("enctype"))||sf,o=new FormData(e)}else if(e4(e)||r4(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")||nf,s=av(e.getAttribute("formenctype"))||av(d.getAttribute("enctype"))||sf,o=new FormData(d,e),!a4()){let{name:h,type:g,value:p}=e;if(g==="image"){let y=h?`${h}.`:"";o.append(`${y}x`,"0"),o.append(`${y}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=nf,i=null,s=sf,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 bx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xR(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=`${Cf(t)}/_root.${i}`:s.pathname=`${Cf(s.pathname)}.${i}`,s}async function c4(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 u4(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 d4(e,t,r){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let u=await c4(o,r);return u.links?u.links():[]}return[]}));return p4(i.flat(1).filter(u4).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function eC(e,t,r,i,s,o){let u=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,d=(m,h)=>{var g;return r[h].pathname!==m.pathname||((g=r[h].route.path)==null?void 0:g.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 g=i.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(u(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let y=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 y=="boolean")return y}return!0}):[]}function h4(e,t,{includeHydrateFallback:r}={}){return f4(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 f4(e){return[...new Set(e)]}function m4(e){let t={},r=Object.keys(e).sort();for(let i of r)t[i]=e[i];return t}function p4(e,t){let r=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(m4(s));return r.has(o)||(r.add(o),i.push({key:o,link:s})),i},[])}function wx(){let e=v.useContext(Ql);return bx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function g4(){let e=v.useContext(Zf);return bx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Sx=v.createContext(void 0);Sx.displayName="FrameworkContext";function em(){let e=v.useContext(Sx);return bx(e,"You must render this element inside a <HydratedRouter> element"),e}function v4(e,t){let r=v.useContext(Sx),[i,s]=v.useState(!1),[o,u]=v.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:p}=t,y=v.useRef(null);v.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=S=>{S.forEach(N=>{u(N.isIntersecting)})},E=new IntersectionObserver(C,{threshold:.5});return y.current&&E.observe(y.current),()=>{E.disconnect()}}},[e]),v.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,y,{}]:[o,y,{onFocus:Jc(d,b),onBlur:Jc(m,w),onMouseEnter:Jc(h,b),onMouseLeave:Jc(g,w),onTouchStart:Jc(p,b)}]:[!1,y,{}]}function Jc(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function _4({page:e,...t}){let r=ML(),{nonce:i}=em(),{router:s}=wx(),o=v.useMemo(()=>tR(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?v.createElement(y4,{page:e,matches:o,...t}):v.createElement(b4,{page:e,matches:o,...t})):null}function x4(e){let{manifest:t,routeModules:r}=em(),[i,s]=v.useState([]);return v.useEffect(()=>{let o=!1;return d4(e,t,r).then(u=>{o||s(u)}),()=>{o=!0}},[e,t,r]),i}function y4({page:e,matches:t,...r}){let i=Ur(),{future:s}=em(),{basename:o}=wx(),u=v.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=xR(e,o,s.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?m=!0:h.push(g.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 v.createElement(v.Fragment,null,u.map(d=>v.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function b4({page:e,matches:t,...r}){let i=Ur(),{future:s,manifest:o,routeModules:u}=em(),{basename:d}=wx(),{loaderData:m,matches:h}=g4(),g=v.useMemo(()=>eC(e,t,h,o,i,"data"),[e,t,h,o,i]),p=v.useMemo(()=>eC(e,t,h,o,i,"assets"),[e,t,h,o,i]),y=v.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||(!g.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=xR(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,g,t,e,u]),b=v.useMemo(()=>h4(p,o),[p,o]),w=x4(p);return v.createElement(v.Fragment,null,y.map(C=>v.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),b.map(C=>v.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),w.map(({key:C,link:E})=>v.createElement("link",{key:C,nonce:r.nonce,...E,crossOrigin:E.crossOrigin??r.crossOrigin})))}function w4(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var S4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{S4&&(window.__reactRouterVersion="7.18.1")}catch{}function C4({basename:e,children:t,useTransitions:r,window:i}){let s=v.useRef();s.current==null&&(s.current=iL({window:i,v5Compat:!0}));let o=s.current,[u,d]=v.useState({action:o.action,location:o.location}),m=v.useCallback(h=>{r===!1?d(h):v.startTransition(()=>d(h))},[r]);return v.useLayoutEffect(()=>o.listen(m),[o,m]),v.createElement(JL,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:r})}var yR=v.forwardRef(function({onClick:t,discover:r="render",prefetch:i="none",relative:s,reloadDocument:o,replace:u,mask:d,state:m,target:h,to:g,preventScrollReset:p,viewTransition:y,defaultShouldRevalidate:b,...w},C){let{basename:E,navigator:S,useTransitions:N}=v.useContext(Mi),k=typeof g=="string"&&gx.test(g),R=lR(g,E);g=R.to;let M=IL(g,{relative:s}),L=Ur(),z=null;if(d){let $=Xf(d,[],L.mask?L.mask.pathname:"/",!0);E!=="/"&&($.pathname=$.pathname==="/"?E:gn([E,$.pathname])),z=S.createHref($)}let[D,W,G]=v4(i,w),q=k4(g,{replace:u,mask:d,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:y,defaultShouldRevalidate:b,useTransitions:N});function B($){t&&t($),$.defaultPrevented||q($)}let j=!(R.isExternal||o),O=v.createElement("a",{...w,...G,href:(j?z:void 0)||R.absoluteURL||M,onClick:j?B:t,ref:w4(C,W),target:h,"data-discover":!k&&r==="render"?"true":void 0});return D&&!k?v.createElement(v.Fragment,null,O,v.createElement(_4,{page:M})):O});yR.displayName="Link";var Sa=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:i="",end:s=!1,style:o,to:u,viewTransition:d,children:m,...h},g){let p=Xu(u,{relative:h.relative}),y=Ur(),b=v.useContext(Zf),{navigator:w,basename:C}=v.useContext(Mi),E=b!=null&&D4(p)&&d===!0,S=w.encodeLocation?w.encodeLocation(p).pathname:p.pathname,N=y.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)==="/"),z={isActive:M,isPending:L,isTransitioning:E},D=M?t:void 0,W;typeof i=="function"?W=i(z):W=[i,M?"active":null,L?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let G=typeof o=="function"?o(z):o;return v.createElement(yR,{...h,"aria-current":D,className:W,ref:g,style:G,to:u,viewTransition:d},typeof m=="function"?m(z):m)});Sa.displayName="NavLink";var E4=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:i,replace:s,state:o,method:u=nf,action:d,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:p,defaultShouldRevalidate:y,...b},w)=>{let{useTransitions:C}=v.useContext(Mi),E=M4(),S=j4(d,{relative:h}),N=u.toLowerCase()==="get"?"get":"post",k=typeof d=="string"&&gx.test(d),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let L=M.nativeEvent.submitter,z=(L==null?void 0:L.getAttribute("formmethod"))||u,D=()=>E(L||M.currentTarget,{fetcherKey:t,method:z,navigate:r,replace:s,state:o,relative:h,preventScrollReset:g,viewTransition:p,defaultShouldRevalidate:y});C&&r!==!1?v.startTransition(()=>D()):D()};return v.createElement("form",{ref:w,method:N,action:S,onSubmit:i?m:R,...b,"data-discover":!k&&e==="render"?"true":void 0})});E4.displayName="Form";function R4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bR(e){let t=v.useContext(Ql);return cr(t,R4(e)),t}function k4(e,{target:t,replace:r,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:h}={}){let g=Oa(),p=Ur(),y=Xu(e,{relative:u});return v.useCallback(b=>{if(n4(b,t)){b.preventDefault();let w=r!==void 0?r:Du(p)===Du(y),C=()=>g(e,{replace:w,mask:i,state:s,preventScrollReset:o,relative:u,viewTransition:d,defaultShouldRevalidate:m});h?v.startTransition(()=>C()):C()}},[p,g,y,r,i,s,t,e,o,u,d,m,h])}function N4(e){Zi(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(B_(e)),r=v.useRef(!1),i=Ur(),s=v.useMemo(()=>s4(i.search,r.current?null:t.current),[i.search]),o=Oa(),u=v.useCallback((d,m)=>{const h=B_(typeof d=="function"?d(new URLSearchParams(s)):d);r.current=!0,o("?"+h,m)},[o,s]);return[s,u]}var A4=0,T4=()=>`__${String(++A4)}__`;function M4(){let{router:e}=bR("useSubmit"),{basename:t}=v.useContext(Mi),r=KL(),i=e.fetch,s=e.navigate;return v.useCallback(async(o,u={})=>{let{action:d,method:m,encType:h,formData:g,body:p}=l4(o,t);if(u.navigate===!1){let y=u.fetcherKey||T4();await i(y,r,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,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:g,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 j4(e,{relative:t}={}){let{basename:r}=v.useContext(Mi),i=v.useContext(wn);cr(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...Xu(e||".",{relative:t})},u=Ur();if(e==null){o.search=u.search;let d=new URLSearchParams(o.search),m=d.getAll("index");if(m.some(g=>g==="")){d.delete("index"),m.filter(p=>p).forEach(p=>d.append("index",p));let g=d.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:gn([r,o.pathname])),Du(o)}function D4(e,{relative:t}={}){let r=v.useContext(dR);cr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=bR("useViewTransitionState"),s=Xu(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 Sf(s.pathname,u)!=null||Sf(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 L4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wR=(...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 O4={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 B4=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:u,...d},m)=>v.createElement("svg",{ref:m,...O4,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:wR("lucide",s),...d},[...u.map(([h,g])=>v.createElement(h,g)),...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=v.forwardRef(({className:i,...s},o)=>v.createElement(B4,{ref:o,iconNode:t,className:wR(`lucide-${L4(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 P4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Gl=Re("ArrowLeft",P4);/**
|
|
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 I4=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],SR=Re("ArrowRight",I4);/**
|
|
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 z4=[["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"}]],Cx=Re("Bot",z4);/**
|
|
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 $4=[["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"}]],CR=Re("Boxes",$4);/**
|
|
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 U4=[["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"}]],Ex=Re("Cable",U4);/**
|
|
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 H4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ba=Re("Check",H4);/**
|
|
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 F4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Rx=Re("ChevronDown",F4);/**
|
|
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 W4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ER=Re("ChevronLeft",W4);/**
|
|
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 q4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jo=Re("ChevronRight",q4);/**
|
|
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 V4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],G4=Re("ChevronUp",V4);/**
|
|
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 Y4=[["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"}]],Zu=Re("CircleAlert",Y4);/**
|
|
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 K4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],RR=Re("CircleCheck",K4);/**
|
|
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 X4=[["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"}]],Z4=Re("CircleHelp",X4);/**
|
|
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 Q4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],J4=Re("CircleSlash",Q4);/**
|
|
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 eO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],tO=Re("CircleStop",eO);/**
|
|
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 rO=[["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"}]],iO=Re("CircleX",rO);/**
|
|
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 nO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sO=Re("Circle",nO);/**
|
|
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 aO=[["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"}]],kx=Re("Command",aO);/**
|
|
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 oO=[["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"}]],kR=Re("Copy",oO);/**
|
|
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 lO=[["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"}]],cO=Re("Download",lO);/**
|
|
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 uO=[["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"}]],Lu=Re("Earth",uO);/**
|
|
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 dO=[["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"}]],hO=Re("Ellipsis",dO);/**
|
|
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 fO=[["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"}]],mO=Re("Eraser",fO);/**
|
|
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 pO=[["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"}]],gO=Re("Expand",pO);/**
|
|
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 vO=[["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"}]],tC=Re("ExternalLink",vO);/**
|
|
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 _O=[["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"}]],xO=Re("FileText",_O);/**
|
|
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 yO=[["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"}]],bO=Re("Fingerprint",yO);/**
|
|
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 wO=[["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"}]],SO=Re("Folder",wO);/**
|
|
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 CO=[["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"}]],EO=Re("GitBranch",CO);/**
|
|
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 RO=[["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"}]],NR=Re("House",RO);/**
|
|
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 kO=[["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"}]],NO=Re("ImageOff",kO);/**
|
|
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 AO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],TO=Re("Image",AO);/**
|
|
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 MO=[["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"}]],AR=Re("KeyRound",MO);/**
|
|
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 jO=[["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"}]],Nx=Re("Laptop",jO);/**
|
|
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 DO=[["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"}]],LO=Re("LayoutDashboard",DO);/**
|
|
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 OO=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],BO=Re("Link2",OO);/**
|
|
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 PO=[["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"}]],IO=Re("ListChecks",PO);/**
|
|
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 zO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qe=Re("LoaderCircle",zO);/**
|
|
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 $O=[["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"}]],UO=Re("MapPin",$O);/**
|
|
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 HO=[["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"}]],FO=Re("MessageSquare",HO);/**
|
|
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 WO=[["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"}]],P_=Re("MonitorSmartphone",WO);/**
|
|
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 qO=[["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"}]],VO=Re("MonitorUp",qO);/**
|
|
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 GO=[["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"}]],TR=Re("Monitor",GO);/**
|
|
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 YO=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],KO=Re("Moon",YO);/**
|
|
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 XO=[["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"}]],ZO=Re("MousePointerBan",XO);/**
|
|
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 QO=[["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"}]],JO=Re("MousePointerClick",QO);/**
|
|
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 eB=[["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"}]],tB=Re("PanelLeftClose",eB);/**
|
|
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 rB=[["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"}]],MR=Re("PanelLeftOpen",rB);/**
|
|
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 iB=[["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"}]],nB=Re("PanelRightClose",iB);/**
|
|
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 sB=[["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"}]],aB=Re("PanelRightOpen",sB);/**
|
|
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 oB=[["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"}]],lB=Re("Paperclip",oB);/**
|
|
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 cB=[["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"}]],uB=Re("Pause",cB);/**
|
|
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 dB=[["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"}]],hB=Re("Pencil",dB);/**
|
|
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 fB=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],jR=Re("Play",fB);/**
|
|
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 mB=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qi=Re("Plus",mB);/**
|
|
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 pB=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Ef=Re("Power",pB);/**
|
|
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 gB=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Nt=Re("RefreshCw",gB);/**
|
|
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 vB=[["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"}]],DR=Re("RotateCw",vB);/**
|
|
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 _B=[["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"}]],xB=Re("ScanEye",_B);/**
|
|
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 yB=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]],bB=Re("ScanSearch",yB);/**
|
|
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 wB=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],LR=Re("ScrollText",wB);/**
|
|
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 SB=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],CB=Re("Search",SB);/**
|
|
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 EB=[["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"}]],OR=Re("Send",EB);/**
|
|
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 RB=[["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"}]],Qu=Re("Server",RB);/**
|
|
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 kB=[["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"}]],NB=Re("Settings",kB);/**
|
|
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 AB=[["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"}]],TB=Re("Share2",AB);/**
|
|
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 MB=[["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"}]],jB=Re("ShieldAlert",MB);/**
|
|
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 DB=[["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",DB);/**
|
|
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 LB=[["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"}]],Ax=Re("ShieldOff",LB);/**
|
|
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 OB=[["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"}]],BB=Re("Shrink",OB);/**
|
|
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 PB=[["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",PB);/**
|
|
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 IB=[["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"}]],BR=Re("Sparkles",IB);/**
|
|
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 zB=[["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"}]],Tx=Re("SquareTerminal",zB);/**
|
|
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 $B=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],UB=Re("Square",$B);/**
|
|
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 HB=[["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"}]],FB=Re("Sun",HB);/**
|
|
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 WB=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],qB=Re("Terminal",WB);/**
|
|
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 VB=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Pa=Re("Trash2",VB);/**
|
|
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 GB=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ea=Re("TriangleAlert",GB);/**
|
|
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 YB=[["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"}]],KB=Re("Unlink",YB);/**
|
|
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 XB=[["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"}]],ZB=Re("Workflow",XB);/**
|
|
481
|
+
* @license lucide-react v0.475.0 - ISC
|
|
482
|
+
*
|
|
483
|
+
* This source code is licensed under the ISC license.
|
|
484
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
485
|
+
*/const QB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Na=Re("X",QB);var Ia=JE();const JB=mx(Ia);function e6(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 t6=e=>{switch(e){case"success":return n6;case"info":return a6;case"warning":return s6;case"error":return o6;default:return null}},r6=Array(12).fill(0),i6=({visible:e,className:t})=>Ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ce.createElement("div",{className:"sonner-spinner"},r6.map((r,i)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),n6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),s6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),a6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),o6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),l6=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c6=()=>{const[e,t]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let I_=1;class u6{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:I_++,u=this.toasts.find(m=>m.id===o),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),u?this.toasts=this.toasts.map(m=>m.id===o?(this.publish({...m,...t,id:o,title:i}),{...m,...t,id:o,dismissible:d,title:i}):m):this.addToast({title:i,...s,dismissible:d,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=i!==void 0,u;const d=s.then(async h=>{if(u=["resolve",h],Ce.isValidElement(h))o=!1,this.create({id:i,type:"default",message:h});else if(h6(h)&&!h.ok){o=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,y=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:y,...w})}else if(h instanceof Error){o=!1;const p=typeof r.error=="function"?await r.error(h):r.error,y=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"error",description:y,...w})}else if(r.success!==void 0){o=!1;const p=typeof r.success=="function"?await r.success(h):r.success,y=typeof r.description=="function"?await r.description(h):r.description,w=typeof p=="object"&&!Ce.isValidElement(p)?p:{message:p};this.create({id:i,type:"success",description:y,...w})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){o=!1;const g=typeof r.error=="function"?await r.error(h):r.error,p=typeof r.description=="function"?await r.description(h):r.description,b=typeof g=="object"&&!Ce.isValidElement(g)?g:{message:g};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,g)=>d.then(()=>u[0]==="reject"?g(u[1]):h(u[1])).catch(g));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)||I_++;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 fi=new u6,d6=(e,t)=>{const r=(t==null?void 0:t.id)||I_++;return fi.addToast({title:e,...t,id:r}),r},h6=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",f6=d6,m6=()=>fi.toasts,p6=()=>fi.getActiveToasts(),xe=Object.assign(f6,{success:fi.success,info:fi.info,warning:fi.warning,error:fi.error,custom:fi.custom,message:fi.message,promise:fi.promise,dismiss:fi.dismiss,loading:fi.loading},{getHistory:m6,getToasts:p6});e6("[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 Th(e){return e.label!==void 0}const g6=3,v6="24px",_6="16px",rC=4e3,x6=356,y6=14,b6=45,w6=200;function On(...e){return e.filter(Boolean).join(" ")}function S6(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const C6=e=>{var t,r,i,s,o,u,d,m,h;const{invert:g,toast:p,unstyled:y,interacting:b,setHeights:w,visibleToasts:C,heights:E,index:S,toasts:N,expanded:k,removeToast:R,defaultRichColors:M,closeButton:L,style:z,cancelButtonStyle:D,actionButtonStyle:W,className:G="",descriptionClassName:q="",duration:B,position:j,gap:O,expandByDefault:$,classNames:T,icons:U,closeButtonAriaLabel:H="Close toast"}=e,[F,V]=Ce.useState(null),[I,Y]=Ce.useState(null),[X,ee]=Ce.useState(!1),[re,oe]=Ce.useState(!1),[Z,ce]=Ce.useState(!1),[ne,we]=Ce.useState(!1),[_e,ye]=Ce.useState(!1),[J,ie]=Ce.useState(0),[Ee,ve]=Ce.useState(0),Ae=Ce.useRef(p.duration||B||rC),Ie=Ce.useRef(null),Oe=Ce.useRef(null),ze=S===0,rt=S+1<=C,Be=p.type,dt=p.dismissible!==!1,He=p.className||"",Ot=p.descriptionClassName||"",Ht=Ce.useMemo(()=>E.findIndex(Ue=>Ue.toastId===p.id)||0,[E,p.id]),gi=Ce.useMemo(()=>{var Ue;return(Ue=p.closeButton)!=null?Ue:L},[p.closeButton,L]),Bt=Ce.useMemo(()=>p.duration||B||rC,[p.duration,B]),gt=Ce.useRef(0),ur=Ce.useRef(0),At=Ce.useRef(0),an=Ce.useRef(null),[is,Ar]=j.split("-"),vi=Ce.useMemo(()=>E.reduce((Ue,me,ke)=>ke>=Ht?Ue:Ue+me.height,0),[E,Ht]),vr=c6(),Wa=p.invert||g,Hs=Be==="loading";ur.current=Ce.useMemo(()=>Ht*O+vi,[Ht,vi]),Ce.useEffect(()=>{Ae.current=Bt},[Bt]),Ce.useEffect(()=>{ee(!0)},[]),Ce.useEffect(()=>{const Ue=Oe.current;if(Ue){const me=Ue.getBoundingClientRect().height;return ve(me),w(ke=>[{toastId:p.id,height:me,position:p.position},...ke]),()=>w(ke=>ke.filter(Fe=>Fe.toastId!==p.id))}},[w,p.id]),Ce.useLayoutEffect(()=>{if(!X)return;const Ue=Oe.current,me=Ue.style.height;Ue.style.height="auto";const ke=Ue.getBoundingClientRect().height;Ue.style.height=me,ve(ke),w(Fe=>Fe.find(Xe=>Xe.toastId===p.id)?Fe.map(Xe=>Xe.toastId===p.id?{...Xe,height:ke}:Xe):[{toastId:p.id,height:ke,position:p.position},...Fe])},[X,p.title,p.description,w,p.id,p.jsx,p.action,p.cancel]);const _i=Ce.useCallback(()=>{oe(!0),ie(ur.current),w(Ue=>Ue.filter(me=>me.toastId!==p.id)),setTimeout(()=>{R(p)},w6)},[p,R,w,ur]);Ce.useEffect(()=>{if(p.promise&&Be==="loading"||p.duration===1/0||p.type==="loading")return;let Ue;return k||b||vr?(()=>{if(At.current<gt.current){const Fe=new Date().getTime()-gt.current;Ae.current=Ae.current-Fe}At.current=new Date().getTime()})():(()=>{Ae.current!==1/0&&(gt.current=new Date().getTime(),Ue=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),_i()},Ae.current))})(),()=>clearTimeout(Ue)},[k,b,p,Be,vr,_i]),Ce.useEffect(()=>{p.delete&&(_i(),p.onDismiss==null||p.onDismiss.call(p,p))},[_i,p.delete]);function ns(){var Ue;if(U!=null&&U.loading){var me;return Ce.createElement("div",{className:On(T==null?void 0:T.loader,p==null||(me=p.classNames)==null?void 0:me.loader,"sonner-loader"),"data-visible":Be==="loading"},U.loading)}return Ce.createElement(i6,{className:On(T==null?void 0:T.loader,p==null||(Ue=p.classNames)==null?void 0:Ue.loader),visible:Be==="loading"})}const ss=p.icon||(U==null?void 0:U[Be])||t6(Be);var Tn,xi;return Ce.createElement("li",{tabIndex:0,ref:Oe,className:On(G,He,T==null?void 0:T.toast,p==null||(t=p.classNames)==null?void 0:t.toast,T==null?void 0:T.default,T==null?void 0:T[Be],p==null||(r=p.classNames)==null?void 0:r[Be]),"data-sonner-toast":"","data-rich-colors":(Tn=p.richColors)!=null?Tn:M,"data-styled":!(p.jsx||p.unstyled||y),"data-mounted":X,"data-promise":!!p.promise,"data-swiped":_e,"data-removed":re,"data-visible":rt,"data-y-position":is,"data-x-position":Ar,"data-index":S,"data-front":ze,"data-swiping":Z,"data-dismissible":dt,"data-type":Be,"data-invert":Wa,"data-swipe-out":ne,"data-swipe-direction":I,"data-expanded":!!(k||$&&X),"data-testid":p.testId,style:{"--index":S,"--toasts-before":S,"--z-index":N.length-S,"--offset":`${re?J:ur.current}px`,"--initial-height":$?"auto":`${Ee}px`,...z,...p.style},onDragEnd:()=>{ce(!1),V(null),an.current=null},onPointerDown:Ue=>{Ue.button!==2&&(Hs||!dt||(Ie.current=new Date,ie(ur.current),Ue.target.setPointerCapture(Ue.pointerId),Ue.target.tagName!=="BUTTON"&&(ce(!0),an.current={x:Ue.clientX,y:Ue.clientY})))},onPointerUp:()=>{var Ue,me,ke;if(ne||!dt)return;an.current=null;const Fe=Number(((Ue=Oe.current)==null?void 0:Ue.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),yt=Number(((me=Oe.current)==null?void 0:me.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Xe=new Date().getTime()-((ke=Ie.current)==null?void 0:ke.getTime()),Ft=F==="x"?Fe:yt,ri=Math.abs(Ft)/Xe;if(Math.abs(Ft)>=b6||ri>.11){ie(ur.current),p.onDismiss==null||p.onDismiss.call(p,p),Y(F==="x"?Fe>0?"right":"left":yt>0?"down":"up"),_i(),we(!0);return}else{var Wt,ii;(Wt=Oe.current)==null||Wt.style.setProperty("--swipe-amount-x","0px"),(ii=Oe.current)==null||ii.style.setProperty("--swipe-amount-y","0px")}ye(!1),ce(!1),V(null)},onPointerMove:Ue=>{var me,ke,Fe;if(!an.current||!dt||((me=window.getSelection())==null?void 0:me.toString().length)>0)return;const Xe=Ue.clientY-an.current.y,Ft=Ue.clientX-an.current.x;var ri;const Wt=(ri=e.swipeDirections)!=null?ri:S6(j);!F&&(Math.abs(Ft)>1||Math.abs(Xe)>1)&&V(Math.abs(Ft)>Math.abs(Xe)?"x":"y");let ii={x:0,y:0};const Fo=on=>1/(1.5+Math.abs(on)/20);if(F==="y"){if(Wt.includes("top")||Wt.includes("bottom"))if(Wt.includes("top")&&Xe<0||Wt.includes("bottom")&&Xe>0)ii.y=Xe;else{const on=Xe*Fo(Xe);ii.y=Math.abs(on)<Math.abs(Xe)?on:Xe}}else if(F==="x"&&(Wt.includes("left")||Wt.includes("right")))if(Wt.includes("left")&&Ft<0||Wt.includes("right")&&Ft>0)ii.x=Ft;else{const on=Ft*Fo(Ft);ii.x=Math.abs(on)<Math.abs(Ft)?on:Ft}(Math.abs(ii.x)>0||Math.abs(ii.y)>0)&&ye(!0),(ke=Oe.current)==null||ke.style.setProperty("--swipe-amount-x",`${ii.x}px`),(Fe=Oe.current)==null||Fe.style.setProperty("--swipe-amount-y",`${ii.y}px`)}},gi&&!p.jsx&&Be!=="loading"?Ce.createElement("button",{"aria-label":H,"data-disabled":Hs,"data-close-button":!0,onClick:Hs||!dt?()=>{}:()=>{_i(),p.onDismiss==null||p.onDismiss.call(p,p)},className:On(T==null?void 0:T.closeButton,p==null||(i=p.classNames)==null?void 0:i.closeButton)},(xi=U==null?void 0:U.close)!=null?xi:l6):null,(Be||p.icon||p.promise)&&p.icon!==null&&((U==null?void 0:U[Be])!==null||p.icon)?Ce.createElement("div",{"data-icon":"",className:On(T==null?void 0:T.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||ns():null,p.type!=="loading"?ss:null):null,Ce.createElement("div",{"data-content":"",className:On(T==null?void 0:T.content,p==null||(o=p.classNames)==null?void 0:o.content)},Ce.createElement("div",{"data-title":"",className:On(T==null?void 0:T.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Ce.createElement("div",{"data-description":"",className:On(q,Ot,T==null?void 0:T.description,p==null||(d=p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),Ce.isValidElement(p.cancel)?p.cancel:p.cancel&&Th(p.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||D,onClick:Ue=>{Th(p.cancel)&&dt&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ue),_i())},className:On(T==null?void 0:T.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Ce.isValidElement(p.action)?p.action:p.action&&Th(p.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||W,onClick:Ue=>{Th(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Ue),!Ue.defaultPrevented&&_i())},className:On(T==null?void 0:T.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function iC(){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 E6(e,t){const r={};return[e,t].forEach((i,s)=>{const o=s===1,u=o?"--mobile-offset":"--offset",d=o?_6:v6;function m(h){["top","right","bottom","left"].forEach(g=>{r[`${u}-${g}`]=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 R6=Ce.forwardRef(function(t,r){const{id:i,invert:s,position:o="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:h,offset:g,mobileOffset:p,theme:y="light",richColors:b,duration:w,style:C,visibleToasts:E=g6,toastOptions:S,dir:N=iC(),gap:k=y6,icons:R,containerAriaLabel:M="Notifications"}=t,[L,z]=Ce.useState([]),D=Ce.useMemo(()=>i?L.filter(X=>X.toasterId===i):L.filter(X=>!X.toasterId),[L,i]),W=Ce.useMemo(()=>Array.from(new Set([o].concat(D.filter(X=>X.position).map(X=>X.position)))),[D,o]),[G,q]=Ce.useState([]),[B,j]=Ce.useState(!1),[O,$]=Ce.useState(!1),[T,U]=Ce.useState(y!=="system"?y:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ce.useRef(null),F=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=Ce.useRef(null),I=Ce.useRef(!1),Y=Ce.useCallback(X=>{z(ee=>{var re;return(re=ee.find(oe=>oe.id===X.id))!=null&&re.delete||fi.dismiss(X.id),ee.filter(({id:oe})=>oe!==X.id)})},[]);return Ce.useEffect(()=>fi.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{z(ee=>ee.map(re=>re.id===X.id?{...re,delete:!0}:re))});return}setTimeout(()=>{JB.flushSync(()=>{z(ee=>{const re=ee.findIndex(oe=>oe.id===X.id);return re!==-1?[...ee.slice(0,re),{...ee[re],...X},...ee.slice(re+1)]:[X,...ee]})})})}),[L]),Ce.useEffect(()=>{if(y!=="system"){U(y);return}if(y==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:ee})=>{U(ee?"dark":"light")})}catch{X.addListener(({matches:re})=>{try{U(re?"dark":"light")}catch(oe){console.error(oe)}})}},[y]),Ce.useEffect(()=>{L.length<=1&&j(!1)},[L]),Ce.useEffect(()=>{const X=ee=>{var re;if(u.every(ce=>ee[ce]||ee.code===ce)){var Z;j(!0),(Z=H.current)==null||Z.focus()}ee.code==="Escape"&&(document.activeElement===H.current||(re=H.current)!=null&&re.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[u]),Ce.useEffect(()=>{if(H.current)return()=>{V.current&&(V.current.focus({preventScroll:!0}),V.current=null,I.current=!1)}},[H.current]),Ce.createElement("section",{ref:r,"aria-label":`${M} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((X,ee)=>{var re;const[oe,Z]=X.split("-");return D.length?Ce.createElement("ol",{key:X,dir:N==="auto"?iC():N,tabIndex:-1,ref:H,className:h,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":oe,"data-x-position":Z,style:{"--front-toast-height":`${((re=G[0])==null?void 0:re.height)||0}px`,"--width":`${x6}px`,"--gap":`${k}px`,...C,...E6(g,p)},onBlur:ce=>{I.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(I.current=!1,V.current&&(V.current.focus({preventScroll:!0}),V.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||I.current||(I.current=!0,V.current=ce.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{O||j(!1)},onDragEnd:()=>j(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},D.filter(ce=>!ce.position&&ee===0||ce.position===X).map((ce,ne)=>{var we,_e;return Ce.createElement(C6,{key:ce.id,icons:R,index:ne,toast:ce,defaultRichColors:b,duration:(we=S==null?void 0:S.duration)!=null?we:w,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:s,visibleToasts:E,closeButton:(_e=S==null?void 0:S.closeButton)!=null?_e:m,interacting:O,position:X,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,closeButtonAriaLabel:S==null?void 0:S.closeButtonAriaLabel,removeToast:Y,toasts:D.filter(ye=>ye.position==ce.position),heights:G.filter(ye=>ye.position==ce.position),setHeights:q,expandByDefault:d,gap:k,expanded:B,swipeDirections:t.swipeDirections})})):null}))});function Sn(e,t=[]){let r=[];function i(o,u){const d=v.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=p=>{var S;const{scope:y,children:b,...w}=p,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=v.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})};h.displayName=o+"Provider";function g(p,y,b={}){var S;const{optional:w=!1}=b,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=v.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,g]}const s=()=>{const o=r.map(u=>v.createContext(u));return function(d){const m=(d==null?void 0:d[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[i,k6(s,...t)]}function k6(...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 v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function nC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function N6(...e){return t=>{let r=!1;const i=e.map(s=>{const o=nC(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():nC(e[s],null)}}}}function it(...e){return v.useCallback(N6(...e),e)}function Le(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Xt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},A6=La[" useId ".trim().toString()]||(()=>{}),T6=0;function vn(e){const[t,r]=v.useState(A6());return Xt(()=>{r(i=>i??String(T6++))},[e]),t?`radix-${t}`:""}var M6=La[" useInsertionEffect ".trim().toString()]||Xt;function Eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[s,o,u]=j6({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s;{const g=v.useRef(e!==void 0);v.useEffect(()=>{const p=g.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.`),g.current=d},[d,i])}const h=v.useCallback(g=>{var p;if(d){const y=D6(g)?g(e):g;y!==e&&((p=u.current)==null||p.call(u,y))}else o(g)},[d,e,o,u]);return[m,h]}function j6({defaultProp:e,onChange:t}){const[r,i]=v.useState(e),s=v.useRef(r),o=v.useRef(t);return M6(()=>{o.current=t},[t]),v.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}function D6(e){return typeof e=="function"}function Ro(e){const t=v.forwardRef((r,i)=>{let{children:s,...o}=r,u=null,d=!1;const m=[];sC(s)&&typeof Mh=="function"&&(s=Mh(s._payload)),v.Children.forEach(s,y=>{var b;if(z6(y)){d=!0;const w=y;let C="child"in w.props?w.props.child:w.props.children;sC(C)&&typeof Mh=="function"&&(C=Mh(C._payload)),u=B6(w,C),m.push((b=u==null?void 0:u.props)==null?void 0:b.children)}else m.push(y)}),u?u=v.cloneElement(u,void 0,m):!d&&v.Children.count(s)===1&&v.isValidElement(s)&&(u=s);const h=u?I6(u):void 0,g=it(i,h);if(!u){if(s||s===0)throw new Error(d?F6(e):H6(e));return s}const p=P6(o,u.props??{});return u.type!==v.Fragment&&(p.ref=i?g:h),v.cloneElement(u,p)});return t.displayName=`${e}.Slot`,t}var L6=Ro("Slot"),O6=Symbol.for("radix.slottable"),B6=(e,t)=>{if("child"in e.props){const r=e.props.child;return v.isValidElement(r)?v.cloneElement(r,void 0,e.props.children(r.props.children)):null}return v.isValidElement(t)?t:null};function P6(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 I6(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 z6(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O6}var $6=Symbol.for("react.lazy");function sC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$6&&"_payload"in e&&U6(e._payload)}function U6(e){return typeof e=="object"&&e!==null&&"then"in e}var H6=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,F6=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Mh=La[" use ".trim().toString()],W6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ve=W6.reduce((e,t)=>{const r=Ro(`Primitive.${t}`),i=v.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 PR(e,t){e&&Ia.flushSync(()=>e.dispatchEvent(t))}function pr(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}var q6="DismissableLayer",z_="dismissableLayer.update",V6="dismissableLayer.pointerDownOutside",G6="dismissableLayer.focusOutside",aC,Mx=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),tm=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...h}=e,g=v.useContext(Mx),[p,y]=v.useState(null),b=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=v.useState({}),C=it(t,y),E=Array.from(g.layers),[S]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),N=S?E.indexOf(S):-1,k=p?E.indexOf(p):-1,R=g.layersWithOutsidePointerEventsDisabled.size>0,M=k>=N,L=v.useRef(!1),z=Q6(q=>{o==null||o(q),d==null||d(q),q.defaultPrevented||m==null||m()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(q=>{if(!(q instanceof Node))return!1;const B=[...g.branches].some(j=>j.contains(q));return M&&!B},[g.branches,M])}),D=J6(q=>{if(i&&L.current)return;const B=q.target;[...g.branches].some(O=>O.contains(B))||(u==null||u(q),d==null||d(q),q.defaultPrevented||m==null||m())},b),W=p?k===E.length-1:!1,G=pr(q=>{q.key==="Escape"&&(s==null||s(q),!q.defaultPrevented&&m&&(q.preventDefault(),m()))});return v.useEffect(()=>{if(W)return b.addEventListener("keydown",G,{capture:!0}),()=>b.removeEventListener("keydown",G,{capture:!0})},[b,W,G]),v.useEffect(()=>{if(p)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(aC=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(p)),g.layers.add(p),oC(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(p),g.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=aC))}},[p,b,r,g]),v.useEffect(()=>()=>{p&&(g.layers.delete(p),g.layersWithOutsidePointerEventsDisabled.delete(p),oC())},[p,g]),v.useEffect(()=>{const q=()=>w({});return document.addEventListener(z_,q),()=>document.removeEventListener(z_,q)},[]),l.jsx(Ve.div,{...h,ref:C,style:{pointerEvents:R?M?"auto":"none":void 0,...e.style},onFocusCapture:Le(e.onFocusCapture,D.onFocusCapture),onBlurCapture:Le(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Le(e.onPointerDownCapture,z.onPointerDownCapture)})});tm.displayName=q6;var Y6="DismissableLayerBranch",K6=v.forwardRef((e,t)=>{const r=v.useContext(Mx),i=v.useRef(null),s=it(t,i);return v.useEffect(()=>{const o=i.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(Ve.div,{...e,ref:s})});K6.displayName=Y6;function X6(){const e=v.useContext(Mx),[t,r]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var Z6=()=>!0;function Q6(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:u=Z6}=t,d=pr(e),m=v.useRef(!1),h=v.useRef(!1),g=v.useRef(new Map),p=v.useRef(()=>{});return v.useEffect(()=>{function y(){h.current=!1,s.current=!1,g.current.clear()}function b(){return Array.from(g.current.values()).some(Boolean)}function w(k){if(!h.current)return;const R=k.target;R instanceof Node&&[...o].some(L=>L.contains(R))||g.current.set(k.type,!0),k.type==="click"&&window.setTimeout(()=>{h.current&&p.current()},0)}function C(k){h.current&&g.current.set(k.type,!1)}const E=k=>{if(k.target&&!m.current){let R=function(){r.removeEventListener("click",p.current);const L=b();y(),L||IR(V6,d,M,{discrete:!0})};if(!u(k.target)){r.removeEventListener("click",p.current),y(),m.current=!1;return}const M={originalEvent:k};h.current=!0,s.current=i&&k.button===0,g.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),y();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 J6(e,t=globalThis==null?void 0:globalThis.document){const r=pr(e),i=v.useRef(!1);return v.useEffect(()=>{const s=o=>{o.target&&!i.current&&IR(G6,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 oC(){const e=new CustomEvent(z_);document.dispatchEvent(e)}function IR(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?PR(s,o):s.dispatchEvent(o)}var ov="focusScope.autoFocusOnMount",lv="focusScope.autoFocusOnUnmount",lC={bubbles:!1,cancelable:!0},eP="FocusScope",rm=v.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...u}=e,[d,m]=v.useState(null),h=pr(s),g=pr(o),p=v.useRef(null),y=it(t,m),b=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.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]),v.useEffect(()=>{if(d){uC.add(b);const C=document.activeElement;if(!d.contains(C)){const S=new CustomEvent(ov,lC);d.addEventListener(ov,h),d.dispatchEvent(S),S.defaultPrevented||(tP(aP(zR(d)),{select:!0}),document.activeElement===C&&xa(d))}return()=>{d.removeEventListener(ov,h),setTimeout(()=>{const S=new CustomEvent(lv,lC);d.addEventListener(lv,g),d.dispatchEvent(S),S.defaultPrevented||xa(C??document.body,{select:!0}),d.removeEventListener(lv,g),uC.remove(b)},0)}}},[d,h,g,b]);const w=v.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]=rP(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(Ve.div,{tabIndex:-1,...u,ref:y,onKeyDown:w})});rm.displayName=eP;function tP(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(xa(i,{select:t}),document.activeElement!==r)return}function rP(e){const t=zR(e),r=cC(t,e),i=cC(t.reverse(),e);return[r,i]}function zR(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 cC(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):iP(i,{upTo:t})))return i}function iP(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 nP(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&&nP(e)&&t&&e.select()}}var uC=sP();function sP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=dC(e,t),e.unshift(t)},remove(t){var r;e=dC(e,t),(r=e[0])==null||r.resume()}}}function dC(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function aP(e){return e.filter(t=>t.tagName!=="A")}var oP="Portal",im=v.forwardRef((e,t)=>{var d;const{container:r,...i}=e,[s,o]=v.useState(!1);Xt(()=>o(!0),[]);const u=r||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return u?Ia.createPortal(l.jsx(Ve.div,{...i,ref:t}),u):null});im.displayName=oP;function lP(e,t){return v.useReducer((r,i)=>t[r][i]??r,e)}var Cn=e=>{const{present:t,children:r}=e,i=cP(t),s=typeof r=="function"?r({present:i.isPresent}):v.Children.only(r),o=uP(i.ref,dP(s));return typeof r=="function"||i.isPresent?v.cloneElement(s,{ref:o}):null};Cn.displayName="Presence";function cP(e){const[t,r]=v.useState(),i=v.useRef(null),s=v.useRef(e),o=v.useRef("none"),u=v.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=lP(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{m==="mounted"?(o.current=u.current??eu(i.current),u.current=void 0):o.current="none"},[m]),Xt(()=>{const g=i.current,p=s.current;if(p!==e){const b=o.current,w=eu(g);e?(u.current=w,h("MOUNT")):w==="none"||(g==null?void 0:g.display)==="none"?h("UNMOUNT"):h(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Xt(()=>{if(t){let g;const p=t.ownerDocument.defaultView??window,y=w=>{const E=eu(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",g=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},b=w=>{w.target===t&&(o.current=eu(i.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{p.clearTimeout(g),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:v.useCallback(g=>{if(g){const p=getComputedStyle(g);i.current=p,u.current=eu(p)}else i.current=null;r(g)},[])}}function hC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function uP(...e){const t=v.useRef(e);return t.current=e,v.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=hC(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():hC(i[u],null)}}},[])}function eu(e){return(e==null?void 0:e.animationName)||"none"}function dP(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 jh=0,Bn=null;function jx(){v.useEffect(()=>{Bn||(Bn={start:fC(),end:fC()});const{start:e,end:t}=Bn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),jh++,()=>{jh===1&&(Bn==null||Bn.start.remove(),Bn==null||Bn.end.remove(),Bn=null),jh=Math.max(0,jh-1)}},[])}function fC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Vn=function(){return Vn=Object.assign||function(t){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Vn.apply(this,arguments)};function $R(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 hP(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 af="right-scroll-bar-position",of="width-before-scroll-bar",fP="with-scroll-bars-hidden",mP="--removed-body-scroll-bar-size";function cv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pP(e,t){var r=v.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 gP=typeof window<"u"?v.useLayoutEffect:v.useEffect,mC=new WeakMap;function vP(e,t){var r=pP(null,function(i){return e.forEach(function(s){return cv(s,i)})});return gP(function(){var i=mC.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)})}mC.set(r,e)},[e]),r}function _P(e){return e}function xP(e,t){t===void 0&&(t=_P);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 g=u;u=[],g.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),r={push:function(g){u.push(g),h()},filter:function(g){return u=u.filter(g),r}}}};return s}function yP(e){e===void 0&&(e={});var t=xP(null);return t.options=Vn({async:!0,ssr:!1},e),t}var UR=function(e){var t=e.sideCar,r=$R(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 v.createElement(i,Vn({},r))};UR.isSideCarExport=!0;function bP(e,t){return e.useMedium(t),UR}var HR=yP(),uv=function(){},nm=v.forwardRef(function(e,t){var r=v.useRef(null),i=v.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,g=e.enabled,p=e.shards,y=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=$R(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=y,L=vP([r,t]),z=Vn(Vn({},R),s);return v.createElement(v.Fragment,null,g&&v.createElement(M,{sideCar:HR,removeScrollBar:h,shards:p,noRelative:b,noIsolation:w,inert:C,setCallbacks:o,allowPinchZoom:!!E,lockRef:r,gapMode:k}),u?v.cloneElement(v.Children.only(d),Vn(Vn({},z),{ref:L})):v.createElement(N,Vn({},z,{className:m,ref:L}),d))});nm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nm.classNames={fullWidth:of,zeroRight:af};var wP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wP();return t&&e.setAttribute("nonce",t),e}function CP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function EP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var RP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=SP())&&(CP(t,r),EP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},kP=function(){var e=RP();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},FR=function(){var e=kP(),t=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return t},NP={left:0,top:0,right:0,gap:0},dv=function(e){return parseInt(e||"",10)||0},AP=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)]},TP=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return NP;var t=AP(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])}},MP=FR(),Wl="data-scroll-locked",jP=function(e,t,r,i){var s=e.left,o=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),`
|
|
486
|
+
.`.concat(fP,` {
|
|
487
|
+
overflow: hidden `).concat(i,`;
|
|
488
|
+
padding-right: `).concat(d,"px ").concat(i,`;
|
|
489
|
+
}
|
|
490
|
+
body[`).concat(Wl,`] {
|
|
491
|
+
overflow: hidden `).concat(i,`;
|
|
492
|
+
overscroll-behavior: contain;
|
|
493
|
+
`).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&`
|
|
494
|
+
padding-left: `.concat(s,`px;
|
|
495
|
+
padding-top: `).concat(o,`px;
|
|
496
|
+
padding-right: `).concat(u,`px;
|
|
497
|
+
margin-left:0;
|
|
498
|
+
margin-top:0;
|
|
499
|
+
margin-right: `).concat(d,"px ").concat(i,`;
|
|
500
|
+
`),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),`
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.`).concat(af,` {
|
|
504
|
+
right: `).concat(d,"px ").concat(i,`;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.`).concat(of,` {
|
|
508
|
+
margin-right: `).concat(d,"px ").concat(i,`;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.`).concat(af," .").concat(af,` {
|
|
512
|
+
right: 0 `).concat(i,`;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.`).concat(of," .").concat(of,` {
|
|
516
|
+
margin-right: 0 `).concat(i,`;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
body[`).concat(Wl,`] {
|
|
520
|
+
`).concat(mP,": ").concat(d,`px;
|
|
521
|
+
}
|
|
522
|
+
`)},pC=function(){var e=parseInt(document.body.getAttribute(Wl)||"0",10);return isFinite(e)?e:0},DP=function(){v.useEffect(function(){return document.body.setAttribute(Wl,(pC()+1).toString()),function(){var e=pC()-1;e<=0?document.body.removeAttribute(Wl):document.body.setAttribute(Wl,e.toString())}},[])},LP=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;DP();var o=v.useMemo(function(){return TP(s)},[s]);return v.createElement(MP,{styles:jP(o,!t,s,r?"":"!important")})},$_=!1;if(typeof window<"u")try{var Dh=Object.defineProperty({},"passive",{get:function(){return $_=!0,!0}});window.addEventListener("test",Dh,Dh),window.removeEventListener("test",Dh,Dh)}catch{$_=!1}var Nl=$_?{passive:!1}:!1,OP=function(e){return e.tagName==="TEXTAREA"},WR=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!OP(e)&&r[t]==="visible")},BP=function(e){return WR(e,"overflowY")},PP=function(e){return WR(e,"overflowX")},gC=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=qR(e,i);if(s){var o=VR(e,i),u=o[1],d=o[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},IP=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},zP=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},qR=function(e,t){return e==="v"?BP(t):PP(t)},VR=function(e,t){return e==="v"?IP(t):zP(t)},$P=function(e,t){return e==="h"&&t==="rtl"?-1:1},UP=function(e,t,r,i,s){var o=$P(e,window.getComputedStyle(t).direction),u=o*i,d=r.target,m=t.contains(d),h=!1,g=u>0,p=0,y=0;do{if(!d)break;var b=VR(e,d),w=b[0],C=b[1],E=b[2],S=C-E-o*w;(w||S)&&qR(e,d)&&(p+=S,y+=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(g&&Math.abs(p)<1||!g&&Math.abs(y)<1)&&(h=!0),h},Lh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vC=function(e){return[e.deltaX,e.deltaY]},_C=function(e){return e&&"current"in e?e.current:e},HP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},FP=function(e){return`
|
|
523
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
524
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
525
|
+
`)},WP=0,Al=[];function qP(e){var t=v.useRef([]),r=v.useRef([0,0]),i=v.useRef(),s=v.useState(WP++)[0],o=v.useState(FR)[0],u=v.useRef(e);v.useEffect(function(){u.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var C=hP([e.lockRef.current],(e.shards||[]).map(_C),!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=v.useCallback(function(C,E){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var S=Lh(C),N=r.current,k="deltaX"in C?C.deltaX:N[0]-S[0],R="deltaY"in C?C.deltaY:N[1]-S[1],M,L=C.target,z=Math.abs(k)>Math.abs(R)?"h":"v";if("touches"in C&&z==="h"&&L.type==="range")return!1;var D=window.getSelection(),W=D&&D.anchorNode,G=W?W===L||W.contains(L):!1;if(G)return!1;var q=gC(z,L);if(!q)return!0;if(q?M=z:(M=z==="v"?"h":"v",q=gC(z,L)),!q)return!1;if(!i.current&&"changedTouches"in C&&(k||R)&&(i.current=M),!M)return!0;var B=i.current||M;return UP(B,E,C,B==="h"?k:R)},[]),m=v.useCallback(function(C){var E=C;if(!(!Al.length||Al[Al.length-1]!==o)){var S="deltaY"in E?vC(E):Lh(E),N=t.current.filter(function(M){return M.name===E.type&&(M.target===E.target||E.target===M.shadowParent)&&HP(M.delta,S)})[0];if(N&&N.should){E.cancelable&&E.preventDefault();return}if(!N){var k=(u.current.shards||[]).map(_C).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=v.useCallback(function(C,E,S,N){var k={name:C,delta:E,target:S,should:N,shadowParent:VP(S)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(R){return R!==k})},1)},[]),g=v.useCallback(function(C){r.current=Lh(C),i.current=void 0},[]),p=v.useCallback(function(C){h(C.type,vC(C),C.target,d(C,e.lockRef.current))},[]),y=v.useCallback(function(C){h(C.type,Lh(C),C.target,d(C,e.lockRef.current))},[]);v.useEffect(function(){return Al.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",m,Nl),document.addEventListener("touchmove",m,Nl),document.addEventListener("touchstart",g,Nl),function(){Al=Al.filter(function(C){return C!==o}),document.removeEventListener("wheel",m,Nl),document.removeEventListener("touchmove",m,Nl),document.removeEventListener("touchstart",g,Nl)}},[]);var b=e.removeScrollBar,w=e.inert;return v.createElement(v.Fragment,null,w?v.createElement(o,{styles:FP(s)}):null,b?v.createElement(LP,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function VP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const GP=bP(HR,qP);var sm=v.forwardRef(function(e,t){return v.createElement(nm,Vn({},e,{ref:t,sideCar:GP}))});sm.classNames=nm.classNames;var YP=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Tl=new WeakMap,Oh=new WeakMap,Bh={},hv=0,GR=function(e){return e&&(e.host||GR(e.parentNode))},KP=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=GR(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})},XP=function(e,t,r,i){var s=KP(t,Array.isArray(e)?e:[e]);Bh[r]||(Bh[r]=new WeakMap);var o=Bh[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 g=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(y){if(d.has(y))g(y);else try{var b=y.getAttribute(i),w=b!==null&&b!=="false",C=(Tl.get(y)||0)+1,E=(o.get(y)||0)+1;Tl.set(y,C),o.set(y,E),u.push(y),C===1&&w&&Oh.set(y,!0),E===1&&y.setAttribute(r,"true"),w||y.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",y,S)}})};return g(t),d.clear(),hv++,function(){u.forEach(function(p){var y=Tl.get(p)-1,b=o.get(p)-1;Tl.set(p,y),o.set(p,b),y||(Oh.has(p)||p.removeAttribute(i),Oh.delete(p)),b||p.removeAttribute(r)}),hv--,hv||(Tl=new WeakMap,Tl=new WeakMap,Oh=new WeakMap,Bh={})}},Dx=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=YP(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),XP(i,s,r,"aria-hidden")):function(){return null}},am="Dialog",[YR,KR]=Sn(am),[ZP,En]=YR(am),Lx=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:u=!0}=e,d=v.useRef(null),m=v.useRef(null),[h,g]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:am});return l.jsx(ZP,{scope:t,triggerRef:d,contentRef:m,contentId:vn(),titleId:vn(),descriptionId:vn(),open:h,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(p=>!p),[g]),modal:u,children:r})};Lx.displayName=am;var XR="DialogTrigger",om=v.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(XR,r),o=it(t,s.triggerRef);return l.jsx(Ve.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Px(s.open),...i,ref:o,onClick:Le(e.onClick,s.onOpenToggle)})});om.displayName=XR;var Ox="DialogPortal",[QP,ZR]=YR(Ox,{forceMount:void 0}),Bx=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:s}=e,o=En(Ox,t);return l.jsx(QP,{scope:t,forceMount:r,children:v.Children.map(i,u=>l.jsx(Cn,{present:r||o.open,children:l.jsx(im,{asChild:!0,container:s,children:u})}))})};Bx.displayName=Ox;var kf="DialogOverlay",lm=v.forwardRef((e,t)=>{const r=ZR(kf,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=En(kf,e.__scopeDialog);return o.modal?l.jsx(Cn,{present:i||o.open,children:l.jsx(eI,{...s,ref:t})}):null});lm.displayName=kf;var JP=Ro("DialogOverlay.RemoveScroll"),eI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(kf,r),o=X6(),u=it(t,o);return l.jsx(sm,{as:JP,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Ve.div,{"data-state":Px(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Kl="DialogContent",cm=v.forwardRef((e,t)=>{const r=ZR(Kl,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,o=En(Kl,e.__scopeDialog);return l.jsx(Cn,{present:i||o.open,children:o.modal?l.jsx(tI,{...s,ref:t}):l.jsx(rI,{...s,ref:t})})});cm.displayName=Kl;var tI=v.forwardRef((e,t)=>{const r=En(Kl,e.__scopeDialog),i=v.useRef(null),s=it(t,r.contentRef,i);return v.useEffect(()=>{const o=i.current;if(o)return Dx(o)},[]),l.jsx(QR,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Le(e.onCloseAutoFocus,o=>{var u;o.preventDefault(),(u=r.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Le(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&o.preventDefault()}),onFocusOutside:Le(e.onFocusOutside,o=>o.preventDefault())})}),rI=v.forwardRef((e,t)=>{const r=En(Kl,e.__scopeDialog),i=v.useRef(!1),s=v.useRef(!1);return l.jsx(QR,{...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()}})}),QR=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,...u}=e,d=En(Kl,r);return jx(),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":Px(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),JR="DialogTitle",um=v.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(JR,r);return l.jsx(Ve.h2,{id:s.titleId,...i,ref:t})});um.displayName=JR;var ek="DialogDescription",dm=v.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(ek,r);return l.jsx(Ve.p,{id:s.descriptionId,...i,ref:t})});dm.displayName=ek;var tk="DialogClose",Do=v.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=En(tk,r);return l.jsx(Ve.button,{type:"button",...i,ref:t,onClick:Le(e.onClick,()=>s.onOpenChange(!1))})});Do.displayName=tk;function Px(e){return e?"open":"closed"}var rk="AlertDialog",[iI]=Sn(rk,[KR]),Ps=KR(),ik=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx(Lx,{...i,...r,modal:!0})};ik.displayName=rk;var nI="AlertDialogTrigger",nk=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(om,{...s,...i,ref:t})});nk.displayName=nI;var sI="AlertDialogPortal",sk=e=>{const{__scopeAlertDialog:t,...r}=e,i=Ps(t);return l.jsx(Bx,{...i,...r})};sk.displayName=sI;var aI="AlertDialogOverlay",ak=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(lm,{...s,...i,ref:t})});ak.displayName=aI;var ok="AlertDialogContent",[oI,lI]=iI(ok),lk=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...s}=e,o=Ps(r),u=v.useRef(null),d=it(t,u),m=v.useRef(null);return l.jsx(oI,{scope:r,cancelRef:m,children:l.jsx(cm,{role:"alertdialog",...o,...s,ref:d,onOpenAutoFocus:Le(s.onOpenAutoFocus,h=>{var g;h.preventDefault(),(g=m.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:i})})});lk.displayName=ok;var cI="AlertDialogTitle",ck=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(um,{...s,...i,ref:t})});ck.displayName=cI;var uI="AlertDialogDescription",uk=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(dm,{...s,...i,ref:t})});uk.displayName=uI;var dI="AlertDialogAction",dk=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Ps(r);return l.jsx(Do,{...s,...i,ref:t})});dk.displayName=dI;var hk="AlertDialogCancel",fk=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:s}=lI(hk,r),o=Ps(r),u=it(t,s);return l.jsx(Do,{...o,...i,ref:u})});fk.displayName=hk;var hI=ik,mk=nk,fI=sk,pk=ak,gk=lk,vk=dk,_k=fk,xk=ck,yk=uk;function bk(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=bk(e[t]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function Ix(){for(var e,t,r=0,i="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=bk(e))&&(i&&(i+=" "),i+=t);return i}const mI=(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},pI=(e,t)=>({classGroupId:e,validator:t}),wk=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Nf="-",xC=[],gI="arbitrary..",vI=e=>{const t=xI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return _I(u);const d=u.split(Nf),m=d[0]===""&&d.length>1?1:0;return Sk(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],h=r[u];return m?h?mI(h,m):m:h||xC}return r[u]||xC}}},Sk=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],o=r.nextPart.get(s);if(o){const h=Sk(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 g=u[h];if(g.validator(d))return g.classGroupId}},_I=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?gI+i:void 0})(),xI=e=>{const{theme:t,classGroups:r}=e;return yI(r,t)},yI=(e,t)=>{const r=wk();for(const i in e){const s=e[i];zx(s,r,i,t)}return r},zx=(e,t,r,i)=>{const s=e.length;for(let o=0;o<s;o++){const u=e[o];bI(u,t,r,i)}},bI=(e,t,r,i)=>{if(typeof e=="string"){wI(e,t,r);return}if(typeof e=="function"){SI(e,t,r,i);return}CI(e,t,r,i)},wI=(e,t,r)=>{const i=e===""?t:Ck(t,e);i.classGroupId=r},SI=(e,t,r,i)=>{if(EI(e)){zx(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(pI(r,e))},CI=(e,t,r,i)=>{const s=Object.entries(e),o=s.length;for(let u=0;u<o;u++){const[d,m]=s[u];zx(m,Ck(t,d),r,i)}},Ck=(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=wk(),r.nextPart.set(u,d)),r=d}return r},EI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,RI=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)}}},U_="!",yC=":",kI=[],bC=(e,t,r,i,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),NI=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=s=>{const o=[];let u=0,d=0,m=0,h;const g=s.length;for(let C=0;C<g;C++){const E=s[C];if(u===0&&d===0){if(E===yC){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 y=p,b=!1;p.endsWith(U_)?(y=p.slice(0,-1),b=!0):p.startsWith(U_)&&(y=p.slice(1),b=!0);const w=h&&h>m?h-m:void 0;return bC(o,b,y,w)};if(t){const s=t+yC,o=i;i=u=>u.startsWith(s)?o(u.slice(s.length)):bC(kI,!1,u,void 0,!0)}if(r){const s=i;i=o=>r({className:o,parseClassName:s})}return i},AI=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}},TI=e=>({cache:RI(e.cacheSize),parseClassName:NI(e),sortModifiers:AI(e),postfixLookupClassGroupIds:MI(e),...vI(e)}),MI=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},jI=/\s+/,DI=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(jI);let h="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:y,modifiers:b,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:E}=r(p);if(y){h=p+(h.length>0?" "+h:h);continue}let S=!!E,N;if(S){const z=C.substring(0,E);N=i(z);const D=N&&u[N]?i(C):void 0;D&&D!==N&&(N=D,S=!1)}else N=i(C);if(!N){if(!S){h=p+(h.length>0?" "+h:h);continue}if(N=i(C),!N){h=p+(h.length>0?" "+h:h);continue}S=!1}const k=b.length===0?"":b.length===1?b[0]:o(b).join(":"),R=w?k+U_:k,M=R+N;if(d.indexOf(M)>-1)continue;d.push(M);const L=s(N,S);for(let z=0;z<L.length;++z){const D=L[z];d.push(R+D)}h=p+(h.length>0?" "+h:h)}return h},LI=(...e)=>{let t=0,r,i,s="";for(;t<e.length;)(r=e[t++])&&(i=Ek(r))&&(s&&(s+=" "),s+=i);return s},Ek=e=>{if(typeof e=="string")return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=Ek(e[i]))&&(r&&(r+=" "),r+=t);return r},OI=(e,...t)=>{let r,i,s,o;const u=m=>{const h=t.reduce((g,p)=>p(g),e());return r=TI(h),i=r.cache.get,s=r.cache.set,o=d,d(m)},d=m=>{const h=i(m);if(h)return h;const g=DI(m,r);return s(m,g),g};return o=u,(...m)=>o(LI(...m))},BI=[],hr=e=>{const t=r=>r[e]||BI;return t.isThemeGetter=!0,t},Rk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,II=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zI=/\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$/,$I=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fa=e=>PI.test(e),et=e=>!!e&&!Number.isNaN(Number(e)),Pn=e=>!!e&&Number.isInteger(Number(e)),fv=e=>e.endsWith("%")&&et(e.slice(0,-1)),Cs=e=>II.test(e),Nk=()=>!0,FI=e=>zI.test(e)&&!$I.test(e),$x=()=>!1,WI=e=>UI.test(e),qI=e=>HI.test(e),VI=e=>!Te(e)&&!Me(e),GI=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)),YI=e=>za(e,Mk,$x),Te=e=>Rk.test(e),lo=e=>za(e,jk,FI),wC=e=>za(e,r8,et),KI=e=>za(e,Lk,Nk),XI=e=>za(e,Dk,$x),SC=e=>za(e,Ak,$x),ZI=e=>za(e,Tk,qI),Ph=e=>za(e,Ok,WI),Me=e=>kk.test(e),tu=e=>Lo(e,jk),QI=e=>Lo(e,Dk),CC=e=>Lo(e,Ak),JI=e=>Lo(e,Mk),e8=e=>Lo(e,Tk),Ih=e=>Lo(e,Ok,!0),t8=e=>Lo(e,Lk,!0),za=(e,t,r)=>{const i=Rk.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Lo=(e,t,r=!1)=>{const i=kk.exec(e);return i?i[1]?t(i[1]):r:!1},Ak=e=>e==="position"||e==="percentage",Tk=e=>e==="image"||e==="url",Mk=e=>e==="length"||e==="size"||e==="bg-size",jk=e=>e==="length",r8=e=>e==="number",Dk=e=>e==="family-name",Lk=e=>e==="number"||e==="weight",Ok=e=>e==="shadow",i8=()=>{const e=hr("color"),t=hr("font"),r=hr("text"),i=hr("font-weight"),s=hr("tracking"),o=hr("leading"),u=hr("breakpoint"),d=hr("container"),m=hr("spacing"),h=hr("radius"),g=hr("shadow"),p=hr("inset-shadow"),y=hr("text-shadow"),b=hr("drop-shadow"),w=hr("blur"),C=hr("perspective"),E=hr("aspect"),S=hr("ease"),N=hr("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...R(),Me,Te],L=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],D=()=>[Me,Te,m],W=()=>[fa,"full","auto",...D()],G=()=>[Pn,"none","subgrid",Me,Te],q=()=>["auto",{span:["full",Pn,Me,Te]},Pn,Me,Te],B=()=>[Pn,"auto",Me,Te],j=()=>["auto","min","max","fr",Me,Te],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...D()],U=()=>[fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],H=()=>[fa,"screen","full","dvw","lvw","svw","min","max","fit",...D()],F=()=>[fa,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],V=()=>[e,Me,Te],I=()=>[...R(),CC,SC,{position:[Me,Te]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",JI,YI,{size:[Me,Te]}],ee=()=>[fv,tu,lo],re=()=>["","none","full",h,Me,Te],oe=()=>["",et,tu,lo],Z=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[et,fv,CC,SC],we=()=>["","none",w,Me,Te],_e=()=>["none",et,Me,Te],ye=()=>["none",et,Me,Te],J=()=>[et,Me,Te],ie=()=>[fa,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Cs],breakpoint:[Cs],color:[Nk],container:[Cs],"drop-shadow":[Cs],ease:["in","out","in-out"],font:[VI],"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":[GI],columns:[{columns:[et,Te,Me,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{"inset-s":W(),start:W()}],end:[{"inset-e":W(),end:W()}],"inset-bs":[{"inset-bs":W()}],"inset-be":[{"inset-be":W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Pn,"auto",Me,Te]}],basis:[{basis:[fa,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[et,fa,"auto","initial","none",Te]}],grow:[{grow:["",et,Me,Te]}],shrink:[{shrink:["",et,Me,Te]}],order:[{order:[Pn,"first","last","none",Me,Te]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mbs:[{mbs:T()}],mbe:[{mbe:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[d,"screen",...U()]}],"min-w":[{"min-w":[d,"screen","none",...U()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",r,tu,lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,t8,KI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fv,Te]}],"font-family":[{font:[QI,XI,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,wC]}],leading:[{leading:[o,...D()]}],"list-image":[{"list-image":["none",Me,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Me,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[et,"from-font","auto",Me,lo]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[et,"auto",Me,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[Pn,Me,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Me,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Me,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Pn,Me,Te],radial:["",Me,Te],conic:[Pn,Me,Te]},e8,ZI]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[et,Me,Te]}],"outline-w":[{outline:["",et,tu,lo]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",g,Ih,Ph]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",p,Ih,Ph]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[et,lo]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",y,Ih,Ph]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[et,Me,Te]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[et]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Me,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[et]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Me,Te]}],filter:[{filter:["","none",Me,Te]}],blur:[{blur:we()}],brightness:[{brightness:[et,Me,Te]}],contrast:[{contrast:[et,Me,Te]}],"drop-shadow":[{"drop-shadow":["","none",b,Ih,Ph]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",et,Me,Te]}],"hue-rotate":[{"hue-rotate":[et,Me,Te]}],invert:[{invert:["",et,Me,Te]}],saturate:[{saturate:[et,Me,Te]}],sepia:[{sepia:["",et,Me,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",Me,Te]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[et,Me,Te]}],"backdrop-contrast":[{"backdrop-contrast":[et,Me,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",et,Me,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[et,Me,Te]}],"backdrop-invert":[{"backdrop-invert":["",et,Me,Te]}],"backdrop-opacity":[{"backdrop-opacity":[et,Me,Te]}],"backdrop-saturate":[{"backdrop-saturate":[et,Me,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",et,Me,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Me,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[et,"initial",Me,Te]}],ease:[{ease:["linear","initial",S,Me,Te]}],delay:[{delay:[et,Me,Te]}],animate:[{animate:["none",N,Me,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Me,Te]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[Me,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":["translate-none"],zoom:[{zoom:[Pn,Me,Te]}],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Me,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":V()}],"scrollbar-track-color":[{"scrollbar-track":V()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Me,Te]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[et,tu,lo,wC]}],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"]}},Bk=OI(i8);function ct(...e){return Bk(Ix(e))}const EC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,RC=Ix,Pk=(e,t)=>r=>{var i;if((t==null?void 0:t.variants)==null)return RC(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 g=r==null?void 0:r[h],p=o==null?void 0:o[h];if(g===null)return null;const y=EC(g)||EC(p);return s[h][y]}),d=r&&Object.entries(r).reduce((h,g)=>{let[p,y]=g;return y===void 0||(h[p]=y),h},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((h,g)=>{let{class:p,className:y,...b}=g;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,y]:h},[]);return RC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},n8=Pk("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=v.forwardRef(({className:e,variant:t,size:r,asChild:i=!1,...s},o)=>{const u=i?L6:"button";return l.jsx(u,{ref:o,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:ct(n8({variant:t,size:r,className:e})),...s})});he.displayName="Button";function Rn(e){return l.jsx(hI,{"data-slot":"alert-dialog",...e})}const es=v.forwardRef((e,t)=>l.jsx(mk,{ref:t,"data-slot":"alert-dialog-trigger",...e}));es.displayName=mk.displayName;function s8(e){return l.jsx(fI,{"data-slot":"alert-dialog-portal",...e})}const Ik=v.forwardRef(({className:e,...t},r)=>l.jsx(pk,{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}));Ik.displayName=pk.displayName;const Ji=v.forwardRef(({className:e,size:t="default",...r},i)=>l.jsxs(s8,{children:[l.jsx(Ik,{}),l.jsx(gk,{ref:i,"data-slot":"alert-dialog-content","data-size":t,className:ct("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));Ji.displayName=gk.displayName;function kn({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:ct("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Nn({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function a8({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-media",className:ct("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",e),...t})}const en=v.forwardRef(({className:e,...t},r)=>l.jsx(xk,{ref:r,"data-slot":"alert-dialog-title",className:ct("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));en.displayName=xk.displayName;const tn=v.forwardRef(({className:e,...t},r)=>l.jsx(yk,{ref:r,"data-slot":"alert-dialog-description",className:ct("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));tn.displayName=yk.displayName;const An=v.forwardRef(({className:e,variant:t="default",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(vk,{ref:s,"data-slot":"alert-dialog-action",className:ct(e),...i})}));An.displayName=vk.displayName;const rn=v.forwardRef(({className:e,variant:t="outline",size:r="default",...i},s)=>l.jsx(he,{variant:t,size:r,asChild:!0,children:l.jsx(_k,{ref:s,"data-slot":"alert-dialog-cancel",className:ct(e),...i})}));rn.displayName=_k.displayName;function Oo(e){return l.jsx(Lx,{"data-slot":"dialog",...e})}const zk=v.forwardRef((e,t)=>l.jsx(om,{ref:t,"data-slot":"dialog-trigger",...e}));zk.displayName=om.displayName;function o8(e){return l.jsx(Bx,{"data-slot":"dialog-portal",...e})}const Ju=v.forwardRef((e,t)=>l.jsx(Do,{ref:t,"data-slot":"dialog-close",...e}));Ju.displayName=Do.displayName;const $k=v.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}));$k.displayName=lm.displayName;const $a=v.forwardRef(({className:e,children:t,showCloseButton:r=!0,...i},s)=>l.jsxs(o8,{children:[l.jsx($k,{}),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(Na,{"aria-hidden":"true"}),l.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));$a.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 ed({className:e,showCloseButton:t=!1,children:r,...i}){return l.jsxs("div",{"data-slot":"dialog-footer",className:ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...i,children:[r,t&&l.jsx(Do,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Close"})})]})}const Ua=v.forwardRef(({className:e,...t},r)=>l.jsx(um,{ref:r,"data-slot":"dialog-title",className:ct("text-base leading-none font-medium",e),...t}));Ua.displayName=um.displayName;const hm=v.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 Ux(e){const t=e+"CollectionProvider",[r,i]=Sn(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:E,children:S}=C,N=v.useRef(null),k=v.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=v.forwardRef((C,E)=>{const{scope:S,children:N}=C,k=o(d,S),R=it(E,k.collectionRef);return l.jsx(m,{ref:R,children:N})});h.displayName=d;const g=e+"CollectionItemSlot",p="data-radix-collection-item",y=Ro(g),b=v.forwardRef((C,E)=>{const{scope:S,children:N,...k}=C,R=v.useRef(null),M=it(E,R),L=o(g,S);return v.useEffect(()=>(L.itemMap.set(R,{ref:R,...k}),()=>void L.itemMap.delete(R))),l.jsx(y,{[p]:"",ref:M,children:N})});b.displayName=g;function w(C){const E=o(e+"CollectionConsumer",C);return v.useCallback(()=>{const N=E.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${p}]`));return Array.from(E.itemMap.values()).sort((L,z)=>k.indexOf(L.ref.current)-k.indexOf(z.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:h,ItemSlot:b},w,i]}var l8=v.createContext(void 0);function td(e){const t=v.useContext(l8);return e||t||"ltr"}const c8=["top","right","bottom","left"],Aa=Math.min,Ai=Math.max,Af=Math.round,zh=Math.floor,Kn=e=>({x:e,y:e}),u8={left:"right",right:"left",bottom:"top",top:"bottom"};function H_(e,t,r){return Ai(e,Aa(t,r))}function Ls(e,t){return typeof e=="function"?e(t):e}function Os(e){return e.split("-")[0]}function ec(e){return e.split("-")[1]}function Hx(e){return e==="x"?"y":"x"}function Fx(e){return e==="y"?"height":"width"}function Gn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Wx(e){return Hx(Gn(e))}function d8(e,t,r){r===void 0&&(r=!1);const i=ec(e),s=Wx(e),o=Fx(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 h8(e){const t=Tf(e);return[F_(e),t,F_(t)]}function F_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kC=["left","right"],NC=["right","left"],f8=["top","bottom"],m8=["bottom","top"];function p8(e,t,r){switch(e){case"top":case"bottom":return r?t?NC:kC:t?kC:NC;case"left":case"right":return t?f8:m8;default:return[]}}function g8(e,t,r,i){const s=ec(e);let o=p8(Os(e),r==="start",i);return s&&(o=o.map(u=>u+"-"+s),t&&(o=o.concat(o.map(F_)))),o}function Tf(e){const t=Os(e);return u8[t]+e.slice(t.length)}function v8(e){return{top:0,right:0,bottom:0,left:0,...e}}function Uk(e){return typeof e!="number"?v8(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 AC(e,t,r){let{reference:i,floating:s}=e;const o=Gn(t),u=Wx(t),d=Fx(u),m=Os(t),h=o==="y",g=i.x+i.width/2-s.width/2,p=i.y+i.height/2-s.height/2,y=i[d]/2-s[d]/2;let b;switch(m){case"top":b={x:g,y:i.y-s.height};break;case"bottom":b={x:g,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(ec(t)){case"start":b[u]-=y*(r&&h?-1:1);break;case"end":b[u]+=y*(r&&h?-1:1);break}return b}async function _8(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:g="viewport",elementContext:p="floating",altBoundary:y=!1,padding:b=0}=Ls(t,e),w=Uk(b),E=d[y?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:g,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 x8=50,y8=async(e,t,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:_8},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:p}=AC(h,i,m),y=i,b=0;const w={};for(let C=0;C<o.length;C++){const E=o[C];if(!E)continue;const{name:S,fn:N}=E,{x:k,y:R,data:M,reset:L}=await N({x:g,y:p,initialPlacement:i,placement:y,strategy:s,middlewareData:w,rects:h,platform:d,elements:{reference:e,floating:t}});g=k??g,p=R??p,w[S]={...w[S],...M},L&&b<x8&&(b++,typeof L=="object"&&(L.placement&&(y=L.placement),L.rects&&(h=L.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):L.rects),{x:g,y:p}=AC(h,y,m)),C=-1)}return{x:g,y:p,placement:y,strategy:s,middlewareData:w}},b8=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:g=0}=Ls(e,t)||{};if(h==null)return{};const p=Uk(g),y={x:r,y:i},b=Wx(s),w=Fx(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]-y[b]-o.floating[w],M=y[b]-o.reference[b],L=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let z=L?L[k]:0;(!z||!await(u.isElement==null?void 0:u.isElement(L)))&&(z=d.floating[k]||o.floating[w]);const D=R/2-M/2,W=z/2-C[w]/2-1,G=Aa(p[S],W),q=Aa(p[N],W),B=G,j=z-C[w]-q,O=z/2-C[w]/2+D,$=H_(B,O,j),T=!m.arrow&&ec(s)!=null&&O!==$&&o.reference[w]/2-(O<B?G:q)-C[w]/2<0,U=T?O<B?O-B:O-j:0;return{[b]:y[b]+U,data:{[b]:$,centerOffset:O-$-U,...T&&{alignmentOffset:U}},reset:T}}}),w8=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:g=!0,crossAxis:p=!0,fallbackPlacements:y,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=Gn(d),k=Os(d)===d,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=y||(k||!C?[Tf(d)]:h8(d)),L=w!=="none";!y&&L&&M.push(...g8(d,C,w,R));const z=[d,...M],D=await m.detectOverflow(t,E),W=[];let G=((i=o.flip)==null?void 0:i.overflows)||[];if(g&&W.push(D[S]),p){const O=d8(s,u,R);W.push(D[O[0]],D[O[1]])}if(G=[...G,{placement:s,overflows:W}],!W.every(O=>O<=0)){var q,B;const O=(((q=o.flip)==null?void 0:q.index)||0)+1,$=z[O];if($&&(!(p==="alignment"?N!==Gn($):!1)||G.every(H=>Gn(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:O,overflows:G},reset:{placement:$}};let T=(B=G.filter(U=>U.overflows[0]<=0).sort((U,H)=>U.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!T)switch(b){case"bestFit":{var j;const U=(j=G.filter(H=>{if(L){const F=Gn(H.placement);return F===N||F==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(F=>F>0).reduce((F,V)=>F+V,0)]).sort((H,F)=>H[1]-F[1])[0])==null?void 0:j[0];U&&(T=U);break}case"initialPlacement":T=d;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function TC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function MC(e){return c8.some(t=>e[t]>=0)}const S8=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=TC(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:MC(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...o,altBoundary:!0}),d=TC(u,r.floating);return{data:{escapedOffsets:d,escaped:MC(d)}}}default:return{}}}}},Hk=new Set(["left","top"]);async function C8(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=ec(r),m=Gn(r)==="y",h=Hk.has(u)?-1:1,g=o&&m?-1:1,p=Ls(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:w}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return d&&typeof w=="number"&&(b=d==="end"?w*-1:w),m?{x:b*g,y:y*h}:{x:y*h,y:b*g}}const E8=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 C8(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}}}}},R8=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),g={x:r,y:i},p=await o.detectOverflow(t,h),y=Gn(Os(s)),b=Hx(y);let w=g[b],C=g[y];if(u){const S=b==="y"?"top":"left",N=b==="y"?"bottom":"right",k=w+p[S],R=w-p[N];w=H_(k,w,R)}if(d){const S=y==="y"?"top":"left",N=y==="y"?"bottom":"right",k=C+p[S],R=C-p[N];C=H_(k,C,R)}const E=m.fn({...t,[b]:w,[y]:C});return{...E,data:{x:E.x-r,y:E.y-i,enabled:{[b]:u,[y]:d}}}}}},k8=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),g={x:r,y:i},p=Gn(s),y=Hx(p);let b=g[y],w=g[p];const C=Ls(d,t),E=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const k=y==="y"?"height":"width",R=o.reference[y]-o.floating[k]+E.mainAxis,M=o.reference[y]+o.reference[k]-E.mainAxis;b<R?b=R:b>M&&(b=M)}if(h){var S,N;const k=y==="y"?"width":"height",R=Hk.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{[y]:b,[p]:w}}}},N8=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),g=await u.detectOverflow(t,h),p=Os(s),y=ec(s),b=Gn(s)==="y",{width:w,height:C}=o.floating;let E,S;p==="top"||p==="bottom"?(E=p,S=y===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(S=p,E=y==="end"?"top":"bottom");const N=C-g.top-g.bottom,k=w-g.left-g.right,R=Aa(C-g[E],N),M=Aa(w-g[S],k),L=!t.middlewareData.shift;let z=R,D=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(D=k),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(z=N),L&&!y){const G=Ai(g.left,0),q=Ai(g.right,0),B=Ai(g.top,0),j=Ai(g.bottom,0);b?D=w-2*(G!==0||q!==0?G+q:Ai(g.left,g.right)):z=C-2*(B!==0||j!==0?B+j:Ai(g.top,g.bottom))}await m({...t,availableWidth:D,availableHeight:z});const W=await u.getDimensions(d.floating);return w!==W.width||C!==W.height?{reset:{rects:!0}}:{}}}};function fm(){return typeof window<"u"}function tc(e){return Fk(e)?(e.nodeName||"").toLowerCase():"#document"}function Ti(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ts(e){var t;return(t=(Fk(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Fk(e){return fm()?e instanceof Node||e instanceof Ti(e).Node:!1}function _n(e){return fm()?e instanceof Element||e instanceof Ti(e).Element:!1}function Is(e){return fm()?e instanceof HTMLElement||e instanceof Ti(e).HTMLElement:!1}function jC(e){return!fm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ti(e).ShadowRoot}function rd(e){const{overflow:t,overflowX:r,overflowY:i,display:s}=xn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&s!=="inline"&&s!=="contents"}function A8(e){return/^(table|td|th)$/.test(tc(e))}function mm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const T8=/transform|translate|scale|rotate|perspective|filter/,M8=/paint|layout|strict|content/,co=e=>!!e&&e!=="none";let mv;function qx(e){const t=_n(e)?xn(e):e;return co(t.transform)||co(t.translate)||co(t.scale)||co(t.rotate)||co(t.perspective)||!Vx()&&(co(t.backdropFilter)||co(t.filter))||T8.test(t.willChange||"")||M8.test(t.contain||"")}function j8(e){let t=Ta(e);for(;Is(t)&&!Xl(t);){if(qx(t))return t;if(mm(t))return null;t=Ta(t)}return null}function Vx(){return mv==null&&(mv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mv}function Xl(e){return/^(html|body|#document)$/.test(tc(e))}function xn(e){return Ti(e).getComputedStyle(e)}function pm(e){return _n(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ta(e){if(tc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jC(e)&&e.host||ts(e);return jC(t)?t.host:t}function Wk(e){const t=Ta(e);return Xl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&rd(t)?t:Wk(t)}function Ou(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Wk(e),o=s===((i=e.ownerDocument)==null?void 0:i.body),u=Ti(s);if(o){const d=W_(u);return t.concat(u,u.visualViewport||[],rd(s)?s:[],d&&r?Ou(d):[])}else return t.concat(s,Ou(s,[],r))}function W_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qk(e){const t=xn(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=Is(e),o=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=Af(r)!==o||Af(i)!==u;return d&&(r=o,i=u),{width:r,height:i,$:d}}function Gx(e){return _n(e)?e:e.contextElement}function ql(e){const t=Gx(e);if(!Is(t))return Kn(1);const r=t.getBoundingClientRect(),{width:i,height:s,$:o}=qk(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 D8=Kn(0);function Vk(e){const t=Ti(e);return!Vx()||!t.visualViewport?D8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function L8(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ti(e)?!1:t}function ko(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=Gx(e);let u=Kn(1);t&&(i?_n(i)&&(u=ql(i)):u=ql(e));const d=L8(o,r,i)?Vk(o):Kn(0);let m=(s.left+d.x)/u.x,h=(s.top+d.y)/u.y,g=s.width/u.x,p=s.height/u.y;if(o){const y=Ti(o),b=i&&_n(i)?Ti(i):i;let w=y,C=W_(w);for(;C&&i&&b!==w;){const E=ql(C),S=C.getBoundingClientRect(),N=xn(C),k=S.left+(C.clientLeft+parseFloat(N.paddingLeft))*E.x,R=S.top+(C.clientTop+parseFloat(N.paddingTop))*E.y;m*=E.x,h*=E.y,g*=E.x,p*=E.y,m+=k,h+=R,w=Ti(C),C=W_(w)}}return Mf({width:g,height:p,x:m,y:h})}function gm(e,t){const r=pm(e).scrollLeft;return t?t.left+r:ko(ts(e)).left+r}function Gk(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 O8(e){let{elements:t,rect:r,offsetParent:i,strategy:s}=e;const o=s==="fixed",u=ts(i),d=t?mm(t.floating):!1;if(i===u||d&&o)return r;let m={scrollLeft:0,scrollTop:0},h=Kn(1);const g=Kn(0),p=Is(i);if((p||!p&&!o)&&((tc(i)!=="body"||rd(u))&&(m=pm(i)),p)){const b=ko(i);h=ql(i),g.x=b.x+i.clientLeft,g.y=b.y+i.clientTop}const y=u&&!p&&!o?Gk(u,m):Kn(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+g.x+y.x,y:r.y*h.y-m.scrollTop*h.y+g.y+y.y}}function B8(e){return Array.from(e.getClientRects())}function P8(e){const t=ts(e),r=pm(e),i=e.ownerDocument.body,s=Ai(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=Ai(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+gm(e);const d=-r.scrollTop;return xn(i).direction==="rtl"&&(u+=Ai(t.clientWidth,i.clientWidth)-s),{width:s,height:o,x:u,y:d}}const DC=25;function I8(e,t){const r=Ti(e),i=ts(e),s=r.visualViewport;let o=i.clientWidth,u=i.clientHeight,d=0,m=0;if(s){o=s.width,u=s.height;const g=Vx();(!g||g&&t==="fixed")&&(d=s.offsetLeft,m=s.offsetTop)}const h=gm(i);if(h<=0){const g=i.ownerDocument,p=g.body,y=getComputedStyle(p),b=g.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,w=Math.abs(i.clientWidth-p.clientWidth-b);w<=DC&&(o-=w)}else h<=DC&&(o+=h);return{width:o,height:u,x:d,y:m}}function z8(e,t){const r=ko(e,!0,t==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,o=Is(e)?ql(e):Kn(1),u=e.clientWidth*o.x,d=e.clientHeight*o.y,m=s*o.x,h=i*o.y;return{width:u,height:d,x:m,y:h}}function LC(e,t,r){let i;if(t==="viewport")i=I8(e,r);else if(t==="document")i=P8(ts(e));else if(_n(t))i=z8(t,r);else{const s=Vk(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Mf(i)}function Yk(e,t){const r=Ta(e);return r===t||!_n(r)||Xl(r)?!1:xn(r).position==="fixed"||Yk(r,t)}function $8(e,t){const r=t.get(e);if(r)return r;let i=Ou(e,[],!1).filter(d=>_n(d)&&tc(d)!=="body"),s=null;const o=xn(e).position==="fixed";let u=o?Ta(e):e;for(;_n(u)&&!Xl(u);){const d=xn(u),m=qx(u);!m&&d.position==="fixed"&&(s=null),(o?!m&&!s:!m&&d.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||rd(u)&&!m&&Yk(e,u))?i=i.filter(g=>g!==u):s=d,u=Ta(u)}return t.set(e,i),i}function U8(e){let{element:t,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?mm(t)?[]:$8(t,this._c):[].concat(r),i],d=LC(t,u[0],s);let m=d.top,h=d.right,g=d.bottom,p=d.left;for(let y=1;y<u.length;y++){const b=LC(t,u[y],s);m=Ai(b.top,m),h=Aa(b.right,h),g=Aa(b.bottom,g),p=Ai(b.left,p)}return{width:h-p,height:g-m,x:p,y:m}}function H8(e){const{width:t,height:r}=qk(e);return{width:t,height:r}}function F8(e,t,r){const i=Is(t),s=ts(t),o=r==="fixed",u=ko(e,!0,o,t);let d={scrollLeft:0,scrollTop:0};const m=Kn(0);function h(){m.x=gm(s)}if(i||!i&&!o)if((tc(t)!=="body"||rd(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 g=s&&!i&&!o?Gk(s,d):Kn(0),p=u.left+d.scrollLeft-m.x-g.x,y=u.top+d.scrollTop-m.y-g.y;return{x:p,y,width:u.width,height:u.height}}function pv(e){return xn(e).position==="static"}function OC(e,t){if(!Is(e)||xn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ts(e)===r&&(r=r.ownerDocument.body),r}function Kk(e,t){const r=Ti(e);if(mm(e))return r;if(!Is(e)){let s=Ta(e);for(;s&&!Xl(s);){if(_n(s)&&!pv(s))return s;s=Ta(s)}return r}let i=OC(e,t);for(;i&&A8(i)&&pv(i);)i=OC(i,t);return i&&Xl(i)&&pv(i)&&!qx(i)?r:i||j8(e)||r}const W8=async function(e){const t=this.getOffsetParent||Kk,r=this.getDimensions,i=await r(e.floating);return{reference:F8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function q8(e){return xn(e).direction==="rtl"}const V8={convertOffsetParentRelativeRectToViewportRelativeRect:O8,getDocumentElement:ts,getClippingRect:U8,getOffsetParent:Kk,getElementRects:W8,getClientRects:B8,getDimensions:H8,getScale:ql,isElement:_n,isRTL:q8};function Xk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function G8(e,t){let r=null,i;const s=ts(e);function o(){var d;clearTimeout(i),(d=r)==null||d.disconnect(),r=null}function u(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),o();const h=e.getBoundingClientRect(),{left:g,top:p,width:y,height:b}=h;if(d||t(),!y||!b)return;const w=zh(p),C=zh(s.clientWidth-(g+y)),E=zh(s.clientHeight-(p+b)),S=zh(g),k={rootMargin:-w+"px "+-C+"px "+-E+"px "+-S+"px",threshold:Ai(0,Aa(1,m))||1};let R=!0;function M(L){const z=L[0].intersectionRatio;if(z!==m){if(!R)return u();z?u(!1,z):i=setTimeout(()=>{u(!1,1e-7)},1e3)}z===1&&!Xk(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 Y8(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=Gx(e),g=s||o?[...h?Ou(h):[],...t?Ou(t):[]]:[];g.forEach(S=>{s&&S.addEventListener("scroll",r,{passive:!0}),o&&S.addEventListener("resize",r)});const p=h&&d?G8(h,r):null;let y=-1,b=null;u&&(b=new ResizeObserver(S=>{let[N]=S;N&&N.target===h&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=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&&!Xk(C,S)&&r(),C=S,w=requestAnimationFrame(E)}return r(),()=>{var S;g.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 K8=E8,X8=R8,Z8=w8,Q8=N8,J8=S8,BC=b8,ez=k8,tz=(e,t,r)=>{const i=new Map,s={platform:V8,...r},o={...s.platform,_c:i};return y8(e,t,{...s,platform:o})};var rz=typeof document<"u",iz=function(){},lf=rz?v.useLayoutEffect:iz;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 Zk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function PC(e,t){const r=Zk(e);return Math.round(t*r)/r}function gv(e){const t=v.useRef(e);return lf(()=>{t.current=e}),t}function nz(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,[g,p]=v.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=v.useState(i);jf(y,i)||b(i);const[w,C]=v.useState(null),[E,S]=v.useState(null),N=v.useCallback(H=>{H!==L.current&&(L.current=H,C(H))},[]),k=v.useCallback(H=>{H!==z.current&&(z.current=H,S(H))},[]),R=o||w,M=u||E,L=v.useRef(null),z=v.useRef(null),D=v.useRef(g),W=m!=null,G=gv(m),q=gv(s),B=gv(h),j=v.useCallback(()=>{if(!L.current||!z.current)return;const H={placement:t,strategy:r,middleware:y};q.current&&(H.platform=q.current),tz(L.current,z.current,H).then(F=>{const V={...F,isPositioned:B.current!==!1};O.current&&!jf(D.current,V)&&(D.current=V,Ia.flushSync(()=>{p(V)}))})},[y,t,r,q,B]);lf(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,p(H=>({...H,isPositioned:!1})))},[h]);const O=v.useRef(!1);lf(()=>(O.current=!0,()=>{O.current=!1}),[]),lf(()=>{if(R&&(L.current=R),M&&(z.current=M),R&&M){if(G.current)return G.current(R,M,j);j()}},[R,M,j,G,W]);const $=v.useMemo(()=>({reference:L,floating:z,setReference:N,setFloating:k}),[N,k]),T=v.useMemo(()=>({reference:R,floating:M}),[R,M]),U=v.useMemo(()=>{const H={position:r,left:0,top:0};if(!T.floating)return H;const F=PC(T.floating,g.x),V=PC(T.floating,g.y);return d?{...H,transform:"translate("+F+"px, "+V+"px)",...Zk(T.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:F,top:V}},[r,d,T.floating,g.x,g.y]);return v.useMemo(()=>({...g,update:j,refs:$,elements:T,floatingStyles:U}),[g,j,$,T,U])}const sz=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?BC({element:i.current,padding:s}).fn(r):{}:i?BC({element:i,padding:s}).fn(r):{}}}},az=(e,t)=>{const r=K8(e);return{name:r.name,fn:r.fn,options:[e,t]}},oz=(e,t)=>{const r=X8(e);return{name:r.name,fn:r.fn,options:[e,t]}},lz=(e,t)=>({fn:ez(e).fn,options:[e,t]}),cz=(e,t)=>{const r=Z8(e);return{name:r.name,fn:r.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=sz(e);return{name:r.name,fn:r.fn,options:[e,t]}};var fz="Arrow",Qk=v.forwardRef((e,t)=>{const{children:r,width:i=10,height:s=5,...o}=e;return l.jsx(Ve.svg,{...o,ref:t,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Qk.displayName=fz;var mz=Qk;function pz(e){const[t,r]=v.useState(void 0);return Xt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let u,d;if("borderBoxSize"in o){const m=o.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}var Yx="Popper",[Jk,vm]=Sn(Yx),[gz,eN]=Jk(Yx),tN=e=>{const{__scopePopper:t,children:r}=e,[i,s]=v.useState(null),[o,u]=v.useState(void 0);return l.jsx(gz,{scope:t,anchor:i,onAnchorChange:s,placementState:o,setPlacementState:u,children:r})};tN.displayName=Yx;var rN="PopperAnchor",iN=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...s}=e,o=eN(rN,r),u=v.useRef(null),d=o.onAnchorChange,m=v.useCallback(w=>{u.current=w,w&&d(w)},[d]),h=it(t,m),g=v.useRef(null);v.useEffect(()=>{if(!i)return;const w=g.current;g.current=i.current,w!==g.current&&d(g.current)});const p=o.placementState&&Xx(o.placementState),y=p==null?void 0:p[0],b=p==null?void 0:p[1];return i?null:l.jsx(Ve.div,{"data-radix-popper-side":y,"data-radix-popper-align":b,...s,ref:h})});iN.displayName=rN;var Kx="PopperContent",[vz,_z]=Jk(Kx),nN=v.forwardRef((e,t)=>{var ce,ne,we,_e,ye,J;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:w,...C}=e,E=eN(Kx,r),[S,N]=v.useState(null),k=it(t,N),[R,M]=v.useState(null),L=pz(R),z=(L==null?void 0:L.width)??0,D=(L==null?void 0:L.height)??0,W=i+(o!=="center"?"-"+o:""),G=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},q=Array.isArray(h)?h:[h],B=q.length>0,j={padding:G,boundary:q.filter(yz),altBoundary:B},{refs:O,floatingStyles:$,placement:T,isPositioned:U,middlewareData:H}=nz({strategy:"fixed",placement:W,whileElementsMounted:(...ie)=>Y8(...ie,{animationFrame:b==="always"}),elements:{reference:E.anchor},middleware:[az({mainAxis:s+D,alignmentAxis:u}),m&&oz({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?lz():void 0,...j}),m&&cz({...j}),uz({...j,apply:({elements:ie,rects:Ee,availableWidth:ve,availableHeight:Ae})=>{const{width:Ie,height:Oe}=Ee.reference,ze=ie.floating.style;ze.setProperty("--radix-popper-available-width",`${ve}px`),ze.setProperty("--radix-popper-available-height",`${Ae}px`),ze.setProperty("--radix-popper-anchor-width",`${Ie}px`),ze.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),R&&hz({element:R,padding:d}),bz({arrowWidth:z,arrowHeight:D}),y&&dz({strategy:"referenceHidden",...j,boundary:B?j.boundary:void 0})]}),F=E.setPlacementState;Xt(()=>(F(T),()=>{F(void 0)}),[T,F]);const[V,I]=Xx(T),Y=pr(w);Xt(()=>{U&&(Y==null||Y())},[U,Y]);const X=(ce=H.arrow)==null?void 0:ce.x,ee=(ne=H.arrow)==null?void 0:ne.y,re=((we=H.arrow)==null?void 0:we.centerOffset)!==0,[oe,Z]=v.useState();return Xt(()=>{S&&Z(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:U?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(_e=H.transformOrigin)==null?void 0:_e.x,(ye=H.transformOrigin)==null?void 0:ye.y].join(" "),...((J=H.hide)==null?void 0:J.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(vz,{scope:r,placedSide:V,placedAlign:I,onArrowChange:M,arrowX:X,arrowY:ee,shouldHideArrow:re,children:l.jsx(Ve.div,{"data-side":V,"data-align":I,...C,ref:k,style:{...C.style,animation:U?void 0:"none"}})})})});nN.displayName=Kx;var sN="PopperArrow",xz={top:"bottom",right:"left",bottom:"top",left:"right"},aN=v.forwardRef(function(t,r){const{__scopePopper:i,...s}=t,o=_z(sN,i),u=xz[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(mz,{...s,ref:r,style:{...s.style,display:"block"}})})});aN.displayName=sN;function yz(e){return e!==null}var bz=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,g]=Xx(r),p={start:"0%",center:"50%",end:"100%"}[g],y=(((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:`${y}px`,C=`${-m}px`):h==="top"?(w=u?p:`${y}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 Xx(e){const[t,r="center"]=e.split("-");return[t,r]}var oN=tN,lN=iN,cN=nN,uN=aN,vv=!1;function wz(){const[e,t]=v.useState(vv);return v.useEffect(()=>{vv||(vv=!0,t(!0))},[]),e}var dN=La[" useSyncExternalStore ".trim().toString()];function Sz(){return()=>{}}function Cz(){return dN(Sz,()=>!0,()=>!1)}var Ez=typeof dN=="function"?Cz:wz,_v="rovingFocusGroup.onEntryFocus",Rz={bubbles:!1,cancelable:!0},id="RovingFocusGroup",[q_,hN,kz]=Ux(id),[Nz,_m]=Sn(id,[kz]),[Az,Tz]=Nz(id),fN=v.forwardRef((e,t)=>l.jsx(q_.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(q_.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Mz,{...e,ref:t})})}));fN.displayName=id;var Mz=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...p}=e,y=v.useRef(null),b=it(t,y),w=td(o),[C,E]=Eo({prop:u,defaultProp:d??null,onChange:m,caller:id}),[S,N]=v.useState(!1),k=pr(h),R=hN(r),M=v.useRef(!1),[L,z]=v.useState(0);return v.useEffect(()=>{const D=y.current;if(D)return D.addEventListener(_v,k),()=>D.removeEventListener(_v,k)},[k]),l.jsx(Az,{scope:r,orientation:i,dir:w,loop:s,currentTabStopId:C,onItemFocus:v.useCallback(D=>E(D),[E]),onItemShiftTab:v.useCallback(()=>N(!0),[]),onFocusableItemAdd:v.useCallback(()=>z(D=>D+1),[]),onFocusableItemRemove:v.useCallback(()=>z(D=>D-1),[]),children:l.jsx(Ve.div,{tabIndex:S||L===0?-1:0,"data-orientation":i,...p,ref:b,style:{outline:"none",...e.style},onMouseDown:Le(e.onMouseDown,()=>{M.current=!0}),onFocus:Le(e.onFocus,D=>{const W=!M.current;if(D.target===D.currentTarget&&W&&!S){const G=new CustomEvent(_v,Rz);if(D.currentTarget.dispatchEvent(G),!G.defaultPrevented){const q=R().filter(T=>T.focusable),B=q.find(T=>T.active),j=q.find(T=>T.id===C),$=[B,j,...q].filter(Boolean).map(T=>T.ref.current);gN($,g)}}M.current=!1}),onBlur:Le(e.onBlur,()=>N(!1))})})}),mN="RovingFocusGroupItem",pN=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:u,...d}=e,m=vn(),h=o||m,g=Tz(mN,r),p=g.currentTabStopId===h,y=hN(r),{onFocusableItemAdd:b,onFocusableItemRemove:w,currentTabStopId:C}=g,E=Ez();return Xt(()=>{if(!(!E||!i))return b(),()=>w()},[E,i,b,w]),v.useEffect(()=>{if(!(E||!i))return b(),()=>w()},[E,i,b,w]),l.jsx(q_.ItemSlot,{scope:r,id:h,focusable:i,active:s,children:l.jsx(Ve.span,{tabIndex:p?0:-1,"data-orientation":g.orientation,...d,ref:t,onMouseDown:Le(e.onMouseDown,S=>{i?g.onItemFocus(h):S.preventDefault()}),onFocus:Le(e.onFocus,()=>g.onItemFocus(h)),onKeyDown:Le(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){g.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const N=Lz(S,g.orientation,g.dir);if(N!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let R=y().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=g.loop?Oz(R,M+1):R.slice(M+1)}setTimeout(()=>gN(R))}}),children:typeof u=="function"?u({isCurrentTabStop:p,hasTabStop:C!=null}):u})})});pN.displayName=mN;var jz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dz(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lz(e,t,r){const i=Dz(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return jz[i]}function gN(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function Oz(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var vN=fN,_N=pN,V_=["Enter"," "],Bz=["ArrowDown","PageUp","Home"],xN=["ArrowUp","PageDown","End"],Pz=[...Bz,...xN],Iz={ltr:[...V_,"ArrowRight"],rtl:[...V_,"ArrowLeft"]},zz={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nd="Menu",[Bu,$z,Uz]=Ux(nd),[Po,yN]=Sn(nd,[Uz,vm,_m]),xm=vm(),bN=_m(),[Hz,Io]=Po(nd),[Fz,sd]=Po(nd),wN=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:s,onOpenChange:o,modal:u=!0}=e,d=xm(t),[m,h]=v.useState(null),g=v.useRef(!1),p=pr(o),y=td(s);return v.useEffect(()=>{const b=()=>{g.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>g.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})}},[]),v.useEffect(()=>{if(!r)return;const b=()=>p(!1);return window.addEventListener("blur",b),()=>window.removeEventListener("blur",b)},[r,p]),l.jsx(oN,{...d,children:l.jsx(Hz,{scope:t,open:r,onOpenChange:p,content:m,onContentChange:h,children:l.jsx(Fz,{scope:t,onClose:v.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:g,dir:y,modal:u,children:i})})})};wN.displayName=nd;var Wz="MenuAnchor",Zx=v.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=xm(r);return l.jsx(lN,{...s,...i,ref:t})});Zx.displayName=Wz;var Qx="MenuPortal",[qz,SN]=Po(Qx,{forceMount:void 0}),CN=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:s}=e,o=Io(Qx,t);return l.jsx(qz,{scope:t,forceMount:r,children:l.jsx(Cn,{present:r||o.open,children:l.jsx(im,{asChild:!0,container:s,children:i})})})};CN.displayName=Qx;var Ki="MenuContent",[Vz,Jx]=Po(Ki),EN=v.forwardRef((e,t)=>{const r=SN(Ki,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,o=Io(Ki,e.__scopeMenu),u=sd(Ki,e.__scopeMenu);return l.jsx(Bu.Provider,{scope:e.__scopeMenu,children:l.jsx(Cn,{present:i||o.open,children:l.jsx(Bu.Slot,{scope:e.__scopeMenu,children:u.modal?l.jsx(Gz,{...s,ref:t}):l.jsx(Yz,{...s,ref:t})})})})}),Gz=v.forwardRef((e,t)=>{const r=Io(Ki,e.__scopeMenu),i=v.useRef(null),s=it(t,i);return v.useEffect(()=>{const o=i.current;if(o)return Dx(o)},[]),l.jsx(ey,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Le(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Yz=v.forwardRef((e,t)=>{const r=Io(Ki,e.__scopeMenu);return l.jsx(ey,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Kz=Ro("MenuContent.ScrollLock"),ey=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:y,onDismiss:b,disableOutsideScroll:w,...C}=e,E=Io(Ki,r),S=sd(Ki,r),N=xm(r),k=bN(r),R=$z(r),[M,L]=v.useState(null),z=v.useRef(null),D=it(t,z,E.onContentChange),W=v.useRef(0),G=v.useRef(""),q=v.useRef(0),B=v.useRef(null),j=v.useRef("right"),O=v.useRef(0),$=w?sm:v.Fragment,T=w?{as:Kz,allowPinchZoom:!0}:void 0,U=F=>{var Z,ce;const V=G.current+F,I=R().filter(ne=>!ne.disabled),Y=document.activeElement,X=(Z=I.find(ne=>ne.ref.current===Y))==null?void 0:Z.textValue,ee=I.map(ne=>ne.textValue),re=o7(ee,V,X),oe=(ce=I.find(ne=>ne.textValue===re))==null?void 0:ce.ref.current;(function ne(we){G.current=we,window.clearTimeout(W.current),we!==""&&(W.current=window.setTimeout(()=>ne(""),1e3))})(V),oe&&setTimeout(()=>oe.focus())};v.useEffect(()=>()=>window.clearTimeout(W.current),[]),jx();const H=v.useCallback(F=>{var I,Y;return j.current===((I=B.current)==null?void 0:I.side)&&c7(F,(Y=B.current)==null?void 0:Y.area)},[]);return l.jsx(Vz,{scope:r,searchRef:G,onItemEnter:v.useCallback(F=>{H(F)&&F.preventDefault()},[H]),onItemLeave:v.useCallback(F=>{var V;H(F)||((V=z.current)==null||V.focus(),L(null))},[H]),onTriggerLeave:v.useCallback(F=>{H(F)&&F.preventDefault()},[H]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(F=>{B.current=F},[]),children:l.jsx($,{...T,children:l.jsx(rm,{asChild:!0,trapped:s,onMountAutoFocus:Le(o,F=>{var V;F.preventDefault(),(V=z.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:l.jsx(tm,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:p,onInteractOutside:y,onDismiss:b,children:l.jsx(vN,{asChild:!0,...k,dir:S.dir,orientation:"vertical",loop:i,currentTabStopId:M,onCurrentTabStopIdChange:L,onEntryFocus:Le(m,F=>{S.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(cN,{role:"menu","aria-orientation":"vertical","data-state":UN(E.open),"data-radix-menu-content":"",dir:S.dir,...N,...C,ref:D,style:{outline:"none",...C.style},onKeyDown:Le(C.onKeyDown,F=>{const I=F.target.closest("[data-radix-menu-content]")===F.currentTarget,Y=F.ctrlKey||F.altKey||F.metaKey,X=F.key.length===1;I&&(F.key==="Tab"&&F.preventDefault(),!Y&&X&&U(F.key));const ee=z.current;if(F.target!==ee||!Pz.includes(F.key))return;F.preventDefault();const oe=R().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);xN.includes(F.key)&&oe.reverse(),s7(oe)}),onBlur:Le(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(W.current),G.current="")}),onPointerMove:Le(e.onPointerMove,Pu(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}}))})})})})})})});EN.displayName=Ki;var Xz="MenuGroup",ty=v.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{role:"group",...i,ref:t})});ty.displayName=Xz;var Zz="MenuLabel",RN=v.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{...i,ref:t})});RN.displayName=Zz;var Df="MenuItem",IC="menu.itemSelect",ym=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...s}=e,o=v.useRef(null),u=sd(Df,e.__scopeMenu),d=Jx(Df,e.__scopeMenu),m=it(t,o),h=v.useRef(!1),g=()=>{const p=o.current;if(!r&&p){const y=new CustomEvent(IC,{bubbles:!0,cancelable:!0});p.addEventListener(IC,b=>i==null?void 0:i(b),{once:!0}),PR(p,y),y.defaultPrevented?h.current=!1:u.onClose()}};return l.jsx(kN,{...s,ref:m,disabled:r,onClick:Le(e.onClick,g),onPointerDown:p=>{var y;(y=e.onPointerDown)==null||y.call(e,p),h.current=!0},onPointerUp:Le(e.onPointerUp,p=>{var y;h.current||(y=p.currentTarget)==null||y.click()}),onKeyDown:Le(e.onKeyDown,p=>{r||p.target!==p.currentTarget||d.searchRef.current!==""&&p.key===" "||V_.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});ym.displayName=Df;var kN=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=e,u=Jx(Df,r),d=bN(r),m=v.useRef(null),h=it(t,m),[g,p]=v.useState(!1),[y,b]=v.useState("");return v.useEffect(()=>{const w=m.current;w&&b((w.textContent??"").trim())},[o.children]),l.jsx(Bu.ItemSlot,{scope:r,disabled:i,textValue:s??y,children:l.jsx(_N,{asChild:!0,...d,focusable:!i,children:l.jsx(Ve.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:h,onPointerMove:Le(e.onPointerMove,Pu(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(e.onPointerLeave,Pu(w=>u.onItemLeave(w))),onFocus:Le(e.onFocus,()=>p(!0)),onBlur:Le(e.onBlur,()=>p(!1))})})})}),Qz="MenuCheckboxItem",NN=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return l.jsx(DN,{scope:e.__scopeMenu,checked:r,children:l.jsx(ym,{role:"menuitemcheckbox","aria-checked":Lf(r)?"mixed":r,...s,ref:t,"data-state":iy(r),onSelect:Le(s.onSelect,()=>i==null?void 0:i(Lf(r)?!0:!r),{checkForDefaultPrevented:!1})})})});NN.displayName=Qz;var AN="MenuRadioGroup",[Jz,e7]=Po(AN,{value:void 0,onValueChange:()=>{}}),TN=v.forwardRef((e,t)=>{const{value:r,onValueChange:i,...s}=e,o=pr(i);return l.jsx(Jz,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(ty,{...s,ref:t})})});TN.displayName=AN;var MN="MenuRadioItem",jN=v.forwardRef((e,t)=>{const{value:r,...i}=e,s=e7(MN,e.__scopeMenu),o=r===s.value;return l.jsx(DN,{scope:e.__scopeMenu,checked:o,children:l.jsx(ym,{role:"menuitemradio","aria-checked":o,...i,ref:t,"data-state":iy(o),onSelect:Le(i.onSelect,()=>{var u;return(u=s.onValueChange)==null?void 0:u.call(s,r)},{checkForDefaultPrevented:!1})})})});jN.displayName=MN;var ry="MenuItemIndicator",[DN,t7]=Po(ry,{checked:!1}),LN=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...s}=e,o=t7(ry,r);return l.jsx(Cn,{present:i||Lf(o.checked)||o.checked===!0,children:l.jsx(Ve.span,{...s,ref:t,"data-state":iy(o.checked)})})});LN.displayName=ry;var r7="MenuSeparator",ON=v.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(Ve.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});ON.displayName=r7;var i7="MenuArrow",BN=v.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=xm(r);return l.jsx(uN,{...s,...i,ref:t})});BN.displayName=i7;var n7="MenuSub",[hZ,PN]=Po(n7),xu="MenuSubTrigger",IN=v.forwardRef((e,t)=>{const r=Io(xu,e.__scopeMenu),i=sd(xu,e.__scopeMenu),s=PN(xu,e.__scopeMenu),o=Jx(xu,e.__scopeMenu),u=v.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=o,h={__scopeMenu:e.__scopeMenu},g=v.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);v.useEffect(()=>g,[g]),v.useEffect(()=>{const y=d.current;return()=>{window.clearTimeout(y),m(null)}},[d,m]);const p=it(t,s.onTriggerChange);return l.jsx(Zx,{asChild:!0,...h,children:l.jsx(kN,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":UN(r.open),...e,ref:p,onClick:y=>{var b;(b=e.onClick)==null||b.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Le(e.onPointerMove,Pu(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(o.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),g()},100))})),onPointerLeave:Le(e.onPointerLeave,Pu(y=>{var w,C;g();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:y.clientX+N,y:y.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(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Le(e.onKeyDown,y=>{var w;e.disabled||y.target!==y.currentTarget||o.searchRef.current!==""&&y.key===" "||Iz[i.dir].includes(y.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),y.preventDefault())})})})});IN.displayName=xu;var zN="MenuSubContent",$N=v.forwardRef((e,t)=>{const r=SN(Ki,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=e,u=Io(Ki,e.__scopeMenu),d=sd(Ki,e.__scopeMenu),m=PN(zN,e.__scopeMenu),h=v.useRef(null),g=it(t,h);return l.jsx(Bu.Provider,{scope:e.__scopeMenu,children:l.jsx(Cn,{present:i||u.open,children:l.jsx(Bu.Slot,{scope:e.__scopeMenu,children:l.jsx(ey,{id:m.contentId,"aria-labelledby":m.triggerId,...o,ref:g,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var y;d.isUsingKeyboardRef.current&&((y=h.current)==null||y.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Le(e.onFocusOutside,p=>{p.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Le(e.onEscapeKeyDown,p=>{d.onClose(),p.preventDefault()}),onKeyDown:Le(e.onKeyDown,p=>{var w;const y=p.currentTarget.contains(p.target),b=zz[d.dir].includes(p.key);y&&b&&(u.onOpenChange(!1),(w=m.trigger)==null||w.focus(),p.preventDefault())})})})})})});$N.displayName=zN;function UN(e){return e?"open":"closed"}function Lf(e){return e==="indeterminate"}function iy(e){return Lf(e)?"indeterminate":e?"checked":"unchecked"}function s7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function a7(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function o7(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=a7(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 l7(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,g=d.y,p=m.x,y=m.y;g>i!=y>i&&r<(p-h)*(i-g)/(y-g)+h&&(s=!s)}return s}function c7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return l7(r,t)}function Pu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var u7=wN,d7=Zx,h7=CN,f7=EN,m7=ty,p7=RN,g7=ym,v7=NN,_7=TN,x7=jN,y7=LN,b7=ON,w7=BN,S7=IN,C7=$N,bm="DropdownMenu",[E7]=Sn(bm,[yN]),Jr=yN(),[R7,HN]=E7(bm),FN=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:s,defaultOpen:o,onOpenChange:u,modal:d=!0}=e,m=Jr(t),h=v.useRef(null),[g,p]=Eo({prop:s,defaultProp:o??!1,onChange:u,caller:bm});return l.jsx(R7,{scope:t,triggerId:vn(),triggerRef:h,contentId:vn(),open:g,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(y=>!y),[p]),modal:d,children:l.jsx(u7,{...m,open:g,onOpenChange:p,dir:i,modal:d,children:r})})};FN.displayName=bm;var WN="DropdownMenuTrigger",qN=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,o=HN(WN,r),u=Jr(r),d=it(t,o.triggerRef);return l.jsx(d7,{asChild:!0,...u,children:l.jsx(Ve.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Le(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(o.onOpenToggle(),o.open||m.preventDefault())}),onKeyDown:Le(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&o.onOpenToggle(),m.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});qN.displayName=WN;var k7="DropdownMenuPortal",VN=e=>{const{__scopeDropdownMenu:t,...r}=e,i=Jr(t);return l.jsx(h7,{...i,...r})};VN.displayName=k7;var GN="DropdownMenuContent",YN=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=HN(GN,r),o=Jr(r),u=v.useRef(!1);return l.jsx(f7,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:t,onCloseAutoFocus:Le(e.onCloseAutoFocus,d=>{var m;u.current||(m=s.triggerRef.current)==null||m.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Le(e.onInteractOutside,d=>{const m=d.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,g=m.button===2||h;(!s.modal||g)&&(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)"}})});YN.displayName=GN;var N7="DropdownMenuGroup",A7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(m7,{...s,...i,ref:t})});A7.displayName=N7;var T7="DropdownMenuLabel",M7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(p7,{...s,...i,ref:t})});M7.displayName=T7;var j7="DropdownMenuItem",KN=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(g7,{...s,...i,ref:t})});KN.displayName=j7;var D7="DropdownMenuCheckboxItem",L7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(v7,{...s,...i,ref:t})});L7.displayName=D7;var O7="DropdownMenuRadioGroup",B7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(_7,{...s,...i,ref:t})});B7.displayName=O7;var P7="DropdownMenuRadioItem",I7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(x7,{...s,...i,ref:t})});I7.displayName=P7;var z7="DropdownMenuItemIndicator",$7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(y7,{...s,...i,ref:t})});$7.displayName=z7;var U7="DropdownMenuSeparator",H7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(b7,{...s,...i,ref:t})});H7.displayName=U7;var F7="DropdownMenuArrow",W7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(w7,{...s,...i,ref:t})});W7.displayName=F7;var q7="DropdownMenuSubTrigger",V7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(S7,{...s,...i,ref:t})});V7.displayName=q7;var G7="DropdownMenuSubContent",Y7=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=Jr(r);return l.jsx(C7,{...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)"}})});Y7.displayName=G7;var K7=FN,XN=qN,X7=VN,ZN=YN,QN=KN;function G_(e){return l.jsx(K7,{"data-slot":"dropdown-menu",...e})}const Of=v.forwardRef((e,t)=>l.jsx(XN,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));Of.displayName=XN.displayName;const Bf=v.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...i},s)=>l.jsx(X7,{children:l.jsx(ZN,{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=ZN.displayName;const Pf=v.forwardRef(({className:e,variant:t="default",...r},i)=>l.jsx(QN,{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=QN.displayName;const xt=v.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}));xt.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 Z7({idPrefix:e,fields:t,activeFieldId:r,answers:i,otherValues:s,otherSelections:o,errors:u={},disabled:d=!1,onNavigate:m,onAnswerChange:h,onOtherValueChange:g,onOtherSelectionChange:p}){const y=v.useRef(null),b=v.useRef(void 0),w=v.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(v.useEffect(()=>{if(!S)return;const D=b.current!==void 0&&b.current!==S.id,W=!!N&&w.current!==N;if(b.current=S.id,w.current=N,!D&&!W)return;const G=y.current,q=(G==null?void 0:G.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(G==null?void 0:G.querySelector("input:checked:not([disabled])"))??(G==null?void 0:G.querySelector("input:not([disabled]), textarea:not([disabled])"));q==null||q.focus()},[N,S]),!S)return null;const R=`${e}-field-${E}`,M=S.description?`${R}-description`:void 0,L=N?`${R}-error`:void 0,z=[M,L].filter(Boolean).join(" ")||void 0;return l.jsxs("div",{className:"grid gap-3",children:[t.length>1&&l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",E+1," of ",t.length]}),l.jsx("div",{className:"text-[11px] text-muted-foreground",children:S.required?"Required":"Optional"})]}),l.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":E+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:l.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(E+1)/t.length*100}%`}})})]}),l.jsx("div",{ref:y,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(UC,{})]}),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":z,required:S.required,onChange:D=>h(S.id,D.target.value)}):l.jsx(xt,{id:R,type:S.secret?"password":"text",autoComplete:"off",value:typeof k=="string"?k:"",disabled:d,placeholder:S.placeholder,"aria-invalid":N?!0:void 0,"aria-describedby":z,required:S.required,onChange:D=>h(S.id,D.target.value)}),l.jsx($C,{id:L,error:N})]}):l.jsxs("fieldset",{disabled:d,role:S.multiple?void 0:"radiogroup","aria-required":!S.multiple&&S.required?!0:void 0,"aria-invalid":N?!0:void 0,"aria-describedby":z,className:"grid gap-1.5",children:[l.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[S.label,S.required&&l.jsx(UC,{})]}),S.description&&l.jsx("p",{id:M,className:"text-[11px] leading-relaxed text-muted-foreground",children:S.description}),l.jsxs("div",{className:"grid gap-1.5",children:[S.options.map((D,W)=>{const G=`${R}-option-${W}`,q=S.multiple?Array.isArray(k)&&k.includes(D.value):o[S.id]!==!0&&k===D.value;return l.jsx(zC,{id:G,name:S.multiple?void 0:R,type:S.multiple?"checkbox":"radio",checked:q,label:D.label,description:D.description,onChange:B=>{if(S.multiple){const j=Array.isArray(k)?k:[];h(S.id,B?[...j.filter(O=>O!==D.value),D.value]:j.filter(O=>O!==D.value))}else h(S.id,D.value),p(S.id,!1)}},D.value)}),S.allowOther&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[l.jsx(zC,{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(xt,{value:s[S.id]??"",disabled:d||o[S.id]!==!0,"aria-label":`Other answer for ${S.label}`,"aria-invalid":N?!0:void 0,"aria-describedby":z,placeholder:"Enter another answer",onChange:D=>g(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($C,{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(ER,{}),"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 zC({id:e,name:t,type:r,checked:i,label:s,description:o,embedded:u=!1,onChange:d}){return l.jsxs("label",{htmlFor:e,className:ct("flex cursor-pointer items-start gap-2 text-xs text-foreground",!u&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[l.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[l.jsx("input",{id:e,type:r,name:t,checked:i,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),l.jsx(Ba,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block",children:s}),o&&l.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:o})]})]})}function $C({id:e,error:t}){return t?l.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function UC(){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),l.jsx("span",{className:"sr-only",children:" (required)"})]})}function Ma({className:e,size:t="default",...r}){return l.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:ct("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[l.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),l.jsx(Rx,{"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 Q7=Object.defineProperty,Bs=(e,t)=>Q7(e,"name",{value:t,configurable:!0});function JN(e,t){return v.useReducer((r,i)=>t[r][i]??r,e)}Bs(JN,"useStateMachine");var Sm=Bs(e=>{const{present:t,children:r}=e,i=eA(t),s=typeof r=="function"?r({present:i.isPresent}):v.Children.only(r),o=tA(i.ref,rA(s));return typeof r=="function"||i.isPresent?v.cloneElement(s,{ref:o}):null},"Presence");function eA(e){const[t,r]=v.useState(),i=v.useRef(null),s=v.useRef(e),o=v.useRef("none"),u=v.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=JN(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{m==="mounted"?(o.current=u.current??Pl(i.current),u.current=void 0):o.current="none"},[m]),Xt(()=>{const g=i.current,p=s.current;if(p!==e){const b=o.current,w=Pl(g);e?(u.current=w,h("MOUNT")):w==="none"||(g==null?void 0:g.display)==="none"?h("UNMOUNT"):h(p&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Xt(()=>{if(t){let g;const p=t.ownerDocument.defaultView??window,y=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",g=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",y),t.addEventListener("animationend",y),()=>{p.clearTimeout(g),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:v.useCallback(g=>{if(g){const p=getComputedStyle(g);i.current=p,u.current=Pl(p)}else i.current=null;r(g)},[])}}Bs(eA,"usePresence");function Y_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Bs(Y_,"setRef");function tA(...e){const t=v.useRef(e);return t.current=e,v.useCallback(r=>{const i=t.current;let s=!1;const o=i.map(u=>{const d=Y_(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():Y_(i[u],null)}}},[])}Bs(tA,"useStableComposedRefs");function Pl(e){return(e==null?void 0:e.animationName)||"none"}Bs(Pl,"getAnimationName");function rA(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(rA,"getElementRef");function K_(e,[t,r]){return Math.min(r,Math.max(t,e))}var J7=Object.defineProperty,rc=(e,t)=>J7(e,"name",{value:t,configurable:!0}),iA=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ra(e,t,{checkForDefaultPrevented:r=!0}={}){return rc(function(s){if(e==null||e(s),r===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}rc(Ra,"composeEventHandlers");function e$(e){var t;if(!iA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}rc(e$,"getOwnerWindow");function X_(e){if(!iA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}rc(X_,"getOwnerDocument");function nA(e,t=!1){const{activeElement:r}=X_(e);if(!(r!=null&&r.nodeName))return null;if(sA(r)&&r.contentDocument)return nA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=X_(r).getElementById(i);if(s)return s}}return r}rc(nA,"getActiveElement");function sA(e){return e.tagName==="IFRAME"}rc(sA,"isFrame");var t$=Object.defineProperty,at=(e,t)=>t$(e,"name",{value:t,configurable:!0});function aA(e,t){return v.useReducer((r,i)=>t[r][i]??r,e)}at(aA,"useStateMachine");var oA="ScrollArea",[lA]=Sn(oA),[r$,nn]=lA(oA),i$=v.forwardRef(at(function(t,r){const{__scopeScrollArea:i,type:s="hover",dir:o,scrollHideDelay:u=600,...d}=t,[m,h]=v.useState(null),[g,p]=v.useState(null),[y,b]=v.useState(null),[w,C]=v.useState(null),[E,S]=v.useState(null),[N,k]=v.useState(0),[R,M]=v.useState(0),[L,z]=v.useState(!1),[D,W]=v.useState(!1),G=it(r,h),q=td(o);return l.jsx(r$,{scope:i,type:s,dir:q,scrollHideDelay:u,scrollArea:m,viewport:g,onViewportChange:p,content:y,onContentChange:b,scrollbarX:w,onScrollbarXChange:C,scrollbarXEnabled:L,onScrollbarXEnabledChange:z,scrollbarY:E,onScrollbarYChange:S,scrollbarYEnabled:D,onScrollbarYEnabledChange:W,onCornerWidthChange:k,onCornerHeightChange:M,children:l.jsx(Ve.div,{dir:q,...d,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":R+"px",...t.style}})})},"ScrollArea")),n$="ScrollAreaViewport",s$=v.forwardRef(at(function(t,r){const{__scopeScrollArea:i,children:s,nonce:o,...u}=t,d=nn(n$,i),m=v.useRef(null),h=it(r,m,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx(a$,{nonce:o}),l.jsx(Ve.div,{"data-radix-scroll-area-viewport":"",...u,ref:h,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})},"ScrollAreaViewport")),a$=v.memo(at(function({nonce:t}){return l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),zs="ScrollAreaScrollbar",cA=v.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),{onScrollbarXEnabledChange:u,onScrollbarYEnabledChange:d}=o,m=t.orientation==="horizontal";return v.useEffect(()=>(m?u(!0):d(!0),()=>{m?u(!1):d(!1)}),[m,u,d]),o.type==="hover"?l.jsx(o$,{...s,ref:r,forceMount:i}):o.type==="scroll"?l.jsx(l$,{...s,ref:r,forceMount:i}):o.type==="auto"?l.jsx(uA,{...s,ref:r,forceMount:i}):o.type==="always"?l.jsx(ny,{...s,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),o$=v.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),[u,d]=v.useState(!1);return v.useEffect(()=>{const m=o.scrollArea;let h=0;if(m){const g=at(()=>{window.clearTimeout(h),d(!0)},"handlePointerEnter"),p=at(()=>{h=window.setTimeout(()=>d(!1),o.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",g),m.addEventListener("pointerleave",p),()=>{window.clearTimeout(h),m.removeEventListener("pointerenter",g),m.removeEventListener("pointerleave",p)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(Sm,{present:i||u,children:l.jsx(uA,{"data-state":u?"visible":"hidden",...s,ref:r})})},"ScrollAreaScrollbarHover")),l$=v.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=nn(zs,t.__scopeScrollArea),u=t.orientation==="horizontal",d=od(()=>h("SCROLL_END"),100),[m,h]=aA("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 v.useEffect(()=>{if(m==="idle"){const g=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(g)}},[m,o.scrollHideDelay,h]),v.useEffect(()=>{const g=o.viewport,p=u?"scrollLeft":"scrollTop";if(g){let y=g[p];const b=at(()=>{const w=g[p];y!==w&&(h("SCROLL"),d()),y=w},"handleScroll");return g.addEventListener("scroll",b),()=>g.removeEventListener("scroll",b)}},[o.viewport,u,h,d]),l.jsx(Sm,{present:i||m!=="hidden",children:l.jsx(ny,{"data-state":m==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:Ra(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Ra(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),uA=v.forwardRef(at(function(t,r){const i=nn(zs,t.__scopeScrollArea),{forceMount:s,...o}=t,[u,d]=v.useState(!1),m=t.orientation==="horizontal",h=od(()=>{if(i.viewport){const g=i.viewport.offsetWidth<i.viewport.scrollWidth,p=i.viewport.offsetHeight<i.viewport.scrollHeight;d(m?g:p)}},10);return No(i.viewport,h),No(i.content,h),l.jsx(Sm,{present:s||u,children:l.jsx(ny,{"data-state":u?"visible":"hidden",...o,ref:r})})},"ScrollAreaScrollbarAuto")),ny=v.forwardRef(at(function(t,r){const{orientation:i="vertical",...s}=t,o=nn(zs,t.__scopeScrollArea),u=v.useRef(null),d=v.useRef(0),[m,h]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),g=sy(m.viewport,m.content),p={...s,sizes:m,onSizesChange:h,hasThumb:g>0&&g<1,onThumbChange:at(b=>u.current=b,"onThumbChange"),onThumbPointerUp:at(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:at(b=>d.current=b,"onThumbPointerDown")};function y(b,w){return mA(b,d.current,m,w)}return at(y,"getScrollPosition"),i==="horizontal"?l.jsx(c$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollLeft,w=Q_(b,m,o.dir);u.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:b=>{o.viewport&&(o.viewport.scrollLeft=b)},onDragScroll:b=>{o.viewport&&(o.viewport.scrollLeft=y(b,o.dir))}}):i==="vertical"?l.jsx(u$,{...p,ref:r,onThumbPositionChange:()=>{if(o.viewport&&u.current){const b=o.viewport.scrollTop,w=Q_(b,m);u.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:b=>{o.viewport&&(o.viewport.scrollTop=b)},onDragScroll:b=>{o.viewport&&(o.viewport.scrollTop=y(b))}}):null},"ScrollAreaScrollbarVisible")),c$=v.forwardRef(at(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=nn(zs,t.__scopeScrollArea),[d,m]=v.useState(),h=v.useRef(null),g=it(r,h,u.onScrollbarXChange);return v.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(hA,{"data-orientation":"horizontal",...o,ref:g,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":ad(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.x),onDragScroll:p=>t.onDragScroll(p.x),onWheelScroll:(p,y)=>{if(u.viewport){const b=u.viewport.scrollLeft+p.deltaX;t.onWheelScroll(b),oy(b,y)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollWidth,viewport:u.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Iu(d.paddingLeft),paddingEnd:Iu(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),u$=v.forwardRef(at(function(t,r){const{sizes:i,onSizesChange:s,...o}=t,u=nn(zs,t.__scopeScrollArea),[d,m]=v.useState(),h=v.useRef(null),g=it(r,h,u.onScrollbarYChange);return v.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),l.jsx(hA,{"data-orientation":"vertical",...o,ref:g,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":ad(i)+"px",...t.style},onThumbPointerDown:p=>t.onThumbPointerDown(p.y),onDragScroll:p=>t.onDragScroll(p.y),onWheelScroll:(p,y)=>{if(u.viewport){const b=u.viewport.scrollTop+p.deltaY;t.onWheelScroll(b),oy(b,y)&&p.preventDefault()}},onResize:()=>{h.current&&u.viewport&&d&&s({content:u.viewport.scrollHeight,viewport:u.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Iu(d.paddingTop),paddingEnd:Iu(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[d$,dA]=lA(zs),hA=v.forwardRef(at(function(t,r){const{__scopeScrollArea:i,sizes:s,hasThumb:o,onThumbChange:u,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:h,onDragScroll:g,onWheelScroll:p,onResize:y,...b}=t,w=nn(zs,i),[C,E]=v.useState(null),S=it(r,E),N=v.useRef(null),k=v.useRef(""),R=w.viewport,M=s.content-s.viewport,L=pr(p),z=pr(h),D=od(y,10);function W(G){if(N.current){const q=G.clientX-N.current.left,B=G.clientY-N.current.top;g({x:q,y:B})}}return at(W,"handleDragScroll"),v.useEffect(()=>{const G=at(q=>{const B=q.target;(C==null?void 0:C.contains(B))&&L(q,M)},"handleWheel");return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[R,C,M,L]),v.useEffect(z,[s,z]),No(C,D),No(w.content,D),l.jsx(d$,{scope:i,scrollbar:C,hasThumb:o,onThumbChange:pr(u),onThumbPointerUp:pr(d),onThumbPositionChange:z,onThumbPointerDown:pr(m),children:l.jsx(Ve.div,{...b,ref:S,style:{position:"absolute",...b.style},onPointerDown:Ra(t.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),N.current=C.getBoundingClientRect(),k.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),W(G))}),onPointerMove:Ra(t.onPointerMove,W),onPointerUp:Ra(t.onPointerUp,G=>{const q=G.target;q.hasPointerCapture(G.pointerId)&&q.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=k.current,w.viewport&&(w.viewport.style.scrollBehavior=""),N.current=null})})})},"ScrollAreaScrollbarImpl")),Z_="ScrollAreaThumb",h$=v.forwardRef(at(function(t,r){const{forceMount:i,...s}=t,o=dA(Z_,t.__scopeScrollArea);return l.jsx(Sm,{present:i||o.hasThumb,children:l.jsx(f$,{ref:r,...s})})},"ScrollAreaThumb")),f$=v.forwardRef(at(function(t,r){const{__scopeScrollArea:i,style:s,...o}=t,u=nn(Z_,i),d=dA(Z_,i),{onThumbPositionChange:m}=d,h=it(r,d.onThumbChange),g=v.useRef(void 0),p=od(()=>{g.current&&(g.current(),g.current=void 0)},100);return v.useEffect(()=>{const y=u.viewport;if(y){const b=at(()=>{if(p(),!g.current){const w=g$(y,m);g.current=w,m()}},"handleScroll");return m(),y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)}},[u.viewport,p,m]),l.jsx(Ve.div,{"data-state":d.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Ra(t.onPointerDownCapture,y=>{const w=y.target.getBoundingClientRect(),C=y.clientX-w.left,E=y.clientY-w.top;d.onThumbPointerDown({x:C,y:E})}),onPointerUp:Ra(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),fA="ScrollAreaCorner",m$=v.forwardRef(at(function(t,r){const i=nn(fA,t.__scopeScrollArea),s=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&s?l.jsx(p$,{...t,ref:r}):null},"ScrollAreaCorner")),p$=v.forwardRef(at(function(t,r){const{__scopeScrollArea:i,...s}=t,o=nn(fA,i),[u,d]=v.useState(0),[m,h]=v.useState(0),g=!!(u&&m),{onCornerWidthChange:p,onCornerHeightChange:y}=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)}),v.useEffect(()=>()=>{p(0),y(0)},[p,y]),g?l.jsx(Ve.div,{...s,ref:r,style:{width:u,height:m,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Iu(e){return e?parseInt(e,10):0}at(Iu,"toInt");function sy(e,t){const r=e/t;return isNaN(r)?0:r}at(sy,"getThumbRatio");function ad(e){const t=sy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=(e.scrollbar.size-r)*t;return Math.max(i,18)}at(ad,"getThumbSize");function mA(e,t,r,i="ltr"){const s=ad(r),o=s/2,u=t||o,d=s-u,m=r.scrollbar.paddingStart+u,h=r.scrollbar.size-r.scrollbar.paddingEnd-d,g=r.content-r.viewport,p=i==="ltr"?[0,g]:[g*-1,0];return ay([m,h],p)(e)}at(mA,"getScrollPositionFromPointer");function Q_(e,t,r="ltr"){const i=ad(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=K_(e,m);return ay([0,u],[0,d])(h)}at(Q_,"getThumbOffsetFromScroll");function ay(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const i=(t[1]-t[0])/(e[1]-e[0]);return t[0]+i*(r-e[0])}}at(ay,"linearScale");function oy(e,t){return e>0&&e<t}at(oy,"isScrollingWithinScrollbarBounds");var g$=at((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},i=0;return at((function s(){const o={left:e.scrollLeft,top:e.scrollTop},u=r.left!==o.left,d=r.top!==o.top;(u||d)&&t(),r=o,i=window.requestAnimationFrame(s)}),"loop")(),()=>window.cancelAnimationFrame(i)},"addUnlinkedScrollListener");function od(e,t){const r=pr(e),i=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(i.current),[]),v.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(r,t)},[r,t])}at(od,"useDebounceCallback");function No(e,t){const r=pr(t);Xt(()=>{let i=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(i),s.unobserve(e)}}},[e,r])}at(No,"useResizeObserver");var pA=i$,v$=s$,_$=m$;const yn=v.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:i,viewportProps:s,scrollbars:o="vertical",type:u="auto",...d},m)=>l.jsxs(pA,{ref:m,"data-slot":"scroll-area",type:u,className:ct("relative overflow-hidden",e),...d,children:[l.jsx(v$,{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(J_,{orientation:"vertical"}),o!=="vertical"&&l.jsx(J_,{orientation:"horizontal"}),l.jsx(_$,{"data-slot":"scroll-area-corner"})]}));yn.displayName=pA.displayName;const J_=v.forwardRef(({className:e,orientation:t="vertical",style:r,...i},s)=>l.jsx(cA,{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(h$,{"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")})}));J_.displayName=cA.displayName;function x$(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var gA=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"}),y$="VisuallyHidden",b$=v.forwardRef((e,t)=>l.jsx(Ve.span,{...e,ref:t,style:{...gA,...e.style}}));b$.displayName=y$;var w$=[" ","Enter","ArrowUp","ArrowDown"],S$=[" ","Enter"],Ao="Select",[Cm,Em,C$]=Ux(Ao),[zo]=Sn(Ao,[C$,vm]),Rm=vm(),[E$,Ha]=zo(Ao),[R$,k$]=zo(Ao),N$="SelectProvider";function vA(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:s,onOpenChange:o,value:u,defaultValue:d,onValueChange:m,dir:h,name:g,autoComplete:p,disabled:y,required:b,form:w,internal_do_not_use_render:C}=e,E=Rm(t),[S,N]=v.useState(null),[k,R]=v.useState(null),[M,L]=v.useState(!1),z=td(h),[D,W]=Eo({prop:i,defaultProp:s??!1,onChange:o,caller:Ao}),[G,q]=Eo({prop:u,defaultProp:d,onChange:m,caller:Ao}),B=v.useRef(null),j=v.useRef(G);v.useEffect(()=>{const Y=w?S==null?void 0:S.ownerDocument.getElementById(w):S==null?void 0:S.form;if(Y instanceof HTMLFormElement){const X=()=>q(j.current);return Y.addEventListener("reset",X),()=>Y.removeEventListener("reset",X)}},[w,S,q]);const O=S?!!w||!!S.closest("form"):!0,[$,T]=v.useState(new Set),U=vn(),H=Array.from($).map(Y=>Y.props.value).join(";"),F=v.useCallback(Y=>{T(X=>new Set(X).add(Y))},[]),V=v.useCallback(Y=>{T(X=>{const ee=new Set(X);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:q,open:D,onOpenChange:W,dir:z,triggerPointerDownPosRef:B,disabled:y,name:g,autoComplete:p,form:w,nativeOptions:$,nativeSelectKey:H,isFormControl:O};return l.jsx(oN,{...E,children:l.jsx(E$,{scope:t,...I,children:l.jsx(Cm.Provider,{scope:t,children:l.jsx(R$,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:V,children:H$(C)?C(I):r})})})})}vA.displayName=N$;var _A=e=>{const{__scopeSelect:t,children:r,...i}=e;return l.jsx(vA,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:s})=>l.jsxs(l.Fragment,{children:[r,s?l.jsx(IA,{__scopeSelect:t}):null]})})};_A.displayName=Ao;var xA="SelectTrigger",ly=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,o=Rm(r),u=Ha(xA,r),d=u.disabled||i,m=it(t,u.onTriggerChange),h=Em(r),g=v.useRef("touch"),[p,y,b]=zA(C=>{const E=h().filter(k=>!k.disabled),S=E.find(k=>k.value===u.value),N=$A(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(lN,{asChild:!0,...o,children:l.jsx(Ve.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":km(u.value)?"":void 0,...s,ref:m,onClick:Le(s.onClick,C=>{C.currentTarget.focus(),g.current!=="mouse"&&w(C)}),onPointerDown:Le(s.onPointerDown,C=>{g.current=C.pointerType;const E=C.target;E.hasPointerCapture(C.pointerId)&&E.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(w(C),C.preventDefault())}),onKeyDown:Le(s.onKeyDown,C=>{const E=p.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&y(C.key),!(E&&C.key===" ")&&w$.includes(C.key)&&(w(),C.preventDefault())})})})});ly.displayName=xA;var yA="SelectValue",cy=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,children:o,placeholder:u="",...d}=e,m=Ha(yA,r),{onValueNodeHasChildrenChange:h}=m,g=o!==void 0,p=it(t,m.onValueNodeChange);Xt(()=>{h(g)},[h,g]);const y=km(m.value);return l.jsx(Ve.span,{...d,asChild:y?!1:d.asChild,ref:p,style:{pointerEvents:"none"},children:l.jsx(v.Fragment,{children:y?u:o},y?"placeholder":"value")})});cy.displayName=yA;var A$="SelectIcon",bA=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...s}=e;return l.jsx(Ve.span,{"aria-hidden":!0,...s,ref:t,children:i||"▼"})});bA.displayName=A$;var wA="SelectPortal",[T$,M$]=zo(wA,{forceMount:void 0}),SA=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return l.jsx(T$,{scope:e.__scopeSelect,forceMount:r,children:l.jsx(im,{asChild:!0,...i})})};SA.displayName=wA;var ja="SelectContent",uy=v.forwardRef((e,t)=>{const r=M$(ja,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,o=Ha(ja,e.__scopeSelect),[u,d]=v.useState();return Xt(()=>{d(new DocumentFragment)},[]),l.jsx(Cn,{present:i||o.open,children:({present:m})=>m?l.jsx(RA,{...s,ref:t}):l.jsx(CA,{...s,fragment:u})})});uy.displayName=ja;var CA=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?Ia.createPortal(l.jsx(EA,{scope:r,children:l.jsx(Cm.Slot,{scope:r,children:l.jsx("div",{ref:t,children:i})})}),s):null});CA.displayName="SelectContentFragment";var mn=10,[EA,Fa]=zo(ja),j$="SelectContentImpl",D$=Ro("SelectContent.RemoveScroll"),RA=v.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:u,side:d,sideOffset:m,align:h,alignOffset:g,arrowPadding:p,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E,...S}=e,N=Ha(ja,r),[k,R]=v.useState(null),[M,L]=v.useState(null),z=it(t,R),[D,W]=v.useState(null),[G,q]=v.useState(null),B=Em(r),[j,O]=v.useState(!1),$=v.useRef(!1);v.useEffect(()=>{if(k)return Dx(k)},[k]),jx();const T=v.useCallback(Z=>{const[ce,...ne]=B().map(ye=>ye.ref.current),[we]=ne.slice(-1),_e=document.activeElement;for(const ye of Z)if(ye===_e||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===ce&&M&&(M.scrollTop=0),ye===we&&M&&(M.scrollTop=M.scrollHeight),ye==null||ye.focus(),document.activeElement!==_e))return},[B,M]),U=v.useCallback(()=>T([D,k]),[T,D,k]);v.useEffect(()=>{j&&U()},[j,U]);const{onOpenChange:H,triggerPointerDownPosRef:F}=N;v.useEffect(()=>{if(k){let Z={x:0,y:0};const ce=we=>{var _e,ye;Z={x:Math.abs(Math.round(we.pageX)-(((_e=F.current)==null?void 0:_e.x)??0)),y:Math.abs(Math.round(we.pageY)-(((ye=F.current)==null?void 0:ye.y)??0))}},ne=we=>{Z.x<=10&&Z.y<=10?we.preventDefault():we.composedPath().includes(k)||H(!1),document.removeEventListener("pointermove",ce),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",ne,{capture:!0})}}},[k,H,F]),v.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]=zA(Z=>{const ce=B().filter(_e=>!_e.disabled),ne=ce.find(_e=>_e.ref.current===document.activeElement),we=$A(ce,Z,ne);we&&setTimeout(()=>{var _e;return(_e=we.ref.current)==null?void 0:_e.focus()})}),Y=v.useCallback((Z,ce,ne)=>{const we=!$.current&&!ne;(N.value!==void 0&&N.value===ce||we)&&(W(Z),we&&($.current=!0))},[N.value]),X=v.useCallback(()=>k==null?void 0:k.focus(),[k]),ee=v.useCallback((Z,ce,ne)=>{const we=!$.current&&!ne;(N.value!==void 0&&N.value===ce||we)&&q(Z)},[N.value]),re=i==="popper"?e0:kA,oe=re===e0?{side:d,sideOffset:m,align:h,alignOffset:g,arrowPadding:p,collisionBoundary:y,collisionPadding:b,sticky:w,hideWhenDetached:C,avoidCollisions:E}:{};return l.jsx(EA,{scope:r,content:k,viewport:M,onViewportChange:L,itemRefCallback:Y,selectedItem:D,onItemLeave:X,itemTextRefCallback:ee,focusSelectedItem:U,selectedItemText:G,position:i,isPositioned:j,searchRef:V,children:l.jsx(sm,{as:D$,allowPinchZoom:!0,children:l.jsx(rm,{asChild:!0,trapped:N.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Le(s,Z=>{var ce;(ce=N.trigger)==null||ce.focus({preventScroll:!0}),Z.preventDefault()}),children:l.jsx(tm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:u,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(re,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:Z=>Z.preventDefault(),...S,...oe,onPlaced:()=>O(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:Le(S.onKeyDown,Z=>{const ce=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ce&&Z.key.length===1&&I(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let we=B().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const _e=Z.target,ye=we.indexOf(_e);we=we.slice(ye+1)}setTimeout(()=>T(we)),Z.preventDefault()}})})})})})})});RA.displayName=j$;var L$="SelectItemAlignedPosition",kA=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,o=Ha(ja,r),u=Fa(ja,r),[d,m]=v.useState(null),[h,g]=v.useState(null),p=it(t,g),y=Em(r),b=v.useRef(!1),w=v.useRef(!0),{viewport:C,selectedItem:E,selectedItemText:S,focusSelectedItem:N}=u,k=v.useCallback(()=>{if(o.trigger&&o.valueNode&&d&&h&&C&&E&&S){const z=o.trigger.getBoundingClientRect(),D=h.getBoundingClientRect(),W=o.valueNode.getBoundingClientRect(),G=S.getBoundingClientRect();if(o.dir!=="rtl"){const _e=G.left-D.left,ye=W.left-_e,J=z.left-ye,ie=z.width+J,Ee=Math.max(ie,D.width),ve=window.innerWidth-mn,Ae=K_(ye,[mn,Math.max(mn,ve-Ee)]);d.style.minWidth=ie+"px",d.style.left=Ae+"px"}else{const _e=D.right-G.right,ye=window.innerWidth-W.right-_e,J=window.innerWidth-z.right-ye,ie=z.width+J,Ee=Math.max(ie,D.width),ve=window.innerWidth-mn,Ae=K_(ye,[mn,Math.max(mn,ve-Ee)]);d.style.minWidth=ie+"px",d.style.right=Ae+"px"}const q=y(),B=window.innerHeight-mn*2,j=C.scrollHeight,O=window.getComputedStyle(h),$=parseInt(O.borderTopWidth,10),T=parseInt(O.paddingTop,10),U=parseInt(O.borderBottomWidth,10),H=parseInt(O.paddingBottom,10),F=$+T+j+H+U,V=Math.min(E.offsetHeight*5,F),I=window.getComputedStyle(C),Y=parseInt(I.paddingTop,10),X=parseInt(I.paddingBottom,10),ee=z.top+z.height/2-mn,re=B-ee,oe=E.offsetHeight/2,Z=E.offsetTop+oe,ce=$+T+Z,ne=F-ce;if(ce<=ee){const _e=q.length>0&&E===q[q.length-1].ref.current;d.style.bottom="0px";const ye=h.clientHeight-C.offsetTop-C.offsetHeight,J=Math.max(re,oe+(_e?X:0)+ye+U),ie=ce+J;d.style.height=ie+"px"}else{const _e=q.length>0&&E===q[0].ref.current;d.style.top="0px";const J=Math.max(ee,$+C.offsetTop+(_e?Y:0)+oe)+ne;d.style.height=J+"px",C.scrollTop=ce-ee+C.offsetTop}d.style.margin=`${mn}px 0`,d.style.minHeight=V+"px",d.style.maxHeight=B+"px",i==null||i(),requestAnimationFrame(()=>b.current=!0)}},[y,o.trigger,o.valueNode,d,h,C,E,S,o.dir,i]);Xt(()=>k(),[k]);const[R,M]=v.useState();Xt(()=>{h&&M(window.getComputedStyle(h).zIndex)},[h]);const L=v.useCallback(z=>{z&&w.current===!0&&(k(),N==null||N(),w.current=!1)},[k,N]);return l.jsx(B$,{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(Ve.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});kA.displayName=L$;var O$="SelectPopperPosition",e0=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=mn,...o}=e,u=Rm(r);return l.jsx(cN,{...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)"}})});e0.displayName=O$;var[B$,dy]=zo(ja,{}),t0="SelectViewport",NA=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...s}=e,o=Fa(t0,r),u=dy(t0,r),d=it(t,o.onViewportChange),m=v.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(Ve.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Le(s.onScroll,h=>{const g=h.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=u;if(y!=null&&y.current&&p){const b=Math.abs(m.current-g.scrollTop);if(b>0){const w=window.innerHeight-mn*2,C=parseFloat(p.style.minHeight),E=parseFloat(p.style.height),S=Math.max(C,E);if(S<w){const N=S+b,k=Math.min(w,N),R=N-k;p.style.height=k+"px",p.style.bottom==="0px"&&(g.scrollTop=R>0?R:0,p.style.justifyContent="flex-end")}}}m.current=g.scrollTop})})})]})});NA.displayName=t0;var AA="SelectGroup",[P$,I$]=zo(AA),hy=v.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=vn();return l.jsx(P$,{scope:r,id:s,children:l.jsx(Ve.div,{role:"group","aria-labelledby":s,...i,ref:t})})});hy.displayName=AA;var TA="SelectLabel",fy=v.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=I$(TA,r);return l.jsx(Ve.div,{id:s.id,...i,ref:t})});fy.displayName=TA;var If="SelectItem",[z$,MA]=zo(If),my=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:o,...u}=e,d=Ha(If,r),m=Fa(If,r),h=d.value===i,[g,p]=v.useState(o??""),[y,b]=v.useState(!1),w=pr(k=>{var R;return(R=m.itemRefCallback)==null?void 0:R.call(m,k,i,s)}),C=it(t,w),E=vn(),S=v.useRef("touch"),N=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return l.jsx(z$,{scope:r,value:i,disabled:s,textId:E,isSelected:h,onItemTextChange:v.useCallback(k=>{p(R=>R||((k==null?void 0:k.textContent)??"").trim())},[]),children:l.jsx(Cm.ItemSlot,{scope:r,value:i,disabled:s,textValue:g,children:l.jsx(Ve.div,{role:"option","aria-labelledby":E,"data-highlighted":y?"":void 0,"aria-selected":h&&y,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:C,onFocus:Le(u.onFocus,()=>b(!0)),onBlur:Le(u.onBlur,()=>b(!1)),onClick:Le(u.onClick,()=>{S.current!=="mouse"&&N()}),onPointerUp:Le(u.onPointerUp,()=>{S.current==="mouse"&&N()}),onPointerDown:Le(u.onPointerDown,k=>{S.current=k.pointerType}),onPointerMove:Le(u.onPointerMove,k=>{var R;S.current=k.pointerType,s?(R=m.onItemLeave)==null||R.call(m):S.current==="mouse"&&k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Le(u.onPointerLeave,k=>{var R;k.currentTarget===document.activeElement&&((R=m.onItemLeave)==null||R.call(m))}),onKeyDown:Le(u.onKeyDown,k=>{var M;s||k.target!==k.currentTarget||((M=m.searchRef)==null?void 0:M.current)!==""&&k.key===" "||(S$.includes(k.key)&&N(),k.key===" "&&k.preventDefault())})})})})});my.displayName=If;var yu="SelectItemText",jA=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,...o}=e,u=Ha(yu,r),d=Fa(yu,r),m=MA(yu,r),h=k$(yu,r),[g,p]=v.useState(null),y=pr(N=>{var k;return(k=d.itemTextRefCallback)==null?void 0:k.call(d,N,m.value,m.disabled)}),b=it(t,p,m.onItemTextChange,y),w=g==null?void 0:g.textContent,C=v.useMemo(()=>l.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:S}=h;return Xt(()=>(E(C),()=>S(C)),[E,S,C]),l.jsxs(l.Fragment,{children:[l.jsx(Ve.span,{id:m.textId,...o,ref:b}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!km(u.value)?Ia.createPortal(o.children,u.valueNode):null]})});jA.displayName=yu;var DA="SelectItemIndicator",LA=v.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return MA(DA,r).isSelected?l.jsx(Ve.span,{"aria-hidden":!0,...i,ref:t}):null});LA.displayName=DA;var r0="SelectScrollUpButton",py=v.forwardRef((e,t)=>{const r=Fa(r0,e.__scopeSelect),i=dy(r0,e.__scopeSelect),[s,o]=v.useState(!1),u=it(t,i.onScrollButtonChange);return Xt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollTop>0;o(h)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(OA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});py.displayName=r0;var i0="SelectScrollDownButton",gy=v.forwardRef((e,t)=>{const r=Fa(i0,e.__scopeSelect),i=dy(i0,e.__scopeSelect),[s,o]=v.useState(!1),u=it(t,i.onScrollButtonChange);return Xt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollHeight-m.clientHeight,g=Math.ceil(m.scrollTop)<h;o(g)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?l.jsx(OA,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});gy.displayName=i0;var OA=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,o=Fa("SelectScrollButton",r),u=v.useRef(null),d=Em(r),m=v.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return v.useEffect(()=>()=>m(),[m]),Xt(()=>{var g;const h=d().find(p=>p.ref.current===document.activeElement);(g=h==null?void 0:h.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),l.jsx(Ve.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Le(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Le(s.onPointerMove,()=>{var h;(h=o.onItemLeave)==null||h.call(o),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Le(s.onPointerLeave,()=>{m()})})}),$$="SelectSeparator",vy=v.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return l.jsx(Ve.div,{"aria-hidden":!0,...i,ref:t})});vy.displayName=$$;var BA="SelectArrow",U$=v.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=Rm(r);return Fa(BA,r).position==="popper"?l.jsx(uN,{...s,...i,ref:t}):null});U$.displayName=BA;var PA="SelectBubbleInput",IA=v.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Ha(PA,e),{value:s,onValueChange:o,required:u,disabled:d,name:m,autoComplete:h,form:g}=i,{nativeOptions:p,nativeSelectKey:y}=i,b=v.useRef(null),w=it(r,b),C=s??"",E=x$(C),S=Array.from(p).some(N=>(N.props.value??"")==="");return v.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(Ve.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:h,disabled:d,form:g,onChange:N=>o(N.target.value),...t,style:{...gA,...t.style},ref:w,defaultValue:C,children:[km(s)&&!S?l.jsx("option",{value:""}):null,Array.from(p)]},y)});IA.displayName=PA;function H$(e){return typeof e=="function"}function km(e){return e===""||e===void 0}function zA(e){const t=pr(e),r=v.useRef(""),i=v.useRef(0),s=v.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=v.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,o]}function $A(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=F$(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 F$(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function Nm(e){return l.jsx(_A,{"data-slot":"select",...e})}const n0=v.forwardRef(({className:e,...t},r)=>l.jsx(hy,{ref:r,"data-slot":"select-group",className:ct("scroll-my-1 p-1",e),...t}));n0.displayName=hy.displayName;const ld=v.forwardRef((e,t)=>l.jsx(cy,{ref:t,"data-slot":"select-value",...e}));ld.displayName=cy.displayName;const cd=v.forwardRef(({className:e,size:t="default",children:r,...i},s)=>l.jsxs(ly,{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(bA,{asChild:!0,children:l.jsx(Rx,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));cd.displayName=ly.displayName;const UA=v.forwardRef(({className:e,...t},r)=>l.jsx(py,{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(G4,{"aria-hidden":"true"})}));UA.displayName=py.displayName;const HA=v.forwardRef(({className:e,...t},r)=>l.jsx(gy,{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(Rx,{"aria-hidden":"true"})}));HA.displayName=gy.displayName;const ud=v.forwardRef(({className:e,children:t,position:r="popper",align:i="center",sideOffset:s=4,collisionPadding:o=8,...u},d)=>l.jsx(SA,{children:l.jsxs(uy,{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(UA,{}),l.jsx(NA,{"data-position":r,className:ct("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(HA,{})]})}));ud.displayName=uy.displayName;const s0=v.forwardRef(({className:e,...t},r)=>l.jsx(fy,{ref:r,"data-slot":"select-label",className:ct("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));s0.displayName=fy.displayName;const Xn=v.forwardRef(({className:e,children:t,...r},i)=>l.jsxs(my,{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(LA,{children:l.jsx(Ba,{"aria-hidden":"true",className:"pointer-events-none"})})}),l.jsx(jA,{children:t})]}));Xn.displayName=my.displayName;const _y=v.forwardRef(({className:e,...t},r)=>l.jsx(vy,{ref:r,"data-slot":"select-separator",className:ct("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));_y.displayName=vy.displayName;var W$=Object.defineProperty,ic=(e,t)=>W$(e,"name",{value:t,configurable:!0}),FA=!!(typeof window<"u"&&window.document&&window.document.createElement);function xy(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(xy,"composeEventHandlers");function q$(e){var t;if(!FA)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(q$,"getOwnerWindow");function a0(e){if(!FA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}ic(a0,"getOwnerDocument");function WA(e,t=!1){const{activeElement:r}=a0(e);if(!(r!=null&&r.nodeName))return null;if(qA(r)&&r.contentDocument)return WA(r.contentDocument.body,t);if(t){const i=r.getAttribute("aria-activedescendant");if(i){const s=a0(r).getElementById(i);if(s)return s}}return r}ic(WA,"getActiveElement");function qA(e){return e.tagName==="IFRAME"}ic(qA,"isFrame");var V$=Object.defineProperty,yy=(e,t)=>V$(e,"name",{value:t,configurable:!0});function o0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}yy(o0,"setRef");function VA(...e){return t=>{let r=!1;const i=e.map(s=>{const o=o0(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():o0(e[s],null)}}}}yy(VA,"composeRefs");function Am(...e){return v.useCallback(VA(...e),e)}yy(Am,"useComposedRefs");var G$=Object.defineProperty,Yi=(e,t)=>G$(e,"name",{value:t,configurable:!0});function Y$(e,t){const r=v.createContext(t);r.displayName=e+"Context";const i=Yi(o=>{const{children:u,...d}=o,m=v.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=v.useContext(r);if(m)return m;if(t!==void 0)return t;if(!d)throw new Error(`\`${o}\` must be used within \`${e}\``)}return Yi(s,"useContext"),[i,s]}Yi(Y$,"createContext");function GA(e,t=[]){let r=[];function i(o,u){const d=v.createContext(u);d.displayName=o+"Context";const m=r.length;r=[...r,u];const h=Yi(p=>{var S;const{scope:y,children:b,...w}=p,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=v.useMemo(()=>w,Object.values(w));return l.jsx(C.Provider,{value:E,children:b})},"Provider");h.displayName=o+"Provider";function g(p,y,b={}){var S;const{optional:w=!1}=b,C=((S=y==null?void 0:y[e])==null?void 0:S[m])||d,E=v.useContext(C);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${p}\` must be used within \`${o}\``)}return Yi(g,"useContext"),[h,g]}Yi(i,"createContext");const s=Yi(()=>{const o=r.map(u=>v.createContext(u));return Yi(function(d){const m=(d==null?void 0:d[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return s.scopeName=e,[i,YA(s,...t)]}Yi(GA,"createContextScope");function YA(...e){const t=e[0];if(e.length===1)return t;const r=Yi(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Yi(function(o){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...d,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}Yi(YA,"composeContextScopes");var by=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},K$=Object.defineProperty,X$=(e,t)=>K$(e,"name",{value:t,configurable:!0}),HC=La[" useEffectEvent ".trim().toString()],FC=La[" useInsertionEffect ".trim().toString()];function KA(e){if(typeof HC=="function")return HC(e);const t=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof FC=="function"?FC(()=>{t.current=e}):by(()=>{t.current=e}),v.useMemo(()=>((...r)=>{var i;return(i=t.current)==null?void 0:i.call(t,...r)}),[])}X$(KA,"useEffectEvent");var Z$=Object.defineProperty,dd=(e,t)=>Z$(e,"name",{value:t,configurable:!0}),Q$=La[" useInsertionEffect ".trim().toString()]||by;function XA({prop:e,defaultProp:t,onChange:r=dd(()=>{},"onChange"),caller:i}){const[s,o,u]=ZA({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:s,h=v.useCallback(g=>{var p;if(d){const y=QA(g)?g(e):g;y!==e&&((p=u.current)==null||p.call(u,y))}else o(g)},[d,e,o,u]);return[m,h]}dd(XA,"useControllableState");function ZA({defaultProp:e,onChange:t}){const[r,i]=v.useState(e),s=v.useRef(r),o=v.useRef(t);return Q$(()=>{o.current=t},[t]),v.useEffect(()=>{var u;s.current!==r&&((u=o.current)==null||u.call(o,r),s.current=r)},[r,s]),[r,i,o]}dd(ZA,"useUncontrolledState");function QA(e){return typeof e=="function"}dd(QA,"isFunction");var WC=Symbol("RADIX:SYNC_STATE");function J$(e,t,r,i){const{prop:s,defaultProp:o,onChange:u,caller:d}=t,m=s!==void 0,h=KA(u),g=[{...r,state:o}];i&&g.push(i);const[p,y]=v.useReducer((E,S)=>{if(S.type===WC)return{...E,state:S.state};const N=e(E,S);return m&&!Object.is(N.state,E.state)&&h(N.state),N},...g),b=p.state,w=v.useRef(b);v.useEffect(()=>{w.current!==b&&(w.current=b,m||h(b))},[b,w,m]);const C=v.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return v.useEffect(()=>{m&&!Object.is(s,p.state)&&y({type:WC,state:s})},[s,p.state,m]),[C,y]}dd(J$,"useControllableStateReducer");var e9=Object.defineProperty,t9=(e,t)=>e9(e,"name",{value:t,configurable:!0});function JA(e){const[t,r]=v.useState(void 0);return by(()=>{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}t9(JA,"useSize");var r9=Object.defineProperty,sn=(e,t)=>r9(e,"name",{value:t,configurable:!0}),i9=sn(((e,t)=>{const r={...t};for(const i in t){const s=e[i],o=t[i];if(/^on[A-Z]/.test(i))if(s&&o){const d=typeof s=="function",m=typeof o=="function";r[i]=(...h)=>{const g=m?o(...h):void 0;return d&&s(...h),g}}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]=eT(o,s))}return{...e,...r}}),"mergeProps");function eT(...e){const t=new Set;for(const r of e)if(typeof r=="string")for(const i of String(r).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}sn(eT,"concatAriaDescribedby");var tT=v.createContext(i9);tT.displayName="SlotContext";function rT(e){const t=v.forwardRef((r,i)=>{const s=v.useContext(tT);let{children:o,mergeProps:u=s,...d}=r,m=null,h=!1;const g=[];l0(o)&&typeof $h=="function"&&(o=$h(o._payload)),v.Children.forEach(o,w=>{var C;if(sT(w)){h=!0;const E=w;let S="child"in E.props?E.props.child:E.props.children;l0(S)&&typeof $h=="function"&&(S=$h(S._payload)),m=s9(E,S),g.push((C=m==null?void 0:m.props)==null?void 0:C.children)}else g.push(w)}),m?m=v.cloneElement(m,void 0,g):!h&&v.Children.count(o)===1&&v.isValidElement(o)&&(m=o);const p=m?nT(m):void 0,y=Am(i,p);if(!m){if(o||o===0)throw new Error(h?l9(e):o9(e));return o}const b=u(d,m.props??{});return m.type!==v.Fragment&&(b.ref=i?y:p),v.cloneElement(m,b)});return t.displayName=`${e}.Slot`,t}sn(rT,"createSlot");var iT=Symbol.for("radix.slottable");function n9(e){const t=sn(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=iT,t}sn(n9,"createSlottable");var s9=sn((e,t)=>{if("child"in e.props){const r=e.props.child;return v.isValidElement(r)?v.cloneElement(r,void 0,e.props.children(r.props.children)):null}return v.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function nT(e){var i,s;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}sn(nT,"getElementRef");function sT(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===iT}sn(sT,"isSlottable");var a9=Symbol.for("react.lazy");function l0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===a9&&"_payload"in e&&aT(e._payload)}sn(l0,"isLazyComponent");function aT(e){return typeof e=="object"&&e!==null&&"then"in e}sn(aT,"isPromiseLike");var o9=sn(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),l9=sn(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),$h=La[" use ".trim().toString()],c9=Object.defineProperty,u9=(e,t)=>c9(e,"name",{value:t,configurable:!0}),d9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wy=d9.reduce((e,t)=>{const r=rT(`Primitive.${t}`),i=v.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 h9(e,t){e&&Ia.flushSync(()=>e.dispatchEvent(t))}u9(h9,"dispatchDiscreteCustomEvent");var f9=Object.defineProperty,Da=(e,t)=>f9(e,"name",{value:t,configurable:!0}),Sy="Switch",[m9,fZ]=GA(Sy),[p9,Cy]=m9(Sy);function oT(e){const{__scopeSwitch:t,checked:r,children:i,defaultChecked:s,disabled:o,form:u,name:d,onCheckedChange:m,required:h,value:g="on",internal_do_not_use_render:p}=e,[y,b]=XA({prop:r,defaultProp:s??!1,onChange:m,caller:Sy}),[w,C]=v.useState(null),[E,S]=v.useState(null),N=v.useRef(!1),[k,R]=v.useReducer(z=>z+1,0),M=w?!!u||!!w.closest("form"):!0,L={checked:y,setChecked:b,disabled:o,control:w,setControl:C,name:d,form:u,value:g,hasConsumerStoppedPropagationRef:N,userInteractionCount:k,onUserInteraction:R,required:h,defaultChecked:s,isFormControl:M,bubbleInput:E,setBubbleInput:S};return l.jsx(p9,{scope:t,...L,children:cT(p)?p(L):i})}Da(oT,"SwitchProvider");var g9="SwitchTrigger",v9=v.forwardRef(Da(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,form:u,value:d,disabled:m,checked:h,required:g,setControl:p,setChecked:y,hasConsumerStoppedPropagationRef:b,onUserInteraction:w,isFormControl:C,bubbleInput:E}=Cy(g9,t),S=Am(s,p),N=v.useRef(h);return v.useEffect(()=>{const k=u?o==null?void 0:o.ownerDocument.getElementById(u):o==null?void 0:o.form;if(k instanceof HTMLFormElement){const R=Da(()=>y(N.current),"reset");return k.addEventListener("reset",R),()=>k.removeEventListener("reset",R)}},[o,u,y]),l.jsx(wy.button,{type:"button",role:"switch","aria-checked":h,"aria-required":g,"data-state":Ey(h),"data-disabled":m?"":void 0,disabled:m,value:d,...i,ref:S,onClick:xy(r,k=>{w(),y(R=>!R),E&&C&&(b.current=k.isPropagationStopped(),b.current||k.stopPropagation())})})},"SwitchTrigger")),lT=v.forwardRef(Da(function(t,r){const{__scopeSwitch:i,name:s,checked:o,defaultChecked:u,required:d,disabled:m,value:h,onCheckedChange:g,form:p,...y}=t;return l.jsx(oT,{__scopeSwitch:i,checked:o,defaultChecked:u,disabled:m,required:d,onCheckedChange:g,name:s,form:p,value:h,internal_do_not_use_render:({isFormControl:b})=>l.jsxs(l.Fragment,{children:[l.jsx(v9,{...y,ref:r,__scopeSwitch:i}),b&&l.jsx(b9,{__scopeSwitch:i})]})})},"Switch")),_9="SwitchThumb",x9=v.forwardRef(Da(function(t,r){const{__scopeSwitch:i,...s}=t,o=Cy(_9,i);return l.jsx(wy.span,{"data-state":Ey(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})},"SwitchThumb")),y9="SwitchBubbleInput",b9=v.forwardRef(Da(function({__scopeSwitch:t,onClick:r,...i},s){const{control:o,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:m,defaultChecked:h,required:g,disabled:p,name:y,value:b,form:w,bubbleInput:C,setBubbleInput:E}=Cy(y9,t),S=Am(s,E),N=JA(o),k=v.useRef(!1),R=v.useRef(m),M=v.useRef(d);v.useEffect(()=>{const z=C;if(!z)return;const D=window.HTMLInputElement.prototype,G=Object.getOwnPropertyDescriptor(D,"checked").set,q=d!==M.current;M.current=d;const B=R.current!==m;R.current=m;const j=!(q&&u.current);if(B&&G){k.current=!q;const O=new Event("click",{bubbles:j});G.call(z,m),z.dispatchEvent(O),k.current=!1}},[C,m,u,d]);const L=v.useRef(m);return l.jsx(wy.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??L.current,required:g,disabled:p,name:y,value:b,form:w,...i,tabIndex:-1,ref:S,onClick:xy(r,z=>{k.current&&z.stopPropagation()}),style:{...i.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function cT(e){return typeof e=="function"}Da(cT,"isFunction");function Ey(e){return e?"checked":"unchecked"}Da(Ey,"getState");const uT=v.forwardRef(({className:e,size:t="default",...r},i)=>l.jsx(lT,{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(x9,{"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"})}));uT.displayName=lT.displayName;var Tm="Tabs",[w9]=Sn(Tm,[_m]),dT=_m(),[S9,Ry]=w9(Tm),hT=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,onValueChange:s,defaultValue:o,orientation:u="horizontal",dir:d,activationMode:m="automatic",...h}=e,g=td(d),[p,y]=Eo({prop:i,onChange:s,defaultProp:o??"",caller:Tm});return l.jsx(S9,{scope:r,baseId:vn(),value:p,onValueChange:y,orientation:u,dir:g,activationMode:m,children:l.jsx(Ve.div,{dir:g,"data-orientation":u,...h,ref:t})})});hT.displayName=Tm;var fT="TabsList",mT=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:i=!0,...s}=e,o=Ry(fT,r),u=dT(r);return l.jsx(vN,{asChild:!0,...u,orientation:o.orientation,dir:o.dir,loop:i,children:l.jsx(Ve.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});mT.displayName=fT;var pT="TabsTrigger",gT=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,disabled:s=!1,...o}=e,u=Ry(pT,r),d=dT(r),m=xT(u.baseId,i),h=yT(u.baseId,i),g=i===u.value;return l.jsx(_N,{asChild:!0,...d,focusable:!s,active:g,children:l.jsx(Ve.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":h,"data-state":g?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:m,...o,ref:t,onMouseDown:Le(e.onMouseDown,p=>{!s&&p.button===0&&p.ctrlKey===!1?u.onValueChange(i):p.preventDefault()}),onKeyDown:Le(e.onKeyDown,p=>{s||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&u.onValueChange(i)}),onFocus:Le(e.onFocus,()=>{const p=u.activationMode!=="manual";!g&&!s&&p&&u.onValueChange(i)})})})});gT.displayName=pT;var vT="TabsContent",_T=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:i,forceMount:s,children:o,...u}=e,d=Ry(vT,r),m=xT(d.baseId,i),h=yT(d.baseId,i),g=i===d.value,p=v.useRef(g);return v.useEffect(()=>{const y=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(y)},[]),l.jsx(Cn,{present:s||g,children:({present:y})=>l.jsx(Ve.div,{"data-state":g?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!y,id:h,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:y&&o})})});_T.displayName=vT;function xT(e,t){return`${e}-trigger-${t}`}function yT(e,t){return`${e}-content-${t}`}var C9=hT,E9=mT,R9=gT,k9=_T;const pt={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",logs:"/settings/logs",daemon:"/settings/daemon",command:"/settings/command",computer:"/settings/computer",inspection:"/settings/inspection"},zu="/settings",c0=pt.overview,N9="/runtimes/:runtimeSelector/sessions",A9="/runtimes/:runtimeSelector/sessions/:sessionId",$u="!invalid-runtime-owner",T9=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,M9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",agents:"/agents",skills:"/skills",channels:"/channels",instances:"/instances",logs:"/logs"},bT=["daemon","command","computer","inspection"];function j9(e){return bT.includes(e)}function wT(e,t){return!j9(e)||t}function ST(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(u0(t)||t===pt.sessions||t.startsWith(`${pt.sessions}/`))return"sessions";const r=Object.entries(pt).find(([,i])=>i===t);return(r==null?void 0:r[0])??"sessions"}function D9(e,t=!0){const r=ST(e);return r==="sessions"||!wT(r,t)?null:r}function u0(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return ET(decodeURIComponent(t[1]))}catch{return $u}}function CT(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?$u:ET(t[0])}function ET(e){return T9.test(e)?e:$u}function cf(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function xo(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function RT(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==zu&&!r.startsWith(`${zu}/`)?r:t}class yo extends Error{constructor(r,i,s,o){super(r);Hr(this,"status");Hr(this,"code");Hr(this,"outcome");this.name="ApiRequestError",this.status=i,this.code=s,this.outcome=o}}function ky(e){return e instanceof yo&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const L9="/api/runtimes/capability",O9="x-rynx-runtime-capability";let Il;async function B9(e,t,r){const i=location.protocol==="https:"?"wss":"ws",s=await Uu(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 P9(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 I9(e,t,r,i){const s=i?`${Br(i,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,o={method:"POST",body:JSON.stringify({resolution:r})};return(i?await kt(s,o):await Ye(s,o)).disposition}async function Ye(e,t={}){return kT(e,{},t)}async function kT(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 Uu(e=!1){return e&&(Il=void 0),Il||(Il=Ye(L9,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw Il=void 0,t})),Il}async function kt(e,t){const r=async s=>{const o=new Headers(t.headers);return o.set(O9,s),Ye(e,{...t,headers:o})},i=await Uu();try{return await r(i)}catch(s){if(!(s instanceof Error)||s.message!=="invalid_runtime_capability")throw s;return Il=void 0,r(await Uu())}}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 qC(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 NT(o,r)}async function z9(e,t,r){const i=await fetch(e,{signal:r});await NT(i,t)}async function NT(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(`
|
|
526
|
+
|
|
527
|
+
`))!==-1;){const m=s.slice(0,d);s=s.slice(d+2);const h=$9(m);h&&t(h)}}}function $9(e){let t="message",r="";for(const s of e.split(`
|
|
528
|
+
`))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 d0(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function ru(e,t,r){const i=d0(e,t);return e?kt(i,r):Ye(i,r)}function Br(e,t,r){const i=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return i;const s=`${i}/${encodeURIComponent(t)}`;return r?`${s}/${r}`:s}function zl(e,t,...r){const i=`${Br(e,t)}/browser`;return r.length===0?i:`${i}/${r.map(s=>encodeURIComponent(s)).join("/")}`}function uo(e,t,r){const i=`${Br(e,t)}/emulator`;return r?`${i}/${r}`:i}function U9(e,t,r){const i=new URLSearchParams({bindingId:r});return`${Br(e,t)}/emulator/frame?${i.toString()}`}function iu(e,t,r,i,s){return kt(zl(e,t,"pages",i,s),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function yv(e,t,r){return e?Br(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const be={meta:()=>Ye("/api/meta"),listRuntimeShareAddresses:()=>Ye("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>kt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Ye("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>kt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>kt(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>Ye("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Ye(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>kt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Ye(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>kt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>kt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>kt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>kT(zl(e,t),null),openRuntimeBrowser:(e,t,r)=>kt(zl(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>kt(zl(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,i)=>kt(zl(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...i===void 0?{}:{url:i}})}),closeRuntimeBrowserPage:(e,t,r,i)=>iu(e,t,r,i,"close"),activateRuntimeBrowserPage:(e,t,r,i)=>iu(e,t,r,i,"activate"),navigateRuntimeBrowserPage:(e,t,r,i,s)=>kt(zl(e,t,"pages",i,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:s})}),backRuntimeBrowserPage:(e,t,r,i)=>iu(e,t,r,i,"back"),forwardRuntimeBrowserPage:(e,t,r,i)=>iu(e,t,r,i,"forward"),reloadRuntimeBrowserPage:(e,t,r,i)=>iu(e,t,r,i,"reload"),getSessionEmulator:(e,t)=>Ye(uo(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Ye(uo(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>kt(uo(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>kt(uo(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,i,s)=>kt(uo(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:i,y:s})}),gestureSessionEmulator:(e,t,r,i)=>kt(uo(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:i})}),buttonSessionEmulator:(e,t,r,i)=>kt(uo(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:i})}),sessionEmulatorFrameBlob:(e,t,r,i)=>xv(U9(e,t,r),{signal:i,cache:"no-store"}),channelTypes:()=>Ye("/api/channel-types").then(e=>e.channelTypes),listChannels:()=>Ye("/api/channels").then(e=>e.channels),createChannel:e=>Ye("/api/channels",{method:"POST",body:JSON.stringify(e)}),updateChannel:(e,t)=>Ye(`/api/channels/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteChannel:e=>Ye(`/api/channels/${encodeURIComponent(e)}`,{method:"DELETE"}),authorizeChannel:(e,t,r)=>qC(`/api/channels/${encodeURIComponent(e)}/authorize`,void 0,t,r),listInstances:()=>Ye("/api/instances").then(e=>e.instances),createInstance:e=>Ye("/api/instances",{method:"POST",body:JSON.stringify(e)}),updateInstance:(e,t)=>Ye(`/api/instances/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),instanceAction:(e,t)=>Ye(`/api/instances/${encodeURIComponent(e)}/${t}`,{method:"POST"}),deleteInstance:e=>Ye(`/api/instances/${encodeURIComponent(e)}`,{method:"DELETE"}),emulatorDevices:e=>Ye(d0(e,"devices")).then(t=>t.devices),activeEmulator:e=>Ye(d0(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>ru(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,i)=>ru(i,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>ru(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>ru(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>ru(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)=>Ye("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>xv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Ye("/api/agents").then(e=>e.agents),getAgent:e=>Ye(`/api/agents/${encodeURIComponent(e)}`),writeAgent:e=>Ye("/api/agents",{method:"POST",body:JSON.stringify(e)}),deleteAgent:e=>Ye(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listSkills:()=>Ye("/api/skills").then(e=>e.skills),getSkill:e=>Ye(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Ye(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Ye("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),deleteSkill:e=>Ye(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),logs:(e,t=200)=>Ye(`/api/logs?lines=${t}${e?`&instance=${encodeURIComponent(e)}`:""}`).then(r=>r.logs),listSessions:e=>Ye(e?Br(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Ye(`${Br(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Ye(`${Br(e)}/launch-options`),createSession:(e,t)=>{const r=t?Br(t):"/api/sessions",i={method:"POST",body:JSON.stringify(e)};return t?kt(r,i):Ye(r,i)},sendSessionMessage:(e,t,r,i,s)=>s?kt(Br(s,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:i}).then(()=>{}):qC(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,i),getSessionResourcePolicy:(e,t)=>Ye(`${Br(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,i,s)=>kt(Br(e,t,"resources"),{method:"POST",body:r,signal:s,headers:{"content-type":r.type,"x-rynx-upload-id":i,"x-rynx-filename":encodeURIComponent(r.name)}}).then(o=>o.resource),deleteSessionResource:(e,t,r)=>kt(`${Br(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>`${Br(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`,enqueueSessionMessage:(e,t,r)=>kt(Br(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t,r)=>kt(Br(e,t,"terminal/start"),{method:"POST",body:"{}",signal:r}),streamSession:(e,t,r,i)=>z9(yv(i,e,"stream"),t,r),getSessionHistory:e=>Ye(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Ye(yv(r,e,"snapshot"),{signal:t}),closeSession:(e,t)=>{const r=t?Br(t,e):`/api/sessions/${encodeURIComponent(e)}`,i={method:"DELETE"};return t?kt(r,i):Ye(r,i)},interruptSession:(e,t)=>{const r=yv(t,e,"interrupt"),i={method:"POST"};return t?kt(r,i):Ye(r,i)}},AT="rynx.control.runtime-target.v1",TT={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function H9(e){var t;if(!e)return"local";try{return((t=e.getItem(AT))==null?void 0:t.trim())||"local"}catch{return"local"}}function VC(e,t){if(e)try{e.setItem(AT,t)}catch{}}function F9(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",TT),[...t.values()].sort((r,i)=>r.selector==="local"?-1:i.selector==="local"?1:r.displayName.localeCompare(i.displayName))}const MT=v.createContext(null);function W9({children:e}){const t=Ur(),r=Oa(),i=u0(t.pathname)??(t.pathname===pt.sessions?CT(t.search):null),[s,o]=v.useState(()=>H9(typeof window>"u"?void 0:window.localStorage)),u=i??s,[d,m]=v.useState([TT]),h=v.useCallback(b=>{m(F9(b))},[]),g=v.useCallback(async()=>{try{h(await be.listRuntimes())}catch(b){xe.error(`Failed to load Runtimes: ${b.message}`)}},[h]);v.useEffect(()=>{g()},[g]),v.useEffect(()=>{!i||i===$u||(o(i),VC(typeof window>"u"?void 0:window.localStorage,i))},[i]);const p=v.useCallback(b=>{const w=b.trim();if(!w)return;o(w),VC(typeof window>"u"?void 0:window.localStorage,w),(t.pathname===pt.sessions||t.pathname.startsWith(`${pt.sessions}/`)||u0(t.pathname)!==null)&&i!==w&&r(xo(w))},[t.pathname,r,i]),y=v.useMemo(()=>{const b=d.find(C=>C.selector===u)??(u===$u?{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:g,updateRuntimes:h}},[g,u,d,p,h]);return l.jsx(MT.Provider,{value:y,children:e})}function nc(){const e=v.useContext(MT);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const GC="!add-runtime";function q9(){const e=Ur(),t=Oa(),{runtimes:r,runtimeSelector:i,selectedRuntime:s,selectRuntime:o}=nc(),u=r.some(m=>m.selector===i)?r:[...r,s],d=m=>{if(m===GC){t(pt.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}o(m)};return l.jsx("div",{className:"ml-auto w-44 max-w-full sm:w-60",children:l.jsxs(Nm,{value:i,onValueChange:d,children:[l.jsxs(cd,{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(ld,{placeholder:"Select Runtime"})]}),l.jsxs(ud,{align:"end",children:[u.map(m=>{const h=m.binding==="local"?Nx:Qu;return l.jsx(Xn,{value:m.selector,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(h,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),l.jsx(_y,{}),l.jsx(Xn,{value:GC,children:l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Qi,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),l.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function qe(...e){return Bk(Ix(e))}function V9({children:e,theme:t,onToggleTheme:r}){const i=Ur(),{runtimeSelector:s}=nc(),o=ST(i.pathname),u=i.pathname===zu||i.pathname.startsWith(`${zu}/`),d=RT(i.state,xo(s)),m=u?d:c0,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(q9,{}),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(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(FB,{}):l.jsx(KO,{})}),l.jsx(he,{asChild:!0,variant:"ghost",size:"icon-xs",className:qe("shrink-0",u&&"text-[var(--primary)]"),children:l.jsx(Sa,{to:m,state:h,"aria-label":u?"Back to app":"Settings",title:u?"Back to app":"Settings",children:l.jsx(NB,{})})})]})]})]})]})}const zf="/assets/rynx-wordmark-LL1QRYHD.png";function hd(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function jT(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function uf(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||jT(e)&&t}function G9({bridge:e,children:t}){const[r,i]=v.useState(null),[s,o]=v.useState(null),[u,d]=v.useState("refresh"),[m,h]=v.useState(!1),g=v.useCallback(async(E=!1)=>{d("refresh"),o(null);try{const S=await e.getStatus(E);uf(S,!1)?i(await e.completeOnboarding()):i(S)}catch(S){o(S.message)}finally{d(null)}},[e]);v.useEffect(()=>{e.initialOnboardingCompleted||g()},[e.initialOnboardingCompleted,g]);const p=r?uf(r,m):!1;async function y(){const E=r==null?void 0:r.globalCli.path;if(E){d("install"),o(null);try{const S=await e.installCli(E);h(!1),uf(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(Y9,{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(K9,{status:r,pending:u,acknowledged:m,onAcknowledgedChange:h,onInstall:()=>void y(),onRefresh:()=>void g(!0),onContinue:()=>void w()}):l.jsx(X9,{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(Qe,{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(Zu,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})})]})]})}function Y9({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 K9({status:e,pending:t,acknowledged:r,onAcknowledgedChange:i,onInstall:s,onRefresh:o,onContinue:u}){const m=e.globalCli.state==="installed"&&!e.globalCli.canInstall,h=jT(e),g=uf(e,r);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:m?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:m?l.jsx(Ba,{className:"size-4"}):l.jsx(kx,{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:Z9(e)})]})]}),h&&l.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--background))] p-3 text-xs",children:[l.jsx("input",{type:"checkbox",checked:r,onChange:p=>i(p.target.checked),className:"mt-0.5 size-4 shrink-0 accent-[var(--primary)]"}),l.jsxs("span",{children:["Continue without Terminal access. I'll resolve the"," ",l.jsx("code",{className:"font-mono",children:"rynx"})," command later."]})]}),l.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[e.globalCli.canInstall&&l.jsxs(he,{disabled:t!==null,onClick:s,children:[t==="install"&&l.jsx(Qe,{className:"animate-spin"}),"Install command"]}),(m||h)&&l.jsxs(he,{disabled:t!==null||!g,onClick:u,children:["Continue",l.jsx(SR,{})]}),l.jsxs(he,{variant:"outline",disabled:t!==null,onClick:o,children:[l.jsx(Nt,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function X9({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(Zu,{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(Qe,{className:"animate-spin"}),"Try again"]})]})]})}function Z9(e){switch(e.globalCli.state){case"installed":return e.globalCli.canInstall?"Install the rynx command to use Rynx from Terminal.":"Rynx is ready to use from Terminal.";case"missing":return"Install the rynx command to use Rynx from Terminal.";case"stale":return"An older rynx command was found. Repair it to continue.";case"foreign":return"Another command named rynx already exists. Resolve it later in Settings.";case"unwritable":return"Rynx could not install the command automatically. Resolve it later in Settings.";case"error":return"Rynx could not check the command. Check again before continuing."}}function Q9({bridge:e}){const[t,r]=v.useState(null),[i,s]=v.useState(!1),[o,u]=v.useState(null),d=v.useRef(!1),m=v.useRef(0),h=v.useCallback(b=>{b.requestId<=m.current||(m.current=b.requestId,r(b),s(!1),u(null),d.current=!1)},[]);v.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 g=v.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=v.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]),y=(t==null?void 0:t.kind)==="active-work";return l.jsx(Rn,{open:t!==null,onOpenChange:b=>{b||g()},children:l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(a8,{className:"bg-destructive/10 text-destructive",children:l.jsx(Ea,{"aria-hidden":"true"})}),l.jsx(en,{children:y?"Quit Rynx?":"Rynx couldn’t quit"}),l.jsx(tn,{children:y?"Work is still running. Quitting now will stop it and close the open workspace.":"Rynx couldn’t stop its local service safely. Keep the app open and try again."})]}),o&&l.jsx("p",{role:"alert",className:"text-sm text-destructive",children:o}),l.jsxs(Nn,{children:[l.jsx(rn,{disabled:i,children:y?"Keep working":"Close"}),y&&l.jsx(he,{type:"button",variant:"destructive",disabled:i,onClick:()=>void p(),children:i?l.jsxs(l.Fragment,{children:[l.jsx(Qe,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const J9=[{label:"General",items:[{id:"overview",label:"Overview",icon:LO}]},{label:"Connections",items:[{id:"runtimes",label:"Runtimes",icon:Qu}]},{label:"Devices",items:[{id:"emulator",label:"Emulator",icon:Yl}]},{label:"Desktop",items:[{id:"daemon",label:"Daemon",icon:Ef},{id:"command",label:"Terminal command",icon:kx},{id:"computer",label:"Computer integration",icon:TR},{id:"inspection",label:"Chrome inspection",icon:bB}]},{label:"Agents",items:[{id:"providers",label:"Providers",icon:Tx},{id:"agents",label:"Agents",icon:Cx},{id:"skills",label:"Skills",icon:BR}]},{label:"Integrations",items:[{id:"channels",label:"Channels",icon:Ex},{id:"instances",label:"Instances",icon:CR}]},{label:"Diagnostics",items:[{id:"logs",label:"Logs",icon:LR}]}];function eU({activeView:e,desktopIntegrationAvailable:t,children:r}){const i=Oa(),s=Ur(),{runtimeSelector:o}=nc(),u=RT(s.state,xo(o)),d={returnTo:u},m=J9.map(g=>({...g,items:g.items.filter(({id:p})=>wT(p,t))})).filter(g=>g.items.length>0),h=m.flatMap(g=>g.items);return l.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[l.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[l.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:l.jsxs(Sa,{to:u,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[l.jsx("img",{src: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(Sa,{to:u,children:[l.jsx(Gl,{className:"size-3.5"}),"Back to app"]})})]}),l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:m.map(g=>l.jsxs("div",{children:[l.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:g.label}),l.jsx("div",{className:"grid gap-0.5",children:g.items.map(({id:p,label:y,icon:b})=>l.jsxs(Sa,{to:pt[p],state:d,"aria-current":e===p?"page":void 0,className:qe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",e===p?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]"),children:[l.jsx(b,{className:"size-3.5 shrink-0"}),y]},p))})]},g.label))})})]}),l.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[l.jsx(Sa,{to:u,className:"app-no-drag shrink-0","aria-label":"Rynx",children:l.jsx("img",{src: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(Sa,{to:u,children:[l.jsx(Gl,{className:"size-3.5"}),"Back"]})}),l.jsx(Ma,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:g=>i(pt[g.target.value],{state:d}),children:h.map(({id:g,label:p})=>l.jsx("option",{value:g,children:p},g))})]}),e==="emulator"?l.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:r}):l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var tU="Label",DT=v.forwardRef((e,t)=>l.jsx(Ve.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));DT.displayName=tU;var rU=DT;const $r=v.forwardRef(({className:e,...t},r)=>l.jsx(rU,{ref:r,className:qe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));$r.displayName="Label";function LT({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[i,s]=v.useState(!1),[o,u]=v.useState(""),[d,m]=v.useState(""),[h,g]=v.useState(""),[p,y]=v.useState(!1);function b(){u(""),m(""),g("")}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){xe.error("Source already pins a ref with '#' — clear one of the two.");return}y(!0);try{const k=await be.installSkill({tool:"skills-cli",source:N,...h.trim()?{skill:h.trim()}:{}});xe.success(`Installed ${h.trim()||N}`),e(k),b(),s(!1)}catch(k){xe.error(`Install failed: ${k.message}`)}finally{y(!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(zk,{asChild:!0,children:l.jsxs(he,{size:"sm",variant:r,children:[l.jsx(Qi,{})," ",t]})}),l.jsxs($a,{children:[l.jsxs(Bo,{children:[l.jsx(Ua,{children:"Install a skill"}),l.jsxs(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($r,{children:["Source ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(xt,{value:o,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:N=>u(N.target.value)}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",l.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Skill"}),l.jsx(xt,{value:h,placeholder:"find-skills",onChange:N=>g(N.target.value)}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Branch"}),l.jsx(xt,{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(ed,{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 iU=["codex","traex","claude"],nU=["none","minimal","low","medium","high","xhigh","max","ultra"],sU=["read-only","workspace-write","danger-full-access"],aU=["never","on-failure","on-request","untrusted"],oU=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function lU({value:e,onChange:t}){return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:l.jsx(xt,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),l.jsx(tr,{label:"Description",children:l.jsx(xt,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),l.jsx(tr,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:l.jsx(wm,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function cU({value:e,onChange:t}){const r=e.executor??{},i=r.retry??{},s=u=>t({...e,executor:{...r,...u}}),o=u=>t({...e,executor:{...r,retry:{...i,...u}}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(tr,{label:"Runtime",children:l.jsx(Au,{value:r.runtime,options:iU,required:!0,onChange:u=>s({runtime:u})})}),l.jsx(tr,{label:"Reasoning effort",children:l.jsx(Au,{value:r.reasoningEffort,options:nU,onChange:u=>s({reasoningEffort:u})})})]}),l.jsx(tr,{label:"Model",help:"Blank inherits the runtime default.",children:l.jsx(xt,{value:r.model??"",placeholder:"runtime default",onChange:u=>s({model:u.target.value||void 0})})}),l.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(tr,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:l.jsx(nu,{value:r.timeout,onChange:u=>s({timeout:u})})}),l.jsx(tr,{label:"Max iterations",help:"claude only (→ --max-turns).",children:l.jsx(nu,{value:r.maxIterations,onChange:u=>s({maxIterations:u})})}),l.jsx(tr,{label:"Context window",help:"codex/traex token budget.",children:l.jsx(nu,{value:r.contextWindow,onChange:u=>s({contextWindow:u})})}),l.jsx(tr,{label:"Retry: max retries",children:l.jsx(nu,{value:i.maxRetries,onChange:u=>o({maxRetries:u})})}),l.jsx(tr,{label:"Retry: timeout/req (s)",children:l.jsx(nu,{value:i.timeoutPerRequestSeconds,onChange:u=>o({timeoutPerRequestSeconds:u})})})]})]})}function uU({value:e,onChange:t}){var o;const r=e.osEnv??{},i=u=>t({...e,osEnv:{...r,...u}}),s=((o=e.executor)==null?void 0:o.runtime)??"codex";return l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s==="claude"?l.jsx(tr,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:l.jsx(Au,{value:r.permissionMode,options:oU,onChange:u=>i({permissionMode:u})})}):l.jsxs(l.Fragment,{children:[l.jsx(tr,{label:"Sandbox",children:l.jsx(Au,{value:r.sandbox,options:sU,onChange:u=>i({sandbox:u})})}),l.jsx(tr,{label:"Approval policy",help:"Codex's approval axis.",children:l.jsx(Au,{value:r.approvalPolicy,options:aU,onChange:u=>i({approvalPolicy:u})})})]}),l.jsx(tr,{label:"Working directory (cwd)",children:l.jsx(xt,{value:r.cwd??"",placeholder:"(inherit)",onChange:u=>i({cwd:u.target.value||void 0})})}),l.jsx(tr,{label:"Full auto",children:l.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[l.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:u=>i({fullAuto:u.target.checked||void 0})}),l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]}),l.jsx(tr,{label:"Allowed dirs",help:"Extra writable roots beyond the base allow-list.",children:l.jsx(f0,{items:r.allowedDirs??[],placeholder:"/path/to/dir",onChange:u=>i({allowedDirs:u})})})]})}function dU({value:e,onChange:t}){const r=e.tools??{},i=s=>t({...e,tools:{...r,...s}});return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:l.jsx(f0,{items:r.allowed??[],placeholder:"ToolName",onChange:s=>i({allowed:s})})}),l.jsx(tr,{label:"Disallowed tools",children:l.jsx(f0,{items:r.disallowed??[],placeholder:"ToolName",onChange:s=>i({disallowed:s})})}),l.jsx(tr,{label:"MCP servers",help:"HTTP transport only.",children:l.jsx(fU,{rows:r.mcp??[],onChange:s=>i({mcp:s})})})]})}function hU({value:e,onChange:t}){const r=e.skills??[],[i,s]=v.useState(null);v.useEffect(()=>{be.listSkills().then(s).catch(g=>{s([]),xe.error(`Load skills failed: ${g.message}`)})},[]);const o=new Set(r.map(g=>g.name)),u=g=>{g.ref&&t({...e,skills:[...r,{...g.ref}]})},d=g=>t({...e,skills:r.filter(p=>p.name!==g)}),m=new Set((i??[]).map(g=>g.name)),h=r.map(g=>g.name).filter(g=>!m.has(g));return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(tr,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:i===null?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):i.length===0&&h.length===0?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):l.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[i.map(g=>l.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(g.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:!g.ref,checked:o.has(g.name),onChange:p=>p.target.checked?u(g):d(g.name)}),l.jsxs("span",{className:"grid",children:[l.jsxs("span",{className:"font-mono text-sm",children:[g.name,!g.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:g.description})]})]},g.name)),h.map(g=>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(g)}),l.jsxs("span",{className:"font-mono text-sm",children:[g," ",l.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},g))]})}),l.jsx("div",{children:l.jsx(LT,{onInstalled:s,triggerVariant:"outline"})})]})}function OT(e){const{skills:t,...r}=e,i=h0(r)??{};return Array.isArray(t)&&t.length>0&&(i.skills=t),i}function h0(e){if(Array.isArray(e)){const t=e.map(h0).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=h0(i);s!==void 0&&(t[r]=s)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function tr({label:e,help:t,children:r}){return l.jsxs("div",{className:"grid content-start gap-1.5",children:[l.jsx($r,{children:e}),r,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const bv="__default__";function Au({value:e,options:t,onChange:r,disabled:i,required:s}){return l.jsxs(Nm,{value:e??(s?t[0]:bv),disabled:i,onValueChange:o=>r(o===bv?void 0:o),children:[l.jsx(cd,{children:l.jsx(ld,{})}),l.jsxs(ud,{children:[!s&&l.jsx(Xn,{value:bv,children:l.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(o=>l.jsx(Xn,{value:o,children:o},o))]})]})}function nu({value:e,onChange:t}){return l.jsx(xt,{type:"number",value:e??"",onChange:r=>{const i=r.target.value;t(i===""?void 0:Number(i))}})}function f0({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(xt,{value:o,placeholder:t,onChange:d=>i(u,d.target.value)}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>s(u),children:l.jsx(Na,{})})]},u)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[l.jsx(Qi,{})," Add"]})]})}function fU({rows:e,onChange:t}){const r=v.useRef(0),[i,s]=v.useState(()=>e.map(()=>r.current++)),o=(m,h)=>t(e.map((g,p)=>p===m?{...g,...h}:g)),u=m=>{t(e.filter((h,g)=>g!==m)),s(i.filter((h,g)=>g!==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(xt,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:g=>o(h,{name:g.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(xt,{value:m.url??"",placeholder:"https://server/mcp",onChange:g=>o(h,{url:g.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:l.jsx(Na,{})})]}),l.jsx(mU,{headers:m.headers??{},onChange:g=>o(h,{headers:g})})]},i[h]??h)),l.jsxs(he,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[l.jsx(Qi,{})," Add MCP server"]})]})}function mU({headers:e,onChange:t}){const[r,i]=v.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function s(d){i(d);const m={};for(const{k:h,v:g}of d){const p=h.trim();p&&(m[p]=g)}t(Object.keys(m).length>0?m:void 0)}const o=(d,m)=>s(r.map((h,g)=>g===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(xt,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:h=>o(m,{k:h.target.value})}),l.jsx(xt,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:h=>o(m,{v:h.target.value})}),l.jsx(he,{variant:"ghost",size:"sm",onClick:()=>u(m),children:l.jsx(Na,{})})]},m)),l.jsxs(he,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>s([...r,{k:"",v:""}]),children:[l.jsx(Qi,{})," Add header"]})]})}function Vr({className:e,...t}){return l.jsx("div",{className:qe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function pi({className:e,...t}){return l.jsx("div",{className:qe("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function Zr({className:e,...t}){return l.jsx("h3",{className:qe("text-sm font-semibold tracking-tight",e),...t})}function Qr({className:e,...t}){return l.jsx("div",{className:qe("p-5",e),...t})}const wv=/^[a-z0-9][a-z0-9-]{0,63}$/,m0=[{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 pU({initial:e,onClose:t,onSaved:r}){const i=e.id==="",[s,o]=v.useState(e.id),[u,d]=v.useState(e.spec),[m,h]=v.useState("identity"),[g,p]=v.useState("form"),[y,b]=v.useState(()=>JSON.stringify(e.spec,null,2)),[w,C]=v.useState(!1);function E(N){if(N!==g)if(N==="json")b(JSON.stringify(u,null,2)),p("json");else try{d(JSON.parse(y)),p("form")}catch(k){xe.error(`Invalid JSON: ${k.message}`)}}async function S(){const N=s.trim();if(i&&!wv.test(N))return h("identity"),xe.error(N?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let k;if(g==="json")try{k=JSON.parse(y)}catch(R){return xe.error(`Invalid JSON: ${R.message}`)}else k=u;C(!0);try{await be.writeAgent({...OT(k),id:s.trim()}),xe.success(`Agent "${s}" saved`),await r()}catch(R){xe.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:qe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",g===N?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:N},N))})]}),g==="json"?l.jsx(wm,{value:y,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:m0.map(N=>l.jsx("button",{type:"button",onClick:()=>h(N.id),className:qe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===N.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:N.label},N.id))}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"mb-4",children:[l.jsx("h2",{className:"text-base font-semibold",children:YC(m).label}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:YC(m).blurb})]}),l.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs($r,{children:["Agent ID ",l.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),l.jsx(xt,{value:s,disabled:!i,onChange:N=>o(N.target.value),placeholder:"polly","aria-invalid":i&&s.trim()!==""&&!wv.test(s.trim())}),i&&s.trim()!==""&&!wv.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(lU,{value:u,onChange:d})]}),m==="model"&&l.jsx(cU,{value:u,onChange:d}),m==="environment"&&l.jsx(uU,{value:u,onChange:d}),m==="tools"&&l.jsx(dU,{value:u,onChange:d}),m==="skills"&&l.jsx(hU,{value:u,onChange:d}),m==="review"&&l.jsx(gU,{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 YC(e){return m0.find(t=>t.id===e)??m0[0]}function gU({id:e,spec:t}){var s,o,u,d,m,h;const r=OT(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",vU(t.skills)],["MCP servers",String(((h=(m=t.tools)==null?void 0:m.mcp)==null?void 0:h.filter(g=>{var p;return(p=g.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(([g,p])=>l.jsxs("div",{className:"contents",children:[l.jsx("dt",{className:"text-[var(--muted-foreground)]",children:g}),l.jsx("dd",{className:"font-medium",children:p})]},g))}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:"Resulting spec"}),l.jsx("pre",{className:"max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:JSON.stringify({id:e||void 0,...r},null,2)})]})]})}function vU(e){return e!=null&&e.length?`${e.length} declared`:"None"}const _U={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 xU({agents:e,onChange:t}){const[r,i]=v.useState(null);function s(){i({id:"",spec:structuredClone(_U)})}async function o(u){try{const d=await be.getAgent(u);delete d.id,i({id:u,spec:d})}catch(d){xe.error(`Load failed: ${d.message}`)}}return r?l.jsx(pU,{initial:r,onClose:()=>i(null),onSaved:async()=>{i(null),await t()}}):l.jsxs(Vr,{children:[l.jsxs(pi,{children:[l.jsxs(Zr,{children:["Agents ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:s,children:[l.jsx(Qi,{})," New agent"]})]}),l.jsx(Qr,{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(hB,{})," Edit"]}),l.jsx(yU,{id:u.id,onChange:t})]})})]},u.id))]})]})})]})}function yU({id:e,onChange:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete agent "',e,'"?']}),l.jsx(tn,{children:"Removes its config directory. Instances bound to it fall back to defaults."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:async()=>{try{await be.deleteAgent(e),xe.success(`Agent "${e}" deleted`),await t()}catch(r){xe.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}const bU=Pk("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 Et({className:e,variant:t,...r}){return l.jsx("span",{className:qe(bU({variant:t}),e),...r})}var Ml={},Sv,KC;function wU(){return KC||(KC=1,Sv=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Sv}var Cv={},ma={},XC;function $o(){if(XC)return ma;XC=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 Ev={},ZC;function Ny(){return ZC||(ZC=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}}})(Ev)),Ev}var Rv,QC;function SU(){if(QC)return Rv;QC=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++}},Rv=e,Rv}var kv,JC;function CU(){if(JC)return kv;JC=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]},kv=e,kv}var Nv={},e2;function EU(){return e2||(e2=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}})(Nv)),Nv}var Av={},t2;function RU(){if(t2)return Av;t2=1;const e=$o().getSymbolSize,t=7;return Av.getPositions=function(i){const s=e(i);return[[0,0],[s-t,0],[0,s-t]]},Av}var Tv={},r2;function kU(){return r2||(r2=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,g=null;for(let p=0;p<o;p++){d=m=0,h=g=null;for(let y=0;y<o;y++){let b=s.get(p,y);b===h?d++:(d>=5&&(u+=t.N1+(d-5)),h=b,d=1),b=s.get(y,p),b===g?m++:(m>=5&&(u+=t.N1+(m-5)),g=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 g=0;g<o;g++)d=d<<1&2047|s.get(h,g),g>=10&&(d===1488||d===93)&&u++,m=m<<1&2047|s.get(g,h),g>=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 g=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(h,s),g<m&&(m=g,d=h)}return d}})(Tv)),Tv}var Uh={},i2;function BT(){if(i2)return Uh;i2=1;const e=Ny(),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 Uh.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}},Uh.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}},Uh}var Mv={},su={},n2;function NU(){if(n2)return su;n2=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]})(),su.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},su.exp=function(i){return e[i]},su.mul=function(i,s){return i===0||s===0?0:e[t[i]+t[s]]},su}var s2;function AU(){return s2||(s2=1,(function(e){const t=NU();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}})(Mv)),Mv}var jv,a2;function TU(){if(a2)return jv;a2=1;const e=AU();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},jv=t,jv}var Dv={},Lv={},Ov={},o2;function PT(){return o2||(o2=1,Ov.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Ov}var In={},l2;function IT(){if(l2)return In;l2=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
|
|
529
|
+
]))+`;In.KANJI=new RegExp(r,"g"),In.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),In.BYTE=new RegExp(i,"g"),In.NUMERIC=new RegExp(e,"g"),In.ALPHANUMERIC=new RegExp(t,"g");const s=new RegExp("^"+r+"$"),o=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return In.testKanji=function(m){return s.test(m)},In.testNumeric=function(m){return o.test(m)},In.testAlphanumeric=function(m){return u.test(m)},In}var c2;function Uo(){return c2||(c2=1,(function(e){const t=PT(),r=IT();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}}})(Lv)),Lv}var u2;function MU(){return u2||(u2=1,(function(e){const t=$o(),r=BT(),i=Ny(),s=Uo(),o=PT(),u=7973,d=t.getBCHDigit(u);function m(y,b,w){for(let C=1;C<=40;C++)if(b<=e.getCapacity(C,w,y))return C}function h(y,b){return s.getCharCountIndicator(y,b)+4}function g(y,b){let w=0;return y.forEach(function(C){const E=h(C.mode,b);w+=E+C.getBitsLength()}),w}function p(y,b){for(let w=1;w<=40;w++)if(g(y,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}})(Dv)),Dv}var Bv={},d2;function jU(){if(d2)return Bv;d2=1;const e=$o(),t=1335,r=21522,i=e.getBCHDigit(t);return Bv.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},Bv}var Pv={},Iv,h2;function DU(){if(h2)return Iv;h2=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))},Iv=t,Iv}var zv,f2;function LU(){if(f2)return zv;f2=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)},zv=r,zv}var $v,m2;function OU(){if(m2)return $v;m2=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)},$v=t,$v}var Uv,p2;function BU(){if(p2)return Uv;p2=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]+`
|
|
530
|
+
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},Uv=r,Uv}var Hv={exports:{}},g2;function PU(){return g2||(g2=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,g,p,y,b,w,C,E;!d.empty();){m=d.pop(),h=m.value,p=m.cost,y=r[h]||{};for(g in y)y.hasOwnProperty(g)&&(b=y[g],w=p+b,C=u[g],E=typeof u[g]>"u",(E||C>w)&&(u[g]=w,d.push(g,w),o[g]=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})(Hv)),Hv.exports}var v2;function IU(){return v2||(v2=1,(function(e){const t=Uo(),r=DU(),i=LU(),s=OU(),o=BU(),u=IT(),d=$o(),m=PU();function h(S){return unescape(encodeURIComponent(S)).length}function g(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=g(u.NUMERIC,t.NUMERIC,S),k=g(u.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,M;return d.isKanjiModeEnabled()?(R=g(u.BYTE,t.BYTE,S),M=g(u.KANJI,t.KANJI,S)):(R=g(u.BYTE_KANJI,t.BYTE,S),M=[]),N.concat(k,R,M).sort(function(z,D){return z.index-D.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function y(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 z=S[L],D=[];for(let W=0;W<z.length;W++){const G=z[W],q=""+L+W;D.push(q),k[q]={node:G,lastCount:0},R[q]={};for(let B=0;B<M.length;B++){const j=M[B];k[j]&&k[j].node.mode===G.mode?(R[j][q]=y(k[j].lastCount+G.length,G.mode)-y(k[j].lastCount,G.mode),k[j].lastCount+=G.length):(k[j]&&(k[j].lastCount=G.length),R[j][q]=y(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)+`.
|
|
531
|
+
Suggested mode is: `+t.toString(R));switch(k===t.KANJI&&!d.isKanjiModeEnabled()&&(k=t.BYTE),k){case t.NUMERIC:return new r(S);case t.ALPHANUMERIC:return new i(S);case t.KANJI:return new o(S);case t.BYTE:return new s(S)}}e.fromArray=function(N){return N.reduce(function(k,R){return typeof R=="string"?k.push(E(R,null)):R.data&&k.push(E(R.data,R.mode)),k},[])},e.fromString=function(N,k){const R=p(N,d.isKanjiModeEnabled()),M=w(R),L=C(M,k),z=m.find_path(L.map,"start","end"),D=[];for(let W=1;W<z.length-1;W++)D.push(L.table[z[W]].node);return e.fromArray(b(D))},e.rawSplit=function(N){return e.fromArray(p(N,d.isKanjiModeEnabled()))}})(Pv)),Pv}var _2;function zU(){if(_2)return Cv;_2=1;const e=$o(),t=Ny(),r=SU(),i=CU(),s=EU(),o=RU(),u=kU(),d=BT(),m=TU(),h=MU(),g=jU(),p=Uo(),y=IU();function b(L,z){const D=L.size,W=o.getPositions(z);for(let G=0;G<W.length;G++){const q=W[G][0],B=W[G][1];for(let j=-1;j<=7;j++)if(!(q+j<=-1||D<=q+j))for(let O=-1;O<=7;O++)B+O<=-1||D<=B+O||(j>=0&&j<=6&&(O===0||O===6)||O>=0&&O<=6&&(j===0||j===6)||j>=2&&j<=4&&O>=2&&O<=4?L.set(q+j,B+O,!0,!0):L.set(q+j,B+O,!1,!0))}}function w(L){const z=L.size;for(let D=8;D<z-8;D++){const W=D%2===0;L.set(D,6,W,!0),L.set(6,D,W,!0)}}function C(L,z){const D=s.getPositions(z);for(let W=0;W<D.length;W++){const G=D[W][0],q=D[W][1];for(let B=-2;B<=2;B++)for(let j=-2;j<=2;j++)B===-2||B===2||j===-2||j===2||B===0&&j===0?L.set(G+B,q+j,!0,!0):L.set(G+B,q+j,!1,!0)}}function E(L,z){const D=L.size,W=h.getEncodedBits(z);let G,q,B;for(let j=0;j<18;j++)G=Math.floor(j/3),q=j%3+D-8-3,B=(W>>j&1)===1,L.set(G,q,B,!0),L.set(q,G,B,!0)}function S(L,z,D){const W=L.size,G=g.getEncodedBits(z,D);let q,B;for(q=0;q<15;q++)B=(G>>q&1)===1,q<6?L.set(q,8,B,!0):q<8?L.set(q+1,8,B,!0):L.set(W-15+q,8,B,!0),q<8?L.set(8,W-q-1,B,!0):q<9?L.set(8,15-q-1+1,B,!0):L.set(8,15-q-1,B,!0);L.set(W-8,8,1,!0)}function N(L,z){const D=L.size;let W=-1,G=D-1,q=7,B=0;for(let j=D-1;j>0;j-=2)for(j===6&&j--;;){for(let O=0;O<2;O++)if(!L.isReserved(G,j-O)){let $=!1;B<z.length&&($=(z[B]>>>q&1)===1),L.set(G,j-O,$),q--,q===-1&&(B++,q=7)}if(G+=W,G<0||D<=G){G-=W,W=-W;break}}}function k(L,z,D){const W=new r;D.forEach(function(O){W.put(O.mode.bit,4),W.put(O.getLength(),p.getCharCountIndicator(O.mode,L)),O.write(W)});const G=e.getSymbolTotalCodewords(L),q=d.getTotalCodewordsCount(L,z),B=(G-q)*8;for(W.getLengthInBits()+4<=B&&W.put(0,4);W.getLengthInBits()%8!==0;)W.putBit(0);const j=(B-W.getLengthInBits())/8;for(let O=0;O<j;O++)W.put(O%2?17:236,8);return R(W,L,z)}function R(L,z,D){const W=e.getSymbolTotalCodewords(z),G=d.getTotalCodewordsCount(z,D),q=W-G,B=d.getBlocksCount(z,D),j=W%B,O=B-j,$=Math.floor(W/B),T=Math.floor(q/B),U=T+1,H=$-T,F=new m(H);let V=0;const I=new Array(B),Y=new Array(B);let X=0;const ee=new Uint8Array(L.buffer);for(let ne=0;ne<B;ne++){const we=ne<O?T:U;I[ne]=ee.slice(V,V+we),Y[ne]=F.encode(I[ne]),V+=we,X=Math.max(X,we)}const re=new Uint8Array(W);let oe=0,Z,ce;for(Z=0;Z<X;Z++)for(ce=0;ce<B;ce++)Z<I[ce].length&&(re[oe++]=I[ce][Z]);for(Z=0;Z<H;Z++)for(ce=0;ce<B;ce++)re[oe++]=Y[ce][Z];return re}function M(L,z,D,W){let G;if(Array.isArray(L))G=y.fromArray(L);else if(typeof L=="string"){let $=z;if(!$){const T=y.rawSplit(L);$=h.getBestVersionForData(T,D)}G=y.fromString(L,$||40)}else throw new Error("Invalid data");const q=h.getBestVersionForData(G,D);if(!q)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=q;else if(z<q)throw new Error(`
|
|
532
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
533
|
+
Minimum version required to store current data is: `+q+`.
|
|
534
|
+
`);const B=k(z,D,G),j=e.getSymbolSize(z),O=new i(j);return b(O,z),w(O),C(O,z),S(O,D,0),z>=7&&E(O,z),N(O,B),isNaN(W)&&(W=u.getBestMask(O,S.bind(null,O,D))),u.applyMask(W,O),S(O,D,W),{modules:O,version:z,errorCorrectionLevel:D,maskPattern:W,segments:G}}return Cv.create=function(z,D){if(typeof z>"u"||z==="")throw new Error("No input text");let W=t.M,G,q;return typeof D<"u"&&(W=t.from(D.errorCorrectionLevel,t.M),G=h.from(D.version),q=u.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),M(z,G,W,q)},Cv}var Fv={},Wv={},x2;function zT(){return x2||(x2=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),g=o.margin*m,p=[o.color.light,o.color.dark];for(let y=0;y<h;y++)for(let b=0;b<h;b++){let w=(y*h+b)*4,C=o.color.light;if(y>=g&&b>=g&&y<h-g&&b<h-g){const E=Math.floor((y-g)/m),S=Math.floor((b-g)/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}}})(Wv)),Wv}var y2;function $U(){return y2||(y2=1,(function(e){const t=zT();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 g=t.getImageWidth(o.modules.size,m),p=h.getContext("2d"),y=p.createImageData(g,g);return t.qrToImageData(y.data,o,m),r(p,h,g),p.putImageData(y,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),g=m.type||"image/png",p=m.rendererOpts||{};return h.toDataURL(g,p.quality)}})(Fv)),Fv}var qv={},b2;function UU(){if(b2)return qv;b2=1;const e=zT();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,g=0;for(let p=0;p<s.length;p++){const y=Math.floor(p%o),b=Math.floor(p/o);!y&&!h&&(h=!0),s[p]?(g++,p>0&&y>0&&s[p-1]||(d+=h?r("M",y+u,.5+b+u):r("m",m,0),m=0,h=!1),y+1<o&&s[p+1]||(d+=r("h",g),g=0)):m++}return d}return qv.render=function(o,u,d){const m=e.getOptions(u),h=o.modules.size,g=o.modules.data,p=h+m.margin*2,y=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(g,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">'+y+b+`</svg>
|
|
535
|
+
`;return typeof d=="function"&&d(null,E),E},qv}var w2;function HU(){if(w2)return Ml;w2=1;const e=wU(),t=zU(),r=$U(),i=UU();function s(o,u,d,m,h){const g=[].slice.call(arguments,1),p=g.length,y=typeof g[p-1]=="function";if(!y&&!e())throw new Error("Callback required as last argument");if(y){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 FU=HU();const WU=mx(FU);function S2({lines:e}){const t=v.useRef(null);return v.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 $T({channelId:e,onDone:t,onCancel:r}){const[i,s]=v.useState("running"),[o,u]=v.useState(),[d,m]=v.useState(),[h,g]=v.useState([]),[p,y]=v.useState();return v.useEffect(()=>{const b=new AbortController;let w=!1;const C=E=>{switch(E.event){case"qr":{const S=String(E.data.url??"");m(S),WU.toDataURL(S,{margin:1,width:224}).then(u).catch(()=>{});break}case"link":m(String(E.data.url??""));break;case"status":g(S=>[...S,String(E.data.text??"")]);break;case"done":w=!0,s("done"),t();break;case"error":w=!0,s("error"),y(String(E.data.message??"authorization failed"));break;default:E.data.url?m(String(E.data.url)):g(S=>[...S,JSON.stringify(E.data)])}};return be.authorizeChannel(e,C,b.signal).then(()=>{w||(s("error"),y("connection closed before completion"))}).catch(E=>{b.signal.aborted||w||(s("error"),y(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(S2,{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(S2,{lines:h}),l.jsx(he,{variant:"outline",size:"sm",onClick:r,children:"Cancel"})]})}function qU(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 VU({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(GU,{label:s.label,help:s.help,required:s.required,children:s.type==="boolean"?l.jsx("input",{type:"checkbox",className:"size-4",checked:!!(t[s.key]??s.default??!1),onChange:o=>i(s.key,o.target.checked)}):s.type==="select"?l.jsx(Ma,{className:"w-full",value:String(t[s.key]??s.default??""),onChange:o=>i(s.key,o.target.value),children:(s.options??[]).map(o=>l.jsx("option",{value:o.value,children:o.label},o.value))}):l.jsx(xt,{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 GU({label:e,help:t,required:r,children:i}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsxs($r,{children:[e,r&&l.jsx("span",{className:"ml-0.5 text-[var(--destructive)]",children:"*"})]}),i,t&&l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}function YU(e){return!!(e.options&&Object.keys(e.options).length>0)}function KU({channels:e,channelTypes:t,onChange:r}){const[i,s]=v.useState(!1),[o,u]=v.useState(null),d=v.useMemo(()=>new Map(t.map(h=>[h.type,h])),[t]);async function m(h,g){try{await g(),xe.success(h),await r()}catch(p){xe.error(`${h} failed: ${p.message}`)}}return l.jsxs(Vr,{children:[l.jsxs(pi,{children:[l.jsxs(Zr,{children:["Channels ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs(he,{size:"sm",onClick:()=>s(!0),disabled:t.length===0,children:[l.jsx(Qi,{})," Add channel"]})]}),l.jsx(Qr,{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 g;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:YU(h)?l.jsx(Et,{variant:"success",children:"● set"}):l.jsx(Et,{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:[((g=d.get(h.type))==null?void 0:g.authorize)&&l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>u(h),children:[l.jsx(AR,{})," Authorize"]}),l.jsx(XU,{name:h.name,onDeleted:()=>m("Deleted",()=>be.deleteChannel(h.id))})]})})]},h.id)})]})]})}),i&&l.jsx(ZU,{channelTypes:t,onClose:()=>s(!1),onAdded:async()=>{s(!1),await r()}}),o&&l.jsx(Oo,{open:!0,onOpenChange:h=>!h&&u(null),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsxs(Ua,{children:['Authorize "',o.name,'"']})}),l.jsx($T,{channelId:o.id,onDone:()=>{xe.success("Authorized"),u(null),r()},onCancel:()=>u(null)})]})})]})}function XU({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete channel "',e,'"?']}),l.jsx(tn,{children:"This removes its credentials and any instance bound to it (which is stopped first)."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function ZU({channelTypes:e,onClose:t,onAdded:r}){var N;const[i,s]=v.useState(""),[o,u]=v.useState(((N=e[0])==null?void 0:N.type)??""),[d,m]=v.useState("manual"),[h,g]=v.useState({}),[p,y]=v.useState(null),b=v.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),g({});const R=e.find(M=>M.type===k);m(R!=null&&R.authorize?"authorize":"manual")}async function S(){if(!i.trim())return xe.error("Channel name is required");if(!o)return xe.error("Pick a channel type");try{if(d==="authorize"){const{id:k}=await be.createChannel({name:i.trim(),type:o});y(k)}else await be.createChannel({name:i.trim(),type:o,options:qU(w,h)}),xe.success(`Channel "${i}" created`),await r()}catch(k){xe.error(`Create failed: ${k.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:k=>!k&&t(),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsx(Ua,{children:"Add channel"})}),p?l.jsx($T,{channelId:p,onDone:async()=>{xe.success(`Channel "${i}" authorized`),await r()},onCancel:()=>void r()}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsx(Vv,{label:"Channel name",children:l.jsx(xt,{value:i,onChange:k=>s(k.target.value),placeholder:"lark-prod"})}),l.jsx(Vv,{label:"Type",children:l.jsx(Ma,{value:o,onChange:k=>E(k.target.value),className:"w-full",children:e.map(k=>l.jsx("option",{value:k.type,children:k.type},k.type))})}),C&&l.jsx(Vv,{label:"Setup",children:l.jsxs(Ma,{value:d,onChange:k=>m(k.target.value),className:"w-full",children:[l.jsx("option",{value:"authorize",children:"Scan / authorize"}),l.jsx("option",{value:"manual",children:"Enter credentials manually"})]})}),d==="manual"&&w.length>0&&l.jsx(VU,{schema:w,values:h,onChange:g})]}),l.jsxs(ed,{children:[l.jsx(Ju,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:S,children:d==="authorize"?"Create & authorize":"Create"})]})]})]})})}function Vv({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:e}),t]})}async function UT(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 C2="127.0.0.1:9333";function QU(){const e=hd(),t=v.useRef(null),[r,i]=v.useState(null),[s,o]=v.useState(null),[u,d]=v.useState("load"),m=v.useCallback(async()=>{if(!e){d(null),o("Chrome inspection is available only in the Rynx app.");return}d("load"),o(null);try{i(await e.getChromeInspectionStatus())}catch(b){o(b.message)}finally{d(null)}},[e]);v.useEffect(()=>{m()},[m]);async function h(b){if(e){d("save"),o(null);try{i(await e.configureChromeInspection(b))}catch(w){const C=w.message;o(C),xe.error(`Could not update Chrome inspection: ${C}`)}finally{d(null)}}}async function g(){const b=await UT(C2,t.current);b==="clipboard"||b==="selection"?xe.success("Address copied"):b==="selected"?xe.info("Address selected — copy it manually"):xe.error("Copy is unavailable")}const p=r==null?void 0:r.settings,y=u!==null;return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Chrome inspection"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Inspect Rynx-managed browser pages with Chrome DevTools."})]}),l.jsxs(Vr,{"aria-busy":u!==null,children:[l.jsxs(pi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Zr,{children:"DevTools discovery"}),r&&l.jsx(JU,{status:r})]}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Chrome connects to one local address and discovers the browsers you choose."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:y,onClick:()=>void m(),children:[l.jsx(Nt,{className:u==="load"?"animate-spin":""}),"Check"]})]}),l.jsxs(Qr,{className:"grid gap-5",children:[r&&p?l.jsxs(l.Fragment,{children:[l.jsx(eH,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:l.jsx(uT,{"aria-label":"Enable Chrome inspection",checked:p.enabled,disabled:y,onCheckedChange:b=>void h({...p,enabled:b})})}),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(E2,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:p.includeLocal,disabled:y||!p.enabled,onChange:b=>void h({...p,includeLocal:b})}),r.remotes.map(b=>l.jsx(E2,{title:b.displayName,detail:rH(b.status),badge:b.status,checked:p.remoteDaemonIds.includes(b.daemonId),disabled:y||!p.enabled||b.status==="incompatible",onChange:w=>void h({...p,remoteDaemonIds:w?[...p.remoteDaemonIds,b.daemonId]:p.remoteDaemonIds.filter(C=>C!==b.daemonId)})},b.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(xt,{ref:t,value:C2,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),l.jsxs(he,{variant:"outline",onClick:()=>void g(),"aria-label":"Copy Chrome inspection address",children:[l.jsx(kR,{}),"Copy"]})]})]}),r.runtime.state==="error"&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] p-3 text-xs text-[var(--warning)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0"}),l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:"Chrome inspection could not start"}),l.jsx("div",{className:"mt-0.5 text-[var(--foreground)]",children:r.runtime.error})]})]}),l.jsxs("div",{role:"note",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_30%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_6%,var(--background))] p-3 text-xs leading-5",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0 text-[var(--destructive)]"}),l.jsx("span",{children:"Any process on this device can use this address to fully control every browser exposed here. Enable it only while you need DevTools."})]})]}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[u==="load"&&l.jsx(Qe,{className:"size-4 animate-spin"}),u==="load"?"Loading Chrome inspection…":"Chrome inspection settings are unavailable."]}),s&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:s})]})]})]})]})}function JU({status:e}){return e.runtime.state==="listening"?l.jsxs(Et,{variant:"success",children:[l.jsx(Ba,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?l.jsx(Et,{variant:"warning",children:"Needs attention"}):l.jsx(Et,{variant:"outline",children:"Off"})}function eH({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 E2({title:e,detail:t,badge:r,checked:i,disabled:s,onChange:o}){return l.jsxs("label",{className:qe("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",s&&"opacity-55"),children:[l.jsx("input",{type:"checkbox",checked:i,disabled:s,onChange:u=>o(u.target.checked),className:"size-4 accent-[var(--primary)]"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e,r&&l.jsx(Et,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:tH(r)})]}),l.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function tH(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function rH(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function iH(){const e=hd(),[t,r]=v.useState(null),[i,s]=v.useState(null),[o,u]=v.useState("refresh"),d=v.useCallback(async()=>{if(e){u("refresh"),s(null);try{r(await e.getStatus())}catch(h){s(h.message)}finally{u(null)}}},[e]);v.useEffect(()=>{d()},[d]);async function m(h){if(e){u("permission"),s(null);try{await e.openSystemSettings(h),xe.message("After granting access, return to Rynx and click Check again.")}catch(g){const p=g.message;s(p),xe.error(`Could not open System Settings: ${p}`)}finally{u(null)}}}return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer integration"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Review the macOS permissions for the separate Computer Use integration. Browser and Emulator automation stay in the bundled rynx-cli Skill."})]}),l.jsxs(Vr,{"aria-busy":o!==null,children:[l.jsxs(pi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Zr,{children:"macOS permissions"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This page checks readiness only. Permissions remain under your control in System Settings."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void d(),children:[l.jsx(Nt,{className:o==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(Qr,{className:"grid gap-3",children:[t?l.jsxs(l.Fragment,{children:[l.jsx(R2,{icon:l.jsx(xB,{className:"size-4"}),ready:t.permissions.accessibility==="granted",title:"Accessibility",description:k2(t.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:t.permissions.accessibility!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void m("accessibility"),children:[l.jsx(tC,{}),"Open Settings"]}):void 0}),l.jsx(R2,{icon:l.jsx(VO,{className:"size-4"}),ready:t.permissions.screenRecording==="granted",title:"Screen Recording",description:k2(t.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:t.permissions.screenRecording!=="granted"?l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void m("screen-recording"),children:[l.jsx(tC,{}),"Open Settings"]}):void 0})]}):l.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o==="refresh"&&l.jsx(Qe,{className:"size-4 animate-spin"}),o==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(Zu,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function R2({icon:e,ready:t,title:r,description:i,action:s}){return l.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[l.jsx("span",{className:t?"grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:t?l.jsx(Ba,{className:"size-4"}):e}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h2",{className:"text-sm font-medium",children:r}),l.jsx(Et,{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 k2(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 nH(){const e=hd(),[t,r]=v.useState(null),[i,s]=v.useState(null),[o,u]=v.useState(!1),d=v.useCallback(async()=>{if(e){u(!0),s(null);try{r(await e.getStatus())}catch(g){s(g.message)}finally{u(!1)}}},[e]);v.useEffect(()=>{d()},[d]);async function m(g){if(!(!e||g===(t==null?void 0:t.runtime.lifecycleMode))){u(!0),s(null);try{r(await e.setDaemonLifecycleMode(g)),xe.success(g==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(p){const y=p.message;s(y),xe.error(`Could not change Runtime mode: ${y}`)}finally{u(!1)}}}async function h(){if(e){u(!0),s(null);try{r(await e.restartDaemon()),xe.success("Local Runtime restarted")}catch(g){const p=g.message;s(p),xe.error(`Could not restart Runtime: ${p}`)}finally{u(!1)}}}return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Daemon"}),l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Choose whether the local Runtime follows the Desktop app or stays available in the background."})]}),l.jsxs(Vr,{"aria-busy":o,children:[l.jsxs(pi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Zr,{children:"Local Runtime"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This setting applies to the Runtime bundled with Rynx."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(he,{variant:"outline",size:"sm",disabled:o,onClick:()=>void d(),children:[l.jsx(Nt,{className:o?"animate-spin":""}),"Check"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o,onClick:()=>void h(),children:[l.jsx(Nt,{}),"Restart"]})]})]}),l.jsxs(Qr,{className:"grid gap-5",children:[t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[l.jsx("span",{className:t.runtime.ready?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:l.jsx(Qu,{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(Et,{variant:t.runtime.ready?"success":"warning",children:sH(t.runtime.state)}),l.jsx(Et,{variant:"outline",children:t.runtime.managedBy==="app"?"Managed by app":t.runtime.managedBy==="external"?"External":"Not managed"})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:t.runtime.detail??aH(t)})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx($r,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),l.jsxs(Ma,{id:"daemon-lifecycle-mode",value:t.runtime.lifecycleMode,disabled:o,className:"max-w-sm",onChange:g=>void m(g.target.value),children:[l.jsx("option",{value:"follow-app",children:"Follow Rynx app"}),l.jsx("option",{value:"resident",children:"Stay available in background"})]}),l.jsx("p",{className:"max-w-2xl text-xs leading-5 text-[var(--muted-foreground)]",children:t.runtime.lifecycleMode==="follow-app"?"The Runtime and its embedded Browser Host start with Rynx and stop when the app fully quits. Closing a window does not quit the app.":"The Runtime and its embedded Browser Host keep running when the app quits, so Terminals, agents, and Session browsers remain available."})]})]}):l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o&&l.jsx(Qe,{className:"size-4 animate-spin"}),o?"Checking Runtime…":"Runtime status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(Zu,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function sH(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function aH(e){const t=[e.runtime.version?`Version ${e.runtime.version}`:null,e.runtime.pid?`PID ${e.runtime.pid}`:null].filter(Boolean);return t.length>0?t.join(" · "):"No additional Runtime details."}const oH=700,lH=250,N2=33333,df=new Uint8Array([0,0,0,1]);function cH(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Gv(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 A2(e,t){const r=cH(e,t),i=Gv(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=Gv(r,u);for(;d;)d.index>u&&s.push(r.slice(u,d.index)),o=d.index,u=d.index+d.length,d=Gv(r,u);return{nals:s,pending:r.slice(o)}}function Mm(e){return e[0]&31}function uH(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 dH(e){const t=e.reduce((s,o)=>s+df.length+o.length,0),r=new Uint8Array(t);let i=0;for(const s of e)r.set(df,i),i+=df.length,r.set(s,i),i+=s.length;return r}function T2(e){const t=Mm(e);return t===1||t===5}function hH(e){return e.some(t=>Mm(t)===5)}function Yv(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 fH(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 M2(e){return e instanceof Error?e.message:String(e)}function mH(e){return e instanceof DOMException&&e.name==="AbortError"}function pH({device:e,alt:t,mediaRef:r,onFrameSize:i}){const s=v.useRef(null),o=v.useRef(!1),u=v.useRef(!1),d=v.useRef(null),[m,h]=v.useState("video"),[g,p]=v.useState(!1),[y,b]=v.useState("Loading preview..."),w=v.useCallback(S=>{s.current=S,r==null||r(S)},[r]),C=v.useCallback(()=>{o.current||(o.current=!0,p(!0),b(""))},[]),E=v.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 v.useEffect(()=>{o.current=!1,u.current=!1,d.current=null,p(!1),b("Loading preview..."),h("video")},[e]),v.useEffect(()=>{if(m!=="video"||o.current)return;let S=!1;return(async()=>{try{const k=await be.emulatorFrameBlob(e);if(S||o.current)return;const R=await createImageBitmap(k);try{const M=s.current;M&&!o.current&&(Yv(M,R,R.width,R.height),E(R.width,R.height),C())}finally{R.close()}}catch{}})(),()=>{S=!0}},[e,C,m,E]),v.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,z=R.displayHeight||R.codedHeight;Yv(M,R,L,z),E(L,z),u.current=!0,C()}}finally{R.close()}};return(async()=>{for(;!S.signal.aborted;){let R=null,M=null,L=new Uint8Array,z=[],D=!1,W=0,G="avc1.42E01F";const q=async()=>{if(R)return R;const O={codec:G,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(O)).supported)throw new Error(`Unsupported Android video codec: ${G}`);return R=new VideoDecoder({output:N,error:T=>{b(T.message)}}),R.configure(O),R},B=async()=>{if(!D){z=[];return}const O=await q(),$=hH(z),T=dH(z),U=W;W+=N2,z=[],D=!1,!(O.decodeQueueSize>2&&!$)&&O.decode(new EncodedVideoChunk({type:$?"key":"delta",timestamp:U,duration:N2,data:T}))},j=async O=>{const $=uH(O);$&&(G=$),(Mm(O)===9||T2(O))&&D&&await B(),z.push(O),T2(O)&&(D=!0)};try{const O=await fetch(be.emulatorVideoStreamUrl(e),{cache:"no-store",signal:S.signal});if(!O.ok||!O.body)throw new Error(`Android video stream failed: ${O.status}`);for(M=O.body.getReader();;){const{done:T,value:U}=await M.read();if(T)break;const H=A2(L,U);L=H.pending;for(const F of H.nals)await j(F)}const $=A2(L,df);for(const T of $.nals)await j(T);await B(),(R==null?void 0:R.state)==="configured"&&await R.flush()}catch(O){if(S.signal.aborted||mH(O))break;if(b(M2(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 fH(lH,S.signal).catch(()=>{})}})(),()=>{S.abort()}},[e,C,m,E]),v.useEffect(()=>{if(m!=="fallback")return;let S=!1,N;const k=async()=>{try{const R=await be.emulatorFrameBlob(e);if(S)return;const M=await createImageBitmap(R);try{const L=s.current;L&&(Yv(L,M,M.width,M.height),E(M.width,M.height),C())}finally{M.close()}}catch(R){S||b(M2(R))}finally{S||(N=window.setTimeout(k,oH))}};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"}),!g&&l.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:y})]})}const j2=8,gH=.012,vH=1500,_H=35,xH=260,yH=40,bH=3,wH=5e3,SH=750;function D2(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function L2(e,t,r){return Math.max(t,Math.min(r,e))}function O2(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function CH(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 Kv(e,t,r){if(!e)return null;const i=CH(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:L2(s,0,1),y:L2(o,0,1)}}function EH(e){return new Promise(t=>setTimeout(t,e))}function RH(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=bH,r.set(t,1),r.buffer}function kH(){const[e,t]=v.useState([]),[r,i]=v.useState(null),[s,o]=v.useState(!0),[u,d]=v.useState(null),[m,h]=v.useState(null),[g,p]=v.useState(!1),[y,b]=v.useState(null),[w,C]=v.useState(null),[E,S]=v.useState(!1),[N,k]=v.useState(0),R=v.useRef(null),M=v.useRef(null),L=v.useRef(null),z=v.useRef(null),D=v.useRef(null),W=v.useRef(null),G=v.useCallback(async()=>{o(!0);try{const[J,ie]=await Promise.all([be.emulatorDevices(),be.activeEmulator()]);t(J),i(ie)}catch(J){xe.error(`Failed to load emulator: ${J.message}`)}finally{o(!1)}},[]);v.useEffect(()=>{G()},[G]),v.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current),M.current!==null&&window.clearTimeout(M.current)},[]),v.useEffect(()=>()=>{var ie;const J=(ie=z.current)==null?void 0:ie.socket;z.current=null,J&&J.readyState!==WebSocket.CLOSED&&J.close()},[r==null?void 0:r.wsUrl]),v.useEffect(()=>{var J;if((r==null?void 0:r.backend)!=="android"){const ie=(J=D.current)==null?void 0:J.socket;D.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close();return}return re(r.deviceUdid).catch(()=>{}),()=>{var Ee;const ie=(Ee=D.current)==null?void 0:Ee.socket;D.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const q=(r==null?void 0:r.streamUrl)??null,B=q&&N>0?`${q}${q.includes("?")?"&":"?"}rynx_preview_retry=${N}`:q,j=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,O=!!(q||j),$=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},T=v.useCallback((J,ie)=>{if(!Number.isFinite(J)||!Number.isFinite(ie)||J<=0||ie<=0)return;const Ee=J/ie;C(ve=>ve!==null&&Math.abs(ve-Ee)<1e-4?ve:Ee)},[]),U=v.useCallback(()=>{M.current!==null&&(window.clearTimeout(M.current),M.current=null)},[]),H=v.useCallback((J,ie)=>{U(),T(J,ie),S(!0)},[U,T]),F=v.useCallback(()=>{S(!1),M.current===null&&(M.current=window.setTimeout(()=>{M.current=null,k(J=>J+1)},SH))},[]);v.useEffect(()=>{if(U(),C(null),S(!1),k(0),!q)return;const J=()=>{const Ee=R.current;Ee instanceof HTMLImageElement&&Ee.naturalWidth>0&&Ee.naturalHeight>0&&H(Ee.naturalWidth,Ee.naturalHeight)};J();const ie=window.setInterval(J,500);return()=>window.clearInterval(ie)},[U,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,H,q]),v.useEffect(()=>{if(!q||E)return;const J=window.setTimeout(F,wH);return()=>window.clearTimeout(J)},[N,E,q,F]);async function V(J){if(r){b("home");try{await be.buttonEmulator(J,r.deviceUdid)}catch(ie){xe.error(`${J==="appswitch"?"App switcher":"Home"} failed: ${ie.message}`)}finally{b(null)}}}function I(){if(!(!r||y)){if(L.current!==null){window.clearTimeout(L.current),L.current=null,V("appswitch");return}L.current=window.setTimeout(()=>{L.current=null,V("home")},xH)}}async function Y(J,ie){const Ee=(r==null?void 0:r.deviceUdid)===J;L.current!==null&&(window.clearTimeout(L.current),L.current=null),h(J),Ee&&b("shutdown");try{await be.shutdownEmulator(J),Ee&&i(null),xe.success(`Shutdown ${ie}`),G()}catch(ve){xe.error(`Shutdown failed: ${ve.message}`)}finally{h(null),Ee&&b(null)}}async function X(J){d(J.id);try{const ie=await be.attachEmulator(J.id);i(ie),xe.success(`Attached ${ie.deviceName??ie.deviceUdid}`),G()}catch(ie){xe.error(`Attach failed: ${ie.message}`)}finally{d(null)}}function ee(J){var Ae;const ie=z.current;if((ie==null?void 0:ie.url)===J){if(((Ae=ie.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const Ee={url:J,socket:null,connecting:null},ve=new Promise((Ie,Oe)=>{const ze=new WebSocket(J),rt=window.setTimeout(()=>{ze.close(),Oe(new Error("Timed out connecting to emulator gesture stream."))},1500),Be=()=>window.clearTimeout(rt);ze.binaryType="arraybuffer",ze.addEventListener("open",()=>{Be(),Ee.socket=ze,Ee.connecting=null,Ie(ze)},{once:!0}),ze.addEventListener("error",()=>{Be(),Ee.connecting=null,Oe(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),ze.addEventListener("close",()=>{var dt;((dt=z.current)==null?void 0:dt.socket)===ze&&(z.current=null)})});return Ee.connecting=ve,z.current=Ee,ve}function re(J){var Ae;const ie=D.current;if((ie==null?void 0:ie.device)===J){if(((Ae=ie.socket)==null?void 0:Ae.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const Ee={device:J,socket:null,connecting:null},ve=new Promise((Ie,Oe)=>{const ze=new WebSocket(P9(J));let rt=!1;const Be=window.setTimeout(()=>{rt||(rt=!0,ze.close(),Oe(new Error("Timed out connecting to Android touch stream.")))},vH),dt=()=>window.clearTimeout(Be);ze.addEventListener("message",He=>{if(!rt&&typeof He.data=="string")try{const Ot=JSON.parse(He.data);Ot.t==="opened"?(rt=!0,dt(),Ee.socket=ze,Ee.connecting=null,Ie(ze)):Ot.t==="error"&&(rt=!0,dt(),Ee.connecting=null,Oe(new Error(Ot.message??"Android touch stream failed.")))}catch{}}),ze.addEventListener("error",()=>{rt||(rt=!0,dt(),Ee.connecting=null,Oe(new Error("Failed to connect to Android touch stream.")))},{once:!0}),ze.addEventListener("close",()=>{var He;dt(),Ee.connecting=null,rt||(rt=!0,Oe(new Error("Android touch stream closed before it was ready."))),((He=D.current)==null?void 0:He.socket)===ze&&(D.current=null)})});return Ee.connecting=ve,D.current=Ee,ve}async function oe(J,ie){if(J.backend==="android"){if(J.liveFailed)return!1;try{return(await re(J.device)).send(JSON.stringify(ie)),J.sentLiveFrames+=1,!0}catch(Ee){return J.liveFailed=!0,J.sentLiveFrames>0&&xe.error(`Android touch stream failed: ${Ee.message}`),!1}}if(!J.wsUrl||J.liveFailed)return!1;try{return(await ee(J.wsUrl)).send(RH(ie)),J.sentLiveFrames+=1,!0}catch(Ee){return J.liveFailed=!0,J.sentLiveFrames>0&&xe.error(`Gesture stream failed: ${Ee.message}`),!1}}function Z(J,ie){be.gestureEmulator([{type:"begin",x:J.x,y:J.y}],ie).catch(Ee=>{xe.error(`Tap failed: ${Ee.message}`)})}function ce(J,ie){be.gestureEmulator(J,ie).catch(Ee=>{xe.error(`Gesture failed: ${Ee.message}`)})}function ne(J){if(!r||!O||!J.isPrimary||J.pointerType==="mouse"&&J.button!==0)return;const ie=Kv(R.current,J,!1);ie&&(J.preventDefault(),J.currentTarget.setPointerCapture(J.pointerId),W.current={backend:r.backend,pointerId:J.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:J.clientX,startClientY:J.clientY,lastPoint:ie,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:ie.x,y:ie.y}]},oe(W.current,{type:"begin",x:ie.x,y:ie.y}),p(!0))}function we(J){const ie=W.current;if(!ie||ie.pointerId!==J.pointerId)return;const Ee=Kv(R.current,J,!0);if(!Ee)return;J.preventDefault();const ve=Math.hypot(J.clientX-ie.startClientX,J.clientY-ie.startClientY)>j2,Ae=O2(Ee,ie.lastPoint)>gH;if(ie.lastPoint=Ee,ve&&(Ae||!ie.moved)){ie.moved=!0;const Ie={type:"move",x:Ee.x,y:Ee.y};ie.points.push(Ie),oe(ie,Ie)}}async function _e(J){const ie=W.current;if(!ie||ie.pointerId!==J.pointerId)return;J.preventDefault();const Ee=Kv(R.current,J,!0)??ie.lastPoint,ve=Math.hypot(J.clientX-ie.startClientX,J.clientY-ie.startClientY)>j2;W.current=null,p(!1);try{J.currentTarget.releasePointerCapture(J.pointerId)}catch{}const Ae={type:"end",x:Ee.x,y:Ee.y};if((ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&(!ie.moved&&!ve&&await EH(ie.backend==="android"?_H:yH),await oe(ie,Ae)||ie.sentLiveFrames>0))return;if(!ie.moved&&!ve){Z(Ee,ie.device);return}const Ie=[...ie.points],Oe=Ie[Ie.length-1];Oe&&O2(Oe,Ee)<=.001?Ie[Ie.length-1]=Ae:Ie.push(Ae),ce(Ie,ie.device)}function ye(J){const ie=W.current;!ie||ie.pointerId!==J.pointerId||(W.current=null,p(!1),(ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&oe(ie,{type:"end",x:ie.lastPoint.x,y:ie.lastPoint.y}))}return l.jsxs("div",{className:"grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]",children:[l.jsxs(Vr,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(pi,{className:"px-4 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs(Zr,{className:"flex items-center gap-2",children:[l.jsx(TR,{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||y!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:l.jsx(NR,{className:qe(y==="home"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&Y(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||y!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:l.jsx(Ef,{className:qe(y==="shutdown"&&"animate-pulse")})}),l.jsx(he,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void G(),disabled:s,"aria-label":"Refresh emulator",title:"Refresh",children:l.jsx(Nt,{className:qe(s&&"animate-spin")})})]})]}),l.jsxs(Qr,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":O&&!E,children:[O?l.jsx("div",{className:qe("relative grid touch-none select-none place-items-center overflow-hidden bg-black",E?"max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm":"pointer-events-none absolute inset-0",E&&(g?"cursor-grabbing":"cursor-crosshair")),style:E?$:void 0,onPointerDown:ne,onPointerMove:we,onPointerUp:_e,onPointerCancel:ye,children:q?l.jsx("img",{ref:J=>{R.current=J},src:B??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:J=>{H(J.currentTarget.naturalWidth,J.currentTarget.naturalHeight)},onError:F,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${N}`):r&&j?l.jsx(pH,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:J=>{R.current=J},onFrameSize:H},r.deviceUdid):null}):l.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),O&&!E&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[l.jsx(Nt,{className:"size-4 animate-spin text-[var(--primary)]"}),l.jsx("span",{children:"Loading preview…"})]})})]})]}),l.jsxs(Vr,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[l.jsxs(pi,{children:[l.jsxs(Zr,{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(Qr,{className:"min-h-0 flex-1 p-0",children:e.length===0?l.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:s?"Loading...":"No devices"}):l.jsx(yn,{className:"h-full min-h-0",children:l.jsx("ul",{className:"grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3",children:e.map(J=>{const ie=(r==null?void 0:r.deviceUdid)===J.id,Ee=u===J.id,ve=m===J.id;return l.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5",children:[l.jsx(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:J.name}),l.jsxs(Et,{variant:J.state==="booted"?"success":J.state==="shutdown"?"outline":"warning",className:"h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase",children:[l.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),J.state]})]}),l.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:D2(J),children:D2(J)})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsx(he,{size:"xs",variant:ie?"outline":"default",onClick:()=>void X(J),disabled:Ee||m!==null,children:Ee?"Attaching…":ie?"Reattach":"Attach"}),J.state==="booted"&&l.jsx(he,{size:"icon-xs",variant:"destructive",onClick:()=>void Y(J.id,J.name),disabled:u!==null||m!==null,"aria-label":`Shutdown ${J.name}`,title:`Shutdown ${J.name}`,children:l.jsx(Ef,{className:qe(ve&&"animate-pulse")})})]})]},`${J.backend}:${J.id}`)})})})})]})]})}function HT({inst:e}){return e.running?e.connected===!1||e.lastError?l.jsx(Et,{variant:"destructive",children:"● error"}):e.connected&&!e.lastEventAt?l.jsx(Et,{variant:"default",children:"● connected (idle)"}):e.connected?l.jsx(Et,{variant:"success",children:"● connected"}):l.jsx(Et,{variant:"default",children:"● running"}):l.jsx(Et,{variant:"outline",children:"● stopped"})}function NH({instances:e,channels:t,agents:r,onChange:i}){const[s,o]=v.useState(!1),u=v.useMemo(()=>new Set(e.map(h=>h.channelId)),[e]),d=t.filter(h=>!u.has(h.id));async function m(h,g){try{await g(),xe.success(h),await i()}catch(p){xe.error(`${h} failed: ${p.message}`)}}return l.jsxs(Vr,{children:[l.jsxs(pi,{children:[l.jsxs(Zr,{children:["Instances ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:e.length})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void i(),children:[l.jsx(Nt,{})," Refresh"]}),l.jsxs(he,{size:"sm",onClick:()=>o(!0),disabled:d.length===0,children:[l.jsx(Qi,{})," Add instance"]})]})]}),l.jsx(Qr,{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(HT,{inst:h}),h.lastError&&l.jsx("div",{className:"mt-0.5 max-w-[16rem] truncate text-xs text-[var(--destructive)]",children:h.lastError})]}),l.jsx("td",{className:"px-3 py-3",children:l.jsxs(Ma,{value:h.agent??"",onChange:g=>void m("Agent updated",()=>be.updateInstance(h.id,{agent:g.target.value||void 0})),children:[l.jsx("option",{value:"",children:"(none)"}),r.map(g=>l.jsx("option",{value:g.id,children:g.name??g.id},g.id))]})}),l.jsx("td",{className:"px-5 py-3",children:l.jsxs("div",{className:"flex justify-end gap-1.5",children:[h.enabled?l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Disabled",()=>be.instanceAction(h.id,"disable")),children:[l.jsx(uB,{})," Disable"]}):l.jsxs(he,{variant:"outline",size:"sm",onClick:()=>void m("Enabled",()=>be.instanceAction(h.id,"enable")),children:[l.jsx(jR,{})," Enable"]}),l.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>void m("Restarted",()=>be.instanceAction(h.id,"restart")),children:[l.jsx(DR,{})," Restart"]}),l.jsx(AH,{name:h.channelName,onDeleted:()=>m("Deleted",()=>be.deleteInstance(h.id))})]})})]},h.id))]})]})}),s&&l.jsx(TH,{freeChannels:d,agents:r,onClose:()=>o(!1),onAdded:async()=>{o(!1),await i()}})]})}function AH({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Delete instance for "',e,'"?']}),l.jsx(tn,{children:"This stops the binding. The channel + its credentials stay; you can re-bind it later."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:t,children:"Delete"})]})]})]})}function TH({freeChannels:e,agents:t,onClose:r,onAdded:i}){var h;const[s,o]=v.useState(((h=e[0])==null?void 0:h.id)??""),[u,d]=v.useState("");async function m(){if(!s)return xe.error("Pick a channel");try{await be.createInstance({channelId:s,agent:u||void 0}),xe.success("Instance created"),await i()}catch(g){xe.error(`Create failed: ${g.message}`)}}return l.jsx(Oo,{open:!0,onOpenChange:g=>!g&&r(),children:l.jsxs($a,{children:[l.jsx(Bo,{children:l.jsx(Ua,{children:"Add instance"})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsx(B2,{label:"Channel",children:l.jsx(Ma,{value:s,onChange:g=>o(g.target.value),className:"w-full",children:e.map(g=>l.jsxs("option",{value:g.id,children:[g.name," (",g.type,")"]},g.id))})}),l.jsx(B2,{label:"Agent",children:l.jsxs(Ma,{value:u,onChange:g=>d(g.target.value),className:"w-full",children:[l.jsx("option",{value:"",children:"(none)"}),t.map(g=>l.jsx("option",{value:g.id,children:g.name??g.id},g.id))]})})]}),l.jsxs(ed,{children:[l.jsx(Ju,{asChild:!0,children:l.jsx(he,{variant:"outline",children:"Cancel"})}),l.jsx(he,{onClick:m,children:"Create"})]})]})})}function B2({label:e,children:t}){return l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{children:e}),t]})}function MH(){const[e,t]=v.useState(""),[r,i]=v.useState("");async function s(){try{i(await be.logs(e.trim()||void 0)||"(empty)")}catch(o){xe.error(`Failed to read logs: ${o.message}`)}}return l.jsxs(Vr,{children:[l.jsxs(pi,{children:[l.jsx(Zr,{children:"Logs"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(xt,{value:e,onChange:o=>t(o.target.value),placeholder:"filter by instance (optional)",className:"h-8 w-56"}),l.jsxs(he,{size:"sm",onClick:()=>void s(),children:[l.jsx(LR,{})," Tail"]})]})]}),l.jsx(Qr,{children:l.jsx("pre",{className:"max-h-[28rem] overflow-auto rounded-lg bg-[var(--muted)] p-4 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:r||"Press Tail to load the latest daemon logs."})})]})}function jH(e){return!!(e.options&&Object.keys(e.options).length>0)}function DH({instances:e,channels:t,agents:r}){const i=Oa(),s=m=>i(pt[m]),o=e.filter(m=>m.running).length,u=e.filter(m=>m.connected).length,d=t.filter(jH).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(Xv,{icon:CR,label:"Instances",value:e.length,sub:`${o} running · ${u} connected`,onClick:()=>s("instances")}),l.jsx(Xv,{icon:Ex,label:"Channels",value:t.length,sub:`${d} configured`,onClick:()=>s("channels")}),l.jsx(Xv,{icon:Cx,label:"Agents",value:r.length,sub:r.length===1?"1 defined":`${r.length} defined`,onClick:()=>s("agents")})]}),l.jsxs(Vr,{children:[l.jsxs(pi,{children:[l.jsx(Zr,{children:"Instances"}),l.jsx(he,{variant:"outline",size:"sm",onClick:()=>s("instances"),children:"Manage"})]}),l.jsx(Qr,{className:"p-0",children:e.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:[t.length===0?"No channels yet — add one to get started.":"No instances yet — bind a channel to an agent.",l.jsx("div",{className:"mt-3",children:l.jsx(he,{size:"sm",onClick:()=>s(t.length===0?"channels":"instances"),children:t.length===0?"Add channel":"Add instance"})})]}):l.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(m=>l.jsxs("li",{className:"flex items-center justify-between gap-3 px-5 py-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-sm font-medium",children:m.channelName}),l.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[m.type,m.agent?` · ${m.agent}`:""]})]}),l.jsx(HT,{inst:m})]},m.id))})})]})]})}function Xv({icon:e,label:t,value:r,sub:i,onClick:s}){return l.jsx(Vr,{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 Zv="local",LH={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function OH(){const[e,t]=v.useState(null),[r,i]=v.useState(null),[s,o]=v.useState(!1),[u,d]=v.useState({}),m=v.useRef(0),h=v.useCallback(async(p=!1)=>{const y=++m.current;p&&o(!0),i(null);try{const b=await be.listProviderClis(Zv);y===m.current&&t(b)}catch(b){y===m.current&&(t(null),i(b instanceof Error?b.message:String(b)))}finally{y===m.current&&o(!1)}},[]);v.useEffect(()=>{h()},[h]);const g=async(p,y)=>{try{let b=(await be.startProviderCliOperation(Zv,p,y)).job;for(d(w=>({...w,[p]:b}));b.state==="running";)await HH(750),b=await be.getProviderCliJob(Zv,b.id),d(w=>({...w,[p]:b}));b.state==="succeeded"?(xe.success(`${P2(p)} ${y} completed`),await h(),d(w=>{const C={...w};return delete C[p],C})):xe.error(b.error??`${P2(p)} ${y} failed`)}catch(b){xe.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.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Et,{variant:"outline",className:"gap-1.5",children:[l.jsx(Nx,{className:"size-3"}),"This device"]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:s,onClick:()=>void h(!0),children:[l.jsx(Nt,{className:s?"animate-spin":""}),"Refresh"]})]})]}),r&&l.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[l.jsx(Ea,{className:"size-4"})," Could not inspect Providers"]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),l.jsxs(he,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void h(!0),children:[l.jsx(Nt,{})," Retry"]})]}),e===null&&!r?l.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(p=>l.jsx(PH,{},p))}):l.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(p=>l.jsx(BH,{provider:p,job:u[p.id],readOnly:e.management==="read_only",onOperation:g},p.id))})]})}function BH({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(Vr,{className:"min-w-0",children:l.jsxs(Qr,{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(Tx,{className:"size-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsx(Zr,{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(Qv,{icon:UO,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),l.jsx(Qv,{icon:Nt,label:"Version",value:$H(e),mono:!0,noWrap:!0}),l.jsx(Qv,{icon:AR,label:"Authentication",value:UH(e)})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:max-w-56 xl:justify-end",children:[l.jsx(IH,{provider:e}),!r&&s&&l.jsx(zH,{provider:e,operation:s,disabled:o,onConfirm:()=>i(e.id,s)})]})]}),e.error&&l.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[o?l.jsx(Nt,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?l.jsx(RR,{className:"size-3.5 text-[var(--success)]"}):l.jsx(Ea,{className:"size-3.5 text-[var(--destructive)]"}),l.jsx("span",{children:t.error??LH[t.stage]})]})]})})}function PH(){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 IH({provider:e}){return e.availability==="missing"?l.jsx(Et,{variant:"warning",children:"Not installed"}):e.availability==="broken"?l.jsx(Et,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?l.jsx(Et,{variant:"warning",children:"New version"}):l.jsx(Et,{variant:"success",children:"Installed"})}function Qv({icon:e,label:t,value:r,mono:i=!1,noWrap:s=!1}){return l.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[l.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),l.jsx("div",{className:qe("mt-0.5",i&&"font-mono text-[11px]",i&&!s&&"break-all",s&&"whitespace-nowrap"),children:r})]})]})}function zH({provider:e,operation:t,disabled:r,onConfirm:i}){const s=t==="install"?"Install":"Update";return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?l.jsx(Nt,{className:"animate-spin"}):l.jsx(cO,{}),r?"Working…":s]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:[s," ",e.name,"?"]}),l.jsxs(tn,{children:["Rynx will run ",e.name,"'s official ",t," mechanism on this Runtime. The daemon will verify the executable and version when it finishes."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{onClick:()=>void i(),children:s})]})]})]})}function $H(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 UH(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function P2(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function HH(e){return new Promise(t=>window.setTimeout(t,e))}function FH(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 WH(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=nc(),[i,s]=v.useState(null),[o,u]=v.useState(!1),[d,m]=v.useState(null),[h,g]=v.useState(null),[p,y]=v.useState({}),[b,w]=v.useState({});async function C(){try{const N=await be.listRuntimes();s(N),r(N)}catch(N){s([]),xe.error(`Failed to load Runtimes: ${N.message}`)}}v.useEffect(()=>{C()},[]);async function E(N){g(N.selector);try{const k=await be.testRuntime(N.selector);y(R=>({...R,[N.selector]:k})),w(R=>{const M={...R};return delete M[N.selector],M}),xe.success(`${N.displayName} is reachable`)}catch(k){y(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})),xe.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{g(null)}}async function S(N){try{await be.forgetRuntime(N.daemonId),y(k=>{const R={...k};return delete R[N.selector],R}),w(k=>{const R={...k};return delete R[N.selector],R}),xe.success(`Forgot ${N.displayName}`),e===N.selector&&t("local"),await C()}catch(k){xe.error(`Forget failed: ${k.message}`)}}return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(qH,{}),l.jsxs(Vr,{children:[l.jsxs(pi,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Zr,{children:["Runtimes"," ",l.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(i==null?void 0:i.length)??0})]}),l.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),l.jsxs(he,{size:"sm",onClick:()=>u(!0),children:[l.jsx(Qi,{})," Add Runtime"]})]}),l.jsx(Qr,{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(Nx,{className:"size-4"}):l.jsx(Qu,{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(Et,{variant:N.binding==="local"?"default":"outline",children:N.binding}),k&&l.jsxs(Et,{variant:"success",children:[l.jsx(RR,{className:"mr-1 size-3"})," reachable"]}),M&&l.jsxs(Et,{variant:"warning",children:[l.jsx(Ax,{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(Nt,{className:h===N.selector?"animate-spin":""}),"Test"]}),N.binding==="direct"&&l.jsx(XH,{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($2,{open:o,onOpenChange:u,onAdded:async N=>{y(k=>({...k,[N.target.selector]:N})),await C()}}),l.jsx($2,{open:d!==null,target:d,onOpenChange:N=>{N||m(null)},onAdded:async N=>{y(k=>({...k,[N.target.selector]:N})),w(k=>{const R={...k};return delete R[N.target.selector],R}),await C()}})]})}const I2="__rynx_custom_share_address__";function qH(){const[e,t]=v.useState(null),[r,i]=v.useState(null),[s,o]=v.useState(null),[u,d]=v.useState(!1),[m,h]=v.useState(!1),[g,p]=v.useState(""),[y,b]=v.useState(!1),[w,C]=v.useState(""),[E,S]=v.useState(!1),[N,k]=v.useState(null),R=v.useRef(null),[M,L]=v.useState(null),[z,D]=v.useState(null),[W,G]=v.useState(!1),[q,B]=v.useState(null),[j,O]=v.useState(null),$=v.useCallback(async(Z=!1)=>{G(!0);try{L(await be.listRuntimeAccess()),D(null),Z&&xe.success("Shared access refreshed")}catch(ce){const ne=ce.message;D(ne),Z&&xe.error(`Failed to refresh shared access: ${ne}`)}finally{G(!1)}},[]),T=v.useCallback(async(Z=!1)=>{d(!0);try{const ce=await be.listRuntimeShareAddresses();t(ce),o(null),i(ne=>(ne==null?void 0:ne.kind)==="custom"||ne&&ce.some(we=>we.address===ne.address)?ne:ce[0]?{kind:"detected",address:ce[0].address}:null),Z&&xe.success("Network addresses refreshed")}catch(ce){const ne=ce.message;t(we=>we??[]),o(ne),Z&&xe.error(`Failed to refresh network addresses: ${ne}`)}finally{d(!1)}},[]);v.useEffect(()=>{$(),T()},[$,T]);const U=(r==null?void 0:r.address)??"",H=w.trim(),F=N&&N.address===U.trim()&&N.clientLabel===H?N.code:"";function V(Z){if(Z===I2){p((r==null?void 0:r.kind)==="custom"?r.address:""),b(!1),h(!0);return}Z!==Jv(r)&&e!=null&&e.some(ce=>ce.address===Z)&&i({kind:"detected",address:Z})}function I(){const Z=g.trim();if(!GH(Z)){b(!0);return}i({kind:"custom",address:Z}),h(!1),b(!1)}async function Y(){const Z=U.trim();if(!Z){xe.error("Choose an address that the other device can reach");return}S(!0);try{const ce=await be.shareRuntime({address:Z,...H?{clientLabel:H}:{}});k({code:ce.pairingCode,address:Z,clientLabel:H}),xe.success("Pairing link generated"),await $()}catch(ce){xe.error(`Failed to generate pairing link: ${ce.message}`)}finally{S(!1)}}async function X(){if(!F)return;const Z=await UT(F,R.current);Z==="clipboard"||Z==="selection"?xe.success("Pairing link copied"):Z==="selected"?xe.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):xe.error("Copy is unavailable — select the pairing link and copy it manually")}async function ee(Z){B(Z.grantId);try{const ce=await be.revokeRuntimeAccess(Z.grantId);xe.success(`Revoked ${Tu(Z)}${ce.closedConnections>0?` and closed ${ce.closedConnections} active connection${ce.closedConnections===1?"":"s"}`:""}`),await $()}catch(ce){xe.error(`Revoke failed: ${ce.message}`)}finally{B(null)}}async function re(Z){O(Z.grantId);try{await be.deleteRevokedRuntimeAccess(Z.grantId),xe.success(`Removed revoked access record for ${Tu(Z)}`),await $()}catch(ce){xe.error(`Remove failed: ${ce.message}`)}finally{O(null)}}const oe=(M==null?void 0:M.filter(Z=>Z.revokedAt===null).length)??0;return l.jsxs(Vr,{children:[l.jsx(pi,{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(TB,{className:"size-4"})}),l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Zr,{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(Qr,{className:"grid gap-6",children:[l.jsxs("form",{className:"grid gap-3",onSubmit:Z=>{Z.preventDefault(),Y()},children:[l.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-share-address",children:"Connection address"}),l.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[l.jsxs(Nm,{value:(r==null?void 0:r.kind)==="custom"?Jv(r):r==null?void 0:r.address,onValueChange:V,disabled:e===null,children:[l.jsx(cd,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:l.jsx(ld,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?VH(e??[],r.address):void 0})}),l.jsxs(ud,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&l.jsxs(Xn,{value:Jv(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Z=>l.jsx(Xn,{value:Z.address,children:FT(Z)},Z.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&l.jsx(_y,{}),l.jsx(Xn,{value:I2,children:"Enter custom address…"})]})]}),l.jsx(he,{type:"button",variant:"outline",size:"icon",disabled:u,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void T(!0),children:l.jsx(Nt,{className:u?"animate-spin":""})})]})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-share-label",children:"Client label"}),l.jsx(xt,{id:"runtime-share-label",value:w,onChange:Z=>C(Z.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),l.jsxs(he,{type:"submit",disabled:E||!r,children:[E?l.jsx(Nt,{className:"animate-spin"}):l.jsx(BO,{}),"Generate Link"]})]}),l.jsx("p",{id:"runtime-share-address-help",className:s?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:s?"alert":void 0,children:s?`Could not refresh network addresses: ${s}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),F&&l.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[l.jsx($r,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),l.jsxs("div",{className:"flex min-w-0 gap-2",children:[l.jsx(xt,{id:"runtime-pairing-code",ref:R,value:F,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),l.jsxs(he,{type:"button",variant:"outline",onClick:()=>void X(),children:[l.jsx(kR,{})," Copy"]})]}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),l.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",l.jsx("span",{className:"text-[var(--muted-foreground)]",children:oe})]}),l.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Active clients can reconnect until their grant is revoked."})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",disabled:W,"aria-label":"Refresh shared access",onClick:()=>void $(!0),children:l.jsx(Nt,{className:W?"animate-spin":""})})]}),M===null&&!z&&l.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),z&&l.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2",children:[l.jsxs("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:["Could not load shared access: ",z]}),l.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>void $(),children:"Retry"})]}),(M==null?void 0:M.length)===0&&!z&&l.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),M&&M.length>0&&l.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:M.map(Z=>l.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-sm font-medium",children:Tu(Z)}),l.jsxs(Et,{variant:Z.revokedAt?"destructive":"success",children:[Z.revokedAt?l.jsx(Ax,{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 ${z2(Z.lastUsedAt)}`:`Created ${z2(Z.createdAt)} · never connected`})]}),Z.revokedAt?l.jsx(KH,{client:Z,disabled:j===Z.grantId,onRemove:()=>re(Z)}):l.jsx(YH,{client:Z,disabled:q===Z.grantId,onRevoke:()=>ee(Z)})]},Z.grantId))})]})]}),l.jsx(Oo,{open:m,onOpenChange:Z=>{h(Z),Z||b(!1)},children:l.jsxs($a,{className:"sm:max-w-md",children:[l.jsxs(Bo,{children:[l.jsx(Ua,{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($r,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),l.jsx(xt,{id:"runtime-custom-share-address",value:g,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":y,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),l.jsx("p",{id:"runtime-custom-share-address-help",className:y?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:y?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),l.jsxs(ed,{children:[l.jsx(Ju,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(he,{type:"submit",disabled:!g.trim(),children:"Use Address"})]})]})]})})]})}function FT(e){return`${e.interfaceName} (${e.address})`}function VH(e,t){const r=e.find(i=>i.address===t);return r?FT(r):t}function Jv(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function GH(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function YH({client:e,disabled:t,onRevoke:r}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Ax,{}),"Revoke"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Revoke access for “",Tu(e),"”?"]}),l.jsx(tn,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function KH({client:e,disabled:t,onRemove:r}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Pa,{}),"Remove Record"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Remove revoked record for “",Tu(e),"”?"]}),l.jsx(tn,{children:"This removes the revoked authorization record from this Host. It does not restore access or delete the credential stored on the client device."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Tu(e){return e.clientLabel??e.clientId}function z2(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function $2({open:e,target:t=null,onOpenChange:r,onAdded:i}){const[s,o]=v.useState(""),[u,d]=v.useState(""),[m,h]=v.useState(!1),g=t!==null;v.useEffect(()=>{e&&(o((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function p(){const y=u.trim();if(y){h(!0);try{const b=await be.pairRuntime({offer:y,...s.trim()?{displayName:s.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});xe.success(g?`Reauthorized ${b.target.displayName}`:`Paired ${b.target.displayName}`),await i(b),o(""),d(""),r(!1)}catch(b){xe.error(FH(b,g?"Reauthorization":"Pairing"))}finally{h(!1)}}}return l.jsx(Oo,{open:e,onOpenChange:r,children:l.jsxs($a,{className:"sm:max-w-lg",children:[l.jsxs(Bo,{children:[l.jsx(Ua,{children:g?"Reauthorize Runtime":"Add Runtime"}),l.jsx(hm,{children:g?"Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.":"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),l.jsxs("form",{className:"grid gap-4",onSubmit:y=>{y.preventDefault(),p()},children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-name",children:"Display name"}),l.jsx(xt,{id:"runtime-name",value:s,onChange:y=>o(y.target.value),placeholder:"Remote lab",maxLength:128})]}),l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx($r,{htmlFor:"runtime-offer",children:"Pairing link"}),l.jsx(xt,{id:"runtime-offer",value:u,onChange:y=>d(y.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),l.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",l.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),l.jsxs(ed,{children:[l.jsx(Ju,{asChild:!0,children:l.jsx(he,{type:"button",variant:"outline",children:"Cancel"})}),l.jsxs(he,{type:"submit",disabled:m||!u.trim(),children:[m?l.jsx(Nt,{className:"animate-spin"}):l.jsx(Rf,{}),g?"Reauthorize":"Add Runtime"]})]})]})]})})}function XH({target:e,onForget:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[l.jsx(Pa,{}),l.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:["Forget “",e.displayName,"”?"]}),l.jsxs(tn,{children:["Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs ",l.jsx("code",{children:"rynx runtime clients revoke"}),"on that daemon."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}const ZH="rynx.control.session-launch-selection.v2";function WT(e){return`${e.kind}:${e.id}`}function qT(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 QH(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function JH(e,t){const r=t?qT(t):null;if(r&&QH(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 eF(e,t){if(!t)return null;try{return t.getItem(VT(e))}catch{return null}}function tF(e,t,r){if(t)try{t.setItem(VT(e),WT(r))}catch{}}function VT(e){return`${ZH}:${encodeURIComponent(e)}`}function rF(e,t){return e.kind==="provider"?{provider:e.id,title:t}:{agent:e.id,title:t}}function iF(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function nF(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function e_(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function Hu(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function p0(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 GT=C9,YT=v.forwardRef(({className:e,...t},r)=>l.jsx(E9,{ref:r,className:qe("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));YT.displayName="TabsList";const g0=v.forwardRef(({className:e,...t},r)=>l.jsx(R9,{ref:r,className:qe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));g0.displayName="TabsTrigger";const Fu=v.forwardRef(({className:e,...t},r)=>l.jsx(k9,{ref:r,className:qe("mt-4 focus-visible:outline-none",e),...t}));Fu.displayName="TabsContent";function Mu(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",waitingForInteraction:!1,todos:[],historyLoaded:!1}}function sF(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function aF(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 oF(e){return e.filter(t=>t.type==="input_image")}function lF(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 Hh(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const i=t[r],s=t[r-1];i.type!=="reasoning"||i.data.model!=="traex"||s.type!=="message"||s.data.role!=="assistant"||s.data.model!=="traex"||s.responseId!==i.responseId||i.createdAt<s.createdAt||i.createdAt-s.createdAt>500||(t[r]=s,t[r-1]=i)}return t}function qn(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function mi(e,t,r){e.items[t]=r}function pn(e,t){const r=e.items.length;return e.items.push(t),r}function U2(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 KT(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=KT(r.children));return t}function bo(e){e.waitingForInteraction=KT(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function XT(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function v0(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?XT(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:v0(r.children,t)}:r)}function _0(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&_0(r.children,t);return t}function H2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:o})=>o.interactionId));for(const[o,u]of Object.entries(e.childStates)){const d=qn(u);d.items=v0(d.items,r),bo(d),e.childStates[o]=d;const m=e.callIndex[o];if(m!==void 0){const h=e.items[m];mi(e,m,{...h,children:d.items})}}e.items=v0(e.items,r);const i=_0(e.items);for(const o of Object.values(e.childStates))_0(o.items,i);for(const{responseId:o,interaction:u}of t.pendingInteractions){if(i.has(u.interactionId))continue;const d={kind:"interaction",id:u.interactionId,responseId:o,request:u,status:"pending"};e.interactionIndex[u.interactionId]=pn(e,d),i.add(u.interactionId)}const s=new Set(t.activeResponseIds);for(const[o,u]of Object.entries(e.turns))s.has(o)||u.status==="running"&&(e.turns[o]={...u,status:"completed"},x0(e,o));uF(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 F2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function W2(e,t,r,i){const s=e.byId[t];if(s!==void 0)return s;const o=pn(e,i());return e.byId[t]=o,o}function 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=qn(e.childStates[t]??Mu());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];mi(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":{U2(e,t.responseId,t.data.model);const i={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:sF(t.data.content),images:oF(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...aF(t)?{textPrefixTruncated:!0}:{}},s=e.byId[t.id];if(s!==void 0){mi(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&&lF(u.images,i.images));if(o!==-1){const u=e.items[o];delete e.byId[u.id],mi(e,o,i),e.byId[t.id]=o;return}}e.byId[t.id]=pn(e,i);return}case"reasoning":{U2(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?mi(e,s,i):e.byId[t.id]=pn(e,i);return}case"function_call":{const i=t.data.callId,s=e.pendingOutputs[i],o=(r=e.childStates[i])==null?void 0:r.items,u={kind:"tool",id:i,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:s?s.status??"completed":t.status,output:s==null?void 0:s.output,exitCode:s==null?void 0:s.exitCode,...o&&o.length?{children:o}:{}};s&&delete e.pendingOutputs[i];const d=e.callIndex[i];d!==void 0?mi(e,d,u):e.callIndex[i]=pn(e,u);return}case"function_call_output":{const i=t.data.callId,s=e.callIndex[i];if(s===void 0){e.pendingOutputs[i]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode};return}const o=e.items[s];mi(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?mi(e,s,i):e.byId[t.id]=pn(e,i);return}case"interaction_request":{const i=t.data.interaction,s=i.interactionId,o=e.interactionIndex[s],u=e.pendingInteractionResolutions[s],d=o===void 0?void 0:e.items[o];let m={kind:"interaction",id:s,responseId:t.responseId,request:i,status:(d==null?void 0:d.status)??"pending",...d!=null&&d.resolution?{resolution:d.resolution}:{},...d!=null&&d.reason?{reason:d.reason}:{},...(d==null?void 0:d.resolvedAt)!==void 0?{resolvedAt:d.resolvedAt}:{}};u&&(m=F2(m,u),delete e.pendingInteractionResolutions[s]),o===void 0?e.interactionIndex[s]=pn(e,m):mi(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];mi(e,s,F2(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?mi(e,s,i):e.byId[t.id]=pn(e,i);return}}}function x0(e,t){const r=i=>i===t;$f(e,r),e.items=y0(e.items,t);for(const[i,s]of Object.entries(e.childStates)){const o=qn(s);$f(o,r),o.items=y0(o.items,t),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];mi(e,u,{...d,children:o.items})}}}function uF(e,t){const r=i=>!t.has(i);$f(e,r);for(const[i,s]of Object.entries(e.childStates)){const o=qn(s);$f(o,r),bo(o),e.childStates[i]=o;const u=e.callIndex[i];if(u!==void 0){const d=e.items[u];mi(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 dF(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 y0(e,t){return e.map(r=>{const i=r.kind==="tool"&&r.children?{...r,children:y0(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 q2(e){return Object.values(e.turns).some(t=>t.status==="running")}function dn(e){e.note=void 0,e.statusKind=void 0}function hF(e,t){var r;switch(t.type){case"session.status":{e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note,e.statusKind=t.statusKind;return}case"response.created":{e.turns[t.responseId]={status:"running",model:t.model},e.runStatus="running",dn(e);return}case"response.output_text.delta":{dn(e);const i=e.byId[t.itemId],s=i===void 0?void 0:e.items[i];if(t.discard===!0){i!==void 0&&(s==null?void 0:s.kind)==="message"&&s.role==="assistant"&&s.responseId===t.responseId&&s.liveDraft===!0&&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=W2(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&&dF(e,t.responseId);return}case"response.reasoning_summary_text.delta":{dn(e);const i=W2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),s=e.items[i],o=s.summary.slice();o[t.summaryIndex]=(o[t.summaryIndex]??"")+t.delta,e.items[i]={...s,summary:o,streaming:!0};return}case"response.function_call_output.delta":{dn(e);const i=e.callIndex[t.callId];if(i===void 0){const o=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...o,output:(o.output??"")+t.delta};return}const s=e.items[i];e.items[i]={...s,output:(s.output??"")+t.delta};return}case"session.interaction.requested":{dn(e),Ts(e,t.item);const i=e.interactionIndex[t.interaction.interactionId];if(i!==void 0){const s=e.items[i];(s.status==="pending"||s.status==="inactive")&&mi(e,i,XT(s))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{dn(e),Ts(e,t.item);return}case"response.output_item.done":{dn(e),Ts(e,t.item);return}case"response.completed":{dn(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"completed",usage:t.usage},x0(e,t.responseId),!q2(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{dn(e);const i=e.turns[t.responseId];e.turns[t.responseId]={...i,status:"failed"},e.items.some(o=>o.kind==="error"&&o.responseId===t.responseId&&o.code===t.error.code)||pn(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),x0(e,t.responseId),e.runStatus=q2(e)?"running":"idle";return}case"session.input.consumed":{dn(e),Ts(e,t.item);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{pn(e,{kind:"divider",id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind==="fork"?"forked to a new session":"context cleared — new session",newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus="idle",dn(e);return}}}function fF(e,t){var r;switch(t.kind){case"reset":return Mu();case"snapshot":{const i=Mu();for(const s of Hh(t.items))Ts(i,s);return H2(i,t.runtime),i.historyLoaded=!0,i}case"reconcile_snapshot":{const i=qn(e);for(const s of Hh(t.items))Ts(i,s);return H2(i,t.runtime),i.historyLoaded=!0,i.error=void 0,i}case"history":{const i=Mu();for(const s of Hh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i}case"reconcile_history":{const i=qn(e);for(const s of Hh(t.items))Ts(i,s);return bo(i),i.historyLoaded=!0,i.error=void 0,i}case"event":{const i=qn(e);return hF(i,t.event),bo(i),i}case"optimistic_user":{const i=qn(e),s={kind:"message",id:t.id,responseId:t.id,role:"user",text:t.text,images:t.images??[],streaming:!1,optimistic:!0};return i.byId[t.id]=pn(i,s),i}case"discard_optimistic_user":{const i=e.byId[t.id];if(i===void 0||((r=e.items[i])==null?void 0:r.kind)!=="message"||!e.items[i].optimistic)return e;const s=qn(e);return jm(s,i),s}case"stream_error":{const i=qn(e);return i.error=t.message,i}case"stream_done":return e}}function mF(e){let t;for(const r of e.items){const i=e.turns[r.responseId];i&&(t=i)}return t}function pF(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 b0="browser:",w0="emulator:",V2=.44,bu=360,gF=420;function vF(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(b0)?{type:"browser",pageId:e.slice(b0.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(w0)?{type:"emulator",bindingId:e.slice(w0.length).trim()||null}:null:null}function Hn(e){return e?`${b0}${e}`:"browser"}function Fn(e){return e?`${w0}${e}`:"emulator"}function G2(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 Fh(e,t){const r=Math.max(0,e),i=Math.max(0,r-gF),s=Math.min(bu,i);return Math.min(i,Math.max(s,t))}function _F(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 xF(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 t_=0;function Wu(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 t_=t_+1>>>0,`${e}_${Date.now().toString(36)}_${t_.toString(36)}`}const yF=256,bF=4*1024*1024;function wF(e,t,r,i){return e||(r?t:i)}function SF(e){return e.type==="response.created"}function Y2(e,t,r){return r&&e!==null&&t===e}function CF(e,t){return e&&t}function EF(e,{runtimeSelector:t,allowSend:r=!0}={}){const[i,s]=v.useReducer(fF,void 0,Mu),[o,u]=v.useState(!1),[d,m]=v.useState(!1),h=v.useRef(null),g=v.useRef(0),p=v.useRef(null),y=v.useRef(null),b=v.useRef(0);v.useEffect(()=>{if(s({kind:"reset"}),p.current=null,y.current=null,u(!1),m(!1),!e)return;const E=new AbortController;let S=!1,N=!0,k;return(async()=>{let M=500;for(;!E.signal.aborted;){const L=new AbortController,z=()=>L.abort();E.signal.addEventListener("abort",z,{once:!0});let D=!1,W=!1,G=!1;const q={events:[],utf8Bytes:0};let B,j;const O=new Promise((U,H)=>{B=U,j=H}),$=be.streamSession(e,U=>{if(!(S||L.signal.aborted))if(U.event==="ready"){const H=kF(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&&SF(H)&&(y.current=F,Y2(p.current,y.current,D)&&(p.current=null,y.current=null,u(!1))),D?s({kind:"event",event:H}):RF(q,H)||(G=!0,L.abort())}else U.event==="error"&&s({kind:"stream_error",message:String(U.data.message??"stream error")})},L.signal,t).then(()=>(j(new Error("session stream closed before ready")),{error:void 0})).catch(U=>(j(U),{error:U}));try{await O,M=500;let U=500;for(;;){const H=new AbortController,F=()=>H.abort();L.signal.addEventListener("abort",F,{once:!0}),L.signal.aborted&&H.abort();const V=be.getSessionSnapshot(e,H.signal,t).then(ee=>({kind:"snapshot",snapshot:ee})).catch(ee=>({kind:"snapshot_error",error:ee})),I=await Promise.race([V,$.then(()=>({kind:"stream_ended"}))]);if(L.signal.removeEventListener("abort",F),I.kind==="stream_ended"){H.abort();break}if(S||E.signal.aborted)return;if(G)break;if(I.kind==="snapshot"){const{snapshot:ee}=I;s({kind:N?"snapshot":"reconcile_snapshot",items:ee.items,runtime:ee.runtime}),W=!0,N=!1;break}const{error:Y}=I;s({kind:"stream_error",message:Y instanceof Error?Y.message:String(Y)});const X=await Promise.race([$.then(()=>"stream_ended"),K2(U,E.signal).then(()=>"retry")]);if(E.signal.aborted)return;if(X==="stream_ended")break;U=Math.min(U*2,8e3)}}catch(U){!S&&!E.signal.aborted&&!G&&s({kind:"stream_error",message:U instanceof Error?U.message:String(U)})}finally{if(G||(D=!0),!S&&!E.signal.aborted&&!G){for(const U of q.events.splice(0))s({kind:"event",event:U});q.utf8Bytes=0,W&&(m(!0),Y2(p.current,y.current,!0)&&(p.current=null,y.current=null,u(!1)))}}const T=await $;if(S||m(!1),E.signal.removeEventListener("abort",z),L.abort(),E.signal.aborted)return;T.error,await K2(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=v.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??Wu("msg"),R=new AbortController,M=++g.current;h.current=R,p.current=M,y.current=null,u(!0);const L=`optimistic_${b.current++}`;s({kind:"optimistic_user",id:L,text:S,images:N});try{await be.sendSessionMessage(e,N.length===0?S:{content:[...N.map(z=>({type:"input_image",resourceId:z.resourceId,mediaType:z.mediaType,...z.filename?{filename:z.filename}:{},...z.byteLength?{byteLength:z.byteLength}:{},...z.width?{width:z.width}:{},...z.height?{height:z.height}:{}})),...S?[{type:"input_text",text:S}]:[]],clientMessageId:k},()=>{},R.signal,t)}catch(z){throw R.signal.aborted||(ky(z)&&s({kind:"discard_optimistic_user",id:L}),s({kind:"stream_error",message:z.message})),p.current===M&&(p.current=null,y.current=null,u(!1)),z}finally{h.current===R&&(h.current=null)}},[r,t,e]),C=v.useCallback(async()=>{var E;if((E=h.current)==null||E.abort(),p.current=null,y.current=null,u(!1),!!e)try{await be.interruptSession(e,t)}catch{}},[t,e]);return v.useEffect(()=>{if(!o)return;if(CF(d,i.runStatus==="running"||i.waitingForInteraction)){p.current=null,y.current=null,u(!1);return}const E=p.current,S=window.setTimeout(()=>{p.current===E&&(p.current=null,y.current=null,u(!1))},15e3);return()=>window.clearTimeout(S)},[d,o,i.runStatus,i.waitingForInteraction]),{state:i,pendingSend:o,current:d,send:w,stop:C}}function RF(e,t,r={}){const i=r.events??yF,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 kF(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 K2(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 Ay="desktop-direct-view",NF=1,X2=32*1024,Z2=4*1024*1024,AF=4096,TF=4096,MF=8847360,jF=4*1024,S0=512,DF=1024,Q2=new Uint8Array([82,66,83,70]),jl=38,LF=1,OF=2,Uf=new TextEncoder,BF=new TextDecoder("utf-8",{fatal:!0});function PF(e){const t=zF(e);switch(t.type){case"browser.surface.ready":{r_(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 ZT(r,i),{type:"browser.surface.ready",subscriptionId:wu(t.subscriptionId,"subscriptionId"),browserGeneration:J2(t.browserGeneration,"browserGeneration"),viewportRevision:HF(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:i,deviceScaleFactor:WF(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:qF(t.format),grantedRole:hf(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{r_(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=hf(t.driver,["none","desktop","stream"],"driver"),i=t.driverSubscriptionId===void 0?void 0:wu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(i!==void 0))throw Ut("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:wu(t.subscriptionId,"subscriptionId"),browserGeneration:J2(t.browserGeneration,"browserGeneration"),driver:r,...i===void 0?{}:{driverSubscriptionId:i}}}case"browser.surface.closed":{r_(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:UF(t.message,"message",DF);return{type:"browser.surface.closed",subscriptionId:wu(t.subscriptionId,"subscriptionId"),reason:hf(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw Ut("unknown Browser Surface server frame type")}}function IF(e){if(!(e instanceof Uint8Array)||e.byteLength<jl+1||e.byteLength>jl+S0+Z2)throw Ut("Browser Surface image frame has an invalid byte length");for(let y=0;y<Q2.length;y+=1)if(e[y]!==Q2[y])throw Ut("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==NF||t.getUint16(6,!1)!==0)throw Ut("Browser Surface image frame header is unsupported");const r=t.getUint8(5),i=r===LF?"jpeg":r===OF?"png":void 0;if(i===void 0)throw Ut("Browser Surface image frame format is unsupported");const s=t.getUint16(32,!1),o=t.getUint32(34,!1);if(s===0||s>S0||o===0||o>Z2||jl+s+o!==e.byteLength)throw Ut("Browser Surface image frame lengths are invalid");let u;try{u=BF.decode(e.subarray(jl,jl+s))}catch{throw Ut("subscriptionId must be valid UTF-8")}u=wu(u,"subscriptionId");const d=e5(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),h=e5(t.getBigUint64(20,!1),"timestampMilliseconds"),g=Hf(t.getUint16(28,!1),"width"),p=Hf(t.getUint16(30,!1),"height");return ZT(g,p),{subscriptionId:u,frameSequence:d,viewportRevision:m,timestampMilliseconds:h,width:g,height:p,format:i,encodedBytes:new Uint8Array(e.subarray(jl+s))}}function zF(e){let t=e;if(typeof e=="string"){if(Uf.encode(e).byteLength>X2)throw Ut("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw Ut("Browser Surface control frame must be valid JSON")}}const r=$F(t,"Browser Surface control frame");let i;try{i=JSON.stringify(r)}catch{throw Ut("Browser Surface control frame must be serializable")}if(Uf.encode(i).byteLength>X2)throw Ut("Browser Surface control frame exceeds its byte limit");return r}function $F(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw Ut(`${t} must be an object`);return e}function r_(e,t,r,i=!1){const s=Object.keys(e),o=i?t.length-1:t.length;if(s.length<o||s.length>t.length||s.some(u=>!t.includes(u))||t.slice(0,o).some(u=>!Object.hasOwn(e,u)))throw Ut(`${r} contains unknown or missing fields`)}function wu(e,t){if(typeof e!="string"||e.length===0||Uf.encode(e).byteLength>S0||!/^[\x21-\x7e]+$/.test(e))throw Ut(`${t} must be a bounded opaque identifier`);return e}function UF(e,t,r){if(typeof e!="string"||e.includes("\0")||Uf.encode(e).byteLength>r)throw Ut(`${t} exceeds its text byte limit`);return e}function J2(e,t){if(!Number.isSafeInteger(e)||e<1)throw Ut(`${t} must be a positive safe integer`);return e}function HF(e,t){if(!Number.isSafeInteger(e)||e<0)throw Ut(`${t} must be a nonnegative safe integer`);return e}function FF(e,t,r,i){if(!Number.isInteger(e)||e<t||e>r)throw Ut(`${i} must be an integer from ${t} to ${r}`);return e}function WF(e,t,r,i){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw Ut(`${i} must be a finite number from ${t} to ${r}`);return e}function Hf(e,t){const r=t.toLowerCase().includes("height")?TF:AF;return FF(e,1,r,t)}function ZT(e,t){if(e*t>MF)throw Ut("Browser Surface viewport exceeds its maximum pixels")}function qF(e){return hf(e,["jpeg","png"],"format")}function hf(e,t,r){if(typeof e!="string"||!t.includes(e))throw Ut(`${r} is unsupported`);return e}function e5(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw Ut(`${t} exceeds a safe integer`);return Number(e)}function Ut(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const t5=1e4,VF=16,i_=1,r5=[500,1e3,2e3,4e3,8e3,15e3];function GF(e){const t=Math.max(0,Math.min(Math.trunc(e),r5.length-1));return r5[t]}function YF(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function KF(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function QT(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function Wh(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 XF(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(Ay)}function ZF(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function QF(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(Ay)}async function JF(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 eW({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:i=t}){const s=Math.max(0,r-t),o=r-i>i_;return{hasOverflow:o,canScrollLeft:o&&e>i_,canScrollRight:o&&e<s-i_}}function tW(e){return Math.max(120,e*.75)}function rW({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 iW(e,t,r,i){return{deltaX:i5(e+r),deltaY:i5(t+i)}}function i5(e){return Number.isFinite(e)?Math.max(-t5,Math.min(t5,e)):0}function nW(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>jF){if(r.push(i),r.length>=VF)throw new RangeError("Browser text input is too large");i="",s=0}i+=o,s+=u}return i&&r.push(i),r}function sW(e,t){if(t.type==="pointerdown"){const i=n5(t.button);return i&&e.set(t.pointerId,i),i}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??n5(t.button)}function n5(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 aW=1,oW=2;function lW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i,toolbarHost:s}){const o=v.useRef(null),u=v.useRef(null),d=v.useRef(void 0),m=v.useRef(void 0),h=v.useRef(0),g=v.useRef(0),p=v.useRef(0),y=v.useRef(0),b=v.useRef(void 0),w=v.useRef(!1),C=v.useRef(!1),E=v.useRef(!1),S=v.useRef(void 0),N=v.useRef(void 0),k=v.useRef(void 0),R=v.useRef(new Map),[M,L]=v.useState("connecting"),[z,D]=v.useState(),[W,G]=v.useState(),[q,B]=v.useState("none"),[j,O]=v.useState(),[$,T]=v.useState(!1),[U,H]=v.useState(!1),F=q==="stream"&&j===(W==null?void 0:W.subscriptionId),V=v.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=v.useCallback(()=>{b.current!==void 0&&(window.clearTimeout(b.current),b.current=void 0)},[]),Y=v.useCallback(async({refreshCapability:ve=!1,preserveFrame:Ae=!1}={})=>{var ze;I();const Ie=++p.current;(ze=d.current)==null||ze.close(1e3,"Browser Surface reconnecting"),d.current=void 0,m.current=void 0,h.current=0,g.current=0,E.current=!1,C.current=!1,V(),L("connecting"),D(void 0),G(void 0),B("none"),O(void 0),H(!1),Ae||(w.current=!1,T(!1));const Oe=rt=>{if(p.current!==Ie)return;D(rt),L("connecting");const Be=GF(y.current++);b.current=window.setTimeout(()=>{b.current=void 0,Y({preserveFrame:!0})},Be)};try{const rt=await Uu(ve);if(p.current!==Ie)return;const Be=new WebSocket(dW({runtimeSelector:e,sessionId:t,pageId:i,browserGeneration:r,capability:rt}));Be.binaryType="arraybuffer",d.current=Be;let dt=ve,He=!1;Be.onmessage=Ot=>{var gi;if(p.current!==Ie||d.current!==Be)return;if(typeof Ot.data=="string"){try{const Bt=JSON.parse(Ot.data);if(Bt&&typeof Bt=="object"&&"type"in Bt&&Bt.type==="error"){const At="message"in Bt&&typeof Bt.message=="string"?Bt.message:"Browser Surface failed";D(At);return}const gt=PF(Bt);if(gt.type==="browser.surface.ready"){m.current=gt,h.current=gt.viewportRevision,I(),G(gt),L("ready");return}if(gt.type==="browser.surface.driver.changed"){const At=gt.driver==="stream"&>.driverSubscriptionId===((gi=m.current)==null?void 0:gi.subscriptionId);E.current=At,At||V(),B(gt.driver),O(gt.driverSubscriptionId);return}E.current=!1,V();const ur=gt.message??hW(gt.reason);He=!0,KF(gt.reason)?(Oe(ur),Be.close(1e3,"recovering Browser Surface")):(D(ur),L("closed"))}catch{He=!0,D("Browser Surface sent an invalid control frame"),L("closed"),Be.close(4400,"invalid Browser Surface control")}return}if(!(Ot.data instanceof ArrayBuffer)){D("Browser Surface sent an invalid image frame"),Be.close(4400,"invalid Browser Surface image");return}const Ht=()=>p.current===Ie&&d.current===Be;cW(Ot.data,Be,o.current,m.current,Ht).then(Bt=>{Bt===void 0||!Ht()||(h.current=Bt,w.current=!0,C.current=!0,y.current=0,T(!0),H(!0))}).catch(()=>{Ht()&&(He=!0,D("Browser preview could not be decoded"),L("closed"),Be.close(4400,"Browser Surface image decode failed"))})},Be.onclose=Ot=>{if(!(p.current!==Ie||d.current!==Be)&&(d.current=void 0,E.current=!1,V(),!He)){if((Ot.code===4403||Ot.code===1006)&&!dt){dt=!0,Y({refreshCapability:!0,preserveFrame:!0});return}if(YF(Ot.code)){Oe(o5(Ot.code));return}L("closed"),D(Ht=>Ht??o5(Ot.code))}},Be.onerror=()=>{d.current===Be&&D("Browser preview transport failed")}}catch(rt){if(p.current!==Ie)return;Oe(rt instanceof Error?rt.message:"Browser preview could not connect")}},[e,t,i,r,V,I]);v.useEffect(()=>(Y(),()=>{var ve;p.current+=1,I(),V(),(ve=d.current)==null||ve.close(1e3,"Browser Surface view unmounted"),d.current=void 0}),[Y,V,I]);const X=v.useCallback(()=>{y.current=0,Y({preserveFrame:!0})},[Y]),ee=v.useCallback(ve=>{const Ae=d.current;return!Ae||Ae.readyState!==WebSocket.OPEN?!1:(Ae.send(JSON.stringify(ve)),!0)},[]),re=v.useCallback(()=>{var Ae;const ve=m.current;!ve||!C.current||(ee({type:"browser.surface.driver.take",subscriptionId:ve.subscriptionId,browserGeneration:ve.browserGeneration,viewportRevision:h.current}),(Ae=u.current)==null||Ae.focus())},[ee]),oe=v.useCallback(()=>{const ve=m.current;ve&&(V(),u.current&&(u.current.value=""),ee({type:"browser.surface.driver.release",subscriptionId:ve.subscriptionId,browserGeneration:ve.browserGeneration}))},[ee,V]),Z=v.useCallback(ve=>{const Ae=m.current;return!Ae||!C.current||!E.current?!1:ee({type:"browser.surface.input",subscriptionId:Ae.subscriptionId,browserGeneration:Ae.browserGeneration,viewportRevision:h.current,inputSequence:g.current++,event:ve})},[ee]),ce=v.useCallback(ve=>{let Ae;try{Ae=nW(ve)}catch{return D("Text input is limited to 64 KiB at a time."),!1}let Ie=!1;for(const Oe of Ae){if(!Z({type:"text.insert",text:Oe}))return Ie;Ie=!0}return Ie},[Z]),ne=v.useCallback(()=>{k.current!==void 0&&(window.cancelAnimationFrame(k.current),k.current=void 0);const ve=S.current,Ae=N.current;S.current=void 0,N.current=void 0,E.current&&(ve&&Z({...ve}),Ae&&Z({...Ae}))},[Z]),we=v.useCallback(()=>{k.current===void 0&&(k.current=window.requestAnimationFrame(ne))},[ne]);v.useEffect(()=>{E.current=F,F||(V(),u.current&&(u.current.value="",u.current.blur()))},[F,V]);const _e=v.useCallback(ve=>{var rt;if(!F)return;const Ae=s5(ve.currentTarget,ve.clientX,ve.clientY);if(!Ae)return;if(ve.type==="pointermove"){S.current={type:"pointer.move",...Ae,modifiers:qh(ve)},we(),ve.preventDefault();return}ne(),ve.type==="pointerdown"&&((rt=u.current)==null||rt.focus(),ve.currentTarget.setPointerCapture(ve.pointerId));const Ie=ve.type==="pointerdown"?"pointer.down":"pointer.up",Oe=sW(R.current,ve);if(!Oe)return;const ze={type:Ie,...Ae,button:Oe,modifiers:qh(ve)};Z(ze)&&ve.preventDefault()},[F,Z,ne,we]),ye=v.useCallback(ve=>{if(!F)return;const Ae=s5(ve.currentTarget,ve.clientX,ve.clientY);if(!Ae)return;const Ie=ve.deltaMode===aW?16:ve.deltaMode===oW?Math.max(1,ve.currentTarget.clientHeight):1,Oe=N.current,ze=iW((Oe==null?void 0:Oe.deltaX)??0,(Oe==null?void 0:Oe.deltaY)??0,ve.deltaX*Ie,ve.deltaY*Ie);N.current={type:"wheel",...Ae,...ze,modifiers:qh(ve)},we(),ve.preventDefault()},[F,we]),J=v.useCallback(ve=>{if(ve.nativeEvent.isComposing||ve.key==="Process"||ve.key==="Dead")return;ne();const Ae=Z({type:ve.type==="keydown"?"key.down":"key.up",key:ve.key,code:ve.code,repeat:ve.repeat,modifiers:qh(ve)}),Ie=uW({type:ve.type,key:ve.key,altKey:ve.altKey,ctrlKey:ve.ctrlKey,metaKey:ve.metaKey,isComposing:ve.nativeEvent.isComposing}),Oe=Ie===void 0?!1:ce(Ie);(Ae||Oe)&&ve.preventDefault()},[Z,ce,ne]),ie=v.useCallback(ve=>{ne();const Ae=ve.clipboardData.getData("text/plain");Ae&&ce(Ae)&&ve.preventDefault()},[ce,ne]),Ee=v.useCallback(ve=>{const Ae=ve.data||ve.currentTarget.value;ve.currentTarget.value="",Ae&&ce(Ae)},[ce]);return l.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]",children:[l.jsx("canvas",{ref:o,className:"max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-label":F?"Interactive browser preview":"Browser preview",tabIndex:-1,onPointerMove:_e,onPointerDown:_e,onPointerUp:_e,onPointerCancel:_e,onWheel:ye}),l.jsx("textarea",{ref:u,"aria-label":"Browser keyboard input",className:"pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0",tabIndex:F?0:-1,autoComplete:"off",spellCheck:!1,onKeyDown:J,onKeyUp:J,onPaste:ie,onCompositionEnd:Ee}),M==="connecting"&&l.jsx(a5,{preserveFrame:$,icon:l.jsx(Qe,{className:"size-5 animate-spin"}),label:$?"Reconnecting preview…":"Connecting preview…"}),M==="ready"&&!U&&l.jsx(a5,{icon:l.jsx(Qe,{className:"size-5 animate-spin"}),label:"Waiting for first frame…"}),M==="closed"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center",children:l.jsxs("div",{className:"max-w-sm",children:[l.jsx("p",{className:"text-sm font-medium text-white",children:"Preview disconnected"}),l.jsx("p",{role:"alert",className:"mt-1 text-xs leading-5 text-white/60",children:z??"The Browser Surface ended."})]})}),s&&Ia.createPortal(l.jsx("div",{className:"flex items-center",children:M==="closed"?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:X,children:l.jsx(Nt,{className:"size-4"})}):M!=="ready"||!U?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":w.current?"Reconnecting browser preview":"Connecting browser preview",title:w.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:l.jsx(Qe,{className:"size-4 animate-spin"})}):F?l.jsx(he,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:oe,children:l.jsx(ZO,{className:"size-4"})}):l.jsx(he,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:re,children:l.jsx(JO,{className:"size-4"})})}),s),l.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:z??(F?"Browser control active":`Browser preview ${M}`)})]})}async function cW(e,t,r,i,s){const o=IF(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 uW(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 dW(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 s5(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 qh(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 a5({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 hW(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 o5(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 fW=400;function mW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}){const s=v.useRef(null),[o,u]=v.useState(0),[d,m]=v.useState("mounting"),[h,g]=v.useState("unavailable"),[p,y]=v.useState(!1),[b,w]=v.useState(),C=v.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:i}),[e,t,r,i]);v.useEffect(()=>{const S=window.rynxDesktopBrowser,N=s.current;if(!S||!N){m("unavailable");return}let k=!1,R=0,M;const L=n_(C),z=async()=>{if(k)return;const B=pW(N.getBoundingClientRect());if(!B){S.park(C);return}try{const j=await S.mount(C,B);if(k)return;if(j==="mounted"){m("mounted"),M!==void 0&&window.clearTimeout(M),M=void 0;return}}catch{}k||(m("mounting"),M=window.setTimeout(()=>void z(),fW))},D=()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>void z())},W=new ResizeObserver(D);W.observe(N),window.addEventListener("resize",D),window.addEventListener("scroll",D,!0);const G=S.onState(B=>{if(n_(B.resource)===L){if(B.state==="closed"){m("unavailable");return}D()}}),q=S.onDriver(B=>{n_(B.resource)===L&&(g(B.driver),B.driver==="desktop"&&(y(!1),w(void 0)))});return g(S.getDriver(C)),m("mounting"),D(),()=>{k=!0,W.disconnect(),G(),q(),window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0),window.cancelAnimationFrame(R),M!==void 0&&window.clearTimeout(M),S.park(C)}},[C,o]);const E=async()=>{const S=window.rynxDesktopBrowser;if(!(!S||p)){y(!0),w(void 0);try{if(await S.takeBack(C)!=="taken")throw new Error("The remote controller is no longer available.")}catch(N){y(!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(Qe,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),l.jsxs(he,{size:"sm",variant:"outline",onClick:()=>u(S=>S+1),children:[l.jsx(Nt,{}),"Retry"]})]})}),d==="mounted"&&h==="stream"&&l.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:l.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[l.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),l.jsxs(he,{className:"mt-3",size:"sm",disabled:p,onClick:()=>void E(),children:[p?l.jsx(Qe,{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 pW(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 n_(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const gW="size-11 sm:size-8";function vW({sessionId:e,runtimeSelector:t,pageId:r,browserResource:i}){const{browser:s,loading:o,pendingAction:u,error:d,disabled:m,load:h,openBrowser:g,closeBrowser:p,recreateForDesktop:y,navigatePage:b,backPage:w,forwardPage:C,reloadPage:E}=i,S=v.useMemo(()=>s==null?void 0:s.pages.find(D=>D.pageId===r),[s,r]),N=s!==null&&XF(t,s,typeof window.rynxDesktopBrowser<"u"),k=s!==null&&s.sessionId===e&&ZF(t,s,typeof window.rynxDesktopBrowser<"u"),R=s!==null&&s.sessionId===e&&QF(t,s,typeof window.rynxDesktopBrowser<"u"),M=v.useRef(null),[L,z]=v.useState(null);return v.useEffect(()=>{const D=`${t}
|
|
536
|
+
${e}`;!k||M.current===D||(M.current=D,y())},[k,y,t,e]),o&&s===null?l.jsx(s_,{label:"Loading browser…"}):s===null?l.jsx(_W,{error:d,pending:u!==null,onOpen:D=>void g(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(Vh,{label:"Go back",disabled:m||!(S!=null&&S.canGoBack),onClick:()=>S&&void w(S.pageId),children:l.jsx(Gl,{})}),l.jsx(Vh,{label:"Go forward",disabled:m||!(S!=null&&S.canGoForward),onClick:()=>S&&void C(S.pageId),children:l.jsx(SR,{})}),l.jsx(Vh,{label:"Reload page",disabled:m||!S,onClick:()=>S&&void E(S.pageId),children:l.jsx(DR,{className:S!=null&&S.loading?"animate-spin":void 0})})]}),S?l.jsx(xW,{page:S,disabled:m,onNavigate:D=>void b(S.pageId,D)},`${S.pageId}
|
|
537
|
+
${S.url}`):l.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!N&&l.jsx("div",{ref:z,className:"flex shrink-0 items-center"}),R&&l.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:u!==null,onClick:()=>void y(),children:"Open in app"}),l.jsx(Vh,{label:"Stop browser",disabled:u!==null,onClick:()=>void p(),children:l.jsx(Ef,{})})]}),l.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[k?l.jsx(s_,{label:"Opening in Desktop…"}):s.status==="ready"&&S?N?l.jsx(mW,{runtimeSelector:t,sessionId:e,browserGeneration:s.browserGeneration,pageId:S.pageId}):l.jsx(lW,{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(yW,{error:d,pending:u!==null,onRestart:()=>void g()}):l.jsx(s_,{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 _W({error:e,pending:t,onOpen:r,onRetry:i}){const[s,o]=v.useState(""),u=d=>{d.preventDefault(),r(QT(s))};return l.jsx(yn,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:l.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:l.jsxs("form",{onSubmit:u,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:l.jsx(Lu,{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(xt,{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(Qe,{className:"animate-spin"}):l.jsx(Lu,{}),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 xW({page:e,disabled:t,onNavigate:r}){const[i,s]=v.useState(e.url),o=u=>{u.preventDefault();const d=QT(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(xt,{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 Vh({label:e,disabled:t,onClick:r,children:i}){return l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:gW,"aria-label":e,title:e,disabled:t,onClick:r,children:i})}function s_({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(Qe,{className:"size-4 animate-spin"}),e]})}function yW({error:e,pending:t,onRestart:r}){return l.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center",role:"status",children:[l.jsx(Nt,{className:"size-5 text-[var(--muted-foreground)]"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),l.jsxs(he,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&l.jsx(Qe,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function bW(e,t,r,i){return r===i?t:e}new TextEncoder;const wW=4,SW=5*1024*1024,CW=20*1024*1024,EW=8192,RW=4e7,kW=["image/png","image/jpeg","image/webp"];function NW(){return{enabled:!0,mediaTypes:[...kW],maxImagesPerMessage:wW,maxImageBytes:SW,maxMessageBytes:CW,maxImageSide:EW,maxImagePixels:RW}}function JT(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const C0=NW(),l5={...C0,enabled:!1};function eM({policy:e,upload:t,deleteResource:r,onChange:i}){const[s,o]=v.useState([]),u=v.useRef([]),d=v.useRef(new Map),m=v.useCallback(b=>{o(w=>{const C=b(w);return u.current=C,C})},[]);v.useEffect(()=>()=>{for(const b of d.current.values())b.abort();for(const b of u.current)URL.revokeObjectURL(b.previewUrl)},[]);const h=v.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=Wu("attachment"),N=Wu("upl"),k=URL.createObjectURL(E),R=E.type;if(!e.mediaTypes.includes(R)){m(z=>[...z,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:"Unsupported image type"}]);continue}if(E.size<=0||E.size>e.maxImageBytes){m(z=>[...z,{id:S,file:E,clientUploadId:N,previewUrl:k,state:"failed",error:`Image must be smaller than ${AW(e.maxImageBytes)}`}]);continue}const M={id:S,file:E,clientUploadId:N,previewUrl:k,state:t?"uploading":"ready"};if(m(z=>[...z,M]),!t)continue;const L=new AbortController;d.current.set(S,L),t(E,N,L.signal).then(z=>{if(d.current.delete(S),!u.current.some(D=>D.id===S)){r==null||r(z).catch(()=>{});return}m(D=>D.map(W=>W.id===S?{...W,state:"ready",resource:z}:W))}).catch(z=>{d.current.delete(S),!L.signal.aborted&&m(D=>D.map(W=>W.id===S?{...W,state:"failed",error:z instanceof Error?z.message:"Upload failed"}:W))})}}},[r,i,e,m,t]),g=v.useCallback(b=>{const w=Array.from(b.clipboardData.files).filter(C=>C.type.startsWith("image/"));w.length!==0&&(b.preventDefault(),h(w))},[h]),p=v.useCallback(b=>{var w;i==null||i(),(w=d.current.get(b.id))==null||w.abort(),d.current.delete(b.id),m(C=>C.filter(E=>E.id!==b.id)),URL.revokeObjectURL(b.previewUrl),b.resource&&(r==null||r(b.resource).catch(()=>{}))},[r,i,m]),y=v.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:g,remove:p,clear:y,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 tM({images:e,disabled:t,onRemove:r,className:i}){return e.length===0?null:l.jsx("div",{className:qe("flex gap-2 overflow-x-auto px-2 pb-2",i),"aria-label":"Attached images",children:e.map(s=>l.jsxs("div",{className:"group relative size-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",title:s.error??s.file.name,children:[l.jsx("img",{src:s.previewUrl,alt:s.file.name,className:"size-full object-cover"}),s.state==="uploading"&&l.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:l.jsx(Qe,{className:"size-5 animate-spin"})}),s.state==="failed"&&l.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white",children:"Upload failed"}),l.jsx("button",{type:"button",className:"absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45","aria-label":`Remove ${s.file.name}`,disabled:t,onClick:()=>r(s),children:l.jsx(Na,{className:"size-3"})})]},s.id))})}function rM({policy:e,imageCount:t,disabled:r,onFiles:i,className:s}){const o=v.useRef(null);function u(d){i(Array.from(d.target.files??[])),d.target.value=""}return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:o,type:"file",accept:e.mediaTypes.join(","),multiple:!0,className:"hidden",onChange:u}),l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:qe("size-8 shrink-0",s),disabled:r||!e.enabled||t>=e.maxImagesPerMessage,"aria-label":"Attach images",title:`Attach up to ${e.maxImagesPerMessage} images`,onClick:()=>{var d;return(d=o.current)==null?void 0:d.click()},children:t>0?l.jsx(TO,{}):l.jsx(lB,{})})]})}function AW(e){return`${Math.round(e/(1024*1024))} MB`}const a_=200;function TW({initialDraft:e,model:t,running:r,disabled:i,sessionId:s,runtimeSelector:o,onSend:u,onStop:d}){const[m,h]=v.useState(e??""),[g,p]=v.useState(l5),[y,b]=v.useState(!1),w=v.useRef(null),C=v.useRef(!1),E=v.useRef(void 0),S=v.useRef(0),N=v.useRef(!1),k=eM({policy:g,upload:(L,z,D)=>be.uploadSessionResource(o,s,L,z,D),deleteResource:L=>be.deleteSessionResource(o,s,L.resourceId),onChange:()=>{E.current=void 0}});v.useEffect(()=>{let L=!1;return be.getSessionResourcePolicy(o,s).then(z=>{L||p(z)}).catch(()=>{L||p(l5)}),()=>{L=!0}},[o,s]),v.useLayoutEffect(()=>{const L=w.current;if(!L)return;L.style.height="auto";const z=L.scrollHeight;L.style.height=`${Math.min(z,a_)}px`,L.style.overflowY=z>a_?"auto":"hidden"},[m]);async function R(){if(N.current)return;const L=m,z=S.current,D=m.trim(),W=k.readyResources;if(!D&&W.length===0||k.hasPending||k.hasFailed)return;const G=W.length>0?E.current??Wu("msg"):void 0;G&&(E.current=G),N.current=!0,b(!0),h("");try{await u({text:D,images:W,clientMessageId:G}),k.clear(),E.current=void 0}catch(q){xe.error(`Could not send message: ${q instanceof Error?q.message:"unknown error"}`),ky(q)?h(B=>bW(B,L,S.current,z)):(k.clear(),E.current=void 0)}finally{N.current=!1,b(!1)}}const M=!i&&!y&&!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(tM,{images:k.images,disabled:y,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=>{y||k.onPaste(L)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:L=>{L.key==="Enter"&&!L.shiftKey&&!C.current&&!L.nativeEvent.isComposing&&L.keyCode!==229&&(L.preventDefault(),M&&R())},className:qe("block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5","text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]","focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"),style:{maxHeight:a_}}),l.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[l.jsx(rM,{policy:g,imageCount:k.images.length,disabled:i||y,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(UB,{})," Stop"]}):l.jsxs(he,{className:"ml-auto h-8 shrink-0",onClick:R,disabled:!M,children:[l.jsx(OR,{})," Send"]})]})]})})}const iM=24,MW={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function jW({pages:e,order:t,selectedPageId:r,selectionDisabled:i,mutationDisabled:s,createDisabled:o,createPending:u,emulatorAttached:d,emulator:m,onSelectPage:h,onClosePage:g,onCreatePage:p,onSelectEmulator:y,onCloseEmulator:b,onAddEmulator:w,headerLeadingAction:C,leadingAction:E,trailingAction:S}){const N=v.useRef(null),k=v.useRef(null),R=v.useRef(null),M=v.useRef(null),L=v.useRef(null),z=v.useRef(null),[D,W]=v.useState(MW),G=t.flatMap(F=>{if(F===Fn())return m?[{type:"emulator",key:F,emulator:m}]:[];const V=e.find(I=>Hn(I.pageId)===F);return V?[{type:"browser",key:F,page:V}]:[]}),q=G.map(F=>F.key).join(`
|
|
538
|
+
`),B=G.length,j=v.useCallback(()=>{const F=N.current,V=k.current,I=R.current;if(!(!F||!V||!I))return eW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,contentWidth:I.scrollWidth,availableWidth:F.clientWidth})},[]),O=v.useCallback(()=>{const F=j();F&&W(V=>DW(V,F)?V:F)},[j]),$=v.useCallback(()=>{L.current===null&&(L.current=window.requestAnimationFrame(()=>{L.current=null,O()}))},[O]),T=v.useCallback(F=>{const V=k.current,I=M.current;if(!V||!I)return;const Y=V.getBoundingClientRect(),X=I.getBoundingClientRect(),ee=rW({scrollLeft:V.scrollLeft,viewportWidth:V.clientWidth,tabLeft:V.scrollLeft+X.left-Y.left,tabWidth:X.width,inset:iM});ee!==0&&V.scrollBy({left:ee,behavior:F})},[]),U=v.useCallback(F=>{const V=k.current;if(!V)return;const I=tW(V.clientWidth);V.scrollBy({left:F==="left"?-I:I,behavior:u5()})},[]);v.useEffect(()=>()=>{L.current!==null&&window.cancelAnimationFrame(L.current)},[]),v.useLayoutEffect(()=>{const F=N.current,V=k.current,I=R.current;if(!F||!V||!I)return;const Y=()=>{const ee=V.clientWidth,re=z.current===null||Math.abs(ee-z.current)>1;z.current=ee,$(),re&&T("auto")},X=typeof ResizeObserver>"u"?void 0:new ResizeObserver(Y);return X==null||X.observe(F),X==null||X.observe(V),X==null||X.observe(I),window.addEventListener("resize",Y),O(),()=>{X==null||X.disconnect(),window.removeEventListener("resize",Y)}},[T,$,O]),v.useEffect(()=>{const F=k.current;if(!F)return;const V=I=>{if(I.ctrlKey||I.deltaY===0||Math.abs(I.deltaY)<=Math.abs(I.deltaX))return;const Y=j();(I.deltaY<0?Y!=null&&Y.canScrollLeft:Y!=null&&Y.canScrollRight)&&(I.preventDefault(),F.scrollLeft+=I.deltaY,$())};return F.addEventListener("wheel",V,{passive:!1}),()=>F.removeEventListener("wheel",V)},[j,$]),v.useLayoutEffect(()=>{T(u5()),$()},[q,T,$,D.hasOverflow,r]);function H(F,V){var X;let I;if(F.key==="ArrowLeft"?I=(V-1+B)%B:F.key==="ArrowRight"?I=(V+1)%B:F.key==="Home"?I=0:F.key==="End"&&(I=B-1),I===void 0||I===V)return;F.preventDefault();const Y=(X=R.current)==null?void 0:X.querySelectorAll('[role="tab"]').item(I);Y==null||Y.focus(),Y==null||Y.click()}return l.jsxs("div",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[C&&l.jsx("div",{className:"mb-1 flex h-8 shrink-0 items-center",children:C}),l.jsxs("div",{ref:N,className:"flex min-w-0 flex-1 items-end gap-1",children:[D.hasOverflow&&l.jsx(c5,{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:LW(D),onScroll:$,children:l.jsx("div",{ref:R,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:G.map((F,V)=>{if(F.type==="emulator"){const ee=F.emulator;return l.jsxs("div",{ref:ee.selected?M:void 0,role:"presentation",className:ee.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":ee.selected,"aria-label":ee.label,title:ee.label,tabIndex:ee.selected?0:-1,onClick:y,onKeyDown:re=>H(re,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[ee.busy?l.jsx(Qe,{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(Na,{className:"size-3"})})]},F.key)}const I=F.page,Y=I.pageId===r,X=I.title||I.url||"New page";return l.jsxs("div",{ref:Y?M:void 0,role:"presentation",className:Y?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":Y,"aria-label":X,title:X,tabIndex:Y?0:-1,disabled:i,onClick:()=>h(I.pageId),onKeyDown:ee=>H(ee,V),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[I.loading?l.jsx(Qe,{className:"size-3 shrink-0 animate-spin"}):l.jsx(Lu,{className:"size-3 shrink-0"}),l.jsx("span",{className:"truncate",children:X})]}),l.jsx(he,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${X}`,title:`Close ${X}`,disabled:s,onClick:()=>g(I.pageId),className:"ml-1",children:l.jsx(Na,{className:"size-3"})})]},F.key)})})}),D.hasOverflow&&l.jsx(c5,{direction:"right",disabled:!D.canScrollRight,onClick:()=>U("right")})]}),E&&l.jsx("div",{className:"mb-1 shrink-0",children:E}),l.jsxs(G_,{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(Qi,{})})}),l.jsxs(Bf,{align:"end",children:[l.jsxs(Pf,{disabled:o,"aria-busy":u,onSelect:p,children:[u?l.jsx(Qe,{className:"animate-spin"}):l.jsx(Lu,{}),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 c5({direction:e,disabled:t,onClick:r}){const i=e==="left"?ER: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 u5(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function DW(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function LW(e){const t=`${iM}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 OW=8,BW=256,PW=4e3;function IW({sessionId:e,runtimeSelector:t,controller:r}){return r.binding?l.jsx($W,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r}):l.jsx(zW,{controller:r})}function zW({controller:e}){const[t,r]=v.useState(null),i=async s=>{r(s);try{await e.attach(s)}catch(o){xe.error(`Could not attach Emulator: ${o.message}`)}finally{r(null)}};return l.jsx(yn,{className:"min-h-0 flex-1",children:l.jsx("div",{className:"p-4 sm:p-5",children:l.jsxs("div",{className:"mx-auto max-w-2xl",children:[l.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),l.jsx(he,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:l.jsx(Nt,{className:qe("size-4",e.devicesLoading&&"animate-spin")})})]}),e.error&&l.jsx("div",{className:"mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:e.error.message}),e.devicesLoading&&e.devices.length===0?l.jsx("div",{className:"grid min-h-40 place-items-center","aria-live":"polite",children:l.jsx(sM,{icon:l.jsx(Qe,{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(P_,{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(Qe,{className:"size-4 animate-spin"}):l.jsx(P_,{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(nM,{state:s.state}),l.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:s.backend})]})]})]},`${s.backend}:${s.id}`))})]})})})}function $W({sessionId:e,runtimeSelector:t,binding:r,controller:i}){const[s,o]=v.useState(null),[u,d]=v.useState(!1),[m,h]=v.useState(null),[g,p]=v.useState(null),y=v.useRef(null),b=v.useRef(null),w=v.useRef(null),C=v.useRef(null),E=v.useRef(null);v.useEffect(()=>{o(null),d(!1),p(null),h(null);let D=!1,W,G,q=0,B=0,j=!1,O=null,$,T="png";const U=()=>{G!==void 0&&window.clearTimeout(G),G=void 0,h(null)},H=(Y,X=!1)=>{if(G!==void 0&&window.clearTimeout(G),X||O===null){h(Y);return}G=window.setTimeout(()=>{G=void 0,D||h(Y)},PW)},F=Y=>{if(D)return;const X=URL.createObjectURL(Y),ee=O;O=X,o(X),U(),q=0,j=!1,ee&&window.setTimeout(()=>URL.revokeObjectURL(ee),1e3)},V=(Y,X=!1)=>{if(D)return;W!==void 0&&window.clearTimeout(W);const ee=X?0:Math.min(8e3,500*2**q++);W=window.setTimeout(()=>void Y(X),ee)},I=async(Y=!1)=>{const X=++B;try{const ee=await Uu(Y);if(D||X!==B)return;const re=new WebSocket(UW({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:ee}));$=re,re.binaryType="arraybuffer",re.onmessage=oe=>{if(D||X!==B||$!==re)return;if(typeof oe.data=="string"){try{const ne=JSON.parse(oe.data);if(ne.type!=="emulator.surface.ready"||typeof ne.surfaceId!="string"||ne.format!=="png"&&ne.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");T=ne.format,b.current={socket:re,surfaceId:ne.surfaceId,inputSequence:0}}catch{re.close(4400,"invalid Emulator Surface ready frame")}return}const Z=oe.data instanceof ArrayBuffer||oe.data instanceof Blob?oe.data:null,ce=T==="jpeg"?"image/jpeg":"image/png";Z instanceof Blob?F(new Blob([Z],{type:ce})):Z&&F(new Blob([Z],{type:ce}))},re.onclose=oe=>{var ce;if(D||X!==B||$!==re)return;((ce=b.current)==null?void 0:ce.socket)===re&&(b.current=null);const Z=new Error(oe.code===4406?"emulator_surface_upgrade_required":oe.reason||"Remote Emulator Surface disconnected");H(Z,oe.code===4406),oe.code!==4406&&((oe.code===4403||oe.code===1006)&&!j?(j=!0,V(I,!0)):V(I))},re.onerror=()=>{}}catch(ee){if(D||X!==B)return;H(ee instanceof Error?ee:new Error(String(ee))),V(I)}};return I(),()=>{D=!0,B+=1,b.current=null,$==null||$.close(1e3,"Session Emulator pane closed"),W!==void 0&&window.clearTimeout(W),G!==void 0&&window.clearTimeout(G),O&&URL.revokeObjectURL(O)}},[r.backend,r.bindingId,t,e]);const S=v.useCallback((D,W,G)=>{const q=b.current;if(!q||q.socket.readyState!==WebSocket.OPEN||G!==void 0&&q.surfaceId!==G)return!1;try{return q.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:q.surfaceId,inputSequence:q.inputSequence++,phase:D,...W})),!0}catch{return!1}},[]),N=v.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=v.useCallback(D=>{const W=y.current;if(!W)return null;const G=W.getBoundingClientRect();return G.width<=0||G.height<=0?null:{x:Math.max(0,Math.min(1,(D.clientX-G.left)/G.width)),y:Math.max(0,Math.min(1,(D.clientY-G.top)/G.height))}},[]),R=D=>{var B;if(i.mutating)return;const W=k(D.nativeEvent);if(!W)return;D.currentTarget.setPointerCapture(D.pointerId);const G=((B=b.current)==null?void 0:B.surfaceId)??null,q=G!==null&&S("begin",W,G);E.current={pointerId:D.pointerId,startX:D.clientX,startY:D.clientY,lastPoint:W,points:[{type:"begin",...W}],live:q,surfaceId:q?G:null}},M=D=>{const W=E.current;if(!W||W.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);G&&W.live?(W.lastPoint=G,w.current=W.surfaceId?{...G,surfaceId:W.surfaceId}:null,C.current===null&&(C.current=window.requestAnimationFrame(()=>N()))):G&&W.points.length<BW-1&&(W.lastPoint=G,W.points.push({type:"move",...G}))},L=D=>{const W=E.current;if(E.current=null,!W||W.pointerId!==D.pointerId)return;const G=k(D.nativeEvent);if(!G)return;if(W.live){N(),W.surfaceId&&S("end",G,W.surfaceId);return}(Math.hypot(D.clientX-W.startX,D.clientY-W.startY)>OW?i.gesture([...W.points,{type:"end",...G}]):i.tap(G.x,G.y)).catch(j=>xe.error(`Emulator input failed: ${j.message}`))},z=async()=>{try{await i.detach()}catch(D){xe.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(nM,{state:r.deviceState}),!r.available&&l.jsx(Et,{variant:"outline",children:"Unavailable"}),m&&s&&l.jsxs(Et,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[l.jsx(Qe,{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=>xe.error(`Home failed: ${D.message}`)),children:l.jsx(NR,{})}),l.jsxs(he,{variant:"ghost",size:"sm",disabled:i.mutating,title:"Detach from this session",onClick:()=>void z(),children:[i.mutating?l.jsx(Qe,{className:"animate-spin"}):l.jsx(KB,{}),"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(sM,{icon:l.jsx(Qe,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),m&&!s&&l.jsxs("div",{className:"max-w-sm text-center",children:[l.jsx(P_,{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:y,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:g?{aspectRatio:`${g.width} / ${g.height}`}:void 0})]})]})}function UW(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 nM({state:e}){return l.jsxs(Et,{variant:"outline",className:qe("gap-1 px-1.5 py-0 font-mono text-[8px] uppercase",e==="booted"&&"border-[var(--success)]/30 text-[var(--success)]",e==="shutdown"&&"text-[var(--muted-foreground)]"),children:[l.jsx("span",{className:qe("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function sM({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 aM="rynx.control.theme";function HW(){const e=localStorage.getItem(aM);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ty(){const[e,t]=v.useState(HW);return v.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(aM,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
|
|
539
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
540
|
+
* @license MIT
|
|
541
|
+
*
|
|
542
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
543
|
+
* @license MIT
|
|
544
|
+
*
|
|
545
|
+
* Originally forked from (with the author's permission):
|
|
546
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
547
|
+
* http://bellard.org/jslinux/
|
|
548
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
549
|
+
*/var FW=2,WW=1,qW=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,g=s-m-t;return{cols:Math.max(FW,Math.floor(g/e.css.cell.width)),rows:Math.max(WW,Math.floor(h/e.css.cell.height))}}};/**
|
|
550
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
551
|
+
* @license MIT
|
|
552
|
+
*
|
|
553
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
554
|
+
* @license MIT
|
|
555
|
+
*
|
|
556
|
+
* Originally forked from (with the author's permission):
|
|
557
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
558
|
+
* http://bellard.org/jslinux/
|
|
559
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
560
|
+
*/var VW=class{constructor(t,r,i,s={}){this._terminal=t,this._regex=r,this._handler=i,this._options=s}provideLinks(t,r){let i=YW.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 GW(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 YW=class ff{static computeLink(t,r,i,s){let o=new RegExp(r.source,(r.flags||"")+"g"),[u,d]=ff._getWindowedLineStrings(t-1,i),m=u.join(""),h,g=[];for(;h=o.exec(m);){let p=h[0];if(!GW(p))continue;let[y,b]=ff._mapStrIdx(i,d,0,h.index),[w,C]=ff._mapStrIdx(i,y,b,p.length);if(y===-1||b===-1||w===-1||C===-1)continue;let E={start:{x:b+1,y:y+1},end:{x:C,y:w+1}};g.push({range:E,text:p,activate:s})}return g}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 g=u.getChars();if(u.getWidth()&&(s-=g.length||1,h===m.length-1&&g==="")){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]}},KW=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function XW(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 ZW=class{constructor(t=XW,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,i=r.urlRegex||KW;this._linkProvider=this._terminal.registerLinkProvider(new VW(this._terminal,i,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
|
|
561
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
562
|
+
* @license MIT
|
|
563
|
+
*
|
|
564
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
565
|
+
* @license MIT
|
|
566
|
+
*
|
|
567
|
+
* Originally forked from (with the author's permission):
|
|
568
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
569
|
+
* http://bellard.org/jslinux/
|
|
570
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
571
|
+
*/var QW=(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},JW=(e,t)=>(r,i)=>t(r,i,e),eq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?d5.isErrorNoTelemetry(e)?new d5(e.message+`
|
|
572
|
+
|
|
573
|
+
`+e.stack):new Error(e.message+`
|
|
574
|
+
|
|
575
|
+
`+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)}},tq=new eq;function o_(e){rq(e)||tq.onUnexpectedError(e)}var E0="Canceled";function rq(e){return e instanceof iq?!0:e instanceof Error&&e.name===E0&&e.message===E0}var iq=class extends Error{constructor(){super(E0),this.name=this.message}},d5=class R0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof R0)return t;let r=new R0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},nq;(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})(nq||(nq={}));function sq(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var oM;(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 g(R,M){let L=0;for(let z of R)if(M(z,L++))return!0;return!1}e.some=g;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*y(R,M){for(let L of R)M(L)&&(yield L)}e.filter=y;function*b(R,M){let L=0;for(let z of R)yield M(z,L++)}e.map=b;function*w(R,M){let L=0;for(let z of R)yield*M(z,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let z=L;for(let D of R)z=M(z,D);return z}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let z=R[Symbol.iterator]();for(let D=0;D<M;D++){let W=z.next();if(W.done)return[L,e.empty()];L.push(W.value)}return[L,{[Symbol.iterator](){return z}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(oM||(oM={}));function lM(e){if(oM.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 cM(...e){return qr(()=>lM(e))}function qr(e){return{dispose:sq(()=>{e()})}}var uM=class dM{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{lM(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?dM.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)}};uM.DISABLE_DISPOSED_WARNING=!1;var Vl=uM,bn=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)}};bn.None=Object.freeze({dispose(){}});var au=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},My=typeof process<"u"&&"title"in process,Dm=My?"node":navigator.userAgent,aq=My?"node":navigator.platform,oq=Dm.includes("Firefox"),lq=Dm.includes("Edge"),hM=/^((?!chrome|android).)*safari/i.test(Dm);function cq(){if(!hM)return 0;let e=Dm.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}aq.indexOf("Linux")>=0;var uq="",wr=0,Sr=0,Cr=0,Yt=0,Fi={css:"#00000000",rgba:0},Xr;(e=>{function t(s,o,u,d){return d!==void 0?`#${ho(s)}${ho(o)}${ho(u)}${ho(d)}`:`#${ho(s)}${ho(o)}${ho(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(Xr||(Xr={}));var Su;(e=>{function t(m,h){if(Yt=(h.rgba&255)/255,Yt===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,p=h.rgba>>16&255,y=h.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;wr=b+Math.round((g-b)*Yt),Sr=w+Math.round((p-w)*Yt),Cr=C+Math.round((y-C)*Yt);let E=Xr.toCss(wr,Sr,Cr),S=Xr.toRgba(wr,Sr,Cr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,g){let p=wo.ensureContrastRatio(m.rgba,h.rgba,g);if(p)return Xr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[wr,Sr,Cr]=wo.toChannels(h),{css:Xr.toCss(wr,Sr,Cr),rgba:h}}e.opaque=s;function o(m,h){return Yt=Math.round(h*255),[wr,Sr,Cr]=wo.toChannels(m.rgba),{css:Xr.toCss(wr,Sr,Cr,Yt),rgba:Xr.toRgba(wr,Sr,Cr,Yt)}}e.opacity=o;function u(m,h){return Yt=m.rgba&255,o(m,Yt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Su||(Su={}));var dq;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return wr=parseInt(s.slice(1,2).repeat(2),16),Sr=parseInt(s.slice(2,3).repeat(2),16),Cr=parseInt(s.slice(3,4).repeat(2),16),Xr.toColor(wr,Sr,Cr);case 5:return wr=parseInt(s.slice(1,2).repeat(2),16),Sr=parseInt(s.slice(2,3).repeat(2),16),Cr=parseInt(s.slice(3,4).repeat(2),16),Yt=parseInt(s.slice(4,5).repeat(2),16),Xr.toColor(wr,Sr,Cr,Yt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return wr=parseInt(o[1]),Sr=parseInt(o[2]),Cr=parseInt(o[3]),Yt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Xr.toColor(wr,Sr,Cr,Yt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[wr,Sr,Cr,Yt]=t.getImageData(0,0,1,1).data,Yt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xr.toRgba(wr,Sr,Cr,Yt),css:s}}e.toColor=i})(dq||(dq={}));var Yr;(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),g=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+g*.7152+p*.0722}e.relativeLuminance2=r})(Yr||(Yr={}));var wo;(e=>{function t(u,d){if(Yt=(d&255)/255,Yt===1)return d;let m=d>>24&255,h=d>>16&255,g=d>>8&255,p=u>>24&255,y=u>>16&255,b=u>>8&255;return wr=p+Math.round((m-p)*Yt),Sr=y+Math.round((h-y)*Yt),Cr=b+Math.round((g-b)*Yt),Xr.toRgba(wr,Sr,Cr)}e.blend=t;function r(u,d,m){let h=Yr.relativeLuminance(u>>8),g=Yr.relativeLuminance(d>>8);if(Es(h,g)<m){if(g<h){let b=i(u,d,m),w=Es(h,Yr.relativeLuminance(b>>8));if(w<m){let C=s(u,d,m),E=Es(h,Yr.relativeLuminance(C>>8));return w>E?b:C}return b}let p=s(u,d,m),y=Es(h,Yr.relativeLuminance(p>>8));if(y<m){let b=i(u,d,m),w=Es(h,Yr.relativeLuminance(b>>8));return y>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,g=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Es(Yr.relativeLuminance2(y,b,w),Yr.relativeLuminance2(h,g,p));for(;C<m&&(y>0||b>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Es(Yr.relativeLuminance2(y,b,w),Yr.relativeLuminance2(h,g,p));return(y<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,g=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Es(Yr.relativeLuminance2(y,b,w),Yr.relativeLuminance2(h,g,p));for(;C<m&&(y<255||b<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Es(Yr.relativeLuminance2(y,b,w),Yr.relativeLuminance2(h,g,p));return(y<<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 ho(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Es(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function or(e){if(!e)throw new Error("value must not be falsy");return e}function jy(e){return 57508<=e&&e<=57558}function hq(e){return 57520<=e&&e<=57527}function fq(e){return 57344<=e&&e<=63743}function mq(e){return 9472<=e&&e<=9631}function pq(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 gq(e,t,r,i){return t===1&&r>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!pq(e)&&!jy(e)&&!fq(e)}function fM(e){return jy(e)||mq(e)}function vq(){return{css:{canvas:Gh(),cell:Gh()},device:{canvas:Gh(),cell:Gh(),char:{width:0,height:0,left:0,top:0}}}}function Gh(){return{width:0,height:0}}function _q(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var Or=0,yr=0,zn=!1,Rs=!1,Yh=!1,di,l_=0,xq=class{constructor(e,t,r,i,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=i,this._coreBrowserService=s,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,yr=0,Or=0,Rs=!1,zn=!1,Yh=!1,di=this._themeService.colors,l_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));l_=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Or=s.foregroundColorRGB.rgba>>8&16777215,zn=!0)}),Yh=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Yh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yr=(this.result.fg&16777215)<<8|255;break;case 0:default:yr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:yr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yr=(this.result.bg&16777215)<<8|255;break}yr=wo.blend(yr,(this._coreBrowserService.isFocused?di.selectionBackgroundOpaque:di.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else yr=(this._coreBrowserService.isFocused?di.selectionBackgroundOpaque:di.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Rs=!0,di.selectionForeground&&(Or=di.selectionForeground.rgba>>8&16777215,zn=!0),fM(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Or=(this._coreBrowserService.isFocused?di.selectionBackgroundOpaque:di.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Or=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Or=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Or=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Or=(this.result.fg&16777215)<<8|255;break;case 0:default:Or=this._themeService.colors.foreground.rgba}Or=wo.blend(Or,(this._coreBrowserService.isFocused?di.selectionBackgroundOpaque:di.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}zn=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",s=>{s.backgroundColorRGB&&(yr=s.backgroundColorRGB.rgba>>8&16777215,Rs=!0),s.foregroundColorRGB&&(Or=s.foregroundColorRGB.rgba>>8&16777215,zn=!0)}),Rs&&(Yh?yr=e.bg&-16777216&-134217729|yr|50331648:yr=e.bg&-16777216|yr|50331648),zn&&(Or=e.fg&-16777216&-67108865|Or|50331648),this.result.fg&67108864&&(Rs&&!zn&&((this.result.bg&50331648)===0?Or=this.result.fg&-134217728|di.background.rgba>>8&16777215&16777215|50331648:Or=this.result.fg&-134217728|this.result.bg&67108863,zn=!0),!Rs&&zn&&((this.result.fg&50331648)===0?yr=this.result.bg&-67108864|di.foreground.rgba>>8&16777215&16777215|50331648:yr=this.result.bg&-67108864|this.result.fg&67108863,Rs=!0)),di=void 0,this.result.bg=Rs?yr:this.result.bg,this.result.fg=zn?Or:this.result.fg,this.result.ext&=536870911,this.result.ext|=l_<<29&3758096384}},yq=.5,mM=oq||lq?"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}]},wq={"░":[[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]]},Sq={"─":{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`}},qu={"":{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}};qu[""]=qu[""];qu[""]=qu[""];function Cq(e,t,r,i,s,o,u,d){let m=bq[t];if(m)return Eq(e,m,r,i,s,o),!0;let h=wq[t];if(h)return Rq(e,h,r,i,s,o),!0;let g=Sq[t];if(g)return kq(e,g,r,i,s,o,d),!0;let p=qu[t];return p?(Nq(e,p,r,i,s,o,u,d),!0):!1}function Eq(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 h5=new Map;function Rq(e,t,r,i,s,o){let u=h5.get(t);u||(u=new Map,h5.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,g=t.length,p=e.canvas.ownerDocument.createElement("canvas");p.width=h,p.height=g;let y=or(p.getContext("2d")),b=new ImageData(h,g),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<g;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);y.putImageData(b,0,0),m=or(e.createPattern(p,null)),u.set(d,m)}e.fillStyle=m,e.fillRect(r,i,s,o)}function kq(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 g=.15/o*s;h=m(.15,g)}else h=m;for(let g of h.split(" ")){let p=g[0],y=pM[p];if(!y){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=g.substring(1).split(",");!b[0]||!b[1]||y(e,gM(b,s,o,r,i,!0,u))}e.stroke(),e.closePath()}}function Nq(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 g of t.d.split(" ")){let p=g[0],y=pM[p];if(!y){console.error(`Could not find drawing instructions for "${p}"`);continue}let b=g.substring(1).split(",");!b[0]||!b[1]||y(e,gM(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 f5(e,t,r=0){return Math.max(Math.min(e,t),r)}var pM={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 gM(e,t,r,i,s,o,u,d=0,m=0){let h=e.map(g=>parseFloat(g)||parseInt(g));if(h.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<h.length;g+=2)h[g]*=t-d*u-m*u,o&&h[g]!==0&&(h[g]=f5(Math.round(h[g]+.5)-.5,t,0)),h[g]+=i+d*u;for(let g=1;g<h.length;g+=2)h[g]*=r,o&&h[g]!==0&&(h[g]=f5(Math.round(h[g]+.5)-.5,r,0)),h[g]+=s;return h}var m5=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={}}},p5=class{constructor(){this._data=new m5}set(e,t,r,i,s){this._data.get(e,t)||this._data.set(e,t,new m5),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()}},vM=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()}},Aq=class extends vM{_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())}}},Tq=class extends vM{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Mq=!My&&"requestIdleCallback"in window?Tq:Aq,Ul=class _M{constructor(){this.fg=0,this.bg=0,this.extended=new xM}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 _M;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}},xM=class yM{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 yM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},jq=globalThis.performance&&typeof globalThis.performance.now=="function",Dq=class bM{static create(t){return new bM(t)}constructor(t){this._now=jq&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ms;(e=>{e.None=()=>bn.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,$)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,$),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h(($,T=null,U)=>B(H=>$.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h(($,T=null,U)=>B(H=>{j(H),$.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h(($,T=null,U)=>B(H=>j(H)&&$.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,$)=>{let T=cM(...B.map(U=>U(H=>j.call(O,H))));return g(T,$)}}e.any=d;function m(B,j,O,$){let T=O;return i(B,U=>(T=j(T,U),T),$)}e.reduce=m;function h(B,j){let O,$={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new Lt($);return j==null||j.add(T),T.event}function g(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,$=!1,T=!1,U,H){let F,V,I,Y=0,X,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(oe=>{Y++,V=j(V,oe),$&&!I&&(re.fire(V),V=void 0),X=()=>{let Z=V;V=void 0,I=void 0,(!$||Y>1)&&re.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(X,O)):I===void 0&&(I=0,queueMicrotask(X))})},onWillRemoveListener(){T&&Y>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,F.dispose()}},re=new Lt(ee);return H==null||H.add(re),re.event}e.debounce=p;function y(B,j=0,O){return e.debounce(B,($,T)=>$?($.push(T),$):[T],j,void 0,!0,void 0,O)}e.accumulate=y;function b(B,j=($,T)=>$===T,O){let $=!0,T;return o(B,U=>{let H=$||!j(U,T);return $=!1,T=U,H},O)}e.latch=b;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,$=>!j($),O)]}e.split=w;function C(B,j=!1,O=[],$){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});$&&$.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new Lt({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),$&&$.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return $&&$.add(F),F.event}e.buffer=C;function E(B,j){return(O,$,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call($,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let $=O;return this.steps.push(T=>($=j($,T),$)),this}latch(j=(O,$)=>O===$){let O=!0,$;return this.steps.push(T=>{let U=O||!j(T,$);return O=!1,$=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.on(j,$),U=()=>B.removeListener(j,$),H=new Lt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,$),U=()=>B.removeEventListener(j,$),H=new Lt({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new Lt;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function z(B,j){return B(O=>j.fire(O))}e.forward=z;function D(B,j,O){return j(O),B($=>j($))}e.runAndSubscribe=D;class W{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new Lt($),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new W(B,j).emitter.event}e.fromObservable=G;function q(B){return(j,O,$)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return $ instanceof Vl?$.add(F):Array.isArray($)&&$.push(F),F}}e.fromObservableLight=q})(Ms||(Ms={}));var k0=class N0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${N0._idPool++}`,N0.all.add(this)}start(t){this._stopWatch=new Dq,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}}};k0.all=new Set,k0._idPool=0;var Lq=k0,Oq=-1,wM=class SM{constructor(t,r,i=(SM._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 Iq(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}};wM._idPool=1;var Bq=wM,Pq=class CM{constructor(t){this.value=t}static create(){let t=new Error;return new CM(t.stack??"")}print(){console.warn(this.value.split(`
|
|
576
|
+
`).slice(2).join(`
|
|
577
|
+
`))}},Iq=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},zq=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},$q=0,c_=class{constructor(e){this.value=e,this.id=$q++}},Uq=2,Hq,Lt=class{constructor(t){var r,i,s,o;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new Bq((t==null?void 0:t.onListenerError)??o_,((i=this._options)==null?void 0:i.leakWarningThreshold)??Oq):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Lq(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,g,p;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let y=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(y);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new zq(`${y}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((d=this._options)==null?void 0:d.onListenerError)||o_)(w),bn.None}if(this._disposed)return bn.None;r&&(t=t.bind(r));let s=new c_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Pq.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof c_?(this._deliveryQueue??(this._deliveryQueue=new Fq),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=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||p.call(g,this)),this._size++;let u=qr(()=>{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*Uq<=r.length){let h=0;for(let g=0;g<r.length;g++)r[g]?r[h++]=r[g]: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)||o_;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 c_)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}},Fq=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}},g5={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}},ou=2,lu,ya=class $l{constructor(t,r,i){this._document=t,this._config=r,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new p5,this._cacheMapCombined=new p5,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ul,this._textureSize=512,this._onAddTextureAtlasCanvas=new Lt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Lt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=EM(t,this._config.deviceCellWidth*4+ou*2,this._config.deviceCellHeight+ou*2),this._tmpCtx=or(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Mq;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,g)=>g.canvas.width!==h.canvas.width?g.canvas.width-h.canvas.width:g.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,g)=>h>g?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 u_(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 u_(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 g of u.glyphs)g.texturePage=r,g.sizeClipSpace.x=g.size.x/i,g.sizeClipSpace.y=g.size.y/i,g.texturePosition.x+=d,g.texturePosition.y+=m,g.texturePositionClipSpace.x=g.texturePosition.x/i,g.texturePositionClipSpace.y=g.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 lu=t.get(r,i,s,o),lu||(lu=this._drawToCache(r,i,s,o,u,d),t.set(r,i,s,o,lu)),lu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,i,s){if(this._config.allowTransparency)return Fi;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(r);break;case 50331648:let u=Ul.toColorRGB(r);o=Xr.toColor(u[0],u[1],u[2]);break;case 0:default:i?o=Su.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Su.opaque(o)),o}_getForegroundColor(t,r,i,s,o,u,d,m,h,g){let p=this._getMinimumContrastColor(t,r,i,s,o,u,d,h,m,g);if(p)return p;let y;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&u<8&&(u+=8),y=this._getColorFromAnsiIndex(u);break;case 50331648:let b=Ul.toColorRGB(u);y=Xr.toColor(b[0],b[1],b[2]);break;case 0:default:d?y=this._config.colors.background:y=this._config.colors.foreground}return this._config.allowTransparency&&(y=Su.opaque(y)),m&&(y=Su.multiplyOpacity(y,yq)),y}_resolveBackgroundRgba(t,r,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,i,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,g){if(this._config.minimumContrastRatio===1||g)return;let p=this._getContrastCache(h),y=p.getColor(t,s);if(y!==void 0)return y||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=Xr.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)+ou*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let h=Math.min(this._config.deviceCellHeight+ou*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 g5;let g=!!this._workAttributeData.isBold(),p=!!this._workAttributeData.isInverse(),y=!!this._workAttributeData.isDim(),b=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),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,y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=g?this._config.fontWeightBold:this._config.fontWeight,z=b?"italic":"";this._tmpCtx.font=`${z} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=mM;let D=d.length===1&&jy(d.charCodeAt(0)),W=d.length===1&&hq(d.charCodeAt(0)),G=this._getForegroundColor(r,R,k,i,N,S,p,y,g,fM(d.charCodeAt(0)));this._tmpCtx.fillStyle=G.css;let q=W?0:ou*2,B=!1;this._config.customGlyphs!==!1&&(B=Cq(this._tmpCtx,d,q,q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let j=!D,O;if(typeof t=="number"?O=this._unicodeService.wcwidth(t):O=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;if(this._tmpCtx.lineWidth=V,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())j=!1,this._tmpCtx.strokeStyle=`rgb(${Ul.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{j=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let Y=q,X=Math.ceil(q+this._config.deviceCharHeight)-I-(o?V*2:0),ee=X+V,re=X+V*2,oe=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<O;Z++){this._tmpCtx.save();let ce=Y+Z*this._config.deviceCellWidth,ne=Y+(Z+1)*this._config.deviceCellWidth,we=ce+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X),this._tmpCtx.moveTo(ce,re),this._tmpCtx.lineTo(ne,re);break;case 3:let _e=V<=1?re:Math.ceil(q+this._config.deviceCharHeight-V/2)-I,ye=V<=1?X:Math.ceil(q+this._config.deviceCharHeight+V/2)-I,J=new Path2D;J.rect(ce,X,this._config.deviceCellWidth,re-X),this._tmpCtx.clip(J),this._tmpCtx.moveTo(ce-this._config.deviceCellWidth/2,ee),this._tmpCtx.bezierCurveTo(ce-this._config.deviceCellWidth/2,ye,ce,ye,ce,ee),this._tmpCtx.bezierCurveTo(ce,_e,we,_e,we,ee),this._tmpCtx.bezierCurveTo(we,ye,ne,ye,ne,ee),this._tmpCtx.bezierCurveTo(ne,_e,ne+this._config.deviceCellWidth/2,_e,ne+this._config.deviceCellWidth/2,ee);break;case 4:let ie=oe===0?0:oe>=V?V*2-oe:V-oe;oe>=V||ie===0?(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ce+ie,X),this._tmpCtx.lineTo(ne,X)):(this._tmpCtx.setLineDash([Math.round(V),Math.round(V)]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ce+ie,X),this._tmpCtx.moveTo(ce+ie+V,X),this._tmpCtx.lineTo(ne,X)),oe=_q(ne-ce,V,oe);break;case 5:let Ee=.6,ve=.3,Ae=ne-ce,Ie=Math.floor(Ee*Ae),Oe=Math.floor(ve*Ae),ze=Ae-Ie-Oe;this._tmpCtx.setLineDash([Ie,Oe,ze]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X);break;case 1:default:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ne,X);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!B&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let ce=new Path2D;ce.rect(Y,X-Math.ceil(V/2),this._config.deviceCellWidth*O,re-X+Math.ceil(V/2)),this._tmpCtx.clip(ce),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(d,q,q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),I=V%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+I),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*O,q+I),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let V=d_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j);if(V)for(let I=1;I<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight-I),V=d_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),M,G,j),!!V);I++);}if(C){let V=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),I=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=V,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*O,q+Math.floor(this._config.deviceCharHeight/2)-I),this._tmpCtx.stroke()}this._tmpCtx.restore();let $=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=Wq($):T=d_($,M,G,j),T)return g5;let U=this._findGlyphBoundingBox($,this._workBoundingBox,m,W,B,q),H,F;for(;;){if(this._activePages.length===0){let V=this._createNewPage();H=V,F=V.currentRow,F.height=U.size.y;break}H=this._activePages[this._activePages.length-1],F=H.currentRow;for(let V of this._activePages)U.size.y<=V.currentRow.height&&(H=V,F=V.currentRow);for(let V=this._activePages.length-1;V>=0;V--)for(let I of this._activePages[V].fixedRows)I.height<=F.height&&U.size.y<=I.height&&(H=this._activePages[V],F=I);if(U.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new u_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),H=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+U.size.x>=H.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+U.size.y>=H.canvas.height||F.height>U.size.y+2){let V=!1;if(H.currentRow.y+H.currentRow.height+U.size.y>=H.canvas.height){let I;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+U.size.y<Y.canvas.height){I=Y;break}if(I)H=I;else if($l.maxAtlasPages&&this._pages.length>=$l.maxAtlasPages&&F.y+U.size.y<=H.canvas.height&&F.height>=U.size.y&&F.x+U.size.x<=H.canvas.width)V=!0;else{let Y=this._createNewPage();H=Y,F=Y.currentRow,F.height=U.size.y,V=!0}}V||(H.currentRow.height>0&&H.fixedRows.push(H.currentRow),F={x:0,y:H.currentRow.y+H.currentRow.height,height:U.size.y},H.fixedRows.push(F),H.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+U.size.x<=H.canvas.width)break;F===H.currentRow?(F.x=0,F.y+=F.height,F.height=0):H.fixedRows.splice(H.fixedRows.indexOf(F),1)}return U.texturePage=this._pages.indexOf(H),U.texturePosition.x=F.x,U.texturePosition.y=F.y,U.texturePositionClipSpace.x=F.x/H.canvas.width,U.texturePositionClipSpace.y=F.y/H.canvas.height,U.sizeClipSpace.x/=H.canvas.width,U.sizeClipSpace.y/=H.canvas.height,F.height=Math.max(F.height,U.size.y),F.x+=U.size.x,H.ctx.putImageData($,U.texturePosition.x-this._workBoundingBox.left,U.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,U.size.x,U.size.y),H.addGlyph(U),H.version++,U}_findGlyphBoundingBox(t,r,i,s,o,u){r.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,m=s?this._config.deviceCellWidth:i,h=!1;for(let g=0;g<d;g++){for(let p=0;p<m;p++){let y=g*this._tmpCanvas.width*4+p*4+3;if(t.data[y]!==0){r.top=g,h=!0;break}}if(h)break}r.left=0,h=!1;for(let g=0;g<u+m;g++){for(let p=0;p<d;p++){let y=p*this._tmpCanvas.width*4+g*4+3;if(t.data[y]!==0){r.left=g,h=!0;break}}if(h)break}r.right=m,h=!1;for(let g=u+m-1;g>=u;g--){for(let p=0;p<d;p++){let y=p*this._tmpCanvas.width*4+g*4+3;if(t.data[y]!==0){r.right=g,h=!0;break}}if(h)break}r.bottom=d,h=!1;for(let g=d-1;g>=0;g--){for(let p=0;p<m;p++){let y=g*this._tmpCanvas.width*4+p*4+3;if(t.data[y]!==0){r.bottom=g,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)}}}},u_=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=EM(t,r,r),this.ctx=or(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function d_(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,g=Math.floor((Math.abs(s-d)+Math.abs(o-m)+Math.abs(u-h))/12),p=!0;for(let y=0;y<e.data.length;y+=4)e.data[y]===s&&e.data[y+1]===o&&e.data[y+2]===u||i&&Math.abs(e.data[y]-s)+Math.abs(e.data[y+1]-o)+Math.abs(e.data[y+2]-u)<g?e.data[y+3]=0:p=!1;return p}function Wq(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function EM(e,t,r){let i=e.createElement("canvas");return i.width=t,i.height=r,i}function qq(e,t,r,i,s,o,u,d){let m={foreground:o.foreground,background:o.background,cursor:Fi,cursorAccent:Fi,selectionForeground:Fi,selectionBackgroundTransparent:Fi,selectionBackgroundOpaque:Fi,selectionInactiveBackgroundTransparent:Fi,selectionInactiveBackgroundOpaque:Fi,overviewRulerBorder:Fi,scrollbarSliderBackground:Fi,scrollbarSliderHoverBackground:Fi,scrollbarSliderActiveBackground:Fi,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:i,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:m}}function v5(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 Vq(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Gi=[];function RM(e,t,r,i,s,o,u,d,m){let h=qq(i,s,o,u,t,r,d,m);for(let y=0;y<Gi.length;y++){let b=Gi[y],w=b.ownedBy.indexOf(e);if(w>=0){if(v5(b.config,h))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),Gi.splice(y,1)):b.ownedBy.splice(w,1);break}}for(let y=0;y<Gi.length;y++){let b=Gi[y];if(v5(b.config,h))return b.ownedBy.push(e),b.atlas}let g=e._core,p={atlas:new ya(document,h,g.unicodeService),config:h,ownedBy:[e]};return Gi.push(p),p.atlas}function _5(e){for(let t=0;t<Gi.length;t++){let r=Gi[t].ownedBy.indexOf(e);if(r!==-1){Gi[t].ownedBy.length===1?(Gi[t].atlas.dispose(),Gi.splice(t,1)):Gi[t].ownedBy.splice(r,1);break}}}var Kh=600,Gq=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=Kh){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Kh-(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=Kh-(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})},Kh)},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 x5(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 qr(()=>i==null?void 0:i.disconnect())}function Yq(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var y5=class kM extends Ul{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new xM,this.combinedData=""}static fromCharData(t){let r=new kM;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?Yq(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()]}},NM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function AM(e,t,r){let i=or(e.createProgram());if(e.attachShader(i,or(b5(e,e.VERTEX_SHADER,t))),e.attachShader(i,or(b5(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 b5(e,t,r){let i=or(e.createShader(t));if(e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function Kq(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 Xq=class{constructor(t){this.texture=t,this.version=-1}},Zq=`#version 300 es
|
|
578
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
579
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
580
|
+
layout (location = 2) in vec2 a_offset;
|
|
581
|
+
layout (location = 3) in vec2 a_size;
|
|
582
|
+
layout (location = 4) in float a_texpage;
|
|
583
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
584
|
+
layout (location = 6) in vec2 a_texsize;
|
|
585
|
+
|
|
586
|
+
uniform mat4 u_projection;
|
|
587
|
+
uniform vec2 u_resolution;
|
|
588
|
+
|
|
589
|
+
out vec2 v_texcoord;
|
|
590
|
+
flat out int v_texpage;
|
|
591
|
+
|
|
592
|
+
void main() {
|
|
593
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
594
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
595
|
+
v_texpage = int(a_texpage);
|
|
596
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
597
|
+
}`;function Qq(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
|
|
598
|
+
precision lowp float;
|
|
599
|
+
|
|
600
|
+
in vec2 v_texcoord;
|
|
601
|
+
flat in int v_texpage;
|
|
602
|
+
|
|
603
|
+
uniform sampler2D u_texture[${e}];
|
|
604
|
+
|
|
605
|
+
out vec4 outColor;
|
|
606
|
+
|
|
607
|
+
void main() {
|
|
608
|
+
if (v_texpage == 0) {
|
|
609
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
610
|
+
} ${t}
|
|
611
|
+
}`}var ba=11,Dl=ba*Float32Array.BYTES_PER_ELEMENT,Jq=2,Gt=0,jt,h_=0,cu=0,eV=class extends bn{constructor(t,r,i,s){super(),this._terminal=t,this._gl=r,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;ya.maxAtlasPages===void 0&&(ya.maxAtlasPages=Math.min(32,or(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ya.maxTextureSize=or(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=or(AM(o,Zq,Qq(ya.maxAtlasPages))),this._register(qr(()=>o.deleteProgram(this._program))),this._projectionLocation=or(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=or(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=or(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(qr(()=>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(qr(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,m,o.STATIC_DRAW),this._attributesBuffer=or(o.createBuffer()),this._register(qr(()=>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 g=new Int32Array(ya.maxAtlasPages);for(let p=0;p<ya.maxAtlasPages;p++)g[p]=p;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,NM),this._atlasTextures=[];for(let p=0;p<ya.maxAtlasPages;p++){let y=new Xq(or(o.createTexture()));this._register(qr(()=>o.deleteTexture(y.texture))),o.activeTexture(o.TEXTURE0+p),o.bindTexture(o.TEXTURE_2D,y.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[p]=y}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,i,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,g){if(Gt=(i*this._terminal.cols+r)*ba,s===0||s===void 0){t.fill(0,Gt,Gt+ba-1-Jq);return}this._atlas&&(m&&m.length>1?jt=this._atlas.getRasterizedGlyphCombinedChar(m,o,u,d,!1,this._terminal.element):jt=this._atlas.getRasterizedGlyph(s,o,u,d,!1,this._terminal.element),h_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&jt.offset.x>h_?(cu=jt.offset.x-h_,t[Gt]=-(jt.offset.x-cu)+this._dimensions.device.char.left,t[Gt+1]=-jt.offset.y+this._dimensions.device.char.top,t[Gt+2]=(jt.size.x-cu)/this._dimensions.device.canvas.width,t[Gt+3]=jt.size.y/this._dimensions.device.canvas.height,t[Gt+4]=jt.texturePage,t[Gt+5]=jt.texturePositionClipSpace.x+cu/this._atlas.pages[jt.texturePage].canvas.width,t[Gt+6]=jt.texturePositionClipSpace.y,t[Gt+7]=jt.sizeClipSpace.x-cu/this._atlas.pages[jt.texturePage].canvas.width,t[Gt+8]=jt.sizeClipSpace.y):(t[Gt]=-jt.offset.x+this._dimensions.device.char.left,t[Gt+1]=-jt.offset.y+this._dimensions.device.char.top,t[Gt+2]=jt.size.x/this._dimensions.device.canvas.width,t[Gt+3]=jt.size.y/this._dimensions.device.canvas.height,t[Gt+4]=jt.texturePage,t[Gt+5]=jt.texturePositionClipSpace.x,t[Gt+6]=jt.texturePositionClipSpace.y,t[Gt+7]=jt.sizeClipSpace.x,t[Gt+8]=jt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&gq(s,h,jt.size.x,this._dimensions.device.cell.width)&&(t[Gt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*ba;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==r?this._vertices.attributesBuffers[i]=new Float32Array(r):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=r,i=0;for(let s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=ba}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*ba,d=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*ba);i.set(d,s),s+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,i.subarray(0,s),r.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(r,this._atlas,o);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,s/ba)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=r.pages[i].version}setDimensions(t){this._dimensions=t}},tV=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 rV(){return new tV}var Ff=4,mf=1,pf=2,f_=3,iV=2147483648,nV=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=rV()}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)}},sV=`#version 300 es
|
|
612
|
+
layout (location = 0) in vec2 a_position;
|
|
613
|
+
layout (location = 1) in vec2 a_size;
|
|
614
|
+
layout (location = 2) in vec4 a_color;
|
|
615
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
616
|
+
|
|
617
|
+
uniform mat4 u_projection;
|
|
618
|
+
|
|
619
|
+
out vec4 v_color;
|
|
620
|
+
|
|
621
|
+
void main() {
|
|
622
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
623
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
624
|
+
v_color = a_color;
|
|
625
|
+
}`,aV=`#version 300 es
|
|
626
|
+
precision lowp float;
|
|
627
|
+
|
|
628
|
+
in vec4 v_color;
|
|
629
|
+
|
|
630
|
+
out vec4 outColor;
|
|
631
|
+
|
|
632
|
+
void main() {
|
|
633
|
+
outColor = v_color;
|
|
634
|
+
}`,As=8,m_=As*Float32Array.BYTES_PER_ELEMENT,oV=20*As,w5=class{constructor(){this.attributes=new Float32Array(oV),this.count=0}},ks=0,S5=0,C5=0,E5=0,R5=0,k5=0,N5=0,lV=class extends bn{constructor(e,t,r,i){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=i,this._vertices=new w5,this._verticesCursor=new w5;let s=this._gl;this._program=or(AM(s,sV,aV)),this._register(qr(()=>s.deleteProgram(this._program))),this._projectionLocation=or(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=s.createBuffer();this._register(qr(()=>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(qr(()=>s.deleteBuffer(m))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,m),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=or(s.createBuffer()),this._register(qr(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,m_,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,m_,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,m_,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,NM),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,g,p,y,b,w;for(s=0;s<t.rows;s++){for(u=-1,d=0,m=0,h=!1,o=0;o<t.cols;o++)g=(s*t.cols+o)*Ff,p=e.cells[g+mf],y=e.cells[g+pf],b=!!(y&67108864),(p!==d||y!==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=y,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=Kq(e.attributes,this._terminal.rows*this._terminal.cols*As)),S5=s*this._dimensions.device.cell.width,C5=u*this._dimensions.device.cell.height,E5=(ks>>24&255)/255,R5=(ks>>16&255)/255,k5=(ks>>8&255)/255,N5=1,this._addRectangle(e.attributes,t,S5,C5,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,E5,R5,k5,N5)}_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 bn{constructor(t,r,i,s,o,u,d,m){super(),this._container=r,this._alpha=o,this._coreBrowserService=u,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(qr(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=or(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,i){}handleSelectionChanged(t,r,i,s=!1){}_setTransparency(t,r){if(r===this._alpha)return;let i=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=RM(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=mM,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}`}},uV=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&&Vq(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,A0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Lt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Lt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};A0.INSTANCE=new A0;var TM=A0;function dV(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}TM.INSTANCE.onDidChangeZoomLevel;TM.INSTANCE.onDidChangeFullscreen;var sc=typeof navigator=="object"?navigator.userAgent:"";sc.indexOf("Firefox")>=0;sc.indexOf("AppleWebKit")>=0;var hV=sc.indexOf("Chrome")>=0;!hV&&sc.indexOf("Safari")>=0;sc.indexOf("Electron/")>=0;sc.indexOf("Android")>=0;var p_=!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)");p_=e.matches,dV(vo,e,({matches:r})=>{p_&&t.matches||(p_=r)})}var Hl="en",g_=!1,MM=!1,Xh,gf=Hl,A5=Hl,fV,hn,So=globalThis,Pr,VE;typeof So.vscode<"u"&&typeof So.vscode.process<"u"?Pr=So.vscode.process:typeof process<"u"&&typeof((VE=process==null?void 0:process.versions)==null?void 0:VE.node)=="string"&&(Pr=process);var GE,mV=typeof((GE=Pr==null?void 0:Pr.versions)==null?void 0:GE.electron)=="string",pV=mV&&(Pr==null?void 0:Pr.type)==="renderer",YE;if(typeof Pr=="object"){Pr.platform,Pr.platform,g_=Pr.platform==="linux",g_&&Pr.env.SNAP&&Pr.env.SNAP_REVISION,Pr.env.CI||Pr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xh=Hl,gf=Hl;let e=Pr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Xh=t.userLocale,A5=t.osLocale,gf=t.resolvedLanguage||Hl,fV=(YE=t.languagePack)==null?void 0:YE.translationsConfigFile}catch{}MM=!0}else typeof navigator=="object"&&!pV?(hn=navigator.userAgent,hn.indexOf("Windows")>=0,hn.indexOf("Macintosh")>=0,(hn.indexOf("Macintosh")>=0||hn.indexOf("iPad")>=0||hn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,g_=hn.indexOf("Linux")>=0,(hn==null?void 0:hn.indexOf("Mobi"))>=0,gf=globalThis._VSCODE_NLS_LANGUAGE||Hl,Xh=navigator.language.toLowerCase(),A5=Xh):console.error("Unable to resolve platform.");var T5=MM,Qn=hn,pa=gf,gV;(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})(gV||(gV={}));var vV=typeof So.postMessage=="function"&&!So.importScripts;(()=>{if(vV){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 _V=!!(Qn&&Qn.indexOf("Chrome")>=0);Qn&&Qn.indexOf("Firefox")>=0;!_V&&Qn&&Qn.indexOf("Safari")>=0;Qn&&Qn.indexOf("Edg/")>=0;Qn&&Qn.indexOf("Android")>=0;var Ll=typeof navigator=="object"?navigator:{};T5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ll&&Ll.clipboard&&Ll.clipboard.writeText,T5||Ll&&Ll.clipboard&&Ll.clipboard.readText;var Dy=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}},v_=new Dy,M5=new Dy,j5=new Dy;new Array(230);var xV;(e=>{function t(d){return v_.keyCodeToStr(d)}e.toString=t;function r(d){return v_.strToKeyCode(d)}e.fromString=r;function i(d){return M5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return j5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return M5.strToKeyCode(d)||j5.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 v_.keyCodeToStr(d)}e.toElectronAccelerator=u})(xV||(xV={}));var jM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),yV;(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:jM})})(yV||(yV={}));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?jM:(this._emitter||(this._emitter=new Lt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},wV;(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})(wV||(wV={}));var D5=class Wi{static fromArray(t){return new Wi(r=>{r.emitMany(t)})}static fromPromise(t){return new Wi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new Wi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new Wi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Lt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ms.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new Wi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return Wi.map(this,t)}static filter(t,r){return new Wi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return Wi.filter(this,t)}static coalesce(t){return Wi.filter(t,r=>!!r)}coalesce(){return Wi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return Wi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};D5.EMPTY=D5.fromArray([]);var{getWindow:SV}=(function(){let e=new Map,t={window:vo,disposables:new Vl};e.set(vo.vscodeWindowId,t);let r=new Lt,i=new Lt,s=new Lt;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return bn.None;let d=new Vl,m={window:u,disposables:d.add(new Vl)};return e.set(u.vscodeWindowId,m),d.add(qr(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(T0(u,EV.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 SV(u).document}}})(),CV=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 T0(e,t,r,i){return new CV(e,t,r,i)}var EV={BEFORE_UNLOAD:"beforeunload"},RV=class extends bn{constructor(t,r,i,s,o,u,d,m,h){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=u,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new au,this._charAtlasDisposable=this._register(new au),this._observerDisposable=this._register(new au),this._model=new nV,this._workCell=new y5,this._workCell2=new y5,this._rectangleRenderer=this._register(new au),this._glyphRenderer=this._register(new au),this._onChangeTextureAtlas=this._register(new Lt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Lt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Lt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Lt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Lt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new xq(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new uV(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=vq(),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(T0(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(T0(this._canvas,"webglcontextrestored",p=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,_5(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=x5(this._canvas,this._coreBrowserService.window,(p,y)=>this._setCanvasDevicePixelDimensions(p,y)),this._register(this._coreBrowserService.onWindowChange(p=>{this._observerDisposable.value=x5(this._canvas,p,(y,b)=>this._setCanvasDevicePixelDimensions(y,b))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(qr(()=>{var p;for(let y of this._renderLayers)y.dispose();(p=this._canvas.parentElement)==null||p.removeChild(this._canvas),_5(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 lV(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new eV(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=RM(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=cM(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 Gq(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let i=this._core,s=this._workCell,o,u,d,m,h,g,p=0,y=!0,b,w,C,E,S,N,k,R,M;t=L5(t,i.rows-1,0),r=L5(r,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,D=z-i.buffer.ydisp,W=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),G=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(u=t;u<=r;u++)for(d=u+i.buffer.ydisp,m=i.buffer.lines.get(d),this._model.lineLengths[u]=0,C=z===d,p=0,h=this._characterJoinerService.getJoinedCharacters(d),R=0;R<i.cols;R++){if(o=this._cellColorResolver.result.bg,m.loadCell(R,s),R===0&&(o=this._cellColorResolver.result.bg),g=!1,y=R>=p,b=R,h.length>0&&R===h[0][0]&&y){w=h.shift();let j=this._model.selection.isCellSelected(this._terminal,w[0],d);for(k=w[0]+1;k<w[1];k++)y&&(y=j===this._model.selection.isCellSelected(this._terminal,k,d));y&&(y=!C||W<w[0]||W>=w[1]),y?(g=!0,s=new kV(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),q&&d===z&&(R===W&&(this._model.cursor={x:W,y:D,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},G=W+s.getWidth()-1),R>=W&&R<=G&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),S!==0&&(this._model.lineLengths[u]=R+1),!(this._model.cells[k]===S&&this._model.cells[k+mf]===this._cellColorResolver.result.bg&&this._model.cells[k+pf]===this._cellColorResolver.result.fg&&this._model.cells[k+f_]===this._cellColorResolver.result.ext)&&(B=!0,E.length>1&&(S|=iV),this._model.cells[k]=S,this._model.cells[k+mf]=this._cellColorResolver.result.bg,this._model.cells[k+pf]=this._cellColorResolver.result.fg,this._model.cells[k+f_]=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),g)){for(s=this._workCell,R++;R<=b;R++)M=(u*i.cols+R)*Ff,this._glyphRenderer.value.updateCell(R,u,0,0,0,0,uq,0,0),this._model.cells[M]=0,this._model.cells[M+mf]=this._cellColorResolver.result.bg,this._model.cells[M+pf]=this._cellColorResolver.result.fg,this._model.cells[M+f_]=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})}},kV=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 L5(e,t,r=0){return Math.max(Math.min(e,t),r)}var O5="di$target",B5="di$dependencies",__=new Map;function rs(e){if(__.has(e))return __.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");NV(t,r,s)};return t._id=e,__.set(e,t),t}function NV(e,t,r){t[O5]===t?t[B5].push({id:e,index:r}):(t[B5]=[{id:e,index:r}],t[O5]=t)}rs("BufferService");rs("CoreMouseService");rs("CoreService");rs("CharsetService");rs("InstantiationService");rs("LogService");var AV=rs("OptionsService");rs("OscLinkService");rs("UnicodeService");rs("DecorationService");var TV={trace:0,debug:1,info:2,warn:3,error:4,off:5},MV="xterm.js: ",P5=class extends bn{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=TV[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?"":MV)+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)}};P5=QW([JW(0,AV)],P5);var jV=class extends bn{constructor(t){if(hM&&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 Lt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Lt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Lt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Lt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=r.coreService,s=r.optionsService,o=r,u=o._renderService,d=o._characterJoinerService,m=o._charSizeService,h=o._coreBrowserService,g=o._decorationService;o._logService;let p=o._themeService;this._renderer=this._register(new RV(t,d,m,h,i,g,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(qr(()=>{if(this._terminal._core._store._isDisposed)return;let y=this._terminal._core._renderService;y.setRenderer(this._terminal._core._createRenderer()),y.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
|
|
635
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
636
|
+
* @license MIT
|
|
637
|
+
*
|
|
638
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
639
|
+
* @license MIT
|
|
640
|
+
*
|
|
641
|
+
* Originally forked from (with the author's permission):
|
|
642
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
643
|
+
* http://bellard.org/jslinux/
|
|
644
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
645
|
+
*/var DM=Object.defineProperty,DV=Object.getOwnPropertyDescriptor,LV=(e,t)=>{for(var r in t)DM(e,r,{get:t[r],enumerable:!0})},Zt=(e,t,r,i)=>{for(var s=i>1?void 0:i?DV(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&&DM(t,r,s),s},Ne=(e,t)=>(r,i)=>t(r,i,e),I5="Terminal input",M0={get:()=>I5,set:e=>I5=e},z5="Too much output to announce, navigate to rows manually to read",j0={get:()=>z5,set:e=>z5=e};function OV(e){return e.replace(/\r?\n/g,"\r")}function BV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function PV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function IV(e,t,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");LM(s,t,r,i)}}function LM(e,t,r,i){e=OV(e),e=BV(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function OM(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 $5(e,t,r,i,s){OM(e,t,r),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function wa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function 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 zV=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}},$V=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 y=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)b<<=6,b|=C;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=E-w;for(;h<S;){if(h>=r)return 0;if(C=e[h++],(C&192)!==128){h--,y=!0;break}else this.interim[w++]=C,b<<=6,b|=C&63}y||(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 g=r-4,p=h;for(;p<r;){for(;p<g&&!((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}},BM="",Ca=" ",fd=class PM{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 PM;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 IM{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 IM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Xi=class zM extends fd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Wf,this.combinedData=""}static fromCharData(t){let r=new zM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?wa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},U5="di$target",D0="di$dependencies",x_=new Map;function UV(e){return e[D0]||[]}function Nr(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");HV(t,r,s)};return t._id=e,x_.set(e,t),t}function HV(e,t,r){t[U5]===t?t[D0].push({id:e,index:r}):(t[D0]=[{id:e,index:r}],t[U5]=t)}var ei=Nr("BufferService"),$M=Nr("CoreMouseService"),Ho=Nr("CoreService"),FV=Nr("CharsetService"),Ly=Nr("InstantiationService"),UM=Nr("LogService"),ti=Nr("OptionsService"),HM=Nr("OscLinkService"),WV=Nr("UnicodeService"),md=Nr("DecorationService"),L0=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var g;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,o=new Xi,u=r.getTrimmedLength(),d=-1,m=-1,h=!1;for(let p=0;p<u;p++)if(!(m===-1&&!r.hasContent(p))){if(r.loadCell(p,o),o.hasExtendedAttrs()&&o.extended.urlId)if(m===-1){m=p,d=o.extended.urlId;continue}else h=o.extended.urlId!==d;else m!==-1&&(h=!0);if(h||m!==-1&&p===u-1){let y=(g=this._oscLinkService.getLinkData(d))==null?void 0:g.uri;if(y){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(y);["http:","https:"].includes(C.protocol)||(w=!0)}catch{w=!0}w||i.push({text:y,range:b,activate:(C,E)=>s?s.activate(C,E,b):qV(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)}};L0=Zt([Ne(0,ei),Ne(1,ti),Ne(2,HM)],L0);function qV(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
646
|
+
|
|
647
|
+
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=Nr("CharSizeService"),$s=Nr("CoreBrowserService"),Oy=Nr("MouseService"),Us=Nr("RenderService"),VV=Nr("SelectionService"),FM=Nr("CharacterJoinerService"),ac=Nr("ThemeService"),WM=Nr("LinkProviderService"),GV=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?H5.isErrorNoTelemetry(e)?new H5(e.message+`
|
|
648
|
+
|
|
649
|
+
`+e.stack):new Error(e.message+`
|
|
650
|
+
|
|
651
|
+
`+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)}},YV=new GV;function vf(e){KV(e)||YV.onUnexpectedError(e)}var O0="Canceled";function KV(e){return e instanceof XV?!0:e instanceof Error&&e.name===O0&&e.message===O0}var XV=class extends Error{constructor(){super(O0),this.name=this.message}};function ZV(e){return new Error(`Illegal argument: ${e}`)}var H5=class B0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof B0)return t;let r=new B0;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},P0=class qM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,qM.prototype)}};function ki(e,t=0){return e[e.length-(1+t)]}var QV;(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})(QV||(QV={}));function JV(e,t){let r=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(r,arguments))),s}}var VM;(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 g(R,M){let L=0;for(let z of R)if(M(z,L++))return!0;return!1}e.some=g;function p(R,M){for(let L of R)if(M(L))return L}e.find=p;function*y(R,M){for(let L of R)M(L)&&(yield L)}e.filter=y;function*b(R,M){let L=0;for(let z of R)yield M(z,L++)}e.map=b;function*w(R,M){let L=0;for(let z of R)yield*M(z,L++)}e.flatMap=w;function*C(...R){for(let M of R)yield*M}e.concat=C;function E(R,M,L){let z=L;for(let D of R)z=M(z,D);return z}e.reduce=E;function*S(R,M,L=R.length){for(M<0&&(M+=R.length),L<0?L+=R.length:L>R.length&&(L=R.length);M<L;M++)yield R[M]}e.slice=S;function N(R,M=Number.POSITIVE_INFINITY){let L=[];if(M===0)return[L,R];let z=R[Symbol.iterator]();for(let D=0;D<M;D++){let W=z.next();if(W.done)return[L,e.empty()];L.push(W.value)}return[L,{[Symbol.iterator](){return z}}]}e.consume=N;async function k(R){let M=[];for await(let L of R)M.push(L);return Promise.resolve(M)}e.asyncToArray=k})(VM||(VM={}));function To(e){if(VM.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 eG(...e){return It(()=>To(e))}function It(e){return{dispose:JV(()=>{e()})}}var GM=class YM{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?YM.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)}};GM.DISABLE_DISPOSED_WARNING=!1;var ka=GM,tt=class{constructor(){this._store=new ka,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};tt.None=Object.freeze({dispose(){}});var 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,I0=class z0{constructor(t){this.element=t,this.next=z0.Undefined,this.prev=z0.Undefined}};I0.Undefined=new I0(void 0);var zt=I0,F5=class{constructor(){this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===zt.Undefined}clear(){let e=this._first;for(;e!==zt.Undefined;){let t=e.next;e.prev=zt.Undefined,e.next=zt.Undefined,e=t}this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new zt(e);if(this._first===zt.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==zt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==zt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==zt.Undefined&&e.next!==zt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===zt.Undefined&&e.next===zt.Undefined?(this._first=zt.Undefined,this._last=zt.Undefined):e.next===zt.Undefined?(this._last=this._last.prev,this._last.next=zt.Undefined):e.prev===zt.Undefined&&(this._first=this._first.next,this._first.prev=zt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==zt.Undefined;)yield e.element,e=e.next}},tG=globalThis.performance&&typeof globalThis.performance.now=="function",rG=class KM{static create(t){return new KM(t)}constructor(t){this._now=tG&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},zr;(e=>{e.None=()=>tt.None;function t(B,j){return p(B,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function r(B){return(j,O=null,$)=>{let T=!1,U;return U=B(H=>{if(!T)return U?U.dispose():T=!0,j.call(O,H)},null,$),T&&U.dispose(),U}}e.once=r;function i(B,j,O){return h(($,T=null,U)=>B(H=>$.call(T,j(H)),null,U),O)}e.map=i;function s(B,j,O){return h(($,T=null,U)=>B(H=>{j(H),$.call(T,H)},null,U),O)}e.forEach=s;function o(B,j,O){return h(($,T=null,U)=>B(H=>j(H)&&$.call(T,H),null,U),O)}e.filter=o;function u(B){return B}e.signal=u;function d(...B){return(j,O=null,$)=>{let T=eG(...B.map(U=>U(H=>j.call(O,H))));return g(T,$)}}e.any=d;function m(B,j,O,$){let T=O;return i(B,U=>(T=j(T,U),T),$)}e.reduce=m;function h(B,j){let O,$={onWillAddFirstListener(){O=B(T.fire,T)},onDidRemoveLastListener(){O==null||O.dispose()}},T=new Se($);return j==null||j.add(T),T.event}function g(B,j){return j instanceof Array?j.push(B):j&&j.add(B),B}function p(B,j,O=100,$=!1,T=!1,U,H){let F,V,I,Y=0,X,ee={leakWarningThreshold:U,onWillAddFirstListener(){F=B(oe=>{Y++,V=j(V,oe),$&&!I&&(re.fire(V),V=void 0),X=()=>{let Z=V;V=void 0,I=void 0,(!$||Y>1)&&re.fire(Z),Y=0},typeof O=="number"?(clearTimeout(I),I=setTimeout(X,O)):I===void 0&&(I=0,queueMicrotask(X))})},onWillRemoveListener(){T&&Y>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,F.dispose()}},re=new Se(ee);return H==null||H.add(re),re.event}e.debounce=p;function y(B,j=0,O){return e.debounce(B,($,T)=>$?($.push(T),$):[T],j,void 0,!0,void 0,O)}e.accumulate=y;function b(B,j=($,T)=>$===T,O){let $=!0,T;return o(B,U=>{let H=$||!j(U,T);return $=!1,T=U,H},O)}e.latch=b;function w(B,j,O){return[e.filter(B,j,O),e.filter(B,$=>!j($),O)]}e.split=w;function C(B,j=!1,O=[],$){let T=O.slice(),U=B(V=>{T?T.push(V):F.fire(V)});$&&$.add(U);let H=()=>{T==null||T.forEach(V=>F.fire(V)),T=null},F=new Se({onWillAddFirstListener(){U||(U=B(V=>F.fire(V)),$&&$.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return $&&$.add(F),F.event}e.buffer=C;function E(B,j){return(O,$,T)=>{let U=j(new N);return B(function(H){let F=U.evaluate(H);F!==S&&O.call($,F)},void 0,T)}}e.chain=E;let S=Symbol("HaltChainable");class N{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(O=>(j(O),O)),this}filter(j){return this.steps.push(O=>j(O)?O:S),this}reduce(j,O){let $=O;return this.steps.push(T=>($=j($,T),$)),this}latch(j=(O,$)=>O===$){let O=!0,$;return this.steps.push(T=>{let U=O||!j(T,$);return O=!1,$=T,U?T:S}),this}evaluate(j){for(let O of this.steps)if(j=O(j),j===S)break;return j}}function k(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.on(j,$),U=()=>B.removeListener(j,$),H=new Se({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromNodeEventEmitter=k;function R(B,j,O=$=>$){let $=(...F)=>H.fire(O(...F)),T=()=>B.addEventListener(j,$),U=()=>B.removeEventListener(j,$),H=new Se({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}e.fromDOMEventEmitter=R;function M(B){return new Promise(j=>r(B)(j))}e.toPromise=M;function L(B){let j=new Se;return B.then(O=>{j.fire(O)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=L;function z(B,j){return B(O=>j.fire(O))}e.forward=z;function D(B,j,O){return j(O),B($=>j($))}e.runAndSubscribe=D;class W{constructor(j,O){this._observable=j,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new Se($),O&&O.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,O){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(B,j){return new W(B,j).emitter.event}e.fromObservable=G;function q(B){return(j,O,$)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(B.reportChanges(),U&&(U=!1,j.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};B.addObserver(H),B.reportChanges();let F={dispose(){B.removeObserver(H)}};return $ instanceof ka?$.add(F):Array.isArray($)&&$.push(F),F}}e.fromObservableLight=q})(zr||(zr={}));var $0=class U0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${U0._idPool++}`,U0.all.add(this)}start(t){this._stopWatch=new rG,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}}};$0.all=new Set,$0._idPool=0;var iG=$0,nG=-1,XM=class ZM{constructor(t,r,i=(ZM._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 oG(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}};XM._idPool=1;var sG=XM,aG=class QM{constructor(t){this.value=t}static create(){let t=new Error;return new QM(t.stack??"")}print(){console.warn(this.value.split(`
|
|
652
|
+
`).slice(2).join(`
|
|
653
|
+
`))}},oG=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},lG=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},cG=0,y_=class{constructor(e){this.value=e,this.id=cG++}},uG=2,dG,Se=class{constructor(e){var t,r,i,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new sG((e==null?void 0:e.onListenerError)??vf,((r=this._options)==null?void 0:r.leakWarningThreshold)??nG):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new iG(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,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],b=new lG(`${p}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((u=this._options)==null?void 0:u.onListenerError)||vf)(b),tt.None}if(this._disposed)return tt.None;t&&(e=e.bind(t));let i=new y_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=aG.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof y_?(this._deliveryQueue??(this._deliveryQueue=new hG),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,(g=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||g.call(h,this)),this._size++;let o=It(()=>{s==null||s(),this._removeListener(i)});return r instanceof ka?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var s,o,u,d;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(u=this._options)==null?void 0:u.onDidRemoveLastListener)==null||d.call(u,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*uG<=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)||vf;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 y_)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}},hG=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}},H0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};H0.INSTANCE=new H0;var By=H0;function fG(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}By.INSTANCE.onDidChangeZoomLevel;function mG(e){return By.INSTANCE.getZoomFactor(e)}By.INSTANCE.onDidChangeFullscreen;var oc=typeof navigator=="object"?navigator.userAgent:"",F0=oc.indexOf("Firefox")>=0,pG=oc.indexOf("AppleWebKit")>=0,Py=oc.indexOf("Chrome")>=0,gG=!Py&&oc.indexOf("Safari")>=0;oc.indexOf("Electron/")>=0;oc.indexOf("Android")>=0;var b_=!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)");b_=e.matches,fG(js,e,({matches:r})=>{b_&&t.matches||(b_=r)})}var Fl="en",W0=!1,q0=!1,_f=!1,JM=!1,Zh,xf=Fl,W5=Fl,vG,fn,Co=globalThis,Ir,KE;typeof Co.vscode<"u"&&typeof Co.vscode.process<"u"?Ir=Co.vscode.process:typeof process<"u"&&typeof((KE=process==null?void 0:process.versions)==null?void 0:KE.node)=="string"&&(Ir=process);var XE,_G=typeof((XE=Ir==null?void 0:Ir.versions)==null?void 0:XE.electron)=="string",xG=_G&&(Ir==null?void 0:Ir.type)==="renderer",ZE;if(typeof Ir=="object"){W0=Ir.platform==="win32",q0=Ir.platform==="darwin",_f=Ir.platform==="linux",_f&&Ir.env.SNAP&&Ir.env.SNAP_REVISION,Ir.env.CI||Ir.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zh=Fl,xf=Fl;let e=Ir.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zh=t.userLocale,W5=t.osLocale,xf=t.resolvedLanguage||Fl,vG=(ZE=t.languagePack)==null?void 0:ZE.translationsConfigFile}catch{}JM=!0}else typeof navigator=="object"&&!xG?(fn=navigator.userAgent,W0=fn.indexOf("Windows")>=0,q0=fn.indexOf("Macintosh")>=0,(fn.indexOf("Macintosh")>=0||fn.indexOf("iPad")>=0||fn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_f=fn.indexOf("Linux")>=0,(fn==null?void 0:fn.indexOf("Mobi"))>=0,xf=globalThis._VSCODE_NLS_LANGUAGE||Fl,Zh=navigator.language.toLowerCase(),W5=Zh):console.error("Unable to resolve platform.");var ej=W0,Zn=q0,yG=_f,q5=JM,Jn=fn,ga=xf,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 wG=typeof Co.postMessage=="function"&&!Co.importScripts;(()=>{if(wG){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 SG=!!(Jn&&Jn.indexOf("Chrome")>=0);Jn&&Jn.indexOf("Firefox")>=0;!SG&&Jn&&Jn.indexOf("Safari")>=0;Jn&&Jn.indexOf("Edg/")>=0;Jn&&Jn.indexOf("Android")>=0;var Ol=typeof navigator=="object"?navigator:{};q5||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ol&&Ol.clipboard&&Ol.clipboard.writeText,q5||Ol&&Ol.clipboard&&Ol.clipboard.readText;var Iy=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}},w_=new Iy,V5=new Iy,G5=new Iy,CG=new Array(230),tj;(e=>{function t(d){return w_.keyCodeToStr(d)}e.toString=t;function r(d){return w_.strToKeyCode(d)}e.fromString=r;function i(d){return V5.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return G5.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return V5.strToKeyCode(d)||G5.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 w_.keyCodeToStr(d)}e.toElectronAccelerator=u})(tj||(tj={}));var EG=class rj{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 rj&&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 RG([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},RG=class{constructor(e){if(e.length===0)throw ZV("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 kG(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return tj.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(F0)switch(t){case 59:return 85;case 60:if(yG)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Zn)return 57;break}else if(pG&&(Zn&&t===93||!Zn&&t===92))return 57;return CG[t]||0}var NG=Zn?256:2048,AG=512,TG=1024,MG=Zn?2048:256,Y5=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=kG(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|=NG),this.altKey&&(t|=AG),this.shiftKey&&(t|=TG),this.metaKey&&(t|=MG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new EG(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},K5=new WeakMap;function jG(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 DG=class{static getSameOriginWindowChain(e){let t=K5.get(e);if(!t){t=[],K5.set(e,t);let r=e,i;do i=jG(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}}},Qh=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=DG.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},X5=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(Py){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?F0&&!Zn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")gG&&ej?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?F0&&!Zn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},ij=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),LG;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof OG?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:zr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ij})})(LG||(LG={}));var OG=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?ij:(this._emitter||(this._emitter=new Se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zy=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 P0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new P0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},BG=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 P0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},t);this.disposable=It(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},PG;(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})(PG||(PG={}));var Z5=class qi{static fromArray(t){return new qi(r=>{r.emitMany(t)})}static fromPromise(t){return new qi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new qi(async r=>{await Promise.all(t.map(async i=>r.emitOne(await i)))})}static merge(t){return new qi(async r=>{await Promise.all(t.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Se,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await zr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new qi(async i=>{for await(let s of t)i.emitOne(r(s))})}map(t){return qi.map(this,t)}static filter(t,r){return new qi(async i=>{for await(let s of t)r(s)&&i.emitOne(s)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,r=>!!r)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let r=[];for await(let i of t)r.push(i);return r}toPromise(){return qi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Z5.EMPTY=Z5.fromArray([]);var{getWindow:Yn,getWindowId:IG,onDidRegisterWindow:zG}=(function(){let e=new Map,t={window:js,disposables:new ka};e.set(js.vscodeWindowId,t);let r=new Se,i=new Se,s=new Se;function o(u,d){return(typeof u=="number"?e.get(u):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return tt.None;let d=new ka,m={window:u,disposables:d.add(new ka)};return e.set(u.vscodeWindowId,m),d.add(It(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),d.add(We(u,br.BEFORE_UNLOAD,()=>{s.fire(u)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){var h;let d=u;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=u;return m!=null&&m.view?m.view.window:js},getDocument(u){return Yn(u).document}}})(),$G=class{constructor(e,t,r,i){this._node=e,this._type=t,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function We(e,t,r,i){return new $G(e,t,r,i)}var Q5=function(e,t,r,i){return We(e,t,r,i)},$y,UG=class extends BG{constructor(e){super(),this.defaultTarget=e&&Yn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},J5=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){vf(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(J5.sort),u.shift().execute();i.set(o,!1)};$y=(o,u,d=0)=>{let m=IG(o),h=new J5(u,d),g=e.get(m);return g||(g=[],e.set(m,g)),g.push(h),r.get(m)||(r.set(m,!0),o.requestAnimationFrame(()=>s(m))),h}})();function HG(e){let t=e.getBoundingClientRect(),r=Yn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var br={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},FG=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=hi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=hi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=hi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=hi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=hi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=hi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=hi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=hi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=hi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=hi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=hi(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=hi(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=hi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=hi(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 hi(e){return typeof e=="number"?`${e}px`:e}function ju(e){return new FG(e)}var nj=class{constructor(){this._hooks=new ka,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let o=e;try{e.setPointerCapture(t),this._hooks.add(It(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Yn(e)}this._hooks.add(We(o,br.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(We(o,br.POINTER_UP,u=>this.stopMonitoring(!0)))}};function WG(e,t,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let o=`$memoize$${t}`;r[i]=function(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,u)}),this[o]}}var Wn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Wn||(Wn={}));var Cu=class Wr extends tt{constructor(){super(),this.dispatched=!1,this.targets=new F5,this.ignoreTargets=new F5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(zr.runAndSubscribe(zG,({window:t,disposables:r})=>{r.add(We(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(We(t.document,"touchend",i=>this.onTouchEnd(t,i))),r.add(We(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:js,disposables:this._store}))}static addTarget(t){if(!Wr.isTouchDevice())return tt.None;Wr.INSTANCE||(Wr.INSTANCE=new Wr);let r=Wr.INSTANCE.targets.push(t);return It(r)}static ignoreTarget(t){if(!Wr.isTouchDevice())return tt.None;Wr.INSTANCE||(Wr.INSTANCE=new Wr);let r=Wr.INSTANCE.ignoreTargets.push(t);return It(r)}static isTouchDevice(){return"ontouchstart"in js||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:r,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[r],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let u=this.newGestureEvent(Wn.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,u=r.changedTouches.length;o<u;o++){let d=r.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],h=Date.now()-m.initialTimeStamp;if(h<Wr.HOLD_DELAY&&Math.abs(m.initialPageX-ki(m.rollingPageX))<30&&Math.abs(m.initialPageY-ki(m.rollingPageY))<30){let g=this.newGestureEvent(Wn.Tap,m.initialTarget);g.pageX=ki(m.rollingPageX),g.pageY=ki(m.rollingPageY),this.dispatchEvent(g)}else if(h>=Wr.HOLD_DELAY&&Math.abs(m.initialPageX-ki(m.rollingPageX))<30&&Math.abs(m.initialPageY-ki(m.rollingPageY))<30){let g=this.newGestureEvent(Wn.Contextmenu,m.initialTarget);g.pageX=ki(m.rollingPageX),g.pageY=ki(m.rollingPageY),this.dispatchEvent(g)}else if(s===1){let g=ki(m.rollingPageX),p=ki(m.rollingPageY),y=ki(m.rollingTimestamps)-m.rollingTimestamps[0],b=g-m.rollingPageX[0],w=p-m.rollingPageY[0],C=[...this.targets].filter(E=>m.initialTarget instanceof Node&&E.contains(m.initialTarget));this.inertia(t,C,i,Math.abs(b)/y,b>0?1:-1,g,Math.abs(w)/y,w>0?1:-1,p)}this.dispatchEvent(this.newGestureEvent(Wn.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(t){if(t.type===Wn.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Wr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,t.tapCount=i}else(t.type===Wn.Change||t.type===Wn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,o=t.initialTarget;for(;o&&o!==i;)s++,o=o.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,i,s,o,u,d,m,h){this.handle=$y(t,()=>{let g=Date.now(),p=g-i,y=0,b=0,w=!0;s+=Wr.SCROLL_FRICTION*p,d+=Wr.SCROLL_FRICTION*p,s>0&&(w=!1,y=o*s*p),d>0&&(w=!1,b=m*d*p);let C=this.newGestureEvent(Wn.Change);C.translationX=y,C.translationY=b,r.forEach(E=>E.dispatchEvent(C)),w||this.inertia(t,r,g,s,o,u+y,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(Wn.Change,u.initialTarget);d.translationX=o.pageX-ki(u.rollingPageX),d.translationY=o.pageY-ki(u.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(o.pageX),u.rollingPageY.push(o.pageY),u.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Cu.SCROLL_FRICTION=-.005,Cu.HOLD_DELAY=700,Cu.CLEAR_TAP_COUNT_TIME=400,Zt([WG],Cu,"isTouchDevice",1);var qG=Cu,Uy=class extends tt{onclick(e,t){this._register(We(e,br.CLICK,r=>t(new Qh(Yn(e),r))))}onmousedown(e,t){this._register(We(e,br.MOUSE_DOWN,r=>t(new Qh(Yn(e),r))))}onmouseover(e,t){this._register(We(e,br.MOUSE_OVER,r=>t(new Qh(Yn(e),r))))}onmouseleave(e,t){this._register(We(e,br.MOUSE_LEAVE,r=>t(new Qh(Yn(e),r))))}onkeydown(e,t){this._register(We(e,br.KEY_DOWN,r=>t(new Y5(r))))}onkeyup(e,t){this._register(We(e,br.KEY_UP,r=>t(new Y5(r))))}oninput(e,t){this._register(We(e,br.INPUT,t))}onblur(e,t){this._register(We(e,br.BLUR,t))}onfocus(e,t){this._register(We(e,br.FOCUS,t))}onchange(e,t){this._register(We(e,br.CHANGE,t))}ignoreGesture(e){return qG.ignoreTarget(e)}},eE=11,VG=class extends Uy{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=eE+"px",this.domNode.style.height=eE+"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 nj),this._register(Q5(this.bgDomNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Q5(this.domNode,br.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new UG),this._pointerdownScheduleRepeatTimer=this._register(new zy)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Yn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},GG=class V0{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 V0(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 V0(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}}},YG=class extends tt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new GG(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 rE(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=rE.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)))}},tE=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function S_(e,t){let r=t-e;return function(i){return e+r*ZG(i)}}function KG(e,t,r){return function(i){return i<r?e(i/r):t((i-r)/(1-r))}}var rE=class G0{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),KG(S_(t,s),S_(o,r),.33)}return S_(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 tE(i,s,!1)}return new tE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,i){return G0.start(t,r,i)}static start(t,r,i){i=i+10;let s=Date.now()-10;return new G0(t,r,s,i)}};function XG(e){return Math.pow(e,3)}function ZG(e){return 1-XG(1-e)}var QG=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 zy)}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":"")))}},JG=140,sj=class extends Uy{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 QG(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new nj),this._shouldRender=!0,this.domNode=ju(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(We(this.domNode.domNode,br.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new VG(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,i){this.slider=ju(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(We(this.slider.domNode,br.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let s=HG(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(ej&&u>JG){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()}},aj=class Y0{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 Y0(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))),g=(d-h)/(s-i),p=o*g;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let t=Y0._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)}},eY=class extends sj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new aj(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}},tY=class extends sj{constructor(e,t,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new aj(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}},rY=500,iE=50,iY=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},K0=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(Py){let r=Yn(t.browserEvent),i=mG(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 iY(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),g=Math.max(s,u),p=Math.max(o,d);g%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}};K0.INSTANCE=new K0;var nY=K0,sY=class extends Uy{constructor(e,t,r){super(),this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Se),this.onWillScroll=this._onWillScroll.event,this._options=oY(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 tY(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new eY(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=ju(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ju(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ju(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 zy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=To(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Zn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new X5(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=To(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new X5(r))};this._mouseWheelToDispose.push(We(this._listenOnDomNode,br.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=nY.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,u=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&u+o===0?u=o=0:Math.abs(o)>=Math.abs(u)?u=0:o=0),this._options.flipAxes&&([o,u]=[u,o]);let d=!Zn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!u&&(u=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(u=u*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=iE*o,p=m.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,p)}if(u){let g=iE*u,p=m.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));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(),rY)}},aY=class extends sY{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 oY(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Zn&&(t.className+=" mac"),t}var X0=class extends tt{constructor(e,t,r,i,s,o,u,d){super(),this._bufferService=r,this._optionsService=u,this._renderService=d,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new YG({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>$y(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new aY(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(zr.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(It(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(It(()=>this._styleElement.remove())),this._register(zr.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
654
|
+
`)})),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}};X0=Zt([Ne(2,ei),Ne(3,$s),Ne(4,$M),Ne(5,ac),Ne(6,ti),Ne(7,Us)],X0);var Z0=class extends tt{constructor(e,t,r,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(It(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Z0=Zt([Ne(1,ei),Ne(2,$s),Ne(3,md),Ne(4,Us)],Z0);var lY=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},$n={full:0,left:0,center:0,right:0},va={full:0,left:0,center:0,right:0},uu={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 lY,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(It(()=>{var g;return(g=this._canvas)==null?void 0:g.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(),uu.full=1,uu.left=1,uu.center=1+va.left,uu.right=1+va.left+va.center}_refreshDrawHeightConstants(){$n.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);$n.left=t,$n.center=t,$n.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$n.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(uu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-$n[e.position||"full"]/2),va[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$n[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};qf=Zt([Ne(2,ei),Ne(3,md),Ne(4,Us),Ne(5,ti),Ne(6,ac),Ne(7,$s)],qf);var ge;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
655
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ge||(ge={}));var yf;(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=""))(yf||(yf={}));var oj;(e=>e.ST=`${ge.ESC}\\`)(oj||(oj={}));var Q0=class{constructor(e,t,r,i,s,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ge.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Q0=Zt([Ne(2,ei),Ne(3,ti),Ne(4,Ho),Ne(5,Us)],Q0);var Er=0,Rr=0,kr=0,Kt=0,nE={css:"#00000000",rgba:0},lr;(e=>{function t(s,o,u,d){return d!==void 0?`#${fo(s)}${fo(o)}${fo(u)}${fo(d)}`:`#${fo(s)}${fo(o)}${fo(u)}`}e.toCss=t;function r(s,o,u,d=255){return(s<<24|o<<16|u<<8|d)>>>0}e.toRgba=r;function i(s,o,u,d){return{css:e.toCss(s,o,u,d),rgba:e.toRgba(s,o,u,d)}}e.toColor=i})(lr||(lr={}));var Dt;(e=>{function t(m,h){if(Kt=(h.rgba&255)/255,Kt===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,p=h.rgba>>16&255,y=h.rgba>>8&255,b=m.rgba>>24&255,w=m.rgba>>16&255,C=m.rgba>>8&255;Er=b+Math.round((g-b)*Kt),Rr=w+Math.round((p-w)*Kt),kr=C+Math.round((y-C)*Kt);let E=lr.toCss(Er,Rr,kr),S=lr.toRgba(Er,Rr,kr);return{css:E,rgba:S}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function i(m,h,g){let p=bf.ensureContrastRatio(m.rgba,h.rgba,g);if(p)return lr.toColor(p>>24&255,p>>16&255,p>>8&255)}e.ensureContrastRatio=i;function s(m){let h=(m.rgba|255)>>>0;return[Er,Rr,kr]=bf.toChannels(h),{css:lr.toCss(Er,Rr,kr),rgba:h}}e.opaque=s;function o(m,h){return Kt=Math.round(h*255),[Er,Rr,kr]=bf.toChannels(m.rgba),{css:lr.toCss(Er,Rr,kr,Kt),rgba:lr.toRgba(Er,Rr,kr,Kt)}}e.opacity=o;function u(m,h){return Kt=m.rgba&255,o(m,Kt*h/255)}e.multiplyOpacity=u;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Dt||(Dt={}));var $t;(e=>{let t,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Er=parseInt(s.slice(1,2).repeat(2),16),Rr=parseInt(s.slice(2,3).repeat(2),16),kr=parseInt(s.slice(3,4).repeat(2),16),lr.toColor(Er,Rr,kr);case 5:return Er=parseInt(s.slice(1,2).repeat(2),16),Rr=parseInt(s.slice(2,3).repeat(2),16),kr=parseInt(s.slice(3,4).repeat(2),16),Kt=parseInt(s.slice(4,5).repeat(2),16),lr.toColor(Er,Rr,kr,Kt);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Er=parseInt(o[1]),Rr=parseInt(o[2]),kr=parseInt(o[3]),Kt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),lr.toColor(Er,Rr,kr,Kt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Er,Rr,kr,Kt]=t.getImageData(0,0,1,1).data,Kt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:lr.toRgba(Er,Rr,kr,Kt),css:s}}e.toColor=i})($t||($t={}));var Kr;(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),g=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+g*.7152+p*.0722}e.relativeLuminance2=r})(Kr||(Kr={}));var bf;(e=>{function t(u,d){if(Kt=(d&255)/255,Kt===1)return d;let m=d>>24&255,h=d>>16&255,g=d>>8&255,p=u>>24&255,y=u>>16&255,b=u>>8&255;return Er=p+Math.round((m-p)*Kt),Rr=y+Math.round((h-y)*Kt),kr=b+Math.round((g-b)*Kt),lr.toRgba(Er,Rr,kr)}e.blend=t;function r(u,d,m){let h=Kr.relativeLuminance(u>>8),g=Kr.relativeLuminance(d>>8);if(Ns(h,g)<m){if(g<h){let b=i(u,d,m),w=Ns(h,Kr.relativeLuminance(b>>8));if(w<m){let C=s(u,d,m),E=Ns(h,Kr.relativeLuminance(C>>8));return w>E?b:C}return b}let p=s(u,d,m),y=Ns(h,Kr.relativeLuminance(p>>8));if(y<m){let b=i(u,d,m),w=Ns(h,Kr.relativeLuminance(b>>8));return y>w?p:b}return p}}e.ensureContrastRatio=r;function i(u,d,m){let h=u>>24&255,g=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Ns(Kr.relativeLuminance2(y,b,w),Kr.relativeLuminance2(h,g,p));for(;C<m&&(y>0||b>0||w>0);)y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Ns(Kr.relativeLuminance2(y,b,w),Kr.relativeLuminance2(h,g,p));return(y<<24|b<<16|w<<8|255)>>>0}e.reduceLuminance=i;function s(u,d,m){let h=u>>24&255,g=u>>16&255,p=u>>8&255,y=d>>24&255,b=d>>16&255,w=d>>8&255,C=Ns(Kr.relativeLuminance2(y,b,w),Kr.relativeLuminance2(h,g,p));for(;C<m&&(y<255||b<255||w<255);)y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Ns(Kr.relativeLuminance2(y,b,w),Kr.relativeLuminance2(h,g,p));return(y<<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})(bf||(bf={}));function fo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ns(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var cY=class extends fd{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 Xi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],i=t.translateToString(!0),s=0,o=0,u=0,d=t.getFg(0),m=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(h-s>1){let g=this._getJoinedRanges(i,u,o,t,s);for(let p=0;p<g.length;p++)r.push(g[p])}s=h,u=o,d=this._workCell.fg,m=this._workCell.bg}o+=this._workCell.getChars().length||Ca.length}if(this._bufferService.cols-s>1){let h=this._getJoinedRanges(i,u,o,t,s);for(let g=0;g<h.length;g++)r.push(h[g])}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||Ca.length;if(m!==0){if(!s&&u[0]<=o&&(u[0]=d,s=!0),u[1]<=o){if(u[1]=d,u=e[++i],!u)break;u[0]<=o?(u[0]=d,s=!0):s=!1}o+=h}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};Vf=Zt([Ne(0,ei)],Vf);function uY(e){return 57508<=e&&e<=57558}function dY(e){return 9472<=e&&e<=9631}function hY(e){return uY(e)||dY(e)}function fY(){return{css:{canvas:Jh(),cell:Jh()},device:{canvas:Jh(),cell:Jh(),char:{width:0,height:0,left:0,top:0}}}}function Jh(){return{width:0,height:0}}var J0=class{constructor(e,t,r,i,s,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=o,this._themeService=u,this._workCell=new Xi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,i,s,o,u,d,m,h,g){let p=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<o+1&&(w=o+1);let C,E=0,S="",N=0,k=0,R=0,M=0,L=!1,z=0,D=!1,W=0,G=0,q=[],B=h!==-1&&g!==-1;for(let j=0;j<w;j++){e.loadCell(j,this._workCell);let O=this._workCell.getWidth();if(O===0)continue;let $=!1,T=j>=G,U=j,H=this._workCell;if(y.length>0&&j===y[0][0]&&T){let J=y.shift(),ie=this._isCellInSelection(J[0],t);for(N=J[0]+1;N<J[1];N++)T&&(T=ie===this._isCellInSelection(N,t));T&&(T=!r||o<J[0]||o>=J[1]),T?($=!0,H=new cY(this._workCell,e.translateToString(!0,J[0],J[1]),J[1]-J[0]),U=J[1]-1,O=H.getWidth()):G=J[1]}let F=this._isCellInSelection(j,t),V=r&&j===o,I=B&&j>=h&&j<=g,Y=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,J=>{Y=!0});let X=H.getChars()||Ca;if(X===" "&&(H.isUnderline()||H.isOverline())&&(X=" "),W=O*d-m.get(X,H.isBold(),H.isItalic()),!C)C=this._document.createElement("span");else if(E&&(F&&D||!F&&!D&&H.bg===k)&&(F&&D&&b.selectionForeground||H.fg===R)&&H.extended.ext===M&&I===L&&W===z&&!V&&!$&&!Y&&T){H.isInvisible()?S+=Ca:S+=X,E++;continue}else E&&(C.textContent=S),C=this._document.createElement("span"),E=0,S="";if(k=H.bg,R=H.fg,M=H.extended.ext,L=I,z=W,D=F,$&&o>=j&&o<=U&&(o=j),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&q.push("xterm-cursor-blink"),q.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(H.isBold()&&q.push("xterm-bold"),H.isItalic()&&q.push("xterm-italic"),H.isDim()&&q.push("xterm-dim"),H.isInvisible()?S=Ca:S=H.getChars()||Ca,H.isUnderline()&&(q.push(`xterm-underline-${H.extended.underlineStyle}`),S===" "&&(S=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${fd.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let J=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&J<8&&(J+=8),C.style.textDecorationColor=b.ansi[J].css}H.isOverline()&&(q.push("xterm-overline"),S===" "&&(S=" ")),H.isStrikethrough()&&q.push("xterm-strikethrough"),I&&(C.style.textDecoration="underline");let ee=H.getFgColor(),re=H.getFgColorMode(),oe=H.getBgColor(),Z=H.getBgColorMode(),ce=!!H.isInverse();if(ce){let J=ee;ee=oe,oe=J;let ie=re;re=Z,Z=ie}let ne,we,_e=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,J=>{J.options.layer!=="top"&&_e||(J.backgroundColorRGB&&(Z=50331648,oe=J.backgroundColorRGB.rgba>>8&16777215,ne=J.backgroundColorRGB),J.foregroundColorRGB&&(re=50331648,ee=J.foregroundColorRGB.rgba>>8&16777215,we=J.foregroundColorRGB),_e=J.options.layer==="top")}),!_e&&F&&(ne=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,oe=ne.rgba>>8&16777215,Z=50331648,_e=!0,b.selectionForeground&&(re=50331648,ee=b.selectionForeground.rgba>>8&16777215,we=b.selectionForeground)),_e&&q.push("xterm-decoration-top");let ye;switch(Z){case 16777216:case 33554432:ye=b.ansi[oe],q.push(`xterm-bg-${oe}`);break;case 50331648:ye=lr.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(C,`background-color:#${sE((oe>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(ye=b.foreground,q.push("xterm-bg-257")):ye=b.background}switch(ne||H.isDim()&&(ne=Dt.multiplyOpacity(ye,.5)),re){case 16777216:case 33554432:H.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(C,ye,b.ansi[ee],H,ne,void 0)||q.push(`xterm-fg-${ee}`);break;case 50331648:let J=lr.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(C,ye,J,H,ne,we)||this._addStyle(C,`color:#${sE(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,ye,b.foreground,H,ne,we)||ce&&q.push("xterm-fg-257")}q.length&&(C.className=q.join(" "),q.length=0),!V&&!$&&!Y&&T?E++:C.textContent=S,W!==this.defaultSpacing&&(C.style.letterSpacing=`${W}px`),p.push(C),j=U}return C&&E&&(C.textContent=S),p}_applyMinimumContrast(e,t,r,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||hY(i.getCode()))return!1;let u=this._getContrastCache(i),d;if(!s&&!o&&(d=u.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Dt.ensureContrastRatio(s||t,o||r,m),u.setColor((s||t).rgba,(o||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&t>=r[1]&&e<i[0]&&t<=i[1]:e<r[0]&&t>=r[1]&&e>=i[0]&&t<=i[1]:t>r[1]&&t<i[1]||r[1]===i[1]&&t===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&t===i[1]&&e<i[0]||r[1]<i[1]&&t===r[1]&&e>=r[0]}};J0=Zt([Ne(1,FM),Ne(2,ti),Ne(3,$s),Ne(4,Ho),Ne(5,md),Ne(6,ac)],J0);function sE(e,t,r){for(;e.length<r;)e=t+e;return e}var mY=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}},pY=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 gY(){return new pY}var C_="xterm-dom-renderer-owner-",Hi="xterm-rows",ef="xterm-fg-",aE="xterm-bg-",du="xterm-focus",tf="xterm-selection",vY=1,ex=class extends tt{constructor(e,t,r,i,s,o,u,d,m,h,g,p,y,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=g,this._coreService=p,this._coreBrowserService=y,this._themeService=b,this._terminalClass=vY++,this._rowElements=[],this._selectionRenderModel=gY(),this.onRequestRedraw=this._register(new Se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Hi),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(tf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=fY(),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(J0,document),this._element.classList.add(C_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(It(()=>{this._element.classList.remove(C_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new mY(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Hi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Hi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Hi} .xterm-dim { color: ${Dt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Hi}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Hi}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Hi}.${du} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Hi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${tf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${tf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${tf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ef}${o} { color: ${u.css}; }${this._terminalSelector} .${ef}${o}.xterm-dim { color: ${Dt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${aE}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ef}257 { color: ${Dt.opaque(e.background).css}; }${this._terminalSelector} .${ef}257.xterm-dim { color: ${Dt.multiplyOpacity(Dt.opaque(e.background),.5).css}; }${this._terminalSelector} .${aE}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(du),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(du),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 g=u-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),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,g=this._rowElements[m],p=r.lines.get(h);if(!g||!p)break;g.replaceChildren(...this._rowFactory.createRow(p,h,h===i,u,d,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${C_}${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),g=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,y=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=r;b<=i;++b){let w=b+d.ydisp,C=this._rowElements[b],E=d.lines.get(w);if(!C||!E)break;C.replaceChildren(...this._rowFactory.createRow(E,w,w===m,p,y,h,g,this.dimensions.css.cell.width,this._widthCache,o?b===r?e:0:-1,o?(b===i?t:s)-1:-1))}}};ex=Zt([Ne(7,Ly),Ne(8,Om),Ne(9,ti),Ne(10,ei),Ne(11,Ho),Ne(12,$s),Ne(13,ac)],ex);var tx=class extends tt{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new xY(this._optionsService))}catch{this._measureStrategy=this._register(new _Y(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())}};tx=Zt([Ne(2,ti)],tx);var lj=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)}},_Y=class extends lj{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}},xY=class extends lj{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}},yY=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 Se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(zr.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(We(this._textarea,"focus",()=>this._isFocused=!0)),this._register(We(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},bY=class extends tt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Zl),this._onDprChange=this._register(new Se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(It(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=We(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},wY=class extends tt{constructor(){super(),this.linkProviders=[],this._register(It(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Hy(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 SY(e,t,r,i,s,o,u,d,m){if(!o)return;let h=Hy(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 rx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,i,s){return SY(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=Hy(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])}}};rx=Zt([Ne(0,Us),Ne(1,Om)],rx);var CY=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=[]}},cj={};LV(cj,{getSafariVersion:()=>RY,isChromeOS:()=>fj,isFirefox:()=>uj,isIpad:()=>kY,isIphone:()=>NY,isLegacyEdge:()=>EY,isLinux:()=>Fy,isMac:()=>Gf,isNode:()=>Bm,isSafari:()=>dj,isWindows:()=>hj});var Bm=typeof process<"u"&&"title"in process,pd=Bm?"node":navigator.userAgent,gd=Bm?"node":navigator.platform,uj=pd.includes("Firefox"),EY=pd.includes("Edge"),dj=/^((?!chrome|android).)*safari/i.test(pd);function RY(){if(!dj)return 0;let e=pd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Gf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(gd),kY=gd==="iPad",NY=gd==="iPhone",hj=["Windows","Win16","Win32","WinCE"].includes(gd),Fy=gd.indexOf("Linux")>=0,fj=/\bCrOS\b/.test(pd),mj=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()}},AY=class extends mj{_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())}}},TY=class extends mj{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Yf=!Bm&&"requestIdleCallback"in window?TY:AY,MY=class{constructor(){this._queue=new Yf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ix=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 MY,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 Se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new CY((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new jY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(It(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=It(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var i;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};ix=Zt([Ne(2,ti),Ne(3,Om),Ne(4,Ho),Ne(5,md),Ne(6,ei),Ne(7,$s),Ne(8,ac)],ix);var jY=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 DY(e,t,r,i){let s=r.buffer.x,o=r.buffer.y;if(!r.buffer.hasScrollback)return BY(s,o,e,t,r,i)+Pm(o,t,r,i)+PY(s,o,e,t,r,i);let u;if(o===t)return u=s>e?"D":"C",Gu(Math.abs(s-e),Vu(u,i));u=o>t?"D":"C";let d=Math.abs(o-t),m=OY(o>t?e:s,r)+(d-1)*r.cols+1+LY(o>t?s:e);return Gu(m,Vu(u,i))}function LY(e,t){return e-1}function OY(e,t){return t.cols-e}function BY(e,t,r,i,s,o){return Pm(t,i,s,o).length===0?"":Gu(gj(e,t,e,t-Mo(t,s),!1,s).length,Vu("D",o))}function Pm(e,t,r,i){let s=e-Mo(e,r),o=t-Mo(t,r),u=Math.abs(s-o)-IY(e,t,r);return Gu(u,Vu(pj(e,t),i))}function PY(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=zY(e,t,r,i,s,o);return Gu(gj(e,u,r,d,m==="C",s).length,Vu(m,o))}function IY(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=pj(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 zY(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 pj(e,t){return e>t?"A":"B"}function gj(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 Vu(e,t){let r=t?"O":"[";return ge.ESC+r+e}function Gu(e,t){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=t;return r}var $Y=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 oE(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 E_=50,UY=15,HY=50,FY=500,WY=" ",qY=new RegExp(WY,"g"),nx=class extends tt{constructor(e,t,r,i,s,o,u,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=o,this._optionsService=u,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Xi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new $Y(this._bufferService),this._activeSelectionMode=0,this._register(It(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let d=r.translateBufferLineToString(u,!0,s,o);i.push(d)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let o=e[1]+1;o<=t[1]-1;o++){let u=r.lines.get(o),d=r.translateBufferLineToString(o,!0);u!=null&&u.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=r.lines.get(t[1]),u=r.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(s=>s.replace(qY," ")).join(hj?`\r
|
|
656
|
+
`:`
|
|
657
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Fy&&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=oE(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=Hy(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,-E_),E_),t/=E_,t/Math.abs(t)+Math.round(t*(UY-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(),HY)}_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<FY&&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=DY(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,g=0,p=0,y=0,b=0;if(u.charAt(d)===" "){for(;d>0&&u.charAt(d-1)===" ";)d--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let E=e[0],S=e[0];o.getWidth(E)===0&&(g++,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?(g++,E--):k>1&&(y+=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-g+y,C=Math.min(this._bufferService.cols,m-d+g+p-y-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=oE(r,this._bufferService.cols)}};nx=Zt([Ne(3,ei),Ne(4,Ho),Ne(5,Oy),Ne(6,ti),Ne(7,Us),Ne(8,$s)],nx);var lE=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={}}},cE=class{constructor(){this._color=new lE,this._css=new lE}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},fr=Object.freeze((()=>{let e=[$t.toColor("#2e3436"),$t.toColor("#cc0000"),$t.toColor("#4e9a06"),$t.toColor("#c4a000"),$t.toColor("#3465a4"),$t.toColor("#75507b"),$t.toColor("#06989a"),$t.toColor("#d3d7cf"),$t.toColor("#555753"),$t.toColor("#ef2929"),$t.toColor("#8ae234"),$t.toColor("#fce94f"),$t.toColor("#729fcf"),$t.toColor("#ad7fa8"),$t.toColor("#34e2e2"),$t.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=t[r/36%6|0],s=t[r/6%6|0],o=t[r%6];e.push({css:lr.toCss(i,s,o),rgba:lr.toRgba(i,s,o)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:lr.toCss(i,i,i),rgba:lr.toRgba(i,i,i)})}return e})()),mo=$t.toColor("#ffffff"),Eu=$t.toColor("#000000"),uE=$t.toColor("#ffffff"),dE=Eu,hu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},VY=mo,sx=class extends tt{constructor(e){super(),this._optionsService=e,this._contrastCache=new cE,this._halfContrastCache=new cE,this._onChangeColors=this._register(new Se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:mo,background:Eu,cursor:uE,cursorAccent:dE,selectionForeground:void 0,selectionBackgroundTransparent:hu,selectionBackgroundOpaque:Dt.blend(Eu,hu),selectionInactiveBackgroundTransparent:hu,selectionInactiveBackgroundOpaque:Dt.blend(Eu,hu),scrollbarSliderBackground:Dt.opacity(mo,.2),scrollbarSliderHoverBackground:Dt.opacity(mo,.4),scrollbarSliderActiveBackground:Dt.opacity(mo,.5),overviewRulerBorder:mo,ansi:fr.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ct(e.foreground,mo),t.background=Ct(e.background,Eu),t.cursor=Dt.blend(t.background,Ct(e.cursor,uE)),t.cursorAccent=Dt.blend(t.background,Ct(e.cursorAccent,dE)),t.selectionBackgroundTransparent=Ct(e.selectionBackground,hu),t.selectionBackgroundOpaque=Dt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ct(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Dt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ct(e.selectionForeground,nE):void 0,t.selectionForeground===nE&&(t.selectionForeground=void 0),Dt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Dt.opacity(t.selectionBackgroundTransparent,.3)),Dt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Dt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ct(e.scrollbarSliderBackground,Dt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ct(e.scrollbarSliderHoverBackground,Dt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ct(e.scrollbarSliderActiveBackground,Dt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ct(e.overviewRulerBorder,VY),t.ansi=fr.slice(),t.ansi[0]=Ct(e.black,fr[0]),t.ansi[1]=Ct(e.red,fr[1]),t.ansi[2]=Ct(e.green,fr[2]),t.ansi[3]=Ct(e.yellow,fr[3]),t.ansi[4]=Ct(e.blue,fr[4]),t.ansi[5]=Ct(e.magenta,fr[5]),t.ansi[6]=Ct(e.cyan,fr[6]),t.ansi[7]=Ct(e.white,fr[7]),t.ansi[8]=Ct(e.brightBlack,fr[8]),t.ansi[9]=Ct(e.brightRed,fr[9]),t.ansi[10]=Ct(e.brightGreen,fr[10]),t.ansi[11]=Ct(e.brightYellow,fr[11]),t.ansi[12]=Ct(e.brightBlue,fr[12]),t.ansi[13]=Ct(e.brightMagenta,fr[13]),t.ansi[14]=Ct(e.brightCyan,fr[14]),t.ansi[15]=Ct(e.brightWhite,fr[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)t.ansi[i+16]=Ct(e.extendedAnsi[i],fr[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};sx=Zt([Ne(0,ti)],sx);function Ct(e,t){if(e!==void 0)try{return $t.toColor(e)}catch{}return t}var GY=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)}},YY=class{constructor(){this._services=new GY,this._services.set(Ly,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=UV(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)}},KY={trace:0,debug:1,info:2,warn:3,error:4,off:5},XY="xterm.js: ",ax=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=KY[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?"":XY)+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)}};ax=Zt([Ne(0,ti)],ax);var hE=class extends tt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...r){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=t-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+t+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Je=3,ar=Object.freeze(new fd),rf=0,R_=2,Ru=class vj{constructor(t,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Je);let s=r||Xi.fromCharData([0,BM,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let r=this._data[t*Je+0],i=r&2097151;return[this._data[t*Je+1],r&2097152?this._combined[t]:i?wa(i):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,r){this._data[t*Je+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Je+0]=t|2097152|r[2]<<22):this._data[t*Je+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Je+0]>>22}hasWidth(t){return this._data[t*Je+0]&12582912}getFg(t){return this._data[t*Je+1]}getBg(t){return this._data[t*Je+2]}hasContent(t){return this._data[t*Je+0]&4194303}getCodePoint(t){let r=this._data[t*Je+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Je+0]&2097152}getString(t){let r=this._data[t*Je+0];return r&2097152?this._combined[t]:r&2097151?wa(r&2097151):""}isProtected(t){return this._data[t*Je+2]&536870912}loadCell(t,r){return rf=t*Je,r.content=this._data[rf+0],r.fg=this._data[rf+1],r.bg=this._data[rf+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Je+0]=r.content,this._data[t*Je+1]=r.fg,this._data[t*Je+2]=r.bg}setCellFromCodepoint(t,r,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Je+0]=r|i<<22,this._data[t*Je+1]=s.fg,this._data[t*Je+2]=s.bg}addCodepointToCell(t,r,i){let s=this._data[t*Je+0];s&2097152?this._combined[t]+=wa(r):s&2097151?(this._combined[t]=wa(s&2097151)+wa(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*Je+0]=s}insertCells(t,r,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length-t){let s=new Xi;for(let o=this.length-t-r-1;o>=0;--o)this.setCell(t+r+o,this.loadCell(t+o,s));for(let o=0;o<r;++o)this.setCell(t+o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,r,i){if(t%=this.length,r<this.length-t){let s=new Xi;for(let o=0;o<this.length-t-r;++o)this.setCell(t+o,this.loadCell(t+r+o,s));for(let o=this.length-r;o<this.length;++o)this.setCell(o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,r,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);t<r&&t<this.length;)this.setCell(t++,i)}resize(t,r){if(t===this.length)return this._data.length*4*R_<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*R_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*R_<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 vj(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303)return t+(this._data[t*Je+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Je+0]&4194303||this._data[t*Je+2]&50331648)return t+(this._data[t*Je+0]>>22);return 0}copyCellsFrom(t,r,i,s,o){let u=t._data;if(o)for(let m=s-1;m>=0;m--){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}else for(let m=0;m<s;m++){for(let h=0;h<Je;h++)this._data[(i+m)*Je+h]=u[(r+m)*Je+h];u[(r+m)*Je+2]&268435456&&(this._extendedAttrs[i+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let h=parseInt(d[m],10);h>=r&&(this._combined[h-r+i]=t._combined[h])}}translateToString(t,r,i,s){r=r??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let o="";for(;r<i;){let u=this._data[r*Je+0],d=u&2097151,m=u&2097152?this._combined[r]:d?wa(d):Ca;if(o+=m,s)for(let h=0;h<m.length;++h)s.push(r);r+=u>>22||1}return s&&s.push(r),o}};function ZY(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 g=[e.get(d)];for(;m<e.length&&h.isWrapped;)g.push(h),h=e.get(++m);if(!o&&i>=d&&i<m){d+=g.length-1;continue}let p=0,y=Yu(g,p,t),b=1,w=0;for(;b<g.length;){let E=Yu(g,b,t),S=E-w,N=r-y,k=Math.min(S,N);g[p].copyCellsFrom(g[b],w,y,k,!1),y+=k,y===r&&(p++,y=0),w+=k,w===E&&(b++,w=0),y===0&&p!==0&&g[p-1].getWidth(r-1)===2&&(g[p].copyCellsFrom(g[p-1],r-1,y++,1,!1),g[p-1].setCell(r-1,s))}g[p].replaceCells(y,r,s);let C=0;for(let E=g.length-1;E>0&&(E>p||g[E].getTrimmedLength()===0);E--)C++;C>0&&(u.push(d+g.length-C),u.push(C)),d+=g.length-1}return u}function QY(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 JY(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 eK(e,t,r){let i=[],s=e.map((m,h)=>Yu(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=Yu(e,u,t);o>m&&(o-=m,u++);let h=e[u].getWidth(o-1)===2;h&&o--;let g=h?r-1:r;i.push(g),d+=g}return i}function Yu(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 _j=class xj{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=xj._nextId++,this._onDispose=this.register(new Se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),To(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};_j._nextId=1;var tK=_j,gr={},po=gr.B;gr[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};gr.A={"#":"£"};gr.B=void 0;gr[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gr.C=gr[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gr.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gr.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gr.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gr.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gr.E=gr[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gr.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gr.H=gr[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gr["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var fE=4294967295,mE=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ar.clone(),this.savedCharset=po,this.markers=[],this._nullCell=Xi.fromCharData([0,BM,1,0]),this._whitespaceCell=Xi.fromCharData([0,Ca,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 hE(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 Ru(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>fE?fE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ar);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new hE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(ar),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,r);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ru(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 Ru(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=ZY(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ar),r);if(i.length>0){let s=QY(this.lines,i);JY(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let i=this.getNullCell(ar),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ru(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(ar),s=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let d=this.lines.get(u);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&u>0;)d=this.lines.get(--u),m.unshift(d);if(!r){let k=this.ybase+this.y;if(k>=u&&k<u+m.length)continue}let h=m[m.length-1].getTrimmedLength(),g=eK(m,this._cols,e),p=g.length-m.length,y;this.ybase===0&&this.y!==this.lines.length-1?y=Math.max(0,this.y-this.lines.maxLength+p):y=Math.max(0,this.lines.length-this.lines.maxLength+p);let b=[];for(let k=0;k<p;k++){let R=this.getBlankLine(ar,!0);b.push(R)}b.length>0&&(s.push({start:u+m.length+o,newLines:b}),o+=b.length),m.push(...b);let w=g.length-1,C=g[w];C===0&&(w--,C=g[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=g[w]),S-=k,S===0){E--;let R=Math.max(E,0);S=Yu(m,R,this._cols)}}for(let k=0;k<m.length;k++)g[k]<e&&m[k].setCell(g[k],i);let N=p-y;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,g=0,p=s[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let y=0;for(let C=Math.min(this.lines.maxLength-1,m+o-1);C>=0;C--)if(p&&p.start>h+y){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}),y+=p.newLines.length,p=s[++g]}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 tK(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)}},rK=class extends tt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Se),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new mE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new mE(!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)}},yj=2,bj=1,ox=class extends tt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,yj),this.rows=Math.max(e.rawOptions.rows||0,bj),this.buffers=this._register(new rK(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))}};ox=Zt([Ne(0,ti)],ox);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:{}},iK=["normal","bold","100","200","300","400","500","600","700","800","900"],nK=class extends tt{constructor(e){super(),this._onOptionChange=this._register(new Se),this.onOptionChange=this._onOptionChange.event;let t={...Bl};for(let r in e)if(r in t)try{let i=e[r];t[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(It(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,i)=>{if(!(r in Bl))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Bl[e]),!sK(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=iK.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 sK(e){return e==="block"||e==="underline"||e==="bar"}function ku(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]&&ku(e[i],t-1);return r}var pE=Object.freeze({insertMode:!1}),gE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),lx=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Se),this.onData=this._onData.event,this._onUserInput=this._register(new Se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ku(pE),this.decPrivateModes=ku(gE)}reset(){this.modes=ku(pE),this.decPrivateModes=ku(gE)}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))}};lx=Zt([Ne(0,ei),Ne(1,UM),Ne(2,ti)],lx);var vE={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 k_(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 N_=String.fromCharCode,_E={DEFAULT:e=>{let t=[k_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${N_(t[0])}${N_(t[1])}${N_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${k_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${k_(e,!0)};${e.x};${e.y}${t}`}},cx=class extends tt{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Se),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(vE))this.addProtocol(i,vE[i]);for(let i of Object.keys(_E))this.addEncoding(i,_E[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)}};cx=Zt([Ne(0,ei),Ne(1,Ho),Ne(2,ti)],cx);var A_=[[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]],aK=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],mr;function oK(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 lK=class{constructor(){if(this.version="6",!mr){mr=new Uint8Array(65536),mr.fill(1),mr[0]=0,mr.fill(0,1,32),mr.fill(0,127,160),mr.fill(2,4352,4448),mr[9001]=2,mr[9002]=2,mr.fill(2,11904,42192),mr[12351]=1,mr.fill(2,44032,55204),mr.fill(2,63744,64256),mr.fill(2,65040,65050),mr.fill(2,65072,65136),mr.fill(2,65280,65377),mr.fill(2,65504,65511);for(let e=0;e<A_.length;++e)mr.fill(0,A_[e][0],A_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?mr[e]:oK(e,aK)?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 wf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Se,this.onChange=this._onChange.event;let t=new lK;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=wf.extractWidth(d);wf.extractShouldJoin(d)&&(m-=wf.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 xE(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 fu=2147483647,uK=256,wj=class ux{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>uK)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 ux;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 ux(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>fu?fu: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>fu?fu: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,fu):t}},mu=[],dK=class{constructor(){this._state=0,this._active=mu,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=mu}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=mu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mu,!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=mu,this._id=-1,this._state=0}}},Ni=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=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}},pu=[],hK=class{constructor(){this._handlers=Object.create(null),this._active=pu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=pu}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=pu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||pu,!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=pu,this._ident=0}},Nu=new wj;Nu.addParam(0);var yE=class{constructor(e){this._handler=e,this._data="",this._params=Nu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Nu,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=Nu,this._data="",this._hitLimit=!1,r));return this._params=Nu,this._data="",this._hitLimit=!1,t}},fK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,i){this.table[t<<8|e]=r<<4|i}addMany(e,t,r,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=r<<4|i}},Vi=160,mK=(function(){let e=new fK(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let o=r(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Vi,0,2,0),e.add(Vi,8,5,8),e.add(Vi,6,0,6),e.add(Vi,11,0,11),e.add(Vi,13,13,13),e})(),pK=class extends tt{constructor(e=mK){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 wj,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(It(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new dK),this._dcsParser=this._register(new hK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let o=e.intermediates.charCodeAt(s);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=i,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,r){let i=0,s=0,o=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=d[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],u=this._oscParser.end(i!==24&&i!==26,r),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=o;d<t;++d){switch(i=e[d],s=this._transitions.table[this.currentState<<8|(i<160?i:Vi)],s>>4){case 2:for(let y=d+1;;++y){if(y>=t||(i=e[y])<32||i>126&&i<Vi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Vi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Vi){this._printHandler(e,d,y),d=y-1;break}if(++y>=t||(i=e[y])<32||i>126&&i<Vi){this._printHandler(e,d,y),d=y-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|i],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 g=this._escHandlers[this._collect<<8|i],p=g?g.length-1:-1;for(;p>=0&&(u=g[p](),u!==!0);p--)if(u instanceof Promise)return this._preserveStack(4,g,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 y=d+1;;++y)if(y>=t||(i=e[y])===24||i===26||i===27||i>127&&i<Vi){this._dcsParser.put(e,d,y),d=y-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,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 y=d+1;;y++)if(y>=t||(i=e[y])<32||i>127&&i<Vi){this._oscParser.put(e,d,y),d=y-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,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}}},gK=/^([\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})$/,vK=/^[\da-f]+$/;function bE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=gK.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),vK.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 T_(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 _K(e,t=16){let[r,i,s]=e;return`rgb:${T_(r,t)}/${T_(i,t)}/${T_(s,t)}`}var xK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},_a=131072,wE=10;function SE(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 CE=5e3,EE=0,yK=class extends tt{constructor(e,t,r,i,s,o,u,d,m=new pK){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 zV,this._utf8Decoder=new $V,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ar.clone(),this._eraseAttrDataInternal=ar.clone(),this._onRequestBell=this._register(new Se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Se),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new dx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.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,g,p)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:p})}),this._parser.setDcsHandlerFallback((h,g,p)=>{g==="HOOK"&&(p=p.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:p})}),this._parser.setPrintHandler((h,g,p)=>this.print(h,g,p)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ge.BEL,()=>this.bell()),this._parser.setExecuteHandler(ge.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ge.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ge.BS,()=>this.backspace()),this._parser.setExecuteHandler(ge.HT,()=>this.tab()),this._parser.setExecuteHandler(ge.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ge.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(yf.IND,()=>this.index()),this._parser.setExecuteHandler(yf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(yf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ni(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ni(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ni(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ni(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ni(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ni(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ni(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ni(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ni(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ni(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ni(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ni(h=>this.restoreCursorColor(h))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let h in gr)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new yE((h,g)=>this.requestStatusString(h,g)))}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"),CE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${CE} 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 g=h+_a<e.length?h+_a:e.length,p=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),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,g=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,g);let y=this._parser.precedingJoinState;for(let b=t;b<r;++b){if(i=e[b],i<127&&o){let S=o[String.fromCharCode(i)];S&&(i=S.charCodeAt(0))}let w=this._unicodeService.charProperties(i,y);s=_o.extractWidth(w);let C=_o.extractShouldJoin(w),E=C?_o.extractWidth(y):0;if(y=w,u&&this._onA11yChar.fire(wa(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-E>d){if(m){let S=p,N=this._activeBuffer.x-E;for(this._activeBuffer.x=E,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&p instanceof Ru&&p.copyCellsFrom(S,N,0,E,!1);N<d;)S.setCellFromCodepoint(N++,0,1,g)}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,g);continue}if(h&&(p.insertCells(this._activeBuffer.x,s-E,this._activeBuffer.getNullCell(g)),p.getWidth(d-1)===2&&p.setCellFromCodepoint(d-1,0,1,g)),p.setCellFromCodepoint(this._activeBuffer.x++,i,s,g),s>0)for(;--s;)p.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=y,this._activeBuffer.x<d&&r-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>SE(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new yE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ni(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,i=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ar));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,i=_o.extractWidth(t),s=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),u=new Uint32Array(o.length*r),d=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;u[d++]=g,h+=g>65535?2:1}let m=d;for(let h=1;h<r;++h)u.copyWithin(m,0,d),m+=d;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ge.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ge.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ge.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ge.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ge.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,po),this._charsetService.setgCharset(1,po),this._charsetService.setgCharset(2,po),this._charsetService.setgCharset(3,po);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:h,alt:g}=d,p=this._optionsService.rawOptions,y=(C,E)=>(u.triggerDataEvent(`${ge.ESC}[${t?"":"?"}${C};${E}$y`),!0),b=C=>C?1:2,w=e.params[0];return t?w===2?y(w,4):w===4?y(w,b(u.modes.insertMode)):w===12?y(w,3):w===20?y(w,b(p.convertEol)):y(w,0):w===1?y(w,b(i.applicationCursorKeys)):w===3?y(w,p.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?y(w,b(i.origin)):w===7?y(w,b(i.wraparound)):w===8?y(w,3):w===9?y(w,b(s==="X10")):w===12?y(w,b(p.cursorBlink)):w===25?y(w,b(!u.isCursorHidden)):w===45?y(w,b(i.reverseWraparound)):w===66?y(w,b(i.applicationKeypad)):w===67?y(w,4):w===1e3?y(w,b(s==="VT200")):w===1002?y(w,b(s==="DRAG")):w===1003?y(w,b(s==="ANY")):w===1004?y(w,b(i.sendFocus)):w===1005?y(w,4):w===1006?y(w,b(o==="SGR")):w===1015?y(w,4):w===1016?y(w,b(o==="SGR_PIXELS")):w===1048?y(w,1):w===47||w===1047||w===1049?y(w,b(h===g)):w===2004?y(w,b(i.bracketedPasteMode)):w===2026?y(w,b(i.synchronizedOutput)):y(w,0)}_updateAttrColor(e,t,r,i,s){return t===2?(e|=50331648,e&=-16777216,e|=fd.fromColorRGB([r,i,s])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let i=[0,0,-1,0,0,0],s=0,o=0;do{if(i[o+s]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),d=0;do i[1]===5&&(s=1),i[o+d+1+s]=u[d];while(++d<u.length&&d+o+1+s<i.length);break}if(i[1]===5&&o+s>=2||i[1]===2&&o+s>=5)break;i[1]&&(s=1)}while(++o+t<e.length&&o+s<i.length);for(let u=2;u<i.length;++u)i[u]===-1&&(i[u]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ar.fg,e.bg=ar.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,i=this._curAttrData;for(let s=0;s<t;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=ar.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=ar.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=ar.fg&16777215,i.bg&=-67108864,i.bg|=ar.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ge.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ge.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ar.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!SE(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ge.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>wE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>wE&&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(RE(o))if(s==="?")t.push({type:0,index:o});else{let u=bE(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=bE(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]);RE(s)&&t.push({type:2,index:s})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,po),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(xK[e[0]],gr[e[1]]||po),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ar.clone(),this._eraseAttrDataInternal=ar.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Xi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=u=>(this._coreService.triggerDataEvent(`${ge.ESC}${u}${ge.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},dx=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&&(EE=e,e=t,t=EE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};dx=Zt([Ne(0,ei)],dx);function RE(e){return 0<=e&&e<256}var bK=5e7,kE=12,wK=50,SK=class extends tt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>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>=kE?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>=kE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>wK&&(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()}},hx=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)))}};hx=Zt([Ne(0,ei)],hx);var NE=!1,CK=class extends tt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Zl),this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onData=this._register(new Se),this.onData=this._onData.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Se),this._instantiationService=new YY,this.optionsService=this._register(new nK(e)),this._instantiationService.setService(ti,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ox)),this._instantiationService.setService(ei,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ax)),this._instantiationService.setService(UM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(lx)),this._instantiationService.setService(Ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(cx)),this._instantiationService.setService($M,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(_o)),this._instantiationService.setService(WV,this.unicodeService),this._charsetService=this._instantiationService.createInstance(cK),this._instantiationService.setService(FV,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(hx),this._instantiationService.setService(HM,this._oscLinkService),this._inputHandler=this._register(new yK(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(zr.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(zr.forward(this._bufferService.onResize,this._onResize)),this._register(zr.forward(this.coreService.onData,this._onData)),this._register(zr.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new SK((t,r)=>this._inputHandler.parse(t,r))),this._register(zr.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!NE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),NE=!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,yj),t=Math.max(t,bj),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(xE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(xE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=It(()=>{for(let t of e)t.dispose()})}}},EK={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 RK(e,t,r,i){var u;let s={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":ge.DEL,e.altKey&&(s.key=ge.ESC+s.key);break;case 9:if(e.shiftKey){s.key=ge.ESC+"[Z";break}s.key=ge.HT,s.cancel=!0;break;case 13:s.key=e.altKey?ge.ESC+ge.CR:ge.CR,s.cancel=!0;break;case 27:s.key=ge.ESC,e.altKey&&(s.key=ge.ESC+ge.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"D":t?s.key=ge.ESC+"OD":s.key=ge.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"C":t?s.key=ge.ESC+"OC":s.key=ge.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"A":t?s.key=ge.ESC+"OA":s.key=ge.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=ge.ESC+"[1;"+(o+1)+"B":t?s.key=ge.ESC+"OB":s.key=ge.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=ge.ESC+"[2~");break;case 46:o?s.key=ge.ESC+"[3;"+(o+1)+"~":s.key=ge.ESC+"[3~";break;case 36:o?s.key=ge.ESC+"[1;"+(o+1)+"H":t?s.key=ge.ESC+"OH":s.key=ge.ESC+"[H";break;case 35:o?s.key=ge.ESC+"[1;"+(o+1)+"F":t?s.key=ge.ESC+"OF":s.key=ge.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=ge.ESC+"[5;"+(o+1)+"~":s.key=ge.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=ge.ESC+"[6;"+(o+1)+"~":s.key=ge.ESC+"[6~";break;case 112:o?s.key=ge.ESC+"[1;"+(o+1)+"P":s.key=ge.ESC+"OP";break;case 113:o?s.key=ge.ESC+"[1;"+(o+1)+"Q":s.key=ge.ESC+"OQ";break;case 114:o?s.key=ge.ESC+"[1;"+(o+1)+"R":s.key=ge.ESC+"OR";break;case 115:o?s.key=ge.ESC+"[1;"+(o+1)+"S":s.key=ge.ESC+"OS";break;case 116:o?s.key=ge.ESC+"[15;"+(o+1)+"~":s.key=ge.ESC+"[15~";break;case 117:o?s.key=ge.ESC+"[17;"+(o+1)+"~":s.key=ge.ESC+"[17~";break;case 118:o?s.key=ge.ESC+"[18;"+(o+1)+"~":s.key=ge.ESC+"[18~";break;case 119:o?s.key=ge.ESC+"[19;"+(o+1)+"~":s.key=ge.ESC+"[19~";break;case 120:o?s.key=ge.ESC+"[20;"+(o+1)+"~":s.key=ge.ESC+"[20~";break;case 121:o?s.key=ge.ESC+"[21;"+(o+1)+"~":s.key=ge.ESC+"[21~";break;case 122:o?s.key=ge.ESC+"[23;"+(o+1)+"~":s.key=ge.ESC+"[23~";break;case 123:o?s.key=ge.ESC+"[24;"+(o+1)+"~":s.key=ge.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=ge.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=ge.DEL:e.keyCode===219?s.key=ge.ESC:e.keyCode===220?s.key=ge.FS:e.keyCode===221&&(s.key=ge.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let d=(u=EK[e.keyCode])==null?void 0:u[e.shiftKey?1:0];if(d)s.key=ge.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(m);e.shiftKey&&(h=h.toUpperCase()),s.key=ge.ESC+h}else if(e.keyCode===32)s.key=ge.ESC+(e.ctrlKey?ge.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),s.key=ge.ESC+m,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=ge.US),e.key==="@"&&(s.key=ge.NUL));break}return s}var er=0,kK=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||(er=this._search(t),er===-1)||this._getKey(this._array[er])!==t)return!1;do if(this._array[er]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(er),!0;while(++er<this._array.length&&this._getKey(this._array[er])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(er=this._search(e),!(er<0||er>=this._array.length)&&this._getKey(this._array[er])===e))do yield this._array[er];while(++er<this._array.length&&this._getKey(this._array[er])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(er=this._search(e),!(er<0||er>=this._array.length)&&this._getKey(this._array[er])===e))do t(this._array[er]);while(++er<this._array.length&&this._getKey(this._array[er])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let i=t+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},M_=0,AE=0,NK=class extends tt{constructor(){super(),this._decorations=new kK(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(It(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new AK(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=>{M_=s.options.x??0,AE=M_+(s.options.width??1),e>=M_&&e<AE&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},AK=class extends ka{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=$t.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=$t.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},TK=1e3,MK=class{constructor(e,t=TK){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)}},TE=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 MK(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(`
|
|
658
|
+
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(We(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(It(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<TE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
659
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===TE+1&&(this._liveRegion.textContent+=j0.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 g=m instanceof Text?m.parentNode:m,p=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(g);if(!y)return console.warn("columns is null. Race condition?"),null;let b=h<y.length?y[h]:y.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=Zt([Ne(1,Ly),Ne(2,$s),Ne(3,Us)],Kf);var fx=class extends tt{constructor(e,t,r,i,s){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(It(()=>{var o;To(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(We(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(We(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(We(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(We(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var i,s;(!this._activeProviderReplies||!t)&&((i=this._activeProviderReplies)==null||i.forEach(o=>{o==null||o.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[o,u]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(o)&&(r=this._checkLinkProviderResult(o,e,r)):u.provideLinks(e.y,d=>{var h,g;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),((g=this._activeProviderReplies)==null?void 0:g.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&&jK(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}}};fx=Zt([Ne(1,Oy),Ne(2,Us),Ne(3,ei),Ne(4,WM)],fx);function jK(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 DK=class extends CK{constructor(e={}){super(e),this._linkifier=this._register(new Zl),this.browser=cj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Zl),this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Se),this.onKey=this._onKey.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Se),this.onBell=this._onBell.event,this._onFocus=this._register(new Se),this._onBlur=this._register(new Se),this._onA11yCharEmitter=this._register(new Se),this._onA11yTabEmitter=this._register(new Se),this._onWillOpen=this._register(new Se),this._setup(),this._decorationService=this._instantiationService.createInstance(NK),this._instantiationService.setService(md,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(wY),this._instantiationService.setService(WM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(L0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(zr.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(zr.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(zr.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(zr.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(It(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,i="";switch(t.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Dt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ge.ESC}]${i};${_K(s)}${oj.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=lr.toColor(...t.color));else{let o=r;this._themeService.modifyColors(u=>u[o]=lr.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Kf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ge.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*s,u=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=u+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(We(this.element,"copy",t=>{this.hasSelection()&&PV(t,this._selectionService)}));let e=t=>IV(t,this.textarea,this.coreService,this.optionsService);this._register(We(this.textarea,"paste",e)),this._register(We(this.element,"paste",e)),uj?this._register(We(this.element,"mousedown",t=>{t.button===2&&$5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(We(this.element,"contextmenu",t=>{$5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Fy&&this._register(We(this.element,"auxclick",t=>{t.button===1&&OM(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(We(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(We(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(We(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(We(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(We(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(We(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(We(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(We(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",M0.get()),fj||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(yY,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($s,this._coreBrowserService),this._register(We(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(We(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(tx,this._document,this._helperContainer),this._instantiationService.setService(Om,this._charSizeService),this._themeService=this._instantiationService.createInstance(sx),this._instantiationService.setService(ac,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Vf),this._instantiationService.setService(FM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ix,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(Q0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rx),this._instantiationService.setService(Oy,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(fx,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(X0,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(nx,this.element,this.screenElement,i)),this._instantiationService.setService(VV,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(zr.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Z0,this.screenElement)),this._register(We(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(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(ex,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,g,p,y,b;let u=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!u)return!1;let d,m;switch(o.overrideType||o.type){case"mousemove":m=32,o.buttons===void 0?(d=3,o.button!==void 0&&(d=o.button<3?o.button:3)):d=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":m=0,d=o.button<3?o.button:3;break;case"mousedown":m=1,d=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let w=o.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(o,(y=(p=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:p.cell)==null?void 0:y.height,(b=e._coreBrowserService)==null?void 0:b.dpr)===0)return!1;m=w<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:d,action:m,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(We(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(We(t,"wheel",o=>{var u,d,m,h,g;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,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let p=ge.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(p,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){LM(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=RK(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ge.ETX||r.key===ge.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(LK(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ar));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ge.ESC+"[I"):this.coreService.triggerDataEvent(ge.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[4;${r};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ge.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function LK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var OK=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)}},BK=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Xi)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},ME=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 BK(t)}getNullCell(){return new Xi}},PK=class extends tt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Se),this.onBufferChange=this._onBufferChange.event,this._normal=new ME(this._core.buffers.normal,"normal"),this._alternate=new ME(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)}},IK=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)}},zK=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}},$K=["cols","rows"],Un=0,UK=class extends tt{constructor(e){super(),this._core=this._register(new DK(e)),this._addonManager=this._register(new OK),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($K.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 IK(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new zK(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 PK(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
|
|
660
|
+
`,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 M0.get()},set promptLabel(e){M0.set(e)},get tooMuchOutput(){return j0.get()},set tooMuchOutput(e){j0.set(e)}}}_verifyIntegers(...e){for(Un of e)if(Un===1/0||isNaN(Un)||Un%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Un of e)if(Un&&(Un===1/0||isNaN(Un)||Un%1!==0||Un<0))throw new Error("This API only accepts positive integers")}};function jE(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 DE(){const e=jE("--card","#0b0b12"),t=jE("--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 HK(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function FK(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 WK(e){return e===1001||e===1006||e===1012||e===1013}function qK(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 VK="\x1B[13;2u";function GK(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?VK:null}const LE=new TextEncoder,YK=750,KK=2048;function XK(e,t){return t<YK&&e<=KK}function ZK(e){let t;try{t=new jV}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function QK(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class JK{constructor(t,r,i){Hr(this,"term");Hr(this,"fit");Hr(this,"webgl");Hr(this,"listenerCtl");Hr(this,"resizeObserver");Hr(this,"ws",null);Hr(this,"dataDispose",null);Hr(this,"lastUserInputAt",0);Hr(this,"disposed",!1);Hr(this,"connectedOnce",!1);Hr(this,"connectionGeneration",0);Hr(this,"layoutVisible",!1);this.url=r,this.onState=i,this.term=new UK({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:DE(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0}),this.fit=new qW,this.term.loadAddon(this.fit),this.term.loadAddon(new ZW(HK)),this.term.open(t),this.webgl=ZK(this.term),this.listenerCtl=new AbortController;const{signal:s}=this.listenerCtl;t.addEventListener("copy",o=>QK(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;qK(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=FK(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(LE.encode(u))}),this.term.attachCustomKeyEventHandler(u=>{const d=GK(u);return d===null?!0:(u.type==="keydown"&&(u.preventDefault(),this.lastUserInputAt=performance.now(),i.readyState===WebSocket.OPEN&&i.send(LE.encode(d))),!1)})}setTheme(){this.term.options.theme=DE()}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(XK(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 OE=[500,1e3,2e3,4e3,8e3],eX=3e4,tX=15e3;function rX({sessionId:e,runtimeSelector:t,active:r,role:i="owner",setup:s}){const[o,u]=v.useState({kind:"connecting"}),[d,m]=v.useState(0),[h,g]=v.useState(!1),[p,y]=v.useState(!1),[b,w]=v.useState(null),C=v.useRef(0),E=v.useRef(null),S=v.useRef(null),N=`${t}\0${e}`,k=v.useRef(N);k.current=N;const{theme:R}=Ty(),M=v.useCallback(W=>u(W),[]);v.useEffect(()=>{var W;(W=S.current)==null||W.setTheme()},[R]),v.useEffect(()=>{w(null),y(!1)},[N]);const L=v.useCallback(W=>{if(W===null)return;M({kind:"connecting"});let G=null,q=!1;return queueMicrotask(()=>{q||(G=new JK(W,({cols:B,rows:j})=>B9(t,e,{role:i,cols:B,rows:j,refreshCapability:!0}),M),S.current=G)}),()=>{q=!0,G==null||G.dispose(),S.current=null}},[e,t,i,M]);v.useEffect(()=>{if(o.kind==="connected"){E.current=Date.now(),g(!1);return}if(o.kind!=="closed")return;if(!r){g(!1);return}if(!WK(o.code)){g(!1);return}if(E.current!==null&&Date.now()-E.current>=eX&&(C.current=0),E.current=null,C.current>=OE.length){g(!1);return}const W=OE[C.current];C.current+=1,g(!0);let G=!1;const q=()=>{G||(G=!0,S.current?S.current.reconnect():m(O=>O+1))},B=window.setTimeout(q,W),j=()=>{document.visibilityState==="visible"&&q()};return document.addEventListener("visibilitychange",j),()=>{window.clearTimeout(B),document.removeEventListener("visibilitychange",j)}},[r,o]);const z=v.useCallback(()=>{C.current=0,E.current=null,g(!1),S.current?S.current.reconnect():m(W=>W+1)},[]),D=v.useCallback(async()=>{if(p)return;const W=N,G=new AbortController,q=window.setTimeout(()=>G.abort(),tX);y(!0),w(null);try{if(await be.startSessionTerminal(t,e,G.signal),k.current!==W)return;z()}catch(B){if(k.current!==W)return;w(G.signal.aborted?"Terminal start timed out. Try again.":B instanceof Error?B.message:"Could not start terminal")}finally{window.clearTimeout(q),k.current===W&&y(!1)}},[z,t,e,p,N]);return l.jsxs("div",{"data-state":o.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[l.jsx("div",{ref:L,className:"h-full w-full overflow-hidden"},d),o.kind!=="connected"&&l.jsx(sX,{state:o,reconnectPending:h,startingTerminal:p,startError:b,onRetry:z,onStartTerminal:()=>void D(),setup:s})]}),l.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:l.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:nX(iX())})})]})}function iX(){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 nX(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function sX({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(Qe,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Qe,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?l.jsx(aX,{starting:r,error:i,onStart:o,setup:u}):l.jsx(BE,{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(Qe,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&l.jsx(BE,{message:e.message,onRetry:s})]})}function aX({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(Qe,{className:"animate-spin"}):l.jsx(jR,{}),e?"Opening…":d]})]})}function BE({message:e,onRetry:t}){return l.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[l.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),l.jsxs(he,{variant:"outline",size:"sm",onClick:t,children:[l.jsx(Nt,{})," Retry"]})]})}var Im="Collapsible",[oX]=Sn(Im),[lX,Wy]=oX(Im),Sj=v.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(lX,{scope:r,disabled:o,contentId:vn(),open:m,onOpenToggle:v.useCallback(()=>h(g=>!g),[h]),children:l.jsx(Ve.div,{"data-state":Vy(m),"data-disabled":o?"":void 0,...d,ref:t})})});Sj.displayName=Im;var Cj="CollapsibleTrigger",Ej=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,...i}=e,s=Wy(Cj,r);return l.jsx(Ve.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Vy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:t,onClick:Le(e.onClick,s.onOpenToggle)})});Ej.displayName=Cj;var qy="CollapsibleContent",Rj=v.forwardRef((e,t)=>{const{forceMount:r,...i}=e,s=Wy(qy,e.__scopeCollapsible);return l.jsx(Cn,{present:r||s.open,children:({present:o})=>l.jsx(cX,{...i,ref:t,present:o})})});Rj.displayName=qy;var cX=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:i,children:s,...o}=e,u=Wy(qy,r),[d,m]=v.useState(i),h=v.useRef(null),g=it(t,h),p=v.useRef(0),y=p.current,b=v.useRef(0),w=b.current,C=u.open||d,E=v.useRef(C),S=v.useRef(void 0);return v.useEffect(()=>{const N=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(N)},[]),Xt(()=>{const N=h.current;if(N){S.current=S.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();p.current=k.height,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(Ve.div,{"data-state":Vy(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!C,...o,ref:g,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:C&&s})});function Vy(e){return e?"open":"closed"}var uX=Sj,dX=Ej,hX=Rj;const zm=uX,$m=dX,Um=hX;function fX({status:e}){return e==="completed"?l.jsx(Ba,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?l.jsx(Qe,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):l.jsx(sO,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function mX({todos:e}){const[t,r]=v.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:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx("span",{className:"label-caps text-[var(--muted-foreground)]",children:"Tasks"}),l.jsxs("span",{className:"font-mono text-[var(--muted-foreground)]",children:[i,"/",e.length]})]}),l.jsx(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(fX,{status:s.status}),l.jsx("span",{className:qe("truncate",s.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:s.subject})]},s.id))})})]})}function PE(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,g=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));g&&!w.includes(g)&&w.push(g),s&&h&&!g?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]:"",y=h?g:m.has(p)?p:"";s&&h&&!g?u[d.id]=`${d.label}: enter a value for Other`:s&&d.required&&!y?u[d.id]=`${d.label} is required`:y&&(o[d.id]=y)}return Object.keys(u).length>0?{ok:!1,errors:u}:{ok:!0,answers:o}}function pX({sessionId:e,item:t,canResolve:r=!0}){var j;const{runtimeSelector:i}=nc(),s=v.useId().replaceAll(":",""),[o,u]=v.useState({}),[d,m]=v.useState({}),[h,g]=v.useState({}),[p,y]=v.useState({}),[b,w]=v.useState(()=>{var O;return(O=t.request.fields[0])==null?void 0:O.id}),[C,E]=v.useState(),[S,N]=v.useState(),k=t.status==="pending";function R(O){y($=>{if(!$[O])return $;const T={...$};return delete T[O],T})}function M(O,$){u(T=>({...T,[O]:$})),R(O)}function L(O,$){g(T=>({...T,[O]:$})),R(O)}function z(O){const $=t.request.fields,T=Math.max($.findIndex(H=>H.id===b),0),U=$.findIndex(H=>H.id===O);if(!(U<0)){if(U>T){const H=$[T];if(H){const F=PE([H],o,d,h);if(!F.ok){y(V=>({...V,...F.errors}));return}R(H.id)}}w(O)}}async function D(O){if(!r)return;const $=PE(t.request.fields,o,d,h,O.requiresAnswers);if(!$.ok){y($.errors);const T=t.request.fields.find(U=>$.errors[U.id]);T&&w(T.id);return}y({}),E(void 0),N(O.id);try{await I9(e,t.id,{actionId:O.id,...Object.keys($.answers).length>0?{answers:$.answers}:{}},i)}catch(T){N(void 0),E(T instanceof Error?T.message:String(T))}}const W=t.request.kind==="permission"?jB:t.request.kind==="form"?IO:Z4,G=Math.max(t.request.fields.findIndex(O=>O.id===b),0),q=t.request.fields.length===0||G===t.request.fields.length-1,B=t.request.actions.filter(O=>!O.requiresAnswers||q);return l.jsxs("section",{"aria-labelledby":`${s}-title`,"aria-busy":S!==void 0,className:qe("min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm",t.request.kind==="permission"?"border-[var(--warning)]/40 bg-[var(--warning)]/5":"border-[var(--primary)]/30 bg-[var(--primary)]/5"),children:[l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(W,{"aria-hidden":"true",className:qe("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{id:`${s}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&l.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),l.jsx(gX,{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(Z7,{idPrefix:s,fields:t.request.fields,activeFieldId:b,answers:o,otherValues:d,otherSelections:h,errors:p,disabled:S!==void 0,onNavigate:z,onAnswerChange:M,onOtherSelectionChange:L,onOtherValueChange:(O,$)=>{m(T=>({...T,[O]:$})),R(O)}}),C&&l.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",C]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[B.map(O=>l.jsxs(he,{type:"button",size:"sm",variant:_X(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(Qe,{"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(vX,{item:t})]})}function gX({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(IE,{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(IE,{value:t.diff,tall:!0})]}):null}function IE({value:e,tall:t=!1}){return l.jsx("pre",{className:qe("min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed",t?"max-h-56":"max-h-32"),children:l.jsx("code",{className:"block min-w-0",children:e})})}function vX({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 _X(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function xX({item:e}){const t=e.rotateKind==="fork"?EO:mO;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 yX({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(tO,{className:"size-3.5 shrink-0"}),l.jsx("span",{children:"Response stopped"})]}):l.jsxs("div",{className:"my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm",children:[l.jsx(Ea,{className:"size-4 shrink-0 text-[var(--destructive)]"}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"label-caps text-[10px] text-[var(--destructive)]",children:[e.source," error · ",e.code]}),l.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80",children:e.message})]})]})}const bX="modulepreload",wX=function(e){return"/"+e},zE={},SX=function(t,r,i){let s=Promise.resolve();if(r&&r.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const 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=wX(h),h in zE)return;zE[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":bX,g||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),g)return new Promise((b,w)=>{y.addEventListener("load",b),y.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)})},CX=v.lazy(()=>SX(()=>import("./mermaid-GHXKKRXX-CSYzOmBR.js").then(e=>e.i),[]).then(e=>({default:e.Streamdown}))),EX=qe("min-w-0 text-sm leading-relaxed break-words","[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5","[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs","[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2","[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2");function kj({children:e,className:t}){return l.jsx(v.Suspense,{fallback:l.jsx("div",{className:qe("whitespace-pre-wrap break-words text-sm",t),children:e}),children:l.jsx(CX,{shikiTheme:["github-light","github-dark"],className:qe(EX,t),children:e})})}function RX({item:e,sessionId:t,runtimeSelector:r}){const[i,s]=v.useState(null),[o,u]=v.useState(()=>new Set),d=e.images??[],m=d.find(h=>h.resourceId===i);return v.useEffect(()=>{if(!i)return;const h=g=>{g.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 g=be.sessionResourceContentUrl(r,t,h),p=o.has(h.resourceId);return l.jsx("button",{type:"button",className:"group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36",onClick:()=>{p||s(h.resourceId)},"aria-label":`Open ${h.filename??"attached image"}`,children:p?l.jsxs("span",{className:"flex size-full items-center justify-center gap-2 px-3 text-xs",children:[l.jsx(NO,{className:"size-4"}),"Image unavailable"]}):l.jsx("img",{src:g,alt:h.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>u(y=>new Set(y).add(h.resourceId))})},h.resourceId)})}),e.text&&l.jsx("div",{className:`whitespace-pre-wrap break-words px-1 ${d.length?"pt-2":""}`,children:e.text}),m&&l.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":m.filename??"Image preview",className:"fixed inset-0 z-50 grid min-h-0 min-w-0 place-items-center overflow-hidden bg-black/80 p-4",onClick:()=>s(null),children:[l.jsx("button",{type:"button",className:"absolute right-4 top-4 grid size-9 place-items-center rounded-full bg-black/60 text-white","aria-label":"Close image preview",onClick:()=>s(null),children:l.jsx(Na,{className:"size-5"})}),l.jsx("img",{src:be.sessionResourceContentUrl(r,t,m),alt:m.filename??"Attached image",className:"block h-auto max-h-[calc(100dvh-2rem)] min-h-0 w-auto max-w-[calc(100vw-2rem)] min-w-0 rounded-md object-contain shadow-2xl",onClick:h=>h.stopPropagation()})]})]})}):l.jsx("div",{className:"flex justify-start",children:l.jsxs("div",{className:"min-w-0 max-w-[90%] rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&l.jsx(kj,{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 kX({item:e}){const t=e.summary.filter(Boolean).join(`
|
|
661
|
+
|
|
662
|
+
`).trim(),[r,i]=v.useState(e.streaming??!1);return v.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:qe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),l.jsx(BR,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:qe("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),l.jsx(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(kj,{children:t}):l.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const $E=12e3;function UE(e){return e.length<=$E?{text:e,truncated:!1}:{text:e.slice(0,$E),truncated:!0}}function NX({item:e}){const[t,r]=v.useState(!1),i=e.stdout?UE(e.stdout):null,s=e.stderr?UE(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:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),l.jsx(Tx,{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 HE=80,FE=12e3;function AX(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function TX(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 MX(e){let t=e,r=!1;const i=t.split(`
|
|
663
|
+
`);return i.length>HE&&(t=i.slice(0,HE).join(`
|
|
664
|
+
`),r=!0),t.length>FE&&(t=t.slice(0,FE),r=!0),{text:t,truncated:r}}function jX({status:e}){return e==="in_progress"?l.jsx(Qe,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?l.jsx(iO,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?l.jsx(J4,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):l.jsx(Ba,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function DX({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){const[s,o]=v.useState(!1),u=TX(e.arguments),d=e.output?MX(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:qe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",s&&"rotate-90")}),l.jsx(jX,{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:AX(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(ZB,{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(g=>l.jsx(Nj,{item:g,sessionId:t,runtimeSelector:r,canResolveInteractions:i},g.id))]})]})]})}function Nj({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i=!0}){switch(e.kind){case"message":return e.isMeta?null:l.jsx(RX,{item:e,sessionId:t,runtimeSelector:r});case"tool":return l.jsx(DX,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:i});case"reasoning":return l.jsx(kX,{item:e});case"terminal_command":return l.jsx(NX,{item:e});case"divider":return l.jsx(xX,{item:e});case"error":return l.jsx(yX,{item:e});case"interaction":return l.jsx(pX,{sessionId:t,item:e,canResolve:i})}}function LX(){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 OX(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function BX({message:e}){const t=v.useRef(Date.now()),[r,i]=v.useState(0);return v.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(Qe,{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 ",OX(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 PX({items:e,historyLoaded:t,running:r,waitingForInteraction:i,queueStatus:s,sessionId:o,runtimeSelector:u}){const d=v.useRef(null),[m,h]=v.useState(!0),g=e[e.length-1],p=(g==null?void 0:g.kind)==="message"&&g.role==="assistant"&&!!g.streaming,y=r&&!p&&!i&&!s;return v.useEffect(()=>{m&&d.current&&(d.current.scrollTop=d.current.scrollHeight)},[e,r,s,m]),l.jsx(yn,{className:"min-w-0 flex-1",viewportRef:d,viewportProps:{onScroll: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(Qe,{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(Nj,{item:b,sessionId:o,runtimeSelector:u,canResolveInteractions:!0},b.id)),s&&l.jsx(BX,{message:s}),y&&l.jsx(LX,{})]})})})}const IX=2500,gu=new Map;function zX({sessionId:e,runtimeSelector:t,active:r,polling:i=r}){const s=`${t}
|
|
665
|
+
${e}`,o=v.useRef(s);o.current=s;const u=v.useRef(r);u.current=r;const d=v.useRef(0),m=v.useRef(0),h=v.useRef(!1),g=v.useRef(null),p=v.useRef(null),[y,b]=v.useState(()=>gu.get(s)??null),[w,C]=v.useState(()=>!gu.has(s)),[E,S]=v.useState(null),[N,k]=v.useState(null),R=v.useCallback(B=>{p.current=B,k(B)},[]),M=v.useCallback(B=>{g.current=B,gu.set(s,B),b(B)},[s]),L=v.useCallback(async B=>{if(!u.current||h.current)return;const j=s,O=d.current,$=m.current;B&&C(!0);try{const T=await be.getRuntimeBrowserState(t,e);return!u.current||d.current!==O||m.current!==$||o.current!==j||h.current?void 0:(M(T),B&&R(null),T)}catch(T){if(!u.current||d.current!==O||m.current!==$||o.current!==j)return;B&&R(Wh(T));return}finally{u.current&&d.current===O&&m.current===$&&o.current===j&&B&&C(!1)}},[s,t,e,M,R]);v.useEffect(()=>{const B=++d.current,j=gu.has(s);return M(gu.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]),v.useEffect(()=>{if(!i)return;const B=window.setInterval(()=>void L(!1),IX);return()=>window.clearInterval(B)},[r,L,i]);const z=v.useCallback(async(B,j)=>{if(!u.current||h.current)return;const O=s,$=d.current;m.current+=1,h.current=!0,S(B),R(null);try{const T=await j();return u.current&&d.current===$&&o.current===O?(M(T),T):void 0}catch(T){u.current&&d.current===$&&o.current===O&&R(Wh(T));return}finally{u.current&&d.current===$&&o.current===O&&(h.current=!1,S(null),C(!1))}},[s,M,R]),D=v.useCallback((B,j)=>{const O=g.current;return O?z(B,()=>j(O.browserGeneration)):Promise.resolve(void 0)},[z]),W=v.useCallback(B=>z("Starting browser",()=>be.openRuntimeBrowser(t,e,B)),[t,e,z]),G=v.useCallback(async()=>{const B=g.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Closing browser"),R(null);try{await be.closeRuntimeBrowser(t,e,B.browserGeneration),u.current&&d.current===O&&o.current===j&&M(null)}catch($){u.current&&d.current===O&&o.current===j&&R(Wh($))}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null))}},[s,t,e,M,R]),q=v.useCallback(async()=>{const B=g.current;if(!u.current||!B||h.current)return;const j=s,O=d.current;m.current+=1,h.current=!0,S("Opening in Desktop"),R(null);try{const $=await JF(B,{close:T=>be.closeRuntimeBrowser(t,e,T).then(()=>{}),open:T=>be.openRuntimeBrowser(t,e,T),createPage:(T,U)=>be.createRuntimeBrowserPage(t,e,T,U),activatePage:(T,U)=>be.activateRuntimeBrowserPage(t,e,T,U),onProgress:T=>{u.current&&d.current===O&&o.current===j&&(M(T),S("Restoring browser tabs"))}});return u.current&&d.current===O&&o.current===j?(M($),($.executionBackend!=="embedded-electron"||!$.capabilities.includes(Ay))&&R("Desktop Browser Host is unavailable; using streamed browser"),$):void 0}catch($){const T=await be.getRuntimeBrowserState(t,e).catch(()=>{});u.current&&d.current===O&&o.current===j&&(T!==void 0&&M(T),R(Wh($)));return}finally{u.current&&d.current===O&&o.current===j&&(h.current=!1,S(null),C(!1))}},[s,t,e,M,R]);return{browser:y,loading:w,pendingAction:E,error:N,currentError:()=>p.current,disabled:E!==null||(y==null?void 0:y.status)!=="ready",createDisabled:E!==null,load:L,openBrowser:W,closeBrowser:G,recreateForDesktop:q,createPage:()=>D("Creating page",B=>be.createRuntimeBrowserPage(t,e,B)),closePage:B=>D("Closing page",j=>be.closeRuntimeBrowserPage(t,e,j,B)),activatePage:B=>D("Switching page",j=>be.activateRuntimeBrowserPage(t,e,j,B)),navigatePage:(B,j)=>D("Navigating",O=>be.navigateRuntimeBrowserPage(t,e,O,B,j)),backPage:B=>D("Going back",j=>be.backRuntimeBrowserPage(t,e,j,B)),forwardPage:B=>D("Going forward",j=>be.forwardRuntimeBrowserPage(t,e,j,B)),reloadPage:B=>D("Reloading page",j=>be.reloadRuntimeBrowserPage(t,e,j,B))}}const $X=2500,vu=new Map;function UX({sessionId:e,runtimeSelector:t,active:r,polling:i=r,devicesActive:s=!1}){const o=`${t}
|
|
666
|
+
${e}`,[u,d]=v.useState(()=>vu.get(o)??null),[m,h]=v.useState([]),[g,p]=v.useState(()=>!vu.has(o)),[y,b]=v.useState(!1),[w,C]=v.useState(!1),[E,S]=v.useState(null),N=v.useRef(0),k=v.useRef(0),R=v.useRef(!1),M=v.useRef(!1),L=v.useRef(!1),z=v.useRef(null);z.current=u;const D=v.useCallback($=>{z.current=$,vu.set(o,$),d($)},[o]),W=v.useCallback(async()=>{if(R.current)return;const $=N.current,T=k.current;M.current||p(!0);try{const U=await be.getSessionEmulator(t,e);if(N.current!==$||k.current!==T||R.current)return;D(U),S(null)}catch(U){if(N.current!==$||k.current!==T||R.current)return;S(j_(U))}finally{N.current===$&&k.current===T&&!R.current&&(M.current=!0,p(!1))}},[t,e,D]),G=v.useCallback(async()=>{if(R.current)return;const $=N.current,T=k.current;b(!0);try{const U=await be.listSessionEmulatorDevices(t,e);if(N.current!==$||k.current!==T||R.current)return;h(U),S(null)}catch(U){if(N.current!==$||k.current!==T||R.current)return;S(j_(U))}finally{N.current===$&&k.current===T&&!R.current&&(L.current=!0,b(!1))}},[t,e]);v.useEffect(()=>{N.current+=1;const $=vu.has(o);D(vu.get(o)??null),h([]),S(null),p(!$),b(!1),C(!1),R.current=!1,M.current=$,L.current=!1,W()},[r,W,o,D]),v.useEffect(()=>{if(!i)return;const $=window.setInterval(()=>void W(),$X);return()=>window.clearInterval($)},[r,i,W]),v.useEffect(()=>{!s||g||w||u||L.current||G()},[r,u,s,g,w,G]);const q=v.useCallback(async($,T)=>{const U=N.current,H=++k.current;R.current=!0,C(!0),S(null);try{const F=await $();return N.current!==U||k.current!==H?null:(T==null||T(F),F)}catch(F){throw N.current===U&&k.current===H&&S(j_(F)),F}finally{N.current===U&&k.current===H&&(R.current=!1,C(!1))}},[]),B=v.useCallback($=>q(()=>be.attachSessionEmulator(t,e,$),T=>D(T)),[q,t,e]),j=v.useCallback(async()=>{const $=z.current;return $?await q(()=>be.detachSessionEmulator(t,e,$.bindingId),()=>D(null))!==null:!1},[q,t,e]),O=v.useCallback(async $=>{const T=z.current;if(!T)throw new Error("This Session has no Emulator attached");await q(()=>$(T))},[q]);return{binding:u,devices:m,loading:g,devicesLoading:y,mutating:w,error:E,reload:W,reloadDevices:G,attach:B,detach:j,tap:($,T)=>O(U=>be.tapSessionEmulator(t,e,U.bindingId,$,T)),gesture:$=>O(T=>be.gestureSessionEmulator(t,e,T.bindingId,$)),button:$=>O(T=>be.buttonSessionEmulator(t,e,T.bindingId,$))}}function j_(e){return e instanceof Error?e:new Error(String(e))}const Aj="rynx.session-resource-dock-width";function HX({session:e,runtimeSelector:t,leadingControls:r,initialDraft:i,terminalSetup:s}){var _i,ns,ss,Tn,xi,Ue;const[o,u]=N4(),d=o.get("view"),m=d==="terminal"?"terminal":"chat",h=vF(o.get("surface")),g=o.get("panel")==="resources",p=d==="browser"||h!==null||g,y=(h==null?void 0:h.type)==="browser"?h.pageId:null,b=v.useRef(null),w=v.useRef(null),C=v.useRef("browser"),E=v.useRef(null),S=v.useRef(0),N=v.useRef(null),[k]=v.useState(FX),R=v.useRef(k),M=v.useRef(null),L=v.useRef(null),z=v.useRef(null),D=v.useRef(null),W=v.useRef(null),G=v.useRef(null),q=v.useRef(!1),[B,j]=v.useState(!1),[O,$]=v.useState(!1),[T,U]=v.useState(null),[H,F]=v.useState(bu),[V,I]=v.useState(!1),[Y,X]=v.useState(!1),[ee,re]=v.useState([]),{state:oe,pendingSend:Z,current:ce,send:ne,stop:we}=EF(e.id,{runtimeSelector:t,allowSend:!0}),_e=zX({sessionId:e.id,runtimeSelector:t,active:!0,polling:p}),ye=UX({sessionId:e.id,runtimeSelector:t,active:!0,polling:p,devicesActive:(h==null?void 0:h.type)==="emulator"}),J=v.useMemo(()=>_F(_e.browser,y,b.current),[_e.browser,y]),ie=wF(Z,oe.runStatus==="running"||oe.waitingForInteraction,ce,e.status==="running"),Ee=e.agent??(e.provider?Hu(e.provider):void 0),ve=(_i=mF(oe))==null?void 0:_i.model,Ae=v.useMemo(()=>pF(oe.items),[oe.items]),Ie=((ns=_e.browser)==null?void 0:ns.pages)??[],Oe=(h==null?void 0:h.type)==="emulator"||B,ze=_e.loading||ye.loading,rt=Ie.length>0||Oe,Be=v.useMemo(()=>[...Ie.map(me=>Hn(me.pageId)),...Oe?[Fn()]:[]],[Ie,Oe]),dt=v.useMemo(()=>G2(ee,Be),[Be,ee]);v.useEffect(()=>{re(me=>{const ke=G2(me,Be);return WX(me,ke)?me:ke})},[Be]),v.useEffect(()=>{const me=N.current;if(!me)return;const ke=()=>{const yt=me.getBoundingClientRect().width,Xe=Fh(yt,Number.POSITIVE_INFINITY);F(Xe);const Ft=R.current,ri=Fh(yt,Ft??yt*V2);Ft!==null&&me.style.setProperty("--session-resource-dock-width",`${ri}px`),M.current=ri,U(ri)};ke();const Fe=new ResizeObserver(ke);return Fe.observe(me),()=>Fe.disconnect()},[]),v.useEffect(()=>()=>{var me;z.current!==null&&window.cancelAnimationFrame(z.current),(me=W.current)==null||me.call(W),WE(G)},[]),v.useEffect(()=>{b.current=null,w.current=null,C.current="browser",E.current=null,j(!1),X(!1),re([]),S.current+=1},[t,e.id]);const He=(me,ke=!0)=>{ke&&(S.current+=1);const Fe=new URLSearchParams(o);me?(Fe.set("surface",me),Fe.delete("panel")):(Fe.delete("surface"),Fe.set("panel","resources")),Fe.get("view")==="browser"&&Fe.set("view","chat"),u(Fe,{replace:!0})},Ot=()=>{S.current+=1,X(!1);const me=new URLSearchParams(o);me.delete("surface"),me.delete("panel"),me.get("view")==="browser"&&me.set("view","chat"),u(me,{replace:!0})},Ht=()=>{if(C.current==="emulator"&&B){He(Fn(E.current));return}if(b.current){He(Hn(b.current));return}if(B){He(Fn(E.current));return}He(null)};v.useEffect(()=>{h&&(C.current=h.type,h.type==="emulator"&&j(!0))},[h==null?void 0:h.type]),v.useEffect(()=>{var ke;const me=((ke=ye.binding)==null?void 0:ke.bindingId)??null;me&&(E.current&&me!==E.current?j(!0):E.current||j(!0),E.current=me)},[(ss=ye.binding)==null?void 0:ss.bindingId]),v.useEffect(()=>{if(d!=="browser")return;const me=new URLSearchParams(o);me.set("view","chat"),me.set("surface",Hn(J)),me.delete("panel"),u(me,{replace:!0})},[d,o,J,u]),v.useEffect(()=>{if((h==null?void 0:h.type)!=="browser")return;J&&(b.current=J);const me=Hn(J);if(o.get("surface")===me)return;const ke=new URLSearchParams(o);ke.set("surface",me),u(ke,{replace:!0})},[h==null?void 0:h.type,o,J,u]),v.useEffect(()=>{const me=Ie.map(Fe=>Fe.pageId),ke=xF(w.current,_e.browser);w.current=me,!(!ke||(h==null?void 0:h.type)!=="browser")&&(b.current=ke,He(Hn(ke),!1))},[Ie,_e.browser,h==null?void 0:h.type]),v.useEffect(()=>{var Fe;if((h==null?void 0:h.type)!=="emulator")return;const me=Fn((Fe=ye.binding)==null?void 0:Fe.bindingId);if(o.get("surface")===me)return;const ke=new URLSearchParams(o);ke.set("surface",me),u(ke,{replace:!0})},[(Tn=ye.binding)==null?void 0:Tn.bindingId,h==null?void 0:h.type,o,u]),v.useEffect(()=>{var me,ke;if(!(!p||ze)){if(!rt){h&&He(null,!1);return}(h==null?void 0:h.type)==="browser"&&J||(h==null?void 0:h.type)==="emulator"&&Oe||(C.current==="emulator"&&Oe?He(Fn((me=ye.binding)==null?void 0:me.bindingId),!1):J?He(Hn(J),!1):Oe&&He(Fn((ke=ye.binding)==null?void 0:ke.bindingId),!1))}},[(xi=ye.binding)==null?void 0:xi.bindingId,Oe,rt,h==null?void 0:h.type,p,ze,J]);const gi=async()=>{var ke,Fe;if(q.current)return;q.current=!0,$(!0);const me=S.current;try{const yt=((ke=_e.browser)==null?void 0:ke.status)==="ready"?await _e.createPage():await _e.openBrowser(),Xe=(yt==null?void 0:yt.activePageId)??((Fe=yt==null?void 0:yt.pages.at(-1))==null?void 0:Fe.pageId);if(!yt){xe.error(`Could not create Browser tab: ${_e.currentError()??"Browser is unavailable"}`);return}Xe&&S.current===me&&He(Hn(Xe),!1)}finally{q.current=!1,$(!1)}},Bt=me=>{const ke=N.current;if(!ke)return null;const Fe=Fh(ke.getBoundingClientRect().width,me);return ke.style.setProperty("--session-resource-dock-width",`${Fe}px`),M.current=Fe,Fe},gt=me=>{const ke=N.current;return ke?Bt(ke.getBoundingClientRect().right-me):null},ur=me=>{if(me!==null){R.current=me,U(me);try{window.localStorage.setItem(Aj,String(Math.round(me)))}catch{}}},At=me=>{D.current=me,z.current===null&&(z.current=window.requestAnimationFrame(()=>{z.current=null;const ke=D.current;D.current=null,ke!==null&>(ke)}))},an=(me,ke,Fe)=>{var Xe;if(L.current!==ke)return;z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),D.current=null;const yt=Fe===void 0?M.current:gt(Fe);ur(yt),L.current=null,(Xe=W.current)==null||Xe.call(W),W.current=null,me.hasPointerCapture(ke)&&me.releasePointerCapture(ke),WE(G),I(!1)},is=me=>{var ri;if(me.button!==0)return;me.preventDefault(),(ri=W.current)==null||ri.call(W),L.current=me.pointerId;const ke=me.currentTarget;ke.setPointerCapture(me.pointerId);const Fe=Wt=>{L.current===Wt.pointerId&&At(Wt.clientX)},yt=Wt=>{an(ke,Wt.pointerId,Wt.clientX)},Xe=Wt=>{an(ke,Wt.pointerId)};window.addEventListener("pointermove",Fe,!0),window.addEventListener("pointerup",yt,!0),window.addEventListener("pointercancel",Xe,!0),W.current=()=>{window.removeEventListener("pointermove",Fe,!0),window.removeEventListener("pointerup",yt,!0),window.removeEventListener("pointercancel",Xe,!0)};const Ft=document.documentElement.style;G.current={cursor:Ft.cursor,userSelect:Ft.userSelect},Ft.cursor="col-resize",Ft.userSelect="none",I(!0),gt(me.clientX)},Ar=me=>{const ke=N.current;if(!ke)return;const Fe=M.current??Fh(ke.getBoundingClientRect().width,ke.getBoundingClientRect().width*V2),yt=me.shiftKey?32:16;let Xe=null;me.key==="ArrowLeft"&&(Xe=Fe+yt),me.key==="ArrowRight"&&(Xe=Fe-yt),me.key==="Home"&&(Xe=0),me.key==="End"&&(Xe=Number.POSITIVE_INFINITY),Xe!==null&&(me.preventDefault(),ur(Bt(Xe)))},vi=me=>{S.current+=1;const ke=new URLSearchParams(o);ke.set("view",me),u(ke,{replace:!0})},vr=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":m==="chat"?"Open terminal":"Open chat",title:m==="chat"?"Open terminal":"Open chat",onClick:()=>vi(m==="chat"?"terminal":"chat"),children:m==="chat"?l.jsx(qB,{}):l.jsx(FO,{})}),Wa=l.jsx(he,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":p?"Hide Session resources":"Show Session resources",title:p?"Hide Session resources":"Show Session resources",onClick:p?Ot:Ht,children:p?l.jsx(nB,{}):l.jsx(aB,{})}),Hs=l.jsx(he,{type:"button",variant:"ghost",size:"icon-sm",className:"hidden size-8 shrink-0 lg:inline-flex","aria-label":Y?"Restore split view":"Expand resource pane","aria-pressed":Y,title:Y?"Restore split view":"Expand resource pane",onClick:()=>X(me=>!me),children:Y?l.jsx(BB,{}):l.jsx(gO,{})});return l.jsx("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:l.jsxs("div",{ref:N,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[l.jsxs("section",{"aria-hidden":Y,className:qe("min-h-0 min-w-0 flex-1 flex-col overflow-hidden",Y?"hidden":"flex"),children:[l.jsxs("header",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r,l.jsx("h2",{className:"min-w-0 truncate text-sm font-medium",children:e.title??Ee??"session"})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[vr,!p&&Wa]})]}),l.jsxs(GT,{value:m,className:"flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[l.jsxs(Fu,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[l.jsx(mX,{todos:oe.todos}),l.jsx(PX,{items:Ae,historyLoaded:oe.historyLoaded,running:ie,waitingForInteraction:oe.waitingForInteraction,queueStatus:oe.statusKind==="queue"?oe.note:void 0,sessionId:e.id,runtimeSelector:t}),l.jsx(TW,{initialDraft:i,model:ve,running:ie,sessionId:e.id,runtimeSelector:t,onSend:ne,onStop:we})]}),l.jsx(Fu,{value:"terminal",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:l.jsx(rX,{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(bu,H),"aria-valuemax":H,"aria-valuenow":Math.round(T??bu),"aria-valuetext":`${Math.round(T??bu)} pixels wide`,tabIndex:0,title:"Drag to resize Session resources",className:"group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block",onPointerDown:is,onKeyDown:Ar,children:l.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${V?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),l.jsxs("aside",{className:qe("flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)]",Y?"h-full w-full":"absolute inset-0 z-20 lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]"),"aria-label":"Session resources",children:[rt&&l.jsx(jW,{pages:Ie,order:dt,selectedPageId:(h==null?void 0:h.type)==="browser"?J:null,selectionDisabled:_e.pendingAction!==null,mutationDisabled:_e.disabled,createDisabled:_e.createDisabled||O,createPending:O,emulatorAttached:!!ye.binding,emulator:Oe?{selected:(h==null?void 0:h.type)==="emulator",label:((Ue=ye.binding)==null?void 0:Ue.deviceName)??"Emulator",busy:ye.loading||ye.mutating}:null,onSelectPage:me=>{var ke;b.current=me,He(Hn(me)),((ke=_e.browser)==null?void 0:ke.status)==="ready"&&_e.activatePage(me)},onClosePage:me=>{S.current+=1,b.current===me&&(b.current=null),_e.closePage(me)},onCreatePage:()=>void gi(),onSelectEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))},onCloseEmulator:()=>{j(!1),C.current="browser",He(J?Hn(J):null)},onAddEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))},headerLeadingAction:Y?r:void 0,leadingAction:Hs,trailingAction:Wa}),!rt&&l.jsxs(l.Fragment,{children:[Y&&r&&l.jsx("div",{className:"absolute left-3 top-1.5 z-10 flex h-8 items-center",children:r}),l.jsxs("div",{className:"absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4",children:[Hs,Wa]})]}),rt?(h==null?void 0:h.type)==="emulator"?l.jsx(IW,{sessionId:e.id,runtimeSelector:t,controller:ye}):(h==null?void 0:h.type)==="browser"?l.jsx(vW,{sessionId:e.id,runtimeSelector:t,pageId:J,browserResource:_e}):l.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[l.jsx(Qe,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),l.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):l.jsx(qX,{browserBusy:_e.createDisabled||O,emulatorBusy:ye.mutating,onOpenBrowser:()=>void gi(),onOpenEmulator:()=>{var me;j(!0),He(Fn((me=ye.binding)==null?void 0:me.bindingId))}})]})]})]})})}function FX(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(Aj));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function WE(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 WX(e,t){return e.length===t.length&&e.every((r,i)=>r===t[i])}function qX({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(Qe,{className:"size-4 shrink-0 animate-spin"}):l.jsx(Lu,{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(Qe,{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 VX=400,GX=160;function YX({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:i,loading:s,selectedId:o,onCollapsedChange:u,onSelect:d,onNew:m,onRetry:h,onDeleted:g}){const[p,y]=v.useState(""),b=p.trim().toLocaleLowerCase(),w=v.useMemo(()=>b?e.filter(E=>[E.title,E.id,E.provider,E.provider?Hu(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 be.closeSession(E,t)}catch(S){xe.error(`Delete session failed: ${S instanceof Error?S.message:String(S)}`);return}g(E)}return l.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[l.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[l.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[l.jsxs(Sa,{to:xo(t),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[l.jsx("img",{src: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(tB,{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(CB,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),l.jsx(xt,{value:p,onChange:E=>y(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),l.jsx(he,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:l.jsx(Qi,{})})]})]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[l.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:i}),l.jsx(he,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:h,children:"Retry"})]}),l.jsx(yn,{className:"min-h-0 flex-1",children:s&&e.length===0?l.jsx(XX,{}):e.length===0?l.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[l.jsxs("div",{children:[l.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),l.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),l.jsxs(he,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[l.jsx(Qi,{})," New session"]})]}):w.length===0?l.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",p.trim(),"”."]}):l.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:w.map(E=>l.jsx(KX,{session:E,runtimeLabel:r,selected:o===E.id,onSelect:()=>d(E.id),onDelete:()=>C(E.id)},E.id))})})]})}function KX({session:e,runtimeLabel:t,selected:r,onSelect:i,onDelete:s}){const[o,u]=v.useState(!1),[d,m]=v.useState(!1),[h,g]=v.useState(!1),p=v.useRef(null),y=v.useRef(null),b=ZX(e.updatedAt??e.createdAt),w=e.agent??(e.provider?Hu(e.provider):void 0)??e.source,C=e.title??w??"Untitled session";v.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current),y.current!==null&&window.clearTimeout(y.current)},[]);const E=()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},S=()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null)},N=()=>{E(),S(),!h&&m(!0)},k=()=>{S(),!(h||d||p.current!==null)&&(p.current=window.setTimeout(()=>{p.current=null,m(!0)},VX))},R=()=>{E(),S(),m(!1)},M=()=>{E(),S(),d&&(y.current=window.setTimeout(()=>{y.current=null,m(!1)},GX))};return l.jsxs("li",{className:qe("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:k,onMouseLeave:M,children:[l.jsxs(G_,{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(Cx,{"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(Ex,{"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(bO,{"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(Qe,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),l.jsxs(G_,{open:h,onOpenChange:L=>{g(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(hO,{})})}),l.jsx(Bf,{align:"end",children:l.jsxs(Pf,{variant:"destructive",onSelect:()=>u(!0),children:[l.jsx(Pa,{}),"Delete session"]})})]}),l.jsx(Rn,{open:o,onOpenChange:u,children:l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(en,{children:"Delete this session?"}),l.jsxs(tn,{children:["“",C,"” will be deleted from ",t,". This cannot be undone."]})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>void s(),children:"Delete"})]})]})})]})]})}function XX(){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 ZX(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 QX({runtimeLabel:e,options:t,selection:r,loading:i,submitting:s,error:o,listCollapsed:u,onShowSessions:d,onRetryOptions:m,onSelectionChange:h,onSubmit:g}){const[p,y]=v.useState(""),b=v.useRef(null),w=v.useRef(!1),C=v.useRef(void 0),E=eM({policy:C0,onChange:()=>{C.current=void 0}}),S=p0(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??Wu("msg"):void 0;M&&(C.current=M),await g({text:R,images:E.readyUploads,...M?{clientMessageId:M}:{}})&&(E.clear(),y(""),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(MR,{className:"size-3.5"})}),l.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),l.jsx(yn,{className:"h-full",viewportClassName:"[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col",children:l.jsxs("div",{className:"mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12",children:[l.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:l.jsxs(he,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:d,children:[l.jsx(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(tM,{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,y(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(rM,{policy:C0,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(Qu,{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?WT(r):void 0,disabled:i||s,onValueChange:R=>{const M=qT(R);M&&h(M)},children:[l.jsx(cd,{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(ld,{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(D_,{status:e_(S)})]})})}),l.jsxs(ud,{align:"end",children:[t.providers.length>0&&l.jsxs(n0,{children:[l.jsx(s0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers"}),t.providers.map(R=>l.jsx(Xn,{value:`provider:${R.id}`,textValue:R.name,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(D_,{status:e_(R)}),l.jsx("span",{children:R.name})]})},`provider:${R.id}`))]}),t.agents.length>0&&l.jsxs(n0,{children:[l.jsx(s0,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),t.agents.map(R=>l.jsx(Xn,{value:`agent:${R.id}`,textValue:R.name??R.id,children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(D_,{status:e_(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(Qe,{className:"animate-spin"}):l.jsx(OR,{})})]})]}),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 D_({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 L_(){const e=Oa(),{sessionId:t}=pR(),{runtimeSelector:r,selectedRuntime:i}=nc(),[s,o]=v.useState([]),[u,d]=v.useState({providers:[],agents:[]}),[m,h]=v.useState(null),[g,p]=v.useState(!0),[y,b]=v.useState(),[w,C]=v.useState(),[E,S]=v.useState(!0),[N,k]=v.useState(!1),[R,M]=v.useState(!1),[L,z]=v.useState(!1),[D,W]=v.useState(),G=v.useRef(!1),q=v.useRef(0),B=v.useRef(0),j=v.useRef(0),O=v.useRef(),$=v.useRef(r),T=v.useRef(r),U=v.useRef({selector:r});U.current.selector!==r&&(U.current={selector:r});const H=U.current,F=t??null,V=v.useRef(F);v.useEffect(()=>()=>{j.current+=1},[]),v.useEffect(()=>{V.current!==F&&(V.current=F,j.current+=1)},[F]);const I=v.useCallback(async(ne=!1)=>{const we=++q.current;ne&&S(!0);try{const _e=await be.listSessions(r);if(q.current!==we)return;$.current=r,o(_e),C(void 0)}catch(_e){if(q.current!==we)return;C(`Could not load sessions: ${_e.message}`)}finally{q.current===we&&S(!1)}},[r]);v.useEffect(()=>{T.current!==r&&(T.current=r,O.current=void 0,q.current+=1,o([]),C(void 0),S(!0))},[r]),v.useEffect(()=>{I(!0);const ne=setInterval(()=>void I(),4e3);return()=>clearInterval(ne)},[I]);const Y=v.useCallback(async()=>{const ne=++B.current;p(!0),b(void 0);try{let we;try{we=await be.listSessionLaunchOptions(r)}catch(ye){if(!(ye instanceof yo)||ye.code!=="incompatible"&&ye.code!=="method_not_found")throw ye;we=nF(await be.listSessionAgentOptions(r))}if(B.current!==ne)return;const _e=eF(r,typeof window>"u"?void 0:window.localStorage);d(we),h(JH(we,_e))}catch(we){if(B.current!==ne)return;d({providers:[],agents:[]}),h(null),b(`Could not load launch options: ${we.message}`)}finally{B.current===ne&&p(!1)}},[r]);v.useEffect(()=>(d({providers:[],agents:[]}),h(null),p(!0),b(void 0),M(!1),W(void 0),Y(),()=>{B.current+=1}),[Y]);const X=v.useCallback(async ne=>{var Oe;if(G.current)return!1;const we=ne.text,_e=m;if(!_e)return b("Choose a provider or Agent before starting."),!1;const ye=p0(_e,u);if(!ye)return b("Choose a provider or Agent before starting."),!1;const J=!ye.ready&&ye.readiness!=="unverified";if(J&&ne.images.length>0)return b(`${ye.name} must finish login or first-run setup before starting with images.`),!1;const ie=U.current,Ee=i.displayName,ve=++j.current,Ae=iF(we||((Oe=ne.images[0])==null?void 0:Oe.file.name)||"Image");let Ie;G.current=!0,z(!0),b(void 0);try{const ze=O.current,Be=ze&&ze.selector===ie.selector&&ze.selection.kind===_e.kind&&ze.selection.id===_e.id?ze.sessionId:(await be.createSession(rF(_e,Ae),ie.selector)).sessionId;Ie=Be,O.current={selector:ie.selector,selection:_e,sessionId:Be};let dt,He=!1,Ot=!1;if(J)try{await be.enqueueSessionMessage(ie.selector,Be,we),He=!0}catch(gt){dt=gt}else try{if(ne.images.length===0)Ot=!0,await be.sendSessionMessage(Be,we,()=>{},void 0,ie.selector);else{if(!(await be.getSessionResourcePolicy(ie.selector,Be)).enabled)throw new yo("Session image resources are unavailable on this Runtime",409,"failed_precondition","not_started");const ur=await Promise.all(ne.images.map(At=>be.uploadSessionResource(ie.selector,Be,At.file,At.clientUploadId)));Ot=!0,await be.sendSessionMessage(Be,{content:[...ur.map(At=>({type:"input_image",resourceId:At.resourceId,mediaType:At.mediaType,...At.filename?{filename:At.filename}:{},...At.byteLength?{byteLength:At.byteLength}:{},...At.width?{width:At.width}:{},...At.height?{height:At.height}:{}})),...we?[{type:"input_text",text:we}]:[]],clientMessageId:ne.clientMessageId},()=>{},void 0,ie.selector)}}catch(gt){dt=gt}const Ht=!!(!He&&(ne.images.length>0&&!Ot&&dt||ky(dt)));if(U.current!==ie)return O.current=void 0,dt?Ht?xe.error(`Session created on ${Ee}, but the first message was not sent: ${dt.message}`):xe.warning(`Session created on ${Ee}, but message delivery is unknown. Check its history before retrying.`):xe.success(`Session started on ${Ee}; switch back to view it.`),!0;if(j.current!==ve)return O.current=void 0,dt?Ht?xe.error(`Session created on ${Ee}, but the first message was not sent. Open it to retry.`):xe.warning(`Session created on ${Ee}, but message delivery is unknown. Check its history before retrying.`):xe.success(`Session started on ${Ee} in the background.`),!0;if(ne.images.length>0&&Ht)return b(`Session created, but the first image message was not sent: ${dt.message}. Retry will reuse this Session.`),I(),!1;const gi=new Date().toISOString(),Bt={id:Be,..._e.kind==="provider"?{provider:_e.id}:{agent:_e.id},title:Ae,status:Ht?"idle":"running",createdAt:gi,updatedAt:gi,source:"console",...He?{setupStatus:"waiting_for_provider"}:{}};return $.current=ie.selector,o(gt=>[Bt,...gt.filter(ur=>ur.id!==Be)]),W(Ht?{sessionId:Be,message:we}:void 0),M(!1),O.current=void 0,e(He?`${cf(ie.selector,Be)}?view=terminal`:cf(ie.selector,Be)),I(),He?xe.info(`${ye.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):dt&&(Ht?xe.error(`Session created, but the first message was not sent: ${dt.message}`):xe.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(ze){const rt=ze instanceof yo&&ze.outcome==="unknown",Be=Ie?`Session created, but its first message was not sent: ${ze.message}. Retry will reuse this Session.`:rt?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${ze.message}`;return U.current===ie&&j.current===ve?b(Be):rt?xe.warning(`Session creation on ${Ee} may have succeeded. Check its Session list before retrying.`):xe.error(`Could not start Session on ${Ee}: ${ze.message}`),!Ie&&rt?(O.current=void 0,!0):!1}finally{G.current=!1,z(!1)}},[u,m,e,I,i.displayName]),ee=$.current===r?s:[],re=ee.find(ne=>ne.id===F)??null,oe=re?p0(re.provider?{kind:"provider",id:re.provider}:re.agent?{kind:"agent",id:re.agent}:null,u):null,Z=(re==null?void 0:re.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(oe==null?void 0:oe.name)??(re.provider?Hu(re.provider):re.agent)}:re&&(re.setupStatus==="waiting_for_provider"||(oe==null?void 0:oe.ready)===!1)?{kind:"required",target:(oe==null?void 0:oe.name)??(re.provider?Hu(re.provider):re.agent),taskQueued:re.setupStatus==="waiting_for_provider",...oe!=null&&oe.reason?{reason:oe.reason}:{}}:void 0;v.useEffect(()=>{(D==null?void 0:D.sessionId)===(re==null?void 0:re.id)&&W(void 0)},[D,re==null?void 0:re.id]);const ce=re?l.jsxs("div",{className:qe("flex shrink-0 items-center gap-1",N&&"desktop-macos-titlebar-leading-inset"),children:[l.jsx(he,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{M(!0),e(xo(r),{replace:!0})},children:l.jsx(Gl,{})}),N&&l.jsx(he,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>k(!1),children:l.jsx(MR,{className:"size-3.5"})})]}):void 0;return l.jsxs("div",{className:qe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",N?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!N&&l.jsx("div",{className:qe("min-h-0 min-w-0 border-r border-[var(--border)]",(!R||re)&&"hidden md:block"),children:l.jsx(YX,{sessions:ee,runtimeSelector:r,runtimeLabel:i.displayName,listError:w,loading:E,selectedId:F,onCollapsedChange:k,onSelect:ne=>{j.current+=1,O.current=void 0,M(!1),W(void 0),e(cf(r,ne))},onNew:()=>{j.current+=1,O.current=void 0,M(!1),W(void 0),e(xo(r))},onRetry:()=>void I(!0),onDeleted:ne=>{U.current===H&&(F===ne&&e(xo(r),{replace:!0}),I())}},r)}),re?l.jsx(HX,{session:re,runtimeSelector:r,leadingControls:ce,initialDraft:(D==null?void 0:D.sessionId)===re.id?D.message:void 0,terminalSetup:Z},`${r}:${re.id}`):F&&E?l.jsx("div",{className:"grid min-h-0 min-w-0 place-items-center",role:"status","aria-live":"polite",children:l.jsxs("span",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[l.jsx(Qe,{className:"size-4 animate-spin"})," Loading session…"]})}):l.jsx("div",{className:qe("min-h-0 min-w-0",R&&!N&&"hidden md:block"),children:l.jsx(QX,{runtimeLabel:i.displayName,options:u,selection:m,loading:g,submitting:L,error:y??w??(F?"Session not found. Start a new session or choose another from the list.":void 0),listCollapsed:N,onShowSessions:()=>{j.current+=1,k(!1),M(!0)},onRetryOptions:()=>{Y()},onSelectionChange:ne=>{O.current=void 0,h(ne),b(void 0),tF(r,typeof window>"u"?void 0:window.localStorage,ne)},onSubmit:X},r)})]})}function JX({name:e,onClose:t}){const[r,i]=v.useState(null),[s,o]=v.useState("meta"),[u,d]=v.useState(null),[m,h]=v.useState(""),[g,p]=v.useState(!1),[y,b]=v.useState(new Set),w=C=>b(E=>{const S=new Set(E);return S.has(C)?S.delete(C):S.add(C),S});return v.useEffect(()=>{if(!e){i(null),d(null),h("");return}o("meta");let C=!1;return be.getSkill(e).then(E=>{var S;C||(i(E),b(new Set(eZ(E.files))),d(((S=E.files.find(N=>N.path==="SKILL.md")??E.files[0])==null?void 0:S.path)??null))}).catch(E=>xe.error(`Load skill failed: ${E.message}`)),()=>{C=!0}},[e]),v.useEffect(()=>{if(!e||!u){h("");return}let C=!1;return p(!0),be.readSkillFile(e,u).then(E=>!C&&h(E.content)).catch(E=>!C&&h(`⚠ ${E.message}`)).finally(()=>!C&&p(!1)),()=>{C=!0}},[e,u]),l.jsx(Oo,{open:e!=null,onOpenChange:C=>!C&&t(),children:l.jsxs($a,{className:"flex max-h-[85vh] max-w-3xl flex-col overflow-hidden",children:[l.jsx(Bo,{children:l.jsx(Ua,{className:"font-mono",children:e})}),l.jsxs(GT,{value:s,onValueChange:o,className:"flex min-h-0 flex-1 flex-col gap-3",children:[l.jsxs(YT,{className:"self-start",children:[l.jsx(g0,{value:"meta",children:"Meta"}),l.jsxs(g0,{value:"files",children:["Files",r?` (${r.files.length})`:""]})]}),l.jsx(Fu,{value:"meta",className:"mt-0 min-h-0 flex-1",children:l.jsx(yn,{className:"h-full",children:r===null?l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):l.jsxs("div",{className:"grid gap-5 pr-1",children:[r.description&&l.jsxs("div",{className:"grid gap-1.5",children:[l.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"Description"}),l.jsx("p",{className:"text-sm leading-relaxed",children:r.description})]}),l.jsxs("dl",{className:"grid grid-cols-[5.5rem_1fr] items-baseline gap-x-5 gap-y-3",children:[(()=>{var E,S;const C=JT((E=r.ref)==null?void 0:E.install);return l.jsxs(l.Fragment,{children:[l.jsx(_u,{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(_u,{label:"Version",children:l.jsx("span",{className:"font-mono text-xs",children:C.version})}),((S=r.ref)==null?void 0:S.contentHash)&&l.jsx(_u,{label:"Content",children:l.jsx("span",{className:"break-all font-mono text-xs",children:r.ref.contentHash})})]})})(),l.jsx(_u,{label:"Files",children:r.files.length}),l.jsx(_u,{label:"Size",children:Tj(r.totalSize)})]})]})})}),l.jsx(Fu,{value:"files",className:"mt-0 flex min-h-0 flex-1 flex-col",children:l.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[14rem_1fr] gap-3",children:[l.jsx(yn,{className:"min-h-0 rounded-md border border-[var(--border)]",children:l.jsx("div",{className:"p-1",children:r===null?l.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"Loading…"}):r.files.length===0?l.jsx("p",{className:"p-2 text-xs text-[var(--muted-foreground)]",children:"No files."}):l.jsx(jj,{nodes:tZ(r.files),depth:0,active:u,onSelect:d,collapsed:y,onToggle:w})})}),l.jsx("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-words rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:g?"Loading…":m})]})})]})]})})}function _u({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 Tj(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:"—"}function eZ(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 tZ(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 Mj(t),t.children}function Mj(e){e.children.sort((t,r)=>t.isDir===r.isDir?t.name.localeCompare(r.name):t.isDir?-1:1),e.children.forEach(Mj)}function jj({nodes:e,depth:t,active:r,onSelect:i,collapsed:s,onToggle:o}){const u=d=>({paddingLeft:d*14+8});return l.jsx(l.Fragment,{children:e.map(d=>d.isDir?l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>o(d.path),style:u(t),className:"flex w-full items-center gap-1.5 rounded-sm py-1 pr-2 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[l.jsx(jo,{className:qe("size-3 shrink-0 transition-transform",!s.has(d.path)&&"rotate-90")}),l.jsx(SO,{className:"size-3.5 shrink-0"}),l.jsx("span",{className:"truncate font-mono",children:d.name})]}),!s.has(d.path)&&l.jsx(jj,{nodes:d.children,depth:t+1,active:r,onSelect:i,collapsed:s,onToggle:o})]},d.path):l.jsxs("button",{type:"button",onClick:()=>i(d.path),style:u(t),className:qe("flex w-full items-center justify-between gap-2 rounded-sm py-1 pr-2 text-left",r===d.path?"bg-[var(--muted)]":"hover:bg-[var(--muted)]/50"),children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx(xO,{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:Tj(d.size??0)})]},d.path))})}function rZ(){const[e,t]=v.useState(null),[r,i]=v.useState(null);async function s(){try{t(await be.listSkills())}catch(o){t([]),xe.error(`Failed to load skills: ${o.message}`)}}return v.useEffect(()=>{s()},[]),l.jsxs(Vr,{children:[l.jsxs(pi,{className:"items-start",children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsxs(Zr,{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(LT,{onInstalled:t})})]}),l.jsx(Qr,{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=JT((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(iZ,{name:o.name,onDeleted:s})]})})]},o.name))]})]})}),l.jsx(JX,{name:r,onClose:()=>i(null)})]})}function iZ({name:e,onDeleted:t}){return l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsx(he,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:l.jsx(Pa,{})})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsxs(en,{children:['Remove skill "',e,'"?']}),l.jsx(tn,{children:"Deletes it from the global catalog. Agents that reference it will no longer resolve it."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:async()=>{try{await be.deleteSkill(e),xe.success(`Skill "${e}" removed`),await t()}catch(r){xe.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function nZ(){const e=hd(),[t,r]=v.useState(null),[i,s]=v.useState(null),[o,u]=v.useState("refresh"),d=v.useCallback(async(b=!1)=>{if(e){u("refresh"),s(null);try{r(await e.getStatus(b))}catch(w){s(w.message)}finally{u(null)}}},[e]);v.useEffect(()=>{d()},[d]);async function m(b){if(e){u("install"),s(null);try{r(await e.installCli(b)),xe.success("Terminal command installed")}catch(w){const C=w.message;s(C),xe.error(`Could not install the Terminal command: ${C}`);try{r(await e.getStatus(!0))}catch{}}finally{u(null)}}}async function h(b){if(e){u("remove"),s(null);try{r(await e.removeCli(b)),xe.success("Terminal command removed")}catch(w){const C=w.message;s(C),xe.error(`Could not remove the Terminal command: ${C}`);try{r(await e.getStatus(!0))}catch{}}finally{u(null)}}}const g=t==null?void 0:t.globalCli,p=(g==null?void 0:g.state)==="installed",y=(g==null?void 0:g.state)==="installed"&&g.canInstall&&!!(g.path&&g.target&&g.path!==g.target);return l.jsxs("div",{className:"grid max-w-3xl gap-5",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Terminal command"}),l.jsxs("p",{className:"text-sm text-[var(--muted-foreground)]",children:["Install or remove the ",l.jsx("code",{className:"font-mono",children:"rynx"})," command used in Terminal."]})]}),l.jsxs(Vr,{"aria-busy":o!==null,children:[l.jsxs(pi,{children:[l.jsxs("div",{className:"grid gap-1",children:[l.jsx(Zr,{children:"Shell access"}),l.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Removing the command does not uninstall Rynx or delete its data."})]}),l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>void d(!0),children:[l.jsx(Nt,{className:o==="refresh"?"animate-spin":""}),"Check"]})]}),l.jsxs(Qr,{className:"grid gap-3",children:[g?l.jsxs("div",{className:"grid gap-4 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[l.jsx("span",{className:p?"grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:p?l.jsx(Ba,{className:"size-5"}):l.jsx(kx,{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(Et,{variant:p?"success":"warning",children:sZ(g.state)})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:aZ(g)}),g.path&&l.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]",children:g.path}),y&&g.target&&l.jsxs("p",{className:"mt-1 break-all text-[11px] text-[var(--muted-foreground)]",children:["Recommended: ",l.jsx("code",{className:"font-mono",children:g.target})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2 sm:justify-self-end",children:[g.canInstall&&l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,onClick:()=>g.path&&void m(g.path),children:[o==="install"&&l.jsx(Qe,{className:"animate-spin"}),y?"Move command":g.state==="stale"?"Repair command":"Install command"]}),g.canRemove&&l.jsxs(Rn,{children:[l.jsx(es,{asChild:!0,children:l.jsxs(he,{variant:"outline",size:"sm",disabled:o!==null,children:[l.jsx(Pa,{}),"Remove command"]})}),l.jsxs(Ji,{children:[l.jsxs(kn,{children:[l.jsx(en,{children:"Remove the Terminal command?"}),l.jsx(tn,{children:"This removes only the shell command link that points to this Rynx app. The app, Runtime, settings, and workspace data remain installed."})]}),l.jsxs(Nn,{children:[l.jsx(rn,{children:"Cancel"}),l.jsx(An,{variant:"destructive",onClick:()=>g.path&&void h(g.path),children:"Remove command"})]})]})]})]})]}):l.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o==="refresh"&&l.jsx(Qe,{className:"size-4 animate-spin"}),o==="refresh"?"Checking command…":"Command status is unavailable."]}),i&&l.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[l.jsx(Zu,{className:"mt-0.5 size-4 shrink-0"}),l.jsx("span",{children:i})]})]})]})]})}function sZ(e){switch(e){case"installed":return"Installed";case"missing":return"Not installed";case"stale":return"Needs repair";case"foreign":return"Managed externally";case"unwritable":case"error":return"Unavailable"}}function aZ(e){switch(e.state){case"installed":return e.canInstall?"The command is ready. You can move it to the recommended location.":"The command is ready to use from Terminal.";case"missing":return"Install the command to use Rynx from Terminal.";case"stale":return"Update the command registration to use this Rynx app.";case"foreign":return"Another program owns the active command. Rynx will not replace or remove it.";case"unwritable":return"Rynx could not find a supported location for the command.";case"error":return"Rynx could not check the command."}}function oZ(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function lZ(){const e=hd();return e?l.jsxs(l.Fragment,{children:[l.jsx(G9,{bridge:e,children:l.jsx(qE,{desktopIntegrationAvailable:!0})}),l.jsx(Q9,{bridge:e})]}):l.jsx(qE,{desktopIntegrationAvailable:!1})}function qE({desktopIntegrationAvailable:e}){const{theme:t,toggle:r}=Ty(),i=Ur(),s=D9(i.pathname,e),o=v.useRef(null),[u,d]=v.useState([]),[m,h]=v.useState([]),[g,p]=v.useState([]),[y,b]=v.useState([]),[w,C]=v.useState(!1),E=v.useCallback(async()=>{try{d(await be.listAgents())}catch(R){xe.error(`Failed to load agents: ${R.message}`)}},[]),S=v.useCallback(async()=>{const R=await Promise.allSettled([be.channelTypes(),be.listChannels(),be.listInstances(),be.listAgents()]);R[0].status==="fulfilled"&&h(R[0].value),R[1].status==="fulfilled"&&p(R[1].value),R[2].status==="fulfilled"&&b(R[2].value),R[3].status==="fulfilled"&&d(R[3].value)},[]);v.useEffect(()=>{s&&s!=="emulator"&&S()},[S,s]),v.useEffect(()=>{let R=!0;const M=async()=>{try{const z=await be.meta();R&&C(oZ(z))}catch{}};M();const L=window.setInterval(()=>void M(),15e3);return()=>{R=!1,window.clearInterval(L)}},[]),v.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=$L([{path:"/",element:l.jsx(go,{replace:!0,to:pt.sessions})},{path:zu,element:l.jsx(go,{replace:!0,to:c0})},{path:pt.overview,element:l.jsx(DH,{instances:y,channels:g,agents:u})},{path:pt.runtimes,element:l.jsx(WH,{})},{path:pt.providers,element:l.jsx(OH,{})},{path:pt.instances,element:l.jsx(NH,{instances:y,channels:g,agents:u,onChange:S})},{path:pt.channels,element:l.jsx(KU,{channels:g,channelTypes:m,onChange:S})},{path:pt.agents,element:l.jsx(xU,{agents:u,onChange:E})},{path:pt.skills,element:l.jsx(rZ,{})},{path:N9,element:l.jsx(L_,{})},{path:A9,element:l.jsx(L_,{})},{path:pt.sessions,element:l.jsx(L_,{})},{path:`${pt.sessions}/:sessionId`,element:l.jsx(cZ,{})},{path:pt.emulator,element:l.jsx(kH,{})},{path:pt.logs,element:l.jsx(MH,{})},...e?[{path:pt.daemon,element:l.jsx(nH,{})},{path:pt.command,element:l.jsx(nZ,{})},{path:pt.computer,element:l.jsx(iH,{})},{path:pt.inspection,element:l.jsx(QU,{})}]:bT.map(R=>({path:pt[R],element:l.jsx(go,{replace:!0,to:c0})})),...Object.entries(M9).map(([R,M])=>({path:M,element:l.jsx(go,{replace:!0,to:pt[R]})})),{path:"*",element:l.jsx(go,{replace:!0,to:pt.sessions})}]),k=s?l.jsx(eU,{activeView:s,desktopIntegrationAvailable:e,children:N}):N;return l.jsx(V9,{theme:t,onToggleTheme:r,children:l.jsxs("div",{ref:o,id:"main-content",tabIndex:-1,className:"flex h-full min-h-0 flex-col overflow-hidden focus:outline-none",children:[w&&l.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]",children:[l.jsx(Ea,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e?l.jsxs("span",{children:["The local Runtime is running an older build. Restart it from"," ",l.jsx("strong",{children:"Settings → Daemon"}),", then reload this page."]}):l.jsxs("span",{children:["The resident daemon is running an older build. Run"," ",l.jsx("code",{className:"font-mono font-semibold",children:"rynx restart"}),", then reload this page."]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:k})]})})}function cZ(){const{sessionId:e}=pR(),t=Ur();if(!e)return l.jsx(go,{replace:!0,to:pt.sessions});const r=CT(t.search)??"local";return l.jsx(go,{replace:!0,to:cf(r,e)})}function uZ(e){const{theme:t}=Ty();return l.jsx(R6,{theme:t,...e})}var QE;((QE=window.rynxDesktopIntegration)==null?void 0:QE.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");tL.createRoot(document.getElementById("root")).render(l.jsx(v.StrictMode,{children:l.jsx(C4,{children:l.jsxs(W9,{children:[l.jsx(lZ,{}),l.jsx(uZ,{richColors:!0,position:"top-right"})]})})}));export{SX as _,Ia as a,Ix as c,mx as g,l as j,v as r,Bk as t};
|