herdr-remote-relay 0.3.11 → 0.3.13
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/bin/herdr-remote-relay.js +20 -20
- package/dist/auth-store.d.ts +114 -0
- package/dist/auth-store.js +276 -0
- package/dist/metrics.d.ts +76 -0
- package/dist/metrics.js +249 -0
- package/dist/protocol/frames.d.ts +27 -0
- package/dist/protocol/frames.js +110 -0
- package/dist/protocol/http.d.ts +161 -0
- package/dist/protocol/http.js +3 -0
- package/dist/protocol/index.d.ts +5 -0
- package/dist/protocol/index.js +7 -0
- package/dist/protocol/messages.d.ts +321 -0
- package/dist/protocol/messages.js +18 -0
- package/dist/protocol/paste.d.ts +14 -0
- package/dist/protocol/paste.js +50 -0
- package/dist/protocol/terminal.d.ts +79 -0
- package/dist/protocol/terminal.js +150 -0
- package/dist/relay-config.d.ts +74 -0
- package/dist/relay-config.js +316 -0
- package/dist/relay-server.d.ts +64 -0
- package/dist/relay-server.js +194 -0
- package/dist/scroll-input.d.ts +17 -0
- package/dist/scroll-input.js +124 -0
- package/dist/server/client-channel.d.ts +3 -0
- package/dist/server/client-channel.js +365 -0
- package/dist/server/font-proxy.d.ts +19 -0
- package/dist/server/font-proxy.js +155 -0
- package/dist/server/host-broadcasts.d.ts +25 -0
- package/dist/server/host-broadcasts.js +79 -0
- package/dist/server/host-channel.d.ts +3 -0
- package/dist/server/host-channel.js +266 -0
- package/dist/server/http-api.d.ts +3 -0
- package/dist/server/http-api.js +214 -0
- package/dist/server/maintenance.d.ts +5 -0
- package/dist/server/maintenance.js +64 -0
- package/dist/server/requests.d.ts +34 -0
- package/dist/server/requests.js +142 -0
- package/dist/server/sessions.d.ts +36 -0
- package/dist/server/sessions.js +225 -0
- package/dist/server/sockets.d.ts +12 -0
- package/dist/server/sockets.js +64 -0
- package/dist/server/status.d.ts +11 -0
- package/dist/server/status.js +95 -0
- package/dist/server/transport.d.ts +16 -0
- package/dist/server/transport.js +110 -0
- package/dist/server/types.d.ts +123 -0
- package/dist/server/types.js +3 -0
- package/dist/server/version.d.ts +2 -0
- package/dist/server/version.js +5 -0
- package/dist/state.d.ts +6 -0
- package/dist/state.js +47 -0
- package/package.json +32 -8
- package/web/dist/assets/index-B-5zRmL_.js +61 -0
- package/web/dist/assets/index-DKt8KLog.css +32 -0
- package/web/dist/assets/{vendor-xterm-Bbu8R_5E.js → vendor-xterm-BhCxil_4.js} +2 -2
- package/web/dist/index.html +3 -3
- package/src/auth-store.js +0 -256
- package/src/metrics.js +0 -241
- package/src/relay-config.js +0 -312
- package/src/relay-server.js +0 -1799
- package/src/scroll-input.js +0 -139
- package/src/state.js +0 -47
- package/src/stream-frame.js +0 -238
- package/web/dist/assets/index-2ut7QeyF.css +0 -32
- package/web/dist/assets/index-cIIMc3UE.js +0 -61
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var pv=Object.defineProperty;var gv=(a,i,s)=>i in a?pv(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s;var Z=(a,i,s)=>gv(a,typeof i!="symbol"?i+"":i,s);import{r as Bg,g as Hg,a as Ug}from"./vendor-react-CYSfZuHu.js";import{r as bv,a as yv}from"./vendor-xterm-Bbu8R_5E.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=s(c);fetch(c.href,d)}})();var Vu={exports:{}},Zs={};/**
|
|
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 Sp;function vv(){if(Sp)return Zs;Sp=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:a,type:r,key:h,ref:c!==void 0?c:null,props:d}}return Zs.Fragment=i,Zs.jsx=s,Zs.jsxs=s,Zs}var Cp;function xv(){return Cp||(Cp=1,Vu.exports=vv()),Vu.exports}var f=xv(),w=Bg();const _i=Hg(w);var Xu={exports:{}},Qs={},Pu={exports:{}},Zu={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* scheduler.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 Tp;function wv(){return Tp||(Tp=1,(function(a){function i(A,j){var J=A.length;A.push(j);e:for(;0<J;){var se=J-1>>>1,V=A[se];if(0<c(V,j))A[se]=j,A[J]=V,J=se;else break e}}function s(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var j=A[0],J=A.pop();if(J!==j){A[0]=J;e:for(var se=0,V=A.length,De=V>>>1;se<De;){var Re=2*(se+1)-1,ye=A[Re],Ae=Re+1,Le=A[Ae];if(0>c(ye,J))Ae<V&&0>c(Le,ye)?(A[se]=Le,A[Ae]=J,se=Ae):(A[se]=ye,A[Re]=J,se=Re);else if(Ae<V&&0>c(Le,J))A[se]=Le,A[Ae]=J,se=Ae;else break e}}return j}function c(A,j){var J=A.sortIndex-j.sortIndex;return J!==0?J:A.id-j.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();a.unstable_now=function(){return h.now()-m}}var p=[],y=[],b=1,v=null,S=3,M=!1,N=!1,q=!1,R=!1,D=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function le(A){for(var j=s(y);j!==null;){if(j.callback===null)r(y);else if(j.startTime<=A)r(y),j.sortIndex=j.expirationTime,i(p,j);else break;j=s(y)}}function fe(A){if(q=!1,le(A),!N)if(s(p)!==null)N=!0,te||(te=!0,ie());else{var j=s(y);j!==null&&we(fe,j.startTime-A)}}var te=!1,F=-1,I=5,me=-1;function be(){return R?!0:!(a.unstable_now()-me<I)}function Ne(){if(R=!1,te){var A=a.unstable_now();me=A;var j=!0;try{e:{N=!1,q&&(q=!1,B(F),F=-1),M=!0;var J=S;try{t:{for(le(A),v=s(p);v!==null&&!(v.expirationTime>A&&be());){var se=v.callback;if(typeof se=="function"){v.callback=null,S=v.priorityLevel;var V=se(v.expirationTime<=A);if(A=a.unstable_now(),typeof V=="function"){v.callback=V,le(A),j=!0;break t}v===s(p)&&r(p),le(A)}else r(p);v=s(p)}if(v!==null)j=!0;else{var De=s(y);De!==null&&we(fe,De.startTime-A),j=!1}}break e}finally{v=null,S=J,M=!1}j=void 0}}finally{j?ie():te=!1}}}var ie;if(typeof G=="function")ie=function(){G(Ne)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,ge=de.port2;de.port1.onmessage=Ne,ie=function(){ge.postMessage(null)}}else ie=function(){D(Ne,0)};function we(A,j){F=D(function(){A(a.unstable_now())},j)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(A){A.callback=null},a.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<A?Math.floor(1e3/A):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(A){switch(S){case 1:case 2:case 3:var j=3;break;default:j=S}var J=S;S=j;try{return A()}finally{S=J}},a.unstable_requestPaint=function(){R=!0},a.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var J=S;S=A;try{return j()}finally{S=J}},a.unstable_scheduleCallback=function(A,j,J){var se=a.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?se+J:se):J=se,A){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=J+V,A={id:b++,callback:j,priorityLevel:A,startTime:J,expirationTime:V,sortIndex:-1},J>se?(A.sortIndex=J,i(y,A),s(p)===null&&A===s(y)&&(q?(B(F),F=-1):q=!0,we(fe,J-se))):(A.sortIndex=V,i(p,A),N||M||(N=!0,te||(te=!0,ie()))),A},a.unstable_shouldYield=be,a.unstable_wrapCallback=function(A){var j=S;return function(){var J=S;S=j;try{return A.apply(this,arguments)}finally{S=J}}}})(Zu)),Zu}var Mp;function Sv(){return Mp||(Mp=1,Pu.exports=wv()),Pu.exports}/**
|
|
18
|
-
* @license React
|
|
19
|
-
* react-dom-client.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 Ap;function Cv(){if(Ap)return Qs;Ap=1;var a=Sv(),i=Bg(),s=Ug();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(r(188))}function y(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,l=t;;){var o=n.return;if(o===null)break;var u=o.alternate;if(u===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===n)return p(o),e;if(u===l)return p(o),t;u=u.sibling}throw Error(r(188))}if(n.return!==l.return)n=o,l=u;else{for(var g=!1,x=o.child;x;){if(x===n){g=!0,n=o,l=u;break}if(x===l){g=!0,l=o,n=u;break}x=x.sibling}if(!g){for(x=u.child;x;){if(x===n){g=!0,n=u,l=o;break}if(x===l){g=!0,l=u,n=o;break}x=x.sibling}if(!g)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),G=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),fe=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),me=Symbol.for("react.activity"),be=Symbol.for("react.memo_cache_sentinel"),Ne=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=Ne&&e[Ne]||e["@@iterator"],typeof e=="function"?e:null)}var de=Symbol.for("react.client.reference");function ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case q:return"Fragment";case D:return"Profiler";case R:return"StrictMode";case fe:return"Suspense";case te:return"SuspenseList";case me:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case G:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case le:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}var we=Array.isArray,A=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},se=[],V=-1;function De(e){return{current:e}}function Re(e){0>V||(e.current=se[V],se[V]=null,V--)}function ye(e,t){V++,se[V]=e.current,e.current=t}var Ae=De(null),Le=De(null),He=De(null),gt=De(null);function Ve(e,t){switch(ye(He,t),ye(Le,e),ye(Ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$m(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$m(t),e=qm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Re(Ae),ye(Ae,e)}function Ue(){Re(Ae),Re(Le),Re(He)}function vt(e){e.memoizedState!==null&&ye(gt,e);var t=Ae.current,n=qm(t,e.type);t!==n&&(ye(Le,e),ye(Ae,n))}function xt(e){Le.current===e&&(Re(Ae),Re(Le)),gt.current===e&&(Re(gt),qs._currentValue=J)}var Fe,Y;function oe(e){if(Fe===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||"",Y=-1<n.stack.indexOf(`
|
|
26
|
-
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
-
`+Fe+e+Y}var Xe=!1;function Nt(e,t){if(!e||Xe)return"";Xe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch($){var K=$}Reflect.construct(e,[],Q)}else{try{Q.call()}catch($){K=$}e.call(Q.prototype)}}else{try{throw Error()}catch($){K=$}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch($){if($&&K&&typeof $.stack=="string")return[$.stack,K.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),g=u[0],x=u[1];if(g&&x){var T=g.split(`
|
|
28
|
-
`),U=x.split(`
|
|
29
|
-
`);for(o=l=0;l<T.length&&!T[l].includes("DetermineComponentFrameRoot");)l++;for(;o<U.length&&!U[o].includes("DetermineComponentFrameRoot");)o++;if(l===T.length||o===U.length)for(l=T.length-1,o=U.length-1;1<=l&&0<=o&&T[l]!==U[o];)o--;for(;1<=l&&0<=o;l--,o--)if(T[l]!==U[o]){if(l!==1||o!==1)do if(l--,o--,0>o||T[l]!==U[o]){var X=`
|
|
30
|
-
`+T[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=o);break}}}finally{Xe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?oe(n):""}function Ut(e,t){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe("Lazy");case 13:return e.child!==t&&t!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("SuspenseList");case 0:case 15:return Nt(e.type,!1);case 11:return Nt(e.type.render,!1);case 1:return Nt(e.type,!0);case 31:return oe("Activity");default:return""}}function dn(e){try{var t="",n=null;do t+=Ut(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
|
|
31
|
-
Error generating stack: `+l.message+`
|
|
32
|
-
`+l.stack}}var Gt=Object.prototype.hasOwnProperty,ot=a.unstable_scheduleCallback,$e=a.unstable_cancelCallback,mn=a.unstable_shouldYield,ct=a.unstable_requestPaint,ce=a.unstable_now,Me=a.unstable_getCurrentPriorityLevel,Ie=a.unstable_ImmediatePriority,E=a.unstable_UserBlockingPriority,ue=a.unstable_NormalPriority,ve=a.unstable_LowPriority,Be=a.unstable_IdlePriority,pn=a.log,li=a.unstable_setDisableYieldValue,gn=null,Ct=null;function Lt(e){if(typeof pn=="function"&&li(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(gn,e)}catch{}}var ft=Math.clz32?Math.clz32:bn,ln=Math.log,Kt=Math.LN2;function bn(e){return e>>>=0,e===0?32:31-(ln(e)/Kt|0)|0}var en=256,tt=262144,yn=4194304;function Tn(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var o=0,u=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var x=l&134217727;return x!==0?(l=x&~u,l!==0?o=Tn(l):(g&=x,g!==0?o=Tn(g):n||(n=x&~e,n!==0&&(o=Tn(n))))):(x=l&~u,x!==0?o=Tn(x):g!==0?o=Tn(g):n||(n=l&~e,n!==0&&(o=Tn(n)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:o}function sn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 wt(){var e=yn;return yn<<=1,(yn&62914560)===0&&(yn=4194304),e}function ta(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $n(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function fl(e,t,n,l,o,u){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var x=e.entanglements,T=e.expirationTimes,U=e.hiddenUpdates;for(n=g&~n;0<n;){var X=31-ft(n),Q=1<<X;x[X]=0,T[X]=-1;var K=U[X];if(K!==null)for(U[X]=null,X=0;X<K.length;X++){var $=K[X];$!==null&&($.lane&=-536870913)}n&=~Q}l!==0&&Ua(e,l,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function Ua(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-ft(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function na(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-ft(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}function jn(e,t){var n=t&-t;return n=(n&42)!==0?1:vn(n),(n&(e.suspendedLanes|t))!==0?0:n}function vn(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function qn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Yt(){var e=j.p;return e!==0?e:(e=window.event,e===void 0?32:pp(e.type))}function hl(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var Dn=Math.random().toString(36).slice(2),jt="__reactFiber$"+Dn,Zt="__reactProps$"+Dn,On="__reactContainer$"+Dn,yi="__reactEvents$"+Dn,ia="__reactListeners$"+Dn,os="__reactHandles$"+Dn,ml="__reactResources$"+Dn,ji="__reactMarker$"+Dn;function Ka(e){delete e[jt],delete e[Zt],delete e[yi],delete e[ia],delete e[os]}function vi(e){var t=e[jt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[On]||n[jt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jm(e);e!==null;){if(n=e[jt])return n;e=Jm(e)}return t}e=n,n=e.parentNode}return null}function xi(e){if(e=e[jt]||e[On]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function si(e){var t=e[ml];return t||(t=e[ml]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function St(e){e[ji]=!0}var Vn=new Set,Si={};function Xn(e,t){ri(e,t),ri(e+"Capture",t)}function ri(e,t){for(Si[e]=t,e=0;e<t.length;e++)Vn.add(t[e])}var pl=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]*$"),Di={},Fa={};function gl(e){return Gt.call(Fa,e)?!0:Gt.call(Di,e)?!1:pl.test(e)?Fa[e]=!0:(Di[e]=!0,!1)}function Oi(e,t,n){if(gl(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ci(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function z(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function C(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ne(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var o=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(g){n=""+g,u.call(this,g)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function W(e){if(!e._valueTracker){var t=O(e)?"checked":"value";e._valueTracker=ne(e,t,""+e[t])}}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=O(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function ee(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var bt=/[\n"\\]/g;function Oe(e){return e.replace(bt,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Tt(e,t,n,l,o,u,g,x){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+C(t)):e.value!==""+C(t)&&(e.value=""+C(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Dt(e,g,C(t)):n!=null?Dt(e,g,C(n)):l!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+C(x):e.removeAttribute("name")}function nt(e,t,n,l,o,u,g,x){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){W(e);return}n=n!=null?""+C(n):"",t=t!=null?""+C(t):n,x||t===e.value||(e.value=t),e.defaultValue=t}l=l??o,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=x?e.checked:!!l,e.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),W(e)}function Dt(e,t,n){t==="number"&&ee(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function fn(e,t,n,l){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&l&&(e[n].defaultSelected=!0)}else{for(n=""+C(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function zi(e,t,n){if(t!=null&&(t=""+C(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+C(n):""}function Ia(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(r(92));if(we(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=C(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),W(e)}function oi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var aa=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 vr(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||aa.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function xr(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var o in t)l=t[o],t.hasOwnProperty(o)&&n[o]!==l&&vr(e,o,l)}else for(var u in t)t.hasOwnProperty(u)&&vr(e,u,t[u])}function cs(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Po=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"]]),Zo=/^[\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 bl(e){return Zo.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ci(){}var us=null;function hn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var la=null,sa=null;function ra(e){var t=xi(e);if(t&&(e=t.stateNode)){var n=e[Zt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Tt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Oe(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=l[Zt]||null;if(!o)throw Error(r(90));Tt(l,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&pe(l)}break e;case"textarea":zi(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&fn(e,!!n.multiple,t,!1)}}}var zn=!1;function ds(e,t,n){if(zn)return e(t,n);zn=!0;try{var l=e(t);return l}finally{if(zn=!1,(la!==null||sa!==null)&&(no(),la&&(t=la,e=sa,sa=la=null,ra(t),e)))for(t=0;t<e.length;t++)ra(e[t])}}function oa(e,t){var n=e.stateNode;if(n===null)return null;var l=n[Zt]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var Mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ca=!1;if(Mn)try{var Ti={};Object.defineProperty(Ti,"passive",{get:function(){ca=!0}}),window.addEventListener("test",Ti,Ti),window.removeEventListener("test",Ti,Ti)}catch{ca=!1}var ui=null,yl=null,Ga=null;function ae(){if(Ga)return Ga;var e,t=yl,n=t.length,l,o="value"in ui?ui.value:ui.textContent,u=o.length;for(e=0;e<n&&t[e]===o[e];e++);var g=n-e;for(l=1;l<=g&&t[n-l]===o[u-l];l++);return Ga=o.slice(e,1<l?1-l:void 0)}function he(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ke(){return!0}function Ot(){return!1}function lt(e){function t(n,l,o,u,g){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=u,this.target=g,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(u):u[x]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ke:Ot,this.isPropagationStopped=Ot,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ke)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ke)},persist:function(){},isPersistent:Ke}),t}var kt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ke=lt(kt),Qt=v({},kt,{view:0,detail:0}),zt=lt(Qt),An,di,Bn,Pn=v({},Qt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Bn&&(Bn&&e.type==="mousemove"?(An=e.screenX-Bn.screenX,di=e.screenY-Bn.screenY):di=An=0,Bn=e),An)},movementY:function(e){return"movementY"in e?e.movementY:di}}),fs=lt(Pn),my=v({},Pn,{dataTransfer:0}),py=lt(my),gy=v({},Qt,{relatedTarget:0}),Qo=lt(gy),by=v({},kt,{animationName:0,elapsedTime:0,pseudoElement:0}),yy=lt(by),vy=v({},kt,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),xy=lt(vy),wy=v({},kt,{data:0}),Xd=lt(wy),Sy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cy={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"},Ty={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function My(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ty[e])?!!t[e]:!1}function Wo(){return My}var Ay=v({},Qt,{key:function(e){if(e.key){var t=Sy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=he(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Cy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wo,charCode:function(e){return e.type==="keypress"?he(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?he(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ey=lt(Ay),Ny=v({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pd=lt(Ny),ky=v({},Qt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wo}),Ry=lt(ky),Ly=v({},kt,{propertyName:0,elapsedTime:0,pseudoElement:0}),_y=lt(Ly),jy=v({},Pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Dy=lt(jy),Oy=v({},kt,{newState:0,oldState:0}),zy=lt(Oy),By=[9,13,27,32],Jo=Mn&&"CompositionEvent"in window,hs=null;Mn&&"documentMode"in document&&(hs=document.documentMode);var Hy=Mn&&"TextEvent"in window&&!hs,Zd=Mn&&(!Jo||hs&&8<hs&&11>=hs),Qd=" ",Wd=!1;function Jd(e,t){switch(e){case"keyup":return By.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ef(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vl=!1;function Uy(e,t){switch(e){case"compositionend":return ef(t);case"keypress":return t.which!==32?null:(Wd=!0,Qd);case"textInput":return e=t.data,e===Qd&&Wd?null:e;default:return null}}function Ky(e,t){if(vl)return e==="compositionend"||!Jo&&Jd(e,t)?(e=ae(),Ga=yl=ui=null,vl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Zd&&t.locale!=="ko"?null:t.data;default:return null}}var Fy={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 tf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Fy[e.type]:t==="textarea"}function nf(e,t,n,l){la?sa?sa.push(l):sa=[l]:la=l,t=co(t,"onChange"),0<t.length&&(n=new ke("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var ms=null,ps=null;function Iy(e){Um(e,0)}function wr(e){var t=wi(e);if(pe(t))return e}function af(e,t){if(e==="change")return t}var lf=!1;if(Mn){var ec;if(Mn){var tc="oninput"in document;if(!tc){var sf=document.createElement("div");sf.setAttribute("oninput","return;"),tc=typeof sf.oninput=="function"}ec=tc}else ec=!1;lf=ec&&(!document.documentMode||9<document.documentMode)}function rf(){ms&&(ms.detachEvent("onpropertychange",of),ps=ms=null)}function of(e){if(e.propertyName==="value"&&wr(ps)){var t=[];nf(t,ps,e,hn(e)),ds(Iy,t)}}function Gy(e,t,n){e==="focusin"?(rf(),ms=t,ps=n,ms.attachEvent("onpropertychange",of)):e==="focusout"&&rf()}function Yy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return wr(ps)}function $y(e,t){if(e==="click")return wr(t)}function qy(e,t){if(e==="input"||e==="change")return wr(t)}function Vy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hn=typeof Object.is=="function"?Object.is:Vy;function gs(e,t){if(Hn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var o=n[l];if(!Gt.call(t,o)||!Hn(e[o],t[o]))return!1}return!0}function cf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uf(e,t){var n=cf(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cf(n)}}function df(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?df(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ff(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ee(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ee(e.document)}return t}function nc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Xy=Mn&&"documentMode"in document&&11>=document.documentMode,xl=null,ic=null,bs=null,ac=!1;function hf(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ac||xl==null||xl!==ee(l)||(l=xl,"selectionStart"in l&&nc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),bs&&gs(bs,l)||(bs=l,l=co(ic,"onSelect"),0<l.length&&(t=new ke("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=xl)))}function Ya(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wl={animationend:Ya("Animation","AnimationEnd"),animationiteration:Ya("Animation","AnimationIteration"),animationstart:Ya("Animation","AnimationStart"),transitionrun:Ya("Transition","TransitionRun"),transitionstart:Ya("Transition","TransitionStart"),transitioncancel:Ya("Transition","TransitionCancel"),transitionend:Ya("Transition","TransitionEnd")},lc={},mf={};Mn&&(mf=document.createElement("div").style,"AnimationEvent"in window||(delete wl.animationend.animation,delete wl.animationiteration.animation,delete wl.animationstart.animation),"TransitionEvent"in window||delete wl.transitionend.transition);function $a(e){if(lc[e])return lc[e];if(!wl[e])return e;var t=wl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in mf)return lc[e]=t[n];return e}var pf=$a("animationend"),gf=$a("animationiteration"),bf=$a("animationstart"),Py=$a("transitionrun"),Zy=$a("transitionstart"),Qy=$a("transitioncancel"),yf=$a("transitionend"),vf=new Map,sc="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(" ");sc.push("scrollEnd");function fi(e,t){vf.set(e,t),Xn(t,[e])}var Sr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Zn=[],Sl=0,rc=0;function Cr(){for(var e=Sl,t=rc=Sl=0;t<e;){var n=Zn[t];Zn[t++]=null;var l=Zn[t];Zn[t++]=null;var o=Zn[t];Zn[t++]=null;var u=Zn[t];if(Zn[t++]=null,l!==null&&o!==null){var g=l.pending;g===null?o.next=o:(o.next=g.next,g.next=o),l.pending=o}u!==0&&xf(n,o,u)}}function Tr(e,t,n,l){Zn[Sl++]=e,Zn[Sl++]=t,Zn[Sl++]=n,Zn[Sl++]=l,rc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function oc(e,t,n,l){return Tr(e,t,n,l),Mr(e)}function qa(e,t){return Tr(e,null,null,t),Mr(e)}function xf(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var o=!1,u=e.return;u!==null;)u.childLanes|=n,l=u.alternate,l!==null&&(l.childLanes|=n),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-ft(n),e=u.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=n|536870912),u):null}function Mr(e){if(50<Us)throw Us=0,bu=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Cl={};function Wy(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,t,n,l){return new Wy(e,t,n,l)}function cc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bi(e,t){var n=e.alternate;return n===null?(n=Un(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function wf(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ar(e,t,n,l,o,u){var g=0;if(l=e,typeof e=="function")cc(e)&&(g=1);else if(typeof e=="string")g=iv(e,n,Ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case me:return e=Un(31,n,t,o),e.elementType=me,e.lanes=u,e;case q:return Va(n.children,o,u,t);case R:g=8,o|=24;break;case D:return e=Un(12,n,t,o|2),e.elementType=D,e.lanes=u,e;case fe:return e=Un(13,n,t,o),e.elementType=fe,e.lanes=u,e;case te:return e=Un(19,n,t,o),e.elementType=te,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case G:g=10;break e;case B:g=9;break e;case le:g=11;break e;case F:g=14;break e;case I:g=16,l=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=Un(g,n,t,o),t.elementType=e,t.type=l,t.lanes=u,t}function Va(e,t,n,l){return e=Un(7,e,l,t),e.lanes=n,e}function uc(e,t,n){return e=Un(6,e,null,t),e.lanes=n,e}function Sf(e){var t=Un(18,null,null,0);return t.stateNode=e,t}function dc(e,t,n){return t=Un(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Cf=new WeakMap;function Qn(e,t){if(typeof e=="object"&&e!==null){var n=Cf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:dn(t)},Cf.set(e,t),t)}return{value:e,source:t,stack:dn(t)}}var Tl=[],Ml=0,Er=null,ys=0,Wn=[],Jn=0,ua=null,Mi=1,Ai="";function Hi(e,t){Tl[Ml++]=ys,Tl[Ml++]=Er,Er=e,ys=t}function Tf(e,t,n){Wn[Jn++]=Mi,Wn[Jn++]=Ai,Wn[Jn++]=ua,ua=e;var l=Mi;e=Ai;var o=32-ft(l)-1;l&=~(1<<o),n+=1;var u=32-ft(t)+o;if(30<u){var g=o-o%5;u=(l&(1<<g)-1).toString(32),l>>=g,o-=g,Mi=1<<32-ft(t)+o|n<<o|l,Ai=u+e}else Mi=1<<u|n<<o|l,Ai=e}function fc(e){e.return!==null&&(Hi(e,1),Tf(e,1,0))}function hc(e){for(;e===Er;)Er=Tl[--Ml],Tl[Ml]=null,ys=Tl[--Ml],Tl[Ml]=null;for(;e===ua;)ua=Wn[--Jn],Wn[Jn]=null,Ai=Wn[--Jn],Wn[Jn]=null,Mi=Wn[--Jn],Wn[Jn]=null}function Mf(e,t){Wn[Jn++]=Mi,Wn[Jn++]=Ai,Wn[Jn++]=ua,Mi=t.id,Ai=t.overflow,ua=e}var rn=null,Mt=null,et=!1,da=null,ei=!1,mc=Error(r(519));function fa(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vs(Qn(t,e)),mc}function Af(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[jt]=e,t[Zt]=l,n){case"dialog":Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":case"embed":Qe("load",t);break;case"video":case"audio":for(n=0;n<Fs.length;n++)Qe(Fs[n],t);break;case"source":Qe("error",t);break;case"img":case"image":case"link":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"input":Qe("invalid",t),nt(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Qe("invalid",t);break;case"textarea":Qe("invalid",t),Ia(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||Gm(t.textContent,n)?(l.popover!=null&&(Qe("beforetoggle",t),Qe("toggle",t)),l.onScroll!=null&&Qe("scroll",t),l.onScrollEnd!=null&&Qe("scrollend",t),l.onClick!=null&&(t.onclick=ci),t=!0):t=!1,t||fa(e,!0)}function Ef(e){for(rn=e.return;rn;)switch(rn.tag){case 5:case 31:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:rn=rn.return}}function Al(e){if(e!==rn)return!1;if(!et)return Ef(e),et=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||_u(e.type,e.memoizedProps)),n=!n),n&&Mt&&fa(e),Ef(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=Wm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Mt=Wm(e)}else t===27?(t=Mt,Aa(e.type)?(e=Bu,Bu=null,Mt=e):Mt=t):Mt=rn?ni(e.stateNode.nextSibling):null;return!0}function Xa(){Mt=rn=null,et=!1}function pc(){var e=da;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),da=null),e}function vs(e){da===null?da=[e]:da.push(e)}var gc=De(null),Pa=null,Ui=null;function ha(e,t,n){ye(gc,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=gc.current,Re(gc)}function bc(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function yc(e,t,n,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var g=o.child;u=u.firstContext;e:for(;u!==null;){var x=u;u=o;for(var T=0;T<t.length;T++)if(x.context===t[T]){u.lanes|=n,x=u.alternate,x!==null&&(x.lanes|=n),bc(u.return,n,e),l||(g=null);break e}u=x.next}}else if(o.tag===18){if(g=o.return,g===null)throw Error(r(341));g.lanes|=n,u=g.alternate,u!==null&&(u.lanes|=n),bc(g,n,e),g=null}else g=o.child;if(g!==null)g.return=o;else for(g=o;g!==null;){if(g===e){g=null;break}if(o=g.sibling,o!==null){o.return=g.return,g=o;break}g=g.return}o=g}}function El(e,t,n,l){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var g=o.alternate;if(g===null)throw Error(r(387));if(g=g.memoizedProps,g!==null){var x=o.type;Hn(o.pendingProps.value,g.value)||(e!==null?e.push(x):e=[x])}}else if(o===gt.current){if(g=o.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(qs):e=[qs])}o=o.return}e!==null&&yc(t,e,n,l),t.flags|=262144}function Nr(e){for(e=e.firstContext;e!==null;){if(!Hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Za(e){Pa=e,Ui=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function on(e){return Nf(Pa,e)}function kr(e,t){return Pa===null&&Za(e),Nf(e,t)}function Nf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ui===null){if(e===null)throw Error(r(308));Ui=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ui=Ui.next=t;return n}var Jy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},e0=a.unstable_scheduleCallback,t0=a.unstable_NormalPriority,$t={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vc(){return{controller:new Jy,data:new Map,refCount:0}}function xs(e){e.refCount--,e.refCount===0&&e0(t0,function(){e.controller.abort()})}var ws=null,xc=0,Nl=0,kl=null;function n0(e,t){if(ws===null){var n=ws=[];xc=0,Nl=Cu(),kl={status:"pending",value:void 0,then:function(l){n.push(l)}}}return xc++,t.then(kf,kf),t}function kf(){if(--xc===0&&ws!==null){kl!==null&&(kl.status="fulfilled");var e=ws;ws=null,Nl=0,kl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function i0(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){for(l.status="rejected",l.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),l}var Rf=A.S;A.S=function(e,t){hm=ce(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&n0(e,t),Rf!==null&&Rf(e,t)};var Qa=De(null);function wc(){var e=Qa.current;return e!==null?e:yt.pooledCache}function Rr(e,t){t===null?ye(Qa,Qa.current):ye(Qa,t.pool)}function Lf(){var e=wc();return e===null?null:{parent:$t._currentValue,pool:e}}var Rl=Error(r(460)),Sc=Error(r(474)),Lr=Error(r(542)),_r={then:function(){}};function _f(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ci,ci),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Of(e),e;default:if(typeof t.status=="string")t.then(ci,ci);else{if(e=yt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=l}},function(l){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Of(e),e}throw Ja=t,Rl}}function Wa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ja=n,Rl):n}}var Ja=null;function Df(){if(Ja===null)throw Error(r(459));var e=Ja;return Ja=null,e}function Of(e){if(e===Rl||e===Lr)throw Error(r(483))}var Ll=null,Ss=0;function jr(e){var t=Ss;return Ss+=1,Ll===null&&(Ll=[]),jf(Ll,e,t)}function Cs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Dr(e,t){throw t.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function zf(e){function t(_,k){if(e){var H=_.deletions;H===null?(_.deletions=[k],_.flags|=16):H.push(k)}}function n(_,k){if(!e)return null;for(;k!==null;)t(_,k),k=k.sibling;return null}function l(_){for(var k=new Map;_!==null;)_.key!==null?k.set(_.key,_):k.set(_.index,_),_=_.sibling;return k}function o(_,k){return _=Bi(_,k),_.index=0,_.sibling=null,_}function u(_,k,H){return _.index=H,e?(H=_.alternate,H!==null?(H=H.index,H<k?(_.flags|=67108866,k):H):(_.flags|=67108866,k)):(_.flags|=1048576,k)}function g(_){return e&&_.alternate===null&&(_.flags|=67108866),_}function x(_,k,H,P){return k===null||k.tag!==6?(k=uc(H,_.mode,P),k.return=_,k):(k=o(k,H),k.return=_,k)}function T(_,k,H,P){var _e=H.type;return _e===q?X(_,k,H.props.children,P,H.key):k!==null&&(k.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===I&&Wa(_e)===k.type)?(k=o(k,H.props),Cs(k,H),k.return=_,k):(k=Ar(H.type,H.key,H.props,null,_.mode,P),Cs(k,H),k.return=_,k)}function U(_,k,H,P){return k===null||k.tag!==4||k.stateNode.containerInfo!==H.containerInfo||k.stateNode.implementation!==H.implementation?(k=dc(H,_.mode,P),k.return=_,k):(k=o(k,H.children||[]),k.return=_,k)}function X(_,k,H,P,_e){return k===null||k.tag!==7?(k=Va(H,_.mode,P,_e),k.return=_,k):(k=o(k,H),k.return=_,k)}function Q(_,k,H){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=uc(""+k,_.mode,H),k.return=_,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case M:return H=Ar(k.type,k.key,k.props,null,_.mode,H),Cs(H,k),H.return=_,H;case N:return k=dc(k,_.mode,H),k.return=_,k;case I:return k=Wa(k),Q(_,k,H)}if(we(k)||ie(k))return k=Va(k,_.mode,H,null),k.return=_,k;if(typeof k.then=="function")return Q(_,jr(k),H);if(k.$$typeof===G)return Q(_,kr(_,k),H);Dr(_,k)}return null}function K(_,k,H,P){var _e=k!==null?k.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return _e!==null?null:x(_,k,""+H,P);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case M:return H.key===_e?T(_,k,H,P):null;case N:return H.key===_e?U(_,k,H,P):null;case I:return H=Wa(H),K(_,k,H,P)}if(we(H)||ie(H))return _e!==null?null:X(_,k,H,P,null);if(typeof H.then=="function")return K(_,k,jr(H),P);if(H.$$typeof===G)return K(_,k,kr(_,H),P);Dr(_,H)}return null}function $(_,k,H,P,_e){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return _=_.get(H)||null,x(k,_,""+P,_e);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case M:return _=_.get(P.key===null?H:P.key)||null,T(k,_,P,_e);case N:return _=_.get(P.key===null?H:P.key)||null,U(k,_,P,_e);case I:return P=Wa(P),$(_,k,H,P,_e)}if(we(P)||ie(P))return _=_.get(H)||null,X(k,_,P,_e,null);if(typeof P.then=="function")return $(_,k,H,jr(P),_e);if(P.$$typeof===G)return $(_,k,H,kr(k,P),_e);Dr(k,P)}return null}function Te(_,k,H,P){for(var _e=null,it=null,Ee=k,qe=k=0,Je=null;Ee!==null&&qe<H.length;qe++){Ee.index>qe?(Je=Ee,Ee=null):Je=Ee.sibling;var at=K(_,Ee,H[qe],P);if(at===null){Ee===null&&(Ee=Je);break}e&&Ee&&at.alternate===null&&t(_,Ee),k=u(at,k,qe),it===null?_e=at:it.sibling=at,it=at,Ee=Je}if(qe===H.length)return n(_,Ee),et&&Hi(_,qe),_e;if(Ee===null){for(;qe<H.length;qe++)Ee=Q(_,H[qe],P),Ee!==null&&(k=u(Ee,k,qe),it===null?_e=Ee:it.sibling=Ee,it=Ee);return et&&Hi(_,qe),_e}for(Ee=l(Ee);qe<H.length;qe++)Je=$(Ee,_,qe,H[qe],P),Je!==null&&(e&&Je.alternate!==null&&Ee.delete(Je.key===null?qe:Je.key),k=u(Je,k,qe),it===null?_e=Je:it.sibling=Je,it=Je);return e&&Ee.forEach(function(La){return t(_,La)}),et&&Hi(_,qe),_e}function ze(_,k,H,P){if(H==null)throw Error(r(151));for(var _e=null,it=null,Ee=k,qe=k=0,Je=null,at=H.next();Ee!==null&&!at.done;qe++,at=H.next()){Ee.index>qe?(Je=Ee,Ee=null):Je=Ee.sibling;var La=K(_,Ee,at.value,P);if(La===null){Ee===null&&(Ee=Je);break}e&&Ee&&La.alternate===null&&t(_,Ee),k=u(La,k,qe),it===null?_e=La:it.sibling=La,it=La,Ee=Je}if(at.done)return n(_,Ee),et&&Hi(_,qe),_e;if(Ee===null){for(;!at.done;qe++,at=H.next())at=Q(_,at.value,P),at!==null&&(k=u(at,k,qe),it===null?_e=at:it.sibling=at,it=at);return et&&Hi(_,qe),_e}for(Ee=l(Ee);!at.done;qe++,at=H.next())at=$(Ee,_,qe,at.value,P),at!==null&&(e&&at.alternate!==null&&Ee.delete(at.key===null?qe:at.key),k=u(at,k,qe),it===null?_e=at:it.sibling=at,it=at);return e&&Ee.forEach(function(mv){return t(_,mv)}),et&&Hi(_,qe),_e}function pt(_,k,H,P){if(typeof H=="object"&&H!==null&&H.type===q&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case M:e:{for(var _e=H.key;k!==null;){if(k.key===_e){if(_e=H.type,_e===q){if(k.tag===7){n(_,k.sibling),P=o(k,H.props.children),P.return=_,_=P;break e}}else if(k.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===I&&Wa(_e)===k.type){n(_,k.sibling),P=o(k,H.props),Cs(P,H),P.return=_,_=P;break e}n(_,k);break}else t(_,k);k=k.sibling}H.type===q?(P=Va(H.props.children,_.mode,P,H.key),P.return=_,_=P):(P=Ar(H.type,H.key,H.props,null,_.mode,P),Cs(P,H),P.return=_,_=P)}return g(_);case N:e:{for(_e=H.key;k!==null;){if(k.key===_e)if(k.tag===4&&k.stateNode.containerInfo===H.containerInfo&&k.stateNode.implementation===H.implementation){n(_,k.sibling),P=o(k,H.children||[]),P.return=_,_=P;break e}else{n(_,k);break}else t(_,k);k=k.sibling}P=dc(H,_.mode,P),P.return=_,_=P}return g(_);case I:return H=Wa(H),pt(_,k,H,P)}if(we(H))return Te(_,k,H,P);if(ie(H)){if(_e=ie(H),typeof _e!="function")throw Error(r(150));return H=_e.call(H),ze(_,k,H,P)}if(typeof H.then=="function")return pt(_,k,jr(H),P);if(H.$$typeof===G)return pt(_,k,kr(_,H),P);Dr(_,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,k!==null&&k.tag===6?(n(_,k.sibling),P=o(k,H),P.return=_,_=P):(n(_,k),P=uc(H,_.mode,P),P.return=_,_=P),g(_)):n(_,k)}return function(_,k,H,P){try{Ss=0;var _e=pt(_,k,H,P);return Ll=null,_e}catch(Ee){if(Ee===Rl||Ee===Lr)throw Ee;var it=Un(29,Ee,null,_.mode);return it.lanes=P,it.return=_,it}finally{}}}var el=zf(!0),Bf=zf(!1),ma=!1;function Cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ga(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(st&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=Mr(e),xf(e,null,n),t}return Tr(e,l,t,n),Mr(e)}function Ts(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,na(e,n)}}function Mc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?o=u=g:u=u.next=g,n=n.next}while(n!==null);u===null?o=u=t:u=u.next=t}else o=u=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ac=!1;function Ms(){if(Ac){var e=kl;if(e!==null)throw e}}function As(e,t,n,l){Ac=!1;var o=e.updateQueue;ma=!1;var u=o.firstBaseUpdate,g=o.lastBaseUpdate,x=o.shared.pending;if(x!==null){o.shared.pending=null;var T=x,U=T.next;T.next=null,g===null?u=U:g.next=U,g=T;var X=e.alternate;X!==null&&(X=X.updateQueue,x=X.lastBaseUpdate,x!==g&&(x===null?X.firstBaseUpdate=U:x.next=U,X.lastBaseUpdate=T))}if(u!==null){var Q=o.baseState;g=0,X=U=T=null,x=u;do{var K=x.lane&-536870913,$=K!==x.lane;if($?(We&K)===K:(l&K)===K){K!==0&&K===Nl&&(Ac=!0),X!==null&&(X=X.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var Te=e,ze=x;K=t;var pt=n;switch(ze.tag){case 1:if(Te=ze.payload,typeof Te=="function"){Q=Te.call(pt,Q,K);break e}Q=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=ze.payload,K=typeof Te=="function"?Te.call(pt,Q,K):Te,K==null)break e;Q=v({},Q,K);break e;case 2:ma=!0}}K=x.callback,K!==null&&(e.flags|=64,$&&(e.flags|=8192),$=o.callbacks,$===null?o.callbacks=[K]:$.push(K))}else $={lane:K,tag:x.tag,payload:x.payload,callback:x.callback,next:null},X===null?(U=X=$,T=Q):X=X.next=$,g|=K;if(x=x.next,x===null){if(x=o.shared.pending,x===null)break;$=x,x=$.next,$.next=null,o.lastBaseUpdate=$,o.shared.pending=null}}while(!0);X===null&&(T=Q),o.baseState=T,o.firstBaseUpdate=U,o.lastBaseUpdate=X,u===null&&(o.shared.lanes=0),wa|=g,e.lanes=g,e.memoizedState=Q}}function Hf(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Uf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Hf(n[e],t)}var _l=De(null),Or=De(0);function Kf(e,t){e=Pi,ye(Or,e),ye(_l,t),Pi=e|t.baseLanes}function Ec(){ye(Or,Pi),ye(_l,_l.current)}function Nc(){Pi=Or.current,Re(_l),Re(Or)}var Kn=De(null),ti=null;function ba(e){var t=e.alternate;ye(Ft,Ft.current&1),ye(Kn,e),ti===null&&(t===null||_l.current!==null||t.memoizedState!==null)&&(ti=e)}function kc(e){ye(Ft,Ft.current),ye(Kn,e),ti===null&&(ti=e)}function Ff(e){e.tag===22?(ye(Ft,Ft.current),ye(Kn,e),ti===null&&(ti=e)):ya()}function ya(){ye(Ft,Ft.current),ye(Kn,Kn.current)}function Fn(e){Re(Kn),ti===e&&(ti=null),Re(Ft)}var Ft=De(0);function zr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ou(n)||zu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Fi=0,Ge=null,ht=null,qt=null,Br=!1,jl=!1,tl=!1,Hr=0,Es=0,Dl=null,a0=0;function Bt(){throw Error(r(321))}function Rc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Hn(e[n],t[n]))return!1;return!0}function Lc(e,t,n,l,o,u){return Fi=u,Ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Th:qc,tl=!1,u=n(l,o),tl=!1,jl&&(u=Gf(t,n,l,o)),If(e),u}function If(e){A.H=Rs;var t=ht!==null&&ht.next!==null;if(Fi=0,qt=ht=Ge=null,Br=!1,Es=0,Dl=null,t)throw Error(r(300));e===null||Vt||(e=e.dependencies,e!==null&&Nr(e)&&(Vt=!0))}function Gf(e,t,n,l){Ge=e;var o=0;do{if(jl&&(Dl=null),Es=0,jl=!1,25<=o)throw Error(r(301));if(o+=1,qt=ht=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}A.H=Mh,u=t(n,l)}while(jl);return u}function l0(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Ns(t):t,e=e.useState()[0],(ht!==null?ht.memoizedState:null)!==e&&(Ge.flags|=1024),t}function _c(){var e=Hr!==0;return Hr=0,e}function jc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Dc(e){if(Br){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Br=!1}Fi=0,qt=ht=Ge=null,jl=!1,Es=Hr=0,Dl=null}function xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?Ge.memoizedState=qt=e:qt=qt.next=e,qt}function It(){if(ht===null){var e=Ge.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=qt===null?Ge.memoizedState:qt.next;if(t!==null)qt=t,ht=e;else{if(e===null)throw Ge.alternate===null?Error(r(467)):Error(r(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},qt===null?Ge.memoizedState=qt=e:qt=qt.next=e}return qt}function Ur(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ns(e){var t=Es;return Es+=1,Dl===null&&(Dl=[]),e=jf(Dl,e,t),t=Ge,(qt===null?t.memoizedState:qt.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Th:qc),e}function Kr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ns(e);if(e.$$typeof===G)return on(e)}throw Error(r(438,String(e)))}function Oc(e){var t=null,n=Ge.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Ge.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Ur(),Ge.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=be;return t.index++,n}function Ii(e,t){return typeof t=="function"?t(e):t}function Fr(e){var t=It();return zc(t,ht,e)}function zc(e,t,n){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=e.baseQueue,u=l.pending;if(u!==null){if(o!==null){var g=o.next;o.next=u.next,u.next=g}t.baseQueue=o=u,l.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var x=g=null,T=null,U=t,X=!1;do{var Q=U.lane&-536870913;if(Q!==U.lane?(We&Q)===Q:(Fi&Q)===Q){var K=U.revertLane;if(K===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),Q===Nl&&(X=!0);else if((Fi&K)===K){U=U.next,K===Nl&&(X=!0);continue}else Q={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},T===null?(x=T=Q,g=u):T=T.next=Q,Ge.lanes|=K,wa|=K;Q=U.action,tl&&n(u,Q),u=U.hasEagerState?U.eagerState:n(u,Q)}else K={lane:Q,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},T===null?(x=T=K,g=u):T=T.next=K,Ge.lanes|=Q,wa|=Q;U=U.next}while(U!==null&&U!==t);if(T===null?g=u:T.next=x,!Hn(u,e.memoizedState)&&(Vt=!0,X&&(n=kl,n!==null)))throw n;e.memoizedState=u,e.baseState=g,e.baseQueue=T,l.lastRenderedState=u}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Bc(e){var t=It(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,u=t.memoizedState;if(o!==null){n.pending=null;var g=o=o.next;do u=e(u,g.action),g=g.next;while(g!==o);Hn(u,t.memoizedState)||(Vt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,l]}function Yf(e,t,n){var l=Ge,o=It(),u=et;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!Hn((ht||o).memoizedState,n);if(g&&(o.memoizedState=n,Vt=!0),o=o.queue,Kc(Vf.bind(null,l,o,e),[e]),o.getSnapshot!==t||g||qt!==null&&qt.memoizedState.tag&1){if(l.flags|=2048,Ol(9,{destroy:void 0},qf.bind(null,l,o,n,t),null),yt===null)throw Error(r(349));u||(Fi&127)!==0||$f(l,t,n)}return n}function $f(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ge.updateQueue,t===null?(t=Ur(),Ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qf(e,t,n,l){t.value=n,t.getSnapshot=l,Xf(t)&&Pf(e)}function Vf(e,t,n){return n(function(){Xf(t)&&Pf(e)})}function Xf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Hn(e,n)}catch{return!0}}function Pf(e){var t=qa(e,2);t!==null&&Ln(t,e,2)}function Hc(e){var t=xn();if(typeof e=="function"){var n=e;if(e=n(),tl){Lt(!0);try{n()}finally{Lt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ii,lastRenderedState:e},t}function Zf(e,t,n,l){return e.baseState=n,zc(e,ht,typeof l=="function"?l:Ii)}function s0(e,t,n,l,o){if(Yr(e))throw Error(r(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){u.listeners.push(g)}};A.T!==null?n(!0):u.isTransition=!1,l(u),n=t.pending,n===null?(u.next=t.pending=u,Qf(t,u)):(u.next=n.next,t.pending=n.next=u)}}function Qf(e,t){var n=t.action,l=t.payload,o=e.state;if(t.isTransition){var u=A.T,g={};A.T=g;try{var x=n(o,l),T=A.S;T!==null&&T(g,x),Wf(e,t,x)}catch(U){Uc(e,t,U)}finally{u!==null&&g.types!==null&&(u.types=g.types),A.T=u}}else try{u=n(o,l),Wf(e,t,u)}catch(U){Uc(e,t,U)}}function Wf(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Jf(e,t,l)},function(l){return Uc(e,t,l)}):Jf(e,t,n)}function Jf(e,t,n){t.status="fulfilled",t.value=n,eh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qf(e,n)))}function Uc(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,eh(t),t=t.next;while(t!==l)}e.action=null}function eh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function th(e,t){return t}function nh(e,t){if(et){var n=yt.formState;if(n!==null){e:{var l=Ge;if(et){if(Mt){t:{for(var o=Mt,u=ei;o.nodeType!==8;){if(!u){o=null;break t}if(o=ni(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Mt=ni(o.nextSibling),l=o.data==="F!";break e}}fa(l)}l=!1}l&&(t=n[0])}}return n=xn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:th,lastRenderedState:t},n.queue=l,n=wh.bind(null,Ge,l),l.dispatch=n,l=Hc(!1),u=$c.bind(null,Ge,!1,l.queue),l=xn(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,n=s0.bind(null,Ge,o,u,n),o.dispatch=n,l.memoizedState=e,[t,n,!1]}function ih(e){var t=It();return ah(t,ht,e)}function ah(e,t,n){if(t=zc(e,t,th)[0],e=Fr(Ii)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Ns(t)}catch(g){throw g===Rl?Lr:g}else l=t;t=It();var o=t.queue,u=o.dispatch;return n!==t.memoizedState&&(Ge.flags|=2048,Ol(9,{destroy:void 0},r0.bind(null,o,n),null)),[l,u,e]}function r0(e,t){e.action=t}function lh(e){var t=It(),n=ht;if(n!==null)return ah(t,n,e);It(),t=t.memoizedState,n=It();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Ol(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Ge.updateQueue,t===null&&(t=Ur(),Ge.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function sh(){return It().memoizedState}function Ir(e,t,n,l){var o=xn();Ge.flags|=e,o.memoizedState=Ol(1|t,{destroy:void 0},n,l===void 0?null:l)}function Gr(e,t,n,l){var o=It();l=l===void 0?null:l;var u=o.memoizedState.inst;ht!==null&&l!==null&&Rc(l,ht.memoizedState.deps)?o.memoizedState=Ol(t,u,n,l):(Ge.flags|=e,o.memoizedState=Ol(1|t,u,n,l))}function rh(e,t){Ir(8390656,8,e,t)}function Kc(e,t){Gr(2048,8,e,t)}function o0(e){Ge.flags|=4;var t=Ge.updateQueue;if(t===null)t=Ur(),Ge.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function oh(e){var t=It().memoizedState;return o0({ref:t,nextImpl:e}),function(){if((st&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function ch(e,t){return Gr(4,2,e,t)}function uh(e,t){return Gr(4,4,e,t)}function dh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fh(e,t,n){n=n!=null?n.concat([e]):null,Gr(4,4,dh.bind(null,t,e),n)}function Fc(){}function hh(e,t){var n=It();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&Rc(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function mh(e,t){var n=It();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&Rc(t,l[1]))return l[0];if(l=e(),tl){Lt(!0);try{e()}finally{Lt(!1)}}return n.memoizedState=[l,t],l}function Ic(e,t,n){return n===void 0||(Fi&1073741824)!==0&&(We&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=pm(),Ge.lanes|=e,wa|=e,n)}function ph(e,t,n,l){return Hn(n,t)?n:_l.current!==null?(e=Ic(e,n,l),Hn(e,t)||(Vt=!0),e):(Fi&42)===0||(Fi&1073741824)!==0&&(We&261930)===0?(Vt=!0,e.memoizedState=n):(e=pm(),Ge.lanes|=e,wa|=e,t)}function gh(e,t,n,l,o){var u=j.p;j.p=u!==0&&8>u?u:8;var g=A.T,x={};A.T=x,$c(e,!1,t,n);try{var T=o(),U=A.S;if(U!==null&&U(x,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var X=i0(T,l);ks(e,t,X,Yn(e))}else ks(e,t,l,Yn(e))}catch(Q){ks(e,t,{then:function(){},status:"rejected",reason:Q},Yn())}finally{j.p=u,g!==null&&x.types!==null&&(g.types=x.types),A.T=g}}function c0(){}function Gc(e,t,n,l){if(e.tag!==5)throw Error(r(476));var o=bh(e).queue;gh(e,o,t,J,n===null?c0:function(){return yh(e),n(l)})}function bh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ii,lastRenderedState:J},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ii,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function yh(e){var t=bh(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},Yn())}function Yc(){return on(qs)}function vh(){return It().memoizedState}function xh(){return It().memoizedState}function u0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yn();e=pa(n);var l=ga(t,e,n);l!==null&&(Ln(l,t,n),Ts(l,t,n)),t={cache:vc()},e.payload=t;return}t=t.return}}function d0(e,t,n){var l=Yn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Yr(e)?Sh(t,n):(n=oc(e,t,n,l),n!==null&&(Ln(n,e,l),Ch(n,t,l)))}function wh(e,t,n){var l=Yn();ks(e,t,n,l)}function ks(e,t,n,l){var o={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Yr(e))Sh(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var g=t.lastRenderedState,x=u(g,n);if(o.hasEagerState=!0,o.eagerState=x,Hn(x,g))return Tr(e,t,o,0),yt===null&&Cr(),!1}catch{}finally{}if(n=oc(e,t,o,l),n!==null)return Ln(n,e,l),Ch(n,t,l),!0}return!1}function $c(e,t,n,l){if(l={lane:2,revertLane:Cu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yr(e)){if(t)throw Error(r(479))}else t=oc(e,n,l,2),t!==null&&Ln(t,e,2)}function Yr(e){var t=e.alternate;return e===Ge||t!==null&&t===Ge}function Sh(e,t){jl=Br=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ch(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,na(e,n)}}var Rs={readContext:on,use:Kr,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};Rs.useEffectEvent=Bt;var Th={readContext:on,use:Kr,useCallback:function(e,t){return xn().memoizedState=[e,t===void 0?null:t],e},useContext:on,useEffect:rh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ir(4194308,4,dh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ir(4194308,4,e,t)},useInsertionEffect:function(e,t){Ir(4,2,e,t)},useMemo:function(e,t){var n=xn();t=t===void 0?null:t;var l=e();if(tl){Lt(!0);try{e()}finally{Lt(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=xn();if(n!==void 0){var o=n(t);if(tl){Lt(!0);try{n(t)}finally{Lt(!1)}}}else o=t;return l.memoizedState=l.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},l.queue=e,e=e.dispatch=d0.bind(null,Ge,e),[l.memoizedState,e]},useRef:function(e){var t=xn();return e={current:e},t.memoizedState=e},useState:function(e){e=Hc(e);var t=e.queue,n=wh.bind(null,Ge,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Fc,useDeferredValue:function(e,t){var n=xn();return Ic(n,e,t)},useTransition:function(){var e=Hc(!1);return e=gh.bind(null,Ge,e.queue,!0,!1),xn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Ge,o=xn();if(et){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),yt===null)throw Error(r(349));(We&127)!==0||$f(l,t,n)}o.memoizedState=n;var u={value:n,getSnapshot:t};return o.queue=u,rh(Vf.bind(null,l,u,e),[e]),l.flags|=2048,Ol(9,{destroy:void 0},qf.bind(null,l,u,n,t),null),n},useId:function(){var e=xn(),t=yt.identifierPrefix;if(et){var n=Ai,l=Mi;n=(l&~(1<<32-ft(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Hr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=a0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Yc,useFormState:nh,useActionState:nh,useOptimistic:function(e){var t=xn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=$c.bind(null,Ge,!0,n),n.dispatch=t,[e,t]},useMemoCache:Oc,useCacheRefresh:function(){return xn().memoizedState=u0.bind(null,Ge)},useEffectEvent:function(e){var t=xn(),n={impl:e};return t.memoizedState=n,function(){if((st&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},qc={readContext:on,use:Kr,useCallback:hh,useContext:on,useEffect:Kc,useImperativeHandle:fh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:mh,useReducer:Fr,useRef:sh,useState:function(){return Fr(Ii)},useDebugValue:Fc,useDeferredValue:function(e,t){var n=It();return ph(n,ht.memoizedState,e,t)},useTransition:function(){var e=Fr(Ii)[0],t=It().memoizedState;return[typeof e=="boolean"?e:Ns(e),t]},useSyncExternalStore:Yf,useId:vh,useHostTransitionStatus:Yc,useFormState:ih,useActionState:ih,useOptimistic:function(e,t){var n=It();return Zf(n,ht,e,t)},useMemoCache:Oc,useCacheRefresh:xh};qc.useEffectEvent=oh;var Mh={readContext:on,use:Kr,useCallback:hh,useContext:on,useEffect:Kc,useImperativeHandle:fh,useInsertionEffect:ch,useLayoutEffect:uh,useMemo:mh,useReducer:Bc,useRef:sh,useState:function(){return Bc(Ii)},useDebugValue:Fc,useDeferredValue:function(e,t){var n=It();return ht===null?Ic(n,e,t):ph(n,ht.memoizedState,e,t)},useTransition:function(){var e=Bc(Ii)[0],t=It().memoizedState;return[typeof e=="boolean"?e:Ns(e),t]},useSyncExternalStore:Yf,useId:vh,useHostTransitionStatus:Yc,useFormState:lh,useActionState:lh,useOptimistic:function(e,t){var n=It();return ht!==null?Zf(n,ht,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Oc,useCacheRefresh:xh};Mh.useEffectEvent=oh;function Vc(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Yn(),o=pa(l);o.payload=t,n!=null&&(o.callback=n),t=ga(e,o,l),t!==null&&(Ln(t,e,l),Ts(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Yn(),o=pa(l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=ga(e,o,l),t!==null&&(Ln(t,e,l),Ts(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yn(),l=pa(n);l.tag=2,t!=null&&(l.callback=t),t=ga(e,l,n),t!==null&&(Ln(t,e,n),Ts(t,e,n))}};function Ah(e,t,n,l,o,u,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,g):t.prototype&&t.prototype.isPureReactComponent?!gs(n,l)||!gs(o,u):!0}function Eh(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&Xc.enqueueReplaceState(t,t.state,null)}function nl(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function Nh(e){Sr(e)}function kh(e){console.error(e)}function Rh(e){Sr(e)}function $r(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Lh(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Pc(e,t,n){return n=pa(n),n.tag=3,n.payload={element:null},n.callback=function(){$r(e,t)},n}function _h(e){return e=pa(e),e.tag=3,e}function jh(e,t,n,l){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var u=l.value;e.payload=function(){return o(u)},e.callback=function(){Lh(t,n,l)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){Lh(t,n,l),typeof o!="function"&&(Sa===null?Sa=new Set([this]):Sa.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function f0(e,t,n,l,o){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&El(t,n,o,!0),n=Kn.current,n!==null){switch(n.tag){case 31:case 13:return ti===null?io():n.alternate===null&&Ht===0&&(Ht=3),n.flags&=-257,n.flags|=65536,n.lanes=o,l===_r?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),xu(e,l,o)),!1;case 22:return n.flags|=65536,l===_r?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),xu(e,l,o)),!1}throw Error(r(435,n.tag))}return xu(e,l,o),io(),!1}if(et)return t=Kn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==mc&&(e=Error(r(422),{cause:l}),vs(Qn(e,n)))):(l!==mc&&(t=Error(r(423),{cause:l}),vs(Qn(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=Qn(l,n),o=Pc(e.stateNode,l,o),Mc(e,o),Ht!==4&&(Ht=2)),!1;var u=Error(r(520),{cause:l});if(u=Qn(u,n),Hs===null?Hs=[u]:Hs.push(u),Ht!==4&&(Ht=2),t===null)return!0;l=Qn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=Pc(n.stateNode,l,e),Mc(n,e),!1;case 1:if(t=n.type,u=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Sa===null||!Sa.has(u))))return n.flags|=65536,o&=-o,n.lanes|=o,o=_h(o),jh(o,e,n,l),Mc(n,o),!1}n=n.return}while(n!==null);return!1}var Zc=Error(r(461)),Vt=!1;function cn(e,t,n,l){t.child=e===null?Bf(t,null,n,l):el(t,e.child,n,l)}function Dh(e,t,n,l,o){n=n.render;var u=t.ref;if("ref"in l){var g={};for(var x in l)x!=="ref"&&(g[x]=l[x])}else g=l;return Za(t),l=Lc(e,t,n,g,u,o),x=_c(),e!==null&&!Vt?(jc(e,t,o),Gi(e,t,o)):(et&&x&&fc(t),t.flags|=1,cn(e,t,l,o),t.child)}function Oh(e,t,n,l,o){if(e===null){var u=n.type;return typeof u=="function"&&!cc(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,zh(e,t,u,l,o)):(e=Ar(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!au(e,o)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:gs,n(g,l)&&e.ref===t.ref)return Gi(e,t,o)}return t.flags|=1,e=Bi(u,l),e.ref=t.ref,e.return=t,t.child=e}function zh(e,t,n,l,o){if(e!==null){var u=e.memoizedProps;if(gs(u,l)&&e.ref===t.ref)if(Vt=!1,t.pendingProps=l=u,au(e,o))(e.flags&131072)!==0&&(Vt=!0);else return t.lanes=e.lanes,Gi(e,t,o)}return Qc(e,t,n,l,o)}function Bh(e,t,n,l){var o=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|n:n,e!==null){for(l=t.child=e.child,o=0;l!==null;)o=o|l.lanes|l.childLanes,l=l.sibling;l=o&~u}else l=0,t.child=null;return Hh(e,t,u,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Rr(t,u!==null?u.cachePool:null),u!==null?Kf(t,u):Ec(),Ff(t);else return l=t.lanes=536870912,Hh(e,t,u!==null?u.baseLanes|n:n,n,l)}else u!==null?(Rr(t,u.cachePool),Kf(t,u),ya(),t.memoizedState=null):(e!==null&&Rr(t,null),Ec(),ya());return cn(e,t,o,n),t.child}function Ls(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hh(e,t,n,l,o){var u=wc();return u=u===null?null:{parent:$t._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&Rr(t,null),Ec(),Ff(t),e!==null&&El(e,t,l,!0),t.childLanes=o,null}function qr(e,t){return t=Xr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Uh(e,t,n){return el(t,e.child,null,n),e=qr(t,t.pendingProps),e.flags|=2,Fn(t),t.memoizedState=null,e}function h0(e,t,n){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(et){if(l.mode==="hidden")return e=qr(t,l),t.lanes=536870912,Ls(null,e);if(kc(t),(e=Mt)?(e=Qm(e,ei),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ua!==null?{id:Mi,overflow:Ai}:null,retryLane:536870912,hydrationErrors:null},n=Sf(e),n.return=t,t.child=n,rn=t,Mt=null)):e=null,e===null)throw fa(t);return t.lanes=536870912,null}return qr(t,l)}var u=e.memoizedState;if(u!==null){var g=u.dehydrated;if(kc(t),o)if(t.flags&256)t.flags&=-257,t=Uh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Vt||El(e,t,n,!1),o=(n&e.childLanes)!==0,Vt||o){if(l=yt,l!==null&&(g=jn(l,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,qa(e,g),Ln(l,e,g),Zc;io(),t=Uh(e,t,n)}else e=u.treeContext,Mt=ni(g.nextSibling),rn=t,et=!0,da=null,ei=!1,e!==null&&Mf(t,e),t=qr(t,l),t.flags|=4096;return t}return e=Bi(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Qc(e,t,n,l,o){return Za(t),n=Lc(e,t,n,l,void 0,o),l=_c(),e!==null&&!Vt?(jc(e,t,o),Gi(e,t,o)):(et&&l&&fc(t),t.flags|=1,cn(e,t,n,o),t.child)}function Kh(e,t,n,l,o,u){return Za(t),t.updateQueue=null,n=Gf(t,l,n,o),If(e),l=_c(),e!==null&&!Vt?(jc(e,t,u),Gi(e,t,u)):(et&&l&&fc(t),t.flags|=1,cn(e,t,n,u),t.child)}function Fh(e,t,n,l,o){if(Za(t),t.stateNode===null){var u=Cl,g=n.contextType;typeof g=="object"&&g!==null&&(u=on(g)),u=new n(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Xc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Cc(t),g=n.contextType,u.context=typeof g=="object"&&g!==null?on(g):Cl,u.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(Vc(t,n,g,l),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(g=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),g!==u.state&&Xc.enqueueReplaceState(u,u.state,null),As(t,l,u,o),Ms(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var x=t.memoizedProps,T=nl(n,x);u.props=T;var U=u.context,X=n.contextType;g=Cl,typeof X=="object"&&X!==null&&(g=on(X));var Q=n.getDerivedStateFromProps;X=typeof Q=="function"||typeof u.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,X||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(x||U!==g)&&Eh(t,u,l,g),ma=!1;var K=t.memoizedState;u.state=K,As(t,l,u,o),Ms(),U=t.memoizedState,x||K!==U||ma?(typeof Q=="function"&&(Vc(t,n,Q,l),U=t.memoizedState),(T=ma||Ah(t,n,T,l,K,U,g))?(X||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=U),u.props=l,u.state=U,u.context=g,l=T):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Tc(e,t),g=t.memoizedProps,X=nl(n,g),u.props=X,Q=t.pendingProps,K=u.context,U=n.contextType,T=Cl,typeof U=="object"&&U!==null&&(T=on(U)),x=n.getDerivedStateFromProps,(U=typeof x=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==Q||K!==T)&&Eh(t,u,l,T),ma=!1,K=t.memoizedState,u.state=K,As(t,l,u,o),Ms();var $=t.memoizedState;g!==Q||K!==$||ma||e!==null&&e.dependencies!==null&&Nr(e.dependencies)?(typeof x=="function"&&(Vc(t,n,x,l),$=t.memoizedState),(X=ma||Ah(t,n,X,l,K,$,T)||e!==null&&e.dependencies!==null&&Nr(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,$,T),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,$,T)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&K===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&K===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=$),u.props=l,u.state=$,u.context=T,l=X):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&K===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&K===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Vr(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=el(t,e.child,null,o),t.child=el(t,null,n,o)):cn(e,t,n,o),t.memoizedState=u.state,e=t.child):e=Gi(e,t,o),e}function Ih(e,t,n,l){return Xa(),t.flags|=256,cn(e,t,n,l),t.child}var Wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jc(e){return{baseLanes:e,cachePool:Lf()}}function eu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Gn),e}function Gh(e,t,n){var l=t.pendingProps,o=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(Ft.current&2)!==0),g&&(o=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(et){if(o?ba(t):ya(),(e=Mt)?(e=Qm(e,ei),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ua!==null?{id:Mi,overflow:Ai}:null,retryLane:536870912,hydrationErrors:null},n=Sf(e),n.return=t,t.child=n,rn=t,Mt=null)):e=null,e===null)throw fa(t);return zu(e)?t.lanes=32:t.lanes=536870912,null}var x=l.children;return l=l.fallback,o?(ya(),o=t.mode,x=Xr({mode:"hidden",children:x},o),l=Va(l,o,n,null),x.return=t,l.return=t,x.sibling=l,t.child=x,l=t.child,l.memoizedState=Jc(n),l.childLanes=eu(e,g,n),t.memoizedState=Wc,Ls(null,l)):(ba(t),tu(t,x))}var T=e.memoizedState;if(T!==null&&(x=T.dehydrated,x!==null)){if(u)t.flags&256?(ba(t),t.flags&=-257,t=nu(e,t,n)):t.memoizedState!==null?(ya(),t.child=e.child,t.flags|=128,t=null):(ya(),x=l.fallback,o=t.mode,l=Xr({mode:"visible",children:l.children},o),x=Va(x,o,n,null),x.flags|=2,l.return=t,x.return=t,l.sibling=x,t.child=l,el(t,e.child,null,n),l=t.child,l.memoizedState=Jc(n),l.childLanes=eu(e,g,n),t.memoizedState=Wc,t=Ls(null,l));else if(ba(t),zu(x)){if(g=x.nextSibling&&x.nextSibling.dataset,g)var U=g.dgst;g=U,l=Error(r(419)),l.stack="",l.digest=g,vs({value:l,source:null,stack:null}),t=nu(e,t,n)}else if(Vt||El(e,t,n,!1),g=(n&e.childLanes)!==0,Vt||g){if(g=yt,g!==null&&(l=jn(g,n),l!==0&&l!==T.retryLane))throw T.retryLane=l,qa(e,l),Ln(g,e,l),Zc;Ou(x)||io(),t=nu(e,t,n)}else Ou(x)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,Mt=ni(x.nextSibling),rn=t,et=!0,da=null,ei=!1,e!==null&&Mf(t,e),t=tu(t,l.children),t.flags|=4096);return t}return o?(ya(),x=l.fallback,o=t.mode,T=e.child,U=T.sibling,l=Bi(T,{mode:"hidden",children:l.children}),l.subtreeFlags=T.subtreeFlags&65011712,U!==null?x=Bi(U,x):(x=Va(x,o,n,null),x.flags|=2),x.return=t,l.return=t,l.sibling=x,t.child=l,Ls(null,l),l=t.child,x=e.child.memoizedState,x===null?x=Jc(n):(o=x.cachePool,o!==null?(T=$t._currentValue,o=o.parent!==T?{parent:T,pool:T}:o):o=Lf(),x={baseLanes:x.baseLanes|n,cachePool:o}),l.memoizedState=x,l.childLanes=eu(e,g,n),t.memoizedState=Wc,Ls(e.child,l)):(ba(t),n=e.child,e=n.sibling,n=Bi(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function tu(e,t){return t=Xr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Xr(e,t){return e=Un(22,e,null,t),e.lanes=0,e}function nu(e,t,n){return el(t,e.child,null,n),e=tu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yh(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),bc(e.return,t,n)}function iu(e,t,n,l,o,u){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o,treeForkCount:u}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=n,g.tailMode=o,g.treeForkCount=u)}function $h(e,t,n){var l=t.pendingProps,o=l.revealOrder,u=l.tail;l=l.children;var g=Ft.current,x=(g&2)!==0;if(x?(g=g&1|2,t.flags|=128):g&=1,ye(Ft,g),cn(e,t,l,n),l=et?ys:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Yh(e,n,t);else if(e.tag===19)Yh(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&zr(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),iu(t,!1,o,n,u,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&zr(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}iu(t,!0,n,null,u,l);break;case"together":iu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Gi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),wa|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(El(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Bi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Bi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function au(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Nr(e)))}function m0(e,t,n){switch(t.tag){case 3:Ve(t,t.stateNode.containerInfo),ha(t,$t,e.memoizedState.cache),Xa();break;case 27:case 5:vt(t);break;case 4:Ve(t,t.stateNode.containerInfo);break;case 10:ha(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,kc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(ba(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Gh(e,t,n):(ba(t),e=Gi(e,t,n),e!==null?e.sibling:null);ba(t);break;case 19:var o=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(El(e,t,n,!1),l=(n&t.childLanes)!==0),o){if(l)return $h(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ye(Ft,Ft.current),l)break;return null;case 22:return t.lanes=0,Bh(e,t,n,t.pendingProps);case 24:ha(t,$t,e.memoizedState.cache)}return Gi(e,t,n)}function qh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Vt=!0;else{if(!au(e,n)&&(t.flags&128)===0)return Vt=!1,m0(e,t,n);Vt=(e.flags&131072)!==0}else Vt=!1,et&&(t.flags&1048576)!==0&&Tf(t,ys,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Wa(t.elementType),t.type=e,typeof e=="function")cc(e)?(l=nl(e,l),t.tag=1,t=Fh(null,t,e,l,n)):(t.tag=0,t=Qc(null,t,e,l,n));else{if(e!=null){var o=e.$$typeof;if(o===le){t.tag=11,t=Dh(null,t,e,l,n);break e}else if(o===F){t.tag=14,t=Oh(null,t,e,l,n);break e}}throw t=ge(e)||e,Error(r(306,t,""))}}return t;case 0:return Qc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,o=nl(l,t.pendingProps),Fh(e,t,l,o,n);case 3:e:{if(Ve(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var u=t.memoizedState;o=u.element,Tc(e,t),As(t,l,null,n);var g=t.memoizedState;if(l=g.cache,ha(t,$t,l),l!==u.cache&&yc(t,[$t],n,!0),Ms(),l=g.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Ih(e,t,l,n);break e}else if(l!==o){o=Qn(Error(r(424)),t),vs(o),t=Ih(e,t,l,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Mt=ni(e.firstChild),rn=t,et=!0,da=null,ei=!0,n=Bf(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Xa(),l===o){t=Gi(e,t,n);break e}cn(e,t,l,n)}t=t.child}return t;case 26:return Vr(e,t),e===null?(n=ip(t.type,null,t.pendingProps,null))?t.memoizedState=n:et||(n=t.type,e=t.pendingProps,l=uo(He.current).createElement(n),l[jt]=t,l[Zt]=e,un(l,n,e),St(l),t.stateNode=l):t.memoizedState=ip(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return vt(t),e===null&&et&&(l=t.stateNode=ep(t.type,t.pendingProps,He.current),rn=t,ei=!0,o=Mt,Aa(t.type)?(Bu=o,Mt=ni(l.firstChild)):Mt=o),cn(e,t,t.pendingProps.children,n),Vr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&et&&((o=l=Mt)&&(l=Y0(l,t.type,t.pendingProps,ei),l!==null?(t.stateNode=l,rn=t,Mt=ni(l.firstChild),ei=!1,o=!0):o=!1),o||fa(t)),vt(t),o=t.type,u=t.pendingProps,g=e!==null?e.memoizedProps:null,l=u.children,_u(o,u)?l=null:g!==null&&_u(o,g)&&(t.flags|=32),t.memoizedState!==null&&(o=Lc(e,t,l0,null,null,n),qs._currentValue=o),Vr(e,t),cn(e,t,l,n),t.child;case 6:return e===null&&et&&((e=n=Mt)&&(n=$0(n,t.pendingProps,ei),n!==null?(t.stateNode=n,rn=t,Mt=null,e=!0):e=!1),e||fa(t)),null;case 13:return Gh(e,t,n);case 4:return Ve(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=el(t,null,l,n):cn(e,t,l,n),t.child;case 11:return Dh(e,t,t.type,t.pendingProps,n);case 7:return cn(e,t,t.pendingProps,n),t.child;case 8:return cn(e,t,t.pendingProps.children,n),t.child;case 12:return cn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,ha(t,t.type,l.value),cn(e,t,l.children,n),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,Za(t),o=on(o),l=l(o),t.flags|=1,cn(e,t,l,n),t.child;case 14:return Oh(e,t,t.type,t.pendingProps,n);case 15:return zh(e,t,t.type,t.pendingProps,n);case 19:return $h(e,t,n);case 31:return h0(e,t,n);case 22:return Bh(e,t,n,t.pendingProps);case 24:return Za(t),l=on($t),e===null?(o=wc(),o===null&&(o=yt,u=vc(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=n),o=u),t.memoizedState={parent:l,cache:o},Cc(t),ha(t,$t,o)):((e.lanes&n)!==0&&(Tc(e,t),As(t,null,null,n),Ms()),o=e.memoizedState,u=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),ha(t,$t,l)):(l=u.cache,ha(t,$t,l),l!==o.cache&&yc(t,[$t],n,!0))),cn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Yi(e){e.flags|=4}function lu(e,t,n,l,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(vm())e.flags|=8192;else throw Ja=_r,Sc}else e.flags&=-16777217}function Vh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!op(t))if(vm())e.flags|=8192;else throw Ja=_r,Sc}function Pr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?wt():536870912,e.lanes|=t,Ul|=t)}function _s(e,t){if(!et)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function At(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags&65011712,l|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function p0(e,t,n){var l=t.pendingProps;switch(hc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return At(t),null;case 1:return At(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Ki($t),Ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Al(t)?Yi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,pc())),At(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(Yi(t),u!==null?(At(t),Vh(t,u)):(At(t),lu(t,o,null,l,n))):u?u!==e.memoizedState?(Yi(t),At(t),Vh(t,u)):(At(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Yi(t),At(t),lu(t,o,e,l,n)),null;case 27:if(xt(t),n=He.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Yi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return At(t),null}e=Ae.current,Al(t)?Af(t):(e=ep(o,l,n),t.stateNode=e,Yi(t))}return At(t),null;case 5:if(xt(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Yi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return At(t),null}if(u=Ae.current,Al(t))Af(t);else{var g=uo(He.current);switch(u){case 1:u=g.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=g.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=g.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?g.createElement(o,{is:l.is}):g.createElement(o)}}u[jt]=t,u[Zt]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)u.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=u;e:switch(un(u,o,l),o){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Yi(t)}}return At(t),lu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Yi(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=He.current,Al(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,o=rn,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[jt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Gm(e.nodeValue,n)),e||fa(t,!0)}else e=uo(e).createTextNode(l),e[jt]=t,t.stateNode=e}return At(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=Al(t),n!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[jt]=t}else Xa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;At(t),e=!1}else n=pc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Fn(t),t):(Fn(t),null);if((t.flags&128)!==0)throw Error(r(558))}return At(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Al(t),l!==null&&l.dehydrated!==null){if(e===null){if(!o)throw Error(r(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));o[jt]=t}else Xa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;At(t),o=!1}else o=pc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Fn(t),t):(Fn(t),null)}return Fn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,o=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(o=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==o&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pr(t,t.updateQueue),At(t),null);case 4:return Ue(),e===null&&Eu(t.stateNode.containerInfo),At(t),null;case 10:return Ki(t.type),At(t),null;case 19:if(Re(Ft),l=t.memoizedState,l===null)return At(t),null;if(o=(t.flags&128)!==0,u=l.rendering,u===null)if(o)_s(l,!1);else{if(Ht!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=zr(e),u!==null){for(t.flags|=128,_s(l,!1),e=u.updateQueue,t.updateQueue=e,Pr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)wf(n,e),n=n.sibling;return ye(Ft,Ft.current&1|2),et&&Hi(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&ce()>eo&&(t.flags|=128,o=!0,_s(l,!1),t.lanes=4194304)}else{if(!o)if(e=zr(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Pr(t,e),_s(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!et)return At(t),null}else 2*ce()-l.renderingStartTime>eo&&n!==536870912&&(t.flags|=128,o=!0,_s(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ce(),e.sibling=null,n=Ft.current,ye(Ft,o?n&1|2:n&1),et&&Hi(t,l.treeForkCount),e):(At(t),null);case 22:case 23:return Fn(t),Nc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(At(t),t.subtreeFlags&6&&(t.flags|=8192)):At(t),n=t.updateQueue,n!==null&&Pr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&Re(Qa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki($t),At(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function g0(e,t){switch(hc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki($t),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xt(t),null;case 31:if(t.memoizedState!==null){if(Fn(t),t.alternate===null)throw Error(r(340));Xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Fn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Xa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Ft),null;case 4:return Ue(),null;case 10:return Ki(t.type),null;case 22:case 23:return Fn(t),Nc(),e!==null&&Re(Qa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki($t),null;case 25:return null;default:return null}}function Xh(e,t){switch(hc(t),t.tag){case 3:Ki($t),Ue();break;case 26:case 27:case 5:xt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Fn(t);break;case 13:Fn(t);break;case 19:Re(Ft);break;case 10:Ki(t.type);break;case 22:case 23:Fn(t),Nc(),e!==null&&Re(Qa);break;case 24:Ki($t)}}function js(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var o=l.next;n=o;do{if((n.tag&e)===e){l=void 0;var u=n.create,g=n.inst;l=u(),g.destroy=l}n=n.next}while(n!==o)}}catch(x){dt(t,t.return,x)}}function va(e,t,n){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){var g=l.inst,x=g.destroy;if(x!==void 0){g.destroy=void 0,o=t;var T=n,U=x;try{U()}catch(X){dt(o,T,X)}}}l=l.next}while(l!==u)}}catch(X){dt(t,t.return,X)}}function Ph(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Uf(t,n)}catch(l){dt(e,e.return,l)}}}function Zh(e,t,n){n.props=nl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){dt(e,t,l)}}function Ds(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(o){dt(e,t,o)}}function Ei(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(o){dt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){dt(e,t,o)}else n.current=null}function Qh(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(o){dt(e,e.return,o)}}function su(e,t,n){try{var l=e.stateNode;H0(l,e.type,n,t),l[Zt]=t}catch(o){dt(e,e.return,o)}}function Wh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Aa(e.type)||e.tag===4}function ru(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Aa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ou(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ci));else if(l!==4&&(l===27&&Aa(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(ou(e,t,n),e=e.sibling;e!==null;)ou(e,t,n),e=e.sibling}function Zr(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&Aa(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zr(e,t,n),e=e.sibling;e!==null;)Zr(e,t,n),e=e.sibling}function Jh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);un(t,l,n),t[jt]=e,t[Zt]=n}catch(u){dt(e,e.return,u)}}var $i=!1,Xt=!1,cu=!1,em=typeof WeakSet=="function"?WeakSet:Set,tn=null;function b0(e,t){if(e=e.containerInfo,Ru=yo,e=ff(e),nc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var o=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var g=0,x=-1,T=-1,U=0,X=0,Q=e,K=null;t:for(;;){for(var $;Q!==n||o!==0&&Q.nodeType!==3||(x=g+o),Q!==u||l!==0&&Q.nodeType!==3||(T=g+l),Q.nodeType===3&&(g+=Q.nodeValue.length),($=Q.firstChild)!==null;)K=Q,Q=$;for(;;){if(Q===e)break t;if(K===n&&++U===o&&(x=g),K===u&&++X===l&&(T=g),($=Q.nextSibling)!==null)break;Q=K,K=Q.parentNode}Q=$}n=x===-1||T===-1?null:{start:x,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(Lu={focusedElem:e,selectionRange:n},yo=!1,tn=t;tn!==null;)if(t=tn,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,tn=e;else for(;tn!==null;){switch(t=tn,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)o=e[n],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,n=t,o=u.memoizedProps,u=u.memoizedState,l=n.stateNode;try{var Te=nl(n.type,o);e=l.getSnapshotBeforeUpdate(Te,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ze){dt(n,n.return,ze)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Du(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Du(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,tn=e;break}tn=t.return}}function tm(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Vi(e,n),l&4&&js(5,n);break;case 1:if(Vi(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){dt(n,n.return,g)}else{var o=nl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){dt(n,n.return,g)}}l&64&&Ph(n),l&512&&Ds(n,n.return);break;case 3:if(Vi(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Uf(e,t)}catch(g){dt(n,n.return,g)}}break;case 27:t===null&&l&4&&Jh(n);case 26:case 5:Vi(e,n),t===null&&l&4&&Qh(n),l&512&&Ds(n,n.return);break;case 12:Vi(e,n);break;case 31:Vi(e,n),l&4&&am(e,n);break;case 13:Vi(e,n),l&4&&lm(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=A0.bind(null,n),q0(e,n))));break;case 22:if(l=n.memoizedState!==null||$i,!l){t=t!==null&&t.memoizedState!==null||Xt,o=$i;var u=Xt;$i=l,(Xt=t)&&!u?Xi(e,n,(n.subtreeFlags&8772)!==0):Vi(e,n),$i=o,Xt=u}break;case 30:break;default:Vi(e,n)}}function nm(e){var t=e.alternate;t!==null&&(e.alternate=null,nm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ka(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Rt=null,En=!1;function qi(e,t,n){for(n=n.child;n!==null;)im(e,t,n),n=n.sibling}function im(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(gn,n)}catch{}switch(n.tag){case 26:Xt||Ei(n,t),qi(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xt||Ei(n,t);var l=Rt,o=En;Aa(n.type)&&(Rt=n.stateNode,En=!1),qi(e,t,n),Gs(n.stateNode),Rt=l,En=o;break;case 5:Xt||Ei(n,t);case 6:if(l=Rt,o=En,Rt=null,qi(e,t,n),Rt=l,En=o,Rt!==null)if(En)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(n.stateNode)}catch(u){dt(n,t,u)}else try{Rt.removeChild(n.stateNode)}catch(u){dt(n,t,u)}break;case 18:Rt!==null&&(En?(e=Rt,Pm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Vl(e)):Pm(Rt,n.stateNode));break;case 4:l=Rt,o=En,Rt=n.stateNode.containerInfo,En=!0,qi(e,t,n),Rt=l,En=o;break;case 0:case 11:case 14:case 15:va(2,n,t),Xt||va(4,n,t),qi(e,t,n);break;case 1:Xt||(Ei(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Zh(n,t,l)),qi(e,t,n);break;case 21:qi(e,t,n);break;case 22:Xt=(l=Xt)||n.memoizedState!==null,qi(e,t,n),Xt=l;break;default:qi(e,t,n)}}function am(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vl(e)}catch(n){dt(t,t.return,n)}}}function lm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vl(e)}catch(n){dt(t,t.return,n)}}function y0(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new em),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new em),t;default:throw Error(r(435,e.tag))}}function Qr(e,t){var n=y0(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var o=E0.bind(null,e,l);l.then(o,o)}})}function Nn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l],u=e,g=t,x=g;e:for(;x!==null;){switch(x.tag){case 27:if(Aa(x.type)){Rt=x.stateNode,En=!1;break e}break;case 5:Rt=x.stateNode,En=!1;break e;case 3:case 4:Rt=x.stateNode.containerInfo,En=!0;break e}x=x.return}if(Rt===null)throw Error(r(160));im(u,g,o),Rt=null,En=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)sm(t,e),t=t.sibling}var hi=null;function sm(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nn(t,e),kn(e),l&4&&(va(3,e,e.return),js(3,e),va(5,e,e.return));break;case 1:Nn(t,e),kn(e),l&512&&(Xt||n===null||Ei(n,n.return)),l&64&&$i&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var o=hi;if(Nn(t,e),kn(e),l&512&&(Xt||n===null||Ei(n,n.return)),l&4){var u=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(l){case"title":u=o.getElementsByTagName("title")[0],(!u||u[ji]||u[jt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(l),o.head.insertBefore(u,o.querySelector("head > title"))),un(u,l,n),u[jt]=e,St(u),l=u;break e;case"link":var g=sp("link","href",o).get(l+(n.href||""));if(g){for(var x=0;x<g.length;x++)if(u=g[x],u.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&u.getAttribute("rel")===(n.rel==null?null:n.rel)&&u.getAttribute("title")===(n.title==null?null:n.title)&&u.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(x,1);break t}}u=o.createElement(l),un(u,l,n),o.head.appendChild(u);break;case"meta":if(g=sp("meta","content",o).get(l+(n.content||""))){for(x=0;x<g.length;x++)if(u=g[x],u.getAttribute("content")===(n.content==null?null:""+n.content)&&u.getAttribute("name")===(n.name==null?null:n.name)&&u.getAttribute("property")===(n.property==null?null:n.property)&&u.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&u.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(x,1);break t}}u=o.createElement(l),un(u,l,n),o.head.appendChild(u);break;default:throw Error(r(468,l))}u[jt]=e,St(u),l=u}e.stateNode=l}else rp(o,e.type,e.stateNode);else e.stateNode=lp(o,l,e.memoizedProps);else u!==l?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,l===null?rp(o,e.type,e.stateNode):lp(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&su(e,e.memoizedProps,n.memoizedProps)}break;case 27:Nn(t,e),kn(e),l&512&&(Xt||n===null||Ei(n,n.return)),n!==null&&l&4&&su(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Nn(t,e),kn(e),l&512&&(Xt||n===null||Ei(n,n.return)),e.flags&32){o=e.stateNode;try{oi(o,"")}catch(Te){dt(e,e.return,Te)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,su(e,o,n!==null?n.memoizedProps:o)),l&1024&&(cu=!0);break;case 6:if(Nn(t,e),kn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(Te){dt(e,e.return,Te)}}break;case 3:if(mo=null,o=hi,hi=fo(t.containerInfo),Nn(t,e),hi=o,kn(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Vl(t.containerInfo)}catch(Te){dt(e,e.return,Te)}cu&&(cu=!1,rm(e));break;case 4:l=hi,hi=fo(e.stateNode.containerInfo),Nn(t,e),kn(e),hi=l;break;case 12:Nn(t,e),kn(e);break;case 31:Nn(t,e),kn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Qr(e,l)));break;case 13:Nn(t,e),kn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Jr=ce()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Qr(e,l)));break;case 22:o=e.memoizedState!==null;var T=n!==null&&n.memoizedState!==null,U=$i,X=Xt;if($i=U||o,Xt=X||T,Nn(t,e),Xt=X,$i=U,kn(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||T||$i||Xt||il(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){T=n=t;try{if(u=T.stateNode,o)g=u.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{x=T.stateNode;var Q=T.memoizedProps.style,K=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;x.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(Te){dt(T,T.return,Te)}}}else if(t.tag===6){if(n===null){T=t;try{T.stateNode.nodeValue=o?"":T.memoizedProps}catch(Te){dt(T,T.return,Te)}}}else if(t.tag===18){if(n===null){T=t;try{var $=T.stateNode;o?Zm($,!0):Zm(T.stateNode,!1)}catch(Te){dt(T,T.return,Te)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,Qr(e,n))));break;case 19:Nn(t,e),kn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Qr(e,l)));break;case 30:break;case 21:break;default:Nn(t,e),kn(e)}}function kn(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Wh(l)){n=l;break}l=l.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var o=n.stateNode,u=ru(e);Zr(e,u,o);break;case 5:var g=n.stateNode;n.flags&32&&(oi(g,""),n.flags&=-33);var x=ru(e);Zr(e,x,g);break;case 3:case 4:var T=n.stateNode.containerInfo,U=ru(e);ou(e,U,T);break;default:throw Error(r(161))}}catch(X){dt(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Vi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tm(e,t.alternate,t),t=t.sibling}function il(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:va(4,t,t.return),il(t);break;case 1:Ei(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Zh(t,t.return,n),il(t);break;case 27:Gs(t.stateNode);case 26:case 5:Ei(t,t.return),il(t);break;case 22:t.memoizedState===null&&il(t);break;case 30:il(t);break;default:il(t)}e=e.sibling}}function Xi(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,u=t,g=u.flags;switch(u.tag){case 0:case 11:case 15:Xi(o,u,n),js(4,u);break;case 1:if(Xi(o,u,n),l=u,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(U){dt(l,l.return,U)}if(l=u,o=l.updateQueue,o!==null){var x=l.stateNode;try{var T=o.shared.hiddenCallbacks;if(T!==null)for(o.shared.hiddenCallbacks=null,o=0;o<T.length;o++)Hf(T[o],x)}catch(U){dt(l,l.return,U)}}n&&g&64&&Ph(u),Ds(u,u.return);break;case 27:Jh(u);case 26:case 5:Xi(o,u,n),n&&l===null&&g&4&&Qh(u),Ds(u,u.return);break;case 12:Xi(o,u,n);break;case 31:Xi(o,u,n),n&&g&4&&am(o,u);break;case 13:Xi(o,u,n),n&&g&4&&lm(o,u);break;case 22:u.memoizedState===null&&Xi(o,u,n),Ds(u,u.return);break;case 30:break;default:Xi(o,u,n)}t=t.sibling}}function uu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&xs(n))}function du(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xs(e))}function mi(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)om(e,t,n,l),t=t.sibling}function om(e,t,n,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:mi(e,t,n,l),o&2048&&js(9,t);break;case 1:mi(e,t,n,l);break;case 3:mi(e,t,n,l),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xs(e)));break;case 12:if(o&2048){mi(e,t,n,l),e=t.stateNode;try{var u=t.memoizedProps,g=u.id,x=u.onPostCommit;typeof x=="function"&&x(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){dt(t,t.return,T)}}else mi(e,t,n,l);break;case 31:mi(e,t,n,l);break;case 13:mi(e,t,n,l);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?mi(e,t,n,l):Os(e,t):u._visibility&2?mi(e,t,n,l):(u._visibility|=2,zl(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&uu(g,t);break;case 24:mi(e,t,n,l),o&2048&&du(t.alternate,t);break;default:mi(e,t,n,l)}}function zl(e,t,n,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,g=t,x=n,T=l,U=g.flags;switch(g.tag){case 0:case 11:case 15:zl(u,g,x,T,o),js(8,g);break;case 23:break;case 22:var X=g.stateNode;g.memoizedState!==null?X._visibility&2?zl(u,g,x,T,o):Os(u,g):(X._visibility|=2,zl(u,g,x,T,o)),o&&U&2048&&uu(g.alternate,g);break;case 24:zl(u,g,x,T,o),o&&U&2048&&du(g.alternate,g);break;default:zl(u,g,x,T,o)}t=t.sibling}}function Os(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,o=l.flags;switch(l.tag){case 22:Os(n,l),o&2048&&uu(l.alternate,l);break;case 24:Os(n,l),o&2048&&du(l.alternate,l);break;default:Os(n,l)}t=t.sibling}}var zs=8192;function Bl(e,t,n){if(e.subtreeFlags&zs)for(e=e.child;e!==null;)cm(e,t,n),e=e.sibling}function cm(e,t,n){switch(e.tag){case 26:Bl(e,t,n),e.flags&zs&&e.memoizedState!==null&&av(n,hi,e.memoizedState,e.memoizedProps);break;case 5:Bl(e,t,n);break;case 3:case 4:var l=hi;hi=fo(e.stateNode.containerInfo),Bl(e,t,n),hi=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=zs,zs=16777216,Bl(e,t,n),zs=l):Bl(e,t,n));break;default:Bl(e,t,n)}}function um(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];tn=l,fm(l,e)}um(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dm(e),e=e.sibling}function dm(e){switch(e.tag){case 0:case 11:case 15:Bs(e),e.flags&2048&&va(9,e,e.return);break;case 3:Bs(e);break;case 12:Bs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Wr(e)):Bs(e);break;default:Bs(e)}}function Wr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];tn=l,fm(l,e)}um(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:va(8,t,t.return),Wr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Wr(t));break;default:Wr(t)}e=e.sibling}}function fm(e,t){for(;tn!==null;){var n=tn;switch(n.tag){case 0:case 11:case 15:va(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:xs(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,tn=l;else e:for(n=e;tn!==null;){l=tn;var o=l.sibling,u=l.return;if(nm(l),l===n){tn=null;break e}if(o!==null){o.return=u,tn=o;break e}tn=u}}}var v0={getCacheForType:function(e){var t=on($t),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return on($t).controller.signal}},x0=typeof WeakMap=="function"?WeakMap:Map,st=0,yt=null,Ze=null,We=0,ut=0,In=null,xa=!1,Hl=!1,fu=!1,Pi=0,Ht=0,wa=0,al=0,hu=0,Gn=0,Ul=0,Hs=null,Rn=null,mu=!1,Jr=0,hm=0,eo=1/0,to=null,Sa=null,Wt=0,Ca=null,Kl=null,Zi=0,pu=0,gu=null,mm=null,Us=0,bu=null;function Yn(){return(st&2)!==0&&We!==0?We&-We:A.T!==null?Cu():Yt()}function pm(){if(Gn===0)if((We&536870912)===0||et){var e=tt;tt<<=1,(tt&3932160)===0&&(tt=262144),Gn=e}else Gn=536870912;return e=Kn.current,e!==null&&(e.flags|=32),Gn}function Ln(e,t,n){(e===yt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&(Fl(e,0),Ta(e,We,Gn,!1)),$n(e,n),((st&2)===0||e!==yt)&&(e===yt&&((st&2)===0&&(al|=n),Ht===4&&Ta(e,We,Gn,!1)),Ni(e))}function gm(e,t,n){if((st&6)!==0)throw Error(r(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||sn(e,t),o=l?C0(e,t):vu(e,t,!0),u=l;do{if(o===0){Hl&&!l&&Ta(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!w0(n)){o=vu(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var x=e;o=Hs;var T=x.current.memoizedState.isDehydrated;if(T&&(Fl(x,g).flags|=256),g=vu(x,g,!1),g!==2){if(fu&&!T){x.errorRecoveryDisabledLanes|=u,al|=u,o=4;break e}u=Rn,Rn=o,u!==null&&(Rn===null?Rn=u:Rn.push.apply(Rn,u))}o=g}if(u=!1,o!==2)continue}}if(o===1){Fl(e,0),Ta(e,t,0,!0);break}e:{switch(l=e,u=o,u){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Ta(l,t,Gn,!xa);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(o=Jr+300-ce(),10<o)){if(Ta(l,t,Gn,!xa),_t(l,0,!0)!==0)break e;Zi=t,l.timeoutHandle=Vm(bm.bind(null,l,n,Rn,to,mu,t,Gn,al,Ul,xa,u,"Throttled",-0,0),o);break e}bm(l,n,Rn,to,mu,t,Gn,al,Ul,xa,u,null,-0,0)}}break}while(!0);Ni(e)}function bm(e,t,n,l,o,u,g,x,T,U,X,Q,K,$){if(e.timeoutHandle=-1,Q=t.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ci},cm(t,u,Q);var Te=(u&62914560)===u?Jr-ce():(u&4194048)===u?hm-ce():0;if(Te=lv(Q,Te),Te!==null){Zi=u,e.cancelPendingCommit=Te(Mm.bind(null,e,t,u,n,l,o,g,x,T,X,Q,null,K,$)),Ta(e,u,g,!U);return}}Mm(e,t,u,n,l,o,g,x,T)}function w0(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var o=n[l],u=o.getSnapshot;o=o.value;try{if(!Hn(u(),o))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ta(e,t,n,l){t&=~hu,t&=~al,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var u=31-ft(o),g=1<<u;l[u]=-1,o&=~g}n!==0&&Ua(e,n,t)}function no(){return(st&6)===0?(Ks(0),!1):!0}function yu(){if(Ze!==null){if(ut===0)var e=Ze.return;else e=Ze,Ui=Pa=null,Dc(e),Ll=null,Ss=0,e=Ze;for(;e!==null;)Xh(e.alternate,e),e=e.return;Ze=null}}function Fl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,F0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Zi=0,yu(),yt=e,Ze=n=Bi(e.current,null),We=t,ut=0,In=null,xa=!1,Hl=sn(e,t),fu=!1,Ul=Gn=hu=al=wa=Ht=0,Rn=Hs=null,mu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var o=31-ft(l),u=1<<o;t|=e[o],l&=~u}return Pi=t,Cr(),n}function ym(e,t){Ge=null,A.H=Rs,t===Rl||t===Lr?(t=Df(),ut=3):t===Sc?(t=Df(),ut=4):ut=t===Zc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,In=t,Ze===null&&(Ht=1,$r(e,Qn(t,e.current)))}function vm(){var e=Kn.current;return e===null?!0:(We&4194048)===We?ti===null:(We&62914560)===We||(We&536870912)!==0?e===ti:!1}function xm(){var e=A.H;return A.H=Rs,e===null?Rs:e}function wm(){var e=A.A;return A.A=v0,e}function io(){Ht=4,xa||(We&4194048)!==We&&Kn.current!==null||(Hl=!0),(wa&134217727)===0&&(al&134217727)===0||yt===null||Ta(yt,We,Gn,!1)}function vu(e,t,n){var l=st;st|=2;var o=xm(),u=wm();(yt!==e||We!==t)&&(to=null,Fl(e,t)),t=!1;var g=Ht;e:do try{if(ut!==0&&Ze!==null){var x=Ze,T=In;switch(ut){case 8:yu(),g=6;break e;case 3:case 2:case 9:case 6:Kn.current===null&&(t=!0);var U=ut;if(ut=0,In=null,Il(e,x,T,U),n&&Hl){g=0;break e}break;default:U=ut,ut=0,In=null,Il(e,x,T,U)}}S0(),g=Ht;break}catch(X){ym(e,X)}while(!0);return t&&e.shellSuspendCounter++,Ui=Pa=null,st=l,A.H=o,A.A=u,Ze===null&&(yt=null,We=0,Cr()),g}function S0(){for(;Ze!==null;)Sm(Ze)}function C0(e,t){var n=st;st|=2;var l=xm(),o=wm();yt!==e||We!==t?(to=null,eo=ce()+500,Fl(e,t)):Hl=sn(e,t);e:do try{if(ut!==0&&Ze!==null){t=Ze;var u=In;t:switch(ut){case 1:ut=0,In=null,Il(e,t,u,1);break;case 2:case 9:if(_f(u)){ut=0,In=null,Cm(t);break}t=function(){ut!==2&&ut!==9||yt!==e||(ut=7),Ni(e)},u.then(t,t);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:_f(u)?(ut=0,In=null,Cm(t)):(ut=0,In=null,Il(e,t,u,7));break;case 5:var g=null;switch(Ze.tag){case 26:g=Ze.memoizedState;case 5:case 27:var x=Ze;if(g?op(g):x.stateNode.complete){ut=0,In=null;var T=x.sibling;if(T!==null)Ze=T;else{var U=x.return;U!==null?(Ze=U,ao(U)):Ze=null}break t}}ut=0,In=null,Il(e,t,u,5);break;case 6:ut=0,In=null,Il(e,t,u,6);break;case 8:yu(),Ht=6;break e;default:throw Error(r(462))}}T0();break}catch(X){ym(e,X)}while(!0);return Ui=Pa=null,A.H=l,A.A=o,st=n,Ze!==null?0:(yt=null,We=0,Cr(),Ht)}function T0(){for(;Ze!==null&&!mn();)Sm(Ze)}function Sm(e){var t=qh(e.alternate,e,Pi);e.memoizedProps=e.pendingProps,t===null?ao(e):Ze=t}function Cm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Kh(n,t,t.pendingProps,t.type,void 0,We);break;case 11:t=Kh(n,t,t.pendingProps,t.type.render,t.ref,We);break;case 5:Dc(t);default:Xh(n,t),t=Ze=wf(t,Pi),t=qh(n,t,Pi)}e.memoizedProps=e.pendingProps,t===null?ao(e):Ze=t}function Il(e,t,n,l){Ui=Pa=null,Dc(t),Ll=null,Ss=0;var o=t.return;try{if(f0(e,o,t,n,We)){Ht=1,$r(e,Qn(n,e.current)),Ze=null;return}}catch(u){if(o!==null)throw Ze=o,u;Ht=1,$r(e,Qn(n,e.current)),Ze=null;return}t.flags&32768?(et||l===1?e=!0:Hl||(We&536870912)!==0?e=!1:(xa=e=!0,(l===2||l===9||l===3||l===6)&&(l=Kn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Tm(t,e)):ao(t)}function ao(e){var t=e;do{if((t.flags&32768)!==0){Tm(t,xa);return}e=t.return;var n=p0(t.alternate,t,Pi);if(n!==null){Ze=n;return}if(t=t.sibling,t!==null){Ze=t;return}Ze=t=e}while(t!==null);Ht===0&&(Ht=5)}function Tm(e,t){do{var n=g0(e.alternate,e);if(n!==null){n.flags&=32767,Ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ze=e;return}Ze=e=n}while(e!==null);Ht=6,Ze=null}function Mm(e,t,n,l,o,u,g,x,T){e.cancelPendingCommit=null;do lo();while(Wt!==0);if((st&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=rc,fl(e,n,u,g,x,T),e===yt&&(Ze=yt=null,We=0),Kl=t,Ca=e,Zi=n,pu=u,gu=o,mm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,N0(ue,function(){return Rm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=A.T,A.T=null,o=j.p,j.p=2,g=st,st|=4;try{b0(e,t,n)}finally{st=g,j.p=o,A.T=l}}Wt=1,Am(),Em(),Nm()}}function Am(){if(Wt===1){Wt=0;var e=Ca,t=Kl,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=A.T,A.T=null;var l=j.p;j.p=2;var o=st;st|=4;try{sm(t,e);var u=Lu,g=ff(e.containerInfo),x=u.focusedElem,T=u.selectionRange;if(g!==x&&x&&x.ownerDocument&&df(x.ownerDocument.documentElement,x)){if(T!==null&&nc(x)){var U=T.start,X=T.end;if(X===void 0&&(X=U),"selectionStart"in x)x.selectionStart=U,x.selectionEnd=Math.min(X,x.value.length);else{var Q=x.ownerDocument||document,K=Q&&Q.defaultView||window;if(K.getSelection){var $=K.getSelection(),Te=x.textContent.length,ze=Math.min(T.start,Te),pt=T.end===void 0?ze:Math.min(T.end,Te);!$.extend&&ze>pt&&(g=pt,pt=ze,ze=g);var _=uf(x,ze),k=uf(x,pt);if(_&&k&&($.rangeCount!==1||$.anchorNode!==_.node||$.anchorOffset!==_.offset||$.focusNode!==k.node||$.focusOffset!==k.offset)){var H=Q.createRange();H.setStart(_.node,_.offset),$.removeAllRanges(),ze>pt?($.addRange(H),$.extend(k.node,k.offset)):(H.setEnd(k.node,k.offset),$.addRange(H))}}}}for(Q=[],$=x;$=$.parentNode;)$.nodeType===1&&Q.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<Q.length;x++){var P=Q[x];P.element.scrollLeft=P.left,P.element.scrollTop=P.top}}yo=!!Ru,Lu=Ru=null}finally{st=o,j.p=l,A.T=n}}e.current=t,Wt=2}}function Em(){if(Wt===2){Wt=0;var e=Ca,t=Kl,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=A.T,A.T=null;var l=j.p;j.p=2;var o=st;st|=4;try{tm(e,t.alternate,t)}finally{st=o,j.p=l,A.T=n}}Wt=3}}function Nm(){if(Wt===4||Wt===3){Wt=0,ct();var e=Ca,t=Kl,n=Zi,l=mm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Wt=5:(Wt=0,Kl=Ca=null,km(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Sa=null),qn(n),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(gn,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=A.T,o=j.p,j.p=2,A.T=null;try{for(var u=e.onRecoverableError,g=0;g<l.length;g++){var x=l[g];u(x.value,{componentStack:x.stack})}}finally{A.T=t,j.p=o}}(Zi&3)!==0&&lo(),Ni(e),o=e.pendingLanes,(n&261930)!==0&&(o&42)!==0?e===bu?Us++:(Us=0,bu=e):Us=0,Ks(0)}}function km(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xs(t)))}function lo(){return Am(),Em(),Nm(),Rm()}function Rm(){if(Wt!==5)return!1;var e=Ca,t=pu;pu=0;var n=qn(Zi),l=A.T,o=j.p;try{j.p=32>n?32:n,A.T=null,n=gu,gu=null;var u=Ca,g=Zi;if(Wt=0,Kl=Ca=null,Zi=0,(st&6)!==0)throw Error(r(331));var x=st;if(st|=4,dm(u.current),om(u,u.current,g,n),st=x,Ks(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(gn,u)}catch{}return!0}finally{j.p=o,A.T=l,km(e,t)}}function Lm(e,t,n){t=Qn(n,t),t=Pc(e.stateNode,t,2),e=ga(e,t,2),e!==null&&($n(e,2),Ni(e))}function dt(e,t,n){if(e.tag===3)Lm(e,e,n);else for(;t!==null;){if(t.tag===3){Lm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Sa===null||!Sa.has(l))){e=Qn(n,e),n=_h(2),l=ga(t,n,2),l!==null&&(jh(n,l,t,e),$n(l,2),Ni(l));break}}t=t.return}}function xu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new x0;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(n)||(fu=!0,o.add(n),e=M0.bind(null,e,t,n),t.then(e,e))}function M0(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,yt===e&&(We&n)===n&&(Ht===4||Ht===3&&(We&62914560)===We&&300>ce()-Jr?(st&2)===0&&Fl(e,0):hu|=n,Ul===We&&(Ul=0)),Ni(e)}function _m(e,t){t===0&&(t=wt()),e=qa(e,t),e!==null&&($n(e,t),Ni(e))}function A0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),_m(e,n)}function E0(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),_m(e,n)}function N0(e,t){return ot(e,t)}var so=null,Gl=null,wu=!1,ro=!1,Su=!1,Ma=0;function Ni(e){e!==Gl&&e.next===null&&(Gl===null?so=Gl=e:Gl=Gl.next=e),ro=!0,wu||(wu=!0,R0())}function Ks(e,t){if(!Su&&ro){Su=!0;do for(var n=!1,l=so;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var u=0;else{var g=l.suspendedLanes,x=l.pingedLanes;u=(1<<31-ft(42|e)+1)-1,u&=o&~(g&~x),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,zm(l,u))}else u=We,u=_t(l,l===yt?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||sn(l,u)||(n=!0,zm(l,u));l=l.next}while(n);Su=!1}}function k0(){jm()}function jm(){ro=wu=!1;var e=0;Ma!==0&&K0()&&(e=Ma);for(var t=ce(),n=null,l=so;l!==null;){var o=l.next,u=Dm(l,t);u===0?(l.next=null,n===null?so=o:n.next=o,o===null&&(Gl=n)):(n=l,(e!==0||(u&3)!==0)&&(ro=!0)),l=o}Wt!==0&&Wt!==5||Ks(e),Ma!==0&&(Ma=0)}function Dm(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var g=31-ft(u),x=1<<g,T=o[g];T===-1?((x&n)===0||(x&l)!==0)&&(o[g]=dl(x,t)):T<=t&&(e.expiredLanes|=x),u&=~x}if(t=yt,n=We,n=_t(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&$e(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||sn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&$e(l),qn(n)){case 2:case 8:n=E;break;case 32:n=ue;break;case 268435456:n=Be;break;default:n=ue}return l=Om.bind(null,e),n=ot(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&$e(l),e.callbackPriority=2,e.callbackNode=null,2}function Om(e,t){if(Wt!==0&&Wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lo()&&e.callbackNode!==n)return null;var l=We;return l=_t(e,e===yt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(gm(e,l,t),Dm(e,ce()),e.callbackNode!=null&&e.callbackNode===n?Om.bind(null,e):null)}function zm(e,t){if(lo())return null;gm(e,t,!0)}function R0(){I0(function(){(st&6)!==0?ot(Ie,k0):jm()})}function Cu(){if(Ma===0){var e=Nl;e===0&&(e=en,en<<=1,(en&261888)===0&&(en=256)),Ma=e}return Ma}function Bm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bl(""+e)}function Hm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function L0(e,t,n,l,o){if(t==="submit"&&n&&n.stateNode===o){var u=Bm((o[Zt]||null).action),g=l.submitter;g&&(t=(t=g[Zt]||null)?Bm(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var x=new ke("action","action",null,l,o);e.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ma!==0){var T=g?Hm(o,g):new FormData(o);Gc(n,{pending:!0,data:T,method:o.method,action:u},null,T)}}else typeof u=="function"&&(x.preventDefault(),T=g?Hm(o,g):new FormData(o),Gc(n,{pending:!0,data:T,method:o.method,action:u},u,T))},currentTarget:o}]})}}for(var Tu=0;Tu<sc.length;Tu++){var Mu=sc[Tu],_0=Mu.toLowerCase(),j0=Mu[0].toUpperCase()+Mu.slice(1);fi(_0,"on"+j0)}fi(pf,"onAnimationEnd"),fi(gf,"onAnimationIteration"),fi(bf,"onAnimationStart"),fi("dblclick","onDoubleClick"),fi("focusin","onFocus"),fi("focusout","onBlur"),fi(Py,"onTransitionRun"),fi(Zy,"onTransitionStart"),fi(Qy,"onTransitionCancel"),fi(yf,"onTransitionEnd"),ri("onMouseEnter",["mouseout","mouseover"]),ri("onMouseLeave",["mouseout","mouseover"]),ri("onPointerEnter",["pointerout","pointerover"]),ri("onPointerLeave",["pointerout","pointerover"]),Xn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fs="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(" "),D0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fs));function Um(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],o=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var g=l.length-1;0<=g;g--){var x=l[g],T=x.instance,U=x.currentTarget;if(x=x.listener,T!==u&&o.isPropagationStopped())break e;u=x,o.currentTarget=U;try{u(o)}catch(X){Sr(X)}o.currentTarget=null,u=T}else for(g=0;g<l.length;g++){if(x=l[g],T=x.instance,U=x.currentTarget,x=x.listener,T!==u&&o.isPropagationStopped())break e;u=x,o.currentTarget=U;try{u(o)}catch(X){Sr(X)}o.currentTarget=null,u=T}}}}function Qe(e,t){var n=t[yi];n===void 0&&(n=t[yi]=new Set);var l=e+"__bubble";n.has(l)||(Km(t,e,2,!1),n.add(l))}function Au(e,t,n){var l=0;t&&(l|=4),Km(n,e,l,t)}var oo="_reactListening"+Math.random().toString(36).slice(2);function Eu(e){if(!e[oo]){e[oo]=!0,Vn.forEach(function(n){n!=="selectionchange"&&(D0.has(n)||Au(n,!1,e),Au(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[oo]||(t[oo]=!0,Au("selectionchange",!1,t))}}function Km(e,t,n,l){switch(pp(t)){case 2:var o=ov;break;case 8:o=cv;break;default:o=Iu}n=o.bind(null,t,n,e),o=void 0,!ca||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Nu(e,t,n,l,o){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var x=l.stateNode.containerInfo;if(x===o)break;if(g===4)for(g=l.return;g!==null;){var T=g.tag;if((T===3||T===4)&&g.stateNode.containerInfo===o)return;g=g.return}for(;x!==null;){if(g=vi(x),g===null)return;if(T=g.tag,T===5||T===6||T===26||T===27){l=u=g;continue e}x=x.parentNode}}l=l.return}ds(function(){var U=u,X=hn(n),Q=[];e:{var K=vf.get(e);if(K!==void 0){var $=ke,Te=e;switch(e){case"keypress":if(he(n)===0)break e;case"keydown":case"keyup":$=Ey;break;case"focusin":Te="focus",$=Qo;break;case"focusout":Te="blur",$=Qo;break;case"beforeblur":case"afterblur":$=Qo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$=fs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=Ry;break;case pf:case gf:case bf:$=yy;break;case yf:$=_y;break;case"scroll":case"scrollend":$=zt;break;case"wheel":$=Dy;break;case"copy":case"cut":case"paste":$=xy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=Pd;break;case"toggle":case"beforetoggle":$=zy}var ze=(t&4)!==0,pt=!ze&&(e==="scroll"||e==="scrollend"),_=ze?K!==null?K+"Capture":null:K;ze=[];for(var k=U,H;k!==null;){var P=k;if(H=P.stateNode,P=P.tag,P!==5&&P!==26&&P!==27||H===null||_===null||(P=oa(k,_),P!=null&&ze.push(Is(k,P,H))),pt)break;k=k.return}0<ze.length&&(K=new $(K,Te,null,n,X),Q.push({event:K,listeners:ze}))}}if((t&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",$=e==="mouseout"||e==="pointerout",K&&n!==us&&(Te=n.relatedTarget||n.fromElement)&&(vi(Te)||Te[On]))break e;if(($||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,$?(Te=n.relatedTarget||n.toElement,$=U,Te=Te?vi(Te):null,Te!==null&&(pt=d(Te),ze=Te.tag,Te!==pt||ze!==5&&ze!==27&&ze!==6)&&(Te=null)):($=null,Te=U),$!==Te)){if(ze=fs,P="onMouseLeave",_="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(ze=Pd,P="onPointerLeave",_="onPointerEnter",k="pointer"),pt=$==null?K:wi($),H=Te==null?K:wi(Te),K=new ze(P,k+"leave",$,n,X),K.target=pt,K.relatedTarget=H,P=null,vi(X)===U&&(ze=new ze(_,k+"enter",Te,n,X),ze.target=H,ze.relatedTarget=pt,P=ze),pt=P,$&&Te)t:{for(ze=O0,_=$,k=Te,H=0,P=_;P;P=ze(P))H++;P=0;for(var _e=k;_e;_e=ze(_e))P++;for(;0<H-P;)_=ze(_),H--;for(;0<P-H;)k=ze(k),P--;for(;H--;){if(_===k||k!==null&&_===k.alternate){ze=_;break t}_=ze(_),k=ze(k)}ze=null}else ze=null;$!==null&&Fm(Q,K,$,ze,!1),Te!==null&&pt!==null&&Fm(Q,pt,Te,ze,!0)}}e:{if(K=U?wi(U):window,$=K.nodeName&&K.nodeName.toLowerCase(),$==="select"||$==="input"&&K.type==="file")var it=af;else if(tf(K))if(lf)it=qy;else{it=Yy;var Ee=Gy}else $=K.nodeName,!$||$.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?U&&cs(U.elementType)&&(it=af):it=$y;if(it&&(it=it(e,U))){nf(Q,it,n,X);break e}Ee&&Ee(e,K,U),e==="focusout"&&U&&K.type==="number"&&U.memoizedProps.value!=null&&Dt(K,"number",K.value)}switch(Ee=U?wi(U):window,e){case"focusin":(tf(Ee)||Ee.contentEditable==="true")&&(xl=Ee,ic=U,bs=null);break;case"focusout":bs=ic=xl=null;break;case"mousedown":ac=!0;break;case"contextmenu":case"mouseup":case"dragend":ac=!1,hf(Q,n,X);break;case"selectionchange":if(Xy)break;case"keydown":case"keyup":hf(Q,n,X)}var qe;if(Jo)e:{switch(e){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else vl?Jd(e,n)&&(Je="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Je="onCompositionStart");Je&&(Zd&&n.locale!=="ko"&&(vl||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&vl&&(qe=ae()):(ui=X,yl="value"in ui?ui.value:ui.textContent,vl=!0)),Ee=co(U,Je),0<Ee.length&&(Je=new Xd(Je,e,null,n,X),Q.push({event:Je,listeners:Ee}),qe?Je.data=qe:(qe=ef(n),qe!==null&&(Je.data=qe)))),(qe=Hy?Uy(e,n):Ky(e,n))&&(Je=co(U,"onBeforeInput"),0<Je.length&&(Ee=new Xd("onBeforeInput","beforeinput",null,n,X),Q.push({event:Ee,listeners:Je}),Ee.data=qe)),L0(Q,e,U,n,X)}Um(Q,t)})}function Is(e,t,n){return{instance:e,listener:t,currentTarget:n}}function co(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=oa(e,n),o!=null&&l.unshift(Is(e,o,u)),o=oa(e,t),o!=null&&l.push(Is(e,o,u))),e.tag===3)return l;e=e.return}return[]}function O0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fm(e,t,n,l,o){for(var u=t._reactName,g=[];n!==null&&n!==l;){var x=n,T=x.alternate,U=x.stateNode;if(x=x.tag,T!==null&&T===l)break;x!==5&&x!==26&&x!==27||U===null||(T=U,o?(U=oa(n,u),U!=null&&g.unshift(Is(n,U,T))):o||(U=oa(n,u),U!=null&&g.push(Is(n,U,T)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var z0=/\r\n?/g,B0=/\u0000|\uFFFD/g;function Im(e){return(typeof e=="string"?e:""+e).replace(z0,`
|
|
33
|
-
`).replace(B0,"")}function Gm(e,t){return t=Im(t),Im(e)===t}function mt(e,t,n,l,o,u){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||oi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&oi(e,""+l);break;case"className":Ci(e,"class",l);break;case"tabIndex":Ci(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ci(e,n,l);break;case"style":xr(e,l,u);break;case"data":if(t!=="object"){Ci(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=bl(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"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 u=="function"&&(n==="formAction"?(t!=="input"&&mt(e,t,"name",o.name,o,null),mt(e,t,"formEncType",o.formEncType,o,null),mt(e,t,"formMethod",o.formMethod,o,null),mt(e,t,"formTarget",o.formTarget,o,null)):(mt(e,t,"encType",o.encType,o,null),mt(e,t,"method",o.method,o,null),mt(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=bl(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=ci);break;case"onScroll":l!=null&&Qe("scroll",e);break;case"onScrollEnd":l!=null&&Qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=bl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),Oi(e,"popover",l);break;case"xlinkActuate":z(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":z(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":z(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":z(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":z(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":z(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":z(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":z(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":z(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Oi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Po.get(n)||n,Oi(e,n,l))}}function ku(e,t,n,l,o,u){switch(n){case"style":xr(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(n=l.__html,n!=null){if(o.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof l=="string"?oi(e,l):(typeof l=="number"||typeof l=="bigint")&&oi(e,""+l);break;case"onScroll":l!=null&&Qe("scroll",e);break;case"onScrollEnd":l!=null&&Qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ci);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Si.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),u=e[Zt]||null,u=u!=null?u[n]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof l=="function")){typeof u!="function"&&u!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,o);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):Oi(e,n,l)}}}function un(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var l=!1,o=!1,u;for(u in n)if(n.hasOwnProperty(u)){var g=n[u];if(g!=null)switch(u){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:mt(e,t,u,g,n,null)}}o&&mt(e,t,"srcSet",n.srcSet,n,null),l&&mt(e,t,"src",n.src,n,null);return;case"input":Qe("invalid",e);var x=u=g=o=null,T=null,U=null;for(l in n)if(n.hasOwnProperty(l)){var X=n[l];if(X!=null)switch(l){case"name":o=X;break;case"type":g=X;break;case"checked":T=X;break;case"defaultChecked":U=X;break;case"value":u=X;break;case"defaultValue":x=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,t));break;default:mt(e,t,l,X,n,null)}}nt(e,u,x,T,U,g,o,!1);return;case"select":Qe("invalid",e),l=g=u=null;for(o in n)if(n.hasOwnProperty(o)&&(x=n[o],x!=null))switch(o){case"value":u=x;break;case"defaultValue":g=x;break;case"multiple":l=x;default:mt(e,t,o,x,n,null)}t=u,n=g,e.multiple=!!l,t!=null?fn(e,!!l,t,!1):n!=null&&fn(e,!!l,n,!0);return;case"textarea":Qe("invalid",e),u=o=l=null;for(g in n)if(n.hasOwnProperty(g)&&(x=n[g],x!=null))switch(g){case"value":l=x;break;case"defaultValue":o=x;break;case"children":u=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:mt(e,t,g,x,n,null)}Ia(e,l,o,u);return;case"option":for(T in n)if(n.hasOwnProperty(T)&&(l=n[T],l!=null))switch(T){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:mt(e,t,T,l,n,null)}return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(l=0;l<Fs.length;l++)Qe(Fs[l],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in n)if(n.hasOwnProperty(U)&&(l=n[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:mt(e,t,U,l,n,null)}return;default:if(cs(t)){for(X in n)n.hasOwnProperty(X)&&(l=n[X],l!==void 0&&ku(e,t,X,l,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(l=n[x],l!=null&&mt(e,t,x,l,n,null))}function H0(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,g=null,x=null,T=null,U=null,X=null;for($ in n){var Q=n[$];if(n.hasOwnProperty($)&&Q!=null)switch($){case"checked":break;case"value":break;case"defaultValue":T=Q;default:l.hasOwnProperty($)||mt(e,t,$,null,l,Q)}}for(var K in l){var $=l[K];if(Q=n[K],l.hasOwnProperty(K)&&($!=null||Q!=null))switch(K){case"type":u=$;break;case"name":o=$;break;case"checked":U=$;break;case"defaultChecked":X=$;break;case"value":g=$;break;case"defaultValue":x=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,t));break;default:$!==Q&&mt(e,t,K,$,l,Q)}}Tt(e,g,x,T,U,X,u,o);return;case"select":$=g=x=K=null;for(u in n)if(T=n[u],n.hasOwnProperty(u)&&T!=null)switch(u){case"value":break;case"multiple":$=T;default:l.hasOwnProperty(u)||mt(e,t,u,null,l,T)}for(o in l)if(u=l[o],T=n[o],l.hasOwnProperty(o)&&(u!=null||T!=null))switch(o){case"value":K=u;break;case"defaultValue":x=u;break;case"multiple":g=u;default:u!==T&&mt(e,t,o,u,l,T)}t=x,n=g,l=$,K!=null?fn(e,!!n,K,!1):!!l!=!!n&&(t!=null?fn(e,!!n,t,!0):fn(e,!!n,n?[]:"",!1));return;case"textarea":$=K=null;for(x in n)if(o=n[x],n.hasOwnProperty(x)&&o!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:mt(e,t,x,null,l,o)}for(g in l)if(o=l[g],u=n[g],l.hasOwnProperty(g)&&(o!=null||u!=null))switch(g){case"value":K=o;break;case"defaultValue":$=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(r(91));break;default:o!==u&&mt(e,t,g,o,l,u)}zi(e,K,$);return;case"option":for(var Te in n)if(K=n[Te],n.hasOwnProperty(Te)&&K!=null&&!l.hasOwnProperty(Te))switch(Te){case"selected":e.selected=!1;break;default:mt(e,t,Te,null,l,K)}for(T in l)if(K=l[T],$=n[T],l.hasOwnProperty(T)&&K!==$&&(K!=null||$!=null))switch(T){case"selected":e.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:mt(e,t,T,K,l,$)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in n)K=n[ze],n.hasOwnProperty(ze)&&K!=null&&!l.hasOwnProperty(ze)&&mt(e,t,ze,null,l,K);for(U in l)if(K=l[U],$=n[U],l.hasOwnProperty(U)&&K!==$&&(K!=null||$!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:mt(e,t,U,K,l,$)}return;default:if(cs(t)){for(var pt in n)K=n[pt],n.hasOwnProperty(pt)&&K!==void 0&&!l.hasOwnProperty(pt)&&ku(e,t,pt,void 0,l,K);for(X in l)K=l[X],$=n[X],!l.hasOwnProperty(X)||K===$||K===void 0&&$===void 0||ku(e,t,X,K,l,$);return}}for(var _ in n)K=n[_],n.hasOwnProperty(_)&&K!=null&&!l.hasOwnProperty(_)&&mt(e,t,_,null,l,K);for(Q in l)K=l[Q],$=n[Q],!l.hasOwnProperty(Q)||K===$||K==null&&$==null||mt(e,t,Q,K,l,$)}function Ym(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var o=n[l],u=o.transferSize,g=o.initiatorType,x=o.duration;if(u&&x&&Ym(g)){for(g=0,x=o.responseEnd,l+=1;l<n.length;l++){var T=n[l],U=T.startTime;if(U>x)break;var X=T.transferSize,Q=T.initiatorType;X&&Ym(Q)&&(T=T.responseEnd,g+=X*(T<x?1:(x-U)/(T-U)))}if(--l,t+=8*(u+g)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ru=null,Lu=null;function uo(e){return e.nodeType===9?e:e.ownerDocument}function $m(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qm(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function _u(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ju=null;function K0(){var e=window.event;return e&&e.type==="popstate"?e===ju?!1:(ju=e,!0):(ju=null,!1)}var Vm=typeof setTimeout=="function"?setTimeout:void 0,F0=typeof clearTimeout=="function"?clearTimeout:void 0,Xm=typeof Promise=="function"?Promise:void 0,I0=typeof queueMicrotask=="function"?queueMicrotask:typeof Xm<"u"?function(e){return Xm.resolve(null).then(e).catch(G0)}:Vm;function G0(e){setTimeout(function(){throw e})}function Aa(e){return e==="head"}function Pm(e,t){var n=t,l=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(o),Vl(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")Gs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Gs(n);for(var u=n.firstChild;u;){var g=u.nextSibling,x=u.nodeName;u[ji]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&Gs(e.ownerDocument.body);n=o}while(n);Vl(t)}function Zm(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function Du(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Du(n),Ka(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Y0(e,t,n,l){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ji])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=ni(e.nextSibling),e===null)break}return null}function $0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ni(e.nextSibling),e===null))return null;return e}function Qm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ni(e.nextSibling),e===null))return null;return e}function Ou(e){return e.data==="$?"||e.data==="$~"}function zu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function q0(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function ni(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Bu=null;function Wm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ni(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Jm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function ep(e,t,n){switch(t=uo(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Gs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ka(e)}var ii=new Map,tp=new Set;function fo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Qi=j.d;j.d={f:V0,r:X0,D:P0,C:Z0,L:Q0,m:W0,X:ev,S:J0,M:tv};function V0(){var e=Qi.f(),t=no();return e||t}function X0(e){var t=xi(e);t!==null&&t.tag===5&&t.type==="form"?yh(t):Qi.r(e)}var Yl=typeof document>"u"?null:document;function np(e,t,n){var l=Yl;if(l&&typeof t=="string"&&t){var o=Oe(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),tp.has(o)||(tp.add(o),e={rel:e,crossOrigin:n,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),un(t,"link",e),St(t),l.head.appendChild(t)))}}function P0(e){Qi.D(e),np("dns-prefetch",e,null)}function Z0(e,t){Qi.C(e,t),np("preconnect",e,t)}function Q0(e,t,n){Qi.L(e,t,n);var l=Yl;if(l&&e&&t){var o='link[rel="preload"][as="'+Oe(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Oe(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Oe(n.imageSizes)+'"]')):o+='[href="'+Oe(e)+'"]';var u=o;switch(t){case"style":u=$l(e);break;case"script":u=ql(e)}ii.has(u)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ii.set(u,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(Ys(u))||t==="script"&&l.querySelector($s(u))||(t=l.createElement("link"),un(t,"link",e),St(t),l.head.appendChild(t)))}}function W0(e,t){Qi.m(e,t);var n=Yl;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Oe(l)+'"][href="'+Oe(e)+'"]',u=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=ql(e)}if(!ii.has(u)&&(e=v({rel:"modulepreload",href:e},t),ii.set(u,e),n.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector($s(u)))return}l=n.createElement("link"),un(l,"link",e),St(l),n.head.appendChild(l)}}}function J0(e,t,n){Qi.S(e,t,n);var l=Yl;if(l&&e){var o=si(l).hoistableStyles,u=$l(e);t=t||"default";var g=o.get(u);if(!g){var x={loading:0,preload:null};if(g=l.querySelector(Ys(u)))x.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ii.get(u))&&Hu(e,n);var T=g=l.createElement("link");St(T),un(T,"link",e),T._p=new Promise(function(U,X){T.onload=U,T.onerror=X}),T.addEventListener("load",function(){x.loading|=1}),T.addEventListener("error",function(){x.loading|=2}),x.loading|=4,ho(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:x},o.set(u,g)}}}function ev(e,t){Qi.X(e,t);var n=Yl;if(n&&e){var l=si(n).hoistableScripts,o=ql(e),u=l.get(o);u||(u=n.querySelector($s(o)),u||(e=v({src:e,async:!0},t),(t=ii.get(o))&&Uu(e,t),u=n.createElement("script"),St(u),un(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function tv(e,t){Qi.M(e,t);var n=Yl;if(n&&e){var l=si(n).hoistableScripts,o=ql(e),u=l.get(o);u||(u=n.querySelector($s(o)),u||(e=v({src:e,async:!0,type:"module"},t),(t=ii.get(o))&&Uu(e,t),u=n.createElement("script"),St(u),un(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(o,u))}}function ip(e,t,n,l){var o=(o=He.current)?fo(o):null;if(!o)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=$l(n.href),n=si(o).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=$l(n.href);var u=si(o).hoistableStyles,g=u.get(e);if(g||(o=o.ownerDocument||o,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,g),(u=o.querySelector(Ys(e)))&&!u._p&&(g.instance=u,g.state.loading=5),ii.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ii.set(e,n),u||nv(o,e,n,g.state))),t&&l===null)throw Error(r(528,""));return g}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ql(n),n=si(o).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function $l(e){return'href="'+Oe(e)+'"'}function Ys(e){return'link[rel="stylesheet"]['+e+"]"}function ap(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function nv(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),un(t,"link",n),St(t),e.head.appendChild(t))}function ql(e){return'[src="'+Oe(e)+'"]'}function $s(e){return"script[async]"+e}function lp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Oe(n.href)+'"]');if(l)return t.instance=l,St(l),l;var o=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),St(l),un(l,"style",o),ho(l,n.precedence,e),t.instance=l;case"stylesheet":o=$l(n.href);var u=e.querySelector(Ys(o));if(u)return t.state.loading|=4,t.instance=u,St(u),u;l=ap(n),(o=ii.get(o))&&Hu(l,o),u=(e.ownerDocument||e).createElement("link"),St(u);var g=u;return g._p=new Promise(function(x,T){g.onload=x,g.onerror=T}),un(u,"link",l),t.state.loading|=4,ho(u,n.precedence,e),t.instance=u;case"script":return u=ql(n.src),(o=e.querySelector($s(u)))?(t.instance=o,St(o),o):(l=n,(o=ii.get(u))&&(l=v({},n),Uu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),St(o),un(o,"link",l),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,ho(l,n.precedence,e));return t.instance}function ho(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,u=o,g=0;g<l.length;g++){var x=l[g];if(x.dataset.precedence===t)u=x;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Uu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var mo=null;function sp(e,t,n){if(mo===null){var l=new Map,o=mo=new Map;o.set(n,l)}else o=mo,l=o.get(n),l||(l=new Map,o.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),o=0;o<n.length;o++){var u=n[o];if(!(u[ji]||u[jt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var g=u.getAttribute(t)||"";g=e+g;var x=l.get(g);x?x.push(u):l.set(g,[u])}}return l}function rp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function iv(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function op(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function av(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=$l(l.href),u=t.querySelector(Ys(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=po.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,St(u);return}u=t.ownerDocument||t,l=ap(l),(o=ii.get(o))&&Hu(l,o),u=u.createElement("link"),St(u);var g=u;g._p=new Promise(function(x,T){g.onload=x,g.onerror=T}),un(u,"link",l),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=po.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Ku=0;function lv(e,t){return e.stylesheets&&e.count===0&&bo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&bo(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Ku===0&&(Ku=62500*U0());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&bo(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Ku?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function po(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var go=null;function bo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,go=new Map,t.forEach(sv,e),go=null,po.call(e))}function sv(e,t){if(!(t.state.loading&4)){var n=go.get(e);if(n)var l=n.get(null);else{n=new Map,go.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var g=o[u];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),l=g)}l&&n.set(null,l)}o=t.instance,g=o.getAttribute("data-precedence"),u=n.get(g)||l,u===l&&n.set(null,o),n.set(g,o),this.count++,l=po.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var qs={$$typeof:G,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function rv(e,t,n,l,o,u,g,x,T){this.tag=1,this.containerInfo=e,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=ta(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ta(0),this.hiddenUpdates=ta(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function cp(e,t,n,l,o,u,g,x,T,U,X,Q){return e=new rv(e,t,n,g,T,U,X,Q,x),t=1,u===!0&&(t|=24),u=Un(3,null,null,t),e.current=u,u.stateNode=e,t=vc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:n,cache:t},Cc(u),e}function up(e){return e?(e=Cl,e):Cl}function dp(e,t,n,l,o,u){o=up(o),l.context===null?l.context=o:l.pendingContext=o,l=pa(t),l.payload={element:n},u=u===void 0?null:u,u!==null&&(l.callback=u),n=ga(e,l,t),n!==null&&(Ln(n,e,t),Ts(n,e,t))}function fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Fu(e,t){fp(e,t),(e=e.alternate)&&fp(e,t)}function hp(e){if(e.tag===13||e.tag===31){var t=qa(e,67108864);t!==null&&Ln(t,e,67108864),Fu(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=Yn();t=vn(t);var n=qa(e,t);n!==null&&Ln(n,e,t),Fu(e,t)}}var yo=!0;function ov(e,t,n,l){var o=A.T;A.T=null;var u=j.p;try{j.p=2,Iu(e,t,n,l)}finally{j.p=u,A.T=o}}function cv(e,t,n,l){var o=A.T;A.T=null;var u=j.p;try{j.p=8,Iu(e,t,n,l)}finally{j.p=u,A.T=o}}function Iu(e,t,n,l){if(yo){var o=Gu(l);if(o===null)Nu(e,t,l,vo,n),gp(e,l);else if(dv(o,e,t,n,l))l.stopPropagation();else if(gp(e,l),t&4&&-1<uv.indexOf(e)){for(;o!==null;){var u=xi(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var g=Tn(u.pendingLanes);if(g!==0){var x=u;for(x.pendingLanes|=2,x.entangledLanes|=2;g;){var T=1<<31-ft(g);x.entanglements[1]|=T,g&=~T}Ni(u),(st&6)===0&&(eo=ce()+500,Ks(0))}}break;case 31:case 13:x=qa(u,2),x!==null&&Ln(x,u,2),no(),Fu(u,2)}if(u=Gu(l),u===null&&Nu(e,t,l,vo,n),u===o)break;o=u}o!==null&&l.stopPropagation()}else Nu(e,t,l,null,n)}}function Gu(e){return e=hn(e),Yu(e)}var vo=null;function Yu(e){if(vo=null,e=vi(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return vo=e,null}function pp(e){switch(e){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(Me()){case Ie:return 2;case E:return 8;case ue:case ve:return 32;case Be:return 268435456;default:return 32}default:return 32}}var $u=!1,Ea=null,Na=null,ka=null,Vs=new Map,Xs=new Map,Ra=[],uv="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 gp(e,t){switch(e){case"focusin":case"focusout":Ea=null;break;case"dragenter":case"dragleave":Na=null;break;case"mouseover":case"mouseout":ka=null;break;case"pointerover":case"pointerout":Vs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xs.delete(t.pointerId)}}function Ps(e,t,n,l,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:u,targetContainers:[o]},t!==null&&(t=xi(t),t!==null&&hp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function dv(e,t,n,l,o){switch(t){case"focusin":return Ea=Ps(Ea,e,t,n,l,o),!0;case"dragenter":return Na=Ps(Na,e,t,n,l,o),!0;case"mouseover":return ka=Ps(ka,e,t,n,l,o),!0;case"pointerover":var u=o.pointerId;return Vs.set(u,Ps(Vs.get(u)||null,e,t,n,l,o)),!0;case"gotpointercapture":return u=o.pointerId,Xs.set(u,Ps(Xs.get(u)||null,e,t,n,l,o)),!0}return!1}function bp(e){var t=vi(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,hl(e.priority,function(){mp(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,hl(e.priority,function(){mp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function xo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Gu(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);us=l,n.target.dispatchEvent(l),us=null}else return t=xi(n),t!==null&&hp(t),e.blockedOn=n,!1;t.shift()}return!0}function yp(e,t,n){xo(e)&&n.delete(t)}function fv(){$u=!1,Ea!==null&&xo(Ea)&&(Ea=null),Na!==null&&xo(Na)&&(Na=null),ka!==null&&xo(ka)&&(ka=null),Vs.forEach(yp),Xs.forEach(yp)}function wo(e,t){e.blockedOn===t&&(e.blockedOn=null,$u||($u=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,fv)))}var So=null;function vp(e){So!==e&&(So=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){So===e&&(So=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],o=e[t+2];if(typeof l!="function"){if(Yu(l||n)===null)continue;break}var u=xi(n);u!==null&&(e.splice(t,3),t-=3,Gc(u,{pending:!0,data:o,method:n.method,action:l},l,o))}}))}function Vl(e){function t(T){return wo(T,e)}Ea!==null&&wo(Ea,e),Na!==null&&wo(Na,e),ka!==null&&wo(ka,e),Vs.forEach(t),Xs.forEach(t);for(var n=0;n<Ra.length;n++){var l=Ra[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ra.length&&(n=Ra[0],n.blockedOn===null);)bp(n),n.blockedOn===null&&Ra.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var o=n[l],u=n[l+1],g=o[Zt]||null;if(typeof u=="function")g||vp(n);else if(g){var x=null;if(u&&u.hasAttribute("formAction")){if(o=u,g=u[Zt]||null)x=g.formAction;else if(Yu(o)!==null)continue}else x=g.action;typeof x=="function"?n[l+1]=x:(n.splice(l,3),l-=3),vp(n)}}}function xp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(g){return o=g})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function qu(e){this._internalRoot=e}Co.prototype.render=qu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,l=Yn();dp(n,l,e,t,null,null)},Co.prototype.unmount=qu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dp(e.current,2,null,e,null,null),no(),t[On]=null}};function Co(e){this._internalRoot=e}Co.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ra.length&&t!==0&&t<Ra[n].priority;n++);Ra.splice(n,0,e),n===0&&bp(e)}};var wp=i.version;if(wp!=="19.2.8")throw Error(r(527,wp,"19.2.8"));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=y(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var hv={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var To=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!To.isDisabled&&To.supportsFiber)try{gn=To.inject(hv),Ct=To}catch{}}return Qs.createRoot=function(e,t){if(!c(e))throw Error(r(299));var n=!1,l="",o=Nh,u=kh,g=Rh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=cp(e,1,!1,null,null,n,l,null,o,u,g,xp),e[On]=t.current,Eu(e),new qu(t)},Qs.hydrateRoot=function(e,t,n){if(!c(e))throw Error(r(299));var l=!1,o="",u=Nh,g=kh,x=Rh,T=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=cp(e,1,!0,t,n??null,l,o,T,u,g,x,xp),t.context=up(null),n=t.current,l=Yn(),l=vn(l),o=pa(l),o.callback=null,ga(n,o,l),n=l,t.current.lanes=n,$n(t,n),Ni(t),e[On]=t.current,Eu(e),new Co(t)},Qs.version="19.2.8",Qs}var Ep;function Tv(){if(Ep)return Xu.exports;Ep=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(i){console.error(i)}}return a(),Xu.exports=Cv(),Xu.exports}var Mv=Tv();const Av=Hg(Mv),xe={ESC:"\x1B",TAB:" ",SHIFT_TAB:"\x1B[Z",ENTER:"\r",BACKSPACE:"",UP:"\x1B[A",DOWN:"\x1B[B",RIGHT:"\x1B[C",LEFT:"\x1B[D",HOME:"\x1B[H",END:"\x1B[F",PAGE_UP:"\x1B[5~",PAGE_DOWN:"\x1B[6~",INSERT:"\x1B[2~",DELETE:"\x1B[3~",CTRL_C:"",CTRL_D:"",CTRL_Z:"",CTRL_L:"\f",CTRL_A:"",CTRL_E:"",CTRL_K:"\v",CTRL_R:"",CTRL_W:"",CTRL_U:"",CTRL_X:"",CTRL_N:"",CTRL_P:"",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},Ev=new TextEncoder;function Dd(a){return Ev.encode(a)}function Kg(a){if(!a||a.length===0)return"";const s=a.toUpperCase().charCodeAt(0);return s>=65&&s<=90?String.fromCharCode(s-64):a==="@"||a===" "?"\0":a==="["?"\x1B":a==="\\"?"":a==="]"?"":a==="^"?"":a==="_"?"":a==="?"?"":a}function Nv(a){return`\x1B${a}`}function Np({ctrl:a,alt:i,shift:s}){return 1+(s?1:0)+(i?2:0)+(a?4:0)}const Fg=/^\x1b[[O]([ABCDHF])$/,Ig=/^\x1bO([PQRS])$/,Gg=/^\x1b\[(\d+)~$/;function Bo(a,i){const{ctrl:s=!1,alt:r=!1,shift:c=!1}=i;if(!s&&!r&&!c)return a;const d=Np(i),h=r&&!s&&!c,m=Fg.exec(a);if(m)return`\x1B[1;${d}${m[1]}`;const p=Ig.exec(a);if(p)return`\x1B[1;${d}${p[1]}`;const y=Gg.exec(a);if(y)return`\x1B[${y[1]};${d}~`;switch(a){case xe.TAB:return c&&!s&&!r?xe.SHIFT_TAB:h?`\x1B${a}`:`\x1B[9;${d}u`;case xe.SHIFT_TAB:return!s&&!r?a:`\x1B[9;${Np({...i,shift:!0})}u`;case xe.ENTER:return h?`\x1B${a}`:`\x1B[13;${d}u`;case xe.BACKSPACE:return s&&!r&&!c?"\b":h?`\x1B${a}`:`\x1B[127;${d}u`;case xe.ESC:return h?`\x1B${a}`:`\x1B[27;${d}u`}let b=a;return c&&a.length===1&&!s&&(b=a.toUpperCase()),s&&(b=Kg(b)),r&&(b=Nv(b)),b}function kv(a){return[...a].length===1?!0:Fg.test(a)||Ig.test(a)||Gg.test(a)||a===xe.SHIFT_TAB}const Yg=27,$g=91,Rv=60,kp=59,qg=77,Vg=48,Lv=57,_v=64,jv=-30,Qu=32,Rp=255;function Xg(a){return Number.isInteger(a)&&(a&jv)===_v}function Dv(a){return a>=Vg&&a<=Lv}function Wu(a,i){let s=i,r=0;for(;s<a.length&&Dv(a[s]);){if(r=r*10+(a[s]-Vg),r>65535)return null;s+=1}return s===i?null:{value:r,next:s}}function Ov(a,i){if(a[i]!==Yg||a[i+1]!==$g||a[i+2]!==Rv)return-1;const s=Wu(a,i+3);if(!s||!Xg(s.value)||a[s.next]!==kp)return-1;const r=Wu(a,s.next+1);if(!r||a[r.next]!==kp)return-1;const c=Wu(a,r.next+1);return!c||a[c.next]!==qg?-1:c.next+1}function zv(a,i){if(a[i]!==Yg||a[i+1]!==$g||a[i+2]!==qg||i+6>a.length)return-1;const s=a[i+3]-Qu,r=a[i+4],c=a[i+5];return!Xg(s)||r<Qu||r>Rp||c<Qu||c>Rp?-1:i+6}function Ho(a){if(!a)return!1;const i=a instanceof Uint8Array?a:new Uint8Array(a);if(i.length===0)return!1;let s=0;for(;s<i.length;){const r=Ov(i,s);if(r>s){s=r;continue}const c=zv(i,s);if(c>s){s=c;continue}return!1}return!0}const Bv=3e3,Hv=1e4,Uv=1500;class Kv{constructor(i){Z(this,"ws",null);Z(this,"config");Z(this,"state","disconnected");Z(this,"currentRole","viewer");Z(this,"controllerId");Z(this,"hostId");Z(this,"assignedClientId");Z(this,"reconnectAttempts",0);Z(this,"reconnectTimer",null);Z(this,"pingTimer",null);Z(this,"pingTimestamp",null);Z(this,"lastInboundAt",0);Z(this,"pingSentAt",null);Z(this,"connectStartedAt",0);Z(this,"lastWakeConnectAt",0);Z(this,"probeTimer",null);Z(this,"rejectedByRelay",!1);Z(this,"isManuallyClosed",!1);Z(this,"authFailureDetail",null);Z(this,"authFailureCode",null);Z(this,"temporaryFailureCode",null);Z(this,"pendingInputSegments",[]);Z(this,"isFlushScheduled",!1);Z(this,"listeners",{stateChange:new Set,roleChange:new Set,ready:new Set,paired:new Set,controlState:new Set,controlRevoked:new Set,sessionReady:new Set,exit:new Set,controlGranted:new Set,controlDenied:new Set,status:new Set,peerCount:new Set,hostReconnecting:new Set,sessionRestarted:new Set,error:new Set,binaryData:new Set,rttUpdate:new Set,pasteFileReady:new Set,agentStatus:new Set,updateStatus:new Set,terminalFont:new Set,hostFontChunk:new Set,hostFontSubset:new Set});Z(this,"terminalCols",80);Z(this,"terminalRows",24);this.config={...i}}updateConfig(i){this.config={...this.config,...i}}getConfig(){return{...this.config}}getState(){return this.state}getRole(){return this.currentRole}getControllerId(){return this.controllerId}getHostId(){return this.hostId}getAssignedClientId(){return this.assignedClientId}on(i,s){return this.listeners[i].add(s),()=>{this.listeners[i].delete(s)}}emit(i,...s){this.listeners[i].forEach(c=>{try{c(...s)}catch(d){console.error(`Error in event listener for ${i}:`,d)}})}setState(i,s,r){this.state!==i&&(this.state=i,this.emit("stateChange",i,s,r))}connect(i){if(i&&(this.terminalCols=i.cols,this.terminalRows=i.rows),!(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))){this.teardownSocket(1e3,"Replaced by a new connection"),this.isManuallyClosed=!1,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.rejectedByRelay=!1,this.clearTimers(),this.setState("connecting");try{const s=this.resolveWsUrl(this.config.wsUrl),r=new WebSocket(s);this.ws=r,this.connectStartedAt=Date.now(),r.binaryType="arraybuffer",r.onopen=()=>{this.isStaleSocket(r)||this.handleOpen()},r.onmessage=c=>{this.isStaleSocket(r)||this.handleMessage(c)},r.onerror=c=>{this.isStaleSocket(r)||this.handleError(c)},r.onclose=c=>{this.isStaleSocket(r)||this.handleClose(c)}}catch(s){this.setState("error",s instanceof Error?s.message:"Connection failed","connection_failed"),this.scheduleReconnect()}}}isStaleSocket(i){return this.ws!==i}teardownSocket(i=1e3,s="Client closed the connection"){this.pendingInputSegments=[],this.isFlushScheduled=!1;const r=this.ws;if(r){this.ws=null,r.onopen=null,r.onmessage=null,r.onerror=null,r.onclose=null;try{(r.readyState===WebSocket.OPEN||r.readyState===WebSocket.CONNECTING)&&r.close(i,s)}catch{}}}disconnect(){this.isManuallyClosed=!0,this.clearTimers(),this.pendingInputSegments=[],this.isFlushScheduled=!1,this.teardownSocket(1e3,"User initiated disconnect"),this.setState("disconnected")}reconnectWith(i){this.updateConfig(i),this.clearTimers(),this.teardownSocket(1e3,"Reconnecting with new credentials"),this.isManuallyClosed=!1,this.reconnectAttempts=0,this.authFailureDetail=null,this.authFailureCode=null,this.temporaryFailureCode=null,this.connect()}wake(i){if(this.isManuallyClosed||!this.config.autoReconnect||this.authFailureDetail||this.rejectedByRelay)return;const s=Date.now(),r=this.ws;if(!r){if(s-this.lastWakeConnectAt<Uv)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>Hv&&this.dropStaleSocket("connection_stalled");return}r.readyState===WebSocket.OPEN&&s-this.lastInboundAt>this.pingIntervalMs()+2e3&&this.probeLiveness()}pingIntervalMs(){return this.config.pingIntervalMs||1e4}probeLiveness(){const i=this.ws;if(!i||i.readyState!==WebSocket.OPEN||this.probeTimer)return;const s=Date.now();this.sendPing(),this.probeTimer=setTimeout(()=>{this.probeTimer=null,this.ws===i&&this.lastInboundAt<s&&this.dropStaleSocket("connection_stale")},Bv)}dropStaleSocket(i){this.clearTimers(),this.teardownSocket(4e3,"Connection went silent"),this.setState("reconnecting","The connection went silent. Reconnecting...",i),this.reconnectAttempts=0,this.lastWakeConnectAt=Date.now(),this.connect()}handleOpen(){this.lastInboundAt=Date.now(),this.sendHello(),this.startHeartbeat()}async handleMessage(i){if(this.lastInboundAt=Date.now(),typeof i.data=="string")try{const s=JSON.parse(i.data);this.processJsonMessage(s)}catch(s){console.warn("Received unparseable text frame from server:",s)}else if(i.data instanceof ArrayBuffer)this.emit("binaryData",new Uint8Array(i.data));else if(typeof Blob<"u"&&i.data instanceof Blob)try{const s=await i.data.arrayBuffer();this.emit("binaryData",new Uint8Array(s))}catch(s){console.error("Failed to convert Blob to ArrayBuffer:",s)}}processJsonMessage(i){switch(i.type){case"ready":{this.reconnectAttempts=0,this.setState("connected"),this.currentRole=i.role,this.controllerId=i.controllerId,this.hostId=i.hostId,this.assignedClientId=i.clientId,this.emit("ready",i),this.emit("roleChange",i.role,i.controllerId,i.hostId,i.clientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount),this.emit("terminalFont",i.terminalFont??null);break}case"paired":{this.emit("paired",{token:i.token,deviceId:i.deviceId,hostId:i.hostId,expiresAt:i.expiresAt});break}case"control_state":{this.currentRole=i.role,this.controllerId=i.controllerId,this.emit("controlState",i.role,i.controllerId),this.emit("roleChange",i.role,i.controllerId,this.hostId,this.assignedClientId),typeof i.clientCount=="number"&&this.emit("peerCount",i.clientCount);break}case"host_reconnecting":{this.temporaryFailureCode="host_reconnecting",this.setState("reconnecting","Herdr host is reconnecting",i.code||"host_reconnecting"),this.emit("hostReconnecting",i.code);break}case"session_restarted":{this.setState("reconnecting","Herdr session is restarting","session_restarted"),this.emit("sessionRestarted",i.cols,i.rows,i.terminalPalette,i.hostname),this.emit("terminalFont",i.terminalFont??null);break}case"control_revoked":{this.currentRole="viewer",this.emit("controlRevoked",i.reason),this.emit("roleChange","viewer",this.controllerId,this.hostId,this.assignedClientId);break}case"session_ready":{this.setState("connected"),this.emit("sessionReady",i);break}case"exit":{this.emit("exit",i.code,i.reason);break}case"control_granted":{this.currentRole="controller",this.controllerId=this.assignedClientId||this.config.clientId,this.emit("controlGranted"),this.emit("roleChange","controller",this.controllerId,this.hostId,this.assignedClientId);break}case"control_denied":{this.emit("controlDenied",i.message);break}case"status":{this.emit("status",i);break}case"error":{i.code==="host_offline"||i.code==="host_reconnecting"||i.code==="host_reconnect_timeout"||i.code==="rate_limited"?(this.temporaryFailureCode=String(i.code),this.setState("reconnecting",i.message,String(i.code))):(i.code==="auth_required"||i.code==="unauthorized"||i.code==="device_revoked"||i.code==="invalid_handshake"||i.code==="too_many_hosts"||i.code===401||i.code===403)&&(this.authFailureDetail=i.message,this.authFailureCode=String(i.code),this.setState("error",i.message,this.authFailureCode)),this.emit("error",{code:i.code,message:i.message});break}case"pong":{if(this.pingTimestamp){const s=Math.max(0,performance.now()-this.pingTimestamp);this.pingTimestamp=null,this.emit("rttUpdate",Math.round(s))}break}case"paste_file_ready":{this.emit("pasteFileReady",i.path);break}case"agent_status":{this.emit("agentStatus",i);break}case"update_status":{this.emit("updateStatus",i);break}case"terminal_font":{this.emit("terminalFont",i.terminalFont??null);break}case"host_font_chunk":{this.emit("hostFontChunk",i);break}case"host_font_subset_ready":{this.emit("hostFontSubset",i);break}}}handleError(i){console.error("WebSocket error:",i),this.emit("error",{code:"WS_ERROR",message:"WebSocket connection error"})}handleClose(i){if(this.clearTimers(),this.ws=null,this.authFailureDetail){this.setState("error",this.authFailureDetail,this.authFailureCode??void 0);return}if(i.code===1008&&this.temporaryFailureCode){this.setState("reconnecting",i.reason||"The relay is temporarily unavailable",this.temporaryFailureCode),this.scheduleReconnect();return}if(i.code===1008){this.rejectedByRelay=!0,this.setState("error",i.reason||"The relay rejected the connection",String(i.code));return}!this.isManuallyClosed&&this.config.autoReconnect?(this.setState("reconnecting",`Connection closed (${i.code}). Retrying...`,"connection_closed"),this.scheduleReconnect()):this.setState("disconnected",`Closed: ${i.reason||i.code}`,"connection_closed")}scheduleReconnect(){if(this.isManuallyClosed||!this.config.autoReconnect)return;if(this.config.maxReconnectAttempts>0&&this.reconnectAttempts>=this.config.maxReconnectAttempts){this.setState("error","Max reconnect attempts reached");return}this.reconnectAttempts++;const i=this.config.reconnectIntervalMs||2e3,r=Math.min(3e4,Math.floor(i*Math.pow(1.5,this.reconnectAttempts-1)+Math.random()*500));this.reconnectTimer=setTimeout(()=>{this.connect()},r)}startHeartbeat(){this.pingTimer&&clearInterval(this.pingTimer);const i=this.pingIntervalMs();this.pingSentAt=null,this.pingTimer=setInterval(()=>{if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN)){if(this.pingSentAt!==null&&this.lastInboundAt<this.pingSentAt&&Date.now()-this.pingSentAt>=i){this.probeLiveness();return}this.sendPing()}},i)}clearTimers(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=null),this.probeTimer&&(clearTimeout(this.probeTimer),this.probeTimer=null)}sendHello(){const i={type:"hello",protocol:1,clientId:this.config.clientId,cols:this.terminalCols,rows:this.terminalRows,capabilities:["host_handoff"]};this.config.token&&(i.token=this.config.token),this.config.pairCode&&(i.pairCode=this.config.pairCode),this.sendJson(i)}claimControl(i=!1){const s={type:"claim_control",...i?{force:!0}:{}};this.sendJson(s)}releaseControl(){const i={type:"release_control"};this.sendJson(i)}sendResize(i,s){this.terminalCols=i,this.terminalRows=s;const r={type:"resize",cols:i,rows:s};this.sendJson(r)}sendPing(){this.pingTimestamp=performance.now(),this.pingSentAt=Date.now();const i={type:"ping"};this.sendJson(i)}sendPasteFile(i,s){this.sendJson({type:"paste_file",mime:i,dataBase64:s})}sendHostFontChunkRequest(i,s){this.sendJson({type:"host_font_chunk_request",sha256:i,index:s})}sendHostFontSubsetRequest(i,s,r){this.sendJson({type:"host_font_subset_request",sha256:i,text:s,requestId:r})}sendHostFontRefresh(){this.sendJson({type:"host_font_refresh"})}sendHerdrStart(){this.sendJson({type:"herdr_start"})}sendJson(i){this.flushInput(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(i))}sendInput(i){const s=i instanceof Uint8Array?i:new Uint8Array(i);s.length!==0&&(this.pendingInputSegments.push(s),this.isFlushScheduled||(this.isFlushScheduled=!0,queueMicrotask(()=>this.flushInput())))}flushInput(){if(this.isFlushScheduled=!1,this.pendingInputSegments.length===0)return;let i=this.pendingInputSegments;if(this.pendingInputSegments=[],this.ws&&(this.ws.bufferedAmount??0)>256*1024&&(i=i.filter(r=>!Ho(r))),i.length===0)return;let s;if(i.length===1)s=i[0];else{let r=0;for(let d=0;d<i.length;d++)r+=i[d].byteLength;s=new Uint8Array(r);let c=0;for(let d=0;d<i.length;d++)s.set(i[d],c),c+=i[d].byteLength}this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(s)}sendBinary(i){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(i)}sendText(i){const s=Dd(i);this.sendInput(s)}resolveWsUrl(i){if(/^wss?:\/\//i.test(i))return i;if(/^https?:\/\//i.test(i)){const s=new URL(i);return s.protocol=s.protocol==="https:"?"wss:":"ws:",(!s.pathname||s.pathname==="/")&&(s.pathname="/ws/client"),s.toString()}if(typeof window<"u"&&window.location){const r=window.location.protocol==="https:"?"wss:":"ws:",c=window.location.host,d=i.startsWith("/")?i:`/${i}`;return`${r}//${c}${d}`}return"ws://127.0.0.1:8787/ws/client"}}function Fv(a,i=window,s=document){const r=y=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&a.wake(y)},c=()=>{s.visibilityState==="visible"&&r("visible")},d=()=>r("pageshow"),h=()=>r("online"),m=()=>r("focus"),p=()=>r("resume");return s.addEventListener("visibilitychange",c),s.addEventListener("resume",p),i.addEventListener("pageshow",d),i.addEventListener("online",h),i.addEventListener("focus",m),()=>{s.removeEventListener("visibilitychange",c),s.removeEventListener("resume",p),i.removeEventListener("pageshow",d),i.removeEventListener("online",h),i.removeEventListener("focus",m)}}const Iv=10,Gv=24,fr=15,Uo=13,Od=640;function Yv(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&(window.matchMedia("(pointer: coarse)").matches||window.matchMedia("(hover: none)").matches))return!0}catch{}return Jl()<Od}function Jl(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Ju(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function is(a,i=fr){const s=typeof a=="number"?a:Number(a);return!Number.isFinite(s)||s<=0?i:Math.min(Gv,Math.max(Iv,Math.round(s)))}function Lp(a,i=Jl()){if(i<Od){const r=is(a,Uo);return Math.min(15,Math.max(12,r))}return is(a,fr)}const Pg=[{id:"esc",label:"ESC",code:xe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:xe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"left",label:"←",code:xe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:xe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:xe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:xe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"enter",label:"Enter",code:xe.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],$v=[{id:"ctrl",label:"CTRL",code:"",type:"modifier",enabled:!0,modifierType:"ctrl",title:"Toggle Ctrl modifier latch"},{id:"alt",label:"ALT",code:"",type:"modifier",enabled:!0,modifierType:"alt",title:"Toggle Alt modifier latch"},{id:"shift",label:"SHIFT",code:"",type:"modifier",enabled:!0,modifierType:"shift",title:"Toggle Shift modifier latch"},{id:"meta",label:"META",code:"\x1B",type:"modifier",enabled:!0,modifierType:"meta",title:"Meta / Cmd key"},{id:"esc",label:"ESC",code:xe.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:xe.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:xe.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:xe.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:xe.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:xe.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:xe.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:xe.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:xe.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:xe.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:xe.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:xe.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:xe.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:xe.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:xe.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:xe.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:xe.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:xe.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:xe.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:xe.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:xe.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:xe.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:xe.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:xe.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:xe.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:xe.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:xe.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:xe.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:xe.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:xe.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:xe.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:xe.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:xe.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:xe.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:xe.F12,type:"fn",enabled:!0,title:"F12"},{id:"drawer_chords",label:"^C",code:"",type:"drawer",enabled:!0,drawerType:"chords",title:"Quick Ctrl Chords"},{id:"drawer_symbols",label:"~|/",code:"",type:"drawer",enabled:!0,drawerType:"symbols",title:"Special Symbols"},{id:"drawer_fn",label:"Fn",code:"",type:"drawer",enabled:!0,drawerType:"fn",title:"Function Keys (F1-F12)"},{id:"sym_pipe",label:"|",code:"|",type:"symbol",enabled:!0,isPlainChar:!0,title:"Pipe (|)"},{id:"sym_tilde",label:"~",code:"~",type:"symbol",enabled:!0,isPlainChar:!0,title:"Tilde (~)"},{id:"sym_slash",label:"/",code:"/",type:"symbol",enabled:!0,isPlainChar:!0,title:"Slash (/)"},{id:"sym_backslash",label:"\\",code:"\\",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backslash (\\)"},{id:"sym_dash",label:"-",code:"-",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dash (-)"},{id:"sym_underscore",label:"_",code:"_",type:"symbol",enabled:!0,isPlainChar:!0,title:"Underscore (_)"},{id:"sym_dollar",label:"$",code:"$",type:"symbol",enabled:!0,isPlainChar:!0,title:"Dollar ($)"},{id:"sym_ampersand",label:"&",code:"&",type:"symbol",enabled:!0,isPlainChar:!0,title:"Ampersand (&)"},{id:"sym_quote",label:'"',code:'"',type:"symbol",enabled:!0,isPlainChar:!0,title:'Double Quote (")'},{id:"sym_backtick",label:"`",code:"`",type:"symbol",enabled:!0,isPlainChar:!0,title:"Backtick (`)"}];function hr(){return JSON.parse(JSON.stringify(Pg))}const qv=[["esc","tab","shift_tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","enter","drawer_chords","drawer_symbols","drawer_fn"],["esc","tab","ctrl","alt","left","up","down","right","drawer_chords","drawer_symbols","drawer_fn","enter"],["esc","tab","ctrl","alt","left","up","down","right","drawer_agent","drawer_symbols","drawer_fn","enter"]];function Vv(a){return qv.some(i=>a.length===i.length&&a.every((s,r)=>s.id===i[r]&&s.enabled!==!1))}function Xv(a){if(!Array.isArray(a)||a.length===0)return hr();const i=a.filter(s=>typeof s=="object"&&s!==null&&typeof s.id=="string"&&typeof s.label=="string"&&typeof s.code=="string");return Vv(i)?hr():i.filter(s=>s.id!=="drawer_agent")}function wd(a,i){if(i){const s=`keyTitles.${a.id}`,r=i(s);if(r&&r!==s)return r}return a.title||a.label}class Ri extends Error{constructor(s,r={}){super(s);Z(this,"code");Z(this,"params");this.name="KeyComboError",this.code=s,this.params=r}}const Pv={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},_p={esc:xe.ESC,tab:xe.TAB,enter:xe.ENTER,backspace:xe.BACKSPACE,delete:xe.DELETE,left:xe.LEFT,right:xe.RIGHT,up:xe.UP,down:xe.DOWN,home:xe.HOME,end:xe.END,pageup:xe.PAGE_UP,pagedown:xe.PAGE_DOWN,insert:xe.INSERT,space:" ","+":"+"},Zv={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},Qv={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Zg(a,i){const s=a.toLowerCase().split("+");if(s.some(p=>!p))throw new Ri("invalidStepSyntax",{step:i+1});const r={};let c;for(const p of s)if(p==="ctrl"||p==="control"){if(r.ctrl)throw new Ri("duplicateModifier",{step:i+1,modifier:"Ctrl"});r.ctrl=!0}else if(p==="alt"||p==="option"){if(r.alt)throw new Ri("duplicateModifier",{step:i+1,modifier:"Alt"});r.alt=!0}else if(p==="shift"){if(r.shift)throw new Ri("duplicateModifier",{step:i+1,modifier:"Shift"});r.shift=!0}else if(c===void 0)c=p;else throw new Ri("multipleKeys",{step:i+1});if(!c)throw new Ri("missingKey",{step:i+1});const d=Pv[c]||c,h=/^f(?:[1-9]|1[0-2])$/.exec(d);let m;if(h)m=xe[d.toUpperCase()];else if(Object.hasOwn(_p,d))m=_p[d];else if([...d].length===1&&/^[\x21-\x7e]$/.test(d))m=d;else throw new Ri("unsupportedKey",{step:i+1,key:d});return{key:m,keyName:d,modifiers:r,sequence:Jv(m,d,r)}}function Wv(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function jp(a,i){const s=[...a][0].codePointAt(0);return s===void 0?"":`\x1B[${s};${Wv(i)}u`}function Jv(a,i,s){if(!s.ctrl)return Bo(a,s);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const r=i.toLowerCase();if(s.alt||s.shift||r==="m"||r==="i")return jp(r,s);if(r==="-"||r==="/"||r==="_")return"";const c=Kg(r);return c!==r?c:jp(r,s)}return Bo(a,s)}function Li(a){if(typeof a!="string"||!a.trim())throw new Ri("empty");const i=a.trim().split(/\s+/);if(i.length>8)throw new Ri("tooManySteps",{count:8});return i.map((s,r)=>Zg(s,r).sequence)}function rr(a){const i=a.trim().split(/\s+/);return i.length>1&&i.every(s=>["esc","escape"].includes(s.toLowerCase()))?`ESC${Qv[i.length]||` ×${i.length}`}`:i.map((s,r)=>{const{keyName:c,modifiers:d}=Zg(s,r),h=Zv[c]||(/^f\d+$/.test(c),c.toUpperCase());return d.ctrl&&d.alt&&d.shift?`Ctrl+Alt+⇧${h}`:d.ctrl&&d.alt?`Ctrl+Alt+${h}`:d.ctrl&&d.shift?`^⇧${h}`:d.ctrl?`^${h}`:d.alt&&d.shift?`Alt+⇧${h}`:d.alt?`Alt+${h}`:d.shift?`⇧${h}`:h}).join(" ")}const Qg="host",ex='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',tx='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',nx="JetBrains Mono, Menlo, Monaco, Consolas, monospace",ix={[ex]:"host",[tx]:"host",[nx]:"host",'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace':"system",'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace':"system",'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace':"system",'"Courier New", Courier, "Symbols Nerd Font Mono", monospace':"system",'"Fira Code", "Symbols Nerd Font Mono", monospace':"fira-code"};function ed(a){return typeof a!="string"||!a.trim()?Qg:ix[a]??a}const es="herdr_remote_settings_v1",cr="herdr_remote_session_view_v1",Wg=64,mr=4096,Sd={local:{},session:{}};function pr(a,i){if(typeof window>"u")return Sd[a][i]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return Sd[a][i]||null}}function za(a,i,s){if(Sd[a][i]=s,!(typeof window>"u"))try{(a==="local"?window.localStorage:window.sessionStorage).setItem(i,s)}catch(r){console.warn(`Failed to write to ${a}Storage:`,r)}}const Jg="herdr-remote.ignoredUpdate";function ax(){return pr("local",Jg)}function lx(a){za("local",Jg,a)}function sx(){return`client-${Math.random().toString(36).substring(2,8)}`}function zd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function rx(a,i){return(typeof a=="string"?a.trim().slice(0,Wg):"")||i}function Ko(a,i){if(!a||typeof a!="object"||Array.isArray(a))return null;const s=a,r=typeof s.wsUrl=="string"?s.wsUrl.trim().slice(0,2048):"",c=typeof s.token=="string"?s.token.slice(0,mr):"",d=typeof s.pairCode=="string"?s.pairCode.trim().toUpperCase().slice(0,32):"";if(!r||!r.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(r)||!c&&!d)return null;const h=Date.now(),m=typeof s.id=="string"&&s.id.length>0?s.id.slice(0,128):zd(),p=typeof s.hostname=="string"&&s.hostname.trim()?s.hostname.trim().slice(0,Wg):`Herdr ${i+1}`;return{id:m,displayName:rx(s.displayName,p),wsUrl:r,token:c,...d?{pairCode:d}:{},...typeof s.hostId=="string"&&s.hostId.trim()?{hostId:s.hostId.trim().slice(0,128)}:{},...typeof s.hostname=="string"&&s.hostname.trim()?{hostname:s.hostname.trim().slice(0,128)}:{},...typeof s.deviceId=="string"&&s.deviceId.trim()?{deviceId:s.deviceId.trim().slice(0,128)}:{},autoReconnect:s.autoReconnect!==!1,createdAt:Number.isFinite(s.createdAt)?Number(s.createdAt):h,lastUsedAt:Number.isFinite(s.lastUsedAt)?Number(s.lastUsedAt):h}}function Dp(a,i=0){const s=Ko({...a,id:a.id||zd()},i);if(!s)throw new Error("a connection profile requires a relay URL and token or pairing code");return s}function Op(a){let i=a.wsUrl.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"").toLowerCase();if(typeof window<"u")try{const s=new URL(a.wsUrl,window.location.origin);s.protocol=s.protocol==="wss:"?"https:":"http:",s.pathname=s.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"")||"/",s.search="",s.hash="",i=s.toString().replace(/\/$/,"").toLowerCase()}catch{}return`${i}::${a.hostId||""}`}function eb(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function tb(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:sx(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?Uo:fr,fontSizeFollowsHost:!0,fontFamily:Qg,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:eb(),virtualKeys:hr(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const ox=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],cx=["wsUrl","token","pairCode","autoReconnect"],Bd=["fontSize","fontSizeFollowsHost","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],ux=Bd.filter(a=>a!=="adminToken"&&a!=="adminTokens"),zp=["theme","colorMode"];function Cd(a){const i=a;if(!zp.some(c=>i[c]!==void 0))return{data:a,changed:!1};const r={...i};for(const c of zp)delete r[c];return{data:r,changed:!0}}function nb(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i={};for(const[s,r]of Object.entries(a).slice(0,32))typeof r!="string"||r.length===0||(i[s.slice(0,512)]=r.slice(0,mr));return i}function ib(a){if(!a||typeof a!="object"||Array.isArray(a))return{};const i=Object.create(null);for(const[s,r]of Object.entries(a).slice(0,32)){if(!/^[a-z][a-z0-9_-]{0,31}$/i.test(s)||["__proto__","constructor","prototype"].includes(s)||!r||typeof r!="object"||Array.isArray(r))continue;const c=r,d={};if(Array.isArray(c.order)&&(d.order=[...new Set(c.order.filter(h=>typeof h=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(h)))].slice(0,256)),c.actions&&typeof c.actions=="object"&&!Array.isArray(c.actions)){const h=Object.create(null);for(const[m,p]of Object.entries(c.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(m)||!p||typeof p!="object"||Array.isArray(p))continue;const y=p,b={};if(typeof y.keys=="string"&&y.keys.trim()){const v=y.keys.trim().slice(0,80);try{Li(v),b.keys=v}catch{}}typeof y.hidden=="boolean"&&(b.hidden=y.hidden),Object.keys(b).length>0&&(h[m]=b)}d.actions=h}if(Array.isArray(c.custom)){const h=new Set;d.custom=c.custom.slice(0,64).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const p=m;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||h.has(p.id))return[];if(typeof p.label!="string"||!p.label.trim()||typeof p.keys!="string"||!p.keys.trim())return[];const y=p.keys.trim().slice(0,80);try{Li(y)}catch{return[]}return h.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:y}]})}i[s]=d}return i}function ab(a){var d;const i=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((h,m)=>{const p=Ko(h,m);p&&!i.some(y=>y.id===p.id)&&i.push(p)}),i.length===0&&(typeof a.token=="string"&&a.token||typeof a.pairCode=="string"&&a.pairCode)){const h=Ko({id:"profile-migrated",displayName:"Herdr 1",wsUrl:typeof a.wsUrl=="string"&&a.wsUrl.trim()?a.wsUrl:"/ws/client",token:a.token||"",pairCode:a.pairCode||"",autoReconnect:a.autoReconnect!==!1},0);h&&i.push(h)}const r=typeof a.activeProfileId=="string"?a.activeProfileId:"",c=i.some(h=>h.id===r)?r:((d=i[0])==null?void 0:d.id)||"";return{profiles:i,activeProfileId:c}}function lb(){const a=tb();if(typeof window>"u")return a;let i={};const s=pr("local",es);if(s)try{i=JSON.parse(s)}catch(ie){console.warn("Failed to parse localStorage settings:",ie)}const r=Cd(i);r.changed&&(i=r.data,za("local",es,JSON.stringify(i)));let c=null;const d=pr("session",cr);if(d)try{c=JSON.parse(d)}catch(ie){console.warn("Failed to parse sessionStorage settings:",ie)}if(!c){const ie={};for(const de of Bd)i[de]!==void 0&&(ie[de]=i[de]);c=ie,za("session",cr,JSON.stringify(c))}const h=ed(c.fontFamily??i.fontFamily??a.fontFamily),m=window.innerWidth<640?Uo:fr,p=c.fontSize??i.fontSize??a.fontSize,y=is(p,m),b=c.fontSizeFollowsHost??i.fontSizeFollowsHost,v=typeof b=="boolean"?b:p===void 0||y===fr||y===Uo,S=c.virtualKeys??i.virtualKeys??a.virtualKeys,M=Xv(S),N=i.language??a.language,q=N==="zh"||N==="en"?N:eb(),R=ab(i),D=R.profiles.find(ie=>ie.id===R.activeProfileId),B=Cd(c);B.changed&&(c=B.data,za("session",cr,JSON.stringify(c)));const G=c.toolbarVisible??i.toolbarVisible??a.toolbarVisible,le=c.toolbarPosition??i.toolbarPosition??a.toolbarPosition,fe=c.vibrateOnKeyPress??i.vibrateOnKeyPress??a.vibrateOnKeyPress,te=ie=>{const de=c[ie]??i[ie];return typeof de=="boolean"?de:a[ie]},F=(c==null?void 0:c.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??a.predictiveEcho,I=F==="always"||F==="off"||F==="auto"?F:"auto",me=typeof c.adminToken=="string"?c.adminToken.slice(0,mr):typeof i.adminToken=="string"?i.adminToken.slice(0,mr):a.adminToken,be=nb(c.adminTokens),Ne={...a,...i,...c,wsUrl:(D==null?void 0:D.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:a.wsUrl),token:(D==null?void 0:D.token)||"",pairCode:(D==null?void 0:D.pairCode)||"",autoReconnect:(D==null?void 0:D.autoReconnect)??a.autoReconnect,profiles:R.profiles,activeProfileId:R.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):a.clientId,fontFamily:h,fontSize:y,fontSizeFollowsHost:v,toolbarVisible:G,toolbarPosition:le,vibrateOnKeyPress:fe,predictiveEcho:I,virtualKeys:M,agentKeymaps:ib(i.agentKeymaps),agentAlertBadge:te("agentAlertBadge"),agentAlertSound:te("agentAlertSound"),agentAlertVibrate:te("agentAlertVibrate"),agentAlertNotify:te("agentAlertNotify"),language:q,adminToken:me,adminTokens:be};return typeof i.fontFamily=="string"&&ed(i.fontFamily)!==i.fontFamily&&(i.fontFamily=ed(i.fontFamily),za("local",es,JSON.stringify(i))),Ne}function _a(a){var S;const s={...lb(),...a};s.agentKeymaps=ib(s.agentKeymaps),s.adminTokens=nb(s.adminTokens),typeof s.adminToken=="string"&&(s.adminToken=s.adminToken.slice(0,mr)),a.fontSize!==void 0&&(s.fontSize=is(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?s.predictiveEcho=a.predictiveEcho:s.predictiveEcho="auto");const r=ab(s);let c=r.profiles,d=r.activeProfileId;if(cx.some(M=>a[M]!==void 0)){const M=c.findIndex(R=>R.id===d),N=M>=0?{...c[M]}:{id:zd(),displayName:`Herdr ${c.length+1}`,wsUrl:s.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};N.wsUrl=s.wsUrl,N.token=s.token,N.pairCode=s.pairCode||void 0,N.autoReconnect=s.autoReconnect,N.lastUsedAt=Date.now();const q=Ko(N,Math.max(M,0));q?M>=0?c[M]=q:(c.push(q),d=q.id):M>=0&&(c=c.filter(R=>R.id!==d),d=((S=c[0])==null?void 0:S.id)||"")}c.length>0&&!c.some(M=>M.id===d)&&(d=c[0].id);const m=c.find(M=>M.id===d);s.profiles=c,s.activeProfileId=d,s.wsUrl=(m==null?void 0:m.wsUrl)||s.wsUrl||"/ws/client",s.token=(m==null?void 0:m.token)||"",s.pairCode=(m==null?void 0:m.pairCode)||"",s.autoReconnect=(m==null?void 0:m.autoReconnect)??s.autoReconnect;const p=pr("local",es);let y={};if(p)try{y=JSON.parse(p)}catch{}y=Cd(y).data;for(const M of ox)s[M]!==void 0&&(y[M]=s[M]);y.profiles=c,y.activeProfileId=d,za("local",es,JSON.stringify(y));const b=pr("session",cr);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const M of Bd)s[M]!==void 0&&(v[M]=s[M]);za("session",cr,JSON.stringify(v));for(const M of ux)s[M]!==void 0&&(y[M]=s[M]);return za("local",es,JSON.stringify(y)),s}const dx={header:{appName:"Herdr",tagline:"remote terminal client",terminalTab:"Terminal",adminTab:"Admin",rttMs:"{rtt}ms",hostLabel:"Host",clientIdLabel:"ID:",copyClientIdTitle:"Click to copy Client ID",languageToggleTitle:"Switch language (EN / 中文)",pairingTitle:"Connection & pairing",settingsTitle:"Terminal settings",virtualKeyboardTitle:"Quick command helper",latencyTitle:"Round-trip latency (RTT)",mainNavigationAria:"Main Navigation",actionKeyboard:"cmd",actionPairing:"link",actionSettings:"cfg",languageShort:"en"},common:{connecting:"Connecting...",connected:"Connected",reconnecting:"Reconnecting...",disconnected:"Disconnected",error:"Error",save:"Save",cancel:"Cancel",close:"Close",done:"Done",retry:"Retry",connect:"Connect",disconnect:"Disconnect",copy:"Copy",copied:"Copied",loading:"Loading...",offline:"Offline",role:"Role",host:"Host",status:"Status",settings:"Settings",admin:"Admin",terminal:"Terminal",pairing:"Pairing",keyBar:"Key bar",quickInput:"Quick input",dismissNotification:"Dismiss notification",closeDialog:"Close dialog",clickToCopy:"Click to copy",controller:"Controller",viewer:"Viewer",live:"Live"},connection:{live:"Live",connecting:"Connecting",reconnecting:"Reconnecting",reconnectNow:"Reconnect now",error:"Error",offline:"Offline",connect:"Connect",retry:"Retry"},role:{controllerMode:"Controller mode active",viewerMode:"Viewer mode",controlActive:"Full Control",viewerReadOnly:"Viewer",viewerWithController:"Viewer (Active: {controllerId})",sharedControl:"Full control",sharedControlDesc:"Every paired window shares this terminal and may type into it.",sharedWindows:"{count} windows",thisWindow:"Window",claimControl:"Claim Control",claimControlTitle:"Claim terminal control",releaseControl:"Release",releaseControlTitle:"Switch to viewer mode",takeoverControl:"Takeover",takeoverControlTitle:"Take over control from {controllerId}",takeoverModalTitle:"Confirm Control Takeover",takeoverModalDesc:"Another client is controlling this terminal.",takeoverModalWarning:"Input focus will transfer to this window.",confirmTakeover:"Confirm Takeover"},statusBanner:{connecting:"Connecting to relay...",reconnectingDefault:"Connection lost. Reconnecting...",reconnectNow:"Reconnect Now",errorDefault:"Unable to connect to relay",disconnected:"Terminal disconnected"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ restart for {version}",toast:"herdr-remote {version} is out for this workstation",toastRestart:"herdr-remote {version} is installed; restart it to apply",title:"herdr-remote update",running:"Running",installed:"Installed",latest:"Latest",restartPending:"{version} is installed but not running yet. Restart herdr-remote on the workstation:",stepTui:'On the workstation, open herdr-remote (the TUI), go to "Language & about" and press Enter on the update row.',stepCli:"Or run on the workstation:",restartNote:"Restarting reconnects this window after a few seconds.",ignore:"Skip this version"},herdrLaunch:{title:"Herdr is not running",body:"Herdr is not running on {host}. Start it on that workstation?",scope:"Only this paired workstation's own Herdr starts, as that workstation's user. No other machine is touched.",start:"Start Herdr",starting:"Starting Herdr on {host}…",failedTitle:"Herdr did not start",timeout:"The workstation did not answer within 30 seconds. Its herdr-remote may be too old to start Herdr from a browser.",thisHost:"this workstation"},onboarding:{title:"Pair with Herdr Remote",subtitle:"Connect your mobile or browser to your local terminal session",description:"Control Herdr sessions from any browser or phone.",firstTimeSetup:"First-time Setup",authRequired:"Authorization Required",authRequiredDesc:"Pair your device or provide a valid access token.",step1Title:"Generate Pairing Code on Host",step1Desc:"Run on the host running Herdr:",step1TuiNote:"Interactive TUI config:",step2Title:"Enter 6-character Pairing Code",step2Placeholder:"e.g. 7X9K2A",step2Note:"Pairing code expires in 5 minutes; credentials are saved automatically.",connectAndPair:"Connect & Pair",connectingAndPairing:"Pairing with Relay...",advancedTitle:"Advanced Options",manualTokenLabel:"Authentication Token",manualTokenPlaceholder:"Optional token (skips pairing code)",wsEndpointLabel:"Relay WebSocket Endpoint",wsEndpointPlaceholder:"/ws/client or wss://your-relay-host/ws/client",clientIdLabel:"Device Client Identifier"},pairing:{title:"Relay Connection & Pairing",addTitle:"Add Herdr Instance",displayNameLabel:"Host Name",displayNamePlaceholder:"e.g. Workstation",displayNameHelp:"This name is stored only in this browser.",credentialsRequired:"Enter a pairing code or device token.",subtitle:"Manage WebSocket endpoints and credentials",pairCodeLabel:"Pairing Code",pairCodeNote:"(6-char code)",pairCodePlaceholder:"e.g. A1B2C3",pairCodeHelp:'Run "herdr-remote pair" on host.',tokenLabel:"Access Token",tokenNote:"(Device secret)",tokenPlaceholder:"Device token...",wsUrlLabel:"Relay WebSocket Endpoint URL",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:"Defaults to same-origin /ws/client",clientIdLabel:"Client Identifier",newIdButton:"New ID",regenerateClientIdTitle:"Regenerate client ID",autoReconnectLabel:"Auto-reconnect",autoReconnectDesc:"Automatically reconnect when disconnected",copyDirectLink:"Copy direct pairing link",saveAndConnect:"Save & Connect"},settings:{title:"Terminal Preferences",subtitle:"Font, size, and touch settings",tabGeneral:"General",tabAppearance:"Appearance & Font",tabVirtualKeys:"Virtual Keys",tabAgentKeymaps:"Agent Keys",fontFamilyLabel:"Monospace Font",fontSizeLabel:"Terminal Text Size ({size}px)",fontSizeCompact:"10px (Compact)",fontSizeDefault:"15px (Default)",fontSizeLarge:"24px (Large)",mobileFontNote:"Terminal font scales automatically on small screens for 80-column layout.",colorPassthroughNote:"Terminal colors and cursor style pass through from the host.",predictiveEchoLabel:"Predictive Echo",predictiveEchoAuto:"Auto",predictiveEchoAlways:"Always On",predictiveEchoOff:"Off",predictiveEchoDesc:"Under high latency, show what you type in a shell prompt or an agent’s input box before the echo comes back. Menus and other screens are never predicted.",touchKeyToolbar:"Touch Key Toolbar",touchKeyToolbarDesc:"Show modifier and navigation keys",touchHaptics:"Haptic Feedback",touchHapticsDesc:"Vibrate on key press",agentAlertsLabel:"Agent alerts",agentAlertBadge:"Title and icon badge",agentAlertBadgeDesc:"Count blocked and finished agents in the tab title, and mark the tab icon",agentAlertVibrate:"Vibrate",agentAlertVibrateDesc:"When an agent stops to ask or finishes, while this page is on screen",agentAlertSound:"Chime",agentAlertSoundDesc:"A short sound while this page is in the background; starts working after your next tap",agentAlertNotify:"System notification",agentAlertNotifyDesc:"While this page is in the background (HTTPS only)",languageLabel:"Language",languageDesc:"Choose English or 简体中文",resetDefaults:"Reset to Defaults",resetDefaultsToast:"Settings reset to defaults",windowZoomSharedNote:"Host view isolation is not active; zoom applies locally.",fontSizeZoomHelp:"Adjusts font size in this window only.",fontSizeFollowHost:"Same size as the workstation terminal ({size}px)",fontSizeFollowHostUnknown:"Same size as the workstation terminal (not reported)",hostFontSync:"Sync host font",hostGlyphLine:"CJK: {family} · {status}",hostGlyphStatus:{none:"",checking:"Checking…",installed:"Installed on this device",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading common characters",ready:"{count} characters on this device; others load as they appear",failed:"Could not be loaded"},hostFontStatus:{none:"The workstation did not report its terminal font",checking:"Checking…",installed:"Installed on this device",loaded:"Loaded from the workstation",available:"Not loaded",declined:"Not loaded — using this device’s fonts",loading:"Loading {percent}%",failed:"Could not be loaded",unavailable:"No font file to load; drawn by name where installed"}},agentKeymaps:{keymapLabel:"Keymap",auto:"Auto",shell:"Shell",agentGroup:"Agent",genericGroup:"General",settingsProfileLabel:"Agent profile",autoProfile:"Auto · {profile}",pinnedProfile:"Pinned · {profile}",barGroup:"Key bar",barHint:"Tap to choose which {profile} shortcuts appear on the key bar ({count} shown). Saved in this browser, per agent. ESC, arrows and other base keys are on the Virtual Keys tab.",restoreBar:"Restore default keys",customizeBar:"Choose which shortcuts the key bar shows",customizeBarShort:"Edit",shortcutLabel:"Shortcut",comboPlaceholder:"e.g. ctrl+e or esc esc",invalidCombo:"Invalid shortcut: {error}",defaultCombo:"Default: {combo}",resetAction:"Reset",moveUp:"Move up",moveDown:"Move down",unverified:"Unverified",addCustom:"Custom key",customLabel:"Function name",customCombo:"Key combo",addAction:"Add custom key",restoreProfile:"Restore this agent defaults",removeCustom:"Remove custom key",configHint:"Agent config: {path}",noAgentActions:"No agent-specific shortcuts.",errors:{empty:"Enter at least one key.",tooManySteps:"A shortcut can have at most {count} steps.",invalidStepSyntax:"Step {step} has invalid syntax. Use ctrl+o or esc esc.",duplicateModifier:"Step {step} repeats {modifier}.",missingKey:"Step {step} needs a key after the modifiers.",multipleKeys:"Step {step} can have only one key.",unsupportedKey:"Step {step} does not support “{key}”."}},agentActions:{mode:"Mode",rewind:"Rewind",details:"Details",model:"Model",thinking:"Thinking",todos:"Tasks",background:"Background",editor:"Editor",history:"History",stash:"Stash",pasteImage:"Paste image",newline:"New line",interrupt:"Interrupt",editPrevious:"Edit previous",queue:"Queue prompt",copy:"Copy",clear:"Clear",yolo:"YOLO mode",expand:"Expand",undo:"Undo",agent:"Next agent",agentBack:"Previous agent",palette:"Command palette",recentModel:"Recent model",variant:"Model variant",newSession:"New session",sessions:"Sessions",thinkingMode:"Thinking mode",nextModel:"Next model",modelPicker:"Model picker",tools:"Tools",thinkingBlocks:"Thinking blocks",followup:"Follow-up",dequeue:"Remove from queue",plan:"Plan mode",temporaryModel:"Temporary model",expandAll:"Expand all",reasoning:"Reasoning effort",review:"Review",specMode:"Spec mode",autonomy:"Autonomy",undoPicker:"Undo picker",steer:"Steer",sidebar:"Sidebar",agents:"Agents",permissionMode:"Permission mode",bypass:"Bypass permissions",tasks:"Tasks",interject:"Interject",multiline:"Multiline input",shortcuts:"Shortcuts",approve:"Approve",eof:"End of input",suspend:"Suspend",startOfLine:"Line start",endOfLine:"Line end",killToEnd:"Delete to line end",agentSwap:"Switch agent",activity:"Activity",planAct:"Plan / Act",autoApprove:"Auto-approve",search:"Search"},virtualKeyboard:{collapseToolbar:"Collapse Toolbar",expandToolbar:"Expand Toolbar",helperTitle:"Quick Commands",closeHelper:"Close Helper",placeholder:"Type command and press Enter...",sendButton:"Send",clearInput:"Clear Input",customizeTitle:"Custom Key Toolbar",customizeDesc:"Reorder, enable, or disable keys for your toolbar.",enabledKeysCount:"{count} keys enabled",resetLayout:"Reset to Default",addKey:"Add Key",availableKeys:"Available Keys",moveUp:"Move Up",moveDown:"Move Down",enableKey:"Enable Key",disableKey:"Disable Key",deleteKeyTitle:"Remove Key",keyTypeModifier:"Modifier",keyTypeNav:"Navigation",keyTypeAction:"Action",keyTypeChord:"Chord",keyTypeFn:"Function",keyTypeSymbol:"Symbol",fnDrawerTitle:"Function Keys (F1-F12)",chordsDrawerTitle:"Control Chords (^C, ^D, ^Z)",symbolsDrawerTitle:"Symbols (~, |, /, \\)",touchKeyboardShortcuts:"Shortcuts Toolbar",ctrlCTitle:"Ctrl+C (SIGINT)",ctrlDTitle:"Ctrl+D (EOF)",ctrlZTitle:"Ctrl+Z (SIGTSTP)",ctrlLTitle:"Ctrl+L (Clear)",ctrlRTitle:"Ctrl+R (Search)",ctrlATitle:"Ctrl+A (Start of line)",ctrlETitle:"Ctrl+E (End of line)",ctrlKTitle:"Ctrl+K (Kill to end)",badgeSigint:"SIGINT",badgeEof:"EOF",badgeTstp:"SIGTSTP",badgeClear:"CLEAR",badgeSearch:"SEARCH",badgeStart:"START",badgeEnd:"END",badgeKill:"KILL",keyEnter:"Enter",uploadImage:"Upload Image",uploadImageTitle:"Select and upload image to terminal",image:"Image",uploadProgressReading:"Reading...",uploadProgressProcessing:"Compressing...",uploadProgressSending:"Uploading...",uploadProgressWaitingHost:"Waiting for host...",uploadProgressCompleted:"Completed",uploadProgressFailed:"Upload failed"},profiles:{title:"Herdr instances",switcherLabel:"Switch Herdr instance",current:"current",empty:"No paired Herdr instances yet.",addHost:"Add Herdr instance",rename:"Rename instance",remove:"Remove locally",removeConfirm:"Remove this saved connection from this browser?"},mobile:{sessionControls:"Session controls",closeSessionControls:"Close session controls",connectionStatusAria:"Connection status",terminalControlAria:"Terminal control",inputControl:"Input control",settingsAria:"Terminal settings",adminAria:"Admin dashboard",pairingAria:"Connection & pairing",keybarAria:"Toggle key toolbar",quickInputAria:"Toggle quick commands",menu:"Menu",statusBarAria:"Session status bar"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"Connected to Herdr session.",windowAriaLabel:"Terminal Window",bufferAriaLabel:"Terminal Buffer",offlineStatusAria:"Offline Status",releaseControlAria:"Release Control",takeoverControlAria:"Takeover Control",claimControlAria:"Claim Control"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab (Claude Code: cycle modes)",ctrl:"Toggle Ctrl Lock",alt:"Toggle Alt Lock",shift:"Toggle Shift Lock",meta:"Meta / Cmd",enter:"Enter",backspace:"Backspace",delete:"Delete",left:"Left (←)",up:"Up (↑)",down:"Down (↓)",right:"Right (→)",home:"Home",end:"End",page_up:"Page Up",page_down:"Page Down",insert:"Insert",drawer_chords:"Ctrl Chords",drawer_agent:"Agent shortcuts",drawer_symbols:"Symbols",drawer_fn:"Function Keys (F1-F12)",ctrl_c:"Ctrl+C (SIGINT)",ctrl_d:"Ctrl+D (EOF)",ctrl_z:"Ctrl+Z (SIGTSTP)",ctrl_l:"Ctrl+L (Clear)",ctrl_a:"Ctrl+A (Start of line)",ctrl_e:"Ctrl+E (End of line)",ctrl_k:"Ctrl+K (Kill to end)",ctrl_r:"Ctrl+R (Search history)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"Pipe (|)",sym_tilde:"Tilde (~)",sym_slash:"Slash (/)",sym_backslash:"Backslash (\\)",sym_dash:"Dash (-)",sym_underscore:"Underscore (_)",sym_dollar:"Dollar ($)",sym_ampersand:"Ampersand (&)",sym_quote:'Quote (")',sym_backtick:"Backtick (`)"},admin:{title:"Admin Dashboard",subtitle:"Connected hosts, paired devices, and relay traffic",returnToTerminal:"Return to Terminal",terminalShells:"Terminal Shells",startedAt:"Started at {time}",accessPanel:"Access",acrossWindows:"across {count} windows",perSecond:"{value}/s",framesPerSecond:"{count} fps",unitDay:"d",unitHour:"h",unitMinute:"m",unitSecond:"s",startedRecently:"Started recently",updatedAt:"Updated at {time}",autoRefresh:"Auto Refresh:",paused:"Paused",refreshNow:"Refresh",connectedHosts:"Connected Hosts",activeUsers:"Active Users",activePtys:"Active PTYs",activeController:"Active Controller",uptime:"Uptime",none:"None",noHost:"No host connected",tabOverview:"Overview",tabClients:"Clients ({count})",tabPtys:"PTY Sessions ({count})",tabDevices:"Paired Devices ({count})",throughput:"Throughput",bytesInTotal:"Total Inbound:",bytesOutTotal:"Total Outbound:",frameRate:"Frame Rate:",hostsTitle:"Hosts ({count})",noHosts:"No hosts connected or paired",hostConnectedDevices:"{count} connected",hostPairedDevices:"{count} paired",hostStatusOnline:"Online",hostStatusBusy:"In use",hostStatusReconnecting:"Reconnecting",hostStatusOffline:"Offline",hostRosterOperatorOnly:"Device list is visible to the relay operator only.",connectedClientsTitle:"Connected Clients ({count})",noClients:"No clients connected",colClientId:"Client ID",colDevice:"Device",colDeviceId:"Device ID",colLastSeen:"Last Seen",colActions:"Actions",unknownDevice:"Unknown Device",pairedDevicesTitle:"Paired Devices ({count})",noDevices:"No paired devices",revokeDevice:"Revoke",revokeConfirm:"Confirm Revocation",revokeFailed:"Revocation failed",colRole:"Role",colIp:"IP Address",colConnectedAt:"Connected At",colTraffic:"Traffic (In/Out)",activePtysTitle:"Active PTY Sessions ({count})",noPtys:"No active PTY sessions",colPtyId:"PTY ID",colPid:"PID",colCommand:"Command",colGrid:"Grid",colCwd:"Working Directory",colViewers:"Windows",copiedJson:"Copied",unauthorizedTitle:"Unauthorized (401/403)",unauthorizedDesc:"GET /api/status requires an authorized device token.",pairingStepsTitle:"Device Pairing:",pairingStepsHelp:"Run pairing command on host to get a code, then enter it here.",enterPairCodeBtn:"Enter Pairing Code",retryFetchBtn:"Retry Status",errorConnecting:"Failed to fetch GET /api/status: {error}",loadingStatus:"Loading status from /api/status...",remoteRelayTitle:"Remote Relay Administration",remoteRelayBadge:"Connected to Remote Relay",remoteRelayNotice:"Connected to remote relay. For server metrics, access the operator dashboard.",remoteRelayEndpoint:"Remote WebSocket Endpoint:",remoteRelayAdminUrl:"Remote Admin URL:",openRemoteAdminBtn:"Open Remote Admin",remoteRelayHelp:"Open remote relay admin dashboard.",relayAdminTitle:"Relay Operator Dashboard",relayAdminTokenLabel:"Relay Admin Token (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"Enter RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"RELAY_ADMIN_TOKEN is not configured on this relay.",relayAdminLoginBtn:"Verify & View Metrics",relayAdminAuthError:"Invalid or unauthorized admin token.",remoteRelayClientNotice:"Terminal client connection. For server metrics, use the operator dashboard.",openOperatorPortal:"Open Operator Dashboard",localWorkstationBadge:"Local Relay",modeLocal:"Local Mode",modeRemote:"Remote Mode",hintTabs:"switch tabs",hintRefresh:"refresh status",hintBack:"return to terminal"},toasts:{connected:"Connected to relay",connectionError:"Connection error",controlGranted:"Control granted",controlDenied:"Request denied: another controller is active",controlRevoked:"Control transferred to another device",pairedSuccess:"Paired successfully",sessionEnded:"Session ended",controlReleased:"Control released",viewerModeWarning:'In viewer mode. Click "Claim Control" first.',clientIdCopied:"Client ID copied: {id}",pairingLinkCopied:"Pairing link copied",switchedLanguage:"Language switched to {lang}",settingsReset:"Settings reset to default",fontReset:"Font reset to default",commandCopied:"Command copied",keyLayoutReset:"Key layout reset"},shortcuts:{title:"Shortcuts",help:"Active outside terminal input area:",terminalInputNote:"Terminal shortcuts pass directly to host PTY."},serverErrors:{auth_required:"Pairing required: enter a pairing code, or a device token that is still valid.",unauthorized:"This device is not authorised for that workstation.",host_offline:"The paired workstation is not connected to this relay.",host_disconnected:"The workstation disconnected.",stale_host:"The workstation stopped answering and was dropped.",too_many_clients:"That workstation has reached its window limit.",rate_limited:"Too many pairing attempts. Wait a minute and try again.",invalid_handshake:"The relay rejected the handshake. Reload the page.",device_revoked:"This device was revoked by the relay operator.",connection_closed:"Connection closed. Reconnecting…",connection_stale:"The connection went quiet while the page was away. Reconnecting…",connection_stalled:"Connecting took too long. Trying again…",connection_failed:"Could not open a connection to the relay.",host_reconnecting:"The Herdr host is reconnecting.",host_reconnect_timeout:"The Herdr host did not reconnect in time.",host_replaced:"The Herdr host connection was replaced.",slow_client:"This browser was disconnected because it could not keep up.",client_send_failed:"The relay could not send data to this browser.",too_many_hosts:"This relay has reached its host limit.",paste_file_unsupported:"Unsupported image format for paste.",paste_file_too_large:"Pasted image exceeds 3 MB limit.",paste_file_write_failed:"Failed to save pasted image on host.",paste_file_empty:"Pasted image payload is empty.",paste_file_corrupt:"Pasted image data is corrupt or does not match declared MIME.",viewer_mode:"Viewer mode cannot paste to terminal.",no_session:"Terminal session is not ready."},fontPresets:{host:"Workstation terminal font (default)",system:"System monospace"},hostFont:{title:"Workstation terminal font",body:"The terminal on {host} uses {family}{detail}. This device does not have it.",bodyGlyphsOnly:"The terminal on {host} draws Chinese with {family}. This device does not have it.",glyphs:"Chinese in {family}: about 2 MB of common characters first; any other character loads the first time it appears.",glyphsAll:"{family} is too large to send whole: about 2 MB of common characters first; any other character loads the first time it appears.",detail:" ({detail})",detailSeparator:", ",download:"Load {count} font file(s), {size} in total. Downloaded once, then kept in this browser.",load:"Load font",decline:"Use this device’s fonts",loading:"Loading {received} of {total}",failed:"The font could not be loaded: {reason}",loaded:"Workstation font loaded",reasons:{host_font_unavailable:"the font changed on the workstation. Sync it again from Settings",host_font_timeout:"the workstation stopped answering",disconnected:"the connection dropped",font_api_unavailable:"this browser cannot load fonts",other:"the browser could not read the font file"}},agents:{title:"Agents on this workstation",blocked:"blocked",done:"done",working:"working",allIdle:"agents idle",notifyBlocked:"{count} agent(s) waiting for you",notifyDone:"{count} agent(s) finished"},clipboard:{openLink:"Open Link",openLinkFailed:"This link cannot be opened from the browser",copySelection:"Copy Selection",copyLine:"Copy Line",copyScreen:"Copy Screen",paste:"Paste",cancel:"Cancel",copied:"Copied to clipboard",copyFailed:"Failed to copy",pasteHint:"Long-press here to paste, then tap Send",pasteSend:"Send",pasteUnavailable:"Clipboard is empty or unavailable",pasteTitle:"Paste Content",pasted:"Pasted",chooseImage:"Choose Image",takePhoto:"Take Photo",imageTooLarge:"Image exceeds 3 MB limit and cannot be compressed further.",imageCompressedSize:"Compressed: {size}",fileEmpty:"File is empty.",decodeFailed:"Failed to decode image file.",unsupportedType:"Unsupported format. Only PNG, JPEG, WebP, and GIF are supported.",imageSectionTitle:"Image",textSectionTitle:"Text",imageCompressing:"Processing image...",removeImage:"Remove image"}},fx={header:{appName:"Herdr",tagline:"远程终端客户端",terminalTab:"终端",adminTab:"管理面板",rttMs:"{rtt}ms",hostLabel:"主机",clientIdLabel:"客户端 ID:",copyClientIdTitle:"点击复制客户端 ID",languageToggleTitle:"切换语言 (EN / 中文)",pairingTitle:"连接与配对",settingsTitle:"终端设置",virtualKeyboardTitle:"快捷命令",latencyTitle:"网络延迟 (RTT)",mainNavigationAria:"主导航菜单",actionKeyboard:"命令",actionPairing:"配对",actionSettings:"设置",languageShort:"中"},common:{connecting:"连接中...",connected:"已连接",reconnecting:"重连中...",disconnected:"已断开",error:"错误",save:"保存",cancel:"取消",close:"关闭",done:"完成",retry:"重试",connect:"连接",disconnect:"断开连接",copy:"复制",copied:"已复制",loading:"加载中...",offline:"离线",role:"角色",host:"主机",status:"连接状态",settings:"设置",admin:"管理面板",terminal:"终端",pairing:"配对",keyBar:"按键条",quickInput:"快捷输入",dismissNotification:"关闭通知",closeDialog:"关闭对话框",clickToCopy:"点击复制",controller:"控制端",viewer:"观察者",live:"运行中"},connection:{live:"在线",connecting:"连接中",reconnecting:"正在重连",reconnectNow:"立即重连",error:"连接错误",offline:"离线",connect:"发起连接",retry:"重试"},role:{controllerMode:"控制模式",viewerMode:"观察者模式",controlActive:"控制端",viewerReadOnly:"观察者",viewerWithController:"观察者(控制者: {controllerId})",sharedControl:"完全控制",sharedControlDesc:"所有已配对窗口共享同一个终端,均可输入。",sharedWindows:"{count} 个窗口",thisWindow:"本窗口",claimControl:"获取控制权",claimControlTitle:"获取终端控制权",releaseControl:"释放控制权",releaseControlTitle:"切回观察者模式",takeoverControl:"强占控制权",takeoverControlTitle:"从 {controllerId} 接管控制权",takeoverModalTitle:"确认接管终端控制权?",takeoverModalDesc:"当前已有其他客户端控制该终端。",takeoverModalWarning:"接管后输入焦点切换至当前窗口。",confirmTakeover:"确认接管"},statusBanner:{connecting:"连接 Relay 服务中...",reconnectingDefault:"连接断开,正在重连...",reconnectNow:"立即重连",errorDefault:"无法连接 Relay 服务",disconnected:"会话已断开"},update:{chip:"↑ herdr-remote {version}",chipCompact:"↑ {version}",chipRestart:"↻ 重启以应用 {version}",toast:"宿主机的 herdr-remote 有新版本 {version}",toastRestart:"herdr-remote {version} 已安装,重启后生效",title:"herdr-remote 更新",running:"正在运行",installed:"已安装",latest:"最新版本",restartPending:"{version} 已安装但尚未运行。在宿主机上重启 herdr-remote:",stepTui:"在宿主机打开 herdr-remote(TUI),进入「语言与关于」,在更新一行按 Enter。",stepCli:"或在宿主机上执行:",restartNote:"重启后这个窗口会在几秒内自动重连。",ignore:"忽略此版本"},herdrLaunch:{title:"Herdr 未运行",body:"{host} 上没有正在运行的 Herdr。要在这台宿主机上启动吗?",scope:"只会以这台已配对宿主机自己的用户身份,启动它自己的 Herdr,不会碰其他任何机器。",start:"启动 Herdr",starting:"正在 {host} 上启动 Herdr…",failedTitle:"Herdr 没有启动",timeout:"宿主机 30 秒内没有回应。它的 herdr-remote 可能版本过旧,不支持从浏览器启动 Herdr。",thisHost:"这台宿主机"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1TuiNote:"交互式 TUI 配置:",step2Title:"输入 6 位配对码",step2Placeholder:"例如:7X9K2A",step2Note:"配对码 5 分钟内有效,连接后自动保存凭据。",connectAndPair:"连接并完成配对",connectingAndPairing:"配对中...",advancedTitle:"高级选项",manualTokenLabel:"认证 Token",manualTokenPlaceholder:"可选 Token(跳过配对码)",wsEndpointLabel:"Relay WebSocket 端点",wsEndpointPlaceholder:"/ws/client 或 wss://relay-host/ws/client",clientIdLabel:"客户端标识 (Client ID)"},pairing:{title:"Relay 连接与配对",addTitle:"添加 Herdr 实例",displayNameLabel:"主机名称",displayNamePlaceholder:"例如:工作电脑",displayNameHelp:"名称仅保存在此浏览器中。",credentialsRequired:"请输入配对码或设备令牌。",subtitle:"管理 WebSocket 服务端点与凭证",pairCodeLabel:"配对码",pairCodeNote:"(6 位代码)",pairCodePlaceholder:"例如:A1B2C3",pairCodeHelp:'在主机运行 "herdr-remote pair" 获取。',tokenLabel:"访问 Token",tokenNote:"(设备凭据)",tokenPlaceholder:"设备 Token...",wsUrlLabel:"Relay WebSocket 端点",wsUrlPlaceholder:"/ws/client",wsUrlDefaultNote:'默认同源端点 "/ws/client"',clientIdLabel:"客户端标识",newIdButton:"生成新 ID",regenerateClientIdTitle:"重新生成客户端 ID",autoReconnectLabel:"掉线自动重连",autoReconnectDesc:"连接断开时自动尝试重连",copyDirectLink:"复制配对链接(含配对码)",saveAndConnect:"保存并连接"},settings:{title:"终端设置",subtitle:"字体、字号与触控管理",tabGeneral:"常规设置",tabAppearance:"终端与字体",tabVirtualKeys:"虚拟按键",tabAgentKeymaps:"智能体按键",fontFamilyLabel:"等宽字体",fontSizeLabel:"终端字号 ({size}px)",fontSizeCompact:"10px (紧凑)",fontSizeDefault:"15px (默认)",fontSizeLarge:"24px (大字号)",mobileFontNote:"小屏设备自动适配字号,保持 80 列完整显示。",colorPassthroughNote:"终端配色与光标样式透传自宿主环境。",predictiveEchoLabel:"预测回显",predictiveEchoAuto:"自动",predictiveEchoAlways:"始终开启",predictiveEchoOff:"关闭",predictiveEchoDesc:"高延迟时,在 shell 提示符或智能体输入框里先行显示输入的字符,回显到达后自动校正。菜单等其他界面不做预测。",touchKeyToolbar:"底部触控按键条",touchKeyToolbarDesc:"显示移动端修饰键与方向键工具栏",touchHaptics:"触控振动反馈",touchHapticsDesc:"移动端按键时轻微震动",agentAlertsLabel:"智能体提醒",agentAlertBadge:"标题与图标角标",agentAlertBadgeDesc:"在标签页标题里显示等待确认和已完成的智能体数量,并在图标上加角标",agentAlertVibrate:"震动",agentAlertVibrateDesc:"智能体停下来等你确认或完成时震动(页面在前台时)",agentAlertSound:"提示音",agentAlertSoundDesc:"页面在后台时播放短提示音;下次点击页面后生效",agentAlertNotify:"系统通知",agentAlertNotifyDesc:"页面在后台时发系统通知(仅 HTTPS)",languageLabel:"显示语言",languageDesc:"选择 English 或 简体中文",resetDefaults:"恢复默认设置",resetDefaultsToast:"设置已恢复默认",windowZoomSharedNote:"当前宿主未启用视图隔离,字号调整仅影响本地窗口。",fontSizeZoomHelp:"仅调节当前窗口字号,不影响其他窗口。",fontSizeFollowHost:"与宿主机终端同字号({size}px)",fontSizeFollowHostUnknown:"与宿主机终端同字号(宿主机未报告)",hostFontSync:"同步宿主机字体",hostGlyphLine:"中文:{family} · {status}",hostGlyphStatus:{none:"",checking:"检查中…",installed:"本机已安装",available:"未加载",declined:"未加载,正在使用本机字体",loading:"正在加载常用字",ready:"本机已有 {count} 字,其余出现时自动补齐",failed:"加载失败"},hostFontStatus:{none:"宿主机未报告终端字体",checking:"检查中…",installed:"本机已安装",loaded:"已从宿主机加载",available:"未加载",declined:"未加载,正在使用本机字体",loading:"加载中 {percent}%",failed:"加载失败",unavailable:"没有可传输的字体文件,已安装该字体的设备按名称显示"}},agentKeymaps:{keymapLabel:"按键方案",auto:"自动",shell:"Shell",agentGroup:"智能体",genericGroup:"通用",settingsProfileLabel:"智能体方案",autoProfile:"自动 · {profile}",pinnedProfile:"固定 · {profile}",barGroup:"按键栏显示",barHint:"点选要在底部按键栏显示的 {profile} 快捷键(已显示 {count} 个)。按智能体分别保存在当前浏览器;ESC、方向键等基础按键在「虚拟按键」页设置。",restoreBar:"恢复默认显示",customizeBar:"自定义按键栏显示哪些快捷键",customizeBarShort:"自定义",shortcutLabel:"快捷键",comboPlaceholder:"例如 ctrl+e 或 esc esc",invalidCombo:"快捷键无效:{error}",defaultCombo:"默认:{combo}",resetAction:"重置",moveUp:"上移",moveDown:"下移",unverified:"未验证",addCustom:"自定义按键",customLabel:"功能名称",customCombo:"按键组合",addAction:"添加自定义按键",restoreProfile:"恢复此智能体默认设置",removeCustom:"删除自定义按键",configHint:"智能体配置:{path}",noAgentActions:"此智能体没有专用快捷键。",errors:{empty:"至少输入一个按键。",tooManySteps:"快捷键最多包含 {count} 个步骤。",invalidStepSyntax:"第 {step} 步格式无效。可输入 ctrl+o 或 esc esc。",duplicateModifier:"第 {step} 步重复使用了 {modifier}。",missingKey:"第 {step} 步需要在修饰键后输入一个按键。",multipleKeys:"第 {step} 步只能包含一个按键。",unsupportedKey:"第 {step} 步不支持按键“{key}”。"}},agentActions:{mode:"模式",rewind:"回退",details:"详情",model:"模型",thinking:"思考",todos:"任务",background:"后台运行",editor:"编辑器",history:"历史",stash:"暂存",pasteImage:"粘贴图片",newline:"换行",interrupt:"中断",editPrevious:"编辑上一条",queue:"排队发送",copy:"复制",clear:"清屏",yolo:"YOLO 模式",expand:"展开",undo:"撤销",agent:"下一个智能体",agentBack:"上一个智能体",palette:"命令面板",recentModel:"最近模型",variant:"模型变体",newSession:"新会话",sessions:"会话列表",thinkingMode:"思考模式",nextModel:"下一个模型",modelPicker:"模型选择器",tools:"工具",thinkingBlocks:"思考内容",followup:"后续提问",dequeue:"移出队列",plan:"计划模式",temporaryModel:"临时模型",expandAll:"全部展开",reasoning:"推理强度",review:"代码审查",specMode:"规格模式",autonomy:"自主模式",undoPicker:"撤销菜单",steer:"引导",sidebar:"侧栏",agents:"智能体列表",permissionMode:"权限模式",bypass:"绕过权限",tasks:"任务",interject:"插话",multiline:"多行输入",shortcuts:"快捷键",approve:"批准",eof:"结束输入",suspend:"挂起",startOfLine:"行首",endOfLine:"行尾",killToEnd:"删除至行尾",agentSwap:"切换智能体",activity:"活动面板",planAct:"计划 / 执行",autoApprove:"自动批准",search:"搜索"},virtualKeyboard:{collapseToolbar:"收起按键栏",expandToolbar:"展开按键栏",helperTitle:"快捷命令",closeHelper:"关闭命令助手",placeholder:"输入终端命令并回车...",sendButton:"发送",clearInput:"清除输入内容",customizeTitle:"自定义虚拟按键",customizeDesc:"调整按键顺序与启禁用状态。",enabledKeysCount:"已启用 {count} 个按键",resetLayout:"恢复默认布局",addKey:"添加按键",availableKeys:"可选按键库",moveUp:"前移",moveDown:"后移",enableKey:"启用按键",disableKey:"禁用按键",deleteKeyTitle:"删除按键",keyTypeModifier:"修饰键",keyTypeNav:"导航键",keyTypeAction:"动作键",keyTypeChord:"组合键",keyTypeFn:"功能键",keyTypeSymbol:"符号",fnDrawerTitle:"功能键 (F1-F12)",chordsDrawerTitle:"控制组合键 (^C, ^D, ^Z)",symbolsDrawerTitle:"终端常用符号 (~, |, /, \\)",touchKeyboardShortcuts:"快捷键工具栏",ctrlCTitle:"Ctrl+C (中断)",ctrlDTitle:"Ctrl+D (退出)",ctrlZTitle:"Ctrl+Z (挂起)",ctrlLTitle:"Ctrl+L (清屏)",ctrlRTitle:"Ctrl+R (搜索)",ctrlATitle:"Ctrl+A (行首)",ctrlETitle:"Ctrl+E (行尾)",ctrlKTitle:"Ctrl+K (剪切)",badgeSigint:"中断",badgeEof:"退出",badgeTstp:"挂起",badgeClear:"清屏",badgeSearch:"搜索",badgeStart:"行首",badgeEnd:"行尾",badgeKill:"剪切",keyEnter:"回车",uploadImage:"上传图片",uploadImageTitle:"选择图片并上传至终端",image:"图片",uploadProgressReading:"读取中...",uploadProgressProcessing:"处理压缩中...",uploadProgressSending:"上传中...",uploadProgressWaitingHost:"等待工作站保存...",uploadProgressCompleted:"完成",uploadProgressFailed:"上传失败"},profiles:{title:"Herdr 实例",switcherLabel:"切换 Herdr 实例",current:"当前",empty:"还没有已配对的 Herdr 实例。",addHost:"添加 Herdr 实例",rename:"重命名实例",remove:"仅本地移除",removeConfirm:"确认从此浏览器移除已保存的连接?"},mobile:{sessionControls:"会话控制",closeSessionControls:"关闭会话控制面板",connectionStatusAria:"连接状态",terminalControlAria:"终端控制权",inputControl:"输入控制权",settingsAria:"终端设置",adminAria:"打开管理面板",pairingAria:"连接与配对设置",keybarAria:"切换触控按键条",quickInputAria:"切换快捷命令",menu:"菜单",statusBarAria:"会话状态栏"},terminal:{bannerTitle:"Herdr Remote WebUI",bannerSubtitle:"已连接至 Herdr 会话。",windowAriaLabel:"远程终端窗口",bufferAriaLabel:"xterm 终端缓冲区",offlineStatusAria:"离线状态",releaseControlAria:"释放终端控制权",takeoverControlAria:"强占终端控制权",claimControlAria:"获取终端控制权"},keyTitles:{esc:"Escape (ESC)",tab:"Tab",shift_tab:"Shift+Tab(Claude Code 切换模式)",ctrl:"切换 Ctrl 锁定",alt:"切换 Alt 锁定",shift:"切换 Shift 锁定",meta:"Meta / 命令键",enter:"回车 (Enter)",backspace:"退格 (Backspace)",delete:"删除 (Delete)",left:"左箭头 (←)",up:"上箭头 (↑)",down:"下箭头 (↓)",right:"右箭头 (→)",home:"行首 (Home)",end:"行尾 (End)",page_up:"向上翻页 (Page Up)",page_down:"向下翻页 (Page Down)",insert:"插入 (Insert)",drawer_chords:"常用 Ctrl 组合键",drawer_agent:"智能体快捷键",drawer_symbols:"常用特殊符号",drawer_fn:"功能键 (F1-F12)",ctrl_c:"Ctrl+C (中断)",ctrl_d:"Ctrl+D (退出)",ctrl_z:"Ctrl+Z (挂起)",ctrl_l:"Ctrl+L (清屏)",ctrl_a:"Ctrl+A (行首)",ctrl_e:"Ctrl+E (行尾)",ctrl_k:"Ctrl+K (剪切)",ctrl_r:"Ctrl+R (历史搜索)",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",sym_pipe:"管道符 (|)",sym_tilde:"波浪号 (~)",sym_slash:"正斜杠 (/)",sym_backslash:"反斜杠 (\\)",sym_dash:"连字符 (-)",sym_underscore:"下划线 (_)",sym_dollar:"美元符 ($)",sym_ampersand:"与符号 (&)",sym_quote:'双引号 (")',sym_backtick:"反引号 (`)"},admin:{title:"系统管理面板",subtitle:"接入主机、配对设备与中转流量",returnToTerminal:"返回终端",terminalShells:"个终端 Shell",startedAt:"启动于 {time}",accessPanel:"接入概览",acrossWindows:"共 {count} 个窗口",perSecond:"{value}/秒",framesPerSecond:"{count} 帧/秒",unitDay:" 天",unitHour:" 小时",unitMinute:" 分",unitSecond:" 秒",startedRecently:"最近启动",updatedAt:"更新于 {time}",autoRefresh:"自动刷新:",paused:"暂停刷新",refreshNow:"立即刷新",connectedHosts:"接入主机",activeUsers:"活跃用户",activePtys:"活动 PTY",activeController:"活跃控制者",uptime:"运行时间",none:"无",noHost:"未连接主机",tabOverview:"系统概览",tabClients:"客户端列表 ({count})",tabPtys:"PTY 会话 ({count})",tabDevices:"已配对设备 ({count})",throughput:"网络吞吐流量",bytesInTotal:"入站流量:",bytesOutTotal:"出站流量:",frameRate:"帧率统计:",hostsTitle:"主机 ({count})",noHosts:"暂无接入或配对的主机",hostConnectedDevices:"{count} 台在线",hostPairedDevices:"{count} 台已配对",hostStatusOnline:"在线",hostStatusBusy:"使用中",hostStatusReconnecting:"重连中",hostStatusOffline:"离线",hostRosterOperatorOnly:"设备清单仅 Relay 操作员可见。",connectedClientsTitle:"已连接客户端 ({count})",noClients:"当前暂无客户端连接",colClientId:"客户端 ID",colDevice:"设备",colDeviceId:"设备 ID",colLastSeen:"最近活动",colActions:"操作",unknownDevice:"未知设备",pairedDevicesTitle:"已配对设备 ({count})",noDevices:"尚未配对任何设备",revokeDevice:"撤销",revokeConfirm:"确认撤销",revokeFailed:"撤销失败",colRole:"角色",colIp:"IP 地址",colConnectedAt:"连接时间",colTraffic:"网络流量 (入/出)",activePtysTitle:"活动 PTY 终端会话 ({count})",noPtys:"当前无活跃的 PTY 会话",colPtyId:"PTY 标识",colPid:"进程 PID",colCommand:"运行命令",colGrid:"网格规格",colCwd:"工作目录",colViewers:"窗口数",copiedJson:"已复制",unauthorizedTitle:"管理接口未授权 (401/403)",unauthorizedDesc:"访问 GET /api/status 需要已授权的设备 Token。",pairingStepsTitle:"设备配对指引:",pairingStepsHelp:"在主机运行配对命令获取配对码后输入。",enterPairCodeBtn:"输入配对码",retryFetchBtn:"重新获取状态",errorConnecting:"连接 GET /api/status 失败:{error}",loadingStatus:"正在加载系统状态...",remoteRelayTitle:"远程 Relay 服务管理",remoteRelayBadge:"已连接远程 Relay 服务",remoteRelayNotice:"当前连接至远程独立 Relay 服务。如需查看服务端指标,请使用操作员后台。",remoteRelayEndpoint:"远程端点:",remoteRelayAdminUrl:"远程后台地址:",openRemoteAdminBtn:"前往远程管理后台",remoteRelayHelp:"直接访问远程 Relay 管理后台。",relayAdminTitle:"Relay 操作员管理后台",relayAdminTokenLabel:"Relay 管理员令牌 (X-Relay-Admin-Token)",relayAdminTokenPlaceholder:"请输入 RELAY_ADMIN_TOKEN...",relayAdminNotConfigured:"该 Relay 服务未配置 RELAY_ADMIN_TOKEN。",relayAdminLoginBtn:"验证并查看服务端指标",relayAdminAuthError:"管理员令牌无效或未授权。",remoteRelayClientNotice:"当前为终端客户端连接。如需查看服务端指标,请访问操作员后台。",openOperatorPortal:"打开服务端管理后台",localWorkstationBadge:"本地宿主 Relay",modeLocal:"本地模式",modeRemote:"远程模式",hintTabs:"切换标签页",hintRefresh:"刷新状态",hintBack:"返回终端"},toasts:{connected:"已连接至 Relay 服务",connectionError:"连接发生错误",controlGranted:"已获得控制权",controlDenied:"控制请求被拒绝:已有活跃控制者",controlRevoked:"控制权已转移",pairedSuccess:"设备配对成功,已保存凭证",sessionEnded:"终端会话已结束",controlReleased:"已释放控制权,切回观察者模式",viewerModeWarning:"处于观察者模式,请先获取控制权",clientIdCopied:"客户端 ID 已复制: {id}",pairingLinkCopied:"配对链接已复制",switchedLanguage:"语言已切换为 {lang}",settingsReset:"设置已恢复默认",fontReset:"字体已恢复默认",commandCopied:"命令已复制",keyLayoutReset:"虚拟按键布局已恢复默认"},shortcuts:{title:"WebUI 快捷键",help:"以下快捷键仅在非终端输入区域生效:",terminalInputNote:"终端操作快捷键直接透传至宿主 PTY。"},serverErrors:{auth_required:"需要配对:请输入配对码,或填写仍然有效的设备令牌。",unauthorized:"该设备无权访问此工作站。",host_offline:"已配对的工作站未连接到该 relay。",host_disconnected:"工作站已断开连接。",stale_host:"工作站长时间无响应,已被断开。",too_many_clients:"该工作站的窗口数量已达上限。",rate_limited:"配对尝试过于频繁,请稍后再试。",invalid_handshake:"relay 拒绝了握手,请刷新页面。",device_revoked:"该设备已被 relay 管理员撤销。",connection_closed:"连接已断开,正在重连…",connection_stale:"页面回到前台时连接已无响应,正在重连…",connection_stalled:"连接超时,正在重试…",connection_failed:"无法建立到 relay 的连接。",host_reconnecting:"Herdr 主机正在重连。",host_reconnect_timeout:"Herdr 主机未能及时恢复连接。",host_replaced:"Herdr 主机连接已被替换。",slow_client:"由于浏览器处理速度过慢,连接已关闭。",client_send_failed:"Relay 无法向此浏览器发送数据。",too_many_hosts:"此 relay 已达到主机数量上限。",paste_file_unsupported:"不支持的粘贴图片格式。",paste_file_too_large:"粘贴图片超过 3 MB 上限。",paste_file_write_failed:"工作站保存图片失败。",paste_file_empty:"粘贴图片内容为空。",paste_file_corrupt:"粘贴图片数据损坏或与声明格式不符。",viewer_mode:"观察者模式无法粘贴到终端。",no_session:"终端会话未准备就绪。"},fontPresets:{host:"宿主机终端字体(默认)",system:"系统等宽字体"},hostFont:{title:"宿主机终端字体",body:"{host} 的终端使用 {family}{detail}。这台设备没有安装该字体。",bodyGlyphsOnly:"{host} 的终端显示中文用 {family},这台设备没有安装该字体。",glyphs:"中文使用 {family}:先下载常用字约 2 MB,其余的字第一次出现时再补。",glyphsAll:"{family} 太大,不整包传输:先下载常用字符约 2 MB,其余字符第一次出现时再补。",detail:"({detail})",detailSeparator:",",download:"加载 {count} 个字体文件,共 {size}。只下载一次,之后保存在本浏览器。",load:"加载字体",decline:"使用本机字体",loading:"正在加载 {received} / {total}",failed:"字体加载失败:{reason}",loaded:"宿主机字体已加载",reasons:{host_font_unavailable:"宿主机上的字体已变化,请在设置里重新同步",host_font_timeout:"宿主机没有响应",disconnected:"连接已断开",font_api_unavailable:"此浏览器不支持加载字体",other:"浏览器无法解析该字体文件"}},agents:{title:"本工作站的智能体",blocked:"待确认",done:"已完成",working:"运行中",allIdle:"智能体空闲",notifyBlocked:"{count} 个智能体在等你确认",notifyDone:"{count} 个智能体已完成"},clipboard:{openLink:"打开链接",openLinkFailed:"该链接无法在浏览器中打开",copySelection:"复制选中",copyLine:"复制本行",copyScreen:"复制整屏",paste:"粘贴",cancel:"取消",copied:"已复制到剪贴板",copyFailed:"复制失败",pasteHint:"长按此处粘贴,然后按发送",pasteSend:"发送",pasteUnavailable:"剪贴板为空或不可用",pasteTitle:"粘贴内容",pasted:"已粘贴",chooseImage:"选择图片",takePhoto:"拍照",imageTooLarge:"图片超过 3 MB 限制且无法进一步压缩。",imageCompressedSize:"压缩后大小:{size}",fileEmpty:"文件内容为空。",decodeFailed:"无法解析图片文件。",unsupportedType:"不支持的图片格式,仅支持 PNG、JPEG、WebP 和 GIF。",imageSectionTitle:"图片",textSectionTitle:"文本",imageCompressing:"正在处理图片...",removeImage:"移除图片"}},td={en:dx,zh:fx};function Hd(a,i,s){const r=td[a]||td.en,c=i.split(".");let d=r;for(const h of c)if(d&&typeof d=="object"&&h in d)d=d[h];else{let m=td.en;for(const p of c)if(m&&typeof m=="object"&&p in m)m=m[p];else return i;d=m;break}if(typeof d!="string")return i;if(s){let h=d;for(const[m,p]of Object.entries(s))h=h.replaceAll(`{${m}}`,String(p));return h}return d}const Bp="#11111b",hx=['"Symbols Nerd Font Mono"','"Sarasa Mono SC"','"Noto Sans Mono CJK SC"','"Noto Sans Mono CJK TC"','"Microsoft YaHei Mono"','"PingFang SC"',"monospace"],Fo=["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"'],Td=[{id:"host",name:"Host terminal font",faces:[]},{id:"system",name:"System monospace",faces:Fo},{id:"jetbrains-mono",name:"JetBrains Mono",faces:['"JetBrains Mono"','"Herdr JetBrains Mono"']},{id:"fira-code",name:"Fira Code",faces:['"Fira Code"','"Herdr Fira Code"']},{id:"cascadia-code",name:"Cascadia Code",faces:['"Cascadia Code"','"Herdr Cascadia Code"']},{id:"source-code-pro",name:"Source Code Pro",faces:['"Source Code Pro"','"Herdr Source Code Pro"']},{id:"ibm-plex-mono",name:"IBM Plex Mono",faces:['"IBM Plex Mono"','"Herdr IBM Plex Mono"']}],mx=[[/^jetbrains\s*mono/i,'"Herdr JetBrains Mono"'],[/^fira\s*code/i,'"Herdr Fira Code"'],[/^(cascadia\s*(code|mono)|caskaydia\s*(cove|mono))/i,'"Herdr Cascadia Code"'],[/^(source\s*code\s*pro|sauce\s*code\s*pro)/i,'"Herdr Source Code Pro"'],[/^(ibm\s*plex\s*mono|blex\s*mono)/i,'"Herdr IBM Plex Mono"']];function px(a){const i=mx.find(([s])=>s.test(a.trim()));return i?i[1]:null}function Ws(a){return`"${a.replace(/["\\]/g,"")}"`}function Md(a){return[...new Set([...a,...hx])].join(", ")}const gx=Md(Fo);function bx(a,i){const s=typeof a=="string"?a.trim():"";if(!s||s==="host"){if(!(i!=null&&i.family))return gx;const d=[],h=i.glyphs;(h==null?void 0:h.scope)==="all"&&h.alias&&d.push(Ws(h.alias)),i.alias&&d.push(Ws(i.alias)),d.push(Ws(i.family));const m=px(i.family);return m&&d.push(m),(h==null?void 0:h.scope)==="cjk"&&(h.alias&&d.push(Ws(h.alias)),d.push(Ws(h.family))),Md([...d,...Fo])}const r=Td.find(d=>d.id===s);if(r)return Md([...r.faces,...Fo]);if(s.includes("Symbols Nerd Font"))return s;if(/^['"]?monospace['"]?$/i.test(s))return'"Symbols Nerd Font Mono", monospace';const c=/,\s*['"]?monospace['"]?\s*$/i;return c.test(s)?s.replace(c,', "Symbols Nerd Font Mono", monospace'):`${s}, "Symbols Nerd Font Mono", monospace`}function yx(a){if(!a)return null;const i={};return a.background&&(i.background=a.background,i.cursorAccent=a.background),a.foreground&&(i.foreground=a.foreground),a.cursor&&(i.cursor=a.cursor),a.ansi&&Object.assign(i,a.ansi),Object.keys(i).length===0?null:i}function sb(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",Bp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Bp}const Hp=["啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆","榜膀绑棒磅蚌镑傍谤苞胞包褒剥薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁","便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍","舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称","城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤","垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮怠耽担丹单郸掸胆旦氮","但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟","蝶迭谍叠丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅","俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿","愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感","秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤","姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍","旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪","户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸","击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰","奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节","桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎","就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤","靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊","辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立","粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫","馏留刘瘤流柳六龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落","洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥","米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜","纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕","呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬篇偏片","骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣","讫掐恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷","秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉","柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢","捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓","逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕","朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔獭挞蹋踏胎苔抬台","泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳","贴铁帖厅听烃汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完","碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬","屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔","舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣","辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡","殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶摇尧遥窑","谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音","阴姻吟银淫寅饮尹引隐印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔","隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载","再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐","账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨","纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻抓爪拽专砖转撰赚篆桩","庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"," 、。〃〄々〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬〰〱〲〳〴〵〶〷〸〹〺〻〼〽〾〿!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¬ ̄¦¥₩"].join(""),nd=256*1024,vx=2,xx={regular:{weight:"400",style:"normal"},bold:{weight:"700",style:"normal"},italic:{weight:"400",style:"italic"},boldItalic:{weight:"700",style:"italic"}};function ll(a){return a?[a.family,...a.faces.map(i=>i.sha256),...(a.subsets||[]).map(i=>i.sha256)].join("|"):null}function Up(a){const i=a==null?void 0:a.faces.find(s=>s.style==="regular");return i?`Herdr Host ${i.sha256.slice(0,12)}`:null}function Kp(a){return a?a.faces.reduce((i,s)=>i+s.bytes,0):0}function id(a){return a>=1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(a/1024))} KB`}function wx(a){if(typeof document>"u")return!1;let i=null;try{i=document.createElement("canvas").getContext("2d")}catch{return!1}if(!i)return!1;const s="mmmmmmmmmmlli10OQ@#WWww";for(const r of["serif","sans-serif"]){i.font=`72px ${r}`;const c=i.measureText(s).width;if(i.font=`72px "${a}", ${r}`,i.measureText(s).width!==c)return!0}return!1}const Sx="herdr-remote-fonts",as="faces",ls="subsets",rb=new Map,Ad=new Map;function $o(){return new Promise(a=>{if(typeof indexedDB>"u"){a(null);return}try{const i=indexedDB.open(Sx,2);i.onupgradeneeded=()=>{i.result.objectStoreNames.contains(as)||i.result.createObjectStore(as),i.result.objectStoreNames.contains(ls)||i.result.createObjectStore(ls)},i.onsuccess=()=>a(i.result),i.onerror=()=>a(null),i.onblocked=()=>a(null)}catch{a(null)}})}async function Cx(a){const i=rb.get(a);if(i)return i;const s=await $o();return s?new Promise(r=>{try{const c=s.transaction(as,"readonly").objectStore(as).get(a);c.onsuccess=()=>{const d=c.result;r(d instanceof ArrayBuffer?d:null)},c.onerror=()=>r(null)}catch{r(null)}finally{s.close()}}):null}async function Tx(a,i){rb.set(a,i);const s=await $o();s&&await new Promise(r=>{try{const c=s.transaction(as,"readwrite");c.objectStore(as).put(i,a),c.oncomplete=()=>r(),c.onerror=()=>r(),c.onabort=()=>r()}catch{r()}finally{s.close()}})}async function Mx(a){const i=await $o();return i?new Promise(s=>{try{const r=IDBKeyRange.bound(`${a}:`,`${a}:`),c=i.transaction(ls,"readonly").objectStore(ls).getAll(r);c.onsuccess=()=>{const d=Array.isArray(c.result)?c.result:[];s(d.filter(h=>h&&h.data instanceof ArrayBuffer&&Array.isArray(h.codepoints)))},c.onerror=()=>s([])}catch{s([])}finally{i.close()}}):Ad.get(a)??[]}async function Ax(a,i){Ad.set(a,[...Ad.get(a)??[],i]);const s=await $o();s&&await new Promise(r=>{try{const c=s.transaction(ls,"readwrite");c.objectStore(ls).put(i,`${a}:${i.subsetSha}`),c.oncomplete=()=>r(),c.onerror=()=>r(),c.onabort=()=>r()}catch{r()}finally{s.close()}})}function ad(a){return a?`Herdr Glyphs ${a.sha256.slice(0,12)}`:null}function Ex(a){return a>=11904&&a<=12255||a>=12288&&a<=13311||a>=13312&&a<=19903||a>=19968&&a<=40959||a>=44032&&a<=55215||a>=63744&&a<=64255||a>=65072&&a<=65103||a>=65280&&a<=65519||a>=131072&&a<=201551}function ob(a,i){return i<32||i>=127&&i<160||i>=9472&&i<=9631?!1:a==="all"||Ex(i)}function Nx(a){const i=[...new Set(a)].sort((r,c)=>r-c),s=[];for(let r=0;r<i.length;r+=1){const c=i[r];let d=c;for(;r+1<i.length&&i[r+1]===d+1;)d=i[r+1],r+=1;const h=m=>m.toString(16).toUpperCase();s.push(c===d?`U+${h(c)}`:`U+${h(c)}-${h(d)}`)}return s.join(", ")}async function kx(a,i){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const s=new FontFace(a,i.data,{weight:"400",style:"normal",unicodeRange:Nx(i.codepoints)});document.fonts.add(await s.load())}const Ed=new Set;function Rx(a){return!!(a&&Ed.has(a))}async function Lx(a,i){if(Ed.has(a))return;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)throw new Error("font_api_unavailable");const s=await Promise.all(i.map(({face:r,data:c})=>new FontFace(a,c,xx[r.style]).load()));for(const r of s)document.fonts.add(r);Ed.add(a)}function Fp(a){const i=atob(a),s=new Uint8Array(i.length);for(let r=0;r<i.length;r+=1)s[r]=i.charCodeAt(r);return s}async function Ip(a,i,s){const r=Math.ceil(a.bytes/nd),c=new Uint8Array(a.bytes);let d=0;const h=async()=>{for(;d<r;){const m=d;d+=1;const p=await i(a.sha256,m),y=m*nd,b=Math.min(nd,a.bytes-y);if(p.length!==b)throw new Error("host_font_corrupt");c.set(p,y),s(p.length)}};return await Promise.all(Array.from({length:Math.min(vx,r)},h)),c.buffer}const Ud="herdr_remote_host_font_consent_v1";function cb(){try{const a=JSON.parse(localStorage.getItem(Ud)||"{}");return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function Gp(a,i){const s=cb()[a];return s&&s.fingerprint===i?s.decision:null}function Yp(a,i,s){try{const r=cb();r[a]={fingerprint:i,decision:s},localStorage.setItem(Ud,JSON.stringify(r))}catch{}}const _x=Ud,ub={source:null,status:"none",alias:null,covered:0},ld={font:null,status:"none",alias:null,receivedBytes:0,totalBytes:0,error:null,glyphs:ub,interactive:!1,glyphRevision:0},$p=3e4,jx=15e3,Dx=80,Ox=2e3,zx=String.fromCodePoint(...Array.from({length:95},(a,i)=>32+i),...Array.from({length:96},(a,i)=>160+i),...Array.from({length:112},(a,i)=>8192+i));function qp(a){const i=(a==null?void 0:a.subsets)??[];return i.find(s=>s.scope==="all")??i.find(s=>s.scope==="cjk")??null}function Bx(a,i){const s=new Set;for(const r of a){const c=r.codePointAt(0);ob(i,c)&&s.add(c)}return[...s]}function Hx(a,i={}){const[s,r]=w.useState(ld),c=w.useRef(s);c.current=s;const d=w.useRef(i);d.current=i;const h=w.useRef(0),m=w.useRef(new Map),p=w.useRef(new Map),y=w.useRef(new Map),b=w.useRef(0),v=w.useRef(new Set),S=w.useRef(new Set),M=w.useRef(new Set),N=w.useRef(null),q=()=>({isInstalled:d.current.isInstalled??wx,readCached:d.current.readCached??Cx,writeCached:d.current.writeCached??Tx,register:d.current.register??Lx,isRegistered:d.current.isRegistered??Rx,readSubsets:d.current.readSubsets??Mx,writeSubset:d.current.writeSubset??Ax,registerGlyphs:d.current.registerGlyphs??kx}),R=()=>(a==null?void 0:a.getHostId())||"default",D=(ie,de)=>{ie===h.current&&r(ge=>({...ge,glyphs:{...ge.glyphs,...de}}))},B=w.useCallback(ie=>{for(const de of[m.current,p.current]){for(const ge of de.values())clearTimeout(ge.timer),ge.reject(new Error(ie));de.clear()}},[]),G=w.useCallback((ie,de)=>new Promise((ge,we)=>{if(!a){we(new Error("disconnected"));return}const A=`${ie}:${de}`,j=setTimeout(()=>{m.current.delete(A),we(new Error("host_font_timeout"))},$p);m.current.set(A,{resolve:ge,reject:we,timer:j}),a.sendHostFontChunkRequest(ie,de)}),[a]),le=w.useCallback((ie,de,ge)=>new Promise((we,A)=>{if(!a){A(new Error("disconnected"));return}const j=Math.random().toString(36).slice(2,12),J=setTimeout(()=>{p.current.delete(j),A(new Error("host_font_timeout"))},$p);p.current.set(j,{resolve:se=>we({...se,codepoints:de}),reject:A,timer:J}),y.current.set(j,ge),a.sendHostFontSubsetRequest(ie.sha256,String.fromCodePoint(...de),j)}),[a]),fe=async(ie,de,ge)=>{const{registerGlyphs:we}=q();for(const A of ge){if(await we(de,A),ie!==h.current)return;for(const j of A.codepoints)v.current.add(j)}ie!==h.current||!ge.length||r(A=>({...A,glyphs:{...A.glyphs,alias:de,covered:v.current.size},glyphRevision:A.glyphRevision+1}))},te=async(ie,de,ge)=>{const we=ad(de),A=de.scope==="all"?zx+Hp:Hp,j=Bx(A,de.scope).filter(se=>!v.current.has(se));if(!j.length)return;for(const se of j)S.current.add(se);const J=await le(de,j,ge);ie===h.current&&(await q().writeSubset(de.sha256,J),await fe(ie,we,[J]))},F=w.useCallback(async(ie,{interactive:de=!0}={})=>{const ge=ie??c.current.font,we=ll(ge);if(!ge||!we)return;const A=c.current,j=ll(A.font)===we;if(j&&(A.status==="loading"||A.glyphs.status==="loading"))return;const J=h.current,{isInstalled:se,isRegistered:V,readCached:De,writeCached:Re,register:ye}=q();Yp(R(),we,"accepted");const Ae=Up(ge),Le=qp(ge),He=!!(Ae&&!V(Ae)&&!se(ge.family)),gt=j?A.glyphs:{...ub,source:Le},Ve=!!(Le&&!["installed","ready","none"].includes(gt.status));let Ue=He?Kp(ge):0,vt=0;const xt=()=>{J===h.current&&r(Fe=>({...Fe,receivedBytes:vt,totalBytes:Ue}))};if(r(Fe=>({...Fe,font:ge,interactive:de,receivedBytes:0,totalBytes:Ue,error:null,status:He?"loading":Fe.status,glyphs:Ve?{...gt,status:"loading"}:gt})),He&&Ae)try{const Fe=[];for(const Y of ge.faces){let oe=await De(Y.sha256);if(oe?(vt+=Y.bytes,xt()):(oe=await Ip(Y,G,Xe=>{vt+=Xe,xt()}),await Re(Y.sha256,oe)),J!==h.current)return;Fe.push({face:Y,data:oe})}if(await ye(Ae,Fe),J!==h.current)return;r(Y=>({...Y,status:"loaded",alias:Ae}))}catch(Fe){if(J!==h.current)return;const Y=Fe instanceof Error&&Fe.message?Fe.message:"host_font_failed";r(oe=>({...oe,status:"failed",alias:null,error:Y}))}if(Ve&&Le){let Fe=0;try{await te(J,Le,(Y,oe)=>{oe&&!Fe&&(Fe=oe,Ue+=oe),vt+=Y,xt()}),D(J,{status:"ready"})}catch(Y){if(J!==h.current)return;const oe=Y instanceof Error&&Y.message?Y.message:"host_font_failed";r(Xe=>({...Xe,error:Xe.error??oe,glyphs:{...Xe.glyphs,status:"failed"}}))}}},[G,le]),I=w.useCallback(async ie=>{const de=ll(ie)!==ll(c.current.font);de&&(B("superseded"),v.current=new Set,S.current=new Set,M.current=new Set);const ge=++h.current;if(!ie){r(ld);return}const{isInstalled:we,readCached:A,register:j,isRegistered:J,readSubsets:se}=q(),V=Up(ie),De=ll(ie),Re=qp(ie);let ye="checking";V&&J(V)?ye="loaded":we(ie.family)?ye="installed":V||(ye="unavailable");let Ae="checking";if(Re?(Re.scope==="cjk"?we(Re.family):ye==="installed")&&(Ae="installed"):Ae="none",r(Ve=>({...ld,font:ie,status:ye==="checking"?"checking":ye,alias:ye==="loaded"?V:null,totalBytes:Kp(ie),glyphs:{source:Re,status:Ae,alias:de?null:Ve.glyphs.alias,covered:v.current.size},glyphRevision:Ve.glyphRevision})),ye==="checking"&&V){const Ve=await Promise.all(ie.faces.map(Ue=>A(Ue.sha256)));if(ge!==h.current)return;if(ye="needs",Ve.every(Boolean))try{if(await j(V,ie.faces.map((Ue,vt)=>({face:Ue,data:Ve[vt]}))),ge!==h.current)return;ye="loaded",r(Ue=>({...Ue,status:"loaded",alias:V}))}catch{}}if(Ae==="checking"&&Re){const Ve=await se(Re.sha256);if(ge!==h.current)return;if(Ve.length)try{await fe(ge,ad(Re),Ve),Ae="cached"}catch{Ae="needs"}else Ae="needs";if(ge!==h.current)return}const Le=Gp(R(),De),He=Le==="accepted"||Ae==="cached"||Date.now()<b.current;if(Ae==="cached"&&(Ae="ready",D(ge,{status:"ready"}),te(ge,Re,()=>{}).catch(()=>{})),ye!=="needs"&&Ae!=="needs")return;if(He){F(ie,{interactive:!1});return}const gt=Le==="declined"?"declined":"available";r(Ve=>({...Ve,status:ye==="needs"?gt:Ve.status,glyphs:Ae==="needs"?{...Ve.glyphs,status:gt}:Ve.glyphs}))},[F,B]),me=w.useCallback(()=>{const ie=ll(c.current.font);ie&&Yp(R(),ie,"declined"),r(de=>({...de,interactive:!1,status:["available","failed"].includes(de.status)?"declined":de.status,glyphs:["available","failed"].includes(de.glyphs.status)?{...de.glyphs,status:"declined"}:de.glyphs}))},[]),be=w.useCallback(()=>{b.current=Date.now()+jx,a==null||a.sendHostFontRefresh();const ie=c.current,de=["available","declined","failed"];ie.font&&(de.includes(ie.status)||de.includes(ie.glyphs.status))&&F(ie.font,{interactive:!1})},[a,F]),Ne=w.useCallback(ie=>{const{glyphs:de}=c.current;if(de.status!=="ready"||!de.source)return;const ge=de.source;for(const we of ie){const A=we.codePointAt(0);A<128&&ge.scope!=="all"||ob(ge.scope,A)&&(v.current.has(A)||S.current.has(A)||M.current.add(A))}!M.current.size||N.current||(N.current=setTimeout(()=>{N.current=null;const we=h.current,A=[...M.current].slice(0,Ox);for(const j of A)M.current.delete(j),S.current.add(j);(async()=>{const j=await le(ge,A,()=>{});we===h.current&&(await q().writeSubset(ge.sha256,j),await fe(we,ad(ge),[j]))})().catch(()=>{})},Dx))},[le]);return w.useEffect(()=>{if(!a)return;const ie=m.current,de=p.current,ge=a.on("terminalFont",se=>{I(se)}),we=a.on("hostFontChunk",se=>{const V=`${se.sha256}:${se.index}`,De=ie.get(V);if(De){ie.delete(V),clearTimeout(De.timer);try{De.resolve(Fp(se.dataBase64))}catch{De.reject(new Error("host_font_corrupt"))}}}),A=a.on("hostFontSubset",se=>{const V=de.get(se.requestId);if(!V)return;de.delete(se.requestId),clearTimeout(V.timer);const De=y.current.get(se.requestId)??(()=>{});if(y.current.delete(se.requestId),se.dataBase64!==void 0){try{const ye=Fp(se.dataBase64);De(ye.length,ye.length),V.resolve({subsetSha:se.subsetSha,data:ye.buffer,codepoints:[]})}catch{V.reject(new Error("host_font_corrupt"))}return}De(0,se.bytes);const Re={bytes:se.bytes,sha256:se.subsetSha};Ip(Re,G,ye=>De(ye,se.bytes)).then(ye=>V.resolve({subsetSha:se.subsetSha,data:ye,codepoints:[]})).catch(ye=>V.reject(ye instanceof Error?ye:new Error("host_font_failed")))}),j=a.on("error",se=>{(se.code==="host_font_unavailable"||se.code==="host_font_subset_failed")&&B(String(se.code))}),J=a.on("stateChange",se=>{se!=="connected"&&B("disconnected")});return()=>{ge(),we(),A(),j(),J(),B("disconnected"),N.current&&clearTimeout(N.current),N.current=null}},[a,I,B,G]),w.useEffect(()=>{const ie=de=>{if(de.key!==_x)return;const ge=c.current,we=ll(ge.font),A=ge.status==="available"||ge.glyphs.status==="available";if(!we||!A)return;const j=Gp(R(),we);j==="accepted"?F(ge.font,{interactive:!1}):j==="declined"&&me()};return window.addEventListener("storage",ie),()=>window.removeEventListener("storage",ie)},[F,me]),{hostFont:s,loadHostFont:F,declineHostFont:me,syncHostFont:be,ensureHostGlyphs:Ne}}const L=(a,i,s,r=!0)=>({id:a,labelKey:i,combo:s,verified:r}),db={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[L("mode","mode","shift+tab"),L("rewind","rewind","esc esc"),L("details","details","ctrl+o"),L("model","model","alt+p"),L("thinking","thinking","alt+t"),L("todos","todos","ctrl+t"),L("background","background","ctrl+b"),L("editor","editor","ctrl+g"),L("history","history","ctrl+r"),L("stash","stash","ctrl+s"),L("pasteImage","pasteImage","ctrl+v"),L("newline","newline","ctrl+j"),L("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[L("mode","mode","shift+tab"),L("editPrevious","editPrevious","esc esc"),L("details","details","ctrl+t"),L("queue","queue","tab"),L("history","history","ctrl+r"),L("copy","copy","ctrl+o"),L("editor","editor","ctrl+g"),L("newline","newline","ctrl+j"),L("clear","clear","ctrl+l"),L("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[L("mode","mode","shift+tab"),L("yolo","yolo","ctrl+y"),L("rewind","rewind","esc esc"),L("todos","todos","ctrl+t"),L("expand","expand","ctrl+o"),L("background","background","ctrl+b"),L("editor","editor","ctrl+g"),L("history","history","ctrl+r"),L("undo","undo","ctrl+z"),L("newline","newline","ctrl+j"),L("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[L("mode","mode","shift+tab"),L("interrupt","interrupt","esc"),L("history","history","ctrl+r"),L("newline","newline","ctrl+j"),L("todos","todos","ctrl+t",!1),L("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[L("agent","agent","tab"),L("agentBack","agentBack","shift+tab"),L("interrupt","interrupt","esc"),L("palette","palette","ctrl+p"),L("model","model","ctrl+x m"),L("recentModel","recentModel","f2"),L("variant","variant","ctrl+t"),L("newSession","newSession","ctrl+x n"),L("sessions","sessions","ctrl+x l"),L("undo","undo","ctrl+x u"),L("editor","editor","ctrl+x e"),L("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[L("agent","agent","tab",!1),L("agentBack","agentBack","shift+tab",!1),L("interrupt","interrupt","esc"),L("palette","palette","ctrl+p"),L("model","model","ctrl+x m"),L("recentModel","recentModel","f2"),L("variant","variant","ctrl+t"),L("newSession","newSession","ctrl+x n"),L("sessions","sessions","ctrl+x l"),L("undo","undo","ctrl+x u"),L("editor","editor","ctrl+x e"),L("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[L("thinkingMode","thinkingMode","shift+tab"),L("interrupt","interrupt","esc"),L("nextModel","nextModel","ctrl+p"),L("modelPicker","modelPicker","ctrl+l"),L("tools","tools","ctrl+o"),L("thinkingBlocks","thinkingBlocks","ctrl+t"),L("editor","editor","ctrl+g"),L("followup","followup","alt+enter"),L("dequeue","dequeue","alt+up"),L("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[L("thinkingMode","thinkingMode","shift+tab"),L("plan","plan","alt+shift+p"),L("model","model","alt+m"),L("temporaryModel","temporaryModel","alt+p"),L("nextModel","nextModel","ctrl+p"),L("tools","tools","ctrl+o"),L("thinking","thinking","ctrl+t"),L("history","history","ctrl+r"),L("editor","editor","ctrl+g"),L("followup","followup","ctrl+enter"),L("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[L("mode","mode","shift+tab"),L("interrupt","interrupt","esc"),L("expand","expand","ctrl+o"),L("expandAll","expandAll","ctrl+e"),L("reasoning","reasoning","ctrl+t"),L("editor","editor","ctrl+g"),L("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[L("mode","mode","shift+tab"),L("review","review","ctrl+r"),L("newline","newline","ctrl+j"),L("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[L("specMode","specMode","shift+tab"),L("autonomy","autonomy","ctrl+l"),L("details","details","ctrl+o",!1),L("queue","queue","ctrl+enter"),L("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[L("plan","plan","shift+tab"),L("interrupt","interrupt","esc"),L("undoPicker","undoPicker","esc esc"),L("expand","expand","ctrl+o"),L("editor","editor","ctrl+g"),L("steer","steer","ctrl+s"),L("undo","undo","ctrl+-"),L("newline","newline","ctrl+j"),L("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[L("palette","palette","ctrl+o"),L("reasoning","reasoning","alt+d"),L("mode","mode","ctrl+s",!1),L("editor","editor","ctrl+g"),L("history","history","ctrl+r"),L("sidebar","sidebar","ctrl+backslash"),L("pasteImage","pasteImage","ctrl+v"),L("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[L("interrupt","interrupt","ctrl+c"),L("newline","newline","ctrl+j"),L("editor","editor","ctrl+g"),L("agents","agents","ctrl+t"),L("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[L("permissionMode","permissionMode","shift+tab"),L("bypass","bypass","ctrl+y"),L("tasks","tasks","ctrl+t"),L("editor","editor","ctrl+x"),L("history","history","ctrl+r"),L("queue","queue","ctrl+enter"),L("newline","newline","ctrl+j"),L("pasteImage","pasteImage","alt+v"),L("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[L("mode","mode","shift+tab"),L("interrupt","interrupt","ctrl+c"),L("thinking","thinking","alt+t"),L("newline","newline","ctrl+j"),L("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[L("mode","mode","shift+tab"),L("interrupt","interrupt","ctrl+c"),L("rewind","rewind","esc esc"),L("interject","interject","ctrl+enter"),L("multiline","multiline","ctrl+m"),L("newline","newline","alt+enter"),L("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[L("mode","mode","shift+tab"),L("interrupt","interrupt","ctrl+c"),L("background","background","ctrl+b"),L("approve","approve","ctrl+k"),L("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[L("interrupt","interrupt","ctrl+c"),L("thinking","thinking","ctrl+t"),L("expand","expand","ctrl+e"),L("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[L("permissionMode","permissionMode","shift+tab"),L("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[L("agentSwap","agentSwap","shift+tab"),L("interrupt","interrupt","esc"),L("details","details","ctrl+t"),L("steer","steer","ctrl+s"),L("expand","expand","ctrl+o"),L("activity","activity","ctrl+x"),L("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[L("planAct","planAct","tab"),L("autoApprove","autoApprove","shift+tab"),L("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[L("rewind","rewind","esc esc"),L("search","search","ctrl+f"),L("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[L("interrupt","interrupt","esc"),L("queue","queue","alt+enter"),L("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},Wl=db,Ux=Object.keys(db),Vp={pi:"pi",claude:"claude","claude-code":"claude",codex:"codex",gemini:"gemini",cursor:"cursor","cursor-agent":"cursor",devin:"devin","devin-cli":"devin","devin cli":"devin",agy:"agy",antigravity:"agy","antigravity-cli":"agy",cline:"cline",".cline":"cline",omp:"omp",mastracode:"mastracode","mastra-code":"mastracode","mastra code":"mastracode",opencode:"opencode",opencode2:"opencode","open-code":"opencode",copilot:"copilot","github-copilot":"copilot",ghcs:"copilot",kimi:"kimi","kimi-code":"kimi","kimi code":"kimi",kiro:"kiro","kiro-cli":"kiro",droid:"droid",amp:"amp","amp-local":"amp",grok:"grok","grok-build":"grok",hermes:"hermes","hermes-agent":"hermes",kilo:"kilo","kilo-code":"kilo","kilo code":"kilo",qodercli:"qodercli",qoderclicn:"qodercli",qoder:"qodercli",qodercn:"qodercli",qwen:"qwen","qwen-code":"qwen","qwen code":"qwen",letta:"letta","letta-code":"letta","letta code":"letta",maki:"maki",muse:"muse","muse-code":"muse","muse-cli":"muse",shell:"shell"},Kx=[L("genericCtrlC","interrupt","ctrl+c"),L("genericCtrlD","eof","ctrl+d"),L("genericCtrlZ","suspend","ctrl+z"),L("genericCtrlL","clear","ctrl+l"),L("genericCtrlR","history","ctrl+r"),L("genericCtrlA","startOfLine","ctrl+a"),L("genericCtrlE","endOfLine","ctrl+e"),L("genericCtrlK","killToEnd","ctrl+k")],Fx=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Ix=["genericCtrlC"];function Gx(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Xp(a){const i=Gx(a);return Vp[i]?Vp[i]:/^muse-bin-\d/.test(i)?"muse":null}function Yx(a,i="auto"){return i&&i!=="auto"?Xp(i)||"shell":Xp(a)||"shell"}function $x(a,i){var c,d;const s=a.map(h=>{var y;const m=(y=i==null?void 0:i.actions)==null?void 0:y[h.id];let p=typeof(m==null?void 0:m.keys)=="string"?m.keys:h.combo;try{Li(p)}catch{p=h.combo}return{...h,defaultCombo:h.combo,combo:p,hidden:typeof(m==null?void 0:m.hidden)=="boolean"?m.hidden:h.defaultHidden===!0,custom:!1}}),r=new Set(s.map(h=>h.id));for(const h of(i==null?void 0:i.custom)||[]){if(!h||typeof h.id!="string"||r.has(h.id))continue;let m=h.keys;try{Li(m)}catch{continue}s.push({id:h.id,labelKey:"custom",defaultCombo:m,combo:m,verified:!0,hidden:((d=(c=i==null?void 0:i.actions)==null?void 0:c[h.id])==null?void 0:d.hidden)===!0,custom:!0,customLabel:h.label}),r.add(h.id)}if(Array.isArray(i==null?void 0:i.order)){const h=new Map(i.order.map((m,p)=>[m,p]));s.sort((m,p)=>(h.get(m.id)??Number.MAX_SAFE_INTEGER)-(h.get(p.id)??Number.MAX_SAFE_INTEGER))}return s}function qx(a,i){const s=new Set(a.map(r=>r.combo.trim().toLowerCase()));return i.filter(r=>!s.has(r.combo.trim().toLowerCase()))}const ur=a=>a.id.startsWith("generic");function fb(a,i){const s=Wl[a],r=new Set([...s.bar||[],...a==="shell"?Fx:Ix]),c=[...s.actions,...Kx].map(d=>({...d,defaultHidden:!r.has(d.id)}));return $x(c,i)}function hb(a,i){const s=fb(a,i),r=s.filter(d=>!ur(d)),c=new Set(qx(r,s.filter(ur)));return s.filter(d=>!ur(d)||c.has(d))}function Vx(a,i){const s=hb(a,i).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!ur(r)),genericActions:s.filter(ur)}}function Xx(a){const i={};for(const[s,r]of Object.entries(a.actions||{})){const c={...r};delete c.hidden,Object.keys(c).length>0&&(i[s]=c)}return{...a,actions:i}}const mb=1568,Px=3*1024*1024,Zx=[.85,.7,.55,.4],pi={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Qx(a,i,s=mb){if(a<=0||i<=0)return{width:Math.max(1,a),height:Math.max(1,i)};const r=Math.max(a,i);if(r<=s)return{width:a,height:i};const c=s/r;return{width:Math.max(1,Math.round(a*c)),height:Math.max(1,Math.round(i*c))}}function Wx(a){if(typeof a!="string"||a.length===0)return 0;const i=a.length;let s=0;a.endsWith("==")?s=2:a.endsWith("=")&&(s=1);const r=Math.floor(i*3/4)-s;return Number.isFinite(r)&&r>0?r:0}function Jx(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function ew(a){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(a,{imageOrientation:"from-image"});return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{try{const i=await createImageBitmap(a);return{source:i,width:i.width,height:i.height,cleanup:()=>{typeof i.close=="function"&&i.close()}}}catch{}}return new Promise((i,s)=>{if(typeof Image>"u")return s(new Error("Image decoding not supported in this environment"));const r=new Image,c=URL.createObjectURL(a);r.onload=()=>{i({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,cleanup:()=>{try{URL.revokeObjectURL(c)}catch{}}})},r.onerror=()=>{try{URL.revokeObjectURL(c)}catch{}s(new Error("Failed to decode image source"))},r.src=c})}async function pb(a,i=mb,s=Px){var c;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let r;try{r=await ew(a)}catch(d){return console.warn("Failed to decode image for paste:",d),null}try{const{width:d,height:h}=Qx(r.width,r.height,i),m=document.createElement("canvas");m.width=d,m.height=h;const p=m.getContext("2d");if(!p)return null;p.drawImage(r.source,0,0,d,h);let y="image/webp";try{m.toDataURL("image/webp",.85).startsWith("data:image/webp")||(y="image/jpeg")}catch{y="image/jpeg"}for(const b of Zx){let v;try{v=m.toDataURL(y,b)}catch{continue}if(!v||!v.startsWith("data:"))continue;const S=v.indexOf(","),M=S!==-1?v.slice(S+1):"",N=Wx(M);if(N<=s)return{mime:y,dataBase64:M,dataUrl:v,byteLength:N,width:d,height:h}}return null}finally{(c=r.cleanup)==null||c.call(r)}}const tw=4e3,nw=3,iw=4096,aw=8*1024*1024,Mo={ctrl:!1,alt:!1,shift:!1},lw=3e4,gb=w.createContext(null);function Xl(a){return{wsUrl:a.wsUrl,token:a.token||void 0,pairCode:a.pairCode||void 0,clientId:a.clientId,autoReconnect:a.autoReconnect,reconnectIntervalMs:2e3,maxReconnectAttempts:0,pingIntervalMs:1e4}}const sw=({children:a})=>{var Ci;const[i,s]=w.useState(lb),[r,c]=w.useState("disconnected"),[d,h]=w.useState(),[m,p]=w.useState(),[y,b]=w.useState("viewer"),[v,S]=w.useState(),[M,N]=w.useState(),[q,R]=w.useState(),[D,B]=w.useState(null),[G,le]=w.useState(null),[fe,te]=w.useState(ax),F=w.useRef(fe),I=w.useRef(new Set),me=w.useRef(null),be=w.useRef(null),Ne=w.useCallback(z=>{(z==null?void 0:z.phase)!=="starting"&&be.current&&(clearTimeout(be.current),be.current=null),me.current=z,B(z)},[]),[ie,de]=w.useState(null),[ge,we]=w.useState(),[A,j]=w.useState(null),[J,se]=w.useState(1),[V,De]=w.useState(0),[Re,ye]=w.useState(null),[Ae,Le]=w.useState(null),[He,gt]=w.useState(null),[Ve,Ue]=w.useState({cols:80,rows:24}),[vt,xt]=w.useState([]),Fe=Yx(Ae==null?void 0:Ae.focusedAgent,"auto");w.useEffect(()=>{sb()},[]);const Y=w.useRef(i);Y.current=i;const oe=w.useRef(null),Xe=w.useRef(!1),Nt=w.useRef(Ve);Nt.current=Ve;const Ut=w.useRef(new Set),dn=w.useRef(new Set),[Gt,ot]=w.useState(pi),$e=w.useRef(null),mn=w.useRef(0),ct=w.useRef(null),ce=w.useCallback((z,C)=>Hd(i.language,z,C),[i.language]),Me=w.useRef(ce);Me.current=ce;const Ie=w.useRef(null),E=w.useRef([]),ue=w.useRef(0),ve=w.useCallback(z=>{for(E.current.push(z),ue.current+=z.byteLength;E.current.length>iw||ue.current>aw;){const C=E.current.shift();if(!C)break;ue.current-=C.byteLength}},[]),Be=w.useCallback(z=>{const C=Ie.current;if(C)try{C(z);return}catch(O){console.debug("Terminal output sink threw, buffering chunk instead:",O)}ve(z)},[ve]),pn=w.useRef(Be);pn.current=Be;const li=w.useCallback(z=>{Ie.current=z;const C=E.current;E.current=[],ue.current=0;for(let O=0;O<C.length;O++)try{z(C[O])}catch(ne){console.debug("Terminal sink threw while flushing, re-buffering the tail:",ne);for(let W=O;W<C.length;W++)ve(C[W]);break}return()=>{Ie.current===z&&(Ie.current=null)}},[ve]),gn=w.useCallback(()=>E.current.length,[]),Ct=w.useCallback(()=>{E.current=[],ue.current=0},[]),Lt=w.useCallback((z=!0)=>{b("viewer"),S(void 0),N(void 0),R(void 0),de(null),we(void 0),j(null),se(1),ye(null),Ct(),z&&De(C=>C+1)},[Ct]),ft=w.useRef([]),ln=w.useRef(new Map),Kt=w.useCallback(z=>{ft.current=z,xt(z)},[]),bn=w.useCallback(z=>{const C=ln.current.get(z);C&&(clearTimeout(C),ln.current.delete(z)),Kt(ft.current.filter(O=>O.id!==z))},[Kt]),en=w.useRef(bn);en.current=bn;const tt=w.useCallback((z,C)=>{const O=Date.now(),ne=ft.current,W=ne.find(Oe=>Oe.type===z&&Oe.message===C),pe=W?W.id:`${O}-${Math.random().toString(36).substring(2,6)}`;let ee;if(W)ee=ne.map(Oe=>Oe.id===pe?{...Oe,count:Oe.count+1,timestamp:O}:Oe);else for(ee=[...ne,{id:pe,type:z,message:C,timestamp:O,count:1}];ee.length>nw;){const[Oe,...Tt]=ee,nt=ln.current.get(Oe.id);nt&&(clearTimeout(nt),ln.current.delete(Oe.id)),ee=Tt}Kt(ee);const bt=ln.current.get(pe);bt&&clearTimeout(bt),ln.current.set(pe,setTimeout(()=>en.current(pe),tw))},[Kt]),yn=w.useCallback(z=>{en.current(z)},[]),Tn=w.useRef(!0);w.useEffect(()=>{y==="controller"&&(Tn.current=!0)},[y]);const _t=w.useCallback(()=>{Tn.current&&(Tn.current=!1,tt("warning",Me.current("toasts.viewerModeWarning")))},[tt]);w.useEffect(()=>{const z=ln.current;return()=>{for(const C of z.values())clearTimeout(C);z.clear()}},[]);const sn=w.useCallback(z=>{const C=_a(z);Y.current=C,s(C)},[]),dl=w.useCallback(z=>{sn({language:z})},[sn]),wt=w.useCallback(z=>{Y.current=z,s(z)},[]),ta=w.useCallback(z=>{var W;const C=Y.current,O=Dp({...z,wsUrl:z.wsUrl||"/ws/client",token:z.token||"",displayName:z.displayName||`Herdr ${C.profiles.length+1}`,autoReconnect:z.autoReconnect!==!1},C.profiles.length),ne=_a({profiles:[...C.profiles,O],activeProfileId:O.id,wsUrl:O.wsUrl,token:O.token,pairCode:O.pairCode||"",autoReconnect:O.autoReconnect});wt(ne),Lt(),(W=oe.current)==null||W.reconnectWith(Xl(ne))},[wt,Lt]),$n=w.useCallback(z=>{var W;const C=Y.current,O=C.profiles.find(pe=>pe.id===z);if(!O||O.id===C.activeProfileId)return;const ne=_a({activeProfileId:O.id,wsUrl:O.wsUrl,token:O.token,pairCode:O.pairCode||"",autoReconnect:O.autoReconnect,profiles:C.profiles.map(pe=>pe.id===O.id?{...pe,lastUsedAt:Date.now()}:pe)});wt(ne),Lt(),(W=oe.current)==null||W.reconnectWith(Xl(ne))},[wt,Lt]),fl=w.useCallback((z,C)=>{const O=Y.current;if(!O.profiles.find(ee=>ee.id===z))return;const W=C.trim().slice(0,64);if(!W)return;const pe=_a({profiles:O.profiles.map(ee=>ee.id===z?{...ee,displayName:W}:ee)});wt(pe)},[wt]),Ua=w.useCallback(z=>{var pe;const C=Y.current;if(!C.profiles.some(ee=>ee.id===z))return;const O=C.profiles.filter(ee=>ee.id!==z),ne=O.find(ee=>ee.id===C.activeProfileId)||O[0],W=_a(ne?{profiles:O,activeProfileId:ne.id,wsUrl:ne.wsUrl,token:ne.token,pairCode:ne.pairCode||"",autoReconnect:ne.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});wt(W),z===C.activeProfileId&&(Lt(),(pe=oe.current)==null||pe.reconnectWith(Xl(W)))},[wt,Lt]),na=w.useCallback(z=>{const C=Y.current,O=C.profiles.find(Dt=>Dt.id===C.activeProfileId),ne=z.hostId?Op({wsUrl:C.wsUrl,hostId:z.hostId}):null,W=ne?C.profiles.findIndex(Dt=>Op(Dt)===ne):-1,pe=W>=0?W:Math.max(0,C.profiles.findIndex(Dt=>Dt.id===C.activeProfileId)),bt={...C.profiles[pe]||O||Dp({wsUrl:C.wsUrl||"/ws/client",token:"",pairCode:C.pairCode||"PENDING",displayName:`Herdr ${C.profiles.length+1}`},C.profiles.length),token:z.token,pairCode:void 0,...z.hostId?{hostId:z.hostId}:{},...z.deviceId?{deviceId:z.deviceId}:{},lastUsedAt:Date.now()};let Oe=[...C.profiles];pe>=0&&pe<Oe.length?Oe[pe]=bt:Oe.push(bt);const Tt=O==null?void 0:O.id;Oe=Oe.filter((Dt,fn)=>fn===pe||Dt.id===bt.id?!0:!(W>=0&&Tt&&Dt.id===Tt));const nt=_a({profiles:Oe,activeProfileId:bt.id,wsUrl:bt.wsUrl,token:bt.token,pairCode:"",autoReconnect:bt.autoReconnect});return wt(nt),nt},[wt]),jn=w.useCallback(z=>{const C=Y.current,O=C.profiles.find(ee=>ee.id===C.activeProfileId);if(!O||!z.hostId&&!z.hostname)return;const ne=/^Herdr \d+$/.test(O.displayName),W={...O,...z.hostId?{hostId:z.hostId}:{},...z.hostname?{hostname:z.hostname}:{},...z.hostname&&ne?{displayName:z.hostname}:{}},pe=_a({profiles:C.profiles.map(ee=>ee.id===O.id?W:ee)});wt(pe)},[wt]);if(!oe.current){const z=new Kv(Xl(i));oe.current=z,z.on("stateChange",(C,O,ne)=>{c(C),p(ne);const W=ne?`serverErrors.${ne}`:null,pe=W?Me.current(W):null,ee=pe&&pe!==W?pe:O;h(ee),C==="connected"?tt("success",Me.current("toasts.connected")):C==="error"&&tt("error",ee||Me.current("toasts.connectionError")),C!=="connected"&&Le(null),C!=="connected"&&Ne(null)}),z.on("ready",C=>{Xe.current&&(Ct(),De(O=>O+1)),Xe.current=!0,Ne(null),le(null),b(C.role),S(C.controllerId),N(C.hostId),R(C.hostname),jn(C),C.clientId&&we(C.clientId),de(C.terminalPalette||null)}),z.on("hostReconnecting",C=>{p(C||"host_reconnecting"),h(Me.current(`serverErrors.${C||"host_reconnecting"}`)),b("viewer"),S(void 0),R(void 0),de(null),j(null),se(1),ye(null),Ct()}),z.on("sessionRestarted",(C,O,ne,W)=>{Ct(),R(W),jn({hostId:z.getHostId(),hostname:W}),de(ne||null),De(pe=>pe+1)}),z.on("roleChange",(C,O,ne,W)=>{b(C),S(O),ne&&N(ne),W&&we(W)}),z.on("controlGranted",()=>{b("controller"),tt("success",Me.current("toasts.controlGranted"))}),z.on("controlDenied",C=>{tt("warning",C||Me.current("toasts.controlDenied"))}),z.on("controlRevoked",C=>{b("viewer"),tt("warning",C||Me.current("toasts.controlRevoked"))}),z.on("paired",C=>{const O=na(C);tt("success",Me.current("toasts.pairedSuccess")),gt(Date.now()),z.reconnectWith(Xl(O))}),z.on("exit",(C,O)=>{tt("info",`${Me.current("toasts.sessionEnded")}${O?`: ${O}`:""}${C!==void 0?` (${C})`:""}`)}),z.on("status",C=>{ye(C)}),z.on("error",C=>{var ee;if(C.code==="herdr_not_running"){((ee=me.current)==null?void 0:ee.phase)!=="starting"&&Ne({phase:"stopped"});return}if(C.code==="herdr_start_failed"&&me.current){Ne({phase:"failed",message:C.message||""});return}if(C.code==="host_font_unavailable")return;$e.current!==null&&(ct.current&&(clearTimeout(ct.current),ct.current=null),$e.current=null,ot(pi));const ne=`serverErrors.${String(C.code)}`,W=Me.current(ne),pe=W&&W!==ne?W:C.message||`[${C.code}]`;tt("error",pe)}),z.on("pasteFileReady",C=>{const O=$e.current;O!==null&&(ct.current&&(clearTimeout(ct.current),ct.current=null),ot({active:!0,phase:"completed",ratio:1,percent:100,statusText:Me.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{$e.current===O&&($e.current=null,ot(pi))},1200));for(const ne of Ut.current)try{ne(C)}catch(W){console.error("Error in pasteFileReady listener:",W)}}),z.on("rttUpdate",C=>{j(C)}),z.on("peerCount",C=>{se(Math.max(1,C))}),z.on("sessionReady",()=>{c("connected"),Ne(null)}),z.on("agentStatus",C=>{Le(C)}),z.on("updateStatus",C=>{if(le(C),!C.updateAvailable||F.current===C.latest)return;const O=`${C.latest}:${C.restartPending?"restart":"update"}`;I.current.has(O)||(I.current.add(O),tt("info",C.restartPending?Me.current("update.toastRestart",{version:C.latest}):Me.current("update.toast",{version:C.latest})))}),z.on("binaryData",C=>{pn.current(C)})}const vn=oe.current,qn=i.profiles.find(z=>z.id===i.activeProfileId),{hostFont:Yt,loadHostFont:hl,declineHostFont:Dn,syncHostFont:jt,ensureHostGlyphs:Zt}=Hx(vn),On=bx(i.fontFamily,Yt.font?{family:Yt.font.family,alias:Yt.status==="loaded"?Yt.alias:null,glyphs:Yt.glyphs.source?{family:Yt.glyphs.source.family,scope:Yt.glyphs.source.scope,alias:Yt.glyphs.alias}:null}:null),yi=i.fontSizeFollowsHost&&((Ci=Yt.font)!=null&&Ci.sizePx)?is(Yt.font.sizePx,i.fontSize):i.fontSize;w.useEffect(()=>{document.documentElement.style.setProperty("--tui-font",On)},[On]),w.useEffect(()=>{var z;(z=oe.current)==null||z.updateConfig(Xl(i))},[i]);const ia=w.useCallback(z=>{oe.current&&(z&&oe.current.updateConfig(z),oe.current.connect(Nt.current))},[]),os=w.useCallback(()=>{oe.current&&oe.current.disconnect()},[]),ml=w.useCallback(z=>{F.current=z,te(z),lx(z)},[]),ji=w.useCallback(()=>{const z=oe.current;z&&(Ne({phase:"starting"}),z.sendHerdrStart(),be.current=setTimeout(()=>{var C;be.current=null,((C=me.current)==null?void 0:C.phase)==="starting"&&Ne({phase:"failed",message:Me.current("herdrLaunch.timeout")})},lw))},[Ne]);w.useEffect(()=>()=>{be.current&&clearTimeout(be.current)},[]);const Ka=w.useCallback((z=!1)=>{oe.current&&oe.current.claimControl(z)},[]),vi=w.useCallback(()=>{var z;(z=oe.current)==null||z.releaseControl()},[]),xi=w.useCallback(z=>{if(y!=="controller"){_t();return}const C=oe.current;if(!C)return;const O=Dd(z);for(const ne of dn.current)try{ne(O)}catch(W){console.debug("Key input observer threw:",W)}C.sendInput(O)},[y,_t]),wi=w.useCallback(z=>(dn.current.add(z),()=>{dn.current.delete(z)}),[]),[si,St]=w.useState(Mo),Vn=w.useRef(Mo),Si=w.useCallback(z=>{const C={...Vn.current,[z]:!Vn.current[z]};Vn.current=C,St(C)},[]),Xn=w.useCallback(()=>{const z=Vn.current;return!z.ctrl&&!z.alt&&!z.shift?null:(Vn.current=Mo,St(Mo),z)},[]);w.useEffect(()=>{const z=oe.current;return z?Fv(z):void 0},[]);const ri=w.useCallback(z=>{y!=="controller"&&!Ho(z)||oe.current&&oe.current.sendInput(z)},[y]),pl=w.useCallback((z,C)=>{Nt.current={cols:z,rows:C},Ue({cols:z,rows:C}),oe.current&&oe.current.sendResize(z,C)},[]),Di=w.useCallback((z,C)=>y!=="controller"?(_t(),!1):oe.current?(oe.current.sendPasteFile(z,C),!0):!1,[y,_t]),Fa=w.useCallback(z=>(Ut.current.add(z),()=>{Ut.current.delete(z)}),[]),gl=w.useCallback(()=>{ct.current&&(clearTimeout(ct.current),ct.current=null),$e.current=null,ot(pi)},[]);w.useEffect(()=>{r!=="connected"&&$e.current!==null&&(ct.current&&(clearTimeout(ct.current),ct.current=null),$e.current=null,ot(pi))},[r]),w.useEffect(()=>()=>{ct.current&&clearTimeout(ct.current)},[]);const Oi=w.useCallback(async z=>{if(y!=="controller")return _t(),!1;if(!oe.current||r!=="connected")return tt("error",ce("serverErrors.host_offline")),!1;if($e.current!==null)return!1;const C=++mn.current;$e.current=C,ct.current&&(clearTimeout(ct.current),ct.current=null);const O="dataBase64"in z&&typeof z.dataBase64=="string";try{let ne;if(O)ne=z;else{const pe=z;if(ot({active:!0,phase:"reading",ratio:.1,percent:10,statusText:ce("virtualKeyboard.uploadProgressReading")}),!pe||pe.size===0)return tt("error",ce("clipboard.fileEmpty")),$e.current=null,ot(pi),!1;if(pe.type&&!pe.type.startsWith("image/"))return tt("error",ce("clipboard.unsupportedType")),$e.current=null,ot(pi),!1;ot({active:!0,phase:"processing",ratio:.35,percent:35,statusText:ce("virtualKeyboard.uploadProgressProcessing")});const ee=await pb(pe);if($e.current!==C)return!1;if(!ee)return tt("error",ce("clipboard.imageTooLarge")),$e.current=null,ot(pi),!1;ne=ee,ot({active:!0,phase:"processing",ratio:.6,percent:60,statusText:ce("virtualKeyboard.uploadProgressProcessing")})}ot({active:!0,phase:"sending",ratio:.75,percent:75,statusText:ce("virtualKeyboard.uploadProgressSending")});const W=Di(ne.mime,ne.dataBase64);return $e.current!==C?!1:W?(ot({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:ce("virtualKeyboard.uploadProgressWaitingHost")}),ct.current=setTimeout(()=>{$e.current===C&&($e.current=null,tt("error",ce("serverErrors.paste_file_write_failed")),ot(pi))},3e4),!0):($e.current=null,ot(pi),!1)}catch(ne){return console.error("Failed to process/upload image:",ne),$e.current===C&&($e.current=null,tt("error",ce("clipboard.imageTooLarge")),ot(pi)),!1}},[y,r,_t,tt,ce,Di]);return f.jsx(gb.Provider,{value:{connectionState:r,stateDetail:d,stateCode:m,role:y,controllerId:v,hostId:M,hostname:q,assignedClientId:ge,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:qn,isController:y==="controller",sharedWindowCount:J,terminalResetVersion:V,rttMs:A,statusPayload:Re,agentStatus:Ae,agentProfile:Fe,lastPairedAt:He,settings:i,hostPalette:ie,hostFont:Yt,loadHostFont:()=>{hl()},declineHostFont:Dn,syncHostFont:jt,ensureHostGlyphs:Zt,terminalFontFamily:On,terminalFontSize:yi,terminalDimensions:Ve,toasts:vt,adapter:vn,language:i.language,t:ce,setLanguage:dl,connect:ia,disconnect:os,switchProfile:$n,addProfileAndConnect:ta,renameProfile:fl,removeProfile:Ua,claimControl:Ka,releaseControl:vi,sendKey:xi,observeKeyInput:wi,modifierLatch:si,toggleModifierLatch:Si,consumeModifierLatch:Xn,sendBinary:ri,sendResize:pl,updateSettings:sn,addToast:tt,removeToast:yn,warnViewerMode:_t,subscribeToOutput:li,getPendingOutputChunkCount:gn,sendPasteFile:Di,subscribeToPasteFileReady:Fa,uploadProgress:Gt,uploadImage:Oi,resetUploadProgress:gl,herdrLaunch:D,startHerdr:ji,updateStatus:G,ignoredUpdate:fe,ignoreUpdate:ml},children:a})};function rt(){const a=w.useContext(gb);if(!a)throw new Error("useTerminal must be used within a TerminalProvider");return a}function gr(a){var i,s;return a?{blocked:((i=a.counts)==null?void 0:i.blocked)??0,done:((s=a.counts)==null?void 0:s.done)??0}:null}function rw(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function ow(a){if(!a)return"";const i=[];return a.blocked>0&&i.push(`${a.blocked}⚠`),a.done>0&&i.push(`${a.done}✓`),i.length>0?`(${i.join(" ")})`:""}function cw(a,i){if(!a||!i)return null;const s=new Map(a.agents.map(h=>[h.paneId,h.status]));let r=null;for(const h of i.agents)if(!(h.status!=="blocked"&&h.status!=="done")&&s.get(h.paneId)!==h.status){if(h.status==="blocked")return"blocked";r="done"}const c=gr(a),d=gr(i);return d.blocked>c.blocked?"blocked":(!r&&d.done>c.done&&(r="done"),r)}const uw={blocked:"%23f9e2af",done:"%23a6e3a1"};function dw(a){return`<circle cx='19' cy='5' r='4.5' fill='${uw[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function fw(a,i){return!i||!a.includes("</svg>")?a:a.replace("</svg>",`${dw(i)}</svg>`)}function Pp(a,i=document){const s=i.querySelector('link[rel~="icon"]');if(!s)return;s.dataset.baseHref===void 0&&(s.dataset.baseHref=s.getAttribute("href")??"");const r=fw(s.dataset.baseHref,a);s.getAttribute("href")!==r&&s.setAttribute("href",r)}let bi=null;function hw(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function bb(){const a=hw();if(a)try{bi=bi??new a,bi.state==="suspended"&&bi.resume()}catch{bi=null}}function mw(a=window){const i=()=>{bb(),s()},s=()=>{a.removeEventListener("pointerdown",i),a.removeEventListener("keydown",i)};return a.addEventListener("pointerdown",i),a.addEventListener("keydown",i),s}const pw={blocked:[880,660],done:[660,880]};function yb(a){if(!(!bi||bi.state!=="running"))try{const i=bi.currentTime;pw[a].forEach((s,r)=>{const c=bi.createOscillator(),d=bi.createGain(),h=i+r*.11;c.type="sine",c.frequency.value=s,d.gain.setValueAtTime(1e-4,h),d.gain.exponentialRampToValueAtTime(.06,h+.01),d.gain.exponentialRampToValueAtTime(1e-4,h+.09),c.connect(d),d.connect(bi.destination),c.start(h),c.stop(h+.1)})}catch{}}const gw=15e3,bw={blocked:[70,50,70],done:[40]};function yw(){const{agentStatus:a,settings:i,t:s}=rt(),r=w.useRef(i);r.current=i;const c=w.useRef(s);c.current=s;const d=w.useRef(null),h=w.useRef(Number.NEGATIVE_INFINITY);w.useEffect(()=>{Pp(i.agentAlertBadge?rw(gr(a)):null)},[a,i.agentAlertBadge]),w.useEffect(()=>()=>Pp(null),[]),w.useEffect(()=>{if(!(!i.agentAlertSound||typeof window>"u"))return mw(window)},[i.agentAlertSound]),w.useEffect(()=>{const m=d.current;d.current=a;const p=cw(m,a);if(!p)return;const y=Date.now();if(y-h.current<gw)return;h.current=y;const b=r.current,v=typeof document<"u"&&document.visibilityState==="hidden",S=v||typeof document<"u"&&!document.hasFocus();if(b.agentAlertVibrate&&!v&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(bw[p])}catch{}if(b.agentAlertSound&&S&&yb(p),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const M=gr(a),N=p==="blocked"?c.current("agents.notifyBlocked",{count:M.blocked}):c.current("agents.notifyDone",{count:M.done});try{new Notification("Herdr Remote",{body:N,tag:"herdr-agents"})}catch{}}},[a])}function vb(a){var i,s,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var c=a.length;for(i=0;i<c;i++)a[i]&&(s=vb(a[i]))&&(r&&(r+=" "),r+=s)}else for(s in a)a[s]&&(r&&(r+=" "),r+=s);return r}function vw(){for(var a,i,s=0,r="",c=arguments.length;s<c;s++)(a=arguments[s])&&(i=vb(a))&&(r&&(r+=" "),r+=i);return r}const xw=(a,i)=>{const s=new Array(a.length+i.length);for(let r=0;r<a.length;r++)s[r]=a[r];for(let r=0;r<i.length;r++)s[a.length+r]=i[r];return s},ww=(a,i)=>({classGroupId:a,validator:i}),xb=(a=new Map,i=null,s)=>({nextPart:a,validators:i,classGroupId:s}),Io="-",Zp=[],Sw="arbitrary..",Cw=a=>{const i=Mw(a),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return Tw(h);const m=h.split(Io),p=m[0]===""&&m.length>1?1:0;return wb(m,p,i)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=r[h],y=s[h];return p?y?xw(y,p):p:y||Zp}return s[h]||Zp}}},wb=(a,i,s)=>{if(a.length-i===0)return s.classGroupId;const c=a[i],d=s.nextPart.get(c);if(d){const y=wb(a,i+1,d);if(y)return y}const h=s.validators;if(h===null)return;const m=i===0?a.join(Io):a.slice(i).join(Io),p=h.length;for(let y=0;y<p;y++){const b=h[y];if(b.validator(m))return b.classGroupId}},Tw=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const i=a.slice(1,-1),s=i.indexOf(":"),r=i.slice(0,s);return r?Sw+r:void 0})(),Mw=a=>{const{theme:i,classGroups:s}=a;return Aw(s,i)},Aw=(a,i)=>{const s=xb();for(const r in a){const c=a[r];Kd(c,s,r,i)}return s},Kd=(a,i,s,r)=>{const c=a.length;for(let d=0;d<c;d++){const h=a[d];Ew(h,i,s,r)}},Ew=(a,i,s,r)=>{if(typeof a=="string"){Nw(a,i,s);return}if(typeof a=="function"){kw(a,i,s,r);return}Rw(a,i,s,r)},Nw=(a,i,s)=>{const r=a===""?i:Sb(i,a);r.classGroupId=s},kw=(a,i,s,r)=>{if(Lw(a)){Kd(a(r),i,s,r);return}i.validators===null&&(i.validators=[]),i.validators.push(ww(s,a))},Rw=(a,i,s,r)=>{const c=Object.entries(a),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];Kd(p,Sb(i,m),s,r)}},Sb=(a,i)=>{let s=a;const r=i.split(Io),c=r.length;for(let d=0;d<c;d++){const h=r[d];let m=s.nextPart.get(h);m||(m=xb(),s.nextPart.set(h,m)),s=m}return s},Lw=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,_w=a=>{if(a<1)return{get:()=>{},set:()=>{}};let i=0,s=Object.create(null),r=Object.create(null);const c=(d,h)=>{s[d]=h,i++,i>a&&(i=0,r=s,s=Object.create(null))};return{get(d){let h=s[d];if(h!==void 0)return h;if((h=r[d])!==void 0)return c(d,h),h},set(d,h){d in s?s[d]=h:c(d,h)}}},Nd="!",Qp=":",jw=[],Wp=(a,i,s,r,c)=>({modifiers:a,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:r,isExternal:c}),Dw=a=>{const{prefix:i,experimentalParseClassName:s}=a;let r=c=>{const d=[];let h=0,m=0,p=0,y;const b=c.length;for(let q=0;q<b;q++){const R=c[q];if(h===0&&m===0){if(R===Qp){d.push(c.slice(p,q)),p=q+1;continue}if(R==="/"){y=q;continue}}R==="["?h++:R==="]"?h--:R==="("?m++:R===")"&&m--}const v=d.length===0?c:c.slice(p);let S=v,M=!1;v.endsWith(Nd)?(S=v.slice(0,-1),M=!0):v.startsWith(Nd)&&(S=v.slice(1),M=!0);const N=y&&y>p?y-p:void 0;return Wp(d,M,S,N)};if(i){const c=i+Qp,d=r;r=h=>h.startsWith(c)?d(h.slice(c.length)):Wp(jw,!1,h,void 0,!0)}if(s){const c=r;r=d=>s({className:d,parseClassName:c})}return r},Ow=a=>{const i=new Map;return a.orderSensitiveModifiers.forEach((s,r)=>{i.set(s,1e6+r)}),s=>{const r=[];let c=[];for(let d=0;d<s.length;d++){const h=s[d],m=h[0]==="[",p=i.has(h);m||p?(c.length>0&&(c.sort(),r.push(...c),c=[]),r.push(h)):c.push(h)}return c.length>0&&(c.sort(),r.push(...c)),r}},zw=a=>({cache:_w(a.cacheSize),parseClassName:Dw(a),sortModifiers:Ow(a),postfixLookupClassGroupIds:Bw(a),...Cw(a)}),Bw=a=>{const i=Object.create(null),s=a.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)i[s[r]]=!0;return i},Hw=/\s+/,Uw=(a,i)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:c,sortModifiers:d,postfixLookupClassGroupIds:h}=i,m=[],p=a.trim().split(Hw);let y="";for(let b=p.length-1;b>=0;b-=1){const v=p[b],{isExternal:S,modifiers:M,hasImportantModifier:N,baseClassName:q,maybePostfixModifierPosition:R}=s(v);if(S){y=v+(y.length>0?" "+y:y);continue}let D=!!R,B;if(D){const F=q.substring(0,R);B=r(F);const I=B&&h[B]?r(q):void 0;I&&I!==B&&(B=I,D=!1)}else B=r(q);if(!B){if(!D){y=v+(y.length>0?" "+y:y);continue}if(B=r(q),!B){y=v+(y.length>0?" "+y:y);continue}D=!1}const G=M.length===0?"":M.length===1?M[0]:d(M).join(":"),le=N?G+Nd:G,fe=le+B;if(m.indexOf(fe)>-1)continue;m.push(fe);const te=c(B,D);for(let F=0;F<te.length;++F){const I=te[F];m.push(le+I)}y=v+(y.length>0?" "+y:y)}return y},Kw=(...a)=>{let i=0,s,r,c="";for(;i<a.length;)(s=a[i++])&&(r=Cb(s))&&(c&&(c+=" "),c+=r);return c},Cb=a=>{if(typeof a=="string")return a;let i,s="";for(let r=0;r<a.length;r++)a[r]&&(i=Cb(a[r]))&&(s&&(s+=" "),s+=i);return s},Fw=(a,...i)=>{let s,r,c,d;const h=p=>{const y=i.reduce((b,v)=>v(b),a());return s=zw(y),r=s.cache.get,c=s.cache.set,d=m,m(p)},m=p=>{const y=r(p);if(y)return y;const b=Uw(p,s);return c(p,b),b};return d=h,(...p)=>d(Kw(...p))},Iw=[],Jt=a=>{const i=s=>s[a]||Iw;return i.isThemeGetter=!0,i},Tb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Mb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gw=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Yw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$w=/\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$/,qw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ja=a=>Gw.test(a),Pe=a=>!!a&&!Number.isNaN(Number(a)),ki=a=>!!a&&Number.isInteger(Number(a)),sd=a=>a.endsWith("%")&&Pe(a.slice(0,-1)),Wi=a=>Yw.test(a),Ab=()=>!0,Pw=a=>$w.test(a)&&!qw.test(a),Fd=()=>!1,Zw=a=>Vw.test(a),Qw=a=>Xw.test(a),Ww=a=>!Se(a)&&!Ce(a),Jw=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),e1=a=>Ha(a,kb,Fd),Se=a=>Tb.test(a),sl=a=>Ha(a,Rb,Pw),Jp=a=>Ha(a,o1,Pe),t1=a=>Ha(a,_b,Ab),n1=a=>Ha(a,Lb,Fd),eg=a=>Ha(a,Eb,Fd),i1=a=>Ha(a,Nb,Qw),Ao=a=>Ha(a,jb,Zw),Ce=a=>Mb.test(a),Js=a=>ul(a,Rb),a1=a=>ul(a,Lb),tg=a=>ul(a,Eb),l1=a=>ul(a,kb),s1=a=>ul(a,Nb),Eo=a=>ul(a,jb,!0),r1=a=>ul(a,_b,!0),Ha=(a,i,s)=>{const r=Tb.exec(a);return r?r[1]?i(r[1]):s(r[2]):!1},ul=(a,i,s=!1)=>{const r=Mb.exec(a);return r?r[1]?i(r[1]):s:!1},Eb=a=>a==="position"||a==="percentage",Nb=a=>a==="image"||a==="url",kb=a=>a==="length"||a==="size"||a==="bg-size",Rb=a=>a==="length",o1=a=>a==="number",Lb=a=>a==="family-name",_b=a=>a==="number"||a==="weight",jb=a=>a==="shadow",c1=()=>{const a=Jt("color"),i=Jt("font"),s=Jt("text"),r=Jt("font-weight"),c=Jt("tracking"),d=Jt("leading"),h=Jt("breakpoint"),m=Jt("container"),p=Jt("spacing"),y=Jt("radius"),b=Jt("shadow"),v=Jt("inset-shadow"),S=Jt("text-shadow"),M=Jt("drop-shadow"),N=Jt("blur"),q=Jt("perspective"),R=Jt("aspect"),D=Jt("ease"),B=Jt("animate"),G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],le=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],fe=()=>[...le(),Ce,Se],te=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],I=()=>[Ce,Se,p],me=()=>[ja,"full","auto",...I()],be=()=>[ki,"none","subgrid",Ce,Se],Ne=()=>["auto",{span:["full",ki,Ce,Se]},ki,Ce,Se],ie=()=>[ki,"auto",Ce,Se],de=()=>["auto","min","max","fr",Ce,Se],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],we=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...I()],j=()=>[ja,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],J=()=>[ja,"screen","full","dvw","lvw","svw","min","max","fit",...I()],se=()=>[ja,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],V=()=>[a,Ce,Se],De=()=>[...le(),tg,eg,{position:[Ce,Se]}],Re=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ye=()=>["auto","cover","contain",l1,e1,{size:[Ce,Se]}],Ae=()=>[sd,Js,sl],Le=()=>["","none","full",y,Ce,Se],He=()=>["",Pe,Js,sl],gt=()=>["solid","dashed","dotted","double"],Ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ue=()=>[Pe,sd,tg,eg],vt=()=>["","none",N,Ce,Se],xt=()=>["none",Pe,Ce,Se],Fe=()=>["none",Pe,Ce,Se],Y=()=>[Pe,Ce,Se],oe=()=>[ja,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wi],breakpoint:[Wi],color:[Ab],container:[Wi],"drop-shadow":[Wi],ease:["in","out","in-out"],font:[Ww],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wi],shadow:[Wi],spacing:["px",Pe],text:[Wi],"text-shadow":[Wi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ja,Se,Ce,R]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,Se]}],"container-named":[Jw],columns:[{columns:[Pe,Se,Ce,m]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"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:fe()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:me()}],"inset-x":[{"inset-x":me()}],"inset-y":[{"inset-y":me()}],start:[{"inset-s":me(),start:me()}],end:[{"inset-e":me(),end:me()}],"inset-bs":[{"inset-bs":me()}],"inset-be":[{"inset-be":me()}],top:[{top:me()}],right:[{right:me()}],bottom:[{bottom:me()}],left:[{left:me()}],visibility:["visible","invisible","collapse"],z:[{z:[ki,"auto",Ce,Se]}],basis:[{basis:[ja,"full","auto",m,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pe,ja,"auto","initial","none",Se]}],grow:[{grow:["",Pe,Ce,Se]}],shrink:[{shrink:["",Pe,Ce,Se]}],order:[{order:[ki,"first","last","none",Ce,Se]}],"grid-cols":[{"grid-cols":be()}],"col-start-end":[{col:Ne()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":be()}],"row-start-end":[{row:Ne()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...we(),"normal"]}],"justify-self":[{"justify-self":["auto",...we()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...we(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...we(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...we(),"baseline"]}],"place-self":[{"place-self":["auto",...we()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[m,"screen",...j()]}],"min-w":[{"min-w":[m,"screen","none",...j()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",s,Js,sl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,r1,t1]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sd,Se]}],"font-family":[{font:[a1,n1,i]}],"font-features":[{"font-features":[Se]}],"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:[c,Ce,Se]}],"line-clamp":[{"line-clamp":[Pe,"none",Ce,Jp]}],leading:[{leading:[d,...I()]}],"list-image":[{"list-image":["none",Ce,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,Se]}],"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:[...gt(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pe,"from-font","auto",Ce,sl]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Pe,"auto",Ce,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[ki,Ce,Se]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,Se]}],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",Ce,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:De()}],"bg-repeat":[{bg:Re()}],"bg-size":[{bg:ye()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ki,Ce,Se],radial:["",Ce,Se],conic:[ki,Ce,Se]},s1,i1]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Ae()}],"gradient-via-pos":[{via:Ae()}],"gradient-to-pos":[{to:Ae()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:Le()}],"rounded-s":[{"rounded-s":Le()}],"rounded-e":[{"rounded-e":Le()}],"rounded-t":[{"rounded-t":Le()}],"rounded-r":[{"rounded-r":Le()}],"rounded-b":[{"rounded-b":Le()}],"rounded-l":[{"rounded-l":Le()}],"rounded-ss":[{"rounded-ss":Le()}],"rounded-se":[{"rounded-se":Le()}],"rounded-ee":[{"rounded-ee":Le()}],"rounded-es":[{"rounded-es":Le()}],"rounded-tl":[{"rounded-tl":Le()}],"rounded-tr":[{"rounded-tr":Le()}],"rounded-br":[{"rounded-br":Le()}],"rounded-bl":[{"rounded-bl":Le()}],"border-w":[{border:He()}],"border-w-x":[{"border-x":He()}],"border-w-y":[{"border-y":He()}],"border-w-s":[{"border-s":He()}],"border-w-e":[{"border-e":He()}],"border-w-bs":[{"border-bs":He()}],"border-w-be":[{"border-be":He()}],"border-w-t":[{"border-t":He()}],"border-w-r":[{"border-r":He()}],"border-w-b":[{"border-b":He()}],"border-w-l":[{"border-l":He()}],"divide-x":[{"divide-x":He()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":He()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...gt(),"hidden","none"]}],"divide-style":[{divide:[...gt(),"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:[...gt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pe,Ce,Se]}],"outline-w":[{outline:["",Pe,Js,sl]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",b,Eo,Ao]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",v,Eo,Ao]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:He()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Pe,sl]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":He()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",S,Eo,Ao]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Pe,Ce,Se]}],"mix-blend":[{"mix-blend":[...Ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ve()}],"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":[Pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ue()}],"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":Ue()}],"mask-image-t-to-pos":[{"mask-t-to":Ue()}],"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":Ue()}],"mask-image-r-to-pos":[{"mask-r-to":Ue()}],"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":Ue()}],"mask-image-b-to-pos":[{"mask-b-to":Ue()}],"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":Ue()}],"mask-image-l-to-pos":[{"mask-l-to":Ue()}],"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":Ue()}],"mask-image-x-to-pos":[{"mask-x-to":Ue()}],"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":Ue()}],"mask-image-y-to-pos":[{"mask-y-to":Ue()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Ce,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ue()}],"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":le()}],"mask-image-conic-pos":[{"mask-conic":[Pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ue()}],"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:De()}],"mask-repeat":[{mask:Re()}],"mask-size":[{mask:ye()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,Se]}],filter:[{filter:["","none",Ce,Se]}],blur:[{blur:vt()}],brightness:[{brightness:[Pe,Ce,Se]}],contrast:[{contrast:[Pe,Ce,Se]}],"drop-shadow":[{"drop-shadow":["","none",M,Eo,Ao]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Pe,Ce,Se]}],"hue-rotate":[{"hue-rotate":[Pe,Ce,Se]}],invert:[{invert:["",Pe,Ce,Se]}],saturate:[{saturate:[Pe,Ce,Se]}],sepia:[{sepia:["",Pe,Ce,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,Se]}],"backdrop-blur":[{"backdrop-blur":vt()}],"backdrop-brightness":[{"backdrop-brightness":[Pe,Ce,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Pe,Ce,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pe,Ce,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pe,Ce,Se]}],"backdrop-invert":[{"backdrop-invert":["",Pe,Ce,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Pe,Ce,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Pe,Ce,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Pe,Ce,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pe,"initial",Ce,Se]}],ease:[{ease:["linear","initial",D,Ce,Se]}],delay:[{delay:[Pe,Ce,Se]}],animate:[{animate:["none",B,Ce,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[q,Ce,Se]}],"perspective-origin":[{"perspective-origin":fe()}],rotate:[{rotate:xt()}],"rotate-x":[{"rotate-x":xt()}],"rotate-y":[{"rotate-y":xt()}],"rotate-z":[{"rotate-z":xt()}],scale:[{scale:Fe()}],"scale-x":[{"scale-x":Fe()}],"scale-y":[{"scale-y":Fe()}],"scale-z":[{"scale-z":Fe()}],"scale-3d":["scale-3d"],skew:[{skew:Y()}],"skew-x":[{"skew-x":Y()}],"skew-y":[{"skew-y":Y()}],transform:[{transform:[Ce,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:fe()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],zoom:[{zoom:[ki,Ce,Se]}],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",Ce,Se]}],"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":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",Ce,Se]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Pe,Js,sl,Jp]}],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"]}},u1=Fw(c1);function re(...a){return u1(vw(a))}var d1=Ug();const Ye={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},ai={ok:{text:"text-tui-ok",edgeL:"border-l-tui-ok",edgeB:"border-b-tui-ok"},warn:{text:"text-tui-warn",edgeL:"border-l-tui-warn",edgeB:"border-b-tui-warn"},bad:{text:"text-tui-bad",edgeL:"border-l-tui-bad",edgeB:"border-b-tui-bad"},idle:{text:"text-tui-faint",edgeL:"border-l-tui-border",edgeB:"border-b-tui-border"},accent:{text:"text-tui-accent",edgeL:"border-l-tui-accent",edgeB:"border-b-tui-accent"},alt:{text:"text-tui-alt",edgeL:"border-l-tui-alt",edgeB:"border-b-tui-alt"},info:{text:"text-tui-info",edgeL:"border-l-tui-info",edgeB:"border-b-tui-info"}},yr={ok:ai.ok.text,warn:ai.warn.text,bad:ai.bad.text,idle:ai.idle.text,accent:ai.accent.text,alt:ai.alt.text,info:ai.info.text},_n=({level:a,className:i})=>f.jsx("span",{"aria-hidden":"true",className:re("select-none leading-none",yr[a],i),children:a==="idle"?Ye.off:Ye.on}),Db=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:re("select-none text-tui-faint",a),children:Ye.dot}),an=({title:a,aside:i,tone:s="accent",className:r,bodyClassName:c,children:d,...h})=>f.jsxs("fieldset",{className:re("tui-panel tui-block relative min-w-0 border border-tui-border bg-tui-base",a?"px-3 pb-3 pt-1":"p-3",r),...h,children:[a?f.jsx("legend",{className:re("flex items-center gap-2 text-tui font-bold",yr[s]),children:f.jsx("span",{children:a})}):null,i?f.jsx("span",{className:"pointer-events-none absolute -top-[10px] right-2 max-w-[60%] truncate bg-tui-base px-1 text-tui-sm text-tui-faint",children:i}):null,f.jsx("div",{className:re("min-w-0",c),children:d})]}),wn=({label:a,labelWidth:i=16,className:s,children:r})=>f.jsxs("div",{className:re("flex items-baseline gap-2 text-tui",s),children:[f.jsx("span",{className:"shrink-0 truncate text-tui-muted",style:{width:`${i}ch`},title:typeof a=="string"?a:void 0,children:a}),f.jsx("span",{className:"min-w-0 flex-1 text-tui-text",children:r})]}),gi=({className:a,label:i})=>i?f.jsxs("div",{className:re("flex items-center gap-2",a),children:[f.jsx("span",{className:"h-px w-3 bg-tui-border-dim","aria-hidden":"true"}),f.jsx("span",{className:"text-tui-sm text-tui-faint",children:i}),f.jsx("span",{className:"h-px flex-1 bg-tui-border-dim","aria-hidden":"true"})]}):f.jsx("div",{className:re("h-px w-full bg-tui-border-dim",a),"aria-hidden":"true"}),f1={default:"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",primary:"border-tui-accent text-tui-accent hover:bg-tui-accent hover:text-tui-crust active:bg-tui-accent-dim",danger:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust active:bg-tui-bad",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust active:bg-tui-warn",ghost:"border-transparent text-tui-muted hover:text-tui-accent hover:border-tui-border active:bg-tui-selection disabled:border-transparent"},je=({variant:a="default",brackets:i=!0,glyph:s,block:r=!1,className:c,children:d,type:h="button",...m})=>f.jsxs("button",{type:h,className:re("tui-focusable inline-flex select-none items-center justify-center gap-1.5 border bg-transparent px-2 py-0.5 text-tui font-medium transition-colors","disabled:cursor-not-allowed disabled:border-tui-border-dim disabled:text-tui-faint disabled:hover:bg-transparent",f1[a],r&&"w-full",c),...m,children:[i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"["}):null,s?f.jsx("span",{"aria-hidden":"true",className:"leading-none",children:s}):null,f.jsx("span",{className:"truncate",children:d}),i?f.jsx("span",{"aria-hidden":"true",className:"opacity-60",children:"]"}):null]}),qo=({tone:a="accent",dot:i=!1,className:s,children:r})=>f.jsxs("span",{className:re("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",yr[a],s),children:[i?f.jsx(_n,{level:a}):null,r]}),Id=({tabs:a,activeId:i,onSelect:s,ariaLabel:r,className:c,labelClassName:d})=>f.jsx("nav",{className:re("flex items-center gap-2",c),"aria-label":r,children:a.map((h,m)=>{const p=h.id===i;return f.jsxs(_i.Fragment,{children:[m>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:Ye.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>s(h.id),"aria-current":p?"page":void 0,"aria-label":h.ariaLabel??h.label,title:h.title,className:re("tui-focusable select-none whitespace-nowrap border-b px-0.5 pb-0.5 text-tui transition-colors",p?"border-tui-accent font-bold text-tui-accent":"border-transparent text-tui-muted hover:border-tui-border-bright hover:text-tui-text"),children:[h.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:re("text-tui-faint",p&&"text-tui-accent"),children:h.index}):null,f.jsx("span",{"aria-hidden":"true",className:re("ml-1",d),children:h.label})]})]},h.id)})}),Ob=({hints:a,className:i})=>f.jsx("div",{className:re("flex flex-wrap items-center gap-x-3 gap-y-0.5 text-tui-sm text-tui-faint",i),children:a.map((s,r)=>f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("kbd",{className:"border border-tui-border-dim px-1 not-italic text-tui-muted",children:s.keys}),f.jsx("span",{children:s.action})]},`${s.keys}-${r}`))}),Sn=({htmlFor:a,hint:i,className:s,children:r})=>f.jsxs("label",{htmlFor:a,className:re("block text-tui-sm font-bold text-tui-muted",s),children:[r,i?f.jsx("span",{className:"ml-2 font-normal text-tui-faint",children:i}):null]}),Cn=_i.forwardRef(({className:a,...i},s)=>f.jsx("input",{ref:s,className:re("tui-input w-full px-2 py-1 text-tui",a),...i}));Cn.displayName="Input";const Go=_i.forwardRef(({className:a,children:i,...s},r)=>f.jsx("select",{ref:r,className:re("tui-input w-full px-2 py-1 text-tui",a),...s,children:i}));Go.displayName="Select";const Oa=({checked:a,onChange:i,disabled:s=!1,label:r,description:c,className:d,id:h})=>f.jsxs("label",{className:re("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",s&&"cursor-not-allowed opacity-60",d),children:[f.jsx("input",{id:h,type:"checkbox",className:"sr-only",checked:a,disabled:s,onChange:m=>i(m.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:re("mt-px shrink-0 font-bold leading-tight",a?"text-tui-ok":"text-tui-faint",!s&&"group-hover:text-tui-accent"),children:a?"[x]":"[ ]"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:re("block",a?"text-tui-text":"text-tui-muted"),children:r}),c?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:c}):null]})]}),er=({checked:a,onChange:i,name:s,disabled:r=!1,label:c,description:d,className:h})=>f.jsxs("label",{className:re("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",h),children:[f.jsx("input",{type:"radio",name:s,className:"sr-only",checked:a,disabled:r,onChange:i}),f.jsx("span",{"aria-hidden":"true",className:re("mt-px shrink-0 font-bold leading-tight",a?"text-tui-accent":"text-tui-faint",!r&&"group-hover:text-tui-accent"),children:a?"(•)":"( )"}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:re("block",a?"text-tui-text":"text-tui-muted"),children:c}),d?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),zb=({value:a,width:i=20,tone:s="accent",className:r})=>{const c=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,d=Math.round(c*i);return f.jsxs("span",{className:re("inline-flex select-none whitespace-pre font-mono leading-none",r),role:"presentation",children:[f.jsx("span",{className:yr[s],children:Ye.meterFull.repeat(d)}),f.jsx("span",{className:"text-tui-border",children:Ye.meterEmpty.repeat(Math.max(0,i-d))})]})},h1={ok:"bg-tui-ok",warn:"bg-tui-warn",bad:"bg-tui-bad",idle:"bg-tui-border",accent:"bg-tui-accent",alt:"bg-tui-alt",info:"bg-tui-info"},m1=({ratio:a,label:i,tone:s="accent",className:r,...c})=>{const d=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return f.jsxs("div",{className:re("relative h-[var(--tui-row)] w-full overflow-hidden border border-tui-border bg-tui-mantle",r),role:"progressbar","aria-valuenow":Math.round(d*100),"aria-valuemin":0,"aria-valuemax":100,...c,children:[f.jsx("div",{className:re("absolute inset-y-0 left-0",h1[s]),style:{width:`${d*100}%`},"aria-hidden":"true"}),i!==void 0?f.jsx("span",{className:"absolute inset-0 flex items-center justify-center whitespace-nowrap px-1 text-tui font-bold text-tui-text mix-blend-difference",children:i}):null]})};function Gd({columns:a,items:i,rowKey:s,empty:r,className:c}){return i.length===0?f.jsx("div",{className:re("px-1 py-4 text-center text-tui text-tui-faint",c),children:r}):f.jsx("div",{className:re("w-full overflow-x-auto",c),children:f.jsxs("table",{className:"w-full border-collapse text-tui",children:[f.jsx("thead",{children:f.jsx("tr",{className:"border-b border-tui-border",children:a.map(d=>f.jsx("th",{scope:"col",style:d.width?{width:`${d.width}ch`}:void 0,className:re("whitespace-nowrap px-2 py-1 text-tui-sm font-bold text-tui-muted",d.align==="right"?"text-right":"text-left",d.className),children:d.header},d.key))})}),f.jsx("tbody",{children:i.map((d,h)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(m=>f.jsx("td",{className:re("px-2 py-1 align-top text-tui-text",m.align==="right"?"text-right":"text-left",m.className),children:m.render(d,h)},m.key))},s(d,h)))})]})})}const Vo=({isOpen:a,onClose:i,title:s,subtitle:r,closeLabel:c,footer:d,hints:h,size:m="md",className:p,children:y})=>{if(!a)return null;const b=m==="sm"?"max-w-md":m==="lg"?"max-w-3xl":"max-w-xl",v=`tui-modal-${s.replace(/\s+/g,"-").toLowerCase()}`,S=f.jsx("div",{className:"fixed inset-0 inset-x-0 z-50 flex items-center justify-center overflow-hidden bg-tui-crust/85 p-3 sm:p-6",style:{height:"var(--app-height, 100dvh)",width:"100vw"},role:"dialog","aria-modal":"true","aria-labelledby":v,onMouseDown:M=>{M.target===M.currentTarget&&i()},children:f.jsxs("div",{className:re("relative flex max-h-full w-full flex-col border border-tui-border bg-tui-base",b,p),children:[f.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-tui-border bg-tui-mantle px-3 py-1.5",children:[f.jsx("h2",{id:v,className:"truncate text-tui font-bold text-tui-accent",children:s}),r?f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-sm text-tui-faint",children:r}):f.jsx("span",{className:"flex-1"}),f.jsx(je,{variant:"ghost",onClick:i,"aria-label":c,title:c,children:"esc"})]}),f.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-3",children:y}),d||h?f.jsxs("footer",{className:"flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-tui-border bg-tui-mantle px-3 py-1.5",children:[h?f.jsx(Ob,{hints:h}):f.jsx("span",{}),d?f.jsx("div",{className:"flex items-center gap-2",children:d}):null]}):null]})});return typeof document>"u"?S:d1.createPortal(S,document.body)},ts=({tone:a="accent",className:i,children:s,action:r})=>{const c=a==="ok"?Ye.check:a==="bad"?Ye.cross:a==="warn"?Ye.warn:"›",d=ai[a].edgeL;return f.jsxs("div",{className:re("flex items-start gap-2 border border-tui-border-dim border-l-2 bg-tui-mantle px-2 py-1.5 text-tui",d,i),children:[f.jsx("span",{"aria-hidden":"true",className:re("shrink-0 font-bold",yr[a]),children:c}),f.jsx("div",{className:"min-w-0 flex-1 leading-snug text-tui-text",children:s}),r?f.jsx("div",{className:"shrink-0",children:r}):null]})},ng=({active:a=!1,className:i,children:s})=>f.jsx("span",{className:re("inline-flex min-w-[2ch] select-none items-center justify-center border px-1 text-tui",a?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border bg-tui-surface text-tui-muted",i),children:s}),ig=({items:a,className:i})=>{const s=a.filter(Boolean);return f.jsx("span",{className:re("flex min-w-0 items-center gap-1.5",i),children:s.map((r,c)=>f.jsxs(_i.Fragment,{children:[c>0?f.jsx(Db,{className:"shrink-0"}):null,r]},c))})},Bb=({left:a,right:i,className:s})=>f.jsxs("footer",{className:re("relative flex h-[var(--tui-row)] w-full shrink-0 items-center justify-between gap-3 overflow-visible border-t border-tui-border bg-tui-mantle px-2 text-tui-sm",s),children:[f.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-muted",children:a}),f.jsx("div",{className:"flex shrink-0 items-center gap-3",children:i})]}),p1=({name:a,tagline:i,aside:s,tabs:r,activeTabId:c,onSelectTab:d,tabsAriaLabel:h,hints:m,footerAside:p,bodyClassName:y,className:b,children:v})=>f.jsxs("div",{className:re("flex h-full min-h-0 w-full flex-col bg-tui-crust",b),children:[f.jsxs("div",{className:"flex h-[var(--tui-row)] shrink-0 items-center justify-between gap-3 overflow-hidden border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[f.jsx("span",{className:"shrink-0 font-bold text-tui-accent",children:a}),i?f.jsx("span",{className:"hidden truncate text-tui-sm text-tui-faint sm:block",children:i}):null]}),s?f.jsx("span",{className:"flex shrink-0 items-center gap-2",children:s}):null]}),r&&r.length>0&&c!==void 0&&d?f.jsx("div",{className:"scrollbar-none shrink-0 overflow-x-auto border-b border-tui-border bg-tui-mantle px-2",children:f.jsx(Id,{tabs:r,activeId:c,onSelect:d,ariaLabel:h,className:"gap-3"})}):null,f.jsx("div",{className:re("min-h-0 flex-1 overflow-y-auto p-2",y),children:v}),m||p?f.jsx(Bb,{left:m?f.jsx(Ob,{hints:m}):null,right:p}):null]}),ag=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],cl=({className:a,label:i})=>{const[s,r]=_i.useState(0);return _i.useEffect(()=>{const c=setInterval(()=>r(d=>(d+1)%ag.length),90);return()=>clearInterval(c)},[]),f.jsxs("span",{className:re("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:ag[s]}),i?f.jsx("span",{children:i}):null]})},No="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",ko="text-tui-muted hover:border-tui-border hover:text-tui-accent",g1="border-tui-accent bg-tui-accent text-tui-crust",b1=({currentView:a,onNavigate:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:c,onToggleVirtualKeyboard:d,isVirtualKeyboardOpen:h})=>{const{addToast:m,language:p,setLanguage:y,t:b}=rt(),v=()=>{const M=p==="zh"?"en":"zh";y(M),m("info",Hd(M,"toasts.switchedLanguage",{lang:M==="zh"?"简体中文":"English"}))},S=[{id:"terminal",label:b("header.terminalTab"),index:1,ariaLabel:b("header.terminalTab")},...s||a==="admin"?[{id:"admin",label:b("header.adminTab"),index:2,ariaLabel:b("header.adminTab")}]:[]];return f.jsx("header",{role:"banner",className:"z-30 w-full shrink-0 select-none overflow-hidden border-b border-tui-border bg-tui-mantle px-2 pt-[max(env(safe-area-inset-top,0px),0.125rem)]",children:f.jsxs("div",{className:"scrollbar-none flex min-h-[var(--tui-row)] items-center gap-2 overflow-x-auto text-tui",children:[f.jsxs("span",{className:"flex shrink-0 items-baseline gap-2",children:[f.jsx("span",{className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("span",{className:"hidden text-tui-sm text-tui-faint sm:inline",children:b("header.tagline")})]}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsx(Id,{tabs:S,activeId:a,onSelect:M=>i(M),ariaLabel:b("header.mainNavigationAria"),className:"shrink-0 gap-3"}),f.jsx("span",{"aria-hidden":"true",className:"h-4 w-px shrink-0 bg-tui-border"}),f.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[f.jsx("button",{type:"button",onClick:v,className:re(No,ko),title:b("header.languageToggleTitle"),"aria-label":b("header.languageToggleTitle"),children:b("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:d,className:re(No,h?g1:ko),title:b("header.virtualKeyboardTitle"),"aria-label":b("header.virtualKeyboardTitle"),children:b("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:r,className:re(No,ko),title:b("header.pairingTitle"),"aria-label":b("header.pairingTitle"),children:b("header.actionPairing")}),f.jsx("button",{type:"button",onClick:c,className:re(No,ko),title:b("header.settingsTitle"),"aria-label":b("header.settingsTitle"),children:b("header.actionSettings")})]})]})})},Ro=({tone:a,glyph:i,message:s,assertive:r=!1,action:c})=>f.jsxs("aside",{className:re("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",ai[a].edgeB),"aria-live":r?"assertive":"polite",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("span",{"aria-hidden":"true",className:re("shrink-0",ai[a].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:s})]}),c]}),y1=()=>{const{connectionState:a,stateDetail:i,connect:s,settings:r,t:c}=rt();return a==="connected"||!r.token&&!r.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx(Ro,{tone:"accent",glyph:f.jsx(cl,{}),message:c("statusBanner.connecting")}):a==="reconnecting"?f.jsx(Ro,{tone:"warn",glyph:f.jsx(cl,{}),assertive:!0,message:i||c("statusBanner.reconnectingDefault"),action:f.jsx(je,{variant:"warn",onClick:()=>s(),className:"shrink-0",children:c("statusBanner.reconnectNow")})}):a==="error"?f.jsx(Ro,{tone:"bad",glyph:Ye.cross,assertive:!0,message:i||c("statusBanner.errorDefault"),action:f.jsx(je,{variant:"danger",onClick:()=>s(),className:"shrink-0",children:c("common.retry")})}):a==="disconnected"?f.jsx(Ro,{tone:"idle",glyph:Ye.off,message:c("statusBanner.disconnected"),action:f.jsx(je,{variant:"primary",onClick:()=>s(),className:"shrink-0",children:c("common.connect")})}):null};var v1=bv(),x1=yv(),rd={exports:{}},lg;function w1(){return lg||(lg=1,(function(a,i){(function(s,r){a.exports=r()})(self,(()=>(()=>{var s={6:(h,m)=>{function p(b){try{const v=new URL(b),S=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return b.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(m,"__esModule",{value:!0}),m.LinkComputer=m.WebLinkProvider=void 0,m.WebLinkProvider=class{constructor(b,v,S,M={}){this._terminal=b,this._regex=v,this._handler=S,this._options=M}provideLinks(b,v){const S=y.computeLink(b,this._regex,this._terminal,this._handler);v(this._addCallbacks(S))}_addCallbacks(b){return b.map((v=>(v.leave=this._options.leave,v.hover=(S,M)=>{if(this._options.hover){const{range:N}=v;this._options.hover(S,M,N)}},v)))}};class y{static computeLink(v,S,M,N){const q=new RegExp(S.source,(S.flags||"")+"g"),[R,D]=y._getWindowedLineStrings(v-1,M),B=R.join("");let G;const le=[];for(;G=q.exec(B);){const fe=G[0];if(!p(fe))continue;const[te,F]=y._mapStrIdx(M,D,0,G.index),[I,me]=y._mapStrIdx(M,te,F,fe.length);if(te===-1||F===-1||I===-1||me===-1)continue;const be={start:{x:F+1,y:te+1},end:{x:me,y:I+1}};le.push({range:be,text:fe,activate:N})}return le}static _getWindowedLineStrings(v,S){let M,N=v,q=v,R=0,D="";const B=[];if(M=S.buffer.active.getLine(v)){const G=M.translateToString(!0);if(M.isWrapped&&G[0]!==" "){for(R=0;(M=S.buffer.active.getLine(--N))&&R<2048&&(D=M.translateToString(!0),R+=D.length,B.push(D),M.isWrapped&&D.indexOf(" ")===-1););B.reverse()}for(B.push(G),R=0;(M=S.buffer.active.getLine(++q))&&M.isWrapped&&R<2048&&(D=M.translateToString(!0),R+=D.length,B.push(D),D.indexOf(" ")===-1););}return[B,N]}static _mapStrIdx(v,S,M,N){const q=v.buffer.active,R=q.getNullCell();let D=M;for(;N;){const B=q.getLine(S);if(!B)return[-1,-1];for(let G=D;G<B.length;++G){B.getCell(G,R);const le=R.getChars();if(R.getWidth()&&(N-=le.length||1,G===B.length-1&&le==="")){const fe=q.getLine(S+1);fe&&fe.isWrapped&&(fe.getCell(0,R),R.getWidth()===2&&(N+=1))}if(N<0)return[S,G]}S++,D=0}return[S,D]}}m.LinkComputer=y}},r={};function c(h){var m=r[h];if(m!==void 0)return m.exports;var p=r[h]={exports:{}};return s[h](p,p.exports,c),p.exports}var d={};return(()=>{var h=d;Object.defineProperty(h,"__esModule",{value:!0}),h.WebLinksAddon=void 0;const m=c(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(b,v){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}h.WebLinksAddon=class{constructor(b=y,v={}){this._handler=b,this._options=v}activate(b){this._terminal=b;const v=this._options,S=v.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new m.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),d})()))})(rd)),rd.exports}var S1=w1();const Hb="\x1B",C1=/^\x1b\[[IO]/,Ub=/^\x1b\[<(\d+);\d+;\d+[Mm]/,T1=/^\x1b\[M[\s\S]{3}/,M1=[/^\x1b\[\?[\d;]*c/,/^\x1b\[>[\d;]*c/,/^\x1b\[\d+;\d+R/,/^\x1b\[\?\d+;\d+R/,/^\x1b\[\d+n/,/^\x1b\[\?[\d;]*\$y/,/^\x1b\[[\d;]*t/,/^\x1b\[\?\d+u/,/^\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/,/^\x1bP[\s\S]*?\x1b\\/],A1=/^\x1b\[1;[2-8]R/;function sg(a){if(A1.test(a))return 0;const i=C1.exec(a);if(i)return i[0].length;const s=Ub.exec(a);if(s){const r=Number(s[1]);return(r&32)!==0&&(r&3)===3&&(r&64)===0?s[0].length:0}for(const r of M1){const c=r.exec(a);if(c)return c[0].length}return 0}function Kb(a){if(!a.startsWith(Hb))return"keys";if(Ub.test(a)||T1.test(a)){let s=a;for(;s.length>0;){const r=sg(s);if(r===0)return"pointer";s=s.slice(r)}return"passive"}let i=a;for(;i.length>0;){const s=sg(i);if(s===0)return"keys";i=i.slice(s)}return"passive"}function E1(a){return a===Hb}const N1=20,k1=6,R1=500,L1=300,ss=13,Fb=.602,Ib=1.3;function ea(a,i){return Number.isFinite(a)&&a>0?a:i}function rg(a,i,s){return Math.min(s,Math.max(i,a))}function og(a){const{width:i,height:s,cellWidth:r,cellHeight:c,minCols:d=N1,minRows:h=k1,maxCols:m=R1,maxRows:p=L1}=a,y=ea(r,ss*Fb),b=ea(c,ss*Ib);return{cols:rg(Math.floor(ea(i,0)/y),d,m),rows:rg(Math.floor(ea(s,0)/b),h,p)}}function rl(a,i=ss){var r,c,d;if(a)try{const h=a._core,m=(d=(c=(r=h==null?void 0:h._renderService)==null?void 0:r.dimensions)==null?void 0:c.css)==null?void 0:d.cell;if(m&&m.width&&m.width>0&&m.height&&m.height>0)return{cellWidth:m.width,cellHeight:m.height,measured:!0}}catch{}const s=ea(i,ss);return{cellWidth:Math.round(s*Fb*100)/100,cellHeight:Math.round(s*Ib*100)/100,measured:!1}}function _1(a){var r;const i=(r=a==null?void 0:a.querySelector)==null?void 0:r.call(a,".xterm-viewport");if(!i)return 0;const s=(i.offsetWidth||0)-(i.clientWidth||0);return Number.isFinite(s)&&s>0?s:0}function od(a,i,s){if(!a)return{width:i,height:s};let r=0,c=0;if(typeof a.getBoundingClientRect=="function"){const d=a.getBoundingClientRect();r=(d==null?void 0:d.width)||0,c=(d==null?void 0:d.height)||0}return{width:ea(r,ea(a.clientWidth,i)),height:ea(c,ea(a.clientHeight,s))}}function Gb(a,i,s,r){const c=Number.isFinite(r)&&r>.01?r:1;return{clientX:s.left+(a-s.left)/c,clientY:s.top+(i-s.top)/c}}function tr(a){var i,s;if(!a)return!1;try{const r=a.modes;if(r&&typeof r.mouseTrackingMode=="string"&&r.mouseTrackingMode!=="none")return!0;const c=a._core;if((i=c==null?void 0:c._coreMouseService)!=null&&i.areMouseEventsActive||(s=c==null?void 0:c.coreMouseService)!=null&&s.areMouseEventsActive||c!=null&&c.mouseMode&&c.mouseMode!=="none")return!0}catch{}return!1}function j1(a,i){const s=i.button??0,r=i.buttons??(a==="mouseup"?0:1);return new MouseEvent(a,{bubbles:!0,cancelable:!0,clientX:i.clientX,clientY:i.clientY,screenX:i.clientX,screenY:i.clientY,button:s,buttons:r})}function cg(a,i,s){const r=j1(i,s);return a.dispatchEvent(r)}class D1{constructor(i){Z(this,"options");Z(this,"state","idle");Z(this,"startX",0);Z(this,"startY",0);Z(this,"lastX",0);Z(this,"lastY",0);Z(this,"activeTarget",null);Z(this,"longPressTimer",null);Z(this,"capturedPointerId",null);Z(this,"captureElement",null);Z(this,"scrollRemainderY",0);this.options={longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,...i}}getState(){return this.state}setGestureState(i){var s,r;this.state!==i&&(this.state=i,(r=(s=this.options).onGestureStateChange)==null||r.call(s,i))}getActiveBuffer(i){var s;try{return((s=i.buffer)==null?void 0:s.active)||null}catch{return null}}getViewportY(i){var r;const s=(r=this.getActiveBuffer(i))==null?void 0:r.viewportY;return typeof s=="number"&&Number.isFinite(s)?s:null}blurTerminal(i){var s;try{(s=i.blur)==null||s.call(i)}catch{}}getLogicalCoordinates(i,s){const r=this.options.getScale?this.options.getScale():1,c=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(r!==1&&c&&typeof c.getBoundingClientRect=="function"){const d=c.getBoundingClientRect();return Gb(i,s,d,r)}return{clientX:i,clientY:s}}getViewportElement(i){var c;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm-viewport"))||((c=i.element)==null?void 0:c.querySelector(".xterm-viewport"))||null}isInputLineHit(i,s){var B;const r=(B=s.buffer)==null?void 0:B.active,c=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(c==null?void 0:c.querySelector(".xterm-screen"))||s.element||c,h=rl(s);if(!d||typeof d.getBoundingClientRect!="function"||h.cellHeight<=0)return!1;const m=d.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),y=m.width>0&&m.height>0;if(![r==null?void 0:r.cursorY,r==null?void 0:r.viewportY,r==null?void 0:r.baseY].every(G=>typeof G=="number"&&Number.isFinite(G)))return!1;const v=r==null?void 0:r.cursorY,S=r==null?void 0:r.viewportY,N=(r==null?void 0:r.baseY)+v-S,q=m.top+N*h.cellHeight,R=q+h.cellHeight,D=Number(s.rows);return N>=0&&(!Number.isFinite(D)||N<D)&&p.clientY>=q-2&&p.clientY<=R+2&&(!y||p.clientX>=m.left&&p.clientX<=m.right)}resolveDispatchTarget(i,s){var m;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(r==null?void 0:r.querySelector(".xterm-screen"))||s.querySelector(".xterm-screen")||null,d=((m=c==null?void 0:c.closest)==null?void 0:m.call(c,".xterm"))||null;let h=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(h=document.elementFromPoint(i.clientX,i.clientY)),h&&d&&(h===d||d.contains(h))?h:c||r||s}getMouseReport(i,s){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,c=(r==null?void 0:r.querySelector(".xterm-screen"))||s.element;if(!c||typeof c.getBoundingClientRect!="function")return null;const d=c.getBoundingClientRect(),h=this.getLogicalCoordinates(i.clientX,i.clientY),m=rl(s);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,d.width||s.cols*m.cellWidth),y=Math.max(1,d.height||s.rows*m.cellHeight),b=Math.max(0,Math.min(p-1,h.clientX-d.left)),v=Math.max(0,Math.min(y-1,h.clientY-d.top)),S=Math.max(0,Math.min(s.cols-1,Math.floor(b/m.cellWidth))),M=Math.max(0,Math.min(s.rows-1,Math.floor(v/m.cellHeight)));return{col:S,row:M,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getCoreMouseService(i){var r,c;const s=i;return s.coreMouseService||((r=s._core)==null?void 0:r.coreMouseService)||((c=s._core)==null?void 0:c._coreMouseService)||null}getCoreService(i){var r;const s=i;return s.coreService||((r=s._core)==null?void 0:r.coreService)||null}getWheelDispatchTarget(i){const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm"))||i.element||null}dispatchWheel(i,s,r,c){const d=this.getWheelDispatchTarget(r);if(!d||typeof WheelEvent>"u"||s===0)return!1;const h=this.getLogicalCoordinates(i.clientX,i.clientY),m=s<0?-1:1;let p=0;for(let y=0;y<Math.abs(s);y+=1)try{const b=new WheelEvent("wheel",{bubbles:!0,cancelable:!0,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:m,deltaMode:1,ctrlKey:!!(c!=null&&c.ctrlKey),altKey:!!(c!=null&&c.altKey),shiftKey:!!(c!=null&&c.shiftKey)});d.dispatchEvent(b),p+=1}catch{return p>0}return p>0}emitWheel(i,s,r,c){if(s===0)return!1;if(this.dispatchWheel(i,s,r,c))return!0;const d=this.getCoreMouseService(r);if(!(d!=null&&d.triggerMouseEvent))return!1;let h=0;for(let m=0;m<Math.abs(s);m+=1){const p=this.getMouseReport(i,r);p&&(p.button=4,p.action=s<0?0:1,p.ctrl=!!(c!=null&&c.ctrlKey),p.alt=!!(c!=null&&c.altKey),p.shift=!!(c!=null&&c.shiftKey),d.triggerMouseEvent(p)&&(h+=1))}return h>0}scrollAlternateBuffer(i,s,r,c){var h;if(s===0)return"none";const d=tr(r);if(!d&&!this.options.getIsController())return"none";if(this.emitWheel(i,s,r,c))return d?"application-mouse":"application-keys";if(!d){const m=this.getCoreService(r);if(!(m!=null&&m.triggerDataEvent))return"none";const y=`\x1B${!!((h=m.decPrivateModes)!=null&&h.applicationCursorKeys)?"O":"["}${s<0?"A":"B"}`;return m.triggerDataEvent(y.repeat(Math.abs(s)),!0),"application-keys"}return"none"}emitMouse(i,s,r){const c=this.options.getTerminal();if(!c)return;const d=this.getCoreMouseService(c);if(d!=null&&d.triggerMouseEvent){const m=this.getMouseReport(s,c);m&&(m.action=i==="mousedown"?1:i==="mouseup"?0:32,m.ctrl=!!(r!=null&&r.ctrlKey),m.alt=!!(r!=null&&r.altKey),m.shift=!!(r!=null&&r.shiftKey),d.triggerMouseEvent(m));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const h=this.getLogicalCoordinates(s.clientX,s.clientY);cg(this.activeTarget,i,{clientX:h.clientX,clientY:h.clientY,button:0,buttons:i==="mouseup"?0:1})}beginGesture(i,s){this.startX=i.clientX,this.startY=i.clientY,this.lastX=i.clientX,this.lastY=i.clientY,this.setGestureState("pending"),this.scrollRemainderY=0,this.activeTarget=this.resolveDispatchTarget(i,s),this.clearLongPressTimer(),this.longPressTimer=setTimeout(()=>{var r,c;this.state==="pending"&&(this.setGestureState("longpress"),(c=(r=this.options).onLongPress)==null||c.call(r,{clientX:this.startX,clientY:this.startY}))},this.options.longPressDelayMs)}moveGesture(i,s){var y,b,v,S;if(this.state==="longpress"){(b=(y=this.options).onSelectionExtend)==null||b.call(y,{clientX:i.clientX,clientY:i.clientY}),s!=null&&s.cancelable&&((v=s.preventDefault)==null||v.call(s));return}if(this.state==="idle")return;const r=i.clientX-this.startX,c=i.clientY-this.startY,d=Math.hypot(r,c);if(this.state==="scrolling"){this.scrollGesture(i,s);return}const h=this.options.getTerminal(),m=this.options.getIsController(),p=tr(h);if(!(d<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(c)>=Math.abs(r)||!p||!m){this.setGestureState("scrolling"),h&&this.blurTerminal(h),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,s);return}if(p&&m){this.state==="pending"&&(this.setGestureState("dragging"),this.emitMouse("mousedown",{clientX:this.startX,clientY:this.startY},s)),this.state==="dragging"&&(this.lastX=i.clientX,this.lastY=i.clientY,this.emitMouse("mousemove",i,s),s!=null&&s.cancelable&&((S=s.preventDefault)==null||S.call(s)));return}this.lastX=i.clientX,this.lastY=i.clientY}}scrollGesture(i,s){var N,q,R;const r=this.options.getTerminal();if(!r)return;const c=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const d=rl(r),h=d.measured?d.cellHeight:this.options.scrollLineHeightPx||d.cellHeight||18;this.scrollRemainderY+=c;const m=Math.trunc(this.scrollRemainderY/h),p=-m;let y=!1,b="none";const v=this.getActiveBuffer(r),S=tr(r);if(p!==0){if((v==null?void 0:v.type)==="alternate")b=this.scrollAlternateBuffer(i,p,r,s),y=b!=="none";else{const D=this.getViewportY(r);r.scrollLines(p);const B=this.getViewportY(r);b="buffer",y=D===null||B===null||D!==B}this.scrollRemainderY-=m*h}const M=this.getViewportElement(r);(q=(N=this.options).onGestureScroll)==null||q.call(N,{deltaY:c,lines:p,viewportY:this.getViewportY(r),scrollTop:(M==null?void 0:M.scrollTop)??null,scrollHeight:(M==null?void 0:M.scrollHeight)??null,clientHeight:(M==null?void 0:M.clientHeight)??null,moved:y,bufferType:(v==null?void 0:v.type)||null,baseY:typeof(v==null?void 0:v.baseY)=="number"?v.baseY:null,cursorY:typeof(v==null?void 0:v.cursorY)=="number"?v.cursorY:null,hasScrollback:typeof(v==null?void 0:v.hasScrollback)=="boolean"?v.hasScrollback:null,mouseTracking:S,scrollMode:b}),s!=null&&s.cancelable&&((R=s.preventDefault)==null||R.call(s))}endGesture(i,s){var h,m,p;this.clearLongPressTimer();const r=this.options.getTerminal(),c=this.options.getIsController(),d=tr(r);if(this.state==="pending"){if(d&&c){const b={clientX:this.startX,clientY:this.startY};this.emitMouse("mousedown",b,s),this.emitMouse("mouseup",b,s)}const y={clientX:this.startX,clientY:this.startY};c&&r&&this.isInputLineHit(y,r)&&((m=(h=this.options).onFocus)==null||m.call(h))}else if(this.state==="dragging"&&d&&c){const y=i??{clientX:this.lastX,clientY:this.lastY};this.emitMouse("mouseup",y,s),s!=null&&s.cancelable&&((p=s.preventDefault)==null||p.call(s))}this.reset()}handlePointerDown(i,s){if(i.pointerType==="mouse")return!1;if(!i.isPrimary)return this.releasePointerCapture(),this.reset(),!1;if(i.cancelable&&i.preventDefault(),this.beginGesture(i,s),i.pointerType!=="touch")try{typeof s.setPointerCapture=="function"&&(s.setPointerCapture(i.pointerId),this.capturedPointerId=i.pointerId,this.captureElement=s)}catch{}return!0}handlePointerMove(i){i.pointerType==="mouse"||this.state==="idle"||this.moveGesture(i,i)}handlePointerUp(i){i.pointerType==="mouse"||this.state==="idle"||(this.releasePointerCapture(),this.endGesture(i,i))}handlePointerCancel(i){i&&i.pointerType==="mouse"||(this.releasePointerCapture(),this.cancelGesture())}handleTouchStart(i,s){if(i.touches.length!==1){this.reset();return}i.cancelable&&i.preventDefault(),this.beginGesture(i.touches[0],s)}handleTouchMove(i){i.touches.length===1&&this.moveGesture(i.touches[0],i)}handleTouchEnd(i){i.cancelable&&i.preventDefault(),this.endGesture(null,i)}handleTouchCancel(){this.cancelGesture()}cancelGesture(){this.clearLongPressTimer();const i=this.options.getTerminal(),s=this.options.getIsController(),r=tr(i);if(this.state==="dragging"&&r&&s&&this.activeTarget){const c=this.getLogicalCoordinates(this.lastX,this.lastY);cg(this.activeTarget,"mouseup",{clientX:c.clientX,clientY:c.clientY,button:0,buttons:0})}this.reset()}releasePointerCapture(){const i=this.captureElement,s=this.capturedPointerId;if(this.captureElement=null,this.capturedPointerId=null,!(!i||s===null))try{typeof i.releasePointerCapture=="function"&&(typeof i.hasPointerCapture!="function"||i.hasPointerCapture(s))&&i.releasePointerCapture(s)}catch{}}clearLongPressTimer(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}reset(){this.clearLongPressTimer(),this.releasePointerCapture(),this.setGestureState("idle"),this.activeTarget=null}}var Pt=(a=>(a[a.CODEPOINT_MASK=2097151]="CODEPOINT_MASK",a[a.IS_COMBINED_MASK=2097152]="IS_COMBINED_MASK",a[a.WIDTH_SHIFT=22]="WIDTH_SHIFT",a))(Pt||{}),Et=(a=>(a[a.PCOLOR_MASK=255]="PCOLOR_MASK",a[a.CM_MASK=50331648]="CM_MASK",a[a.CM_DEFAULT=0]="CM_DEFAULT",a[a.CM_P16=16777216]="CM_P16",a[a.CM_P256=33554432]="CM_P256",a[a.CM_RGB=50331648]="CM_RGB",a[a.RGB_MASK=16777215]="RGB_MASK",a))(Et||{}),nn=(a=>(a[a.INVERSE=67108864]="INVERSE",a[a.BOLD=134217728]="BOLD",a[a.UNDERLINE=268435456]="UNDERLINE",a[a.BLINK=536870912]="BLINK",a[a.INVISIBLE=1073741824]="INVISIBLE",a[a.STRIKETHROUGH=2147483648]="STRIKETHROUGH",a))(nn||{}),ol=(a=>(a[a.ITALIC=67108864]="ITALIC",a[a.DIM=134217728]="DIM",a[a.HAS_EXTENDED=268435456]="HAS_EXTENDED",a[a.PROTECTED=536870912]="PROTECTED",a[a.OVERLINE=1073741824]="OVERLINE",a))(ol||{}),Ql=(a=>(a[a.NONE=0]="NONE",a[a.SINGLE=1]="SINGLE",a[a.DOUBLE=2]="DOUBLE",a[a.CURLY=3]="CURLY",a[a.DOTTED=4]="DOTTED",a[a.DASHED=5]="DASHED",a))(Ql||{});function O1(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const Yb={fg:0,bg:0,ext:0};function $b(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function z1(a){return a>>>26&7}function B1(a){return a&67108863}function H1(a,i){const s=a.codePointAt(0)??0;return a.length>0&&String.fromCodePoint(s).length===a.length?{content:s|i<<22,combinedData:""}:{content:2097152|i<<22,combinedData:a}}function qb(a){const i=a;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:$b(i)}}const Lo=new Map;function Vb(a){let i=Lo.get(a);return i===void 0&&(i=`#${(a&Et.RGB_MASK).toString(16).padStart(6,"0")}`,Lo.size>4096&&Lo.clear(),Lo.set(a,i)),i}function Xb(a,i,s){var r;switch(a&Et.CM_MASK){case Et.CM_P16:case Et.CM_P256:return((r=i.ansi[a&Et.PCOLOR_MASK])==null?void 0:r.css)??s;case Et.CM_RGB:return Vb(a&Et.RGB_MASK);default:return s}}function ug(a,i,s,r){var v;const c=(a&nn.INVERSE)!==0,d=c?i:a,h=c?a:i;let m;const p=d&Et.CM_MASK;if(p===Et.CM_P16||p===Et.CM_P256){let S=d&Et.PCOLOR_MASK;r&&a&nn.BOLD&&S<8&&(S+=8),m=((v=s.ansi[S])==null?void 0:v.css)??s.foreground.css}else p===Et.CM_RGB?m=Vb(d&Et.RGB_MASK):m=c?s.background.css:s.foreground.css;const y=h&Et.CM_MASK,b=y===Et.CM_DEFAULT?c?s.foreground.css:s.background.css:Xb(h,s,s.background.css);return{fg:m,bg:b,bgIsDefault:!c&&y===Et.CM_DEFAULT}}function _o(a){return(a&nn.BOLD)!==0}function cd(a){return(a&ol.ITALIC)!==0}function ud(a){return(a&ol.DIM)!==0}function jo(a){return(a&nn.INVISIBLE)!==0}/**
|
|
34
|
-
* Box drawing, block element and Powerline glyphs, drawn as shapes rather than
|
|
35
|
-
* taken from the font.
|
|
36
|
-
*
|
|
37
|
-
* Vendored verbatim from @xterm/xterm 5.5.0,
|
|
38
|
-
* src/browser/renderer/shared/CustomGlyphs.ts. The only edits are the one
|
|
39
|
-
* helper it imported, inlined below, and underscores on parameters the strict
|
|
40
|
-
* compiler flags as unused.
|
|
41
|
-
*
|
|
42
|
-
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
|
|
43
|
-
* @license MIT
|
|
44
|
-
*/function dg(a){if(!a)throw new Error("value must not be falsy");return a}const U1={"▀":[{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}]},K1={"░":[[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]]},F1={"─":{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:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"║":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╒":{1:(a,i)=>`M.5,1 L.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╓":{1:(a,i)=>`M${.5-a},1 L${.5-a},.5 L1,.5 M${.5+a},.5 L${.5+a},1`},"╔":{1:(a,i)=>`M1,${.5-i} L${.5-a},${.5-i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╕":{1:(a,i)=>`M0,${.5-i} L.5,${.5-i} L.5,1 M0,${.5+i} L.5,${.5+i}`},"╖":{1:(a,i)=>`M${.5+a},1 L${.5+a},.5 L0,.5 M${.5-a},.5 L${.5-a},1`},"╗":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5+a},${.5-i} L${.5+a},1`},"╘":{1:(a,i)=>`M.5,0 L.5,${.5+i} L1,${.5+i} M.5,${.5-i} L1,${.5-i}`},"╙":{1:(a,i)=>`M1,.5 L${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╚":{1:(a,i)=>`M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0 M1,${.5+i} L${.5-a},${.5+i} L${.5-a},0`},"╛":{1:(a,i)=>`M0,${.5+i} L.5,${.5+i} L.5,0 M0,${.5-i} L.5,${.5-i}`},"╜":{1:(a,i)=>`M0,.5 L${.5+a},.5 L${.5+a},0 M${.5-a},.5 L${.5-a},0`},"╝":{1:(a,i)=>`M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M0,${.5+i} L${.5+a},${.5+i} L${.5+a},0`},"╞":{1:(a,i)=>`M.5,0 L.5,1 M.5,${.5-i} L1,${.5-i} M.5,${.5+i} L1,${.5+i}`},"╟":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1 M${.5+a},.5 L1,.5`},"╠":{1:(a,i)=>`M${.5-a},0 L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╡":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L.5,${.5-i} M0,${.5+i} L.5,${.5+i}`},"╢":{1:(a,i)=>`M0,.5 L${.5-a},.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╣":{1:(a,i)=>`M${.5+a},0 L${.5+a},1 M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0`},"╤":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i} M.5,${.5+i} L.5,1`},"╥":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},1 M${.5+a},.5 L${.5+a},1`},"╦":{1:(a,i)=>`M0,${.5-i} L1,${.5-i} M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1`},"╧":{1:(a,i)=>`M.5,0 L.5,${.5-i} M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╨":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},.5 L${.5-a},0 M${.5+a},.5 L${.5+a},0`},"╩":{1:(a,i)=>`M0,${.5+i} L1,${.5+i} M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},0`},"╪":{1:(a,i)=>`M.5,0 L.5,1 M0,${.5-i} L1,${.5-i} M0,${.5+i} L1,${.5+i}`},"╫":{1:(a,i)=>`M0,.5 L1,.5 M${.5-a},0 L${.5-a},1 M${.5+a},0 L${.5+a},1`},"╬":{1:(a,i)=>`M0,${.5+i} L${.5-a},${.5+i} L${.5-a},1 M1,${.5+i} L${.5+a},${.5+i} L${.5+a},1 M0,${.5-i} L${.5-a},${.5-i} L${.5-a},0 M1,${.5-i} L${.5+a},${.5-i} L${.5+a},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:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,1,.5`},"╮":{1:(a,i)=>`M.5,1 L.5,${.5+i/.15*.5} C.5,${.5+i/.15*.5},.5,.5,0,.5`},"╯":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,0,.5`},"╰":{1:(a,i)=>`M.5,0 L.5,${.5-i/.15*.5} C.5,${.5-i/.15*.5},.5,.5,1,.5`}},br={"":{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}};br[""]=br[""];br[""]=br[""];function I1(a,i,s,r,c,d,h,m){const p=U1[i];if(p)return G1(a,p,s,r,c,d),!0;const y=K1[i];if(y)return Y1(a,y,s,r,c,d),!0;const b=F1[i];if(b)return $1(a,b,s,r,c,d,m),!0;const v=br[i];return v?(q1(a,v,s,r,c,d,h,m),!0):!1}function G1(a,i,s,r,c,d){for(let h=0;h<i.length;h++){const m=i[h],p=c/8,y=d/8;a.fillRect(s+m.x*p,r+m.y*y,m.w*p,m.h*y)}}const fg=new Map;function Y1(a,i,s,r,c,d){let h=fg.get(i);h||(h=new Map,fg.set(i,h));const m=a.fillStyle;if(typeof m!="string")throw new Error(`Unexpected fillStyle type "${m}"`);let p=h.get(m);if(!p){const y=i[0].length,b=i.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=y,v.height=b;const S=dg(v.getContext("2d")),M=new ImageData(y,b);let N,q,R,D;if(m.startsWith("#"))N=parseInt(m.slice(1,3),16),q=parseInt(m.slice(3,5),16),R=parseInt(m.slice(5,7),16),D=m.length>7&&parseInt(m.slice(7,9),16)||1;else if(m.startsWith("rgba"))[N,q,R,D]=m.substring(5,m.length-1).split(",").map(B=>parseFloat(B));else throw new Error(`Unexpected fillStyle color format "${m}" when drawing pattern glyph`);for(let B=0;B<b;B++)for(let G=0;G<y;G++)M.data[(B*y+G)*4]=N,M.data[(B*y+G)*4+1]=q,M.data[(B*y+G)*4+2]=R,M.data[(B*y+G)*4+3]=i[B][G]*(D*255);S.putImageData(M,0,0),p=dg(a.createPattern(v,null)),h.set(m,p)}a.fillStyle=p,a.fillRect(s,r,c,d)}function $1(a,i,s,r,c,d,h){a.strokeStyle=a.fillStyle;for(const[m,p]of Object.entries(i)){a.beginPath(),a.lineWidth=h*Number.parseInt(m);let y;if(typeof p=="function"){const v=.15/d*c;y=p(.15,v)}else y=p;for(const b of y.split(" ")){const v=b[0],S=Pb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const M=b.substring(1).split(",");!M[0]||!M[1]||S(a,Zb(M,c,d,s,r,!0,h))}a.stroke(),a.closePath()}}function q1(a,i,s,r,c,d,h,m){const p=new Path2D;p.rect(s,r,c,d),a.clip(p),a.beginPath();const y=h/12;a.lineWidth=m*y;for(const b of i.d.split(" ")){const v=b[0],S=Pb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const M=b.substring(1).split(",");!M[0]||!M[1]||S(a,Zb(M,c,d,s,r,!1,m,(i.leftPadding??0)*(y/2),(i.rightPadding??0)*(y/2)))}i.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function hg(a,i,s=0){return Math.max(Math.min(a,i),s)}const Pb={C:(a,i)=>a.bezierCurveTo(i[0],i[1],i[2],i[3],i[4],i[5]),L:(a,i)=>a.lineTo(i[0],i[1]),M:(a,i)=>a.moveTo(i[0],i[1])};function Zb(a,i,s,r,c,d,h,m=0,p=0){const y=a.map(b=>parseFloat(b)||parseInt(b));if(y.length<2)throw new Error("Too few arguments for instruction");for(let b=0;b<y.length;b+=2)y[b]*=i-m*h-p*h,d&&y[b]!==0&&(y[b]=hg(Math.round(y[b]+.5)-.5,i,0)),y[b]+=r+m*h;for(let b=1;b<y.length;b+=2)y[b]*=s,d&&y[b]!==0&&(y[b]=hg(Math.round(y[b]+.5)-.5,s,0)),y[b]+=c;return y}const kd=.5,V1=1024,X1=6;function P1(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class Z1{constructor(i,s=typeof navigator<"u"?navigator.userAgent:""){Z(this,"pages",[]);Z(this,"slots",new Map);Z(this,"inkCache",new Map);Z(this,"metrics",null);Z(this,"font",null);Z(this,"baseline");Z(this,"generation",0);Z(this,"scratch");this.document=i,this.baseline=P1(s)}configure(i,s){const r=this.metrics&&this.font&&this.metrics.cellWidth===i.cellWidth&&this.metrics.cellHeight===i.cellHeight&&this.metrics.charWidth===i.charWidth&&this.metrics.charHeight===i.charHeight&&this.metrics.charLeft===i.charLeft&&this.metrics.charTop===i.charTop&&this.metrics.dpr===i.dpr&&this.font.fontFamily===s.fontFamily&&this.font.fontSize===s.fontSize&&this.font.fontWeight===s.fontWeight&&this.font.fontWeightBold===s.fontWeightBold&&this.font.customGlyphs===s.customGlyphs;this.metrics={...i},this.font={...s},r||this.clear()}clear(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.shelfX=0,i.shelfY=0;this.generation++}dispose(){this.slots.clear(),this.inkCache.clear();for(const i of this.pages)i.canvas.width=0,i.canvas.height=0;this.pages=[]}get pageCount(){return this.pages.length}fontString(i,s){const r=this.font,c=i?r.fontWeightBold:r.fontWeight;return`${s?"italic ":""}${c} ${r.fontSize*this.metrics.dpr}px ${r.fontFamily}`}overflow(i,s,r){if(!this.metrics||!this.font||i.length===1&&i.charCodeAt(0)<128)return 0;const c=`${s?1:0}${r?1:0}${i}`,d=this.inkCache.get(c);if(d!==void 0)return d;let h=0;const m=this.scratchContext();if(m&&!(this.font.customGlyphs&&Qb(i))){m.font=this.fontString(s,r),m.textBaseline=this.baseline;const p=m.measureText(i),y=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;h=Math.max(0,Math.ceil(this.metrics.charLeft+y-this.metrics.cellWidth))}return this.inkCache.set(c,h),h}get(i){const s=this.metrics,r=this.font;if(!s||!r||s.cellWidth<=0||s.cellHeight<=0)return null;const c=`${i.cells}${i.bold?1:0}${i.italic?1:0}${i.dim?1:0}${i.fg}\0${i.bg}\0${i.chars}`,d=this.slots.get(c);if(d)return d;const h=s.cellWidth*i.cells,m=s.cellHeight,p=this.allocate(h,m);if(!p)return null;const{page:y,x:b,y:v}=p,S=y.ctx;S.save(),S.beginPath(),S.rect(b,v,h,m),S.clip(),S.globalAlpha=1,S.fillStyle=i.bg,S.fillRect(b,v,h,m),S.fillStyle=i.fg,i.dim&&(S.globalAlpha=kd);let M=!1;r.customGlyphs&&(M=I1(S,i.chars,b,v,s.cellWidth,s.cellHeight,r.fontSize,s.dpr)),M||(S.font=this.fontString(i.bold,i.italic),S.textBaseline=this.baseline,S.fillText(i.chars,b+s.charLeft,v+s.charTop+s.charHeight)),S.restore();const N={source:y.canvas,x:b,y:v,width:h,height:m};return this.slots.set(c,N),N}allocate(i,s){for(const r of this.pages){const c=this.fit(r,i,s);if(c)return c}if(this.pages.length<X1){const r=this.createPage(Math.max(V1,i,s));return r?(this.pages.push(r),this.fit(r,i,s)):null}return this.clear(),this.pages[0]?this.fit(this.pages[0],i,s):null}fit(i,s,r){if(i.shelfX+s>i.canvas.width&&(i.shelfX=0,i.shelfY+=r),i.shelfY+r>i.canvas.height||s>i.canvas.width)return null;const c={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=s,c}createPage(i){const s=this.document.createElement("canvas");s.width=i,s.height=i;const r=s.getContext("2d",{alpha:!1});return r?{canvas:s,ctx:r,shelfX:0,shelfY:0}:null}scratchContext(){if(this.scratch===void 0){const i=this.document.createElement("canvas");i.width=1,i.height=1,this.scratch=i.getContext("2d")}return this.scratch}}function Qb(a){if(a.length!==1)return!1;const i=a.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function Q1(a){var s,r,c,d;const i=a._core;return!i||!i.screenElement||!i.coreService||!((s=i.optionsService)!=null&&s.rawOptions)||!((r=i._bufferService)!=null&&r.buffer)||!i._charSizeService||!i._coreBrowserService||!((c=i._themeService)!=null&&c.colors)||typeof((d=i._renderService)==null?void 0:d.setRenderer)!="function"?null:i}const W1=150,J1=600,nr=4294967295;function eS(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}class tS{constructor(){Z(this,"listeners",new Set);Z(this,"event",i=>(this.listeners.add(i),{dispose:()=>this.listeners.delete(i)}))}fire(i){for(const s of[...this.listeners])s(i)}dispose(){this.listeners.clear()}}class Yd{constructor(i,s){Z(this,"dimensions",eS());Z(this,"redraw",new tS);Z(this,"onRequestRedraw",this.redraw.event);Z(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});Z(this,"canvas");Z(this,"ctx");Z(this,"decorCanvas");Z(this,"decorCtx");Z(this,"atlas");Z(this,"disposables",[]);Z(this,"now");Z(this,"maxSyncHoldMs");Z(this,"cols",0);Z(this,"rows",0);Z(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});Z(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});Z(this,"work",O1());Z(this,"overlayProvider",null);Z(this,"paintedOverlayRows",new Set);Z(this,"paintedCursorRow",-1);Z(this,"lastYdisp",0);Z(this,"holdStartedAt",null);Z(this,"held",null);Z(this,"holdTimer",null);Z(this,"selection",null);Z(this,"link",null);Z(this,"inputAt",null);Z(this,"blinkVisible",!0);Z(this,"blinkTimer",null);Z(this,"disposed",!1);Z(this,"isSynchronizing");Z(this,"dprUsed",0);this.core=i,this.now=s.now??(()=>performance.now()),this.maxSyncHoldMs=s.maxSyncHoldMs??W1,this.isSynchronizing=s.isSynchronizing??(()=>!1);const r=i._coreBrowserService.mainDocument,c=i.screenElement;this.canvas=r.createElement("canvas"),this.canvas.classList.add("xterm-text-layer"),this.canvas.style.zIndex="0";const d=this.canvas.getContext("2d",{alpha:!1});if(!d)throw new Error("2D canvas unavailable");this.ctx=d,this.decorCanvas=r.createElement("canvas"),this.decorCanvas.classList.add("xterm-decor-layer"),this.decorCanvas.style.zIndex="2";const h=this.decorCanvas.getContext("2d");if(!h)throw new Error("2D canvas unavailable");this.decorCtx=h,c.appendChild(this.canvas),c.appendChild(this.decorCanvas),this.atlas=new Z1(r),this.disposables.push(i._themeService.onChangeColors(()=>{this.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(m=>{(m==="cursorBlink"||m==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(m=>{this.link=m,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(r),this.restartBlink()}static install(i,s={}){const r=Q1(i);if(!r)return null;const c=new Yd(r,s);return r._renderService.setRenderer(c),r._renderService.handleResize(r._bufferService.cols,r._bufferService.rows),c}setOverlayProvider(i){this.overlayProvider=i,this.invalidateOverlay()}invalidateOverlay(){var r;const i=((r=this.overlayProvider)==null?void 0:r.call(this))??null,s=new Set(this.paintedOverlayRows);for(const c of nS(i))s.add(c);this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+this.buffer().ydisp),this.requestAbsoluteRows(s)}markInput(){this.inputAt=this.now()}flushHeld(){if(!this.held)return;const{start:i,end:s}=this.held;this.redraw.fire({start:i,end:s})}handleDevicePixelRatioChange(){this.dimensions.device.cell.width&&this.dprUsed!==this.core._coreBrowserService.dpr&&this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleResize(i,s){this.updateDimensions(i,s);const r=this.dimensions;for(const d of[this.canvas,this.decorCanvas])d.width=r.device.canvas.width,d.height=r.device.canvas.height,d.style.width=`${r.css.canvas.width}px`,d.style.height=`${r.css.canvas.height}px`;const c=this.core.screenElement;c&&(c.style.width=`${r.css.canvas.width}px`,c.style.height=`${r.css.canvas.height}px`),this.resizeGrid(i,s),this.configureAtlas(),this.fillBackground(),this.redrawDecor()}handleCharSizeChanged(){this.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)}handleBlur(){this.stopBlink(),this.requestCursorRow(),this.redrawDecor()}handleFocus(){this.restartBlink(),this.requestCursorRow(),this.redrawDecor()}handleSelectionChanged(i,s,r){this.selection=i&&s&&!(i[0]===s[0]&&i[1]===s[1])?{start:[i[0],i[1]],end:[s[0],s[1]],columnSelectMode:r}:null,this.redrawDecor()}handleCursorMove(){this.blinkTimer&&this.restartBlink()}clear(){this.invalidateAll(),this.fillBackground()}clearTextureAtlas(){this.atlas.clear(),this.invalidateAll(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}renderRows(i,s){if(!(this.disposed||!this.cols||!this.rows||!this.dimensions.device.cell.width)){if(this.isSynchronizing()){const r=this.now();if(this.holdStartedAt===null&&(this.holdStartedAt=r),r-this.holdStartedAt<this.maxSyncHoldMs){this.held=this.held?{start:Math.min(this.held.start,i),end:Math.max(this.held.end,s)}:{start:i,end:s},this.stats.heldFrames++,this.holdTimer||(this.holdTimer=setTimeout(()=>{this.holdTimer=null,this.flushHeld()},this.maxSyncHoldMs));return}}this.held&&(i=Math.min(i,this.held.start),s=Math.max(s,this.held.end)),this.held=null,this.holdStartedAt=null,this.holdTimer&&(clearTimeout(this.holdTimer),this.holdTimer=null),this.paint(Math.max(0,i),Math.min(this.rows-1,s))}}dispose(){if(!this.disposed){this.disposed=!0,this.stopBlink(),this.holdTimer&&clearTimeout(this.holdTimer);for(const i of this.disposables)i.dispose();this.disposables.length=0,this.redraw.dispose(),this.atlas.dispose(),this.canvas.remove(),this.decorCanvas.remove()}}uninstall(){const i=this.core._createRenderer;typeof i=="function"&&(this.core._renderService.setRenderer(i.call(this.core)),this.core._renderService.handleResize(this.core._bufferService.cols,this.core._bufferService.rows)),this.dispose()}get textCanvas(){return this.canvas}hasPaintedInk(i,s){const r=this.dimensions.device;if(!r.cell.width||!r.cell.height)return!1;const c=Math.min(this.cols,Math.floor(i/r.cell.width)),d=Math.min(this.rows,Math.floor(s/r.cell.height)),h=this.painted;for(let m=0;m<d;m++)for(let p=0;p<c;p++){const y=m*this.cols+p,b=h.content[y];if(b===nr||h.meta[y]===4||jo(h.fg[y]))continue;const v=b&Pt.CODEPOINT_MASK;if(b&Pt.IS_COMBINED_MASK?h.combined[y]!=="":v!==0&&v!==32)return!0}return!1}paint(i,s){var v;const r=this.now(),d=this.buffer().ydisp;d!==this.lastYdisp&&(this.lastYdisp=d,this.redrawDecor());const h=((v=this.overlayProvider)==null?void 0:v.call(this))??null,m=new Map;for(const S of(h==null?void 0:h.cells)??[]){const M=m.get(S.row);M?M.push(S):m.set(S.row,[S])}const p=this.cursorState(h),y=new Set;for(let S=i;S<=s;S++)y.add(S);for(const S of this.paintedOverlayRows)Do(y,S-d,this.rows);for(const S of m.keys())Do(y,S-d,this.rows);this.paintedCursorRow>=0&&Do(y,this.paintedCursorRow,this.rows),p&&Do(y,p.y,this.rows);let b=0;for(const S of y)this.loadRow(S,d,m.get(S+d)),b+=this.paintRow(S,p);this.paintedOverlayRows=new Set(m.keys()),this.paintedCursorRow=p?p.y:-1,this.stats.frames++,this.stats.lastCells=b,this.stats.lastPaintMs=this.now()-r,this.inputAt!==null&&b>0&&(this.stats.lastInputToPaintMs=this.now()-this.inputAt,this.inputAt=null)}loadRow(i,s,r){const{content:c,fg:d,bg:h,ext:m,combined:p}=this.row,y=this.buffer().lines.get(s+i),b=this.work;for(let v=0;v<this.cols;v++)y&&v<y.length?(y.loadCell(v,b),c[v]=b.content,d[v]=b.fg,h[v]=b.bg,m[v]=$b(b),p[v]=b.content&Pt.IS_COMBINED_MASK?b.combinedData:""):(c[v]=1<<Pt.WIDTH_SHIFT,d[v]=0,h[v]=0,m[v]=0,p[v]="");if(r)for(const v of r){const S=v.col;if(S<0||S+v.width>this.cols)continue;S>0&&!(c[S]>>>Pt.WIDTH_SHIFT)&&this.blankAt(S-1);const M=S+v.width;M<this.cols&&!(c[M]>>>Pt.WIDTH_SHIFT)&&c[M-1]>>>Pt.WIDTH_SHIFT===2&&this.blankAt(M);const N=H1(v.chars,v.width);c[S]=N.content,p[S]=N.combinedData,d[S]=v.style.fg,h[S]=v.style.bg,m[S]=v.style.ext,v.width===2&&(c[S+1]=0,p[S+1]="",d[S+1]=v.style.fg,h[S+1]=v.style.bg,m[S+1]=v.style.ext)}}blankAt(i){this.row.content[i]=32|1<<Pt.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,s){const r=this.cols,{content:c,fg:d,bg:h,ext:m,combined:p}=this.row,y=this.painted,b=i*r;let v=0,S=-1,M=-1,N="";const q=()=>{S<0||(this.fillCells(S,i,M-S,N),S=-1)};let R=0;for(;R<r;){let B=c[R]>>>Pt.WIDTH_SHIFT;B===0&&(B=1),R+B>r&&(B=r-R),B===1&&R+1<r&&this.overflowsInto(R)&&(B=2);const G=s&&s.y===i&&s.x>=R&&s.x<R+B?s.shape:0,le=B|G<<3;let fe=this.differs(b+R,R,le);for(let te=1;te<B;te++)this.differs(b+R+te,R+te,4)&&(fe=!0);if(fe){for(let F=0;F<B;F++){const I=b+R+F;y.content[I]=c[R+F],y.fg[I]=d[R+F],y.bg[I]=h[R+F],y.ext[I]=m[R+F],y.meta[I]=F===0?le:4,y.combined[I]=p[R+F]}v+=B;const te=this.plainFill(R,G);te!==null?S>=0&&M===R&&N===te?M=R+B:(q(),S=R,M=R+B,N=te):(q(),this.paintCell(R,i,B,G))}R+=B}return q(),v}differs(i,s,r){const c=this.painted,d=this.row;return c.meta[i]!==r||c.content[i]!==d.content[s]||c.fg[i]!==d.fg[s]||c.bg[i]!==d.bg[s]||c.ext[i]!==d.ext[s]||c.combined[i]!==d.combined[s]}overflowsInto(i){const{content:s,fg:r,bg:c,ext:d}=this.row,h=s[i];if((h&Pt.CODEPOINT_MASK)<128&&!(h&Pt.IS_COMBINED_MASK)||h>>>Pt.WIDTH_SHIFT!==1||jo(r[i]))return!1;const p=s[i+1],y=p&Pt.CODEPOINT_MASK;if(p>>>Pt.WIDTH_SHIFT!==1||p&Pt.IS_COMBINED_MASK||y!==0&&y!==32||c[i]!==c[i+1]||d[i+1]!==0||(r[i]&nn.INVERSE)!==(r[i+1]&nn.INVERSE)||r[i]&nn.INVERSE&&r[i]!==r[i+1]||r[i+1]&(nn.UNDERLINE|nn.STRIKETHROUGH)||c[i+1]&ol.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&Qb(b)?!1:this.atlas.overflow(b,_o(r[i]),cd(c[i]))>0}charsAt(i){const s=this.row.content[i];if(s&Pt.IS_COMBINED_MASK)return this.row.combined[i];const r=s&Pt.CODEPOINT_MASK;return r?String.fromCodePoint(r):""}plainFill(i,s){if(s!==0)return null;const{content:r,fg:c,bg:d}=this.row,h=r[i],m=h&Pt.CODEPOINT_MASK,p=!(h&Pt.IS_COMBINED_MASK)&&(m===0||m===32),y=jo(c[i]);return!p&&!y||(c[i]&(nn.UNDERLINE|nn.STRIKETHROUGH)||d[i]&ol.OVERLINE)&&!y?null:ug(c[i],d[i],this.colors(),this.boldBright()).bg}paintCell(i,s,r,c){const d=this.ctx,h=this.dimensions.device,m=this.colors(),p=this.row.fg[i],y=this.row.bg[i],b=this.row.ext[i],v=ug(p,y,m,this.boldBright());let S=v.fg,M=v.bg;c===1&&(M=m.cursor.css,S=m.cursorAccent.css);const N=jo(p),q=this.charsAt(i),R=i*h.cell.width,D=s*h.cell.height,B=r*h.cell.width,G=h.cell.height,le=N||q===""||q===" ",fe=le?null:this.atlas.get({chars:q,bold:_o(p),italic:cd(y),dim:ud(y),fg:S,bg:M,cells:r});fe?d.drawImage(fe.source,fe.x,fe.y,fe.width,fe.height,R,D,B,G):(d.fillStyle=M,d.fillRect(R,D,B,G),le||(d.save(),d.beginPath(),d.rect(R,D,B,G),d.clip(),d.fillStyle=S,ud(y)&&(d.globalAlpha=kd),d.font=this.atlas.fontString(_o(p),cd(y)),d.fillText(q,R+h.char.left,D+h.char.top+h.char.height),d.restore())),N||this.paintDecorations(R,D,r,p,y,b,S),c!==0&&c!==1&&this.paintCursorShape(R,D,B,c)}paintDecorations(i,s,r,c,d,h,m){const p=(c&nn.UNDERLINE)!==0,y=(c&nn.STRIKETHROUGH)!==0,b=(d&ol.OVERLINE)!==0;if(!p&&!y&&!b)return;const v=this.ctx,S=this.dimensions.device,M=this.core.optionsService.rawOptions,N=this.core._coreBrowserService.dpr,q=r*S.cell.width;v.save(),v.beginPath(),v.rect(i,s,q,S.cell.height),v.clip(),ud(d)&&(v.globalAlpha=kd);const R=Math.max(1,Math.floor(M.fontSize*N/15)),D=R%2===1?.5:0;if(p){const B=B1(h);let G=m;if(B){let te=B;this.boldBright()&&_o(c)&&(te&50331648)!==50331648&&(te&255)<8&&(te+=8),G=Xb(te,this.colors(),m)}v.strokeStyle=G,v.lineWidth=R;const le=s+S.char.top+Math.ceil(S.char.height)-D-R*2,fe=h?z1(h):Ql.SINGLE;switch(v.beginPath(),fe){case Ql.DOUBLE:v.moveTo(i,le),v.lineTo(i+q,le),v.moveTo(i,le+R*2),v.lineTo(i+q,le+R*2);break;case Ql.CURLY:{const te=le+R,F=Math.max(1,R);for(let I=0;I<r;I++){const me=i+I*S.cell.width,be=me+S.cell.width/2,Ne=me+S.cell.width;v.moveTo(me,te),v.bezierCurveTo(me,te-F,be,te-F,be,te),v.bezierCurveTo(be,te+F,Ne,te+F,Ne,te)}break}case Ql.DOTTED:v.setLineDash([R,R]),v.moveTo(i,le),v.lineTo(i+q,le);break;case Ql.DASHED:{const te=Math.floor(.6*S.cell.width),F=Math.floor(.3*S.cell.width);v.setLineDash([te,F,S.cell.width-te-F]),v.moveTo(i,le),v.lineTo(i+q,le);break}default:v.moveTo(i,le),v.lineTo(i+q,le)}v.stroke(),v.setLineDash([])}if(b&&(v.strokeStyle=m,v.lineWidth=R,v.beginPath(),v.moveTo(i,s+S.char.top+D),v.lineTo(i+q,s+S.char.top+D),v.stroke()),y){const B=Math.max(1,Math.floor(M.fontSize*N/10)),G=s+S.char.top+Math.floor(S.char.height/2)-(B%2===1?.5:0);v.strokeStyle=m,v.lineWidth=B,v.beginPath(),v.moveTo(i,G),v.lineTo(i+q,G),v.stroke()}v.restore()}paintCursorShape(i,s,r,c){const d=this.ctx,h=this.dimensions.device,m=this.core._coreBrowserService.dpr,p=this.colors();switch(d.save(),d.fillStyle=p.cursor.css,d.strokeStyle=p.cursor.css,c){case 2:d.fillRect(i,s,Math.max(1,Math.round(this.core.optionsService.rawOptions.cursorWidth*m)),h.cell.height);break;case 3:d.fillRect(i,s+h.cell.height-Math.max(1,Math.round(m))-1,r,Math.max(1,Math.round(m)));break;case 4:{const y=Math.max(1,Math.round(m));d.lineWidth=y,d.strokeRect(i+y/2,s+y/2,r-y,h.cell.height-y);break}}d.restore()}fillCells(i,s,r,c){const d=this.dimensions.device;this.ctx.fillStyle=c,this.ctx.fillRect(i*d.cell.width,s*d.cell.height,r*d.cell.width,d.cell.height)}fillBackground(){this.ctx.fillStyle=this.colors().background.css,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}cursorState(i){const s=this.core,r=this.buffer();let c,d;if(i&&i.cursor!==void 0){if(i.cursor===null)return null;c=i.cursor.row,d=i.cursor.col}else{if(!s.coreService.isCursorInitialized||s.coreService.isCursorHidden)return null;c=r.ybase+r.y,d=r.x}const h=c-r.ydisp;if(h<0||h>=this.rows)return null;const m=Math.min(Math.max(0,d),this.cols-1),p=s.optionsService.rawOptions;let y;if(s._coreBrowserService.isFocused)this.blinkTimer&&!this.blinkVisible?y=0:y=mg(p.cursorStyle||"block");else{const b=p.cursorInactiveStyle??"outline";y=b==="none"?0:mg(b)}return y===0?null:{x:m,y:h,shape:y}}restartBlink(){if(this.stopBlink(),this.blinkVisible=!0,this.disposed||!this.core.optionsService.rawOptions.cursorBlink||!this.core._coreBrowserService.isFocused){this.requestCursorRow();return}this.blinkTimer=setInterval(()=>{this.blinkVisible=!this.blinkVisible,this.requestCursorRow()},J1),this.requestCursorRow()}stopBlink(){this.blinkTimer&&clearInterval(this.blinkTimer),this.blinkTimer=null,this.blinkVisible=!0}requestCursorRow(){if(!this.rows)return;const i=this.buffer(),s=new Set;s.add(i.ybase+i.y),this.paintedCursorRow>=0&&s.add(this.paintedCursorRow+i.ydisp),this.requestAbsoluteRows(s)}redrawDecor(){var p;const i=this.decorCtx;i.clearRect(0,0,this.decorCanvas.width,this.decorCanvas.height);const s=this.dimensions.device;if(!s.cell.width||!this.rows)return;const r=this.colors(),c=this.buffer().ydisp,d=(y,b,v,S)=>i.fillRect(y*s.cell.width,b*s.cell.height,v*s.cell.width,S*s.cell.height),h=this.selection;if(h){const y=h.start[1]-c,b=h.end[1]-c,v=Math.max(y,0),S=Math.min(b,this.rows-1);if(v<this.rows&&S>=0)if(i.fillStyle=(this.core._coreBrowserService.isFocused?r.selectionBackgroundTransparent:r.selectionInactiveBackgroundTransparent).css,h.columnSelectMode)d(h.start[0],v,h.end[0]-h.start[0],S-v+1);else{const M=y===v?h.start[0]:0,N=v===b?h.end[0]:this.cols;d(M,v,N-M,1),d(0,v+1,this.cols,Math.max(S-v-1,0)),v!==S&&d(0,S,b===S?h.end[0]:this.cols,1)}}const m=this.link;if(m){const y=this.core._coreBrowserService.dpr;i.fillStyle=m.fg===257?r.background.css:m.fg!==void 0&&m.fg<256?((p=r.ansi[m.fg])==null?void 0:p.css)??r.foreground.css:r.foreground.css;const b=(v,S,M)=>i.fillRect(v*s.cell.width,(S+1)*s.cell.height-y-1,M*s.cell.width,y);if(m.y1===m.y2)b(m.x1,m.y1,m.x2-m.x1);else{b(m.x1,m.y1,m.cols-m.x1);for(let v=m.y1+1;v<m.y2;v++)b(0,v,m.cols);b(0,m.y2,m.x2)}}}updateDimensions(i,s){const r=this.core._charSizeService;if(!r.hasValidSize)return;const c=this.core._coreBrowserService.dpr,d=this.core.optionsService.rawOptions,h=this.dimensions;h.device.char.width=Math.floor(r.width*c),h.device.char.height=Math.ceil(r.height*c),h.device.cell.height=Math.floor(h.device.char.height*d.lineHeight),h.device.char.top=d.lineHeight===1?0:Math.round((h.device.cell.height-h.device.char.height)/2),h.device.cell.width=h.device.char.width+Math.round(d.letterSpacing),h.device.char.left=Math.floor(d.letterSpacing/2),h.device.canvas.height=s*h.device.cell.height,h.device.canvas.width=i*h.device.cell.width,h.css.canvas.height=Math.round(h.device.canvas.height/c),h.css.canvas.width=Math.round(h.device.canvas.width/c),h.css.cell.height=h.css.canvas.height/s,h.css.cell.width=h.css.canvas.width/i,this.dprUsed=c}resizeGrid(i,s){this.cols=i,this.rows=s;const r=i*s;this.painted={content:new Uint32Array(r).fill(nr),fg:new Uint32Array(r),bg:new Uint32Array(r),ext:new Uint32Array(r),meta:new Uint32Array(r).fill(nr),combined:new Array(r).fill("")},this.row={content:new Uint32Array(i),fg:new Uint32Array(i),bg:new Uint32Array(i),ext:new Uint32Array(i),combined:new Array(i).fill("")},this.paintedOverlayRows.clear(),this.paintedCursorRow=-1}configureAtlas(){const i=this.dimensions.device,s=this.core.optionsService.rawOptions;this.atlas.configure({cellWidth:i.cell.width,cellHeight:i.cell.height,charWidth:i.char.width,charHeight:i.char.height,charLeft:i.char.left,charTop:i.char.top,dpr:this.core._coreBrowserService.dpr},{fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,customGlyphs:s.customGlyphs!==!1})}invalidateAll(){this.painted.content.fill(nr),this.painted.meta.fill(nr),this.paintedCursorRow=-1}observeDevicePixels(){const i=this.core._coreBrowserService.window;if(!i||typeof i.ResizeObserver!="function")return;let s=new i.ResizeObserver(r=>{var y;const c=r.find(b=>b.target===this.canvas);if(!c)return;if(!("devicePixelContentBoxSize"in c)||!((y=c.devicePixelContentBoxSize)!=null&&y[0])){s==null||s.disconnect(),s=null;return}const d=c.devicePixelContentBoxSize[0].inlineSize,h=c.devicePixelContentBoxSize[0].blockSize;if(d<=0||h<=0||d===this.canvas.width&&h===this.canvas.height)return;const m=this.core._coreBrowserService.dpr,p=this.dimensions.css.canvas;if(!(Math.abs(d-p.width*m)>2||Math.abs(h-p.height*m)>2)){this.dimensions.device.canvas.width=d,this.dimensions.device.canvas.height=h;for(const b of[this.canvas,this.decorCanvas])b.width=d,b.height=h;this.invalidateAll(),this.fillBackground(),this.redrawDecor(),this.redraw.fire({start:0,end:Math.max(0,this.rows-1)})}});try{s.observe(this.canvas,{box:"device-pixel-content-box"})}catch{s.disconnect(),s=null}this.disposables.push({dispose:()=>s==null?void 0:s.disconnect()})}observeFonts(i){const s=i.fonts;if(!s||typeof s.addEventListener!="function")return;const r=()=>this.clearTextureAtlas();s.addEventListener("loadingdone",r),this.disposables.push({dispose:()=>s.removeEventListener("loadingdone",r)})}buffer(){return this.core._bufferService.buffer}colors(){return this.core._themeService.colors}boldBright(){return this.core.optionsService.rawOptions.drawBoldTextInBrightColors!==!1}requestAbsoluteRows(i){if(!this.rows)return;const s=this.buffer().ydisp;let r=1/0,c=-1/0;for(const d of i){const h=d-s;h<0||h>=this.rows||(r=Math.min(r,h),c=Math.max(c,h))}r<=c&&this.redraw.fire({start:r,end:c})}}function mg(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function nS(a){if(!a)return[];const i=a.cells.map(s=>s.row);return a.cursor&&i.push(a.cursor.row),i}function Do(a,i,s){i>=0&&i<s&&a.add(i)}const dr="herdr_remote_renderer_probe_v3",iS=30,Wb=640,Jb=240,Oo=1,aS=720*60*60*1e3,Rd={};function ey(){let a=null;if(typeof window>"u")a=Rd[dr]||null;else try{a=window.localStorage?window.localStorage.getItem(dr):null}catch{a=Rd[dr]||null}if(!a)return{v:Oo,ua:{}};try{const i=JSON.parse(a);return typeof i=="object"&&i!==null&&i.v===Oo&&typeof i.ua=="object"&&i.ua!==null?i:{v:Oo,ua:{}}}catch{return{v:Oo,ua:{}}}}function lS(a,i=Date.now()){var c;const s=ey();s.ua[a]={failedAt:i};const r=JSON.stringify(s);if(Rd[dr]=r,typeof window<"u")try{(c=window.localStorage)==null||c.setItem(dr,r)}catch(d){console.warn("Failed to write renderer probe result to localStorage:",d)}}function sS(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";if(!s)return!1;const c=ey().ua[s];return!(!c||typeof c.failedAt!="number"||i-c.failedAt>aS)}function pg(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";s&&lS(s,i)}function rS(a){if(a.length<4)return!0;const i=a[0],s=a[1],r=a[2],c=a[3];for(let d=4;d<a.length;d+=4)if(a[d]!==i||a[d+1]!==s||a[d+2]!==r||a[d+3]!==c)return!1;return!0}function oS(a){if(!a||a.width<=0||a.height<=0)return console.debug("Canvas probe inconclusive: text layer canvas missing or zero dimensions"),"inconclusive";let i=null;try{i=a.getContext("2d",{willReadFrequently:!0})||a.getContext("2d")}catch(c){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",c),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const s=Math.min(a.width,Wb),r=Math.min(a.height,Jb);if(s<=0||r<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const c=i.getImageData(0,0,s,r);return rS(c.data)?"blank":"healthy"}catch(c){return console.debug("Canvas probe inconclusive: getImageData threw exception:",c),"inconclusive"}}function gg(a=2){return new Promise(i=>{if(typeof requestAnimationFrame!="function"){setTimeout(i,32);return}let s=a;const r=()=>{s--,s<=0?i():requestAnimationFrame(r)};requestAnimationFrame(r)})}const dd={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function cS(a,i={}){if(sS())return dd;let s;try{s=Yd.install(a,{isSynchronizing:i.isSynchronizing})}catch(m){return console.debug("Canvas renderer unavailable, using the DOM renderer:",m),pg(),dd}if(!s)return dd;let r=s,c=null;const d=()=>{var p;if(!r)return;pg();const m=r;r=null;try{m.uninstall()}catch{}(p=i.onRendererSwapped)==null||p.call(i,"dom")};return{get kind(){return r?"canvas":"dom"},get canvas(){return r},dispose:()=>{const m=r;r=null;try{m==null||m.dispose()}catch{}},verify:async()=>{if(r)return c||(c=(async()=>{try{const m=r.stats.frames;await gg(2);for(let y=0;y<iS&&r&&r.stats.frames===m;y++)await gg(1);if(!r)return;const p=oS(r.textCanvas);p==="blank"&&r.hasPaintedInk(Wb,Jb)?d():p==="blank"?console.debug("Canvas probe inconclusive: uniform, but no character was painted there"):p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(m){console.debug("Canvas probe inconclusive: unexpected error during verify():",m)}finally{c=null}})(),c)}}}function bg(a,i){const s=typeof window<"u"?window:void 0,r=s&&typeof s.devicePixelRatio=="number"&&s.devicePixelRatio>0?s.devicePixelRatio:1,c=s&&s.visualViewport&&typeof s.visualViewport.scale=="number"&&s.visualViewport.scale>0?s.visualViewport.scale:1,d=Math.max(0,a.width),h=Math.max(0,a.height),m=Math.round(d*r*100)/100,p=Math.round(h*r*100)/100;return{dpr:r,scale:c,cssWidth:d,cssHeight:h,physicalWidth:m,physicalHeight:p}}function uS(a){const{lastSnapshot:i,currentSnapshot:s,physicalTolerancePx:r=6}=a;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const c=Math.abs(s.scale-i.scale)>.01,d=Math.abs(s.scale-1)>.01;if(c||d)return{shouldIgnore:!0,isVisualZoom:!0,reason:"visual_pinch_zoom"};if(Math.abs(s.dpr-i.dpr)>.01){const y=Math.abs(s.physicalWidth-i.physicalWidth),b=Math.abs(s.physicalHeight-i.physicalHeight);if(y<=r&&b<=r)return{shouldIgnore:!0,isVisualZoom:!0,reason:"dpr_zoom"}}const m=Math.abs(s.cssWidth-i.cssWidth),p=Math.abs(s.cssHeight-i.cssHeight);return m<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const dS=" ()[]{}'\"\\`";function fd(a,i,s,r=1){var R,D;if(!i||!((R=i.buffer)!=null&&R.active)||i.cols<=0||i.rows<=0)return null;const c=s||((D=i.element)==null?void 0:D.querySelector(".xterm-screen"))||i.element;if(!c||typeof c.getBoundingClientRect!="function")return null;const d=c.getBoundingClientRect(),h=Gb(a.clientX,a.clientY,d,r),m=rl(i);if(m.cellWidth<=0||m.cellHeight<=0)return null;const p=Math.max(1,d.width||i.cols*m.cellWidth),y=Math.max(1,d.height||i.rows*m.cellHeight),b=Math.max(0,Math.min(p-1,h.clientX-d.left)),v=Math.max(0,Math.min(y-1,h.clientY-d.top)),S=Math.max(0,Math.min(i.cols-1,Math.floor(b/m.cellWidth))),M=Math.max(0,Math.min(i.rows-1,Math.floor(v/m.cellHeight))),q=(i.buffer.active.viewportY??0)+M;return{col:S,bufferRow:q}}function fS(a,i){if(!a||a.length===0||a==="\0")return!0;for(const s of a)if(s==="\0"||/\s/.test(s)||i.includes(s))return!0;return!1}function hS(a,i,s){var S,M;if(!a||!((S=a.buffer)!=null&&S.active)||i<0||i>=a.cols)return null;const r=a.buffer.active.getLine(s);if(!r)return null;const c=((M=a.options)==null?void 0:M.wordSeparator)??dS,d=new Array(a.cols).fill(null),h=Math.min(a.cols,r.length);let m=0;for(;m<h;){const N=r.getCell(m);if(!N){d[m]={startCol:m,endCol:m+1,isSeparator:!0},m++;continue}const q=N.getWidth();if(q===0){d[m]||(d[m]={startCol:m,endCol:m+1,isSeparator:!0}),m++;continue}const R=N.getChars(),D=fS(R,c),B=Math.min(a.cols,m+q),G={startCol:m,endCol:B,isSeparator:D};for(let le=m;le<B;le++)d[le]=G;m+=Math.max(1,q)}for(let N=h;N<a.cols;N++)d[N]||(d[N]={startCol:N,endCol:N+1,isSeparator:!0});const p=d[i];if(!p||p.isSeparator)return null;let y=p.startCol;for(;y>0;){const N=d[y-1];if(N&&!N.isSeparator)y=N.startCol;else break}let b=p.endCol;for(;b<a.cols;){const N=d[b];if(N&&!N.isSeparator)b=N.endCol;else break}const v=b-y;return v<=0?null:{startCol:y,length:v}}function mS(a){var d;if(!a||!((d=a.buffer)!=null&&d.active))return"";const i=a.buffer.active,s=i.viewportY??0,r=a.rows,c=[];for(let h=0;h<r;h++){const m=i.getLine(s+h);c.push(m?m.translateToString(!0):"")}for(;c.length>0&&c[c.length-1]==="";)c.pop();return c.join(`
|
|
45
|
-
`)}const yg=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),pS=.6,gS=new Set(["─","━","═","┄","┅","┈","┉","-"]),bS=.8;function hd(a,i){if(!a)return!1;let s=0;const r=Math.min(i,a.length);for(let c=0;c<r;c++){const d=a.getCell(c);if(d){const h=d.getChars();h&&gS.has(h)&&s++}}return s>=Math.max(5,Math.min(i*.25,10))}function md(a,i,s){var M;if(!a||!((M=a.buffer)!=null&&M.active)||a.cols<=0)return{startCol:0,endCol:0};const r=a.buffer.active,c=a.cols,d=Math.max(0,Math.min(c-1,i)),h=r.viewportY??0,m=a.rows>0?a.rows:1,p=new Int32Array(c);let y=0;for(let N=0;N<m;N++){const q=r.getLine(h+N);if(y++,!q)continue;const R=Math.min(c,q.length);for(let D=0;D<R;D++){const B=q.getCell(D);if(B){const G=B.getChars();G&&yg.has(G)&&p[D]++}}}if(y===0)return{startCol:0,endCol:c-1};const b=y*pS,v=N=>p[N]>=b;let S=!1;for(let N=0;N<c;N++)if(v(N)){S=!0;break}if(S){if(v(d))return{startCol:d,endCol:d};let N=-1;for(let R=d-1;R>=0;R--)if(v(R)){N=R;break}let q=c;for(let R=d+1;R<c;R++)if(v(R)){q=R;break}return{startCol:N+1,endCol:q-1}}if(s!==void 0){const N=Math.max(h,Math.min(h+m-1,s)),q=r.getLine(N);if(!hd(q,c)){let R=h;for(let G=N-1;G>=h;G--)if(hd(r.getLine(G),c)){R=G+1;break}let D=h+m-1;for(let G=N+1;G<=h+m-1;G++)if(hd(r.getLine(G),c)){D=G-1;break}const B=D-R+1;if(B>=2){const G=new Int32Array(c);for(let F=R;F<=D;F++){const I=r.getLine(F);if(!I)continue;const me=Math.min(c,I.length);for(let be=0;be<me;be++){const Ne=I.getCell(be);if(Ne){const ie=Ne.getChars();ie&&yg.has(ie)&&G[be]++}}}const le=B*bS,fe=F=>G[F]>=le;let te=!1;for(let F=0;F<c;F++)if(fe(F)){te=!0;break}if(te){if(fe(d))return{startCol:d,endCol:d};let F=-1;for(let me=d-1;me>=0;me--)if(fe(me)){F=me;break}let I=c;for(let me=d+1;me<c;me++)if(fe(me)){I=me;break}return{startCol:F+1,endCol:I-1}}}}}return{startCol:0,endCol:c-1}}function vg(a,i){const s=Math.min(a.startCol,a.endCol),r=Math.max(a.startCol,a.endCol),c=Math.min(a.startRow,a.endRow),d=Math.max(a.startRow,a.endRow);return{startCol:Math.max(i.startCol,Math.min(i.endCol,s)),endCol:Math.max(i.startCol,Math.min(i.endCol,r)),startRow:c,endRow:d}}function pd(a,i){var y;if(!a||!((y=a.buffer)!=null&&y.active)||a.cols<=0)return"";const s=a.buffer.active,r=a.cols,c=Math.min(i.startRow,i.endRow),d=Math.max(i.startRow,i.endRow),h=Math.max(0,Math.min(i.startCol,i.endCol)),m=Math.min(r-1,Math.max(i.startCol,i.endCol));if(h>m||c>d)return"";const p=[];for(let b=c;b<=d;b++){const v=s.getLine(b);if(!v){p.push("");continue}const S=v.translateToString(!0,h,m+1);p.push(S.trimEnd())}return p.join(`
|
|
46
|
-
`)}async function Ba(a){if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(a),"clipboard"}catch{}if(typeof document<"u"&&typeof document.execCommand=="function"){let i=null,s=null,r=null;try{if(i=document.createElement("textarea"),i.style.userSelect="text",i.style.webkitUserSelect="text",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="1px",i.style.height="1px",i.style.padding="0",i.style.border="none",i.style.outline="none",i.style.boxShadow="none",i.style.background="transparent",i.style.opacity="0",i.style.fontSize="16px",i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.value=a,typeof window<"u"&&typeof window.getSelection=="function"&&(r=window.getSelection(),r&&r.rangeCount>0&&(s=r.getRangeAt(0))),document.body.appendChild(i),typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent||"")||navigator.platform==="MacIntel"&&(navigator.maxTouchPoints||0)>1)){const h=document.createRange();h.selectNodeContents(i),r&&(r.removeAllRanges(),r.addRange(h)),i.setSelectionRange(0,a.length)}else i.focus({preventScroll:!0}),i.select();if(document.execCommand("copy"))return"exec"}catch{}finally{i&&i.parentNode&&i.parentNode.removeChild(i),r&&(r.removeAllRanges(),s&&r.addRange(s))}}return"failed"}async function yS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.readText();return!i||i.length===0?{ok:!1,reason:"empty"}:{ok:!0,text:i}}catch(i){return typeof window<"u"&&window.isSecureContext===!1?{ok:!1,reason:"insecure"}:(i==null?void 0:i.name)==="SecurityError"?{ok:!1,reason:"insecure"}:{ok:!1,reason:"denied"}}}async function vS(){if(!(typeof window>"u"||window.isSecureContext!==!1)||typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.read!="function")return{ok:!1,reason:"insecure"};try{const i=await navigator.clipboard.read();if(!i||i.length===0)return{ok:!1,reason:"empty"};for(const s of i){const r=s.types.find(c=>c.startsWith("image/"));if(r){const c=await s.getType(r);if(c&&c.size>0)return{ok:!0,blob:c}}}return{ok:!1,reason:"empty"}}catch(i){if(typeof window<"u"&&window.isSecureContext===!1)return{ok:!1,reason:"insecure"};const s=i==null?void 0:i.name;return s==="SecurityError"?{ok:!1,reason:"insecure"}:s==="NotAllowedError"?{ok:!1,reason:"denied"}:{ok:!1,reason:"empty"}}}function ty(a){const i=a.clipboardData;if(!i)return null;if(i.files&&i.files.length>0)for(let s=0;s<i.files.length;s++){const r=i.files[s];if(r&&r.type.startsWith("image/"))return r}if(i.items&&i.items.length>0)for(let s=0;s<i.items.length;s++){const r=i.items[s];if(r&&r.type.startsWith("image/")){const c=r.getAsFile();if(c)return c}}return null}function xS(a){if(!a||a.length===0)return null;for(let i=0;i<a.length;i++){const s=a[i];if(s&&(s.type.startsWith("image/")||/\.(png|jpe?g|webp|gif)$/i.test(s.name)))return s}return null}const gd="Herdr Remote",xg=80,wS=/[\u0000-\u001F\u007F-\u009F]/g;function Ld(a){if(typeof a!="string")return"";const i=a.replace(wS," ").replace(/\s+/g," ").trim();return i.length<=xg?i:`${i.slice(0,xg-1).trimEnd()}…`}function SS(a,i,s){const r=ow(s??null),c=r?`${r} `:"",d=Ld(a);if(d)return`${c}${d} · ${gd}`;const h=Ld(i);return h?`${c}${h} · ${gd}`:`${c}${gd}`}function CS(a,i,s){const r=SS(a,i,s);return typeof document<"u"&&(document.title=r),r}const TS=new Set(["http:","https:","mailto:"]),bd=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,MS=/[.,;:!?'"]+$/,wg=8;function $d(a){return/^www\./i.test(a)?`https://${a}`:a}function AS(a){const i=(c,d)=>c.split(d).length-1;let s=a.replace(MS,"");const r=[["(",")"],["[","]"],["{","}"]];for(const[c,d]of r)for(;s.endsWith(d)&&i(s,d)>i(s,c);)s=s.slice(0,-1);return s}function ny(a){if(typeof a!="string"||a.length===0)return!1;try{return TS.has(new URL($d(a)).protocol)}catch{return!1}}function ES(a,i){if(typeof a!="string"||i<0)return null;bd.lastIndex=0;for(let s=bd.exec(a);s;s=bd.exec(a)){const r=AS(s[0]);if(!r)continue;const c=s.index,d=c+r.length;if(i>=c&&i<d&&ny(r))return r}return null}function NS(a,i,s){var m;const r=(m=a==null?void 0:a.buffer)==null?void 0:m.active;if(!r||typeof r.getLine!="function"||!r.getLine(s))return null;let c=s;for(let p=0;p<wg;p+=1){const y=r.getLine(c);if(!(y!=null&&y.isWrapped)||c===0)break;c-=1}let d="",h=-1;for(let p=c;p<c+wg;p+=1){const y=r.getLine(p);if(!y||p>c&&!y.isWrapped)break;p===s&&(h=d.length+i),d+=y.translateToString(!1)}return h<0?null:{text:d,index:h}}function kS(a,i,s){const r=NS(a,i,s);return r?ES(r.text,r.index):null}function RS(a){try{const i=new URL($d(a));return i.host||i.pathname}catch{return""}}function yd(a){return!ny(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open($d(a),"_blank","noopener,noreferrer"),!0)}const Pl="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Zl="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",LS=({anchorPoint:a,hasSelection:i,isController:s,vibrateOnKeyPress:r=!1,linkUrl:c=null,onOpenLink:d,onCopySelection:h,onCopyLine:m,onCopyScreen:p,onPaste:y,onClose:b})=>{const{t:v}=rt(),S=w.useRef(null),[M,N]=w.useState(null);w.useEffect(()=>{if(r&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r]),w.useLayoutEffect(()=>{const B=S.current;if(!B||!B.parentElement)return;const G=B.parentElement.getBoundingClientRect(),le=B.getBoundingClientRect(),fe=le.width||208,te=le.height||220,F=G.width,I=G.height;let me=a.x-fe/2;me=Math.max(8,Math.min(Math.max(8,F-fe-8),me));let be=a.y-te-8;be<8&&(be=a.y+8),be=Math.max(8,Math.min(Math.max(8,I-te-8),be)),N({x:me,y:be})},[a.x,a.y,i,s,c]);const q=Math.max(8,a.x-104),R=Math.max(8,a.y-200),D={position:"absolute",left:`${M?M.x:q}px`,top:`${M?M.y:R}px`,visibility:M?"visible":"hidden"};return f.jsx("div",{ref:S,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:D,onMouseDown:B=>B.stopPropagation(),onTouchStart:B=>B.stopPropagation(),onPointerDown:B=>B.stopPropagation(),children:f.jsxs(an,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[c&&d&&f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:()=>{d(c),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:RS(c)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:()=>{h(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:()=>{m(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:()=>{p(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),s&&f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:()=>{y(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:re(Pl,Zl),onClick:b,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:Ye.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},_S=({isOpen:a,onClose:i,onSend:s,onSendImage:r})=>{const{t:c,addToast:d}=rt(),[h,m]=w.useState(""),[p,y]=w.useState(null),[b,v]=w.useState(!1),S=w.useRef(null),M=w.useRef(null),N=w.useRef(null);w.useEffect(()=>{a&&(m(""),y(null),v(!1),S.current&&(S.current.value=""),M.current&&(M.current.value=""))},[a]);const q=async te=>{if(te.size===0){d("error",c("clipboard.fileEmpty"));return}v(!0);try{const F=await pb(te);F?(y(F),m("")):d("error",c("clipboard.imageTooLarge"))}catch(F){console.error("Failed to process image:",F),d("error",c("clipboard.imageTooLarge"))}finally{v(!1)}},R=async te=>{const F=ty(te);F&&(te.preventDefault(),await q(F))},D=async te=>{const F=xS(te.target.files);te.target.value="",F&&await q(F)},B=te=>{const F=te.target.value;m(F),F&&p&&y(null)},G=()=>{y(null),S.current&&(S.current.value=""),M.current&&(M.current.value="")},le=()=>{p?(r==null||r(p),i()):h.trim()&&(s(h),i())},fe=!!(h.trim()||p);return f.jsx(Vo,{isOpen:a,onClose:i,title:c("clipboard.pasteTitle"),closeLabel:c("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(je,{variant:"ghost",onClick:i,children:c("clipboard.cancel")}),f.jsx(je,{variant:"primary",onClick:le,disabled:!fe||b,children:c("clipboard.pasteSend")})]}),children:f.jsxs("div",{className:"flex flex-col gap-3 p-3 font-mono select-text",children:[f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("label",{htmlFor:"paste-fallback-input",className:"text-tui-sm text-tui-muted font-sans font-medium",children:c("clipboard.pasteHint")}),f.jsx("textarea",{ref:N,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:c("clipboard.pasteHint"),value:h,onChange:B,onPaste:R,disabled:!!p||b,className:"tui-input min-h-[90px] w-full resize-none p-2 text-tui font-mono rounded border border-tui-border bg-tui-bg focus:outline-none focus:ring-1 focus:ring-tui-accent disabled:opacity-50"})]}),f.jsxs("div",{className:"relative my-1",children:[f.jsx("div",{className:"absolute inset-0 flex items-center",children:f.jsx("div",{className:"w-full border-t border-tui-border"})}),f.jsx("div",{className:"relative flex justify-center text-tui-xs uppercase",children:f.jsx("span",{className:"bg-tui-bg px-2 text-tui-muted font-sans",children:c("clipboard.imageSectionTitle")})})]}),f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"paste-fallback-file-input",onChange:D}),f.jsx("input",{ref:M,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:D}),p?f.jsxs("div",{className:"flex flex-col items-center gap-2 p-3 border border-tui-border bg-tui-bg rounded",children:[f.jsx("img",{src:p.dataUrl,alt:"Pasted preview","data-testid":"pasted-image-preview",className:"max-h-40 max-w-full object-contain rounded border border-tui-border"}),f.jsxs("div",{className:"flex items-center justify-between w-full text-tui-xs text-tui-muted pt-1",children:[f.jsx("span",{children:c("clipboard.imageCompressedSize",{size:Jx(p.byteLength)})}),f.jsx(je,{variant:"ghost",onClick:G,"aria-label":c("clipboard.removeImage"),children:c("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(je,{variant:"default",onClick:()=>{var te;return(te=S.current)==null?void 0:te.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":c("clipboard.chooseImage"),children:c("clipboard.chooseImage")}),f.jsx(je,{variant:"default",onClick:()=>{var te;return(te=M.current)==null?void 0:te.click()},disabled:b||!!h.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":c("clipboard.takePhoto"),children:c("clipboard.takePhoto")})]}),b&&f.jsx("div",{className:"flex items-center gap-2 text-tui-xs text-tui-muted animate-pulse",children:f.jsx("span",{children:c("clipboard.imageCompressing")})})]})]})})},jS=[[12288,12329],[12334,12335],[12337,12348],[12350,12350],[12353,12438],[12443,12543],[13312,19903],[19968,40959],[44032,55203],[63744,64255],[65281,65376],[65504,65510],[131072,196605],[196608,262141]];function Sg(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[i,s]of jS){if(a<i)return 0;if(a<=s)return 2}return 0}const DS=2,OS="?!#",Cg=8,zS=1500,BS=4e3,HS=20;function Ji(a){return a===""||a===" "?" ":a}function US(a,i,s,r=64){var h;const c=a.buffer.active.getLine(i),d=[];for(let m=s-1;m>=0&&d.length<r;m--){const p=c==null?void 0:c.getCell(m);if(!p)break;((h=p.getWidth)==null?void 0:h.call(p))!==0&&d.unshift(Ji(p.getChars()))}return d}function KS(a,i){for(let s=Math.min(a.length,i.length);s>0;s--){let r=!0;for(let c=0;c<s&&r;c++)r=i[i.length-s+c]===Ji(a[c]);if(r)return s}return 0}function FS(a){const i=a.buffer.active;return{key:"legacy",row:i.baseY+i.cursorY,caretCol:i.cursorX,startCol:i.cursorX,endCol:a.cols,empty:!1,agentLike:!1}}class IS{constructor(i){Z(this,"getTerminal");Z(this,"getFieldOption");Z(this,"charWidth");Z(this,"now");Z(this,"textDecoder",new TextDecoder("utf-8"));Z(this,"confidentKeys",new Set);Z(this,"fieldStyles",new Map);Z(this,"field",null);Z(this,"runStartedEmpty",!1);Z(this,"predictions",[]);Z(this,"predictedCursor",null);Z(this,"srtt",null);Z(this,"isSuppressed",!1);Z(this,"suppressCursor",null);Z(this,"suppressSentAt",0);Z(this,"inFlight",[]);Z(this,"inFlightUnknown",!1);Z(this,"runInFlight",[]);Z(this,"probationRun",!1);Z(this,"runSent",[]);Z(this,"lastSentUndrawn",!1);Z(this,"awaitingPrefixCommand",!1);Z(this,"mismatches",0);Z(this,"trace",[]);this.getTerminal=i.getTerminal,this.getFieldOption=i.getField,this.charWidth=i.charWidth,this.now=i.now??(typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now())}handleUserInput(i){var h;if(this.pruneExpired(),i.length===0)return;const s=this.textDecoder.decode(i,{stream:!1});if(!s)return;const r=Kb(s);if(r==="passive")return;if(r==="pointer"){this.freeze("pointer");return}if(this.awaitingPrefixCommand){this.awaitingPrefixCommand=!1,this.freeze("Herdr prefix command",{demote:!0});return}if(E1(s)){const m=this.field??((h=this.getFieldOption)==null?void 0:h.call(this))??null;this.freeze("escape",{demote:!m||m.modal!==!1});return}const c=this.getTerminal();if(!c){this.reset("terminal unavailable",!0);return}const d=Array.from(s);for(let m=0;m<d.length;m++){const p=d[m],y=p.codePointAt(0);if(y===void 0)continue;if(y===DS){this.awaitingPrefixCommand=!0,this.freeze("Herdr prefix",{demote:!0});return}if(y===27||y===9||y===10||y===13||y<32&&y!==8){this.freeze("control or escape sequence");return}if(y===8||y===127){if(!this.handleBackspace(c))return;continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const b=Sg(y);if(b===0){if(!this.skipUnpredictable(p,y,c)){m<d.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,b,c)){m<d.length-1&&(this.inFlightUnknown=!0);return}}}onServerOutput(){const i=this.getTerminal(),s=i?{row:i.buffer.active.baseY+i.buffer.active.cursorY,col:i.buffer.active.cursorX}:null;this.pruneExpired(),i&&s&&this.predictions.length>0&&this.settle(i,s),this.updateSuppression(s)}updateSuppression(i){if(!this.isSuppressed)return;if(this.predictions.some(r=>r.frozenFrom)){this.suppressSentAt=this.now();return}!!i&&!!this.suppressCursor&&(i.row!==this.suppressCursor.row||i.col!==this.suppressCursor.col)?this.liftSuppression():this.stillSuppressed()}settle(i,s){var d,h;const r=this.field;if(this.getFieldOption){const m=this.getFieldOption();if(!m||m.key!==(r==null?void 0:r.key)){if(this.predictions.every(p=>p.frozenFrom||p.echoed)){this.predictions=[],this.predictedCursor=null;return}this.mismatch("field changed");return}if(m.layout!==r.layout){this.predictions=[],this.predictedCursor=null,this.field=m,this.note("layout changed");return}}const c=[];for(const m of this.predictions){const p=(d=i.buffer.active.getLine(m.row))==null?void 0:d.getCell(m.col),y=Ji(p?p.getChars():""),b=m.kind==="char"?y===m.char&&(m.width===1||(((h=p==null?void 0:p.getWidth)==null?void 0:h.call(p))??2)===2):y===" ",v=m.kind==="char"?s.row>m.row||s.row===m.row&&s.col>=m.col+m.width:s.row<m.row||s.row===m.row&&s.col<=m.col,S=m.before.includes(y),M=m.kind==="char"&&y===m.char&&!b;if(!(m.echoed&&!b))if(b&&(v||!S)){if(m.echoed||this.confirm(m,r),v){m.kind==="char"&&r&&!m.frozenFrom&&this.learnStyle(r.key,p);continue}m.echoed=!0,c.push(m)}else if(m.frozenFrom){const N=m.frozenFrom;!v&&s.row===N.row&&s.col>=N.col?c.push(m):v&&m.probation&&(this.inFlightUnknown=!0)}else if(!v&&!M)c.push(m);else if(m.probation){this.note("probation guess dropped"),this.predictions.some(N=>!N.frozenFrom&&N.kind==="erase")&&(this.inFlightUnknown=!0),this.inFlight=[...this.runInFlight,...this.runSent,...this.inFlight],this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.predictions=this.predictions.filter(N=>N.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(m.char)}`);return}}this.predictions=c,c.length===0&&(this.predictedCursor=null)}reset(i,s){var d;this.predictions=[],this.predictedCursor=null;const r=typeof s=="boolean"?s:(s==null?void 0:s.suppress)??!0,c=typeof s=="object"&&(s==null?void 0:s.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),c){const h=this.field??((d=this.getFieldOption)==null?void 0:d.call(this))??null;h&&this.confidentKeys.delete(h.key)}if(this.forgetInFlight(),r){this.isSuppressed=!0,this.suppressSentAt=this.now();const h=this.getTerminal();h?this.suppressCursor={row:h.buffer.active.baseY+h.buffer.active.cursorY,col:h.buffer.active.cursorX}:this.suppressCursor=null}else this.isSuppressed=!1,this.suppressCursor=null}forgetConfidence(){this.confidentKeys.clear(),this.fieldStyles.clear(),this.field=null}getVisiblePredictions(){return this.pruneExpired(),this.visiblePredictions().filter(i=>!i.echoed).map(i=>({row:i.row,col:i.col,char:i.char}))}getOverlayItems(){var S,M,N,q,R;this.pruneExpired();const i=this.visiblePredictions();if(i.length===0)return[];const s=this.field?this.fieldStyles.get(this.field.key):void 0,r=i.map(D=>{const B={row:D.row,col:D.col,char:D.char,width:D.width,kind:D.kind};return s&&(B.style=s),B}),c=i[i.length-1],d=this.predictedCursor??{row:c.row,col:c.kind==="erase"?c.col:c.col+c.width},h=(D,B)=>r.some(G=>G.row===D&&G.col<=B&&B<G.col+G.width),m=this.getTerminal(),p=m==null?void 0:m.buffer.active,y=this.field;if(p&&y&&this.runStartedEmpty&&y.agentLike&&d.row===y.row){const D=p.getLine(d.row);for(let B=d.col;B<y.endCol;B++){if(h(d.row,B)||Ji(((S=D==null?void 0:D.getCell(B))==null?void 0:S.getChars())??"")===" ")continue;const G={row:d.row,col:B,char:" ",width:1,kind:"erase"};s&&(G.style=s),r.push(G)}}if(p){const D={row:p.baseY+p.cursorY,col:p.cursorX};if(!h(D.row,D.col)&&(D.row!==d.row||D.col!==d.col)){const B=((N=(M=p.getLine(D.row))==null?void 0:M.getCell(D.col))==null?void 0:N.getChars())??"",G={row:D.row,col:D.col,char:Ji(B),width:1,kind:"mask"};s&&(G.style=s),r.push(G)}}const b=r.find(D=>D.row===d.row&&D.col===d.col&&D.kind!=="mask"),v=b?b.char:Ji(((R=(q=p==null?void 0:p.getLine(d.row))==null?void 0:q.getCell(d.col))==null?void 0:R.getChars())??"");return r.push({row:d.row,col:d.col,char:v,width:1,kind:"caret"}),r}getState(){return this.field&&this.confidentKeys.has(this.field.key)?"confident":"tentative"}getField(){return this.field}getMismatchCount(){return this.mismatches}getEchoSrttMs(){return this.srtt}getTrace(){return this.trace}visiblePredictions(){const i=this.getState()==="confident";return this.predictions.filter(s=>s.frozenFrom?s.shownWhenFrozen:i&&!s.probation)}freeze(i,s={}){var p;const r=this.getTerminal(),c=r?{row:r.buffer.active.baseY+r.buffer.active.cursorY,col:r.buffer.active.cursorX}:null,d=this.getState()==="confident";for(const y of this.predictions)y.frozenFrom||(y.frozenFrom=c??{row:y.row,col:y.col},y.shownWhenFrozen=d&&!y.probation);const h=this.predictedCursor?{...this.predictedCursor}:c,m=this.inFlight.length>0||this.inFlightUnknown||this.lastSentUndrawn;if(this.predictedCursor=null,this.note(`freeze: ${i}${s.demote?" (demote)":""}`),s.demote){const y=this.field??((p=this.getFieldOption)==null?void 0:p.call(this))??null;y&&this.confidentKeys.delete(y.key)}this.isSuppressed=!0,this.suppressSentAt=this.now(),this.suppressCursor=h,this.forgetInFlight(),this.inFlightUnknown=m}forgetInFlight(){this.inFlight=[],this.inFlightUnknown=!1,this.runInFlight=[],this.runSent=[],this.probationRun=!1,this.lastSentUndrawn=!1}suppressTimeout(){return Math.max(300,(this.srtt??300)*1.5)}predictionTimeout(){return Math.min(BS,Math.max(zS,(this.srtt??0)*4))}stillSuppressed(){return this.isSuppressed?this.now()-this.suppressSentAt>=this.suppressTimeout()?(this.liftSuppression(),!1):!0:!1}liftSuppression(){this.isSuppressed=!1,this.suppressCursor=null}handlePrintable(i,s,r){var v;const c=this.ensureField(r);if(!c||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const d=this.predictedCursor,h=this.predictions.every(S=>S.frozenFrom)&&d.col===c.caretCol;if(c.agentLike&&c.empty&&h&&OS.includes(i))return this.freeze("agent mode switch"),!1;if(d.col+s>c.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const m=(v=r.buffer.active.getLine(d.row))==null?void 0:v.getCell(d.col),p=[Ji(m?m.getChars():"")],y=this.predictions[this.predictions.length-1];let b;return y&&y.kind==="erase"&&!y.frozenFrom&&y.row===d.row&&y.col===d.col&&(b=this.predictions.pop(),p.push(...y.before," ")),this.predictions.push({row:d.row,col:d.col,char:i,width:s,kind:"char",before:p,sentAt:this.now(),replaces:b,probation:this.probationRun||void 0}),this.probationRun&&this.runSent.push(i),this.lastSentUndrawn=!1,d.col+=s,!0}skipUnpredictable(i,s,r){const c=this.ensureField(r),d=this.predictedCursor;if(!c||!d)return this.note("refused: caret is not in an input field"),!1;const h=this.assumedWidth(s);return d.col+h>c.endCol-1?(this.freeze("cursor would reach the edge of the field"),!1):(this.probationRun||(this.probationRun=!0,this.runSent=[]),this.runSent.push(i),this.lastSentUndrawn=!0,d.col+=h,this.note("width unknown: guessing"),!0)}assumedWidth(i){var r;const s=(r=this.charWidth)==null?void 0:r.call(this,i);return s===0||s===1||s===2?s:1}handleBackspace(i){var r,c,d;const s=this.predictions[this.predictions.length-1];if(this.predictedCursor&&s&&!s.frozenFrom&&!s.echoed&&s.kind==="char"&&s.row===this.predictedCursor.row&&s.col+s.width===this.predictedCursor.col)return this.predictions.pop(),s.probation&&this.runSent.pop(),this.predictedCursor.col=s.col,s.replaces&&this.predictions.push(s.replaces),!0;if(this.stillSuppressed())this.inFlightUnknown=!0;else{const h=this.ensureField(i),m=this.predictedCursor;if(h&&m){const p=i.buffer.active.getLine(m.row),y=p==null?void 0:p.getCell(m.col-1),b=y&&((r=y.getWidth)==null?void 0:r.call(y))===0?2:1,v=m.col-b;let S=!0;for(let N=m.col;N<h.endCol&&S;N++)S=this.coveredByPrediction(m.row,N)||Ji(((c=p==null?void 0:p.getCell(N))==null?void 0:c.getChars())??"")===" ";const M=Ji(((d=p==null?void 0:p.getCell(v))==null?void 0:d.getChars())??"");if(v>h.startCol&&S&&M!==" ")return this.predictions=this.predictions.filter(N=>!(N.echoed&&N.row===m.row&&N.col+N.width>v)),this.predictions.push({row:m.row,col:v,char:" ",width:b,kind:"erase",before:[M],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,m.col=v,!0}}return this.freeze("backspace into server content"),!1}coveredByPrediction(i,s){return this.predictions.some(r=>r.echoed&&r.row===i&&r.col<=s&&s<r.col+r.width)}ensureField(i){if(this.predictedCursor&&this.field)return this.field;const s=this.getFieldOption?this.getFieldOption():FS(i);if(!s)return null;let r=s.caretCol,c=[],d=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){c=this.inFlight.slice(KS(this.inFlight,US(i,s.row,r)));for(const h of c){const m=h.codePointAt(0)??0;r+=Sg(m)||this.assumedWidth(m)}d=c.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=s,this.runStartedEmpty=s.empty&&c.length===0,this.predictions=this.predictions.filter(h=>h.frozenFrom),this.predictedCursor={row:s.row,col:r},this.runInFlight=c,this.probationRun=d,this.runSent=[],s}confirm(i,s){if(this.updateSrtt(Math.max(0,this.now()-i.sentAt)),s&&!i.frozenFrom&&this.markConfident(s.key),i.probation){for(const r of this.predictions)r.probation=void 0;this.probationRun=!1,this.runInFlight=[],this.runSent=[]}}learnStyle(i,s){const r=qb(s);if(r)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,r);this.fieldStyles.size>Cg;){const c=this.fieldStyles.keys().next().value;if(c===void 0)break;this.fieldStyles.delete(c)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>Cg;){const s=this.confidentKeys.values().next().value;if(s===void 0)break;this.confidentKeys.delete(s)}}mismatch(i){this.mismatches++,this.note(`mismatch: ${i}`),this.predictions=[],this.predictedCursor=null,this.field&&this.confidentKeys.delete(this.field.key),this.isSuppressed=!1,this.suppressCursor=null}note(i){const s=this.trace[this.trace.length-1];if(s&&s.event===i){s.count++,s.at=this.now();return}this.trace.push({at:this.now(),event:i,count:1}),this.trace.length>HS&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),s=this.predictionTimeout(),r=this.predictions.filter(c=>i-c.sentAt<=s);r.length!==this.predictions.length&&(this.note("expired without an echo"),this.predictions=r,this.predictions.length===0&&(this.predictedCursor=null))}updateSrtt(i){this.srtt===null?this.srtt=i:this.srtt=this.srtt*.8+i*.2}}class GS{constructor(i){Z(this,"items",[]);Z(this,"target",null);Z(this,"provider",()=>this.paint());this.options=i}attach(i){var s;this.target!==i&&((s=this.target)==null||s.setOverlayProvider(null),this.target=i,i==null||i.setOverlayProvider(this.provider))}sync(i){var s;i.length===0&&this.items.length===0||(this.items=i,(s=this.target)==null||s.invalidateOverlay())}clear(){var i;this.items.length!==0&&(this.items=[],(i=this.target)==null||i.invalidateOverlay())}hasItems(){return this.items.length>0}dispose(){this.attach(null),this.items=[]}paint(){if(this.items.length===0)return null;const i=this.options.getTerminal(),s=i==null?void 0:i.buffer.active;if(!i||!s)return null;const r=[],c=this.options.isCursorHidden(),d=s.baseY+s.cursorY,h=s.cursorX,m=_d(i,d,h),p=c&&!!m&&iy(m);let y;for(const b of this.items)switch(b.kind){case"char":r.push({row:b.row,col:b.col,chars:b.char,width:b.width,style:b.style??qS(i,b.row,b.col)});break;case"erase":r.push({row:b.row,col:b.col,chars:" ",width:b.width,style:$S(b.style??_d(i,b.row,b.col)??Yb)});break;case"mask":p&&b.row===d&&b.col===h&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??YS(m)});break;case"caret":c?p&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:m}):y={row:b.row,col:b.col};break}return y===void 0?{cells:r}:{cells:r,cursor:y}}}function _d(a,i,s){var r;return s<0||s>=a.cols?null:qb((r=a.buffer.active.getLine(i))==null?void 0:r.getCell(s))}function iy(a){return(a.fg&nn.INVERSE)!==0||(a.bg&Et.CM_MASK)!==Et.CM_DEFAULT}function YS(a){return{fg:a.fg&~nn.INVERSE,bg:a.bg&~(Et.CM_MASK|Et.RGB_MASK),ext:a.ext}}function $S(a){return{fg:a.fg&nn.INVERSE?a.fg&(nn.INVERSE|Et.CM_MASK|Et.RGB_MASK):0,bg:a.bg&(Et.CM_MASK|Et.RGB_MASK),ext:0}}function qS(a,i,s){const r=_d(a,i,s-1);return r&&!iy(r)&&!(r.bg&ol.DIM)?r:Yb}const zo=new Set(["│","┃","║","▐","▕","▏","▌"]),Yo=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),VS=new Set(["╭","┌","┏","╔"]),XS=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),PS=new Set(["╮","┐","┓","╗"]),ZS=new Set(["╰","└","┗","╚"]),QS=new Set(["╯","┘","┛","╝"]),vd=new Set(["─","━","═","╌","┄"]),WS=new Set(["❯","›",">","!"]),Tg=new Set(["$","#","%",">","❯","›","➜","λ","»"]),jd=8,JS=12,Mg=2,Ag=1,eC=4,tC=3,Eg=/-- INSERT --/,nC=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,iC=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,aC=/^\s*\d+[.)]\s/;function ns(a){return a===""||a===" "||a===" "}class lC{constructor(i){Z(this,"cell");Z(this,"top");Z(this,"bottom");var s;this.screen=i,this.cell=(s=i.getNullCell)==null?void 0:s.call(i),this.top=i.baseY,this.bottom=i.baseY+i.rows-1}get cols(){return this.screen.cols}at(i,s){var r;if(!(i<this.top||i>this.bottom||s<0||s>=this.screen.cols))return(r=this.screen.getLine(i))==null?void 0:r.getCell(s,this.cell)}char(i,s){var r;return((r=this.at(i,s))==null?void 0:r.getChars())??""}dim(i,s){var r,c;return!!((c=(r=this.at(i,s))==null?void 0:r.isDim)!=null&&c.call(r))}text(i,s,r){var c;return i<this.top||i>this.bottom?"":((c=this.screen.getLine(i))==null?void 0:c.translateToString(!0,s,r))??""}isEdge(i,s){if(!zo.has(this.char(i,s)))return!1;const r=this.char(i-1,s),c=this.char(i+1,s);return zo.has(r)||Yo.has(r)||zo.has(c)||Yo.has(c)}blankOrDim(i,s,r){var c;for(let d=s;d<r;d++){const h=this.at(i,d);if(h&&!ns(h.getChars())&&!((c=h.isDim)!=null&&c.call(h)))return!1}return!0}}function sC(a,i,s){if(a.isEdge(i,s))return null;let r=0;for(let d=s-1;d>=0;d--)if(a.isEdge(i,d)){r=d+1;break}let c=a.cols;for(let d=s+1;d<a.cols;d++)if(a.isEdge(i,d)){c=d;break}return r<c?{start:r,end:c}:null}function Ng(a,i,s){if(!vd.has(a.char(i,s.start))||!vd.has(a.char(i,s.end-1))||Yo.has(a.char(i,s.start-1)))return!1;const r=s.end-s.start;let c=0;for(let d=s.start;d<s.end;d++)if(vd.has(a.char(i,d)))c++;else if(d-s.start-c>r*.1)return!1;return c>=r*.9}function rs(a){return`${a.start}-${a.end}`}function ay(a,i,s){if(s.start===0)return a.top;for(let r=i-1;r>=a.top;r--)if(XS.has(a.char(r,s.start-1)))return r;return a.top}function rC(a,i,s){const r=s.start-1,c=s.end,{row:d}=i;if(r<0||c>=a.cols)return null;const h=a.char(d,r);if(!zo.has(h)||a.char(d,c)!==h)return null;let m=d-1;for(;m>=a.top&&a.char(m,r)===h;)m--;let p=d+1;for(;p<=a.bottom&&a.char(p,r)===h;)p++;if(p-m-1>jd||!VS.has(a.char(m,r))||!PS.has(a.char(m,c))||!ZS.has(a.char(p,r))||!QS.has(a.char(p,c))||a.dim(d,r))return null;const y=s.start+Ag,b=s.end-Ag;return i.col<y||i.col>=b?null:{kind:"frame",key:`frame:${rs(s)}`,region:rs(s),layout:`${m}`,row:d,caretCol:i.col,startCol:y,endCol:b,empty:m+2===p&&i.col===y&&a.blankOrDim(d,y,b),agentLike:!0,vimInsert:null,modal:!1}}function oC(a,i,s){const{row:r}=i;let c=-1;for(let b=r-1;b>=Math.max(a.top,r-jd);b--)if(Ng(a,b,s)){c=b;break}if(c<0)return null;let d=-1;for(let b=r+1;b<=Math.min(a.bottom,r+jd);b++)if(Ng(a,b,s)){d=b;break}if(d<0)return null;const h=c+1;let m=-1;for(let b=s.start;b<Math.min(s.end,s.start+3);b++){const v=a.char(h,b);if(!ns(v)){WS.has(v)&&ns(a.char(h,b+1))&&(m=b);break}}if(m<0||a.dim(h,m)||aC.test(a.text(h,m+1,s.end)))return null;for(let b=h+1;b<d;b++)for(let v=s.start;v<s.start+Mg;v++)if(!ns(a.char(b,v)))return null;let p="";for(let b=d+1;b<=Math.min(a.bottom,d+JS)&&!Yo.has(a.char(b,s.start-1));b++)p+=`${a.text(b,s.start,s.end)}
|
|
47
|
-
`;if(iC.test(p)||nC.test(p))return null;const y=r===h?m+2:s.start+Mg;return i.col<y||i.col>=s.end?null:{kind:"rule",key:`rule:${rs(s)}:${ay(a,c,s)}`,region:rs(s),layout:`${c}`,row:r,caretCol:i.col,startCol:y,endCol:s.end,empty:d-c===2&&i.col===y&&a.blankOrDim(r,y,s.end),agentLike:!0,vimInsert:Eg.test(p),modal:Eg.test(p)}}function cC(a,i,s){if(i.hidden)return null;const{row:r,col:c}=i;for(let d=c-2;d>=s.start;d--)if(!(!Tg.has(a.char(r,d))||!ns(a.char(r,d+1))))return a.dim(r,d)?null:kg(a,i,s,r,d+2,d===s.start);for(let d=r-1;d>=Math.max(a.top,r-tC);d--){let h=s.end-1;for(;h>=s.start&&ns(a.char(d,h));)h--;if(h>=s.end-1-eC&&Tg.has(a.char(d,h)))return a.dim(d,h)?null:kg(a,i,s,d,s.start,!1);if(h<s.end-1)return null}return null}function kg(a,i,s,r,c,d){const h=i.row===r?c:s.start;return i.col<h||i.col>=s.end?null:{kind:"prompt",key:`prompt:${rs(s)}:${ay(a,r,s)}`,region:rs(s),layout:`${r}`,row:i.row,caretCol:i.col,startCol:h,endCol:s.end,empty:i.row===r&&i.col===h&&a.blankOrDim(i.row,h,s.end),agentLike:d,vimInsert:null,modal:!1}}function uC(a,i){const s=new lC(a);if(i.row<s.top||i.row>s.bottom||i.col<0||i.col>=a.cols)return null;const r=sC(s,i.row,i.col);return r?rC(s,i,r)??oC(s,i,r)??cC(s,i,r):null}class dC{constructor(){Z(this,"insertSeen",new Set)}detect(i,s){const r=uC(i,s);return!r||r.vimInsert===null?r:r.vimInsert?(this.insertSeen.add(r.region),r):this.insertSeen.has(r.region)?null:r}reset(){this.insertSeen.clear()}}class fC{constructor(i){Z(this,"tracker",new dC);Z(this,"cached");Z(this,"lastComplete",null);Z(this,"detect",()=>{var i,s;if((s=(i=this.options).isSynchronizing)!=null&&s.call(i))return this.lastComplete;if(this.cached===void 0){const r=this.options.getScreen(),c=this.options.getCursor();this.cached=r&&c?this.tracker.detect(r,c):null,this.lastComplete=this.cached}return this.cached});this.options=i}invalidate(){this.cached=void 0}reset(){this.tracker.reset(),this.cached=void 0,this.lastComplete=null}}const hC=25,mC=2026,pC=1e3;function gC(a,i=()=>performance.now()){let s=!1,r=null;const c=new Set,d=b=>(c.add(b),{dispose:()=>void c.delete(b)}),h=()=>{s=!1,r=null},m=a.parser;if(!m||typeof m.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:d,reset:h,dispose:()=>{}};const p=b=>v=>{for(const S of v.flat())if(S===hC&&(s=!b),S===mC){const M=!b&&r!==null;if(r=b?i():null,M)for(const N of[...c])N()}return!1},y=[m.registerCsiHandler({prefix:"?",final:"h"},p(!0)),m.registerCsiHandler({prefix:"?",final:"l"},p(!1)),m.registerCsiHandler({intermediates:"!",final:"p"},()=>(h(),!1))];return typeof m.registerEscHandler=="function"&&y.push(m.registerEscHandler({final:"c"},()=>(h(),!1))),{isCursorHidden:()=>s,isSynchronizing:()=>r!==null&&i()-r<pC,onSyncEnd:d,reset:h,dispose:()=>{for(const b of y)b.dispose();c.clear()}}}const bC=40;function yC(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function vC(a){var r;const i=(r=a==null?void 0:a.canvas)==null?void 0:r.stats;if(!i)return`paint: ${(a==null?void 0:a.kind)??"-"} renderer
|
|
48
|
-
`;const s=i.lastInputToPaintMs!==null?`${i.lastInputToPaintMs.toFixed(1)}ms`:"-";return`paint: ${i.lastPaintMs.toFixed(2)}ms cells: ${i.lastCells} frames: ${i.frames} held: ${i.heldFrames} key→paint: ${s}
|
|
49
|
-
`}function xC(a){const i=(a==null?void 0:a.getTrace())??[];return i.length===0?"trace: -":`trace:
|
|
50
|
-
${i.slice(-6).map(s=>` ${s.event}${s.count>1?` ×${s.count}`:""}`).join(`
|
|
51
|
-
`)}`}function Rg(a,i){return a==="off"?!1:a==="always"?!0:i!==null&&i>bC}const wC=250,SC=({onTerminalFocus:a,isActive:i=!0})=>{var Di,Fa,gl,Oi,Ci,z;const s=w.useRef(null),r=w.useRef(null),c=w.useRef(null),d=w.useRef(null),h=w.useRef(1),m=w.useRef({cols:0,rows:0}),p=w.useRef(null),y=w.useRef(null),b=w.useRef(null),v=w.useRef(null),S=w.useRef({width:0,height:0}),M=w.useRef(null),N=Yv(),q=N||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,R=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[D,B]=w.useState({state:"idle",deltaY:0,lines:0,viewportY:null,scrollTop:null,scrollHeight:null,clientHeight:null,moved:!1,focused:!1,bufferType:null,baseY:null,cursorY:null,hasScrollback:null,mouseTracking:!1,scrollMode:"none",scrollCalls:0,lastScrollLines:null,lastInputEvent:"",pointerEvents:0,touchEvents:0}),[G,le]=w.useState({framesPerSec:0,bytesPerSec:0}),[fe,te]=w.useState(null),F=w.useRef(null),I=w.useRef(!1),me=w.useRef(!1),be=w.useRef([]);w.useEffect(()=>{if(!R)return;const C=setInterval(()=>{const ne=performance.now()-1e3,W=be.current;for(;W.length>0&&W[0].time<ne;)W.shift();let pe=0;for(let ee=0;ee<W.length;ee++)pe+=W[ee].bytes;le({framesPerSec:W.length,bytesPerSec:pe})},1e3);return()=>clearInterval(C)},[R]);const{isController:Ne,connectionState:ie,settings:de,hostPalette:ge,terminalFontFamily:we,terminalFontSize:A,hostFont:j,ensureHostGlyphs:J,terminalResetVersion:se,sendResize:V,sendBinary:De,observeKeyInput:Re,consumeModifierLatch:ye,agentStatus:Ae,addToast:Le,warnViewerMode:He,connect:gt,subscribeToOutput:Ve,subscribeToPasteFileReady:Ue,uploadImage:vt,profiles:xt,activeProfileId:Fe,t:Y,rttMs:oe}=rt(),Xe=_i.useMemo(()=>yx(ge),[ge]),Nt=w.useRef(Xe);Nt.current=Xe;const Ut=w.useRef(J);Ut.current=J;const dn=w.useRef(!1);dn.current=j.glyphs.status==="ready";const Gt=w.useRef(Ne);Gt.current=Ne;const ot=w.useRef(De);ot.current=De;const $e=w.useRef(Le);$e.current=Le;const mn=w.useRef(He);mn.current=He;const ct=w.useRef(V);ct.current=V;const ce=w.useRef(vt);ce.current=vt;const Me=w.useRef(i);Me.current=i;const Ie=w.useRef(de);Ie.current=de;const E=w.useRef(Y);E.current=Y;const ue=w.useRef(null),ve=w.useRef(null),Be=w.useRef(null),pn=w.useRef(ye);pn.current=ye;const li=w.useRef(()=>{}),gn=w.useRef(C=>{var O,ne,W,pe;(O=ue.current)==null||O.reset(C),(ne=ue.current)==null||ne.forgetConfidence(),(W=Be.current)==null||W.reset(),(pe=ve.current)==null||pe.clear()}),[Ct,Lt]=w.useState(null),ft=w.useRef(null),[ln,Kt]=w.useState(null),bn=w.useRef(null);bn.current=ln;const[en,tt]=w.useState(null),yn=w.useRef(null);yn.current=en;const[Tn,_t]=w.useState(""),sn=w.useRef("");sn.current=Tn;const[dl,wt]=w.useState(!1),ta=w.useRef(!1);ta.current=dl;const $n=w.useRef(!1),[fl,Ua]=w.useState(0),na=w.useRef(0),jn=w.useRef(null),vn=w.useRef(null),qn=w.useRef(null),Yt=w.useRef(null),[hl,Dn]=w.useState(!1),jt=w.useCallback(C=>{var pe;const O=d.current;if(!O)return null;const ne=((pe=c.current)==null?void 0:pe.querySelector(".xterm-screen"))||c.current,W=fd(C,O,ne,h.current);return W?kS(O,W.col,W.bufferRow):null},[]),Zt=w.useCallback(C=>{var pe;const O=d.current;if(!O)return;const ne=((pe=c.current)==null?void 0:pe.querySelector(".xterm-screen"))||c.current,W=fd(C,O,ne,h.current);if(W){qn.current=W;const ee=md(O,W.col,W.bufferRow);Yt.current=ee;const bt=hS(O,W.col,W.bufferRow);if(bt){const Oe={startCol:bt.startCol,endCol:bt.startCol+bt.length-1,startRow:W.bufferRow,endRow:W.bufferRow},Tt=vg(Oe,ee),nt=pd(O,Tt);tt(Tt),_t(nt),wt(!0)}else tt(null),_t(""),wt(!1),qn.current=null,Yt.current=null}else tt(null),_t(""),wt(!1),qn.current=null,Yt.current=null;jn.current=C,vn.current=null},[]),On=w.useCallback(C=>{var nt;const O=d.current,ne=qn.current;if(!O||!ne)return;vn.current=C;const W=((nt=c.current)==null?void 0:nt.querySelector(".xterm-screen"))||c.current,pe=fd(C,O,W,h.current);if(!pe)return;const ee=Yt.current??md(O,ne.col,ne.bufferRow),bt={startCol:Math.min(ne.col,pe.col),endCol:Math.max(ne.col,pe.col),startRow:Math.min(ne.bufferRow,pe.bufferRow),endRow:Math.max(ne.bufferRow,pe.bufferRow)},Oe=vg(bt,ee),Tt=pd(O,Oe);tt(Oe),_t(Tt),wt(!0)},[]),yi=w.useRef(Zt);yi.current=Zt;const ia=w.useRef(On);ia.current=On;const os=w.useCallback(async()=>{const C=sn.current;if(!C)return;await Ba(C)==="failed"?$e.current("error",E.current("clipboard.copyFailed")):$e.current("success",E.current("clipboard.copied"))},[]),ml=w.useCallback(async()=>{var Oe,Tt,nt,Dt;const C=d.current;if(!C)return;const O=(Oe=C.buffer)==null?void 0:Oe.active;if(!O)return;const ne=((Tt=yn.current)==null?void 0:Tt.startRow)??((nt=qn.current)==null?void 0:nt.bufferRow)??O.viewportY,W=Yt.current??md(C,((Dt=qn.current)==null?void 0:Dt.col)??0,ne),pe={startCol:W.startCol,endCol:W.endCol,startRow:ne,endRow:ne},ee=pd(C,pe);await Ba(ee)==="failed"?$e.current("error",E.current("clipboard.copyFailed")):$e.current("success",E.current("clipboard.copied"))},[]),ji=w.useCallback(async()=>{const C=d.current;if(!C)return;const O=mS(C);await Ba(O)==="failed"?$e.current("error",E.current("clipboard.copyFailed")):$e.current("success",E.current("clipboard.copied"))},[]),Ka=w.useCallback(async()=>{var O,ne;const C=d.current;if(C){if(!Gt.current){mn.current();return}try{const W=await vS();if(W.ok){await ce.current(W.blob);return}}catch{}try{const W=await yS();if(W.ok){(O=ue.current)==null||O.reset("paste"),(ne=ve.current)==null||ne.clear(),C.paste(W.text),$e.current("success",E.current("clipboard.pasted"));return}else if(W.reason==="empty"){$e.current("info",E.current("clipboard.pasteUnavailable"));return}}catch{}Dn(!0)}},[]),vi=w.useCallback(C=>{var ne,W;const O=d.current;if(O){if(!Gt.current){mn.current();return}(ne=ue.current)==null||ne.reset("paste"),(W=ve.current)==null||W.clear(),O.paste(C),$e.current("success",E.current("clipboard.pasted"))}},[]),xi=w.useCallback(C=>{if(d.current){if(!Gt.current){mn.current();return}ce.current(C)}},[]);w.useEffect(()=>Ue(O=>{var W,pe;const ne=d.current;ne&&((W=ue.current)==null||W.reset("paste"),(pe=ve.current)==null||pe.clear(),ne.paste(O),$e.current("success",E.current("clipboard.pasted")))}),[Ue]);const wi=w.useCallback((C,O)=>{!Number.isFinite(C)||!Number.isFinite(O)||C<=0||O<=0||C===m.current.cols&&O===m.current.rows||(p.current={cols:C,rows:O},!y.current&&(y.current=setTimeout(()=>{y.current=null;const ne=p.current;p.current=null,ne&&(ne.cols===m.current.cols&&ne.rows===m.current.rows||(m.current=ne,ct.current(ne.cols,ne.rows),gn.current("resize")))},wC)))},[]),si=w.useCallback((C=!1)=>{var zi;const O=d.current,ne=s.current,W=c.current,pe=r.current;if(!O||!ne||!W||!pe)return;const ee=od(ne,Jl(),Ju());if(ee.width<=0||ee.height<=0)return;pe.style.width="100%",pe.style.height="100%",W.style.width="100%",W.style.height="100%",W.style.transform="none",W.style.transformOrigin="top left",h.current=1;const bt=bg(ee),Oe=uS({lastSnapshot:M.current,currentSnapshot:bt});if(Oe.isVisualZoom&&!C){M.current=bt;try{O.refresh(0,Math.max(0,O.rows-1))}catch{}return}if(Oe.shouldIgnore&&!C)return;M.current=bt;const Tt=rl(O,ss),nt=og({width:ee.width-_1(W),height:ee.height,cellWidth:Tt.cellWidth,cellHeight:Tt.cellHeight}),Dt=Math.abs(ee.width-S.current.width)>1||Math.abs(ee.height-S.current.height)>1;if(O.cols!==nt.cols||O.rows!==nt.rows)try{O.resize(nt.cols,nt.rows)}catch(Ia){console.debug("Error resizing terminal grid:",Ia)}I.current&&!me.current&&(Dt||O.cols!==nt.cols||O.rows!==nt.rows)&&(me.current=!0,(zi=F.current)==null||zi.verify());const fn=nt.cols!==m.current.cols||nt.rows!==m.current.rows;Me.current&&(Dt||C||fn)&&(S.current={width:ee.width,height:ee.height},wi(nt.cols,nt.rows));try{O.refresh(0,Math.max(0,O.rows-1))}catch{}},[wi]),St=w.useRef(si);St.current=si;const Vn=w.useCallback(()=>{if(b.current===null){if(typeof requestAnimationFrame!="function"){St.current();return}b.current=requestAnimationFrame(()=>{b.current=null,St.current()})}},[]),Si=w.useCallback((C=30)=>{v.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(v.current),v.current=null);let O=0;const ne=()=>{v.current=null,O++;const W=O>=C;St.current(!0),!W&&O<2&&typeof requestAnimationFrame=="function"&&(v.current=requestAnimationFrame(ne))};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(ne):ne()},[]);w.useEffect(()=>{var ui,yl,Ga;if(!s.current||!c.current)return;const C=s.current,O=od(C,Jl(),Ju()),ne=rl(null,ss),W=og({width:O.width,height:O.height,cellWidth:ne.cellWidth,cellHeight:ne.cellHeight});ct.current(W.cols,W.rows),S.current={width:O.width,height:O.height},M.current=bg(O);const pe=Lp(A,O.width),ee=new v1.Terminal({fontSize:pe,fontFamily:we,lineHeight:1.15,...Nt.current?{theme:{...Nt.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:W.cols,rows:W.rows,screenReaderMode:!1,linkHandler:{activate:(ae,he)=>{yd(he)}}});try{const ae=new x1.Unicode11Addon;ee.loadAddon(ae),ee.unicode.activeVersion="11"}catch(ae){console.debug("Unicode11 addon unavailable, using default width table:",ae)}try{ee.loadAddon(new S1.WebLinksAddon((ae,he)=>{yd(he)}))}catch(ae){console.debug("WebLinks addon unavailable, URLs stay plain text:",ae)}ee.open(c.current),d.current=ee;const bt=ee.onTitleChange(ae=>{Lt(Ld(ae)||null)}),Oe=gC(ee),Tt=new fC({getScreen:()=>{const ae=d.current;if(!ae)return null;const he=ae.buffer.active;return{cols:ae.cols,rows:ae.rows,baseY:he.baseY,getLine:Ke=>he.getLine(Ke),getNullCell:typeof he.getNullCell=="function"?()=>he.getNullCell():void 0}},getCursor:()=>{var he;const ae=(he=d.current)==null?void 0:he.buffer.active;return ae?{row:ae.baseY+ae.cursorY,col:ae.cursorX,hidden:Oe.isCursorHidden()}:null},isSynchronizing:Oe.isSynchronizing});Be.current=Tt;const nt=(ui=ee._core)==null?void 0:ui.unicodeService,Dt=new IS({getTerminal:()=>d.current,getField:Tt.detect,charWidth:typeof(nt==null?void 0:nt.wcwidth)=="function"?ae=>nt.wcwidth(ae):void 0});ue.current=Dt;const fn=new GS({getTerminal:()=>d.current,isCursorHidden:()=>Oe.isCursorHidden()});ve.current=fn;const zi=()=>{const ae=ue.current,he=ve.current;if(!ae||!he)return;const Ke=Ie.current.predictiveEcho,Ot=ae.getEchoSrttMs();if(!Rg(Ke,Ot)){he.clear();return}he.sync(ae.getOverlayItems())};li.current=zi,N&&ee.textarea&&(ee.textarea.readOnly=!1,ee.textarea.tabIndex=0,ee.textarea.inputMode="text");let Ia=()=>{};if(R&&ee.textarea){const ae=()=>{B(he=>({...he,focused:document.activeElement===ee.textarea}))};ee.textarea.addEventListener("focus",ae),ee.textarea.addEventListener("blur",ae),Ia=()=>{var he,Ke;(he=ee.textarea)==null||he.removeEventListener("focus",ae),(Ke=ee.textarea)==null||Ke.removeEventListener("blur",ae)},ae()}const oi=async ae=>{var Ke,Ot;(Ke=ue.current)==null||Ke.reset("paste"),(Ot=ve.current)==null||Ot.clear();const he=ty(ae);if(he){if(ae.preventDefault(),ae.stopPropagation(),!Gt.current){mn.current();return}await ce.current(he)}};(yl=ee.textarea)==null||yl.addEventListener("paste",oi),C.addEventListener("paste",oi);const aa=cS(ee,{isSynchronizing:Oe.isSynchronizing,onRendererSwapped:ae=>{var he;C&&(C.dataset.renderer=ae),te(ae),(he=ve.current)==null||he.attach(null);try{ee.refresh(0,Math.max(0,ee.rows-1))}catch{}}});fn.attach(aa.canvas);const vr=Oe.onSyncEnd(()=>{var ae,he;return(he=(ae=F.current)==null?void 0:ae.canvas)==null?void 0:he.flushHeld()});F.current=aa,C&&(C.dataset.renderer=aa.kind),te(aa.kind);const xr=E.current("terminal.bannerTitle"),cs=E.current("terminal.bannerSubtitle");if(ee.writeln(" ___ ___ .___ "),ee.writeln(` / | \\ ____ _______| _/______ \x1B[1m${xr}\x1B[0m`),ee.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${cs}\x1B[0m`),ee.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),ee.writeln(" \\___|_ / \\___ >|__| /___/____ >"),ee.writeln(" \\/ \\/ \\/ "),ee.writeln(""),I.current=!0,ee.write("",()=>void aa.verify()),!N)try{ee.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((Ga=document.fonts)==null?void 0:Ga.load)=="function"&&document.fonts.load('13px "Symbols Nerd Font Mono"').then(()=>{if(d.current){try{d.current.refresh(0,Math.max(0,d.current.rows-1))}catch{}Si(5)}}).catch(()=>{});const Po=ee.onData(ae=>{var Ot,lt,kt;let he=ae;if(Gt.current&&Kb(ae)==="keys"&&kv(ae)){const ke=pn.current();ke&&(he=Bo(ae,ke))}const Ke=Dd(he);if(!Gt.current&&!Ho(Ke)){mn.current();return}(Ot=ue.current)==null||Ot.handleUserInput(Ke),zi(),(kt=(lt=F.current)==null?void 0:lt.canvas)==null||kt.markInput(),ot.current(Ke)}),Zo=ee.onBinary(ae=>{const he=new Uint8Array(ae.length);for(let Ke=0;Ke<ae.length;Ke++)he[Ke]=ae.charCodeAt(Ke)&255;!Gt.current&&!Ho(he)||ot.current(he)}),bl=typeof ee.onWriteParsed=="function"?ee.onWriteParsed(()=>{var ae;$n.current=!0,Tt.invalidate(),!Oe.isSynchronizing()&&((ae=ue.current)==null||ae.onServerOutput(),zi())}):{dispose:()=>{}},ci=typeof ee.onRender=="function"?ee.onRender(ae=>{var Ot;const he=ee.buffer.active.viewportY??0;if(dn.current){let lt="";for(let kt=ae.start;kt<=ae.end;kt+=1)lt+=((Ot=ee.buffer.active.getLine(he+kt))==null?void 0:Ot.translateToString(!0))??"";/[^\x00-\x7f]/.test(lt)&&Ut.current(lt)}he!==na.current&&(na.current=he,Ua(he));const Ke=yn.current;if(Ke&&ta.current){const lt=Ke.startRow-he,kt=Ke.endRow-he;$n.current&&ae.start<=kt&&ae.end>=lt&&(wt(!1),$n.current=!1)}else $n.current=!1}):{dispose:()=>{}},us=typeof ee.onScroll=="function"?ee.onScroll(()=>{var he,Ke;const ae=ee.buffer.active.viewportY??0;na.current=ae,Ua(ae),(he=ue.current)==null||he.reset("scroll"),(Ke=ve.current)==null||Ke.clear()}):{dispose:()=>{}},hn=new D1({getTerminal:()=>d.current,getIsController:()=>Gt.current,getScale:()=>h.current,getSurfaceElement:()=>c.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{ee.focus()}catch{}R&&B(ae=>({...ae,focused:document.activeElement===ee.textarea})),a==null||a()},onGestureStateChange:ae=>{R&&B(he=>({...he,state:ae}))},onGestureScroll:({deltaY:ae,lines:he,viewportY:Ke,scrollTop:Ot,scrollHeight:lt,clientHeight:kt,moved:ke,bufferType:Qt,baseY:zt,cursorY:An,hasScrollback:di,mouseTracking:Bn,scrollMode:Pn})=>{R&&B(fs=>({...fs,deltaY:ae,lines:he,viewportY:Ke,scrollTop:Ot,scrollHeight:lt,clientHeight:kt,moved:ke,focused:document.activeElement===ee.textarea,bufferType:Qt,baseY:zt,cursorY:An,hasScrollback:di,mouseTracking:Bn,scrollMode:Pn,scrollCalls:fs.scrollCalls+(he!==0?1:0),lastScrollLines:he}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:N?(ae=>{var he;return(he=yi.current)==null?void 0:he.call(yi,ae)}):void 0,onSelectionExtend:N?(ae=>{var he;return(he=ia.current)==null?void 0:he.call(ia,ae)}):void 0}),la=typeof window<"u"&&"PointerEvent"in window,sa=typeof TouchEvent<"u",ra=[],zn=(ae,he=!1)=>{const Ke=ae.target;return Ke instanceof Node&&C.contains(Ke)||he&&hn.getState()!=="idle"};if(la){const ae={passive:!1,capture:!0},he=ke=>{R&&B(Qt=>({...Qt,pointerEvents:Qt.pointerEvents+1,lastInputEvent:ke}))},Ke=ke=>{if(!zn(ke))return;if(he("pointerdown"),bn.current){Kt(null),bn.current=null,tt(null),yn.current=null,_t(""),sn.current="",wt(!1),jn.current=null,vn.current=null,ke.cancelable&&ke.preventDefault(),ke.stopPropagation();return}hn.handlePointerDown(ke,C)&&ke.stopPropagation()},Ot=ke=>{zn(ke,!0)&&(he("pointermove"),hn.handlePointerMove(ke),ke.pointerType!=="mouse"&&ke.stopPropagation())},lt=ke=>{if(!zn(ke,!0))return;if(he("pointerup"),hn.getState()==="longpress"&&ft.current){const zt=vn.current??jn.current;if(zt){const An=ft.current.getBoundingClientRect(),di=zt.clientX-An.left,Bn=zt.clientY-An.top,Pn=jt(zt);Kt({x:di,y:Bn,link:Pn}),bn.current={x:di,y:Bn,link:Pn}}}hn.handlePointerUp(ke),ke.pointerType!=="mouse"&&ke.stopPropagation()},kt=ke=>{zn(ke,!0)&&(he("pointercancel"),Kt(null),bn.current=null,tt(null),yn.current=null,_t(""),sn.current="",wt(!1),jn.current=null,vn.current=null,hn.handlePointerCancel(ke),ke.pointerType!=="mouse"&&ke.stopPropagation())};if(document.addEventListener("pointerdown",Ke,ae),document.addEventListener("pointermove",Ot,ae),document.addEventListener("pointerup",lt,ae),document.addEventListener("pointercancel",kt,ae),ra.push(()=>{document.removeEventListener("pointerdown",Ke,ae),document.removeEventListener("pointermove",Ot,ae),document.removeEventListener("pointerup",lt,ae),document.removeEventListener("pointercancel",kt,ae)}),sa){const ke=zt=>{zn(zt,!0)&&(R&&B(An=>({...An,touchEvents:An.touchEvents+1})),zt.cancelable&&zt.preventDefault(),zt.stopPropagation())},Qt=["touchstart","touchmove","touchend","touchcancel"];for(const zt of Qt)document.addEventListener(zt,ke,ae);ra.push(()=>{for(const zt of Qt)document.removeEventListener(zt,ke,ae)})}}else{const ae={passive:!1,capture:!0},he=ke=>{R&&B(Qt=>({...Qt,touchEvents:Qt.touchEvents+1,lastInputEvent:ke}))},Ke=ke=>{if(zn(ke)){if(he("touchstart"),bn.current){Kt(null),bn.current=null,tt(null),yn.current=null,_t(""),sn.current="",wt(!1),jn.current=null,vn.current=null,ke.cancelable&&ke.preventDefault(),ke.stopPropagation();return}ke.touches.length===1&&ke.stopPropagation(),hn.handleTouchStart(ke,C)}},Ot=ke=>{zn(ke,!0)&&(he("touchmove"),ke.touches.length===1&&ke.stopPropagation(),hn.handleTouchMove(ke))},lt=ke=>{if(!zn(ke,!0))return;if(he("touchend"),hn.getState()==="longpress"&&ft.current){const zt=vn.current??jn.current;if(zt){const An=ft.current.getBoundingClientRect(),di=zt.clientX-An.left,Bn=zt.clientY-An.top,Pn=jt(zt);Kt({x:di,y:Bn,link:Pn}),bn.current={x:di,y:Bn,link:Pn}}}ke.stopPropagation(),hn.handleTouchEnd(ke)},kt=ke=>{zn(ke,!0)&&(he("touchcancel"),Kt(null),bn.current=null,tt(null),yn.current=null,_t(""),sn.current="",wt(!1),jn.current=null,vn.current=null,ke.stopPropagation(),hn.handleTouchCancel())};document.addEventListener("touchstart",Ke,ae),document.addEventListener("touchmove",Ot,ae),document.addEventListener("touchend",lt,ae),document.addEventListener("touchcancel",kt,ae),ra.push(()=>{document.removeEventListener("touchstart",Ke,ae),document.removeEventListener("touchmove",Ot,ae),document.removeEventListener("touchend",lt,ae),document.removeEventListener("touchcancel",kt,ae)})}const ds=ae=>{ae.preventDefault()};C.addEventListener("contextmenu",ds),ra.push(()=>{C.removeEventListener("contextmenu",ds)});const oa=new ResizeObserver(()=>{Vn()});oa.observe(C);const Mn=()=>{Vn()},ca=()=>{var ae,he;if(document.visibilityState==="visible"){Si(10);try{(he=d.current)==null||he.refresh(0,Math.max(0,(((ae=d.current)==null?void 0:ae.rows)||1)-1))}catch{}}};window.addEventListener("resize",Mn),window.addEventListener("orientationchange",Mn),document.addEventListener("visibilitychange",ca),window.addEventListener("pageshow",ca);const Ti=()=>{Vn()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Ti),window.visualViewport.addEventListener("scroll",Ti)),()=>{var ae,he;Po.dispose(),Zo.dispose(),ci.dispose(),us.dispose(),bl.dispose(),bt.dispose(),vr.dispose(),(ae=ve.current)==null||ae.dispose(),ve.current=null,ue.current=null,Be.current=null,li.current=()=>{},Oe.dispose(),hn.handlePointerCancel();for(const Ke of ra)Ke();oa.disconnect(),window.removeEventListener("resize",Mn),window.removeEventListener("orientationchange",Mn),document.removeEventListener("visibilitychange",ca),window.removeEventListener("pageshow",ca),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Ti),window.visualViewport.removeEventListener("scroll",Ti)),y.current&&(clearTimeout(y.current),y.current=null),b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),Ia(),(he=ee.textarea)==null||he.removeEventListener("paste",oi),C.removeEventListener("paste",oi),aa.dispose(),F.current=null,ee.dispose(),d.current=null}},[]);const Xn=_i.useMemo(()=>{var C;return((C=xt.find(O=>O.id===Fe))==null?void 0:C.displayName)??null},[xt,Fe]);w.useEffect(()=>{ie!=="connected"&&Lt(null)},[ie]),w.useEffect(()=>{const C=i&&ie==="connected",O=de.agentAlertBadge?gr(Ae):null;CS(C?Ct:null,Xn,O)},[i,ie,Ct,Xn,Ae,de.agentAlertBadge]),w.useEffect(()=>{const C=d.current;if(!C)return;const O=od(s.current,Jl(),Ju());C.options.fontSize=Lp(A,O.width),C.options.fontFamily=we;try{C.refresh(0,Math.max(0,C.rows-1))}catch{}Si(10)},[A,we]),w.useEffect(()=>{var O,ne;const C=d.current;if(!(!C||!j.glyphRevision)){(ne=(O=F.current)==null?void 0:O.canvas)==null||ne.clearTextureAtlas();try{C.refresh(0,Math.max(0,C.rows-1))}catch{}}},[j.glyphRevision]),w.useEffect(()=>Re(C=>{var O,ne,W;(O=ue.current)==null||O.handleUserInput(C),li.current(),(W=(ne=F.current)==null?void 0:ne.canvas)==null||W.markInput()}),[Re]),w.useEffect(()=>{const C=ue.current,O=ve.current;if(!C||!O)return;const ne=C.getEchoSrttMs();Rg(de.predictiveEcho,ne)?O.sync(C.getOverlayItems()):O.clear()},[de.predictiveEcho]);const ri=w.useRef(se);w.useEffect(()=>{var O;if(ri.current===se)return;ri.current=se,gn.current("resetVersion");const C=d.current;if(C)try{(O=C.reset)==null||O.call(C),C.clear(),C.refresh(0,Math.max(0,C.rows-1))}catch{}},[se]),w.useEffect(()=>{gn.current("connectionState")},[ie]),w.useEffect(()=>{const C=d.current;if(!(!C||!Xe)){C.options.theme={...Xe};try{C.refresh(0,Math.max(0,C.rows-1))}catch{}}},[Xe]),w.useEffect(()=>Ve(O=>{const ne=d.current;if(!ne)throw new Error("terminal not ready");if(ne.write(O),R){const W=performance.now(),pe=be.current;pe.push({time:W,bytes:O.byteLength});const ee=W-1e3;for(;pe.length>0&&pe[0].time<ee;)pe.shift()}}),[Ve,R]),w.useEffect(()=>{if(!i)return;Si(10);const C=d.current;if(C){try{C.refresh(0,Math.max(0,C.rows-1))}catch{}if(!N)try{C.focus()}catch{}}},[i,N,Si]),w.useEffect(()=>{ie==="disconnected"&>()},[]);const pl=C=>{C.preventDefault()};return f.jsxs("main",{ref:ft,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:pl,"aria-label":Y("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:s,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:q?"none":"auto"},tabIndex:0,onContextMenu:pl,"aria-label":Y("terminal.bufferAriaLabel"),role:"region",children:f.jsx("div",{id:"terminal-frame",ref:r,className:"relative overflow-hidden",style:{width:"100%",height:"100%"},children:f.jsx("div",{id:"terminal-surface",ref:c,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),R&&f.jsxs("pre",{"data-testid":"terminal-touch-debug",className:"pointer-events-none absolute left-1 top-1 z-50 border border-tui-border bg-tui-crust/90 px-2 py-1 font-mono text-tui-sm leading-relaxed text-tui-muted","aria-hidden":"true",children:[`gesture: ${D.state}
|
|
52
|
-
`,`deltaY: ${D.deltaY} lines: ${D.lines}
|
|
53
|
-
`,`viewportY: ${D.viewportY??"-"} focus: ${D.focused}
|
|
54
|
-
`,`buffer: ${D.bufferType??"-"} base: ${D.baseY??"-"} cursor: ${D.cursorY??"-"} scrollback: ${D.hasScrollback??"-"}
|
|
55
|
-
`,`scroll: ${D.scrollTop??"-"} / ${D.scrollHeight??"-"} (h ${D.clientHeight??"-"}) moved: ${D.moved}
|
|
56
|
-
`,`mode: ${D.scrollMode} calls: ${D.scrollCalls} lines: ${D.lastScrollLines??"-"} mouse: ${D.mouseTracking}
|
|
57
|
-
`,`event: ${D.lastInputEvent||"-"} pointer: ${D.pointerEvents} touch: ${D.touchEvents}
|
|
58
|
-
`,`rtt: ${oe!==null?`${oe}ms`:"-"} frames/s: ${G.framesPerSec} bytes/s: ${G.bytesPerSec} renderer: ${fe??"-"}
|
|
59
|
-
`,`prediction: ${((Di=ue.current)==null?void 0:Di.getState())??"-"} mode: ${de.predictiveEcho} pending: ${((Fa=ue.current)==null?void 0:Fa.getVisiblePredictions().length)??0} srtt: ${((gl=ue.current)==null?void 0:gl.getEchoSrttMs())!==null&&((Oi=ue.current)==null?void 0:Oi.getEchoSrttMs())!==void 0?`${Math.round(ue.current.getEchoSrttMs())}ms`:"-"}
|
|
60
|
-
`,`field: ${yC(((Ci=Be.current)==null?void 0:Ci.detect())??null)} mismatches: ${((z=ue.current)==null?void 0:z.getMismatchCount())??0}
|
|
61
|
-
`,vC(F.current),xC(ue.current)]}),N&&en&&dl&&(()=>{var fn;const C=d.current;if(!C||!ft.current)return null;const O=rl(C);if(O.cellWidth<=0||O.cellHeight<=0)return null;const ne=((fn=c.current)==null?void 0:fn.querySelector(".xterm-screen"))||c.current;if(!ne)return null;const W=ne.getBoundingClientRect(),pe=ft.current.getBoundingClientRect(),ee=en.startRow-fl;if(en.endRow-fl<0||ee>=C.rows)return null;const Oe=W.top-pe.top+ee*O.cellHeight,Tt=W.left-pe.left+en.startCol*O.cellWidth,nt=(en.endCol-en.startCol+1)*O.cellWidth,Dt=(en.endRow-en.startRow+1)*O.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Oe}px`,left:`${Tt}px`,width:`${nt}px`,height:`${Dt}px`}})})(),N&&ln&&f.jsx(LS,{anchorPoint:ln,hasSelection:!!Tn,isController:Ne,vibrateOnKeyPress:de.vibrateOnKeyPress,linkUrl:ln.link??null,onOpenLink:C=>{yd(C)||Le("warning",Y("clipboard.openLinkFailed"))},onCopySelection:os,onCopyLine:ml,onCopyScreen:ji,onPaste:Ka,onClose:()=>{Kt(null),bn.current=null,tt(null),yn.current=null,_t(""),sn.current="",wt(!1)}}),N&&f.jsx(_S,{isOpen:hl,onClose:()=>Dn(!1),onSend:vi,onSendImage:xi})]})},CC=({onPairedSuccess:a})=>{const{settings:i,updateSettings:s,connect:r,connectionState:c,stateDetail:d,addToast:h,t:m}=rt(),[p,y]=w.useState(""),[b,v]=w.useState(null),[S,M]=w.useState(!1),[N,q]=w.useState(i.wsUrl||"/ws/client"),[R,D]=w.useState(i.token||""),[B,G]=w.useState(i.clientId||""),le="node bin/service.js pair",fe="node bin/config-tui.js",te=be=>{Ba(be).then(Ne=>{if(Ne==="failed"){h("error",m("clipboard.copyFailed"));return}v(be),h("success",m("toasts.commandCopied")),setTimeout(()=>v(null),2e3)})},F=be=>{be.preventDefault();const Ne=p.trim().toUpperCase();if(!Ne&&!R.trim()){h("warning",m("toasts.connectionError"));return}const ie={pairCode:Ne,wsUrl:N.trim()||"/ws/client",clientId:B.trim()||i.clientId};R.trim()&&(ie.token=R.trim()),s(ie),r({pairCode:Ne||void 0,token:R.trim()||void 0,wsUrl:N.trim()||"/ws/client",clientId:B.trim()||i.clientId}),a&&a()},I=c==="connecting"||c==="reconnecting",me=({n:be})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",be,"]"]});return f.jsx("div",{className:"flex h-full w-full flex-1 justify-center overflow-y-auto bg-tui-crust p-2 sm:p-4",children:f.jsxs("div",{className:"my-auto w-full max-w-3xl space-y-3",children:[f.jsxs("div",{className:"border border-tui-border bg-tui-base px-3 py-2",children:[f.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold text-tui-accent",children:"herdr-remote"}),f.jsx("h1",{className:"text-tui font-bold text-tui-text",children:m("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:m("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:m("onboarding.description")})]}),c==="error"&&f.jsxs(ts,{tone:"warn",action:f.jsx(je,{variant:"warn",onClick:()=>r(),children:m("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:m("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:d||m("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:F,className:"grid gap-3",children:[f.jsx(an,{title:m("onboarding.step1Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("p",{className:"flex items-start gap-2 text-tui text-tui-muted",children:[f.jsx(me,{n:1}),f.jsx("span",{className:"leading-snug",children:m("onboarding.step1Desc")})]}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui text-tui-text",children:le}),f.jsx(je,{onClick:()=>te(le),glyph:b===le?Ye.check:"⧉",className:re("shrink-0",b===le&&"border-tui-ok text-tui-ok"),children:m(b===le?"common.copied":"common.copy")})]}),f.jsx("div",{className:"space-y-0.5 text-tui-sm",children:f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:m("onboarding.step1TuiNote")}),f.jsx("code",{onClick:()=>te(fe),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:m("common.clickToCopy"),children:fe})]})})]})}),f.jsx(an,{title:m("onboarding.step2Title"),className:"min-w-0",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(me,{n:2}),f.jsx(Cn,{type:"text",value:p,onChange:be=>y(be.target.value.toUpperCase()),placeholder:m("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":m("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:m("onboarding.step2Note")})]})}),f.jsx(je,{variant:"primary",type:"submit",block:!0,disabled:I,className:"py-1.5",children:I?f.jsx(cl,{label:m("onboarding.connectingAndPairing")}):m("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>M(!S),"aria-expanded":S,className:"tui-focusable flex w-full items-center gap-2 px-2 py-1 text-left text-tui text-tui-muted transition-colors hover:text-tui-accent",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:S?Ye.chevronDown:Ye.chevronRight}),f.jsx("span",{className:"uppercase",children:m("onboarding.advancedTitle")})]}),S&&f.jsxs("div",{className:"space-y-2.5 border-t border-tui-border-dim px-2 py-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"onboarding-token",children:m("onboarding.manualTokenLabel")}),f.jsx(Cn,{id:"onboarding-token",type:"password",value:R,onChange:be=>D(be.target.value),placeholder:m("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"onboarding-ws",children:m("onboarding.wsEndpointLabel")}),f.jsx(Cn,{id:"onboarding-ws",type:"text",value:N,onChange:be=>q(be.target.value),placeholder:m("onboarding.wsEndpointPlaceholder")})]}),f.jsx(gi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"onboarding-client-id",children:m("onboarding.clientIdLabel")}),f.jsx(Cn,{id:"onboarding-client-id",type:"text",value:B,onChange:be=>G(be.target.value)})]})]})]})]})]})})},Da="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",or="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",TC="border-tui-accent bg-tui-accent text-tui-crust font-bold",MC="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",Lg={default:or,bad:"border-tui-bad text-tui-bad hover:bg-tui-bad hover:text-tui-crust",warn:"border-tui-warn text-tui-warn hover:bg-tui-warn hover:text-tui-crust"},AC=({compact:a=!1,onCustomize:i})=>{const{sendKey:s,settings:r,updateSettings:c,isController:d,warnViewerMode:h,t:m,uploadProgress:p,uploadImage:y,modifierLatch:b,toggleModifierLatch:v,consumeModifierLatch:S,agentProfile:M}=rt(),N=a?"h-8":"h-7",q=a?"h-8 min-w-[2rem] px-1.5":"h-7 min-w-[1.75rem] px-1.5",R=a?"h-8 w-8":"h-7 w-7",D=a?"h-8 px-1.5":"h-7 px-1.5",B=w.useRef(null),G=w.useRef(null),le=w.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),fe=w.useCallback(()=>{var Y;if(le(),!d){h();return}p.active||(Y=B.current)==null||Y.click()},[le,d,h,p.active]),te=w.useCallback(Y=>{const oe=Y.target.files,Xe=oe&&oe[0];Y.target.value="",Xe&&y(Xe)},[y]),F=()=>f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:B,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:te}),f.jsx("input",{ref:G,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:te})]}),I=(Y=!1)=>p.active?f.jsx("div",{"data-testid":Y?"key-toolbar-progress-collapsed":"key-toolbar-progress",className:"w-full border-b border-tui-border-dim bg-tui-crust px-2 py-1",children:f.jsx(m1,{ratio:p.ratio,label:p.statusText,tone:p.phase==="completed"?"ok":p.phase==="error"?"bad":"accent","aria-label":p.statusText})}):null,me=()=>{const Y=p.active;return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:fe,disabled:Y,className:re(Da,q,Y?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":or),title:Y?p.statusText:m("virtualKeyboard.uploadImageTitle"),"aria-label":m("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:Y?`${p.percent}%`:m("virtualKeyboard.image")})})},[be,Ne]=w.useState(!1),[ie,de]=w.useState(!1),[ge,we]=w.useState(!1),A=w.useRef([]);w.useEffect(()=>()=>{A.current.forEach(Y=>clearTimeout(Y)),A.current=[]},[]);const j=w.useRef(null),[J,se]=w.useState(!1),V=w.useCallback(()=>{const Y=j.current;se(!!Y&&Y.scrollLeft+Y.clientWidth<Y.scrollWidth-1)},[]);w.useEffect(V),w.useEffect(()=>{const Y=j.current;if(!Y||typeof ResizeObserver!="function")return;const oe=new ResizeObserver(V);return oe.observe(Y),()=>oe.disconnect()},[V,r.toolbarVisible]);const De=w.useCallback(Y=>{if(le(),!d){h();return}let oe;try{oe=Li(Y)}catch{return}if(S(),oe.length===1){s(oe[0]);return}oe.forEach((Xe,Nt)=>{const Ut=setTimeout(()=>{A.current=A.current.filter(dn=>dn!==Ut),s(Xe)},Nt*120);A.current.push(Ut)})},[S,d,s,le,h]),Re=Vx(M,r.agentKeymaps[M]),ye=Y=>{let oe="";try{oe=rr(Y.combo)}catch{}const Xe=Y.custom?Y.customLabel||"":m(`agentActions.${Y.labelKey}`),Nt=Y.labelKey==="interrupt"&&Y.combo.trim().toLowerCase()==="ctrl+c"?"bad":Y.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${Y.id}`,onClick:()=>De(Y.combo),className:re(Da,N,"max-w-[10rem] gap-1 px-1.5",Lg[Nt]),title:`${oe} ${Xe}`.trim(),"aria-label":`${oe} ${Xe}`.trim(),children:[f.jsx("span",{className:"font-bold",children:oe}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:Xe})]},Y.id)},Ae=()=>{const Y=[...Re.agentActions,...Re.genericActions];return Y.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${Wl[M].name} ${m("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-tui-border-dim"}),Y.map(ye),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:re(Da,N,"px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:m("agentKeymaps.customizeBar"),"aria-label":m("agentKeymaps.customizeBar"),children:m("agentKeymaps.customizeBarShort")})]})},Le=w.useCallback((Y,oe=!0)=>{if(le(),!d){h();return}const Xe=S();s(oe&&Xe?Bo(Y,Xe):Y)},[d,s,h,le,S]);if(!r.toolbarVisible)return f.jsxs("div",{"data-testid":"key-toolbar-collapsed",className:"z-20 flex shrink-0 flex-col border-t border-tui-border bg-tui-mantle pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]",children:[F(),I(!0),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>c({toolbarVisible:!0}),className:"tui-focusable flex h-6 w-28 items-center justify-center gap-1 text-tui uppercase text-tui-faint transition-colors hover:text-tui-accent",title:m("virtualKeyboard.expandToolbar"),"aria-label":m("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:m("common.keyBar")})]})})]});const He=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(Y=>Y.enabled):Pg,gt=Y=>Y.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):Y.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):Y.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):Y.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):Y.id==="enter"?f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",children:"⏎"}),f.jsx("span",{className:"hidden sm:inline",children:m("virtualKeyboard.keyEnter")})]}):Y.id==="drawer_chords"?f.jsx("span",{children:"^C"}):Y.id==="drawer_fn"?f.jsxs("span",{className:"flex items-center gap-0.5",children:[f.jsx("span",{children:"Fn"}),f.jsx("span",{"aria-hidden":"true",children:be?"▾":"▴"})]}):f.jsx("span",{children:Y.label}),Ve=Y=>{if(le(),Y.type==="modifier"){Y.modifierType==="ctrl"||Y.modifierType==="alt"||Y.modifierType==="shift"?v(Y.modifierType):Y.modifierType==="meta"&&Le(xe.ESC);return}if(Y.type==="drawer"){Y.drawerType==="fn"?(Ne(!be),de(!1),we(!1)):Y.drawerType==="chords"?(we(!ge),Ne(!1),de(!1)):Y.drawerType==="symbols"&&(de(!ie),Ne(!1),we(!1));return}Le(Y.code,Y.type!=="chord")},Ue=Y=>{if(Y.type==="modifier"){if(Y.modifierType==="ctrl")return b.ctrl;if(Y.modifierType==="alt")return b.alt;if(Y.modifierType==="shift")return b.shift}if(Y.type==="drawer"){if(Y.drawerType==="fn")return be;if(Y.drawerType==="chords")return ge;if(Y.drawerType==="symbols")return ie}return!1},vt=Y=>{const oe=Ue(Y),Xe=["left","up","down","right"].includes(Y.id),Nt=Y.type==="drawer",Ut=wd(Y,m);return f.jsx("button",{type:"button",onClick:()=>Ve(Y),className:re(Da,Xe?R:Nt?D:q,Y.id==="enter"?MC:oe?TC:or),title:Ut,"aria-label":Ut,"aria-pressed":oe,children:gt(Y)},Y.id)},xt=He.find(Y=>Y.id==="enter"),Fe=(Y,oe,Xe,Nt,Ut="default")=>f.jsxs("button",{type:"button",onClick:()=>Le(Y,!1),className:re(Da,N,"gap-1.5 px-2",Lg[Ut]),title:Xe,children:[f.jsx("span",{className:"font-bold",children:oe}),f.jsx("span",{className:"text-tui-sm opacity-70",children:Nt})]});return f.jsxs("div",{"data-testid":"key-toolbar",className:re("z-20 flex shrink-0 select-none flex-col border-t border-tui-border bg-tui-mantle",a?"pb-[max(env(safe-area-inset-bottom,0px),0.125rem)]":"pb-[max(env(safe-area-inset-bottom,0px),0.25rem)]"),role:"toolbar","aria-label":m("virtualKeyboard.touchKeyboardShortcuts"),children:[F(),I(!1),be&&f.jsx("div",{className:"grid grid-cols-6 gap-1 border-b border-tui-border-dim bg-tui-crust p-1.5 sm:grid-cols-12",children:[1,2,3,4,5,6,7,8,9,10,11,12].map(Y=>{const oe=`F${Y}`;return f.jsxs("button",{type:"button",onClick:()=>Le(xe[oe]),className:re(Da,or,N),children:["F",Y]},oe)})}),ge&&f.jsxs("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:[Fe(xe.CTRL_C,"^C",m("virtualKeyboard.ctrlCTitle"),m("virtualKeyboard.badgeSigint"),"bad"),Fe(xe.CTRL_D,"^D",m("virtualKeyboard.ctrlDTitle"),m("virtualKeyboard.badgeEof")),Fe(xe.CTRL_Z,"^Z",m("virtualKeyboard.ctrlZTitle"),m("virtualKeyboard.badgeTstp"),"warn"),Fe(xe.CTRL_L,"^L",m("virtualKeyboard.ctrlLTitle"),m("virtualKeyboard.badgeClear")),Fe(xe.CTRL_R,"^R",m("virtualKeyboard.ctrlRTitle"),m("virtualKeyboard.badgeSearch")),Fe(xe.CTRL_A,"^A",m("virtualKeyboard.ctrlATitle"),m("virtualKeyboard.badgeStart")),Fe(xe.CTRL_E,"^E",m("virtualKeyboard.ctrlETitle"),m("virtualKeyboard.badgeEnd")),Fe(xe.CTRL_K,"^K",m("virtualKeyboard.ctrlKTitle"),m("virtualKeyboard.badgeKill"))]}),ie&&f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto border-b border-tui-border-dim bg-tui-crust p-1.5",children:["|","~","/","\\","-","_","$","&",";",":","`",'"',"'",">","<","=","#","@","{","}","[","]"].map(Y=>f.jsx("button",{type:"button",onClick:()=>Le(Y,!0),className:re(Da,or,R,"font-bold"),children:Y},Y))}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:re("flex flex-nowrap items-center justify-start gap-1",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsxs("div",{className:"relative min-w-0",children:[f.jsxs("div",{ref:j,"data-testid":"key-toolbar-scroll",onScroll:V,className:"scrollbar-none flex flex-nowrap touch-pan-x items-center gap-1 overflow-x-auto overscroll-x-contain",children:[f.jsx("button",{type:"button",onClick:()=>c({toolbarVisible:!1}),className:re(Da,R,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:m("virtualKeyboard.collapseToolbar"),"aria-label":m("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),He.filter(Y=>Y.id!=="enter").map(vt),Ae(),me()]}),J&&f.jsx("span",{"aria-hidden":"true","data-testid":"key-toolbar-more",className:"pointer-events-none absolute inset-y-0 right-0 w-4 bg-gradient-to-l from-tui-mantle"})]}),xt&&vt(xt)]})]})},EC=["ls -la","clear","git status","pwd","top","exit","cat"],NC=({isOpen:a,onClose:i})=>{const{sendKey:s,isController:r,warnViewerMode:c,t:d}=rt(),[h,m]=w.useState("");if(!a)return null;const p=b=>{if(b&&b.preventDefault(),!r){c();return}h.length>0?(s(h+"\r"),m("")):s("\r")},y=b=>{if(!r){c();return}s(b+"\r")};return f.jsxs("div",{className:"z-20 flex flex-col gap-1.5 border-t border-tui-border bg-tui-mantle p-2",role:"region","aria-label":d("virtualKeyboard.helperTitle"),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-tui font-bold uppercase text-tui-accent",children:d("virtualKeyboard.helperTitle")}),f.jsx(je,{variant:"ghost",onClick:i,"aria-label":d("virtualKeyboard.closeHelper"),children:"esc"})]}),f.jsx("div",{className:"scrollbar-none flex items-center gap-1 overflow-x-auto py-0.5",children:EC.map(b=>f.jsx("button",{type:"button",onClick:()=>y(b),className:"tui-focusable shrink-0 select-none border border-tui-border bg-tui-surface px-2 py-0.5 text-tui-sm text-tui-muted transition-colors hover:border-tui-accent hover:text-tui-accent",children:b},b))}),f.jsxs("form",{onSubmit:p,className:"flex items-center gap-1.5",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none font-bold text-tui-ok",children:"$"}),f.jsxs("div",{className:"relative flex-1",children:[f.jsx("label",{htmlFor:"virtual-keyboard-input",className:"sr-only",children:d("virtualKeyboard.placeholder")}),f.jsx(Cn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:h,onChange:b=>m(b.target.value),placeholder:d("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),h.length>0&&f.jsx("button",{type:"button",onClick:()=>m(""),className:"tui-focusable absolute right-1 top-1/2 -translate-y-1/2 px-1 text-tui-faint hover:text-tui-bad","aria-label":d("virtualKeyboard.clearInput"),children:f.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]}),f.jsx(je,{variant:"primary",type:"submit",title:d("virtualKeyboard.sendButton"),glyph:"⏎",className:"h-9 shrink-0",children:f.jsx("span",{className:"hidden sm:inline",children:d("virtualKeyboard.sendButton")})})]})]})};function Xo(a,i){const s=(r,c)=>i?i(r):c;switch(a){case"connected":return{label:s("connection.live","Live"),level:"ok",needsAttention:!1};case"connecting":return{label:s("connection.connecting","Connecting"),level:"warn",needsAttention:!0};case"reconnecting":return{label:s("connection.reconnecting","Reconnecting"),level:"warn",needsAttention:!0,actionLabel:s("connection.reconnectNow","Reconnect now")};case"error":return{label:s("connection.error","Error"),level:"bad",needsAttention:!0,actionLabel:s("connection.retry","Retry")};default:return{label:s("connection.offline","Offline"),level:"idle",needsAttention:!0,actionLabel:s("connection.connect","Connect")}}}const kC={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},RC=({isOpen:a,onClose:i,isAddMode:s=!1})=>{const{settings:r,updateSettings:c,connect:d,disconnect:h,connectionState:m,hostId:p,addToast:y,t:b,activeProfile:v,activeProfileId:S,addProfileAndConnect:M,renameProfile:N}=rt(),[q,R]=w.useState(r.wsUrl),[D,B]=w.useState(r.token),[G,le]=w.useState(r.pairCode),[fe,te]=w.useState(r.clientId),[F,I]=w.useState((v==null?void 0:v.displayName)||""),[me,be]=w.useState(r.autoReconnect),[Ne,ie]=w.useState(!1);if(w.useEffect(()=>{a&&(R(r.wsUrl),B(s?"":r.token),le(s?"":r.pairCode),te(r.clientId),I(s?"":(v==null?void 0:v.displayName)||""),be(r.autoReconnect))},[a,s,r,v]),!a)return null;const de=j=>{j.preventDefault();const J={wsUrl:q.trim()||"/ws/client",token:D.trim(),pairCode:G.trim().toUpperCase(),clientId:fe.trim()||r.clientId,autoReconnect:me};if(!J.token&&!J.pairCode){y("warning",b("pairing.credentialsRequired"));return}s?M({...J,displayName:F.trim()||void 0}):(c(J),S&&F.trim()&&N(S,F),h(),d({wsUrl:J.wsUrl,token:J.token||void 0,pairCode:J.pairCode||void 0,clientId:J.clientId,autoReconnect:me})),i()},ge=()=>{const j=`client-${Math.random().toString(36).substring(2,8)}`;te(j)},we=()=>{const j=new URL(window.location.href);j.search="",G.trim()&&j.searchParams.set("pairCode",G.trim().toUpperCase()),Ba(j.toString()).then(J=>{if(J==="failed"){y("error",b("clipboard.copyFailed"));return}ie(!0),y("success",b("toasts.pairingLinkCopied")),setTimeout(()=>ie(!1),2e3)})},A=kC[m]??"idle";return f.jsxs(Vo,{isOpen:a,onClose:i,title:b(s?"pairing.addTitle":"pairing.title"),subtitle:b("pairing.subtitle"),closeLabel:b("common.closeDialog"),hints:[{keys:"esc",action:b("common.close")},{keys:"⏎",action:b("pairing.saveAndConnect")}],footer:f.jsxs(f.Fragment,{children:[m==="connected"&&f.jsx(je,{variant:"danger",onClick:()=>{h(),i()},children:b("common.disconnect")}),f.jsx(je,{variant:"primary",type:"submit",form:"pairing-form",children:b("pairing.saveAndConnect")})]}),children:[f.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2 border-b border-tui-border-dim pb-2 text-tui",children:[f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:A}),f.jsx("span",{className:"text-tui-muted",children:b("common.status")}),f.jsx("span",{className:re(A==="ok"?"text-tui-ok":A==="bad"?"text-tui-bad":A==="warn"?"text-tui-warn":"text-tui-faint"),children:Xo(m,b).label})]}),p&&f.jsxs("span",{className:"flex items-center gap-1.5 text-tui-muted",children:[b("common.host")," ",f.jsx("span",{className:"text-tui-text",children:p})]})]}),f.jsxs("form",{id:"pairing-form",onSubmit:de,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"pairing-name",children:b("pairing.displayNameLabel")}),f.jsx(Cn,{id:"pairing-name",type:"text",value:F,onChange:j=>I(j.target.value),placeholder:b("pairing.displayNamePlaceholder"),maxLength:64,autoComplete:"off"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.displayNameHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"pairing-code",hint:b("pairing.pairCodeNote"),children:b("pairing.pairCodeLabel")}),f.jsx(Cn,{id:"pairing-code",type:"text",value:G,onChange:j=>le(j.target.value.toUpperCase()),placeholder:b("pairing.pairCodePlaceholder"),maxLength:12,className:"uppercase"}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.pairCodeHelp")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"pairing-token",hint:b("pairing.tokenNote"),children:b("pairing.tokenLabel")}),f.jsx(Cn,{id:"pairing-token",type:"password",value:D,onChange:j=>B(j.target.value),placeholder:b("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"pairing-ws",children:b("pairing.wsUrlLabel")}),f.jsx(Cn,{id:"pairing-ws",type:"text",value:q,onChange:j=>R(j.target.value),placeholder:b("pairing.wsUrlPlaceholder")}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:b("pairing.wsUrlDefaultNote")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"pairing-client-id",children:b("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Cn,{id:"pairing-client-id",type:"text",value:fe,onChange:j=>te(j.target.value),className:"flex-1"}),f.jsx(je,{onClick:ge,title:b("pairing.regenerateClientIdTitle"),className:"shrink-0",children:b("pairing.newIdButton")})]})]}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(Oa,{checked:me,onChange:be,label:b("pairing.autoReconnectLabel"),description:b("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(je,{onClick:we,block:!0,glyph:Ne?Ye.check:"⧉",className:re(Ne&&"border-tui-ok text-tui-ok"),children:b("pairing.copyDirectLink")})})]})]})},ly={"gnome-terminal":"GNOME Terminal",ptyxis:"Ptyxis",tilix:"Tilix",konsole:"Konsole","xfce4-terminal":"Xfce Terminal",kitty:"kitty",alacritty:"Alacritty",ghostty:"Ghostty",wezterm:"WezTerm",foot:"foot",vscode:"VS Code",iterm2:"iTerm2","apple-terminal":"Terminal",xterm:"xterm",urxvt:"urxvt"},LC=["host_font_unavailable","host_font_timeout","disconnected","font_api_unavailable"],_C=()=>{const{hostFont:a,loadHostFont:i,declineHostFont:s,settings:r,herdrLaunch:c,hostname:d,activeProfile:h,addToast:m,t:p}=rt(),{font:y,status:b,glyphs:v}=a,S=b==="loading"||v.status==="loading",M=b==="failed"||v.status==="failed",N=w.useRef(!1);w.useEffect(()=>{N.current&&!S&&!M&&a.interactive&&m("success",p("hostFont.loaded")),N.current=S&&a.interactive},[S,M,a.interactive,m,p]);const q=b==="available"||v.status==="available",R=a.interactive&&(S||M);if(!(y&&r.fontFamily==="host"&&!c&&(q||R)))return null;const B=b==="available"||a.interactive&&(b==="loading"||b==="failed"),G=v.source&&(v.status==="available"||a.interactive&&(v.status==="loading"||v.status==="failed")),le=d||(h==null?void 0:h.displayName)||p("herdrLaunch.thisHost"),fe=[y.sizePx?`${Math.round(y.sizePx)}px`:null,y.source?ly[y.source]||y.source:null].filter(Boolean).join(p("hostFont.detailSeparator")),te=a.error&&LC.includes(a.error)?a.error:"other",F=a.totalBytes?a.receivedBytes/a.totalBytes:0;return f.jsx("div",{"data-testid":"host-font-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsxs(an,{title:p("hostFont.title"),tone:b==="failed"?"bad":"accent",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":p("hostFont.title"),children:[f.jsx("p",{className:"leading-snug text-tui-text",children:B||!v.source?p("hostFont.body",{host:le,family:y.family,detail:fe?p("hostFont.detail",{detail:fe}):""}):p("hostFont.bodyGlyphsOnly",{host:le,family:v.source.family})}),S?f.jsxs("div",{className:"space-y-1",role:"status",children:[f.jsx(zb,{value:F,width:32,className:"max-w-full overflow-hidden"}),f.jsx("p",{className:"text-tui-sm text-tui-muted",children:p("hostFont.loading",{received:id(a.receivedBytes),total:id(a.totalBytes)})})]}):f.jsxs(f.Fragment,{children:[M?f.jsx(ts,{tone:"bad",children:p("hostFont.failed",{reason:p(`hostFont.reasons.${te}`)})}):f.jsxs("div",{className:"space-y-1 text-tui-sm leading-snug text-tui-faint",children:[B&&y.faces.length?f.jsx("p",{children:p("hostFont.download",{count:y.faces.length,size:id(a.totalBytes)})}):null,G&&v.source?f.jsx("p",{children:p(v.source.scope==="all"?"hostFont.glyphsAll":"hostFont.glyphs",{family:v.source.family})}):null]}),f.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[f.jsx(je,{onClick:s,children:p("hostFont.decline")}),f.jsx(je,{variant:"primary",onClick:i,autoFocus:!0,children:p(M?"common.retry":"hostFont.load")})]})]})]})})},jC=["grid items-center gap-x-2 gap-y-1 border-b border-tui-border-dim px-2 py-1.5 last:border-b-0","grid-cols-[5rem_minmax(0,1fr)_6.5rem] [grid-template-areas:'cap_label_actions'_'combo_combo_default']","sm:grid-cols-[5rem_minmax(0,1fr)_9rem_7rem_6.5rem] sm:[grid-template-areas:'cap_label_combo_default_actions']"].join(" "),DC=({isOpen:a,onClose:i,initialTab:s})=>{var Ie;const{settings:r,updateSettings:c,addToast:d,language:h,setLanguage:m,t:p,agentProfile:y,connectionState:b,hostFont:v,syncHostFont:S,terminalFontFamily:M,terminalFontSize:N}=rt(),[q,R]=w.useState("appearance"),[D,B]=w.useState(null),[G,le]=w.useState({}),fe=w.useRef({}),[te,F]=w.useState(""),[I,me]=w.useState(""),[be,Ne]=w.useState(!1);if(w.useEffect(()=>{!a||!s||(R(s),B(null))},[a,s]),!a)return null;const ie=Td.find(E=>E.id===r.fontFamily),de=(E,ue)=>E==="host"||E==="system"?p(`fontPresets.${E}`):ue,ge=(()=>{const{font:E,status:ue}=v,ve=v.totalBytes?Math.round(v.receivedBytes/v.totalBytes*100):0,Be=p(`settings.hostFontStatus.${ue}`,{percent:ve});return E?[E.family,E.sizePx?`${Math.round(E.sizePx)}px`:null,E.source?ly[E.source]||E.source:null,Be].filter(Boolean).join(" · "):Be})(),we=(Ie=v.font)!=null&&Ie.sizePx?is(v.font.sizePx):null,A=v.glyphs.source&&v.glyphs.status!=="none"?p("settings.hostGlyphLine",{family:v.glyphs.source.family,status:p(`settings.hostGlyphStatus.${v.glyphs.status}`,{count:v.glyphs.covered.toLocaleString()})}):null,j=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:hr(),J=D||y,se=r.agentKeymaps[J]||{},V=fb(J,se),De=hb(J,se),Re=De.filter(E=>!E.hidden).length,ye=E=>E.custom?E.customLabel||"":p(`agentActions.${E.labelKey}`),Ae=E=>{try{return rr(E.combo)}catch{return E.combo}},Le=E=>{c({agentKeymaps:{...r.agentKeymaps,[J]:E}})},He=(E,ue)=>{var ve;Le({...se,actions:{...se.actions,[E]:{...(ve=se.actions)==null?void 0:ve[E],...ue}}})},gt=E=>{He(E.id,{keys:E.defaultCombo})},Ve=(E,ue)=>{const ve=E+(ue==="up"?-1:1);if(ve<0||ve>=V.length)return;const Be=V.map(pn=>pn.id);[Be[E],Be[ve]]=[Be[ve],Be[E]],Le({...se,order:Be})},Ue=E=>{var ue;Le({...se,custom:(se.custom||[]).filter(ve=>ve.id!==E),order:(ue=se.order)==null?void 0:ue.filter(ve=>ve!==E)})},vt=()=>Le(Xx(se)),xt=()=>{const E={...r.agentKeymaps};delete E[J],c({agentKeymaps:E})},Fe=()=>{const E=te.trim();if(!E)return;try{Li(I)}catch{return}const ue=`custom-${Date.now().toString(36)}`;Le({...se,custom:[...se.custom||[],{id:ue,label:E,keys:I.trim()}],order:[...V.map(ve=>ve.id),ue]}),F(""),me("")},Y=E=>E instanceof Ri?p(`agentKeymaps.errors.${E.code}`,E.params):String(E),oe=(E,ue)=>`${E}:${ue}`,Xe=(E,ue)=>{const ve=oe(J,E);fe.current={...fe.current,[ve]:ue},le(fe.current);try{Li(ue),He(E,{keys:ue})}catch{}},Nt=E=>{const ue=oe(J,E),ve=fe.current[ue];if(ve!==void 0){delete fe.current[ue],le({...fe.current});try{Li(ve),He(E,{keys:ve})}catch{}}},Ut=typeof window<"u"&&window.isSecureContext&&"Notification"in window,dn=()=>{const E=tb();c({fontSize:E.fontSize,fontSizeFollowsHost:E.fontSizeFollowsHost,fontFamily:E.fontFamily,toolbarVisible:E.toolbarVisible,vibrateOnKeyPress:E.vibrateOnKeyPress,predictiveEcho:E.predictiveEcho,agentAlertBadge:E.agentAlertBadge,agentAlertSound:E.agentAlertSound,agentAlertVibrate:E.agentAlertVibrate,agentAlertNotify:E.agentAlertNotify,language:E.language,virtualKeys:E.virtualKeys}),d("info",p("settings.resetDefaultsToast"))},Gt=E=>{const ue=j.map(ve=>ve.id===E?{...ve,enabled:!ve.enabled}:ve);c({virtualKeys:ue})},ot=(E,ue)=>{const ve=ue==="up"?E-1:E+1;if(ve<0||ve>=j.length)return;const Be=[...j],pn=Be[E];Be[E]=Be[ve],Be[ve]=pn,c({virtualKeys:Be})},$e=E=>{if(j.some(ve=>ve.id===E.id)){const ve=j.map(Be=>Be.id===E.id?{...Be,enabled:!0}:Be);c({virtualKeys:ve})}else{const ve=[...j,{...E,enabled:!0}];c({virtualKeys:ve})}Ne(!1)},mn=E=>{const ue=j.filter(ve=>ve.id!==E);c({virtualKeys:ue})},ct=()=>{c({virtualKeys:hr()}),d("info",p("toasts.keyLayoutReset"))},ce=10,Me=24;return f.jsxs(Vo,{isOpen:a,onClose:i,title:p("settings.title"),subtitle:p("settings.subtitle"),closeLabel:p("common.closeDialog"),size:"lg",hints:[{keys:"esc",action:p("common.close")}],footer:f.jsxs(f.Fragment,{children:[f.jsx(je,{variant:"ghost",onClick:dn,children:p("settings.resetDefaults")}),f.jsx(je,{variant:"primary",onClick:i,children:p("common.done")})]}),children:[f.jsx(Id,{tabs:[{id:"appearance",label:p("settings.tabAppearance"),index:1},{id:"virtualKeys",label:p("settings.tabVirtualKeys"),index:2},{id:"agentKeymaps",label:p("settings.tabAgentKeymaps"),index:3}],activeId:q,onSelect:E=>R(E),className:"mb-3 border-b border-tui-border-dim pb-1"}),q==="appearance"&&f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{children:p("settings.languageLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[f.jsx(er,{name:"ui-language",checked:h==="zh",onChange:()=>m("zh"),label:"简体中文"}),f.jsx(er,{name:"ui-language",checked:h==="en",onChange:()=>m("en"),label:"English"})]})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"terminal-font-select",children:p("settings.fontFamilyLabel")}),f.jsxs(Go,{id:"terminal-font-select",value:r.fontFamily,onChange:E=>c({fontFamily:E.target.value}),"aria-label":p("settings.fontFamilyLabel"),children:[!ie&&f.jsx("option",{value:r.fontFamily,children:r.fontFamily}),Td.map(E=>f.jsx("option",{value:E.id,children:de(E.id,E.name)},E.id))]}),r.fontFamily==="host"&&f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[f.jsxs("div",{className:"min-w-0 space-y-0.5 break-words text-tui-sm leading-snug text-tui-muted",children:[f.jsx("p",{"data-testid":"host-font-status",children:ge}),A?f.jsx("p",{"data-testid":"host-glyph-status",children:A}):null]}),f.jsx(je,{onClick:S,disabled:b!=="connected"||v.status==="loading"||v.glyphs.status==="loading",children:p("settings.hostFontSync")})]}),f.jsxs("div",{className:"overflow-x-auto whitespace-nowrap border border-tui-border bg-tui-mantle px-2 py-1.5 leading-snug text-tui-text",style:{fontFamily:M,fontSize:`${N}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"terminal-font-size",children:p("settings.fontSizeLabel",{size:N})}),f.jsx(Oa,{checked:r.fontSizeFollowsHost,onChange:E=>c(E?{fontSizeFollowsHost:!0}:{fontSizeFollowsHost:!1,fontSize:N}),label:we?p("settings.fontSizeFollowHost",{size:we}):p("settings.fontSizeFollowHostUnknown")}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(zb,{value:(N-ce)/(Me-ce),width:24,className:"hidden shrink-0 sm:inline-flex"}),f.jsx("input",{id:"terminal-font-size",type:"range",min:ce,max:Me,step:1,value:N,onChange:E=>c({fontSize:Number(E.target.value),fontSizeFollowsHost:!1}),className:"h-1 w-full cursor-pointer appearance-none bg-tui-border accent-tui-accent"})]}),f.jsxs("div",{className:"flex justify-between text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("settings.fontSizeCompact")}),f.jsx("span",{children:p("settings.fontSizeDefault")}),f.jsx("span",{children:p("settings.fontSizeLarge")})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.mobileFontNote")}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.windowZoomSharedNote")})]}),f.jsx(gi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{children:p("settings.predictiveEchoLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[f.jsx(er,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>c({predictiveEcho:"auto"}),label:p("settings.predictiveEchoAuto")}),f.jsx(er,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>c({predictiveEcho:"always"}),label:p("settings.predictiveEchoAlways")}),f.jsx(er,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>c({predictiveEcho:"off"}),label:p("settings.predictiveEchoOff")})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.predictiveEchoDesc")})]}),f.jsx(gi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Oa,{checked:r.toolbarVisible,onChange:E=>c({toolbarVisible:E}),label:p("settings.touchKeyToolbar"),description:p("settings.touchKeyToolbarDesc")}),f.jsx(Oa,{checked:r.vibrateOnKeyPress,onChange:E=>c({vibrateOnKeyPress:E}),label:p("settings.touchHaptics"),description:p("settings.touchHapticsDesc")})]}),f.jsx(gi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{children:p("settings.agentAlertsLabel")}),f.jsx(Oa,{checked:r.agentAlertBadge,onChange:E=>c({agentAlertBadge:E}),label:p("settings.agentAlertBadge"),description:p("settings.agentAlertBadgeDesc")}),f.jsx(Oa,{checked:r.agentAlertVibrate,onChange:E=>c({agentAlertVibrate:E}),label:p("settings.agentAlertVibrate"),description:p("settings.agentAlertVibrateDesc")}),f.jsx(Oa,{checked:r.agentAlertSound,onChange:E=>{c({agentAlertSound:E}),E&&(bb(),yb("done"))},label:p("settings.agentAlertSound"),description:p("settings.agentAlertSoundDesc")}),Ut&&f.jsx(Oa,{checked:r.agentAlertNotify,onChange:E=>{if(E&&Notification.permission!=="granted"){Notification.requestPermission().then(ue=>c({agentAlertNotify:ue==="granted"}));return}c({agentAlertNotify:E})},label:p("settings.agentAlertNotify"),description:p("settings.agentAlertNotifyDesc")})]}),f.jsx(gi,{}),f.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1",children:Ye.arrowRight}),p("settings.colorPassthroughNote")]})]}),q==="virtualKeys"&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-start justify-between gap-2",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("h3",{className:"text-tui font-bold uppercase text-tui-accent",children:p("virtualKeyboard.customizeTitle")}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("virtualKeyboard.customizeDesc")})]}),f.jsx(je,{variant:"ghost",onClick:ct,className:"shrink-0",children:p("virtualKeyboard.resetLayout")})]}),f.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:j.map((E,ue)=>f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border-dim px-2 py-1 last:border-b-0 hover:bg-tui-selection",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[f.jsx("input",{type:"checkbox",checked:E.enabled,onChange:()=>Gt(E.id),className:"sr-only",id:`toggle-${E.id}`}),f.jsx("label",{htmlFor:`toggle-${E.id}`,className:re("shrink-0 cursor-pointer select-none font-bold",E.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:E.enabled?"[x]":"[ ]"}),f.jsx(ng,{className:re(!E.enabled&&"opacity-50"),children:E.label}),f.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:wd(E,p)})]}),f.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[f.jsx(je,{variant:"ghost",brackets:!1,disabled:ue===0,onClick:()=>ot(ue,"up"),title:p("virtualKeyboard.moveUp"),"aria-label":p("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),f.jsx(je,{variant:"ghost",brackets:!1,disabled:ue===j.length-1,onClick:()=>ot(ue,"down"),title:p("virtualKeyboard.moveDown"),"aria-label":p("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),f.jsx(je,{variant:"ghost",brackets:!1,onClick:()=>mn(E.id),title:p("virtualKeyboard.deleteKeyTitle"),"aria-label":p("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:Ye.cross})]})]},E.id))}),f.jsx(je,{block:!0,glyph:"+",onClick:()=>Ne(!be),className:"border-dashed",children:p("virtualKeyboard.addKey")}),be&&f.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[f.jsx(gi,{label:p("virtualKeyboard.availableKeys")}),f.jsx("div",{className:"relative flex max-h-48 flex-wrap gap-1 overflow-y-auto overscroll-contain",children:$v.map(E=>{const ue=j.some(ve=>ve.id===E.id);return f.jsxs("button",{type:"button",onClick:()=>$e(E),title:wd(E,p),className:re("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",ue?"border-tui-border-dim text-tui-faint":"border-tui-border text-tui-text hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{children:E.label}),f.jsx("span",{"aria-hidden":"true",className:ue?"text-tui-ok":"text-tui-accent",children:ue?Ye.check:"+"})]},E.id)})})]})]}),q==="agentKeymaps"&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"agent-keymap-profile",children:p("agentKeymaps.settingsProfileLabel")}),f.jsx(Go,{id:"agent-keymap-profile","aria-label":p("agentKeymaps.settingsProfileLabel"),value:J,onChange:E=>B(E.target.value),children:Ux.map(E=>f.jsx("option",{value:E,children:Wl[E].name},E))}),Wl[J].configHint&&f.jsx("p",{className:"text-tui-sm text-tui-faint",children:p("agentKeymaps.configHint",{path:Wl[J].configHint})})]}),f.jsx(gi,{label:p("agentKeymaps.barGroup")}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("agentKeymaps.barHint",{profile:Wl[J].name,count:Re})}),f.jsx("div",{role:"group","aria-label":p("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:De.map(E=>{const ue=ye(E),ve=Ae(E),Be=!E.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${E.id}`,"aria-pressed":Be,onClick:()=>He(E.id,{hidden:Be}),title:`${ve} ${ue}`.trim(),className:re("tui-focusable inline-flex h-8 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",Be?"border-tui-accent bg-tui-accent text-tui-crust":"border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent"),children:[f.jsx("span",{"aria-hidden":"true",className:"font-bold",children:Be?Ye.check:"+"}),f.jsx("span",{className:"font-bold",children:ve}),f.jsx("span",{className:Be?void 0:"opacity-80",children:ue})]},E.id)})}),f.jsx(je,{variant:"ghost",onClick:vt,children:p("agentKeymaps.restoreBar")})]}),f.jsx(gi,{label:p("agentKeymaps.agentGroup")}),f.jsx("div",{className:"relative max-h-72 overflow-y-auto overscroll-contain border border-tui-border bg-tui-mantle",children:V.map((E,ue)=>{var ft,ln;const ve=ye(E),Be=p("agentKeymaps.defaultCombo",{combo:rr(E.defaultCombo)}),pn=((ln=(ft=se.actions)==null?void 0:ft[E.id])==null?void 0:ln.keys)??E.combo,li=oe(J,E.id),gn=G[li]??pn;let Ct="",Lt=null;try{Li(gn),Ct=rr(gn)}catch(Kt){Lt=Y(Kt)}return f.jsxs("div",{"data-testid":`agent-setting-row-${E.id}`,className:jC,children:[f.jsx(ng,{className:"max-w-full justify-self-start overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:Ct||"—"}),f.jsxs("span",{className:"min-w-0 truncate text-tui-sm text-tui-text [grid-area:label]",title:ve,children:[ve,!E.verified&&f.jsx("span",{className:"ml-1 text-tui-sm text-tui-faint",children:p("agentKeymaps.unverified")})]}),f.jsxs("label",{className:"sr-only",htmlFor:`agent-combo-${E.id}`,children:[p("agentKeymaps.shortcutLabel")," ",ve]}),f.jsx(Cn,{id:`agent-combo-${E.id}`,"aria-label":`${p("agentKeymaps.shortcutLabel")} ${ve}`,value:gn,onChange:Kt=>Xe(E.id,Kt.target.value),onBlur:()=>Nt(E.id),onKeyDown:Kt=>{Kt.key==="Enter"&&Kt.currentTarget.blur()},placeholder:p("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Lt,className:"w-full min-w-0 [grid-area:combo]"}),f.jsx("span",{className:"min-w-0 truncate text-tui-sm text-tui-faint [grid-area:default]",title:Be,children:Be}),f.jsxs("div",{className:"flex items-center gap-1 [grid-area:actions]",children:[f.jsx(je,{variant:"ghost",brackets:!1,className:"px-1",onClick:()=>gt(E),title:p("agentKeymaps.resetAction"),"aria-label":`${p("agentKeymaps.resetAction")} ${ve}`,children:"↺"}),f.jsx(je,{variant:"ghost",brackets:!1,className:"px-1",disabled:ue===0,onClick:()=>Ve(ue,"up"),title:p("agentKeymaps.moveUp"),"aria-label":`${p("agentKeymaps.moveUp")} ${ve}`,children:"↑"}),f.jsx(je,{variant:"ghost",brackets:!1,className:"px-1",disabled:ue===V.length-1,onClick:()=>Ve(ue,"down"),title:p("agentKeymaps.moveDown"),"aria-label":`${p("agentKeymaps.moveDown")} ${ve}`,children:"↓"}),E.custom&&f.jsx(je,{variant:"ghost",brackets:!1,className:"px-1 text-tui-bad",onClick:()=>Ue(E.id),title:p("agentKeymaps.removeCustom"),"aria-label":`${p("agentKeymaps.removeCustom")} ${ve}`,children:Ye.cross})]}),Lt&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:p("agentKeymaps.invalidCombo",{error:Lt})})]},E.id)})}),f.jsx(gi,{label:p("agentKeymaps.addCustom")}),f.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("agentKeymaps.customLabel")}),f.jsx(Cn,{value:te,onChange:E=>F(E.target.value)})]}),f.jsxs("label",{className:"min-w-[9rem] flex-1 space-y-1 text-tui-sm text-tui-faint",children:[f.jsx("span",{children:p("agentKeymaps.customCombo")}),f.jsx(Cn,{value:I,onChange:E=>me(E.target.value)})]}),f.jsx(je,{onClick:Fe,disabled:!te.trim()||!I.trim(),children:p("agentKeymaps.addAction")})]}),I.trim()&&(()=>{try{return Li(I),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:rr(I)})}catch(E){const ue=Y(E);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:ue})}})(),f.jsx(je,{variant:"ghost",onClick:xt,children:p("agentKeymaps.restoreProfile")})]})]})},OC={success:"ok",warning:"warn",error:"bad",info:"accent"},zC={success:Ye.check,warning:Ye.warn,error:Ye.cross,info:"›"},BC=()=>{const{toasts:a,removeToast:i,t:s}=rt();return a.length===0?null:f.jsx("div",{className:"pointer-events-none fixed right-2 top-12 z-50 flex w-[calc(100vw-16px)] max-w-sm flex-col gap-1","aria-live":"polite","aria-atomic":"true",children:a.map(r=>{const c=OC[r.type];return f.jsxs("div",{className:re("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",ai[c].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:re("shrink-0 font-bold",ai[c].text),children:zC[r.type]}),f.jsx("div",{className:"min-w-0 flex-1 break-words leading-snug text-tui-text",children:r.message}),r.count>1&&f.jsxs("span",{className:"shrink-0 border border-tui-border-dim px-1 text-tui-sm text-tui-muted","aria-label":`×${r.count}`,children:["×",r.count]}),f.jsx("button",{type:"button",onClick:()=>i(r.id),className:"tui-focusable shrink-0 select-none px-0.5 text-tui-faint transition-colors hover:text-tui-bad","aria-label":s("common.dismissNotification"),children:f.jsx("span",{"aria-hidden":"true",children:Ye.cross})})]},r.id)})})},sy=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}];function HC(a){return a?a.total>0||sy.some(({status:i})=>{var s;return(((s=a.counts)==null?void 0:s[i])??0)>0}):!1}const ry=({className:a,compact:i=!1})=>{const{agentStatus:s,t:r}=rt();if(!s)return null;const c=sy.map(({status:h,level:m})=>{var p;return{status:h,level:m,count:((p=s.counts)==null?void 0:p[h])??0}}).filter(h=>h.count>0),d=i?c.slice(0,1):c;return d.length===0?s.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:re("flex shrink-0 items-center gap-1 px-1 text-tui-muted",a),title:r("agents.title"),children:[f.jsx(_n,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:r("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:re("flex shrink-0 items-center gap-2 px-1",a),title:r("agents.title"),children:d.map(({status:h,level:m,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(_n,{level:m}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:r(`agents.${h}`)})]},h))})},qd=({onAddProfile:a,mobile:i=!1,statusBar:s=!1})=>{const{profiles:r,activeProfileId:c,activeProfile:d,connectionState:h,switchProfile:m,renameProfile:p,removeProfile:y,t:b}=rt(),[v,S]=w.useState(!1),[M,N]=w.useState(null),[q,R]=w.useState(""),D=w.useRef(null);w.useEffect(()=>{if(!v)return;const F=I=>{D.current&&!D.current.contains(I.target)&&S(!1)};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[v]);const B=(F,I)=>{N(F),R(I)},G=F=>{const I=q.trim();I&&p(F,I),N(null)},le=F=>{typeof window<"u"&&!window.confirm(b("profiles.removeConfirm"))||(y(F),N(null))},fe=(d==null?void 0:d.displayName)||b("profiles.addHost"),te=h==="connected"?"ok":h==="connecting"||h==="reconnecting"?"warn":h==="error"?"bad":"idle";return f.jsxs("div",{ref:D,className:re("relative min-w-0",i&&"w-full",s&&"flex-1"),children:[f.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":v,"aria-label":b("profiles.switcherLabel"),onClick:()=>S(F=>!F),className:re("tui-focusable flex min-w-0 items-center gap-1.5 border border-transparent text-left text-tui-muted transition-colors hover:border-tui-border hover:text-tui-accent",s?"min-h-11 w-full max-w-none px-2":i?"min-h-11 w-full px-2":"min-h-[24px] max-w-[18rem] px-1"),children:[f.jsx(_n,{level:te}),f.jsx("span",{className:re("truncate text-tui-text",s&&"min-w-0 flex-1"),children:fe}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?Ye.chevronDown:Ye.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":b("profiles.switcherLabel"),className:re("absolute bottom-full left-0 z-[100] mb-1 max-h-[min(70vh,24rem)] overflow-y-auto border border-tui-border bg-tui-base p-1 shadow-lg",s?"w-80 max-w-[calc(100vw-1rem)]":i?"inset-x-0 bottom-auto top-full mt-1 mb-0 w-full":"w-80 max-w-[calc(100vw-1rem)]"),children:[f.jsx("div",{className:"border-b border-tui-border-dim px-2 py-1 text-tui-sm uppercase text-tui-faint",children:b("profiles.title")}),r.length===0?f.jsx("p",{className:"px-2 py-2 text-tui-sm text-tui-muted",children:b("profiles.empty")}):r.map(F=>{const I=F.id===c,me=F.id===M;return f.jsxs("div",{role:"none",className:"border-b border-tui-border-dim last:border-b-0",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs("button",{type:"button",role:"menuitem","aria-current":I?"true":void 0,onClick:()=>{m(F.id),S(!1)},className:re("tui-focusable flex min-h-11 min-w-0 flex-1 items-center gap-2 px-2 text-left text-tui transition-colors hover:bg-tui-selection",I?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:I?Ye.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:F.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:F.hostname||F.hostId,children:F.hostname||F.hostId||F.wsUrl})]}),I&&f.jsx("span",{className:"shrink-0 text-tui-sm text-tui-ok",children:b("profiles.current")})]}),f.jsx("button",{type:"button",role:"menuitem","aria-label":b("profiles.rename"),title:b("profiles.rename"),onClick:()=>B(F.id,F.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:Ye.ellipsis})]}),me&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:q,maxLength:64,onChange:be=>R(be.target.value),onKeyDown:be=>{be.key==="Enter"&&G(F.id),be.key==="Escape"&&N(null)},"aria-label":b("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(je,{onClick:()=>G(F.id),variant:"primary",className:"min-h-11",children:b("common.save")}),f.jsx(je,{onClick:()=>le(F.id),variant:"danger",className:"min-h-11",children:b("profiles.remove")})]})]},F.id)}),f.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{S(!1),a()},className:"tui-focusable flex min-h-11 w-full items-center gap-2 px-2 text-left text-tui-accent hover:bg-tui-selection",children:[f.jsx("span",{"aria-hidden":"true",children:"+"}),f.jsx("span",{children:b("profiles.addHost")})]})]})]})};function oy(){const{updateStatus:a,ignoredUpdate:i}=rt();return!!(a!=null&&a.updateAvailable)&&i!==(a==null?void 0:a.latest)}const cy=({compact:a=!1,className:i})=>{const{updateStatus:s,t:r}=rt(),c=oy(),[d,h]=w.useState(!1);if(!c||!s)return null;const{latest:m,restartPending:p}=s,y=p?r("update.chipRestart",{version:m}):a?r("update.chipCompact",{version:m}):r("update.chip",{version:m});return f.jsxs(f.Fragment,{children:[f.jsx("button",{type:"button","data-testid":"update-chip",onClick:()=>h(!0),title:r("update.title"),className:re("tui-focusable shrink-0 whitespace-nowrap px-1 text-tui-warn hover:underline",i),children:y}),f.jsx(UC,{isOpen:d,onClose:()=>h(!1)})]})},xd=({command:a})=>{const{addToast:i,t:s}=rt();return f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-mantle px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 break-all text-tui-text",children:a}),f.jsx(je,{glyph:"⧉",className:"shrink-0",onClick:()=>{Ba(a).then(r=>{i(r==="failed"?"error":"success",s(r==="failed"?"clipboard.copyFailed":"toasts.commandCopied"))})},children:s("common.copy")})]})},UC=({isOpen:a,onClose:i})=>{const{updateStatus:s,ignoreUpdate:r,hostname:c,hostId:d,t:h}=rt();if(!s)return null;const{current:m,installed:p,latest:y,restartPending:b}=s;return f.jsx(Vo,{isOpen:a,onClose:i,title:h("update.title"),closeLabel:h("common.closeDialog"),size:"md",footer:f.jsxs(f.Fragment,{children:[f.jsx(je,{variant:"ghost",onClick:()=>{r(y),i()},children:h("update.ignore")}),f.jsx(je,{variant:"primary",onClick:i,children:h("common.done")})]}),children:f.jsxs("div",{className:"space-y-3","data-testid":"update-modal",children:[f.jsxs("div",{className:"space-y-0.5",children:[f.jsx(wn,{label:h("common.host"),labelWidth:10,children:c||d||"—"}),f.jsx(wn,{label:h("update.running"),labelWidth:10,children:m}),p!==m?f.jsx(wn,{label:h("update.installed"),labelWidth:10,children:p}):null,f.jsx(wn,{label:h("update.latest"),labelWidth:10,children:f.jsx("span",{className:"text-tui-ok",children:y})})]}),b?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:h("update.restartPending",{version:p})}),f.jsx(xd,{command:"herdr-remote restart"})]}):f.jsxs(f.Fragment,{children:[f.jsxs("p",{className:"leading-snug text-tui-text",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1 text-tui-accent",children:Ye.arrowRight}),h("update.stepTui")]}),f.jsx("p",{className:"leading-snug text-tui-muted",children:h("update.stepCli")}),f.jsx(xd,{command:`npm install -g herdr-remote@${y} --prefer-online`}),f.jsx(xd,{command:"herdr-remote restart"}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("update.restartNote")})]})]})})},KC=({onAddProfile:a=()=>{}})=>{const{connectionState:i,role:s,hostId:r,assignedClientId:c,sharedWindowCount:d,settings:h,rttMs:m,agentStatus:p,t:y}=rt(),b=Xo(i,y),v=i==="connected",S=oy();return f.jsx(Bb,{left:f.jsxs(f.Fragment,{children:[f.jsx(qd,{onAddProfile:a}),f.jsx(ig,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(_n,{level:b.level}),f.jsx("span",{className:"text-tui-text",children:b.label})]},"status"),v?f.jsx(qo,{tone:s==="controller"?"ok":"warn",children:y(s==="controller"?"role.sharedControl":"common.viewer")},"role"):null,v&&d>1?f.jsx("span",{className:"text-tui-muted",children:y("role.sharedWindows",{count:d})},"windows"):null,r?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[y("common.host"),":"]})," ",f.jsx("span",{className:"text-tui-text",children:r})]},"host"):null,f.jsxs("span",{children:[f.jsx("span",{className:"text-tui-faint",children:y("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:c||h.clientId})]},"client")]})]}),right:f.jsx(ig,{items:[S?f.jsx(cy,{},"update"):null,v&&HC(p)?f.jsx(ry,{},"agents"):null,m!==null?f.jsxs("span",{className:"text-tui-muted",children:[y("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[m,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:y("header.tagline")},"mode")]})})},FC=[[/\biPhone\b/i,"iPhone"],[/\biPad\b/i,"iPad"],[/\biPod\b/i,"iPod"],[/\bAndroid\b/i,"Android"],[/\bCrOS\b/i,"ChromeOS"],[/\bWindows NT\b/i,"Windows"],[/\bMac OS X\b|\bMacintosh\b/i,"macOS"],[/\bLinux\b/i,"Linux"]],IC=[[/\bEdgA?\/|\bEdge\//i,"Edge"],[/\bOPR\/|\bOpera\//i,"Opera"],[/\bSamsungBrowser\//i,"Samsung Internet"],[/\bFirefox\/|\bFxiOS\//i,"Firefox"],[/\bCriOS\//i,"Chrome"],[/\bChrome\//i,"Chrome"],[/\bSafari\//i,"Safari"]];function _g(a,i){for(const[s,r]of a)if(s.test(i))return r;return null}function Vd(a){const i=typeof a=="string"?a.trim():"";if(!i)return{label:"",raw:""};const s=_g(FC,i),r=_g(IC,i);return s&&r?{label:`${s} · ${r}`,raw:i}:s?{label:s,raw:i}:r?{label:r,raw:i}:{label:i.length>32?`${i.slice(0,32)}…`:i,raw:i}}function jg(a){if(a===0)return"0 B";const i=1024,s=["B","KB","MB","GB"],r=Math.floor(Math.log(a)/Math.log(i));return`${(a/Math.pow(i,r)).toFixed(1)} ${s[r]}`}const GC=({clients:a})=>{const{t:i}=rt(),s=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:"ok"}),f.jsx("span",{className:"font-bold text-tui-text",children:r.id})]})},{key:"role",header:i("admin.colRole"),width:12,render:r=>{const c=r.role==="controller";return f.jsx(qo,{tone:c?"ok":"warn",children:i(c?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const c=Vd(r.userAgent);return c.label?f.jsx("span",{className:"text-tui-muted",title:c.raw,children:c.label}):f.jsx("span",{className:"text-tui-faint",children:i("admin.unknownDevice")})}},{key:"ip",header:i("admin.colIp"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.ip||"127.0.0.1"})},{key:"connectedAt",header:i("admin.colConnectedAt"),render:r=>f.jsx("span",{className:"text-tui-muted",children:r.connectedAt?new Date(r.connectedAt).toLocaleTimeString():i("admin.startedRecently")})},{key:"traffic",header:i("admin.colTraffic"),align:"right",render:r=>f.jsxs("span",{className:"whitespace-nowrap",children:[f.jsx("span",{className:"text-tui-accent",children:jg(r.bytesReceived||0)}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsx("span",{className:"text-tui-ok",children:jg(r.bytesSent||0)})]})}];return f.jsx(an,{title:i("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noClients")})})},Dg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function YC(a=[],i=[]){const s=new Map;for(const d of i){if(!(d!=null&&d.hostId))continue;const h=s.get(d.hostId);h?h.push(d):s.set(d.hostId,[d])}const r=a.map(d=>{const h=s.get(d.id)||[];return{id:d.id,hostname:d.hostname||d.id,status:d.status||"online",connectedDeviceCount:d.connectedDeviceCount??0,pairedDeviceCount:d.pairedDeviceCount??h.length,devices:h,fromRosterOnly:!1}}),c=new Set(r.map(d=>d.id));for(const[d,h]of s)c.has(d)||r.push({id:d,hostname:d,status:"offline",connectedDeviceCount:0,pairedDeviceCount:h.length,devices:h,fromRosterOnly:!0});return r.sort((d,h)=>d.fromRosterOnly!==h.fromRosterOnly?d.fromRosterOnly?1:-1:d.hostname.localeCompare(h.hostname))}const $C=({hosts:a,devices:i})=>{const{t:s}=rt(),r=YC(a,i),c={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return f.jsx(an,{title:s("admin.hostsTitle",{count:r.length}),bodyClassName:"space-y-2",children:r.length===0?f.jsx("p",{className:"px-1 py-2 text-tui text-tui-faint",children:s("admin.noHosts")}):r.map(d=>f.jsxs("div",{className:"border border-tui-border-dim bg-tui-mantle",children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b border-tui-border-dim px-2 py-1",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-tui",children:[f.jsx(_n,{level:Dg[d.status]}),f.jsx("span",{className:"truncate font-bold text-tui-text",children:d.hostname}),d.hostname!==d.id?f.jsx("code",{className:"truncate text-tui-sm text-tui-faint",children:d.id}):null]}),f.jsxs("span",{className:"flex shrink-0 items-center gap-3 text-tui-sm",children:[f.jsx(qo,{tone:Dg[d.status],children:c[d.status]}),f.jsx("span",{className:"text-tui-accent",children:s("admin.hostConnectedDevices",{count:d.connectedDeviceCount})}),f.jsx("span",{className:"text-tui-muted",children:s("admin.hostPairedDevices",{count:d.pairedDeviceCount})})]})]}),d.devices.length>0?f.jsx("ul",{className:"divide-y divide-tui-border-dim",children:d.devices.map(h=>{const m=Vd(h.userAgent);return f.jsxs("li",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 py-0.5 text-tui",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:"·"}),f.jsx("span",{className:"truncate text-tui-text",title:m.raw,children:m.label||s("admin.unknownDevice")}),f.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:h.deviceId}),f.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:h.lastIp||"—"})]},h.deviceId)})}):f.jsx("p",{className:"px-2 py-1 text-tui-sm text-tui-faint",children:d.pairedDeviceCount>0?s("admin.hostRosterOperatorOnly"):s("admin.noDevices")})]},d.id))})},qC=({ptys:a})=>{const{t:i}=rt(),s=[{key:"id",header:i("admin.colPtyId"),render:r=>f.jsx("span",{className:"font-bold text-tui-accent",children:r.id})},{key:"pid",header:i("admin.colPid"),width:9,render:r=>f.jsx("span",{className:"text-tui-muted",children:r.pid})},{key:"command",header:i("admin.colCommand"),render:r=>f.jsx("code",{className:"border border-tui-border-dim bg-tui-mantle px-1 text-tui-text",children:r.command})},{key:"grid",header:i("admin.colGrid"),width:11,render:r=>f.jsxs("span",{className:"whitespace-nowrap text-tui-muted",children:[r.cols,f.jsx("span",{"aria-hidden":"true",className:"mx-0.5 text-tui-faint",children:"×"}),r.rows]})},{key:"cwd",header:i("admin.colCwd"),className:"max-w-xs truncate",render:r=>f.jsx("span",{className:"text-tui-muted",children:r.cwd||"~"})},{key:"viewers",header:i("admin.colViewers"),align:"right",width:9,render:r=>f.jsx("span",{className:"font-bold text-tui-ok",children:r.activeClients})}];return f.jsx(an,{title:i("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function VC(a){if(!a)return"—";const i=new Date(a);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const XC=({devices:a,onRevoke:i})=>{const{t:s}=rt(),[r,c]=w.useState(null),[d,h]=w.useState(null),m=async y=>{if(r!==y){c(y);return}h(y);try{await i(y)}finally{h(null),c(null)}},p=[{key:"device",header:s("admin.colDevice"),render:y=>{const b=Vd(y.userAgent);return f.jsx("span",{className:"text-tui-text",title:b.raw,children:b.label||s("admin.unknownDevice")})}},{key:"deviceId",header:s("admin.colDeviceId"),render:y=>f.jsx("span",{className:"text-tui-muted",children:y.deviceId})},{key:"ip",header:s("admin.colIp"),render:y=>f.jsx("span",{className:"text-tui-muted",children:y.lastIp||"—"})},{key:"lastSeen",header:s("admin.colLastSeen"),render:y=>f.jsx("span",{className:"whitespace-nowrap text-tui-muted",children:VC(y.lastSeenAt)})},{key:"actions",header:s("admin.colActions"),align:"right",render:y=>{const b=r===y.deviceId,v=d===y.deviceId;return f.jsx(je,{variant:"danger",disabled:v,onClick:()=>void m(y.deviceId),onBlur:()=>c(S=>S===y.deviceId?null:S),"aria-label":s("admin.revokeDevice"),className:b?"bg-tui-bad text-tui-crust":void 0,children:v?f.jsx(cl,{}):s(b?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(an,{title:s("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Gd,{columns:p,items:a,rowKey:y=>y.deviceId,empty:s("admin.noDevices")})})};function uy(a){if(typeof window>"u"||!a||a.startsWith("/"))return"";try{const i=new URL(a.replace(/^ws/,"http")),s=i.pathname.replace(/\/ws\/client\/?$/,"").replace(/\/+$/,"");return i.origin===window.location.origin&&!s?"":`${i.origin}${s}`}catch{return""}}function ir(a,i){const s=uy(a);return s?`${s}${i.startsWith("/")?i:`/${i}`}`:i}const PC=({onBackToTerminal:a,onOpenPairing:i})=>{var vt,xt,Fe,Y,oe,Xe,Nt,Ut,dn,Gt,ot,$e,mn,ct;const{settings:s,updateSettings:r,addToast:c,t:d}=rt(),h=uy(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),m=((vt=s.adminTokens)==null?void 0:vt[h])||(h===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,y]=w.useState(null),[b,v]=w.useState(null),[S,M]=w.useState(!1),[N,q]=w.useState(!0),[R,D]=w.useState(null),[B,G]=w.useState(!1),[le,fe]=w.useState(3e3),[te,F]=w.useState(null),[I,me]=w.useState("overview"),[be,Ne]=w.useState(!1),[ie,de]=w.useState(m),[ge,we]=w.useState(!!m),A="node bin/service.js pair";w.useEffect(()=>{de(m),we(!!m),y(null),v(null),M(!1)},[h]);const j=()=>{Ba(A).then(ce=>{if(ce==="failed"){c("error",d("clipboard.copyFailed"));return}Ne(!0),c("success",d("toasts.commandCopied")),setTimeout(()=>Ne(!1),2e3)})};w.useEffect(()=>{let ce=!0;q(!0);async function Me(){try{const Ie=await fetch(ir(s.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(Ie.ok){const E=await Ie.json();ce&&(v(E),M(!0));return}}catch{}if(ce){const Ie=!!(s.wsUrl&&!s.wsUrl.startsWith("/")&&!s.wsUrl.includes("localhost")&&!s.wsUrl.includes("127.0.0.1")&&typeof window<"u"&&!s.wsUrl.startsWith(window.location.origin.replace("http","ws")));v({ok:!0,version:"0.1.0",protocol:1,relayMode:Ie?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),M(!0)}}return Me(),()=>{ce=!1}},[s.wsUrl,h]);const J=(b==null?void 0:b.relayMode)==="remote",se=()=>{if(b!=null&&b.adminPath)return b.publicUrl?`${b.publicUrl.replace(/\/$/,"")}${b.adminPath}`:ir(s.wsUrl,b.adminPath);if(p!=null&&p.remoteAdminUrl)return p.remoteAdminUrl;if(s.wsUrl)try{return ir(s.wsUrl,"/admin")}catch{}return"/admin"},V=w.useCallback(async()=>{if(S){if(J){if(!ge&&!ie){y(null),q(!1),D(null),G(!1);return}try{q(!0);const ce=ir(s.wsUrl,(b==null?void 0:b.adminStatusPath)||"/api/admin/status"),Ie=await fetch(ce,{headers:{Accept:"application/json","X-Relay-Admin-Token":ie}});if(Ie.status===401||Ie.status===403){G(!0),D(d("admin.relayAdminAuthError")),y(null);return}if(!Ie.ok)throw new Error(`HTTP ${Ie.status}: ${Ie.statusText}`);const E=await Ie.json();y(E),D(null),G(!1),F(new Date)}catch(ce){console.warn("GET /api/admin/status request failed:",ce),G(!1),D(ce instanceof Error?ce.message:"Failed to fetch remote admin status"),y(null)}finally{q(!1)}return}try{q(!0);const ce={Accept:"application/json"};s.token&&(ce.Authorization=`Bearer ${s.token}`);const Me=await fetch("/api/status",{headers:ce});if(Me.status===401||Me.status===403){G(!0),D(`Authentication failed (HTTP ${Me.status}): Access denied. Please configure an authorized token or pair with the host.`),y(null);return}if(!Me.ok)throw new Error(`HTTP ${Me.status}: ${Me.statusText}`);const Ie=await Me.json();y(Ie),D(null),G(!1),F(new Date)}catch(ce){console.warn("GET /api/status request failed:",ce),G(!1),D(ce instanceof Error?ce.message:"Failed to fetch status"),y(null)}finally{q(!1)}}},[S,J,ge,ie,b,s.token,s.wsUrl,h,d]),De=w.useCallback(async ce=>{try{if(!(await fetch(ir(s.wsUrl,`/api/admin/devices/${encodeURIComponent(ce)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":ie}})).ok){D(d("admin.revokeFailed"));return}await V()}catch{D(d("admin.revokeFailed"))}},[ie,V,s.wsUrl,d]);w.useEffect(()=>{if(!S)return;V();let ce=null;const Me=()=>{le>0&&!ce&&(ce=setInterval(()=>{document.visibilityState==="visible"&&V()},le))},Ie=()=>{ce&&(clearInterval(ce),ce=null)},E=()=>{document.visibilityState==="visible"?(V(),Me()):Ie()};return Me(),document.addEventListener("visibilitychange",E),()=>{Ie(),document.removeEventListener("visibilitychange",E)}},[S,V,le]);const Re=ce=>{ce.preventDefault();const Me=ie.trim();r({adminToken:Me,adminTokens:{...s.adminTokens||{},[h]:Me}}),we(!!Me)},ye=ce=>{const Me=Math.max(0,Math.floor(ce)),Ie=Math.floor(Me/86400),E=Math.floor(Me%86400/3600),ue=Math.floor(Me%3600/60),ve=Me%60,Be=(pn,li)=>`${pn}${d(`admin.unit${li}`)}`;return Ie>0?[Be(Ie,"Day"),Be(E,"Hour"),Be(ue,"Minute")].join(" "):E>0?[Be(E,"Hour"),Be(ue,"Minute"),Be(ve,"Second")].join(" "):[Be(ue,"Minute"),Be(ve,"Second")].join(" ")},Ae=ce=>{if(!ce||ce===0)return"0 B";const Me=1024,Ie=["B","KB","MB","GB"],E=Math.floor(Math.log(ce)/Math.log(Me));return`${(ce/Math.pow(Me,E)).toFixed(1)} ${Ie[E]}`},Le=()=>{const ce=se();window.open(ce,"_blank","noopener,noreferrer")},He=p?p.activeUserCount??((xt=p.clients)==null?void 0:xt.length)??0:0,gt=p?[{id:"overview",label:d("admin.tabOverview"),index:1},{id:"clients",label:d("admin.tabClients",{count:((Fe=p.clients)==null?void 0:Fe.length)||0}),index:2},{id:"ptys",label:d("admin.tabPtys",{count:((Y=p.ptys)==null?void 0:Y.length)||0}),index:3},...p.devices?[{id:"devices",label:d("admin.tabDevices",{count:p.devices.length}),index:4}]:[]]:[],Ve=gt.map(ce=>ce.id);w.useEffect(()=>{const ce=Me=>{if(Me.ctrlKey||Me.altKey||Me.metaKey)return;const Ie=Me.target;if(Ie instanceof HTMLInputElement||Ie instanceof HTMLTextAreaElement||Ie instanceof HTMLSelectElement||Ie!=null&&Ie.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Me.key==="Escape"&&a){Me.preventDefault(),a();return}if(Me.key.toLowerCase()==="r"){Me.preventDefault(),V();return}const E=Number.parseInt(Me.key,10)-1;Number.isInteger(E)&&E>=0&&E<Ve.length&&(Me.preventDefault(),me(Ve[E]))};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[V,Ve.join("|")]);const Ue=f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a&&f.jsx(je,{variant:"ghost",onClick:a,title:d("admin.returnToTerminal"),"aria-label":d("admin.returnToTerminal"),glyph:Ye.arrowLeft,brackets:!1,className:"shrink-0",children:f.jsx("span",{className:"sr-only",children:d("admin.returnToTerminal")})}),f.jsxs("span",{className:"hidden text-tui-sm text-tui-accent sm:inline",children:["v",(b==null?void 0:b.version)||(p==null?void 0:p.version)||"0.1.0"]}),f.jsx(qo,{tone:J?"alt":"ok",children:d(J?"admin.modeRemote":"admin.localWorkstationBadge")}),f.jsxs("label",{className:"hidden items-center gap-1.5 text-tui-sm text-tui-muted md:flex",children:[f.jsx("span",{children:d("admin.autoRefresh")}),f.jsxs(Go,{value:le,onChange:ce=>fe(Number(ce.target.value)),"aria-label":d("admin.autoRefresh"),className:"w-auto",children:[f.jsx("option",{value:0,children:d("admin.paused")}),f.jsx("option",{value:1e3,children:"1s"}),f.jsx("option",{value:3e3,children:"3s"}),f.jsx("option",{value:5e3,children:"5s"}),f.jsx("option",{value:1e4,children:"10s"})]})]}),f.jsx(je,{variant:"primary",onClick:V,disabled:N,title:d("admin.refreshNow"),children:N?f.jsx(cl,{}):d("admin.refreshNow")})]});return f.jsxs(p1,{name:d("admin.title"),tagline:d("admin.subtitle"),aside:Ue,tabs:gt,activeTabId:I,onSelectTab:ce=>me(ce),tabsAriaLabel:d("header.mainNavigationAria"),hints:[{keys:"1–4",action:d("admin.hintTabs")},{keys:"r",action:d("admin.hintRefresh")},...a?[{keys:"esc",action:d("admin.hintBack")}]:[]],footerAside:te?f.jsx("span",{className:"text-tui-faint",children:d("admin.updatedAt",{time:te.toLocaleTimeString()})}):null,bodyClassName:"space-y-3 pb-2",children:[!S&&f.jsx("div",{className:"flex items-center justify-center gap-2 border border-tui-border bg-tui-base px-3 py-8 text-tui text-tui-muted",children:f.jsx(cl,{label:d("admin.loadingStatus")})}),S&&J&&!ge&&f.jsxs(an,{title:d("admin.remoteRelayTitle"),aside:d("admin.remoteRelayBadge"),bodyClassName:"space-y-2",children:[f.jsx("p",{className:"text-tui leading-snug text-tui-muted",children:d("admin.remoteRelayNotice")}),f.jsxs("div",{className:"space-y-0.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx(wn,{label:d("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:s.wsUrl})}),f.jsx(wn,{label:d("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:se()})})]}),f.jsx(gi,{}),f.jsxs("div",{className:"flex flex-col items-start justify-between gap-2 sm:flex-row sm:items-center",children:[f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:d("admin.remoteRelayHelp")}),f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f.jsx(je,{onClick:()=>we(!0),children:d("admin.relayAdminLoginBtn")}),f.jsx(je,{variant:"primary",onClick:Le,glyph:Ye.arrowRight,children:d("admin.openRemoteAdminBtn")})]})]})]}),S&&J&&ge&&!p&&f.jsxs(an,{title:d("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[f.jsx(ts,{tone:(b==null?void 0:b.adminConfigured)===!1?"warn":"bad",children:(b==null?void 0:b.adminConfigured)===!1?d("admin.relayAdminNotConfigured"):d("admin.relayAdminAuthError")}),f.jsxs("form",{onSubmit:Re,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(Sn,{htmlFor:"relay-admin-token",children:d("admin.relayAdminTokenLabel")}),f.jsx(Cn,{id:"relay-admin-token",type:"password",value:ie,onChange:ce=>de(ce.target.value),placeholder:d("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(je,{variant:"primary",type:"submit",children:d("admin.relayAdminLoginBtn")}),f.jsx(je,{variant:"ghost",onClick:()=>we(!1),children:d("common.cancel")})]})]})]}),S&&!J&&B&&f.jsxs(an,{title:d("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(ts,{tone:"bad",children:d("admin.unauthorizedDesc")}),f.jsxs("div",{className:"space-y-1.5 border border-tui-border-dim bg-tui-mantle px-2 py-1.5",children:[f.jsx("span",{className:"block text-tui-sm uppercase text-tui-muted",children:d("admin.pairingStepsTitle")}),f.jsxs("div",{className:"flex items-center gap-2 border border-tui-border bg-tui-crust px-2 py-1",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 select-none text-tui-ok",children:"$"}),f.jsx("code",{className:"min-w-0 flex-1 truncate text-tui-text",children:A}),f.jsx(je,{onClick:j,glyph:be?Ye.check:"⧉",className:re("shrink-0",be&&"border-tui-ok text-tui-ok"),children:d(be?"admin.copiedJson":"common.copy")})]}),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:d("admin.pairingStepsHelp")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[i&&f.jsx(je,{variant:"primary",onClick:i,children:d("admin.enterPairCodeBtn")}),f.jsx(je,{onClick:V,children:d("admin.retryFetchBtn")})]})]}),S&&R&&!B&&!(!J&&B)&&f.jsx(ts,{tone:"warn",action:f.jsx(je,{variant:"warn",onClick:V,children:d("common.retry")}),children:d("admin.errorConnecting",{error:R})}),p&&f.jsxs(f.Fragment,{children:[I==="overview"&&f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:[f.jsxs(an,{title:d("admin.accessPanel"),aside:ye(p.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[f.jsx(wn,{label:d("admin.connectedHosts"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:(oe=p.hosts)!=null&&oe.length?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:((Xe=p.hosts)==null?void 0:Xe.length)||0})]})}),f.jsx(wn,{label:d("admin.activeUsers"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(_n,{level:He?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:He}),f.jsx("span",{className:"text-tui-faint",children:d("admin.acrossWindows",{count:((Nt=p.clients)==null?void 0:Nt.length)||0})})]})}),f.jsxs(wn,{label:d("admin.activePtys"),labelWidth:14,children:[f.jsx("span",{className:"font-bold",children:((Ut=p.ptys)==null?void 0:Ut.length)||0}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.terminalShells")})]}),f.jsx(wn,{label:d("admin.uptime"),labelWidth:14,children:f.jsx("span",{className:"text-tui-muted",children:p.startTime?d("admin.startedAt",{time:new Date(p.startTime).toLocaleTimeString()}):d("admin.startedRecently")})})]}),f.jsxs(an,{title:d("admin.throughput"),aside:d("admin.perSecond",{value:Ae(((dn=p.throughput)==null?void 0:dn.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[f.jsxs(wn,{label:d("admin.bytesInTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-accent",children:Ae(((Gt=p.throughput)==null?void 0:Gt.bytesIn)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:Ae(((ot=p.throughput)==null?void 0:ot.bytesInPerSec)||0)})})]}),f.jsxs(wn,{label:d("admin.bytesOutTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-ok",children:Ae((($e=p.throughput)==null?void 0:$e.bytesOut)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:Ae(((mn=p.throughput)==null?void 0:mn.bytesOutPerSec)||0)})})]}),f.jsx(gi,{}),f.jsx(wn,{label:d("admin.frameRate"),labelWidth:13,children:f.jsx("span",{className:"font-bold",children:d("admin.framesPerSecond",{count:(((ct=p.throughput)==null?void 0:ct.framesOutPerSec)||0).toFixed(0)})})})]})]}),f.jsx($C,{hosts:p.hosts||[],devices:p.devices})]}),I==="clients"&&f.jsx(GC,{clients:p.clients||[]}),I==="ptys"&&f.jsx(qC,{ptys:p.ptys||[]}),I==="devices"&&f.jsx(XC,{devices:p.devices||[],onRevoke:De})]})]})},ZC=({compact:a=!1})=>{const{role:i,connectionState:s,sharedWindowCount:r,assignedClientId:c,t:d}=rt();if(!(s==="connected"))return f.jsxs("div",{className:"inline-flex select-none items-center gap-1.5 text-tui uppercase text-tui-faint",role:"status","aria-label":d("terminal.offlineStatusAria"),children:[f.jsx(_n,{level:"idle"}),f.jsx("span",{children:d("common.offline")})]});const m=i==="controller",p=r>1,y=f.jsxs("div",{className:re("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",m?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":d(m?"role.controllerMode":"role.viewerMode"),children:[f.jsx(_n,{level:m?"ok":"warn"}),f.jsx("span",{className:"truncate",children:d(m?"role.sharedControl":"role.viewerReadOnly")}),p?f.jsx("span",{className:"shrink-0 normal-case text-tui-muted",children:d("role.sharedWindows",{count:r})}):null]});return a?y:f.jsxs("div",{className:"flex w-full flex-col gap-1",children:[y,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:d("role.sharedControlDesc")}),c?f.jsx(wn,{label:d("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:c})}):null]})},ar="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",lr="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",QC="border-tui-accent bg-tui-selection text-tui-accent",sr=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:re("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:Ye.cursor}),WC=({onClose:a,onNavigateAdmin:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:c,onAddProfile:d=()=>{}})=>{const{connectionState:h,stateDetail:m,rttMs:p,hostId:y,settings:b,updateSettings:v,connect:S,addToast:M,language:N,setLanguage:q,t:R}=rt(),[D,B]=_i.useState(!1),G=Xo(h,R),le=F=>()=>{var me;const I=document.activeElement;(me=I==null?void 0:I.blur)==null||me.call(I),F()},fe=()=>{Ba(b.clientId).then(F=>{if(F==="failed"){M("error",R("clipboard.copyFailed"));return}B(!0),M("info",R("toasts.clientIdCopied",{id:b.clientId})),setTimeout(()=>B(!1),2e3)})},te=()=>{const F=N==="zh"?"en":"zh";q(F),M("info",Hd(F,"toasts.switchedLanguage",{lang:F==="zh"?"简体中文":"English"}))};return f.jsxs("div",{className:"flex flex-col gap-3 px-3 pb-2 pt-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-tui-border pb-1.5",children:[f.jsx("h2",{className:"text-tui font-bold uppercase text-tui-accent",children:R("mobile.sessionControls")}),f.jsx(je,{variant:"ghost",onClick:a,"aria-label":R("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(an,{title:R("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(qd,{mobile:!0,onAddProfile:d})}),f.jsxs(an,{title:R("common.status"),tone:G.level==="ok"?"ok":G.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":R("mobile.connectionStatusAria"),children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(_n,{level:G.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:G.label}),h==="connected"&&p!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[p,"ms"]})]}),G.actionLabel&&f.jsx(je,{variant:"primary",onClick:()=>S(),className:"shrink-0",children:G.actionLabel})]}),G.needsAttention&&m&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:m}),y&&f.jsx(wn,{label:R("common.host"),labelWidth:9,children:y}),f.jsxs("button",{type:"button",onClick:fe,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:R("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:R("header.clientIdLabel")}),f.jsx("span",{className:"min-w-0 flex-1 truncate text-tui-text",children:b.clientId}),f.jsx("span",{"aria-hidden":"true",className:re("shrink-0",D?"text-tui-ok":"text-tui-faint"),children:D?Ye.check:"⧉"})]})]}),f.jsx(an,{title:R("mobile.inputControl"),tone:"accent","aria-label":R("mobile.terminalControlAria"),children:f.jsx(ZC,{})}),f.jsxs(an,{title:R("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:te,className:re(ar,lr),"aria-label":R("header.languageToggleTitle"),children:[f.jsx(sr,{}),f.jsx("span",{className:"truncate",children:N==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:le(c),className:re(ar,lr),"aria-label":R("mobile.settingsAria"),children:[f.jsx(sr,{}),f.jsx("span",{className:"truncate",children:R("common.settings")})]}),f.jsxs("button",{type:"button",onClick:le(r),className:re(ar,lr),"aria-label":R("mobile.pairingAria"),children:[f.jsx(sr,{}),f.jsx("span",{className:"truncate",children:R("common.pairing")})]}),s&&f.jsxs("button",{type:"button",onClick:le(i),className:re(ar,lr),"aria-label":R("mobile.adminAria"),children:[f.jsx(sr,{}),f.jsx("span",{className:"truncate",children:R("common.admin")})]}),f.jsxs("button",{type:"button",onClick:()=>v({toolbarVisible:!b.toolbarVisible}),className:re(ar,b.toolbarVisible?QC:lr),"aria-label":R("mobile.keybarAria"),"aria-pressed":b.toolbarVisible,children:[f.jsx(sr,{active:b.toolbarVisible}),f.jsx("span",{className:"truncate",children:R("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:b.toolbarVisible?"[x]":"[ ]"})]})]})]})},JC=({onAddProfile:a})=>{const{rttMs:i,t:s}=rt();return f.jsxs("footer",{"data-testid":"mobile-status-bar",role:"status","aria-label":s("mobile.statusBarAria"),className:"absolute inset-x-0 bottom-0 z-40 flex h-11 shrink-0 items-center gap-2 border-t border-tui-border bg-tui-mantle px-1 text-tui-sm",children:[f.jsx(qd,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(ry,{compact:!0}),f.jsx(cy,{compact:!0}),f.jsxs("span",{className:"flex shrink-0 items-center gap-1 px-1 text-tui-muted",title:s("header.latencyTitle"),children:[f.jsx("span",{className:"text-tui-faint",children:"RTT"}),f.jsx("span",{className:re(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},eT=({onNavigateAdmin:a,showAdminEntry:i=!0,onOpenPairing:s,onOpenSettings:r,onAddProfile:c=()=>{}})=>{const{connectionState:d,isController:h,t:m}=rt(),[p,y]=w.useState(!1),b=w.useRef(null),v=w.useCallback(()=>y(!1),[]);w.useEffect(()=>{if(!p)return;const M=N=>{if(!(N.ctrlKey||N.altKey||N.metaKey)&&N.key==="Escape"){const q=N.target;q&&typeof q.closest=="function"&&!!q.closest("#terminal-container")||(N.stopPropagation(),N.preventDefault(),v())}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[p,v]),w.useEffect(()=>{var M;p&&((M=b.current)==null||M.focus({preventScroll:!0}))},[p]);const S=Xo(d,m);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":m("mobile.sessionControls"),className:"pointer-events-none absolute inset-x-0 top-0 z-40 flex h-12 items-center justify-between gap-2 border-b border-tui-border bg-tui-mantle px-2 text-tui",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-tui-sm text-tui-muted",children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:"herdr"}),f.jsx(Db,{className:"shrink-0"}),f.jsx(_n,{level:S.level}),f.jsx("span",{className:"truncate uppercase",children:S.label})]}),f.jsxs("button",{type:"button","data-testid":"mobile-chrome-trigger",onClick:()=>y(!0),"aria-label":m("mobile.sessionControls"),"aria-expanded":p,"aria-haspopup":"dialog",className:re("tui-focusable pointer-events-auto flex h-9 shrink-0 select-none items-center gap-1.5 border px-2 text-tui uppercase transition-colors",S.needsAttention?"border-tui-warn text-tui-warn":h?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!h&&!S.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:m("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:Ye.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:m("mobile.menu")})]})]}),p&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"mobile-sheet-scrim",className:"absolute inset-0 z-40 bg-tui-crust/70",onClick:v,"aria-hidden":"true"}),f.jsx("div",{ref:b,"data-testid":"mobile-control-sheet",role:"dialog","aria-modal":"true","aria-label":m("mobile.sessionControls"),tabIndex:-1,className:"herdr-sheet absolute inset-x-0 bottom-0 z-50 max-h-[85%] overflow-y-auto border-t border-tui-border bg-tui-base pb-3 focus:outline-none",children:f.jsx(WC,{onClose:v,showAdminEntry:i,onNavigateAdmin:()=>{v(),a()},onOpenPairing:()=>{v(),s()},onOpenSettings:()=>{v(),r()},onAddProfile:()=>{v(),c()}})})]}),f.jsx(JC,{onAddProfile:c})]})},tT=()=>{const{herdrLaunch:a,startHerdr:i,hostname:s,activeProfile:r,t:c}=rt();if(!a)return null;const d=s||(r==null?void 0:r.displayName)||c("herdrLaunch.thisHost"),h=a.phase==="failed";return f.jsx("div",{"data-testid":"herdr-start-prompt",className:"absolute inset-0 z-30 flex items-center justify-center bg-tui-crust/85 p-3",children:f.jsx(an,{title:c(h?"herdrLaunch.failedTitle":"herdrLaunch.title"),tone:h?"bad":"warn",className:"w-full max-w-md",bodyClassName:"space-y-3","aria-label":c("herdrLaunch.title"),children:a.phase==="starting"?f.jsxs("p",{className:"flex items-center gap-2 text-tui-text",role:"status",children:[f.jsx(cl,{}),f.jsx("span",{children:c("herdrLaunch.starting",{host:d})})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"leading-snug text-tui-text",children:c("herdrLaunch.body",{host:d})}),h&&a.message?f.jsx(ts,{tone:"bad",children:f.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap break-words font-mono text-tui-sm",children:a.message})}):null,f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:c("herdrLaunch.scope")}),f.jsx("div",{className:"flex justify-end",children:f.jsx(je,{variant:"primary",onClick:i,autoFocus:!0,children:c(h?"common.retry":"herdrLaunch.start")})})]})})})},dy="--app-height",fy="--keyboard-inset",nT=80;function iT(){if(typeof window>"u")return{height:768,keyboardInset:0};const a=window.innerHeight||768,i=window.visualViewport;if(i&&typeof i.height=="number"&&i.height>0){const s=a-i.height-(i.offsetTop||0),r=s>=nT?Math.round(s):0;return{height:Math.round(i.height),keyboardInset:r}}return{height:a,keyboardInset:0}}function Og(a,i=iT()){return a.style.setProperty(dy,`${i.height}px`),a.style.setProperty(fy,`${i.keyboardInset}px`),i}function aT(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let i=null;const s=()=>{i=null,Og(a)},r=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){s();return}i=requestAnimationFrame(s)}};Og(a);const c=window.visualViewport;return c==null||c.addEventListener("resize",r),c==null||c.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),c==null||c.removeEventListener("resize",r),c==null||c.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),a.style.removeProperty(dy),a.style.removeProperty(fy)}}const lT=900;function zg(){if(typeof window>"u")return!1;const a=Jl();return a<Od?!0:a<=lT}function sT(){const[a,i]=w.useState(zg);return w.useEffect(()=>{var c,d;const s=()=>{const h=zg();i(m=>m===h?m:h)};s();let r=null;try{r=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{r=null}return(c=r==null?void 0:r.addEventListener)==null||c.call(r,"change",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),(d=window.visualViewport)==null||d.addEventListener("resize",s),()=>{var h,m;(h=r==null?void 0:r.removeEventListener)==null||h.call(r,"change",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),(m=window.visualViewport)==null||m.removeEventListener("resize",s)}},[]),a}function rT(a){const i=a.target;if(!i)return!1;if(i.id==="terminal-container"||i.id==="terminal-frame"||i.id==="terminal-surface"||i.classList.contains("xterm-helper-textarea")||i.classList.contains("xterm")||i.closest("#terminal-container")||i.closest(".xterm"))return!0;if(typeof document<"u"&&document.activeElement){const s=document.activeElement;if(s.id==="terminal-container"||s.classList.contains("xterm-helper-textarea")||s.closest("#terminal-container")||s.closest(".xterm"))return!0}return!1}function oT(a,i={}){if(typeof window>"u")return()=>{};const s=r=>{var c;r.ctrlKey||r.altKey||r.metaKey||r.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(rT(r)||(r.preventDefault(),r.stopPropagation(),(c=a.onCloseModals)==null||c.call(a)))};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}}function cT(){const[a,i]=w.useState("terminal"),[s,r]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(!1),[p,y]=w.useState(void 0),b=A=>{y(A),m(!0)},[v,S]=w.useState(!1),{updateSettings:M,settings:N,connectionState:q,stateDetail:R,stateCode:D,lastPairedAt:B}=rt();yw();const G=sT();w.useEffect(()=>aT(),[]);const[le,fe]=w.useState(!0);w.useEffect(()=>{let A=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(j=>j.ok?j.json():null).then(j=>{A||!j||fe(!j.isRemoteRelay)}).catch(()=>{}),()=>{A=!0}},[]),w.useEffect(()=>{sb()},[]),w.useEffect(()=>{const A=s||h||v;if(A)return oT({onCloseModals:()=>{r(!1),m(!1),S(!1)}},{isModalOpen:A})},[s,h,v]),w.useEffect(()=>{const A=()=>{const j=window.location.pathname,J=window.location.hash;i(j==="/admin"||J==="#admin"?"admin":"terminal")};A(),window.addEventListener("popstate",A),window.addEventListener("hashchange",A);try{const j=new URL(window.location.href),J=j.searchParams.get("token"),se=j.searchParams.get("pairCode"),V=j.searchParams.get("ws")||j.searchParams.get("wsUrl"),De={};J&&(De.token=J),se&&(De.pairCode=se.toUpperCase()),V&&(De.wsUrl=V),Object.keys(De).length>0&&M(De);let Re=!1;if(j.searchParams.has("token")&&(j.searchParams.delete("token"),Re=!0),j.searchParams.has("pairCode")&&(j.searchParams.delete("pairCode"),Re=!0),Re){const ye=j.searchParams.toString(),Ae=j.pathname+(ye?`?${ye}`:"")+j.hash;window.history.replaceState({},"",Ae)}}catch(j){console.warn("Failed to parse URL query params:",j)}return()=>{window.removeEventListener("popstate",A),window.removeEventListener("hashchange",A)}},[]);const te=(A=!1)=>{d(A),r(!0)},F=()=>{r(!1),d(!1)},I=A=>{i(A),A==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},me=!N.token&&!N.pairCode&&q!=="connected",be=q==="error"&&(["auth_required","unauthorized","device_revoked"].includes(D||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(R||"")),Ne=me||be,[ie,de]=w.useState(!Ne);w.useEffect(()=>{Ne||de(!0)},[Ne]),w.useEffect(()=>{B&&(r(!1),de(!0),i("terminal"))},[B]);const ge=a==="terminal"&&!Ne,we=A=>({visibility:A?"visible":"hidden",opacity:A?1:0,pointerEvents:A?"auto":"none",zIndex:A?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:G?{paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)",paddingRight:"env(safe-area-inset-right, 0px)"}:void 0,className:"flex h-full w-full select-none flex-col overflow-hidden bg-tui-crust font-mono text-tui text-tui-text",onContextMenu:A=>{A.preventDefault(),A.stopPropagation()},children:[!G&&f.jsx(b1,{currentView:a,onNavigate:I,showAdminEntry:le,onOpenPairing:()=>te(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>S(!v),isVirtualKeyboardOpen:v}),!G&&!Ne&&f.jsx(y1,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[ie&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${G?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:we(ge),"aria-hidden":!ge,children:[f.jsx(SC,{isActive:ge}),!G&&f.jsx(NC,{isOpen:v,onClose:()=>S(!1)}),f.jsx(AC,{compact:G,onCustomize:()=>b("agentKeymaps")}),f.jsx(tT,{}),f.jsx(_C,{})]}),a==="terminal"&&Ne&&f.jsx("div",{"data-testid":"onboarding-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-10",children:f.jsx(CC,{onPairedSuccess:()=>{}})}),a==="admin"&&f.jsx("div",{"data-testid":"admin-layer",className:"absolute inset-0 flex flex-col min-h-0 w-full overflow-hidden z-20",children:f.jsx(PC,{onBackToTerminal:()=>I("terminal"),onOpenPairing:()=>te(!1)})}),G&&ge&&f.jsx(eT,{onNavigateAdmin:()=>I("admin"),showAdminEntry:le,onOpenPairing:()=>te(!1),onOpenSettings:()=>b(),onAddProfile:()=>te(!0)})]}),!G&&a!=="admin"&&f.jsx(KC,{onAddProfile:()=>te(!0)}),f.jsx(RC,{isOpen:s,isAddMode:c,onClose:F}),f.jsx(DC,{isOpen:h,initialTab:p,onClose:()=>m(!1)}),f.jsx(BC,{})]})}function uT(){return f.jsx(sw,{children:f.jsx(cT,{})})}const hy=document.getElementById("root");if(!hy)throw new Error("Root element not found");Av.createRoot(hy).render(f.jsx(_i.StrictMode,{children:f.jsx(uT,{})}));
|