herdr-remote-relay 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ var D0=Object.defineProperty;var z0=(a,i,s)=>i in a?D0(a,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[i]=s;var X=(a,i,s)=>z0(a,typeof i!="symbol"?i+"":i,s);import{r as mg,g as pg,a as gg}from"./vendor-react-CYSfZuHu.js";import{r as O0,a as B0}from"./vendor-xterm-Bbu8R_5E.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))r(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&r(m)}).observe(document,{childList:!0,subtree:!0});function s(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(u){if(u.ep)return;u.ep=!0;const d=s(u);fetch(u.href,d)}})();var Ou={exports:{}},Os={};/**
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 U0(){if(sp)return Os;sp=1;var a=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(r,u,d){var m=null;if(d!==void 0&&(m=""+d),u.key!==void 0&&(m=""+u.key),"key"in u){d={};for(var h in u)h!=="key"&&(d[h]=u[h])}else d=u;return u=d.ref,{$$typeof:a,type:r,key:m,ref:u!==void 0?u:null,props:d}}return Os.Fragment=i,Os.jsx=s,Os.jsxs=s,Os}var rp;function H0(){return rp||(rp=1,Ou.exports=U0()),Ou.exports}var f=H0(),w=mg();const mi=pg(w);var Bu={exports:{}},Bs={},Uu={exports:{}},Hu={};/**
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 op;function K0(){return op||(op=1,(function(a){function i(L,I){var le=L.length;L.push(I);e:for(;0<le;){var je=le-1>>>1,Q=L[je];if(0<u(Q,I))L[je]=I,L[le]=Q,le=je;else break e}}function s(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var I=L[0],le=L.pop();if(le!==I){L[0]=le;e:for(var je=0,Q=L.length,Ze=Q>>>1;je<Ze;){var Le=2*(je+1)-1,fe=L[Le],Ge=Le+1,Re=L[Ge];if(0>u(fe,le))Ge<Q&&0>u(Re,fe)?(L[je]=Re,L[Ge]=le,je=Ge):(L[je]=fe,L[Le]=le,je=Le);else if(Ge<Q&&0>u(Re,le))L[je]=Re,L[Ge]=le,je=Ge;else break e}}return I}function u(L,I){var le=L.sortIndex-I.sortIndex;return le!==0?le:L.id-I.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 m=Date,h=m.now();a.unstable_now=function(){return m.now()-h}}var p=[],y=[],b=1,v=null,S=3,T=!1,E=!1,Y=!1,A=!1,z=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function te(L){for(var I=s(y);I!==null;){if(I.callback===null)r(y);else if(I.startTime<=L)r(y),I.sortIndex=I.expirationTime,i(p,I);else break;I=s(y)}}function ue(L){if(Y=!1,te(L),!E)if(s(p)!==null)E=!0,W||(W=!0,Ce());else{var I=s(y);I!==null&&Fe(ue,I.startTime-L)}}var W=!1,G=-1,U=5,ie=-1;function se(){return A?!0:!(a.unstable_now()-ie<U)}function pe(){if(A=!1,W){var L=a.unstable_now();ie=L;var I=!0;try{e:{E=!1,Y&&(Y=!1,O(G),G=-1),T=!0;var le=S;try{t:{for(te(L),v=s(p);v!==null&&!(v.expirationTime>L&&se());){var je=v.callback;if(typeof je=="function"){v.callback=null,S=v.priorityLevel;var Q=je(v.expirationTime<=L);if(L=a.unstable_now(),typeof Q=="function"){v.callback=Q,te(L),I=!0;break t}v===s(p)&&r(p),te(L)}else r(p);v=s(p)}if(v!==null)I=!0;else{var Ze=s(y);Ze!==null&&Fe(ue,Ze.startTime-L),I=!1}}break e}finally{v=null,S=le,T=!1}I=void 0}}finally{I?Ce():W=!1}}}var Ce;if(typeof B=="function")Ce=function(){B(pe)};else if(typeof MessageChannel<"u"){var Oe=new MessageChannel,rt=Oe.port2;Oe.port1.onmessage=pe,Ce=function(){rt.postMessage(null)}}else Ce=function(){z(pe,0)};function Fe(L,I){G=z(function(){L(a.unstable_now())},I)}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(L){L.callback=null},a.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<L?Math.floor(1e3/L):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(L){switch(S){case 1:case 2:case 3:var I=3;break;default:I=S}var le=S;S=I;try{return L()}finally{S=le}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(L,I){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var le=S;S=L;try{return I()}finally{S=le}},a.unstable_scheduleCallback=function(L,I,le){var je=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?je+le:je):le=je,L){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=le+Q,L={id:b++,callback:I,priorityLevel:L,startTime:le,expirationTime:Q,sortIndex:-1},le>je?(L.sortIndex=le,i(y,L),s(p)===null&&L===s(y)&&(Y?(O(G),G=-1):Y=!0,Fe(ue,le-je))):(L.sortIndex=Q,i(p,L),E||T||(E=!0,W||(W=!0,Ce()))),L},a.unstable_shouldYield=se,a.unstable_wrapCallback=function(L){var I=S;return function(){var le=S;S=I;try{return L.apply(this,arguments)}finally{S=le}}}})(Hu)),Hu}var cp;function Y0(){return cp||(cp=1,Uu.exports=K0()),Uu.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 up;function G0(){if(up)return Bs;up=1;var a=Y0(),i=mg(),s=gg();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 u(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 m(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 h(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 c=o.alternate;if(c===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===n)return p(o),e;if(c===l)return p(o),t;c=c.sibling}throw Error(r(188))}if(n.return!==l.return)n=o,l=c;else{for(var g=!1,x=o.child;x;){if(x===n){g=!0,n=o,l=c;break}if(x===l){g=!0,l=o,n=c;break}x=x.sibling}if(!g){for(x=c.child;x;){if(x===n){g=!0,n=c,l=o;break}if(x===l){g=!0,l=c,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"),T=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),B=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),pe=Symbol.iterator;function Ce(e){return e===null||typeof e!="object"?null:(e=pe&&e[pe]||e["@@iterator"],typeof e=="function"?e:null)}var Oe=Symbol.for("react.client.reference");function rt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case z:return"Profiler";case A:return"StrictMode";case ue:return"Suspense";case W:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case B:return e.displayName||"Context";case O:return(e._context.displayName||"Context")+".Consumer";case te:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case G:return t=e.displayName||null,t!==null?t:rt(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return rt(e(t))}catch{}}return null}var Fe=Array.isArray,L=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},je=[],Q=-1;function Ze(e){return{current:e}}function Le(e){0>Q||(e.current=je[Q],je[Q]=null,Q--)}function fe(e,t){Q++,je[Q]=e.current,e.current=t}var Ge=Ze(null),Re=Ze(null),F=Ze(null),Be=Ze(null);function it(e,t){switch(fe(F,t),fe(Re,e),fe(Ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?km(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=km(t),e=Lm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Le(Ge),fe(Ge,e)}function we(){Le(Ge),Le(Re),Le(F)}function Ke(e){e.memoizedState!==null&&fe(Be,e);var t=Ge.current,n=Lm(t,e.type);t!==n&&(fe(Re,e),fe(Ge,n))}function gt(e){Re.current===e&&(Le(Ge),Le(Re)),Be.current===e&&(Le(Be),_s._currentValue=le)}var Ve,Qe;function lt(e){if(Ve===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||"",Qe=-1<n.stack.indexOf(`
26
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
27
+ `+Ve+e+Qe}var wt=!1;function Dt(e,t){if(!e||wt)return"";wt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(K){var D=K}Reflect.construct(e,[],P)}else{try{P.call()}catch(K){D=K}e.call(P.prototype)}}else{try{throw Error()}catch(K){D=K}(P=e())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(K){if(K&&D&&typeof K.stack=="string")return[K.stack,D.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 c=l.DetermineComponentFrameRoot(),g=c[0],x=c[1];if(g&&x){var C=g.split(`
28
+ `),j=x.split(`
29
+ `);for(o=l=0;l<C.length&&!C[l].includes("DetermineComponentFrameRoot");)l++;for(;o<j.length&&!j[o].includes("DetermineComponentFrameRoot");)o++;if(l===C.length||o===j.length)for(l=C.length-1,o=j.length-1;1<=l&&0<=o&&C[l]!==j[o];)o--;for(;1<=l&&0<=o;l--,o--)if(C[l]!==j[o]){if(l!==1||o!==1)do if(l--,o--,0>o||C[l]!==j[o]){var $=`
30
+ `+C[l].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=l&&0<=o);break}}}finally{wt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?lt(n):""}function R(e,t){switch(e.tag){case 26:case 27:case 5:return lt(e.type);case 16:return lt("Lazy");case 13:return e.child!==t&&t!==null?lt("Suspense Fallback"):lt("Suspense");case 19:return lt("SuspenseList");case 0:case 15:return Dt(e.type,!1);case 11:return Dt(e.type.render,!1);case 1:return Dt(e.type,!0);case 31:return lt("Activity");default:return""}}function ve(e){try{var t="",n=null;do t+=R(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
31
+ Error generating stack: `+l.message+`
32
+ `+l.stack}}var ye=Object.prototype.hasOwnProperty,We=a.unstable_scheduleCallback,bt=a.unstable_cancelCallback,ft=a.unstable_shouldYield,St=a.unstable_requestPaint,oe=a.unstable_now,Ne=a.unstable_getCurrentPriorityLevel,De=a.unstable_ImmediatePriority,ot=a.unstable_UserBlockingPriority,Yt=a.unstable_NormalPriority,ni=a.unstable_LowPriority,Pe=a.unstable_IdlePriority,pi=a.log,gn=a.unstable_setDisableYieldValue,zt=null,Ct=null;function qt(e){if(typeof pi=="function"&&gn(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(zt,e)}catch{}}var at=Math.clz32?Math.clz32:ii,aa=Math.log,Dn=Math.LN2;function ii(e){return e>>>=0,e===0?32:31-(aa(e)/Dn|0)|0}var Ni=256,rn=262144,gi=4194304;function Sn(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 ki(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var o=0,c=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var x=l&134217727;return x!==0?(l=x&~c,l!==0?o=Sn(l):(g&=x,g!==0?o=Sn(g):n||(n=x&~e,n!==0&&(o=Sn(n))))):(x=l&~c,x!==0?o=Sn(x):g!==0?o=Sn(g):n||(n=l&~e,n!==0&&(o=Sn(n)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,n=t&-t,c>=n||c===32&&(n&4194048)!==0)?t:o}function bi(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 In(){var e=gi;return gi<<=1,(gi&62914560)===0&&(gi=4194304),e}function Cn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Tn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Li(e,t,n,l,o,c){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,C=e.expirationTimes,j=e.hiddenUpdates;for(n=g&~n;0<n;){var $=31-at(n),P=1<<$;x[$]=0,C[$]=-1;var D=j[$];if(D!==null)for(j[$]=null,$=0;$<D.length;$++){var K=D[$];K!==null&&(K.lane&=-536870913)}n&=~P}l!==0&&sa(e,l,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(g&~t))}function sa(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-at(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function Ji(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-at(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}function li(e,t){var n=t&-t;return n=(n&42)!==0?1:el(n),(n&(e.suspendedLanes|t))!==0?0:n}function el(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 tl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ri(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:Jm(e.type))}function _i(e,t){var n=I.p;try{return I.p=e,t()}finally{I.p=n}}var Mn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Mn,en="__reactProps$"+Mn,yi="__reactContainer$"+Mn,H="__reactEvents$"+Mn,q="__reactListeners$"+Mn,de="__reactHandles$"+Mn,Ee="__reactResources$"+Mn,Te="__reactMarker$"+Mn;function ze(e){delete e[Gt],delete e[en],delete e[H],delete e[q],delete e[de]}function He(e){var t=e[Gt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yi]||n[Gt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Bm(e);e!==null;){if(n=e[Gt])return n;e=Bm(e)}return t}e=n,n=e.parentNode}return null}function Ft(e){if(e=e[Gt]||e[yi]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Nt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function An(e){var t=e[Ee];return t||(t=e[Ee]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Tt(e){e[Te]=!0}var En=new Set,zl={};function vi(e,t){ji(e,t),ji(e+"Capture",t)}function ji(e,t){for(zl[e]=t,e=0;e<t.length;e++)En.add(t[e])}var tr=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]*$"),J={},ee={};function Se(e){return ye.call(ee,e)?!0:ye.call(J,e)?!1:tr.test(e)?ee[e]=!0:(J[e]=!0,!1)}function he(e,t,n){if(Se(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 Ie(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 ae(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 Mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function tn(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,c=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(g){n=""+g,c.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 ht(e){if(!e._valueTracker){var t=Bt(e)?"checked":"value";e._valueTracker=tn(e,t,""+e[t])}}function $n(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Bt(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function qn(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 nl=/[\n"\\]/g;function on(e){return e.replace(nl,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function il(e,t,n,l,o,c,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=""+Mt(t)):e.value!==""+Mt(t)&&(e.value=""+Mt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?Za(e,g,Mt(t)):n!=null?Za(e,g,Mt(n)):l!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+Mt(x):e.removeAttribute("name")}function Di(e,t,n,l,o,c,g,x){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||n!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){ht(e);return}n=n!=null?""+Mt(n):"",t=t!=null?""+Mt(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),ht(e)}function Za(e,t,n){t==="number"&&qn(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ll(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=""+Mt(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 nr(e,t,n){if(t!=null&&(t=""+Mt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Mt(n):""}function ir(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(r(92));if(Fe(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=Mt(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),ht(e)}function al(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zo=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 lr(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||zo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ar(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&&lr(e,o,l)}else for(var c in t)t.hasOwnProperty(c)&&lr(e,c,t[c])}function hn(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 Oo=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"]]),Bo=/^[\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 xi(e){return Bo.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Qt(){}var ra=null;function oa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ai=null,si=null;function Ol(e){var t=Ft(e);if(t&&(e=t.stateNode)){var n=e[en]||null;e:switch(e=t.stateNode,t.type){case"input":if(il(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="'+on(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=l[en]||null;if(!o)throw Error(r(90));il(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&&$n(l)}break e;case"textarea":nr(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ll(e,!!n.multiple,t,!1)}}}var ca=!1;function Qa(e,t,n){if(ca)return e(t,n);ca=!0;try{var l=e(t);return l}finally{if(ca=!1,(ai!==null||si!==null)&&(Gr(),ai&&(t=ai,e=si,si=ai=null,Ol(t),e)))for(t=0;t<e.length;t++)Ol(e[t])}}function sl(e,t){var n=e.stateNode;if(n===null)return null;var l=n[en]||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 Z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),re=!1;if(Z)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){re=!0}}),window.addEventListener("test",Ue,Ue),window.removeEventListener("test",Ue,Ue)}catch{re=!1}var At=null,mn=null,bn=null;function Me(){if(bn)return bn;var e,t=mn,n=t.length,l,o="value"in At?At.value:At.textContent,c=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[c-l];l++);return bn=o.slice(e,1<l?1-l:void 0)}function nn(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 kt(){return!0}function zn(){return!1}function Ut(e){function t(n,l,o,c,g){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=c,this.target=g,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(c):c[x]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?kt:zn,this.isPropagationStopped=zn,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=kt)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=kt)},persist:function(){},isPersistent:kt}),t}var yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fn=Ut(yn),rl=v({},yn,{view:0,detail:0}),_b=Ut(rl),Uo,Ho,Wa,sr=v({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yo,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!==Wa&&(Wa&&e.type==="mousemove"?(Uo=e.screenX-Wa.screenX,Ho=e.screenY-Wa.screenY):Ho=Uo=0,Wa=e),Uo)},movementY:function(e){return"movementY"in e?e.movementY:Ho}}),Rd=Ut(sr),jb=v({},sr,{dataTransfer:0}),Db=Ut(jb),zb=v({},rl,{relatedTarget:0}),Ko=Ut(zb),Ob=v({},yn,{animationName:0,elapsedTime:0,pseudoElement:0}),Bb=Ut(Ob),Ub=v({},yn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hb=Ut(Ub),Kb=v({},yn,{data:0}),_d=Ut(Kb),Yb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gb={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"},Ib={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $b(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ib[e])?!!t[e]:!1}function Yo(){return $b}var qb=v({},rl,{key:function(e){if(e.key){var t=Yb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yo,charCode:function(e){return e.type==="keypress"?nn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fb=Ut(qb),Vb=v({},sr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jd=Ut(Vb),Xb=v({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yo}),Pb=Ut(Xb),Zb=v({},yn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qb=Ut(Zb),Wb=v({},sr,{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}),Jb=Ut(Wb),ey=v({},yn,{newState:0,oldState:0}),ty=Ut(ey),ny=[9,13,27,32],Go=Z&&"CompositionEvent"in window,Ja=null;Z&&"documentMode"in document&&(Ja=document.documentMode);var iy=Z&&"TextEvent"in window&&!Ja,Dd=Z&&(!Go||Ja&&8<Ja&&11>=Ja),zd=" ",Od=!1;function Bd(e,t){switch(e){case"keyup":return ny.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ud(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ua=!1;function ly(e,t){switch(e){case"compositionend":return Ud(t);case"keypress":return t.which!==32?null:(Od=!0,zd);case"textInput":return e=t.data,e===zd&&Od?null:e;default:return null}}function ay(e,t){if(ua)return e==="compositionend"||!Go&&Bd(e,t)?(e=Me(),bn=mn=At=null,ua=!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 Dd&&t.locale!=="ko"?null:t.data;default:return null}}var sy={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 Hd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sy[e.type]:t==="textarea"}function Kd(e,t,n,l){ai?si?si.push(l):si=[l]:ai=l,t=Pr(t,"onChange"),0<t.length&&(n=new Fn("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var es=null,ts=null;function ry(e){Cm(e,0)}function rr(e){var t=Nt(e);if($n(t))return e}function Yd(e,t){if(e==="change")return t}var Gd=!1;if(Z){var Io;if(Z){var $o="oninput"in document;if(!$o){var Id=document.createElement("div");Id.setAttribute("oninput","return;"),$o=typeof Id.oninput=="function"}Io=$o}else Io=!1;Gd=Io&&(!document.documentMode||9<document.documentMode)}function $d(){es&&(es.detachEvent("onpropertychange",qd),ts=es=null)}function qd(e){if(e.propertyName==="value"&&rr(ts)){var t=[];Kd(t,ts,e,oa(e)),Qa(ry,t)}}function oy(e,t,n){e==="focusin"?($d(),es=t,ts=n,es.attachEvent("onpropertychange",qd)):e==="focusout"&&$d()}function cy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return rr(ts)}function uy(e,t){if(e==="click")return rr(t)}function dy(e,t){if(e==="input"||e==="change")return rr(t)}function fy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var On=typeof Object.is=="function"?Object.is:fy;function ns(e,t){if(On(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(!ye.call(t,o)||!On(e[o],t[o]))return!1}return!0}function Fd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vd(e,t){var n=Fd(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=Fd(n)}}function Xd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qn(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=qn(e.document)}return t}function qo(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 hy=Z&&"documentMode"in document&&11>=document.documentMode,da=null,Fo=null,is=null,Vo=!1;function Zd(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vo||da==null||da!==qn(l)||(l=da,"selectionStart"in l&&qo(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}),is&&ns(is,l)||(is=l,l=Pr(Fo,"onSelect"),0<l.length&&(t=new Fn("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=da)))}function Bl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fa={animationend:Bl("Animation","AnimationEnd"),animationiteration:Bl("Animation","AnimationIteration"),animationstart:Bl("Animation","AnimationStart"),transitionrun:Bl("Transition","TransitionRun"),transitionstart:Bl("Transition","TransitionStart"),transitioncancel:Bl("Transition","TransitionCancel"),transitionend:Bl("Transition","TransitionEnd")},Xo={},Qd={};Z&&(Qd=document.createElement("div").style,"AnimationEvent"in window||(delete fa.animationend.animation,delete fa.animationiteration.animation,delete fa.animationstart.animation),"TransitionEvent"in window||delete fa.transitionend.transition);function Ul(e){if(Xo[e])return Xo[e];if(!fa[e])return e;var t=fa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Qd)return Xo[e]=t[n];return e}var Wd=Ul("animationend"),Jd=Ul("animationiteration"),ef=Ul("animationstart"),my=Ul("transitionrun"),py=Ul("transitionstart"),gy=Ul("transitioncancel"),tf=Ul("transitionend"),nf=new Map,Po="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(" ");Po.push("scrollEnd");function ri(e,t){nf.set(e,t),vi(t,[e])}var or=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)},Vn=[],ha=0,Zo=0;function cr(){for(var e=ha,t=Zo=ha=0;t<e;){var n=Vn[t];Vn[t++]=null;var l=Vn[t];Vn[t++]=null;var o=Vn[t];Vn[t++]=null;var c=Vn[t];if(Vn[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}c!==0&&lf(n,o,c)}}function ur(e,t,n,l){Vn[ha++]=e,Vn[ha++]=t,Vn[ha++]=n,Vn[ha++]=l,Zo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Qo(e,t,n,l){return ur(e,t,n,l),dr(e)}function Hl(e,t){return ur(e,null,null,t),dr(e)}function lf(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var o=!1,c=e.return;c!==null;)c.childLanes|=n,l=c.alternate,l!==null&&(l.childLanes|=n),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(o=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,o&&t!==null&&(o=31-at(n),e=c.hiddenUpdates,l=e[o],l===null?e[o]=[t]:l.push(t),t.lane=n|536870912),c):null}function dr(e){if(50<Ms)throw Ms=0,su=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ma={};function by(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 Bn(e,t,n,l){return new by(e,t,n,l)}function Wo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zi(e,t){var n=e.alternate;return n===null?(n=Bn(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 af(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 fr(e,t,n,l,o,c){var g=0;if(l=e,typeof e=="function")Wo(e)&&(g=1);else if(typeof e=="string")g=S0(e,n,Ge.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ie:return e=Bn(31,n,t,o),e.elementType=ie,e.lanes=c,e;case Y:return Kl(n.children,o,c,t);case A:g=8,o|=24;break;case z:return e=Bn(12,n,t,o|2),e.elementType=z,e.lanes=c,e;case ue:return e=Bn(13,n,t,o),e.elementType=ue,e.lanes=c,e;case W:return e=Bn(19,n,t,o),e.elementType=W,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:g=10;break e;case O:g=9;break e;case te:g=11;break e;case G:g=14;break e;case U:g=16,l=null;break e}g=29,n=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=Bn(g,n,t,o),t.elementType=e,t.type=l,t.lanes=c,t}function Kl(e,t,n,l){return e=Bn(7,e,l,t),e.lanes=n,e}function Jo(e,t,n){return e=Bn(6,e,null,t),e.lanes=n,e}function sf(e){var t=Bn(18,null,null,0);return t.stateNode=e,t}function ec(e,t,n){return t=Bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var rf=new WeakMap;function Xn(e,t){if(typeof e=="object"&&e!==null){var n=rf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ve(t)},rf.set(e,t),t)}return{value:e,source:t,stack:ve(t)}}var pa=[],ga=0,hr=null,ls=0,Pn=[],Zn=0,ol=null,wi=1,Si="";function Oi(e,t){pa[ga++]=ls,pa[ga++]=hr,hr=e,ls=t}function of(e,t,n){Pn[Zn++]=wi,Pn[Zn++]=Si,Pn[Zn++]=ol,ol=e;var l=wi;e=Si;var o=32-at(l)-1;l&=~(1<<o),n+=1;var c=32-at(t)+o;if(30<c){var g=o-o%5;c=(l&(1<<g)-1).toString(32),l>>=g,o-=g,wi=1<<32-at(t)+o|n<<o|l,Si=c+e}else wi=1<<c|n<<o|l,Si=e}function tc(e){e.return!==null&&(Oi(e,1),of(e,1,0))}function nc(e){for(;e===hr;)hr=pa[--ga],pa[ga]=null,ls=pa[--ga],pa[ga]=null;for(;e===ol;)ol=Pn[--Zn],Pn[Zn]=null,Si=Pn[--Zn],Pn[Zn]=null,wi=Pn[--Zn],Pn[Zn]=null}function cf(e,t){Pn[Zn++]=wi,Pn[Zn++]=Si,Pn[Zn++]=ol,wi=t.id,Si=t.overflow,ol=e}var cn=null,Lt=null,st=!1,cl=null,Qn=!1,ic=Error(r(519));function ul(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw as(Xn(t,e)),ic}function uf(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[Gt]=e,t[en]=l,n){case"dialog":et("cancel",t),et("close",t);break;case"iframe":case"object":case"embed":et("load",t);break;case"video":case"audio":for(n=0;n<Es.length;n++)et(Es[n],t);break;case"source":et("error",t);break;case"img":case"image":case"link":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"input":et("invalid",t),Di(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":et("invalid",t);break;case"textarea":et("invalid",t),ir(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||Em(t.textContent,n)?(l.popover!=null&&(et("beforetoggle",t),et("toggle",t)),l.onScroll!=null&&et("scroll",t),l.onScrollEnd!=null&&et("scrollend",t),l.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||ul(e,!0)}function df(e){for(cn=e.return;cn;)switch(cn.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:cn=cn.return}}function ba(e){if(e!==cn)return!1;if(!st)return df(e),st=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||wu(e.type,e.memoizedProps)),n=!n),n&&Lt&&ul(e),df(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Lt=Om(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Lt=Om(e)}else t===27?(t=Lt,Tl(e.type)?(e=Au,Au=null,Lt=e):Lt=t):Lt=cn?Jn(e.stateNode.nextSibling):null;return!0}function Yl(){Lt=cn=null,st=!1}function lc(){var e=cl;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),cl=null),e}function as(e){cl===null?cl=[e]:cl.push(e)}var ac=Ze(null),Gl=null,Bi=null;function dl(e,t,n){fe(ac,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=ac.current,Le(ac)}function sc(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 rc(e,t,n,l){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){var g=o.child;c=c.firstContext;e:for(;c!==null;){var x=c;c=o;for(var C=0;C<t.length;C++)if(x.context===t[C]){c.lanes|=n,x=c.alternate,x!==null&&(x.lanes|=n),sc(c.return,n,e),l||(g=null);break e}c=x.next}}else if(o.tag===18){if(g=o.return,g===null)throw Error(r(341));g.lanes|=n,c=g.alternate,c!==null&&(c.lanes|=n),sc(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 ya(e,t,n,l){e=null;for(var o=t,c=!1;o!==null;){if(!c){if((o.flags&524288)!==0)c=!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;On(o.pendingProps.value,g.value)||(e!==null?e.push(x):e=[x])}}else if(o===Be.current){if(g=o.alternate,g===null)throw Error(r(387));g.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(_s):e=[_s])}o=o.return}e!==null&&rc(t,e,n,l),t.flags|=262144}function mr(e){for(e=e.firstContext;e!==null;){if(!On(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Il(e){Gl=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function un(e){return ff(Gl,e)}function pr(e,t){return Gl===null&&Il(e),ff(e,t)}function ff(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(r(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var yy=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()})}},vy=a.unstable_scheduleCallback,xy=a.unstable_NormalPriority,Vt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oc(){return{controller:new yy,data:new Map,refCount:0}}function ss(e){e.refCount--,e.refCount===0&&vy(xy,function(){e.controller.abort()})}var rs=null,cc=0,va=0,xa=null;function wy(e,t){if(rs===null){var n=rs=[];cc=0,va=fu(),xa={status:"pending",value:void 0,then:function(l){n.push(l)}}}return cc++,t.then(hf,hf),t}function hf(){if(--cc===0&&rs!==null){xa!==null&&(xa.status="fulfilled");var e=rs;rs=null,va=0,xa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sy(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 mf=L.S;L.S=function(e,t){Qh=oe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&wy(e,t),mf!==null&&mf(e,t)};var $l=Ze(null);function uc(){var e=$l.current;return e!==null?e:Et.pooledCache}function gr(e,t){t===null?fe($l,$l.current):fe($l,t.pool)}function pf(){var e=uc();return e===null?null:{parent:Vt._currentValue,pool:e}}var wa=Error(r(460)),dc=Error(r(474)),br=Error(r(542)),yr={then:function(){}};function gf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bf(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,vf(e),e;default:if(typeof t.status=="string")t.then(Qt,Qt);else{if(e=Et,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,vf(e),e}throw Fl=t,wa}}function ql(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Fl=n,wa):n}}var Fl=null;function yf(){if(Fl===null)throw Error(r(459));var e=Fl;return Fl=null,e}function vf(e){if(e===wa||e===br)throw Error(r(483))}var Sa=null,os=0;function vr(e){var t=os;return os+=1,Sa===null&&(Sa=[]),bf(Sa,e,t)}function cs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xr(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 xf(e){function t(k,M){if(e){var _=k.deletions;_===null?(k.deletions=[M],k.flags|=16):_.push(M)}}function n(k,M){if(!e)return null;for(;M!==null;)t(k,M),M=M.sibling;return null}function l(k){for(var M=new Map;k!==null;)k.key!==null?M.set(k.key,k):M.set(k.index,k),k=k.sibling;return M}function o(k,M){return k=zi(k,M),k.index=0,k.sibling=null,k}function c(k,M,_){return k.index=_,e?(_=k.alternate,_!==null?(_=_.index,_<M?(k.flags|=67108866,M):_):(k.flags|=67108866,M)):(k.flags|=1048576,M)}function g(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function x(k,M,_,V){return M===null||M.tag!==6?(M=Jo(_,k.mode,V),M.return=k,M):(M=o(M,_),M.return=k,M)}function C(k,M,_,V){var Ae=_.type;return Ae===Y?$(k,M,_.props.children,V,_.key):M!==null&&(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&ql(Ae)===M.type)?(M=o(M,_.props),cs(M,_),M.return=k,M):(M=fr(_.type,_.key,_.props,null,k.mode,V),cs(M,_),M.return=k,M)}function j(k,M,_,V){return M===null||M.tag!==4||M.stateNode.containerInfo!==_.containerInfo||M.stateNode.implementation!==_.implementation?(M=ec(_,k.mode,V),M.return=k,M):(M=o(M,_.children||[]),M.return=k,M)}function $(k,M,_,V,Ae){return M===null||M.tag!==7?(M=Kl(_,k.mode,V,Ae),M.return=k,M):(M=o(M,_),M.return=k,M)}function P(k,M,_){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Jo(""+M,k.mode,_),M.return=k,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case T:return _=fr(M.type,M.key,M.props,null,k.mode,_),cs(_,M),_.return=k,_;case E:return M=ec(M,k.mode,_),M.return=k,M;case U:return M=ql(M),P(k,M,_)}if(Fe(M)||Ce(M))return M=Kl(M,k.mode,_,null),M.return=k,M;if(typeof M.then=="function")return P(k,vr(M),_);if(M.$$typeof===B)return P(k,pr(k,M),_);xr(k,M)}return null}function D(k,M,_,V){var Ae=M!==null?M.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return Ae!==null?null:x(k,M,""+_,V);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case T:return _.key===Ae?C(k,M,_,V):null;case E:return _.key===Ae?j(k,M,_,V):null;case U:return _=ql(_),D(k,M,_,V)}if(Fe(_)||Ce(_))return Ae!==null?null:$(k,M,_,V,null);if(typeof _.then=="function")return D(k,M,vr(_),V);if(_.$$typeof===B)return D(k,M,pr(k,_),V);xr(k,_)}return null}function K(k,M,_,V,Ae){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return k=k.get(_)||null,x(M,k,""+V,Ae);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case T:return k=k.get(V.key===null?_:V.key)||null,C(M,k,V,Ae);case E:return k=k.get(V.key===null?_:V.key)||null,j(M,k,V,Ae);case U:return V=ql(V),K(k,M,_,V,Ae)}if(Fe(V)||Ce(V))return k=k.get(_)||null,$(M,k,V,Ae,null);if(typeof V.then=="function")return K(k,M,_,vr(V),Ae);if(V.$$typeof===B)return K(k,M,_,pr(M,V),Ae);xr(M,V)}return null}function be(k,M,_,V){for(var Ae=null,ct=null,xe=M,$e=M=0,nt=null;xe!==null&&$e<_.length;$e++){xe.index>$e?(nt=xe,xe=null):nt=xe.sibling;var ut=D(k,xe,_[$e],V);if(ut===null){xe===null&&(xe=nt);break}e&&xe&&ut.alternate===null&&t(k,xe),M=c(ut,M,$e),ct===null?Ae=ut:ct.sibling=ut,ct=ut,xe=nt}if($e===_.length)return n(k,xe),st&&Oi(k,$e),Ae;if(xe===null){for(;$e<_.length;$e++)xe=P(k,_[$e],V),xe!==null&&(M=c(xe,M,$e),ct===null?Ae=xe:ct.sibling=xe,ct=xe);return st&&Oi(k,$e),Ae}for(xe=l(xe);$e<_.length;$e++)nt=K(xe,k,$e,_[$e],V),nt!==null&&(e&&nt.alternate!==null&&xe.delete(nt.key===null?$e:nt.key),M=c(nt,M,$e),ct===null?Ae=nt:ct.sibling=nt,ct=nt);return e&&xe.forEach(function(kl){return t(k,kl)}),st&&Oi(k,$e),Ae}function ke(k,M,_,V){if(_==null)throw Error(r(151));for(var Ae=null,ct=null,xe=M,$e=M=0,nt=null,ut=_.next();xe!==null&&!ut.done;$e++,ut=_.next()){xe.index>$e?(nt=xe,xe=null):nt=xe.sibling;var kl=D(k,xe,ut.value,V);if(kl===null){xe===null&&(xe=nt);break}e&&xe&&kl.alternate===null&&t(k,xe),M=c(kl,M,$e),ct===null?Ae=kl:ct.sibling=kl,ct=kl,xe=nt}if(ut.done)return n(k,xe),st&&Oi(k,$e),Ae;if(xe===null){for(;!ut.done;$e++,ut=_.next())ut=P(k,ut.value,V),ut!==null&&(M=c(ut,M,$e),ct===null?Ae=ut:ct.sibling=ut,ct=ut);return st&&Oi(k,$e),Ae}for(xe=l(xe);!ut.done;$e++,ut=_.next())ut=K(xe,k,$e,ut.value,V),ut!==null&&(e&&ut.alternate!==null&&xe.delete(ut.key===null?$e:ut.key),M=c(ut,M,$e),ct===null?Ae=ut:ct.sibling=ut,ct=ut);return e&&xe.forEach(function(j0){return t(k,j0)}),st&&Oi(k,$e),Ae}function xt(k,M,_,V){if(typeof _=="object"&&_!==null&&_.type===Y&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case T:e:{for(var Ae=_.key;M!==null;){if(M.key===Ae){if(Ae=_.type,Ae===Y){if(M.tag===7){n(k,M.sibling),V=o(M,_.props.children),V.return=k,k=V;break e}}else if(M.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===U&&ql(Ae)===M.type){n(k,M.sibling),V=o(M,_.props),cs(V,_),V.return=k,k=V;break e}n(k,M);break}else t(k,M);M=M.sibling}_.type===Y?(V=Kl(_.props.children,k.mode,V,_.key),V.return=k,k=V):(V=fr(_.type,_.key,_.props,null,k.mode,V),cs(V,_),V.return=k,k=V)}return g(k);case E:e:{for(Ae=_.key;M!==null;){if(M.key===Ae)if(M.tag===4&&M.stateNode.containerInfo===_.containerInfo&&M.stateNode.implementation===_.implementation){n(k,M.sibling),V=o(M,_.children||[]),V.return=k,k=V;break e}else{n(k,M);break}else t(k,M);M=M.sibling}V=ec(_,k.mode,V),V.return=k,k=V}return g(k);case U:return _=ql(_),xt(k,M,_,V)}if(Fe(_))return be(k,M,_,V);if(Ce(_)){if(Ae=Ce(_),typeof Ae!="function")throw Error(r(150));return _=Ae.call(_),ke(k,M,_,V)}if(typeof _.then=="function")return xt(k,M,vr(_),V);if(_.$$typeof===B)return xt(k,M,pr(k,_),V);xr(k,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,M!==null&&M.tag===6?(n(k,M.sibling),V=o(M,_),V.return=k,k=V):(n(k,M),V=Jo(_,k.mode,V),V.return=k,k=V),g(k)):n(k,M)}return function(k,M,_,V){try{os=0;var Ae=xt(k,M,_,V);return Sa=null,Ae}catch(xe){if(xe===wa||xe===br)throw xe;var ct=Bn(29,xe,null,k.mode);return ct.lanes=V,ct.return=k,ct}finally{}}}var Vl=xf(!0),wf=xf(!1),fl=!1;function fc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hc(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 hl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ml(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(dt&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,t=dr(e),lf(e,null,n),t}return ur(e,l,t,n),dr(e)}function us(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,Ji(e,n)}}function mc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,c=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};c===null?o=c=g:c=c.next=g,n=n.next}while(n!==null);c===null?o=c=t:c=c.next=t}else o=c=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:c,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 pc=!1;function ds(){if(pc){var e=xa;if(e!==null)throw e}}function fs(e,t,n,l){pc=!1;var o=e.updateQueue;fl=!1;var c=o.firstBaseUpdate,g=o.lastBaseUpdate,x=o.shared.pending;if(x!==null){o.shared.pending=null;var C=x,j=C.next;C.next=null,g===null?c=j:g.next=j,g=C;var $=e.alternate;$!==null&&($=$.updateQueue,x=$.lastBaseUpdate,x!==g&&(x===null?$.firstBaseUpdate=j:x.next=j,$.lastBaseUpdate=C))}if(c!==null){var P=o.baseState;g=0,$=j=C=null,x=c;do{var D=x.lane&-536870913,K=D!==x.lane;if(K?(tt&D)===D:(l&D)===D){D!==0&&D===va&&(pc=!0),$!==null&&($=$.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var be=e,ke=x;D=t;var xt=n;switch(ke.tag){case 1:if(be=ke.payload,typeof be=="function"){P=be.call(xt,P,D);break e}P=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=ke.payload,D=typeof be=="function"?be.call(xt,P,D):be,D==null)break e;P=v({},P,D);break e;case 2:fl=!0}}D=x.callback,D!==null&&(e.flags|=64,K&&(e.flags|=8192),K=o.callbacks,K===null?o.callbacks=[D]:K.push(D))}else K={lane:D,tag:x.tag,payload:x.payload,callback:x.callback,next:null},$===null?(j=$=K,C=P):$=$.next=K,g|=D;if(x=x.next,x===null){if(x=o.shared.pending,x===null)break;K=x,x=K.next,K.next=null,o.lastBaseUpdate=K,o.shared.pending=null}}while(!0);$===null&&(C=P),o.baseState=C,o.firstBaseUpdate=j,o.lastBaseUpdate=$,c===null&&(o.shared.lanes=0),vl|=g,e.lanes=g,e.memoizedState=P}}function Sf(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Cf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Sf(n[e],t)}var Ca=Ze(null),wr=Ze(0);function Tf(e,t){e=Vi,fe(wr,e),fe(Ca,t),Vi=e|t.baseLanes}function gc(){fe(wr,Vi),fe(Ca,Ca.current)}function bc(){Vi=wr.current,Le(Ca),Le(wr)}var Un=Ze(null),Wn=null;function pl(e){var t=e.alternate;fe(It,It.current&1),fe(Un,e),Wn===null&&(t===null||Ca.current!==null||t.memoizedState!==null)&&(Wn=e)}function yc(e){fe(It,It.current),fe(Un,e),Wn===null&&(Wn=e)}function Mf(e){e.tag===22?(fe(It,It.current),fe(Un,e),Wn===null&&(Wn=e)):gl()}function gl(){fe(It,It.current),fe(Un,Un.current)}function Hn(e){Le(Un),Wn===e&&(Wn=null),Le(It)}var It=Ze(0);function Sr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Tu(n)||Mu(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 Hi=0,Ye=null,yt=null,Xt=null,Cr=!1,Ta=!1,Xl=!1,Tr=0,hs=0,Ma=null,Cy=0;function Ht(){throw Error(r(321))}function vc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!On(e[n],t[n]))return!1;return!0}function xc(e,t,n,l,o,c){return Hi=c,Ye=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,L.H=e===null||e.memoizedState===null?oh:zc,Xl=!1,c=n(l,o),Xl=!1,Ta&&(c=Ef(t,n,l,o)),Af(e),c}function Af(e){L.H=gs;var t=yt!==null&&yt.next!==null;if(Hi=0,Xt=yt=Ye=null,Cr=!1,hs=0,Ma=null,t)throw Error(r(300));e===null||Pt||(e=e.dependencies,e!==null&&mr(e)&&(Pt=!0))}function Ef(e,t,n,l){Ye=e;var o=0;do{if(Ta&&(Ma=null),hs=0,Ta=!1,25<=o)throw Error(r(301));if(o+=1,Xt=yt=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}L.H=ch,c=t(n,l)}while(Ta);return c}function Ty(){var e=L.H,t=e.useState()[0];return t=typeof t.then=="function"?ms(t):t,e=e.useState()[0],(yt!==null?yt.memoizedState:null)!==e&&(Ye.flags|=1024),t}function wc(){var e=Tr!==0;return Tr=0,e}function Sc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Cc(e){if(Cr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Cr=!1}Hi=0,Xt=yt=Ye=null,Ta=!1,hs=Tr=0,Ma=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Ye.memoizedState=Xt=e:Xt=Xt.next=e,Xt}function $t(){if(yt===null){var e=Ye.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=Xt===null?Ye.memoizedState:Xt.next;if(t!==null)Xt=t,yt=e;else{if(e===null)throw Ye.alternate===null?Error(r(467)):Error(r(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Xt===null?Ye.memoizedState=Xt=e:Xt=Xt.next=e}return Xt}function Mr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ms(e){var t=hs;return hs+=1,Ma===null&&(Ma=[]),e=bf(Ma,e,t),t=Ye,(Xt===null?t.memoizedState:Xt.next)===null&&(t=t.alternate,L.H=t===null||t.memoizedState===null?oh:zc),e}function Ar(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ms(e);if(e.$$typeof===B)return un(e)}throw Error(r(438,String(e)))}function Tc(e){var t=null,n=Ye.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Ye.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=Mr(),Ye.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]=se;return t.index++,n}function Ki(e,t){return typeof t=="function"?t(e):t}function Er(e){var t=$t();return Mc(t,yt,e)}function Mc(e,t,n){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=e.baseQueue,c=l.pending;if(c!==null){if(o!==null){var g=o.next;o.next=c.next,c.next=g}t.baseQueue=o=c,l.pending=null}if(c=e.baseState,o===null)e.memoizedState=c;else{t=o.next;var x=g=null,C=null,j=t,$=!1;do{var P=j.lane&-536870913;if(P!==j.lane?(tt&P)===P:(Hi&P)===P){var D=j.revertLane;if(D===0)C!==null&&(C=C.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),P===va&&($=!0);else if((Hi&D)===D){j=j.next,D===va&&($=!0);continue}else P={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=P,g=c):C=C.next=P,Ye.lanes|=D,vl|=D;P=j.action,Xl&&n(c,P),c=j.hasEagerState?j.eagerState:n(c,P)}else D={lane:P,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},C===null?(x=C=D,g=c):C=C.next=D,Ye.lanes|=P,vl|=P;j=j.next}while(j!==null&&j!==t);if(C===null?g=c:C.next=x,!On(c,e.memoizedState)&&(Pt=!0,$&&(n=xa,n!==null)))throw n;e.memoizedState=c,e.baseState=g,e.baseQueue=C,l.lastRenderedState=c}return o===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Ac(e){var t=$t(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,c=t.memoizedState;if(o!==null){n.pending=null;var g=o=o.next;do c=e(c,g.action),g=g.next;while(g!==o);On(c,t.memoizedState)||(Pt=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),n.lastRenderedState=c}return[c,l]}function Nf(e,t,n){var l=Ye,o=$t(),c=st;if(c){if(n===void 0)throw Error(r(407));n=n()}else n=t();var g=!On((yt||o).memoizedState,n);if(g&&(o.memoizedState=n,Pt=!0),o=o.queue,kc(Rf.bind(null,l,o,e),[e]),o.getSnapshot!==t||g||Xt!==null&&Xt.memoizedState.tag&1){if(l.flags|=2048,Aa(9,{destroy:void 0},Lf.bind(null,l,o,n,t),null),Et===null)throw Error(r(349));c||(Hi&127)!==0||kf(l,t,n)}return n}function kf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ye.updateQueue,t===null?(t=Mr(),Ye.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lf(e,t,n,l){t.value=n,t.getSnapshot=l,_f(t)&&jf(e)}function Rf(e,t,n){return n(function(){_f(t)&&jf(e)})}function _f(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!On(e,n)}catch{return!0}}function jf(e){var t=Hl(e,2);t!==null&&_n(t,e,2)}function Ec(e){var t=vn();if(typeof e=="function"){var n=e;if(e=n(),Xl){qt(!0);try{n()}finally{qt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:e},t}function Df(e,t,n,l){return e.baseState=n,Mc(e,yt,typeof l=="function"?l:Ki)}function My(e,t,n,l,o){if(Lr(e))throw Error(r(485));if(e=t.action,e!==null){var c={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){c.listeners.push(g)}};L.T!==null?n(!0):c.isTransition=!1,l(c),n=t.pending,n===null?(c.next=t.pending=c,zf(t,c)):(c.next=n.next,t.pending=n.next=c)}}function zf(e,t){var n=t.action,l=t.payload,o=e.state;if(t.isTransition){var c=L.T,g={};L.T=g;try{var x=n(o,l),C=L.S;C!==null&&C(g,x),Of(e,t,x)}catch(j){Nc(e,t,j)}finally{c!==null&&g.types!==null&&(c.types=g.types),L.T=c}}else try{c=n(o,l),Of(e,t,c)}catch(j){Nc(e,t,j)}}function Of(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Bf(e,t,l)},function(l){return Nc(e,t,l)}):Bf(e,t,n)}function Bf(e,t,n){t.status="fulfilled",t.value=n,Uf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zf(e,n)))}function Nc(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,Uf(t),t=t.next;while(t!==l)}e.action=null}function Uf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Hf(e,t){return t}function Kf(e,t){if(st){var n=Et.formState;if(n!==null){e:{var l=Ye;if(st){if(Lt){t:{for(var o=Lt,c=Qn;o.nodeType!==8;){if(!c){o=null;break t}if(o=Jn(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){Lt=Jn(o.nextSibling),l=o.data==="F!";break e}}ul(l)}l=!1}l&&(t=n[0])}}return n=vn(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hf,lastRenderedState:t},n.queue=l,n=ah.bind(null,Ye,l),l.dispatch=n,l=Ec(!1),c=Dc.bind(null,Ye,!1,l.queue),l=vn(),o={state:t,dispatch:null,action:e,pending:null},l.queue=o,n=My.bind(null,Ye,o,c,n),o.dispatch=n,l.memoizedState=e,[t,n,!1]}function Yf(e){var t=$t();return Gf(t,yt,e)}function Gf(e,t,n){if(t=Mc(e,t,Hf)[0],e=Er(Ki)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=ms(t)}catch(g){throw g===wa?br:g}else l=t;t=$t();var o=t.queue,c=o.dispatch;return n!==t.memoizedState&&(Ye.flags|=2048,Aa(9,{destroy:void 0},Ay.bind(null,o,n),null)),[l,c,e]}function Ay(e,t){e.action=t}function If(e){var t=$t(),n=yt;if(n!==null)return Gf(t,n,e);$t(),t=t.memoizedState,n=$t();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Aa(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Ye.updateQueue,t===null&&(t=Mr(),Ye.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 $f(){return $t().memoizedState}function Nr(e,t,n,l){var o=vn();Ye.flags|=e,o.memoizedState=Aa(1|t,{destroy:void 0},n,l===void 0?null:l)}function kr(e,t,n,l){var o=$t();l=l===void 0?null:l;var c=o.memoizedState.inst;yt!==null&&l!==null&&vc(l,yt.memoizedState.deps)?o.memoizedState=Aa(t,c,n,l):(Ye.flags|=e,o.memoizedState=Aa(1|t,c,n,l))}function qf(e,t){Nr(8390656,8,e,t)}function kc(e,t){kr(2048,8,e,t)}function Ey(e){Ye.flags|=4;var t=Ye.updateQueue;if(t===null)t=Mr(),Ye.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ff(e){var t=$t().memoizedState;return Ey({ref:t,nextImpl:e}),function(){if((dt&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Vf(e,t){return kr(4,2,e,t)}function Xf(e,t){return kr(4,4,e,t)}function Pf(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 Zf(e,t,n){n=n!=null?n.concat([e]):null,kr(4,4,Pf.bind(null,t,e),n)}function Lc(){}function Qf(e,t){var n=$t();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&vc(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Wf(e,t){var n=$t();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&vc(t,l[1]))return l[0];if(l=e(),Xl){qt(!0);try{e()}finally{qt(!1)}}return n.memoizedState=[l,t],l}function Rc(e,t,n){return n===void 0||(Hi&1073741824)!==0&&(tt&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Jh(),Ye.lanes|=e,vl|=e,n)}function Jf(e,t,n,l){return On(n,t)?n:Ca.current!==null?(e=Rc(e,n,l),On(e,t)||(Pt=!0),e):(Hi&42)===0||(Hi&1073741824)!==0&&(tt&261930)===0?(Pt=!0,e.memoizedState=n):(e=Jh(),Ye.lanes|=e,vl|=e,t)}function eh(e,t,n,l,o){var c=I.p;I.p=c!==0&&8>c?c:8;var g=L.T,x={};L.T=x,Dc(e,!1,t,n);try{var C=o(),j=L.S;if(j!==null&&j(x,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var $=Sy(C,l);ps(e,t,$,Gn(e))}else ps(e,t,l,Gn(e))}catch(P){ps(e,t,{then:function(){},status:"rejected",reason:P},Gn())}finally{I.p=c,g!==null&&x.types!==null&&(g.types=x.types),L.T=g}}function Ny(){}function _c(e,t,n,l){if(e.tag!==5)throw Error(r(476));var o=th(e).queue;eh(e,o,t,le,n===null?Ny:function(){return nh(e),n(l)})}function th(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nh(e){var t=th(e);t.next===null&&(t=e.alternate.memoizedState),ps(e,t.next.queue,{},Gn())}function jc(){return un(_s)}function ih(){return $t().memoizedState}function lh(){return $t().memoizedState}function ky(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Gn();e=hl(n);var l=ml(t,e,n);l!==null&&(_n(l,t,n),us(l,t,n)),t={cache:oc()},e.payload=t;return}t=t.return}}function Ly(e,t,n){var l=Gn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Lr(e)?sh(t,n):(n=Qo(e,t,n,l),n!==null&&(_n(n,e,l),rh(n,t,l)))}function ah(e,t,n){var l=Gn();ps(e,t,n,l)}function ps(e,t,n,l){var o={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lr(e))sh(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var g=t.lastRenderedState,x=c(g,n);if(o.hasEagerState=!0,o.eagerState=x,On(x,g))return ur(e,t,o,0),Et===null&&cr(),!1}catch{}finally{}if(n=Qo(e,t,o,l),n!==null)return _n(n,e,l),rh(n,t,l),!0}return!1}function Dc(e,t,n,l){if(l={lane:2,revertLane:fu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Lr(e)){if(t)throw Error(r(479))}else t=Qo(e,n,l,2),t!==null&&_n(t,e,2)}function Lr(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function sh(e,t){Ta=Cr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rh(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ji(e,n)}}var gs={readContext:un,use:Ar,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};gs.useEffectEvent=Ht;var oh={readContext:un,use:Ar,useCallback:function(e,t){return vn().memoizedState=[e,t===void 0?null:t],e},useContext:un,useEffect:qf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Nr(4194308,4,Pf.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Nr(4194308,4,e,t)},useInsertionEffect:function(e,t){Nr(4,2,e,t)},useMemo:function(e,t){var n=vn();t=t===void 0?null:t;var l=e();if(Xl){qt(!0);try{e()}finally{qt(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=vn();if(n!==void 0){var o=n(t);if(Xl){qt(!0);try{n(t)}finally{qt(!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=Ly.bind(null,Ye,e),[l.memoizedState,e]},useRef:function(e){var t=vn();return e={current:e},t.memoizedState=e},useState:function(e){e=Ec(e);var t=e.queue,n=ah.bind(null,Ye,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Lc,useDeferredValue:function(e,t){var n=vn();return Rc(n,e,t)},useTransition:function(){var e=Ec(!1);return e=eh.bind(null,Ye,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Ye,o=vn();if(st){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Et===null)throw Error(r(349));(tt&127)!==0||kf(l,t,n)}o.memoizedState=n;var c={value:n,getSnapshot:t};return o.queue=c,qf(Rf.bind(null,l,c,e),[e]),l.flags|=2048,Aa(9,{destroy:void 0},Lf.bind(null,l,c,n,t),null),n},useId:function(){var e=vn(),t=Et.identifierPrefix;if(st){var n=Si,l=wi;n=(l&~(1<<32-at(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Tr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Cy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:jc,useFormState:Kf,useActionState:Kf,useOptimistic:function(e){var t=vn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Dc.bind(null,Ye,!0,n),n.dispatch=t,[e,t]},useMemoCache:Tc,useCacheRefresh:function(){return vn().memoizedState=ky.bind(null,Ye)},useEffectEvent:function(e){var t=vn(),n={impl:e};return t.memoizedState=n,function(){if((dt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},zc={readContext:un,use:Ar,useCallback:Qf,useContext:un,useEffect:kc,useImperativeHandle:Zf,useInsertionEffect:Vf,useLayoutEffect:Xf,useMemo:Wf,useReducer:Er,useRef:$f,useState:function(){return Er(Ki)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=$t();return Jf(n,yt.memoizedState,e,t)},useTransition:function(){var e=Er(Ki)[0],t=$t().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:Nf,useId:ih,useHostTransitionStatus:jc,useFormState:Yf,useActionState:Yf,useOptimistic:function(e,t){var n=$t();return Df(n,yt,e,t)},useMemoCache:Tc,useCacheRefresh:lh};zc.useEffectEvent=Ff;var ch={readContext:un,use:Ar,useCallback:Qf,useContext:un,useEffect:kc,useImperativeHandle:Zf,useInsertionEffect:Vf,useLayoutEffect:Xf,useMemo:Wf,useReducer:Ac,useRef:$f,useState:function(){return Ac(Ki)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=$t();return yt===null?Rc(n,e,t):Jf(n,yt.memoizedState,e,t)},useTransition:function(){var e=Ac(Ki)[0],t=$t().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:Nf,useId:ih,useHostTransitionStatus:jc,useFormState:If,useActionState:If,useOptimistic:function(e,t){var n=$t();return yt!==null?Df(n,yt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Tc,useCacheRefresh:lh};ch.useEffectEvent=Ff;function Oc(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 Bc={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Gn(),o=hl(l);o.payload=t,n!=null&&(o.callback=n),t=ml(e,o,l),t!==null&&(_n(t,e,l),us(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Gn(),o=hl(l);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=ml(e,o,l),t!==null&&(_n(t,e,l),us(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gn(),l=hl(n);l.tag=2,t!=null&&(l.callback=t),t=ml(e,l,n),t!==null&&(_n(t,e,n),us(t,e,n))}};function uh(e,t,n,l,o,c,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,c,g):t.prototype&&t.prototype.isPureReactComponent?!ns(n,l)||!ns(o,c):!0}function dh(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&&Bc.enqueueReplaceState(t,t.state,null)}function Pl(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 fh(e){or(e)}function hh(e){console.error(e)}function mh(e){or(e)}function Rr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function ph(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 Uc(e,t,n){return n=hl(n),n.tag=3,n.payload={element:null},n.callback=function(){Rr(e,t)},n}function gh(e){return e=hl(e),e.tag=3,e}function bh(e,t,n,l){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var c=l.value;e.payload=function(){return o(c)},e.callback=function(){ph(t,n,l)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){ph(t,n,l),typeof o!="function"&&(xl===null?xl=new Set([this]):xl.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function Ry(e,t,n,l,o){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&ya(t,n,o,!0),n=Un.current,n!==null){switch(n.tag){case 31:case 13:return Wn===null?Ir():n.alternate===null&&Kt===0&&(Kt=3),n.flags&=-257,n.flags|=65536,n.lanes=o,l===yr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),cu(e,l,o)),!1;case 22:return n.flags|=65536,l===yr?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)),cu(e,l,o)),!1}throw Error(r(435,n.tag))}return cu(e,l,o),Ir(),!1}if(st)return t=Un.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,l!==ic&&(e=Error(r(422),{cause:l}),as(Xn(e,n)))):(l!==ic&&(t=Error(r(423),{cause:l}),as(Xn(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,l=Xn(l,n),o=Uc(e.stateNode,l,o),mc(e,o),Kt!==4&&(Kt=2)),!1;var c=Error(r(520),{cause:l});if(c=Xn(c,n),Ts===null?Ts=[c]:Ts.push(c),Kt!==4&&(Kt=2),t===null)return!0;l=Xn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=Uc(n.stateNode,l,e),mc(n,e),!1;case 1:if(t=n.type,c=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(xl===null||!xl.has(c))))return n.flags|=65536,o&=-o,n.lanes|=o,o=gh(o),bh(o,e,n,l),mc(n,o),!1}n=n.return}while(n!==null);return!1}var Hc=Error(r(461)),Pt=!1;function dn(e,t,n,l){t.child=e===null?wf(t,null,n,l):Vl(t,e.child,n,l)}function yh(e,t,n,l,o){n=n.render;var c=t.ref;if("ref"in l){var g={};for(var x in l)x!=="ref"&&(g[x]=l[x])}else g=l;return Il(t),l=xc(e,t,n,g,c,o),x=wc(),e!==null&&!Pt?(Sc(e,t,o),Yi(e,t,o)):(st&&x&&tc(t),t.flags|=1,dn(e,t,l,o),t.child)}function vh(e,t,n,l,o){if(e===null){var c=n.type;return typeof c=="function"&&!Wo(c)&&c.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=c,xh(e,t,c,l,o)):(e=fr(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Vc(e,o)){var g=c.memoizedProps;if(n=n.compare,n=n!==null?n:ns,n(g,l)&&e.ref===t.ref)return Yi(e,t,o)}return t.flags|=1,e=zi(c,l),e.ref=t.ref,e.return=t,t.child=e}function xh(e,t,n,l,o){if(e!==null){var c=e.memoizedProps;if(ns(c,l)&&e.ref===t.ref)if(Pt=!1,t.pendingProps=l=c,Vc(e,o))(e.flags&131072)!==0&&(Pt=!0);else return t.lanes=e.lanes,Yi(e,t,o)}return Kc(e,t,n,l,o)}function wh(e,t,n,l){var o=l.children,c=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(c=c!==null?c.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&~c}else l=0,t.child=null;return Sh(e,t,c,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&gr(t,c!==null?c.cachePool:null),c!==null?Tf(t,c):gc(),Mf(t);else return l=t.lanes=536870912,Sh(e,t,c!==null?c.baseLanes|n:n,n,l)}else c!==null?(gr(t,c.cachePool),Tf(t,c),gl(),t.memoizedState=null):(e!==null&&gr(t,null),gc(),gl());return dn(e,t,o,n),t.child}function bs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sh(e,t,n,l,o){var c=uc();return c=c===null?null:{parent:Vt._currentValue,pool:c},t.memoizedState={baseLanes:n,cachePool:c},e!==null&&gr(t,null),gc(),Mf(t),e!==null&&ya(e,t,l,!0),t.childLanes=o,null}function _r(e,t){return t=Dr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Ch(e,t,n){return Vl(t,e.child,null,n),e=_r(t,t.pendingProps),e.flags|=2,Hn(t),t.memoizedState=null,e}function _y(e,t,n){var l=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(st){if(l.mode==="hidden")return e=_r(t,l),t.lanes=536870912,bs(null,e);if(yc(t),(e=Lt)?(e=zm(e,Qn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ol!==null?{id:wi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},n=sf(e),n.return=t,t.child=n,cn=t,Lt=null)):e=null,e===null)throw ul(t);return t.lanes=536870912,null}return _r(t,l)}var c=e.memoizedState;if(c!==null){var g=c.dehydrated;if(yc(t),o)if(t.flags&256)t.flags&=-257,t=Ch(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Pt||ya(e,t,n,!1),o=(n&e.childLanes)!==0,Pt||o){if(l=Et,l!==null&&(g=li(l,n),g!==0&&g!==c.retryLane))throw c.retryLane=g,Hl(e,g),_n(l,e,g),Hc;Ir(),t=Ch(e,t,n)}else e=c.treeContext,Lt=Jn(g.nextSibling),cn=t,st=!0,cl=null,Qn=!1,e!==null&&cf(t,e),t=_r(t,l),t.flags|=4096;return t}return e=zi(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jr(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 Kc(e,t,n,l,o){return Il(t),n=xc(e,t,n,l,void 0,o),l=wc(),e!==null&&!Pt?(Sc(e,t,o),Yi(e,t,o)):(st&&l&&tc(t),t.flags|=1,dn(e,t,n,o),t.child)}function Th(e,t,n,l,o,c){return Il(t),t.updateQueue=null,n=Ef(t,l,n,o),Af(e),l=wc(),e!==null&&!Pt?(Sc(e,t,c),Yi(e,t,c)):(st&&l&&tc(t),t.flags|=1,dn(e,t,n,c),t.child)}function Mh(e,t,n,l,o){if(Il(t),t.stateNode===null){var c=ma,g=n.contextType;typeof g=="object"&&g!==null&&(c=un(g)),c=new n(l,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Bc,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=l,c.state=t.memoizedState,c.refs={},fc(t),g=n.contextType,c.context=typeof g=="object"&&g!==null?un(g):ma,c.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(Oc(t,n,g,l),c.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(g=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),g!==c.state&&Bc.enqueueReplaceState(c,c.state,null),fs(t,l,c,o),ds(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){c=t.stateNode;var x=t.memoizedProps,C=Pl(n,x);c.props=C;var j=c.context,$=n.contextType;g=ma,typeof $=="object"&&$!==null&&(g=un($));var P=n.getDerivedStateFromProps;$=typeof P=="function"||typeof c.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,$||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(x||j!==g)&&dh(t,c,l,g),fl=!1;var D=t.memoizedState;c.state=D,fs(t,l,c,o),ds(),j=t.memoizedState,x||D!==j||fl?(typeof P=="function"&&(Oc(t,n,P,l),j=t.memoizedState),(C=fl||uh(t,n,C,l,D,j,g))?($||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=j),c.props=l,c.state=j,c.context=g,l=C):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{c=t.stateNode,hc(e,t),g=t.memoizedProps,$=Pl(n,g),c.props=$,P=t.pendingProps,D=c.context,j=n.contextType,C=ma,typeof j=="object"&&j!==null&&(C=un(j)),x=n.getDerivedStateFromProps,(j=typeof x=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(g!==P||D!==C)&&dh(t,c,l,C),fl=!1,D=t.memoizedState,c.state=D,fs(t,l,c,o),ds();var K=t.memoizedState;g!==P||D!==K||fl||e!==null&&e.dependencies!==null&&mr(e.dependencies)?(typeof x=="function"&&(Oc(t,n,x,l),K=t.memoizedState),($=fl||uh(t,n,$,l,D,K,C)||e!==null&&e.dependencies!==null&&mr(e.dependencies))?(j||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(l,K,C),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(l,K,C)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=K),c.props=l,c.state=K,c.context=C,l=$):(typeof c.componentDidUpdate!="function"||g===e.memoizedProps&&D===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&D===e.memoizedState||(t.flags|=1024),l=!1)}return c=l,jr(e,t),l=(t.flags&128)!==0,c||l?(c=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&l?(t.child=Vl(t,e.child,null,o),t.child=Vl(t,null,n,o)):dn(e,t,n,o),t.memoizedState=c.state,e=t.child):e=Yi(e,t,o),e}function Ah(e,t,n,l){return Yl(),t.flags|=256,dn(e,t,n,l),t.child}var Yc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:pf()}}function Ic(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Yn),e}function Eh(e,t,n){var l=t.pendingProps,o=!1,c=(t.flags&128)!==0,g;if((g=c)||(g=e!==null&&e.memoizedState===null?!1:(It.current&2)!==0),g&&(o=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(st){if(o?pl(t):gl(),(e=Lt)?(e=zm(e,Qn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ol!==null?{id:wi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},n=sf(e),n.return=t,t.child=n,cn=t,Lt=null)):e=null,e===null)throw ul(t);return Mu(e)?t.lanes=32:t.lanes=536870912,null}var x=l.children;return l=l.fallback,o?(gl(),o=t.mode,x=Dr({mode:"hidden",children:x},o),l=Kl(l,o,n,null),x.return=t,l.return=t,x.sibling=l,t.child=x,l=t.child,l.memoizedState=Gc(n),l.childLanes=Ic(e,g,n),t.memoizedState=Yc,bs(null,l)):(pl(t),$c(t,x))}var C=e.memoizedState;if(C!==null&&(x=C.dehydrated,x!==null)){if(c)t.flags&256?(pl(t),t.flags&=-257,t=qc(e,t,n)):t.memoizedState!==null?(gl(),t.child=e.child,t.flags|=128,t=null):(gl(),x=l.fallback,o=t.mode,l=Dr({mode:"visible",children:l.children},o),x=Kl(x,o,n,null),x.flags|=2,l.return=t,x.return=t,l.sibling=x,t.child=l,Vl(t,e.child,null,n),l=t.child,l.memoizedState=Gc(n),l.childLanes=Ic(e,g,n),t.memoizedState=Yc,t=bs(null,l));else if(pl(t),Mu(x)){if(g=x.nextSibling&&x.nextSibling.dataset,g)var j=g.dgst;g=j,l=Error(r(419)),l.stack="",l.digest=g,as({value:l,source:null,stack:null}),t=qc(e,t,n)}else if(Pt||ya(e,t,n,!1),g=(n&e.childLanes)!==0,Pt||g){if(g=Et,g!==null&&(l=li(g,n),l!==0&&l!==C.retryLane))throw C.retryLane=l,Hl(e,l),_n(g,e,l),Hc;Tu(x)||Ir(),t=qc(e,t,n)}else Tu(x)?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,Lt=Jn(x.nextSibling),cn=t,st=!0,cl=null,Qn=!1,e!==null&&cf(t,e),t=$c(t,l.children),t.flags|=4096);return t}return o?(gl(),x=l.fallback,o=t.mode,C=e.child,j=C.sibling,l=zi(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&65011712,j!==null?x=zi(j,x):(x=Kl(x,o,n,null),x.flags|=2),x.return=t,l.return=t,l.sibling=x,t.child=l,bs(null,l),l=t.child,x=e.child.memoizedState,x===null?x=Gc(n):(o=x.cachePool,o!==null?(C=Vt._currentValue,o=o.parent!==C?{parent:C,pool:C}:o):o=pf(),x={baseLanes:x.baseLanes|n,cachePool:o}),l.memoizedState=x,l.childLanes=Ic(e,g,n),t.memoizedState=Yc,bs(e.child,l)):(pl(t),n=e.child,e=n.sibling,n=zi(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 $c(e,t){return t=Dr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Dr(e,t){return e=Bn(22,e,null,t),e.lanes=0,e}function qc(e,t,n){return Vl(t,e.child,null,n),e=$c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nh(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),sc(e.return,t,n)}function Fc(e,t,n,l,o,c){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o,treeForkCount:c}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=n,g.tailMode=o,g.treeForkCount=c)}function kh(e,t,n){var l=t.pendingProps,o=l.revealOrder,c=l.tail;l=l.children;var g=It.current,x=(g&2)!==0;if(x?(g=g&1|2,t.flags|=128):g&=1,fe(It,g),dn(e,t,l,n),l=st?ls:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nh(e,n,t);else if(e.tag===19)Nh(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&&Sr(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Fc(t,!1,o,n,c,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&&Sr(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Fc(t,!0,n,null,c,l);break;case"together":Fc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function Yi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),vl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ya(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=zi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=zi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Vc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&mr(e)))}function jy(e,t,n){switch(t.tag){case 3:it(t,t.stateNode.containerInfo),dl(t,Vt,e.memoizedState.cache),Yl();break;case 27:case 5:Ke(t);break;case 4:it(t,t.stateNode.containerInfo);break;case 10:dl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,yc(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(pl(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Eh(e,t,n):(pl(t),e=Yi(e,t,n),e!==null?e.sibling:null);pl(t);break;case 19:var o=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(ya(e,t,n,!1),l=(n&t.childLanes)!==0),o){if(l)return kh(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),fe(It,It.current),l)break;return null;case 22:return t.lanes=0,wh(e,t,n,t.pendingProps);case 24:dl(t,Vt,e.memoizedState.cache)}return Yi(e,t,n)}function Lh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pt=!0;else{if(!Vc(e,n)&&(t.flags&128)===0)return Pt=!1,jy(e,t,n);Pt=(e.flags&131072)!==0}else Pt=!1,st&&(t.flags&1048576)!==0&&of(t,ls,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=ql(t.elementType),t.type=e,typeof e=="function")Wo(e)?(l=Pl(e,l),t.tag=1,t=Mh(null,t,e,l,n)):(t.tag=0,t=Kc(null,t,e,l,n));else{if(e!=null){var o=e.$$typeof;if(o===te){t.tag=11,t=yh(null,t,e,l,n);break e}else if(o===G){t.tag=14,t=vh(null,t,e,l,n);break e}}throw t=rt(e)||e,Error(r(306,t,""))}}return t;case 0:return Kc(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,o=Pl(l,t.pendingProps),Mh(e,t,l,o,n);case 3:e:{if(it(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var c=t.memoizedState;o=c.element,hc(e,t),fs(t,l,null,n);var g=t.memoizedState;if(l=g.cache,dl(t,Vt,l),l!==c.cache&&rc(t,[Vt],n,!0),ds(),l=g.element,c.isDehydrated)if(c={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Ah(e,t,l,n);break e}else if(l!==o){o=Xn(Error(r(424)),t),as(o),t=Ah(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(Lt=Jn(e.firstChild),cn=t,st=!0,cl=null,Qn=!0,n=wf(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Yl(),l===o){t=Yi(e,t,n);break e}dn(e,t,l,n)}t=t.child}return t;case 26:return jr(e,t),e===null?(n=Ym(t.type,null,t.pendingProps,null))?t.memoizedState=n:st||(n=t.type,e=t.pendingProps,l=Zr(F.current).createElement(n),l[Gt]=t,l[en]=e,fn(l,n,e),Tt(l),t.stateNode=l):t.memoizedState=Ym(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ke(t),e===null&&st&&(l=t.stateNode=Um(t.type,t.pendingProps,F.current),cn=t,Qn=!0,o=Lt,Tl(t.type)?(Au=o,Lt=Jn(l.firstChild)):Lt=o),dn(e,t,t.pendingProps.children,n),jr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&st&&((o=l=Lt)&&(l=c0(l,t.type,t.pendingProps,Qn),l!==null?(t.stateNode=l,cn=t,Lt=Jn(l.firstChild),Qn=!1,o=!0):o=!1),o||ul(t)),Ke(t),o=t.type,c=t.pendingProps,g=e!==null?e.memoizedProps:null,l=c.children,wu(o,c)?l=null:g!==null&&wu(o,g)&&(t.flags|=32),t.memoizedState!==null&&(o=xc(e,t,Ty,null,null,n),_s._currentValue=o),jr(e,t),dn(e,t,l,n),t.child;case 6:return e===null&&st&&((e=n=Lt)&&(n=u0(n,t.pendingProps,Qn),n!==null?(t.stateNode=n,cn=t,Lt=null,e=!0):e=!1),e||ul(t)),null;case 13:return Eh(e,t,n);case 4:return it(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Vl(t,null,l,n):dn(e,t,l,n),t.child;case 11:return yh(e,t,t.type,t.pendingProps,n);case 7:return dn(e,t,t.pendingProps,n),t.child;case 8:return dn(e,t,t.pendingProps.children,n),t.child;case 12:return dn(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,dl(t,t.type,l.value),dn(e,t,l.children,n),t.child;case 9:return o=t.type._context,l=t.pendingProps.children,Il(t),o=un(o),l=l(o),t.flags|=1,dn(e,t,l,n),t.child;case 14:return vh(e,t,t.type,t.pendingProps,n);case 15:return xh(e,t,t.type,t.pendingProps,n);case 19:return kh(e,t,n);case 31:return _y(e,t,n);case 22:return wh(e,t,n,t.pendingProps);case 24:return Il(t),l=un(Vt),e===null?(o=uc(),o===null&&(o=Et,c=oc(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=n),o=c),t.memoizedState={parent:l,cache:o},fc(t),dl(t,Vt,o)):((e.lanes&n)!==0&&(hc(e,t),fs(t,null,null,n),ds()),o=e.memoizedState,c=t.memoizedState,o.parent!==l?(o={parent:l,cache:l},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),dl(t,Vt,l)):(l=c.cache,dl(t,Vt,l),l!==o.cache&&rc(t,[Vt],n,!0))),dn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function Gi(e){e.flags|=4}function Xc(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(im())e.flags|=8192;else throw Fl=yr,dc}else e.flags&=-16777217}function Rh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Fm(t))if(im())e.flags|=8192;else throw Fl=yr,dc}function zr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?In():536870912,e.lanes|=t,La|=t)}function ys(e,t){if(!st)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 Rt(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 Dy(e,t,n){var l=t.pendingProps;switch(nc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(t),null;case 1:return Rt(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Ui(Vt),we(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ba(t)?Gi(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,lc())),Rt(t),null;case 26:var o=t.type,c=t.memoizedState;return e===null?(Gi(t),c!==null?(Rt(t),Rh(t,c)):(Rt(t),Xc(t,o,null,l,n))):c?c!==e.memoizedState?(Gi(t),Rt(t),Rh(t,c)):(Rt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&Gi(t),Rt(t),Xc(t,o,e,l,n)),null;case 27:if(gt(t),n=F.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Gi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Rt(t),null}e=Ge.current,ba(t)?uf(t):(e=Um(o,l,n),t.stateNode=e,Gi(t))}return Rt(t),null;case 5:if(gt(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Gi(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Rt(t),null}if(c=Ge.current,ba(t))uf(t);else{var g=Zr(F.current);switch(c){case 1:c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":c=g.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":c=g.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":c=g.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?c.multiple=!0:l.size&&(c.size=l.size);break;default:c=typeof l.is=="string"?g.createElement(o,{is:l.is}):g.createElement(o)}}c[Gt]=t,c[en]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)c.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=c;e:switch(fn(c,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&&Gi(t)}}return Rt(t),Xc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Gi(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=F.current,ba(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,o=cn,o!==null)switch(o.tag){case 27:case 5:l=o.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Em(e.nodeValue,n)),e||ul(t,!0)}else e=Zr(e).createTextNode(l),e[Gt]=t,t.stateNode=e}return Rt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=ba(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[Gt]=t}else Yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),e=!1}else n=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Hn(t),t):(Hn(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Rt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=ba(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[Gt]=t}else Yl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),o=!1}else o=lc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Hn(t),t):(Hn(t),null)}return Hn(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),c=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(c=l.memoizedState.cachePool.pool),c!==o&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),zr(t,t.updateQueue),Rt(t),null);case 4:return we(),e===null&&gu(t.stateNode.containerInfo),Rt(t),null;case 10:return Ui(t.type),Rt(t),null;case 19:if(Le(It),l=t.memoizedState,l===null)return Rt(t),null;if(o=(t.flags&128)!==0,c=l.rendering,c===null)if(o)ys(l,!1);else{if(Kt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Sr(e),c!==null){for(t.flags|=128,ys(l,!1),e=c.updateQueue,t.updateQueue=e,zr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)af(n,e),n=n.sibling;return fe(It,It.current&1|2),st&&Oi(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&oe()>Kr&&(t.flags|=128,o=!0,ys(l,!1),t.lanes=4194304)}else{if(!o)if(e=Sr(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,zr(t,e),ys(l,!0),l.tail===null&&l.tailMode==="hidden"&&!c.alternate&&!st)return Rt(t),null}else 2*oe()-l.renderingStartTime>Kr&&n!==536870912&&(t.flags|=128,o=!0,ys(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(e=l.last,e!==null?e.sibling=c:t.child=c,l.last=c)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=oe(),e.sibling=null,n=It.current,fe(It,o?n&1|2:n&1),st&&Oi(t,l.treeForkCount),e):(Rt(t),null);case 22:case 23:return Hn(t),bc(),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&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),n=t.updateQueue,n!==null&&zr(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&&Le($l),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(Vt),Rt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function zy(e,t){switch(nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(Vt),we(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gt(t),null;case 31:if(t.memoizedState!==null){if(Hn(t),t.alternate===null)throw Error(r(340));Yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Yl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(It),null;case 4:return we(),null;case 10:return Ui(t.type),null;case 22:case 23:return Hn(t),bc(),e!==null&&Le($l),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(Vt),null;case 25:return null;default:return null}}function _h(e,t){switch(nc(t),t.tag){case 3:Ui(Vt),we();break;case 26:case 27:case 5:gt(t);break;case 4:we();break;case 31:t.memoizedState!==null&&Hn(t);break;case 13:Hn(t);break;case 19:Le(It);break;case 10:Ui(t.type);break;case 22:case 23:Hn(t),bc(),e!==null&&Le($l);break;case 24:Ui(Vt)}}function vs(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 c=n.create,g=n.inst;l=c(),g.destroy=l}n=n.next}while(n!==o)}}catch(x){pt(t,t.return,x)}}function bl(e,t,n){try{var l=t.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var c=o.next;l=c;do{if((l.tag&e)===e){var g=l.inst,x=g.destroy;if(x!==void 0){g.destroy=void 0,o=t;var C=n,j=x;try{j()}catch($){pt(o,C,$)}}}l=l.next}while(l!==c)}}catch($){pt(t,t.return,$)}}function jh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Cf(t,n)}catch(l){pt(e,e.return,l)}}}function Dh(e,t,n){n.props=Pl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){pt(e,t,l)}}function xs(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){pt(e,t,o)}}function Ci(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(o){pt(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){pt(e,t,o)}else n.current=null}function zh(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){pt(e,e.return,o)}}function Pc(e,t,n){try{var l=e.stateNode;i0(l,e.type,n,t),l[en]=t}catch(o){pt(e,e.return,o)}}function Oh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Tl(e.type)||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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&&Tl(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 Qc(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=Qt));else if(l!==4&&(l===27&&Tl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function Or(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&&Tl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Or(e,t,n),e=e.sibling;e!==null;)Or(e,t,n),e=e.sibling}function Bh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);fn(t,l,n),t[Gt]=e,t[en]=n}catch(c){pt(e,e.return,c)}}var Ii=!1,Zt=!1,Wc=!1,Uh=typeof WeakSet=="function"?WeakSet:Set,ln=null;function Oy(e,t){if(e=e.containerInfo,vu=io,e=Pd(e),qo(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,c=l.focusNode;l=l.focusOffset;try{n.nodeType,c.nodeType}catch{n=null;break e}var g=0,x=-1,C=-1,j=0,$=0,P=e,D=null;t:for(;;){for(var K;P!==n||o!==0&&P.nodeType!==3||(x=g+o),P!==c||l!==0&&P.nodeType!==3||(C=g+l),P.nodeType===3&&(g+=P.nodeValue.length),(K=P.firstChild)!==null;)D=P,P=K;for(;;){if(P===e)break t;if(D===n&&++j===o&&(x=g),D===c&&++$===l&&(C=g),(K=P.nextSibling)!==null)break;P=D,D=P.parentNode}P=K}n=x===-1||C===-1?null:{start:x,end:C}}else n=null}n=n||{start:0,end:0}}else n=null;for(xu={focusedElem:e,selectionRange:n},io=!1,ln=t;ln!==null;)if(t=ln,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ln=e;else for(;ln!==null;){switch(t=ln,c=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&&c!==null){e=void 0,n=t,o=c.memoizedProps,c=c.memoizedState,l=n.stateNode;try{var be=Pl(n.type,o);e=l.getSnapshotBeforeUpdate(be,c),l.__reactInternalSnapshotBeforeUpdate=e}catch(ke){pt(n,n.return,ke)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Cu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Cu(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,ln=e;break}ln=t.return}}function Hh(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:qi(e,n),l&4&&vs(5,n);break;case 1:if(qi(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){pt(n,n.return,g)}else{var o=Pl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){pt(n,n.return,g)}}l&64&&jh(n),l&512&&xs(n,n.return);break;case 3:if(qi(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{Cf(e,t)}catch(g){pt(n,n.return,g)}}break;case 27:t===null&&l&4&&Bh(n);case 26:case 5:qi(e,n),t===null&&l&4&&zh(n),l&512&&xs(n,n.return);break;case 12:qi(e,n);break;case 31:qi(e,n),l&4&&Gh(e,n);break;case 13:qi(e,n),l&4&&Ih(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=qy.bind(null,n),d0(e,n))));break;case 22:if(l=n.memoizedState!==null||Ii,!l){t=t!==null&&t.memoizedState!==null||Zt,o=Ii;var c=Zt;Ii=l,(Zt=t)&&!c?Fi(e,n,(n.subtreeFlags&8772)!==0):qi(e,n),Ii=o,Zt=c}break;case 30:break;default:qi(e,n)}}function Kh(e){var t=e.alternate;t!==null&&(e.alternate=null,Kh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ze(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 Ot=null,Nn=!1;function $i(e,t,n){for(n=n.child;n!==null;)Yh(e,t,n),n=n.sibling}function Yh(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(zt,n)}catch{}switch(n.tag){case 26:Zt||Ci(n,t),$i(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zt||Ci(n,t);var l=Ot,o=Nn;Tl(n.type)&&(Ot=n.stateNode,Nn=!1),$i(e,t,n),ks(n.stateNode),Ot=l,Nn=o;break;case 5:Zt||Ci(n,t);case 6:if(l=Ot,o=Nn,Ot=null,$i(e,t,n),Ot=l,Nn=o,Ot!==null)if(Nn)try{(Ot.nodeType===9?Ot.body:Ot.nodeName==="HTML"?Ot.ownerDocument.body:Ot).removeChild(n.stateNode)}catch(c){pt(n,t,c)}else try{Ot.removeChild(n.stateNode)}catch(c){pt(n,t,c)}break;case 18:Ot!==null&&(Nn?(e=Ot,jm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ua(e)):jm(Ot,n.stateNode));break;case 4:l=Ot,o=Nn,Ot=n.stateNode.containerInfo,Nn=!0,$i(e,t,n),Ot=l,Nn=o;break;case 0:case 11:case 14:case 15:bl(2,n,t),Zt||bl(4,n,t),$i(e,t,n);break;case 1:Zt||(Ci(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Dh(n,t,l)),$i(e,t,n);break;case 21:$i(e,t,n);break;case 22:Zt=(l=Zt)||n.memoizedState!==null,$i(e,t,n),Zt=l;break;default:$i(e,t,n)}}function Gh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ua(e)}catch(n){pt(t,t.return,n)}}}function Ih(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ua(e)}catch(n){pt(t,t.return,n)}}function By(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Uh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Uh),t;default:throw Error(r(435,e.tag))}}function Br(e,t){var n=By(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var o=Fy.bind(null,e,l);l.then(o,o)}})}function kn(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l],c=e,g=t,x=g;e:for(;x!==null;){switch(x.tag){case 27:if(Tl(x.type)){Ot=x.stateNode,Nn=!1;break e}break;case 5:Ot=x.stateNode,Nn=!1;break e;case 3:case 4:Ot=x.stateNode.containerInfo,Nn=!0;break e}x=x.return}if(Ot===null)throw Error(r(160));Yh(c,g,o),Ot=null,Nn=!1,c=o.alternate,c!==null&&(c.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)$h(t,e),t=t.sibling}var oi=null;function $h(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:kn(t,e),Ln(e),l&4&&(bl(3,e,e.return),vs(3,e),bl(5,e,e.return));break;case 1:kn(t,e),Ln(e),l&512&&(Zt||n===null||Ci(n,n.return)),l&64&&Ii&&(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=oi;if(kn(t,e),Ln(e),l&512&&(Zt||n===null||Ci(n,n.return)),l&4){var c=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":c=o.getElementsByTagName("title")[0],(!c||c[Te]||c[Gt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=o.createElement(l),o.head.insertBefore(c,o.querySelector("head > title"))),fn(c,l,n),c[Gt]=e,Tt(c),l=c;break e;case"link":var g=$m("link","href",o).get(l+(n.href||""));if(g){for(var x=0;x<g.length;x++)if(c=g[x],c.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&c.getAttribute("rel")===(n.rel==null?null:n.rel)&&c.getAttribute("title")===(n.title==null?null:n.title)&&c.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(x,1);break t}}c=o.createElement(l),fn(c,l,n),o.head.appendChild(c);break;case"meta":if(g=$m("meta","content",o).get(l+(n.content||""))){for(x=0;x<g.length;x++)if(c=g[x],c.getAttribute("content")===(n.content==null?null:""+n.content)&&c.getAttribute("name")===(n.name==null?null:n.name)&&c.getAttribute("property")===(n.property==null?null:n.property)&&c.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&c.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(x,1);break t}}c=o.createElement(l),fn(c,l,n),o.head.appendChild(c);break;default:throw Error(r(468,l))}c[Gt]=e,Tt(c),l=c}e.stateNode=l}else qm(o,e.type,e.stateNode);else e.stateNode=Im(o,l,e.memoizedProps);else c!==l?(c===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):c.count--,l===null?qm(o,e.type,e.stateNode):Im(o,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Pc(e,e.memoizedProps,n.memoizedProps)}break;case 27:kn(t,e),Ln(e),l&512&&(Zt||n===null||Ci(n,n.return)),n!==null&&l&4&&Pc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(kn(t,e),Ln(e),l&512&&(Zt||n===null||Ci(n,n.return)),e.flags&32){o=e.stateNode;try{al(o,"")}catch(be){pt(e,e.return,be)}}l&4&&e.stateNode!=null&&(o=e.memoizedProps,Pc(e,o,n!==null?n.memoizedProps:o)),l&1024&&(Wc=!0);break;case 6:if(kn(t,e),Ln(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(be){pt(e,e.return,be)}}break;case 3:if(Jr=null,o=oi,oi=Qr(t.containerInfo),kn(t,e),oi=o,Ln(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Ua(t.containerInfo)}catch(be){pt(e,e.return,be)}Wc&&(Wc=!1,qh(e));break;case 4:l=oi,oi=Qr(e.stateNode.containerInfo),kn(t,e),Ln(e),oi=l;break;case 12:kn(t,e),Ln(e);break;case 31:kn(t,e),Ln(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Br(e,l)));break;case 13:kn(t,e),Ln(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Hr=oe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Br(e,l)));break;case 22:o=e.memoizedState!==null;var C=n!==null&&n.memoizedState!==null,j=Ii,$=Zt;if(Ii=j||o,Zt=$||C,kn(t,e),Zt=$,Ii=j,Ln(e),l&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||C||Ii||Zt||Zl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){C=n=t;try{if(c=C.stateNode,o)g=c.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{x=C.stateNode;var P=C.memoizedProps.style,D=P!=null&&P.hasOwnProperty("display")?P.display:null;x.style.display=D==null||typeof D=="boolean"?"":(""+D).trim()}}catch(be){pt(C,C.return,be)}}}else if(t.tag===6){if(n===null){C=t;try{C.stateNode.nodeValue=o?"":C.memoizedProps}catch(be){pt(C,C.return,be)}}}else if(t.tag===18){if(n===null){C=t;try{var K=C.stateNode;o?Dm(K,!0):Dm(C.stateNode,!1)}catch(be){pt(C,C.return,be)}}}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,Br(e,n))));break;case 19:kn(t,e),Ln(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Br(e,l)));break;case 30:break;case 21:break;default:kn(t,e),Ln(e)}}function Ln(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Oh(l)){n=l;break}l=l.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var o=n.stateNode,c=Zc(e);Or(e,c,o);break;case 5:var g=n.stateNode;n.flags&32&&(al(g,""),n.flags&=-33);var x=Zc(e);Or(e,x,g);break;case 3:case 4:var C=n.stateNode.containerInfo,j=Zc(e);Qc(e,j,C);break;default:throw Error(r(161))}}catch($){pt(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function qi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Hh(e,t.alternate,t),t=t.sibling}function Zl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bl(4,t,t.return),Zl(t);break;case 1:Ci(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Dh(t,t.return,n),Zl(t);break;case 27:ks(t.stateNode);case 26:case 5:Ci(t,t.return),Zl(t);break;case 22:t.memoizedState===null&&Zl(t);break;case 30:Zl(t);break;default:Zl(t)}e=e.sibling}}function Fi(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,o=e,c=t,g=c.flags;switch(c.tag){case 0:case 11:case 15:Fi(o,c,n),vs(4,c);break;case 1:if(Fi(o,c,n),l=c,o=l.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(j){pt(l,l.return,j)}if(l=c,o=l.updateQueue,o!==null){var x=l.stateNode;try{var C=o.shared.hiddenCallbacks;if(C!==null)for(o.shared.hiddenCallbacks=null,o=0;o<C.length;o++)Sf(C[o],x)}catch(j){pt(l,l.return,j)}}n&&g&64&&jh(c),xs(c,c.return);break;case 27:Bh(c);case 26:case 5:Fi(o,c,n),n&&l===null&&g&4&&zh(c),xs(c,c.return);break;case 12:Fi(o,c,n);break;case 31:Fi(o,c,n),n&&g&4&&Gh(o,c);break;case 13:Fi(o,c,n),n&&g&4&&Ih(o,c);break;case 22:c.memoizedState===null&&Fi(o,c,n),xs(c,c.return);break;case 30:break;default:Fi(o,c,n)}t=t.sibling}}function Jc(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&&ss(n))}function eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ss(e))}function ci(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Fh(e,t,n,l),t=t.sibling}function Fh(e,t,n,l){var o=t.flags;switch(t.tag){case 0:case 11:case 15:ci(e,t,n,l),o&2048&&vs(9,t);break;case 1:ci(e,t,n,l);break;case 3:ci(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&&ss(e)));break;case 12:if(o&2048){ci(e,t,n,l),e=t.stateNode;try{var c=t.memoizedProps,g=c.id,x=c.onPostCommit;typeof x=="function"&&x(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){pt(t,t.return,C)}}else ci(e,t,n,l);break;case 31:ci(e,t,n,l);break;case 13:ci(e,t,n,l);break;case 23:break;case 22:c=t.stateNode,g=t.alternate,t.memoizedState!==null?c._visibility&2?ci(e,t,n,l):ws(e,t):c._visibility&2?ci(e,t,n,l):(c._visibility|=2,Ea(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Jc(g,t);break;case 24:ci(e,t,n,l),o&2048&&eu(t.alternate,t);break;default:ci(e,t,n,l)}}function Ea(e,t,n,l,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,g=t,x=n,C=l,j=g.flags;switch(g.tag){case 0:case 11:case 15:Ea(c,g,x,C,o),vs(8,g);break;case 23:break;case 22:var $=g.stateNode;g.memoizedState!==null?$._visibility&2?Ea(c,g,x,C,o):ws(c,g):($._visibility|=2,Ea(c,g,x,C,o)),o&&j&2048&&Jc(g.alternate,g);break;case 24:Ea(c,g,x,C,o),o&&j&2048&&eu(g.alternate,g);break;default:Ea(c,g,x,C,o)}t=t.sibling}}function ws(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:ws(n,l),o&2048&&Jc(l.alternate,l);break;case 24:ws(n,l),o&2048&&eu(l.alternate,l);break;default:ws(n,l)}t=t.sibling}}var Ss=8192;function Na(e,t,n){if(e.subtreeFlags&Ss)for(e=e.child;e!==null;)Vh(e,t,n),e=e.sibling}function Vh(e,t,n){switch(e.tag){case 26:Na(e,t,n),e.flags&Ss&&e.memoizedState!==null&&C0(n,oi,e.memoizedState,e.memoizedProps);break;case 5:Na(e,t,n);break;case 3:case 4:var l=oi;oi=Qr(e.stateNode.containerInfo),Na(e,t,n),oi=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Ss,Ss=16777216,Na(e,t,n),Ss=l):Na(e,t,n));break;default:Na(e,t,n)}}function Xh(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 Cs(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];ln=l,Zh(l,e)}Xh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ph(e),e=e.sibling}function Ph(e){switch(e.tag){case 0:case 11:case 15:Cs(e),e.flags&2048&&bl(9,e,e.return);break;case 3:Cs(e);break;case 12:Cs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ur(e)):Cs(e);break;default:Cs(e)}}function Ur(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];ln=l,Zh(l,e)}Xh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bl(8,t,t.return),Ur(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ur(t));break;default:Ur(t)}e=e.sibling}}function Zh(e,t){for(;ln!==null;){var n=ln;switch(n.tag){case 0:case 11:case 15:bl(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:ss(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,ln=l;else e:for(n=e;ln!==null;){l=ln;var o=l.sibling,c=l.return;if(Kh(l),l===n){ln=null;break e}if(o!==null){o.return=c,ln=o;break e}ln=c}}}var Uy={getCacheForType:function(e){var t=un(Vt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return un(Vt).controller.signal}},Hy=typeof WeakMap=="function"?WeakMap:Map,dt=0,Et=null,Je=null,tt=0,mt=0,Kn=null,yl=!1,ka=!1,tu=!1,Vi=0,Kt=0,vl=0,Ql=0,nu=0,Yn=0,La=0,Ts=null,Rn=null,iu=!1,Hr=0,Qh=0,Kr=1/0,Yr=null,xl=null,Wt=0,wl=null,Ra=null,Xi=0,lu=0,au=null,Wh=null,Ms=0,su=null;function Gn(){return(dt&2)!==0&&tt!==0?tt&-tt:L.T!==null?fu():Ri()}function Jh(){if(Yn===0)if((tt&536870912)===0||st){var e=rn;rn<<=1,(rn&3932160)===0&&(rn=262144),Yn=e}else Yn=536870912;return e=Un.current,e!==null&&(e.flags|=32),Yn}function _n(e,t,n){(e===Et&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(_a(e,0),Sl(e,tt,Yn,!1)),Tn(e,n),((dt&2)===0||e!==Et)&&(e===Et&&((dt&2)===0&&(Ql|=n),Kt===4&&Sl(e,tt,Yn,!1)),Ti(e))}function em(e,t,n){if((dt&6)!==0)throw Error(r(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||bi(e,t),o=l?Gy(e,t):ou(e,t,!0),c=l;do{if(o===0){ka&&!l&&Sl(e,t,0,!1);break}else{if(n=e.current.alternate,c&&!Ky(n)){o=ou(e,t,!1),c=!1;continue}if(o===2){if(c=t,e.errorRecoveryDisabledLanes&c)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=Ts;var C=x.current.memoizedState.isDehydrated;if(C&&(_a(x,g).flags|=256),g=ou(x,g,!1),g!==2){if(tu&&!C){x.errorRecoveryDisabledLanes|=c,Ql|=c,o=4;break e}c=Rn,Rn=o,c!==null&&(Rn===null?Rn=c:Rn.push.apply(Rn,c))}o=g}if(c=!1,o!==2)continue}}if(o===1){_a(e,0),Sl(e,t,0,!0);break}e:{switch(l=e,c=o,c){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Sl(l,t,Yn,!yl);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(o=Hr+300-oe(),10<o)){if(Sl(l,t,Yn,!yl),ki(l,0,!0)!==0)break e;Xi=t,l.timeoutHandle=Rm(tm.bind(null,l,n,Rn,Yr,iu,t,Yn,Ql,La,yl,c,"Throttled",-0,0),o);break e}tm(l,n,Rn,Yr,iu,t,Yn,Ql,La,yl,c,null,-0,0)}}break}while(!0);Ti(e)}function tm(e,t,n,l,o,c,g,x,C,j,$,P,D,K){if(e.timeoutHandle=-1,P=t.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},Vh(t,c,P);var be=(c&62914560)===c?Hr-oe():(c&4194048)===c?Qh-oe():0;if(be=T0(P,be),be!==null){Xi=c,e.cancelPendingCommit=be(cm.bind(null,e,t,c,n,l,o,g,x,C,$,P,null,D,K)),Sl(e,c,g,!j);return}}cm(e,t,c,n,l,o,g,x,C)}function Ky(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],c=o.getSnapshot;o=o.value;try{if(!On(c(),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 Sl(e,t,n,l){t&=~nu,t&=~Ql,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var o=t;0<o;){var c=31-at(o),g=1<<c;l[c]=-1,o&=~g}n!==0&&sa(e,n,t)}function Gr(){return(dt&6)===0?(As(0),!1):!0}function ru(){if(Je!==null){if(mt===0)var e=Je.return;else e=Je,Bi=Gl=null,Cc(e),Sa=null,os=0,e=Je;for(;e!==null;)_h(e.alternate,e),e=e.return;Je=null}}function _a(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,s0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Xi=0,ru(),Et=e,Je=n=zi(e.current,null),tt=t,mt=0,Kn=null,yl=!1,ka=bi(e,t),tu=!1,La=Yn=nu=Ql=vl=Kt=0,Rn=Ts=null,iu=!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-at(l),c=1<<o;t|=e[o],l&=~c}return Vi=t,cr(),n}function nm(e,t){Ye=null,L.H=gs,t===wa||t===br?(t=yf(),mt=3):t===dc?(t=yf(),mt=4):mt=t===Hc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Kn=t,Je===null&&(Kt=1,Rr(e,Xn(t,e.current)))}function im(){var e=Un.current;return e===null?!0:(tt&4194048)===tt?Wn===null:(tt&62914560)===tt||(tt&536870912)!==0?e===Wn:!1}function lm(){var e=L.H;return L.H=gs,e===null?gs:e}function am(){var e=L.A;return L.A=Uy,e}function Ir(){Kt=4,yl||(tt&4194048)!==tt&&Un.current!==null||(ka=!0),(vl&134217727)===0&&(Ql&134217727)===0||Et===null||Sl(Et,tt,Yn,!1)}function ou(e,t,n){var l=dt;dt|=2;var o=lm(),c=am();(Et!==e||tt!==t)&&(Yr=null,_a(e,t)),t=!1;var g=Kt;e:do try{if(mt!==0&&Je!==null){var x=Je,C=Kn;switch(mt){case 8:ru(),g=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(t=!0);var j=mt;if(mt=0,Kn=null,ja(e,x,C,j),n&&ka){g=0;break e}break;default:j=mt,mt=0,Kn=null,ja(e,x,C,j)}}Yy(),g=Kt;break}catch($){nm(e,$)}while(!0);return t&&e.shellSuspendCounter++,Bi=Gl=null,dt=l,L.H=o,L.A=c,Je===null&&(Et=null,tt=0,cr()),g}function Yy(){for(;Je!==null;)sm(Je)}function Gy(e,t){var n=dt;dt|=2;var l=lm(),o=am();Et!==e||tt!==t?(Yr=null,Kr=oe()+500,_a(e,t)):ka=bi(e,t);e:do try{if(mt!==0&&Je!==null){t=Je;var c=Kn;t:switch(mt){case 1:mt=0,Kn=null,ja(e,t,c,1);break;case 2:case 9:if(gf(c)){mt=0,Kn=null,rm(t);break}t=function(){mt!==2&&mt!==9||Et!==e||(mt=7),Ti(e)},c.then(t,t);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:gf(c)?(mt=0,Kn=null,rm(t)):(mt=0,Kn=null,ja(e,t,c,7));break;case 5:var g=null;switch(Je.tag){case 26:g=Je.memoizedState;case 5:case 27:var x=Je;if(g?Fm(g):x.stateNode.complete){mt=0,Kn=null;var C=x.sibling;if(C!==null)Je=C;else{var j=x.return;j!==null?(Je=j,$r(j)):Je=null}break t}}mt=0,Kn=null,ja(e,t,c,5);break;case 6:mt=0,Kn=null,ja(e,t,c,6);break;case 8:ru(),Kt=6;break e;default:throw Error(r(462))}}Iy();break}catch($){nm(e,$)}while(!0);return Bi=Gl=null,L.H=l,L.A=o,dt=n,Je!==null?0:(Et=null,tt=0,cr(),Kt)}function Iy(){for(;Je!==null&&!ft();)sm(Je)}function sm(e){var t=Lh(e.alternate,e,Vi);e.memoizedProps=e.pendingProps,t===null?$r(e):Je=t}function rm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Th(n,t,t.pendingProps,t.type,void 0,tt);break;case 11:t=Th(n,t,t.pendingProps,t.type.render,t.ref,tt);break;case 5:Cc(t);default:_h(n,t),t=Je=af(t,Vi),t=Lh(n,t,Vi)}e.memoizedProps=e.pendingProps,t===null?$r(e):Je=t}function ja(e,t,n,l){Bi=Gl=null,Cc(t),Sa=null,os=0;var o=t.return;try{if(Ry(e,o,t,n,tt)){Kt=1,Rr(e,Xn(n,e.current)),Je=null;return}}catch(c){if(o!==null)throw Je=o,c;Kt=1,Rr(e,Xn(n,e.current)),Je=null;return}t.flags&32768?(st||l===1?e=!0:ka||(tt&536870912)!==0?e=!1:(yl=e=!0,(l===2||l===9||l===3||l===6)&&(l=Un.current,l!==null&&l.tag===13&&(l.flags|=16384))),om(t,e)):$r(t)}function $r(e){var t=e;do{if((t.flags&32768)!==0){om(t,yl);return}e=t.return;var n=Dy(t.alternate,t,Vi);if(n!==null){Je=n;return}if(t=t.sibling,t!==null){Je=t;return}Je=t=e}while(t!==null);Kt===0&&(Kt=5)}function om(e,t){do{var n=zy(e.alternate,e);if(n!==null){n.flags&=32767,Je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Je=e;return}Je=e=n}while(e!==null);Kt=6,Je=null}function cm(e,t,n,l,o,c,g,x,C){e.cancelPendingCommit=null;do qr();while(Wt!==0);if((dt&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(c=t.lanes|t.childLanes,c|=Zo,Li(e,n,c,g,x,C),e===Et&&(Je=Et=null,tt=0),Ra=t,wl=e,Xi=n,lu=c,au=o,Wh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vy(Yt,function(){return mm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,o=I.p,I.p=2,g=dt,dt|=4;try{Oy(e,t,n)}finally{dt=g,I.p=o,L.T=l}}Wt=1,um(),dm(),fm()}}function um(){if(Wt===1){Wt=0;var e=wl,t=Ra,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=L.T,L.T=null;var l=I.p;I.p=2;var o=dt;dt|=4;try{$h(t,e);var c=xu,g=Pd(e.containerInfo),x=c.focusedElem,C=c.selectionRange;if(g!==x&&x&&x.ownerDocument&&Xd(x.ownerDocument.documentElement,x)){if(C!==null&&qo(x)){var j=C.start,$=C.end;if($===void 0&&($=j),"selectionStart"in x)x.selectionStart=j,x.selectionEnd=Math.min($,x.value.length);else{var P=x.ownerDocument||document,D=P&&P.defaultView||window;if(D.getSelection){var K=D.getSelection(),be=x.textContent.length,ke=Math.min(C.start,be),xt=C.end===void 0?ke:Math.min(C.end,be);!K.extend&&ke>xt&&(g=xt,xt=ke,ke=g);var k=Vd(x,ke),M=Vd(x,xt);if(k&&M&&(K.rangeCount!==1||K.anchorNode!==k.node||K.anchorOffset!==k.offset||K.focusNode!==M.node||K.focusOffset!==M.offset)){var _=P.createRange();_.setStart(k.node,k.offset),K.removeAllRanges(),ke>xt?(K.addRange(_),K.extend(M.node,M.offset)):(_.setEnd(M.node,M.offset),K.addRange(_))}}}}for(P=[],K=x;K=K.parentNode;)K.nodeType===1&&P.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<P.length;x++){var V=P[x];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}io=!!vu,xu=vu=null}finally{dt=o,I.p=l,L.T=n}}e.current=t,Wt=2}}function dm(){if(Wt===2){Wt=0;var e=wl,t=Ra,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=L.T,L.T=null;var l=I.p;I.p=2;var o=dt;dt|=4;try{Hh(e,t.alternate,t)}finally{dt=o,I.p=l,L.T=n}}Wt=3}}function fm(){if(Wt===4||Wt===3){Wt=0,St();var e=wl,t=Ra,n=Xi,l=Wh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Wt=5:(Wt=0,Ra=wl=null,hm(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(xl=null),tl(n),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(zt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=L.T,o=I.p,I.p=2,L.T=null;try{for(var c=e.onRecoverableError,g=0;g<l.length;g++){var x=l[g];c(x.value,{componentStack:x.stack})}}finally{L.T=t,I.p=o}}(Xi&3)!==0&&qr(),Ti(e),o=e.pendingLanes,(n&261930)!==0&&(o&42)!==0?e===su?Ms++:(Ms=0,su=e):Ms=0,As(0)}}function hm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ss(t)))}function qr(){return um(),dm(),fm(),mm()}function mm(){if(Wt!==5)return!1;var e=wl,t=lu;lu=0;var n=tl(Xi),l=L.T,o=I.p;try{I.p=32>n?32:n,L.T=null,n=au,au=null;var c=wl,g=Xi;if(Wt=0,Ra=wl=null,Xi=0,(dt&6)!==0)throw Error(r(331));var x=dt;if(dt|=4,Ph(c.current),Fh(c,c.current,g,n),dt=x,As(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(zt,c)}catch{}return!0}finally{I.p=o,L.T=l,hm(e,t)}}function pm(e,t,n){t=Xn(n,t),t=Uc(e.stateNode,t,2),e=ml(e,t,2),e!==null&&(Tn(e,2),Ti(e))}function pt(e,t,n){if(e.tag===3)pm(e,e,n);else for(;t!==null;){if(t.tag===3){pm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(xl===null||!xl.has(l))){e=Xn(n,e),n=gh(2),l=ml(t,n,2),l!==null&&(bh(n,l,t,e),Tn(l,2),Ti(l));break}}t=t.return}}function cu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Hy;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)||(tu=!0,o.add(n),e=$y.bind(null,e,t,n),t.then(e,e))}function $y(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Et===e&&(tt&n)===n&&(Kt===4||Kt===3&&(tt&62914560)===tt&&300>oe()-Hr?(dt&2)===0&&_a(e,0):nu|=n,La===tt&&(La=0)),Ti(e)}function gm(e,t){t===0&&(t=In()),e=Hl(e,t),e!==null&&(Tn(e,t),Ti(e))}function qy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gm(e,n)}function Fy(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),gm(e,n)}function Vy(e,t){return We(e,t)}var Fr=null,Da=null,uu=!1,Vr=!1,du=!1,Cl=0;function Ti(e){e!==Da&&e.next===null&&(Da===null?Fr=Da=e:Da=Da.next=e),Vr=!0,uu||(uu=!0,Py())}function As(e,t){if(!du&&Vr){du=!0;do for(var n=!1,l=Fr;l!==null;){if(e!==0){var o=l.pendingLanes;if(o===0)var c=0;else{var g=l.suspendedLanes,x=l.pingedLanes;c=(1<<31-at(42|e)+1)-1,c&=o&~(g&~x),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(n=!0,xm(l,c))}else c=tt,c=ki(l,l===Et?c:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(c&3)===0||bi(l,c)||(n=!0,xm(l,c));l=l.next}while(n);du=!1}}function Xy(){bm()}function bm(){Vr=uu=!1;var e=0;Cl!==0&&a0()&&(e=Cl);for(var t=oe(),n=null,l=Fr;l!==null;){var o=l.next,c=ym(l,t);c===0?(l.next=null,n===null?Fr=o:n.next=o,o===null&&(Da=n)):(n=l,(e!==0||(c&3)!==0)&&(Vr=!0)),l=o}Wt!==0&&Wt!==5||As(e),Cl!==0&&(Cl=0)}function ym(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var g=31-at(c),x=1<<g,C=o[g];C===-1?((x&n)===0||(x&l)!==0)&&(o[g]=Dl(x,t)):C<=t&&(e.expiredLanes|=x),c&=~x}if(t=Et,n=tt,n=ki(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&bt(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||bi(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&bt(l),tl(n)){case 2:case 8:n=ot;break;case 32:n=Yt;break;case 268435456:n=Pe;break;default:n=Yt}return l=vm.bind(null,e),n=We(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&bt(l),e.callbackPriority=2,e.callbackNode=null,2}function vm(e,t){if(Wt!==0&&Wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(qr()&&e.callbackNode!==n)return null;var l=tt;return l=ki(e,e===Et?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(em(e,l,t),ym(e,oe()),e.callbackNode!=null&&e.callbackNode===n?vm.bind(null,e):null)}function xm(e,t){if(qr())return null;em(e,t,!0)}function Py(){r0(function(){(dt&6)!==0?We(De,Xy):bm()})}function fu(){if(Cl===0){var e=va;e===0&&(e=Ni,Ni<<=1,(Ni&261888)===0&&(Ni=256)),Cl=e}return Cl}function wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:xi(""+e)}function Sm(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 Zy(e,t,n,l,o){if(t==="submit"&&n&&n.stateNode===o){var c=wm((o[en]||null).action),g=l.submitter;g&&(t=(t=g[en]||null)?wm(t.formAction):g.getAttribute("formAction"),t!==null&&(c=t,g=null));var x=new Fn("action","action",null,l,o);e.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Cl!==0){var C=g?Sm(o,g):new FormData(o);_c(n,{pending:!0,data:C,method:o.method,action:c},null,C)}}else typeof c=="function"&&(x.preventDefault(),C=g?Sm(o,g):new FormData(o),_c(n,{pending:!0,data:C,method:o.method,action:c},c,C))},currentTarget:o}]})}}for(var hu=0;hu<Po.length;hu++){var mu=Po[hu],Qy=mu.toLowerCase(),Wy=mu[0].toUpperCase()+mu.slice(1);ri(Qy,"on"+Wy)}ri(Wd,"onAnimationEnd"),ri(Jd,"onAnimationIteration"),ri(ef,"onAnimationStart"),ri("dblclick","onDoubleClick"),ri("focusin","onFocus"),ri("focusout","onBlur"),ri(my,"onTransitionRun"),ri(py,"onTransitionStart"),ri(gy,"onTransitionCancel"),ri(tf,"onTransitionEnd"),ji("onMouseEnter",["mouseout","mouseover"]),ji("onMouseLeave",["mouseout","mouseover"]),ji("onPointerEnter",["pointerout","pointerover"]),ji("onPointerLeave",["pointerout","pointerover"]),vi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vi("onBeforeInput",["compositionend","keypress","textInput","paste"]),vi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Es="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(" "),Jy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Es));function Cm(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 c=void 0;if(t)for(var g=l.length-1;0<=g;g--){var x=l[g],C=x.instance,j=x.currentTarget;if(x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=j;try{c(o)}catch($){or($)}o.currentTarget=null,c=C}else for(g=0;g<l.length;g++){if(x=l[g],C=x.instance,j=x.currentTarget,x=x.listener,C!==c&&o.isPropagationStopped())break e;c=x,o.currentTarget=j;try{c(o)}catch($){or($)}o.currentTarget=null,c=C}}}}function et(e,t){var n=t[H];n===void 0&&(n=t[H]=new Set);var l=e+"__bubble";n.has(l)||(Tm(t,e,2,!1),n.add(l))}function pu(e,t,n){var l=0;t&&(l|=4),Tm(n,e,l,t)}var Xr="_reactListening"+Math.random().toString(36).slice(2);function gu(e){if(!e[Xr]){e[Xr]=!0,En.forEach(function(n){n!=="selectionchange"&&(Jy.has(n)||pu(n,!1,e),pu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xr]||(t[Xr]=!0,pu("selectionchange",!1,t))}}function Tm(e,t,n,l){switch(Jm(t)){case 2:var o=E0;break;case 8:o=N0;break;default:o=Ru}n=o.bind(null,t,n,e),o=void 0,!re||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 bu(e,t,n,l,o){var c=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 C=g.tag;if((C===3||C===4)&&g.stateNode.containerInfo===o)return;g=g.return}for(;x!==null;){if(g=He(x),g===null)return;if(C=g.tag,C===5||C===6||C===26||C===27){l=c=g;continue e}x=x.parentNode}}l=l.return}Qa(function(){var j=c,$=oa(n),P=[];e:{var D=nf.get(e);if(D!==void 0){var K=Fn,be=e;switch(e){case"keypress":if(nn(n)===0)break e;case"keydown":case"keyup":K=Fb;break;case"focusin":be="focus",K=Ko;break;case"focusout":be="blur",K=Ko;break;case"beforeblur":case"afterblur":K=Ko;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":K=Rd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Db;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Pb;break;case Wd:case Jd:case ef:K=Bb;break;case tf:K=Qb;break;case"scroll":case"scrollend":K=_b;break;case"wheel":K=Jb;break;case"copy":case"cut":case"paste":K=Hb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=jd;break;case"toggle":case"beforetoggle":K=ty}var ke=(t&4)!==0,xt=!ke&&(e==="scroll"||e==="scrollend"),k=ke?D!==null?D+"Capture":null:D;ke=[];for(var M=j,_;M!==null;){var V=M;if(_=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||_===null||k===null||(V=sl(M,k),V!=null&&ke.push(Ns(M,V,_))),xt)break;M=M.return}0<ke.length&&(D=new K(D,be,null,n,$),P.push({event:D,listeners:ke}))}}if((t&7)===0){e:{if(D=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",D&&n!==ra&&(be=n.relatedTarget||n.fromElement)&&(He(be)||be[yi]))break e;if((K||D)&&(D=$.window===$?$:(D=$.ownerDocument)?D.defaultView||D.parentWindow:window,K?(be=n.relatedTarget||n.toElement,K=j,be=be?He(be):null,be!==null&&(xt=d(be),ke=be.tag,be!==xt||ke!==5&&ke!==27&&ke!==6)&&(be=null)):(K=null,be=j),K!==be)){if(ke=Rd,V="onMouseLeave",k="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(ke=jd,V="onPointerLeave",k="onPointerEnter",M="pointer"),xt=K==null?D:Nt(K),_=be==null?D:Nt(be),D=new ke(V,M+"leave",K,n,$),D.target=xt,D.relatedTarget=_,V=null,He($)===j&&(ke=new ke(k,M+"enter",be,n,$),ke.target=_,ke.relatedTarget=xt,V=ke),xt=V,K&&be)t:{for(ke=e0,k=K,M=be,_=0,V=k;V;V=ke(V))_++;V=0;for(var Ae=M;Ae;Ae=ke(Ae))V++;for(;0<_-V;)k=ke(k),_--;for(;0<V-_;)M=ke(M),V--;for(;_--;){if(k===M||M!==null&&k===M.alternate){ke=k;break t}k=ke(k),M=ke(M)}ke=null}else ke=null;K!==null&&Mm(P,D,K,ke,!1),be!==null&&xt!==null&&Mm(P,xt,be,ke,!0)}}e:{if(D=j?Nt(j):window,K=D.nodeName&&D.nodeName.toLowerCase(),K==="select"||K==="input"&&D.type==="file")var ct=Yd;else if(Hd(D))if(Gd)ct=dy;else{ct=cy;var xe=oy}else K=D.nodeName,!K||K.toLowerCase()!=="input"||D.type!=="checkbox"&&D.type!=="radio"?j&&hn(j.elementType)&&(ct=Yd):ct=uy;if(ct&&(ct=ct(e,j))){Kd(P,ct,n,$);break e}xe&&xe(e,D,j),e==="focusout"&&j&&D.type==="number"&&j.memoizedProps.value!=null&&Za(D,"number",D.value)}switch(xe=j?Nt(j):window,e){case"focusin":(Hd(xe)||xe.contentEditable==="true")&&(da=xe,Fo=j,is=null);break;case"focusout":is=Fo=da=null;break;case"mousedown":Vo=!0;break;case"contextmenu":case"mouseup":case"dragend":Vo=!1,Zd(P,n,$);break;case"selectionchange":if(hy)break;case"keydown":case"keyup":Zd(P,n,$)}var $e;if(Go)e:{switch(e){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else ua?Bd(e,n)&&(nt="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(nt="onCompositionStart");nt&&(Dd&&n.locale!=="ko"&&(ua||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&ua&&($e=Me()):(At=$,mn="value"in At?At.value:At.textContent,ua=!0)),xe=Pr(j,nt),0<xe.length&&(nt=new _d(nt,e,null,n,$),P.push({event:nt,listeners:xe}),$e?nt.data=$e:($e=Ud(n),$e!==null&&(nt.data=$e)))),($e=iy?ly(e,n):ay(e,n))&&(nt=Pr(j,"onBeforeInput"),0<nt.length&&(xe=new _d("onBeforeInput","beforeinput",null,n,$),P.push({event:xe,listeners:nt}),xe.data=$e)),Zy(P,e,j,n,$)}Cm(P,t)})}function Ns(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Pr(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,c=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||c===null||(o=sl(e,n),o!=null&&l.unshift(Ns(e,o,c)),o=sl(e,t),o!=null&&l.push(Ns(e,o,c))),e.tag===3)return l;e=e.return}return[]}function e0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Mm(e,t,n,l,o){for(var c=t._reactName,g=[];n!==null&&n!==l;){var x=n,C=x.alternate,j=x.stateNode;if(x=x.tag,C!==null&&C===l)break;x!==5&&x!==26&&x!==27||j===null||(C=j,o?(j=sl(n,c),j!=null&&g.unshift(Ns(n,j,C))):o||(j=sl(n,c),j!=null&&g.push(Ns(n,j,C)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var t0=/\r\n?/g,n0=/\u0000|\uFFFD/g;function Am(e){return(typeof e=="string"?e:""+e).replace(t0,`
33
+ `).replace(n0,"")}function Em(e,t){return t=Am(t),Am(e)===t}function vt(e,t,n,l,o,c){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||al(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&al(e,""+l);break;case"className":Ie(e,"class",l);break;case"tabIndex":Ie(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ie(e,n,l);break;case"style":ar(e,l,c);break;case"data":if(t!=="object"){Ie(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=xi(""+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 c=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",o.name,o,null),vt(e,t,"formEncType",o.formEncType,o,null),vt(e,t,"formMethod",o.formMethod,o,null),vt(e,t,"formTarget",o.formTarget,o,null)):(vt(e,t,"encType",o.encType,o,null),vt(e,t,"method",o.method,o,null),vt(e,t,"target",o.target,o,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=xi(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Qt);break;case"onScroll":l!=null&&et("scroll",e);break;case"onScrollEnd":l!=null&&et("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=xi(""+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":et("beforetoggle",e),et("toggle",e),he(e,"popover",l);break;case"xlinkActuate":ae(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ae(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ae(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ae(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ae(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ae(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ae(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ae(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ae(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":he(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=Oo.get(n)||n,he(e,n,l))}}function yu(e,t,n,l,o,c){switch(n){case"style":ar(e,l,c);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"?al(e,l):(typeof l=="number"||typeof l=="bigint")&&al(e,""+l);break;case"onScroll":l!=null&&et("scroll",e);break;case"onScrollEnd":l!=null&&et("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Qt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zl.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),c=e[en]||null,c=c!=null?c[n]:null,typeof c=="function"&&e.removeEventListener(t,c,o),typeof l=="function")){typeof c!="function"&&c!==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,""):he(e,n,l)}}}function fn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",e),et("load",e);var l=!1,o=!1,c;for(c in n)if(n.hasOwnProperty(c)){var g=n[c];if(g!=null)switch(c){case"src":l=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,c,g,n,null)}}o&&vt(e,t,"srcSet",n.srcSet,n,null),l&&vt(e,t,"src",n.src,n,null);return;case"input":et("invalid",e);var x=c=g=o=null,C=null,j=null;for(l in n)if(n.hasOwnProperty(l)){var $=n[l];if($!=null)switch(l){case"name":o=$;break;case"type":g=$;break;case"checked":C=$;break;case"defaultChecked":j=$;break;case"value":c=$;break;case"defaultValue":x=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,t));break;default:vt(e,t,l,$,n,null)}}Di(e,c,x,C,j,g,o,!1);return;case"select":et("invalid",e),l=g=c=null;for(o in n)if(n.hasOwnProperty(o)&&(x=n[o],x!=null))switch(o){case"value":c=x;break;case"defaultValue":g=x;break;case"multiple":l=x;default:vt(e,t,o,x,n,null)}t=c,n=g,e.multiple=!!l,t!=null?ll(e,!!l,t,!1):n!=null&&ll(e,!!l,n,!0);return;case"textarea":et("invalid",e),c=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":c=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:vt(e,t,g,x,n,null)}ir(e,l,o,c);return;case"option":for(C in n)if(n.hasOwnProperty(C)&&(l=n[C],l!=null))switch(C){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:vt(e,t,C,l,n,null)}return;case"dialog":et("beforetoggle",e),et("toggle",e),et("cancel",e),et("close",e);break;case"iframe":case"object":et("load",e);break;case"video":case"audio":for(l=0;l<Es.length;l++)et(Es[l],e);break;case"image":et("error",e),et("load",e);break;case"details":et("toggle",e);break;case"embed":case"source":case"link":et("error",e),et("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(j in n)if(n.hasOwnProperty(j)&&(l=n[j],l!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:vt(e,t,j,l,n,null)}return;default:if(hn(t)){for($ in n)n.hasOwnProperty($)&&(l=n[$],l!==void 0&&yu(e,t,$,l,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(l=n[x],l!=null&&vt(e,t,x,l,n,null))}function i0(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,c=null,g=null,x=null,C=null,j=null,$=null;for(K in n){var P=n[K];if(n.hasOwnProperty(K)&&P!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":C=P;default:l.hasOwnProperty(K)||vt(e,t,K,null,l,P)}}for(var D in l){var K=l[D];if(P=n[D],l.hasOwnProperty(D)&&(K!=null||P!=null))switch(D){case"type":c=K;break;case"name":o=K;break;case"checked":j=K;break;case"defaultChecked":$=K;break;case"value":g=K;break;case"defaultValue":x=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:K!==P&&vt(e,t,D,K,l,P)}}il(e,g,x,C,j,$,c,o);return;case"select":K=g=x=D=null;for(c in n)if(C=n[c],n.hasOwnProperty(c)&&C!=null)switch(c){case"value":break;case"multiple":K=C;default:l.hasOwnProperty(c)||vt(e,t,c,null,l,C)}for(o in l)if(c=l[o],C=n[o],l.hasOwnProperty(o)&&(c!=null||C!=null))switch(o){case"value":D=c;break;case"defaultValue":x=c;break;case"multiple":g=c;default:c!==C&&vt(e,t,o,c,l,C)}t=x,n=g,l=K,D!=null?ll(e,!!n,D,!1):!!l!=!!n&&(t!=null?ll(e,!!n,t,!0):ll(e,!!n,n?[]:"",!1));return;case"textarea":K=D=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:vt(e,t,x,null,l,o)}for(g in l)if(o=l[g],c=n[g],l.hasOwnProperty(g)&&(o!=null||c!=null))switch(g){case"value":D=o;break;case"defaultValue":K=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(r(91));break;default:o!==c&&vt(e,t,g,o,l,c)}nr(e,D,K);return;case"option":for(var be in n)if(D=n[be],n.hasOwnProperty(be)&&D!=null&&!l.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:vt(e,t,be,null,l,D)}for(C in l)if(D=l[C],K=n[C],l.hasOwnProperty(C)&&D!==K&&(D!=null||K!=null))switch(C){case"selected":e.selected=D&&typeof D!="function"&&typeof D!="symbol";break;default:vt(e,t,C,D,l,K)}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 ke in n)D=n[ke],n.hasOwnProperty(ke)&&D!=null&&!l.hasOwnProperty(ke)&&vt(e,t,ke,null,l,D);for(j in l)if(D=l[j],K=n[j],l.hasOwnProperty(j)&&D!==K&&(D!=null||K!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(137,t));break;default:vt(e,t,j,D,l,K)}return;default:if(hn(t)){for(var xt in n)D=n[xt],n.hasOwnProperty(xt)&&D!==void 0&&!l.hasOwnProperty(xt)&&yu(e,t,xt,void 0,l,D);for($ in l)D=l[$],K=n[$],!l.hasOwnProperty($)||D===K||D===void 0&&K===void 0||yu(e,t,$,D,l,K);return}}for(var k in n)D=n[k],n.hasOwnProperty(k)&&D!=null&&!l.hasOwnProperty(k)&&vt(e,t,k,null,l,D);for(P in l)D=l[P],K=n[P],!l.hasOwnProperty(P)||D===K||D==null&&K==null||vt(e,t,P,D,l,K)}function Nm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l0(){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],c=o.transferSize,g=o.initiatorType,x=o.duration;if(c&&x&&Nm(g)){for(g=0,x=o.responseEnd,l+=1;l<n.length;l++){var C=n[l],j=C.startTime;if(j>x)break;var $=C.transferSize,P=C.initiatorType;$&&Nm(P)&&(C=C.responseEnd,g+=$*(C<x?1:(x-j)/(C-j)))}if(--l,t+=8*(c+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 vu=null,xu=null;function Zr(e){return e.nodeType===9?e:e.ownerDocument}function km(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 Lm(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 wu(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 Su=null;function a0(){var e=window.event;return e&&e.type==="popstate"?e===Su?!1:(Su=e,!0):(Su=null,!1)}var Rm=typeof setTimeout=="function"?setTimeout:void 0,s0=typeof clearTimeout=="function"?clearTimeout:void 0,_m=typeof Promise=="function"?Promise:void 0,r0=typeof queueMicrotask=="function"?queueMicrotask:typeof _m<"u"?function(e){return _m.resolve(null).then(e).catch(o0)}:Rm;function o0(e){setTimeout(function(){throw e})}function Tl(e){return e==="head"}function jm(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),Ua(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")ks(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ks(n);for(var c=n.firstChild;c;){var g=c.nextSibling,x=c.nodeName;c[Te]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&c.rel.toLowerCase()==="stylesheet"||n.removeChild(c),c=g}}else n==="body"&&ks(e.ownerDocument.body);n=o}while(n);Ua(t)}function Dm(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 Cu(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":Cu(n),ze(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function c0(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[Te])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==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(c=e.getAttribute("src"),(c!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=Jn(e.nextSibling),e===null)break}return null}function u0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function zm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Jn(e.nextSibling),e===null))return null;return e}function Tu(e){return e.data==="$?"||e.data==="$~"}function Mu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function d0(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 Jn(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 Au=null;function Om(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Jn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Bm(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 Um(e,t,n){switch(t=Zr(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 ks(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ze(e)}var ei=new Map,Hm=new Set;function Qr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Pi=I.d;I.d={f:f0,r:h0,D:m0,C:p0,L:g0,m:b0,X:v0,S:y0,M:x0};function f0(){var e=Pi.f(),t=Gr();return e||t}function h0(e){var t=Ft(e);t!==null&&t.tag===5&&t.type==="form"?nh(t):Pi.r(e)}var za=typeof document>"u"?null:document;function Km(e,t,n){var l=za;if(l&&typeof t=="string"&&t){var o=on(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),Hm.has(o)||(Hm.add(o),e={rel:e,crossOrigin:n,href:t},l.querySelector(o)===null&&(t=l.createElement("link"),fn(t,"link",e),Tt(t),l.head.appendChild(t)))}}function m0(e){Pi.D(e),Km("dns-prefetch",e,null)}function p0(e,t){Pi.C(e,t),Km("preconnect",e,t)}function g0(e,t,n){Pi.L(e,t,n);var l=za;if(l&&e&&t){var o='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+on(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+on(n.imageSizes)+'"]')):o+='[href="'+on(e)+'"]';var c=o;switch(t){case"style":c=Oa(e);break;case"script":c=Ba(e)}ei.has(c)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ei.set(c,e),l.querySelector(o)!==null||t==="style"&&l.querySelector(Ls(c))||t==="script"&&l.querySelector(Rs(c))||(t=l.createElement("link"),fn(t,"link",e),Tt(t),l.head.appendChild(t)))}}function b0(e,t){Pi.m(e,t);var n=za;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+on(l)+'"][href="'+on(e)+'"]',c=o;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Ba(e)}if(!ei.has(c)&&(e=v({rel:"modulepreload",href:e},t),ei.set(c,e),n.querySelector(o)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Rs(c)))return}l=n.createElement("link"),fn(l,"link",e),Tt(l),n.head.appendChild(l)}}}function y0(e,t,n){Pi.S(e,t,n);var l=za;if(l&&e){var o=An(l).hoistableStyles,c=Oa(e);t=t||"default";var g=o.get(c);if(!g){var x={loading:0,preload:null};if(g=l.querySelector(Ls(c)))x.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ei.get(c))&&Eu(e,n);var C=g=l.createElement("link");Tt(C),fn(C,"link",e),C._p=new Promise(function(j,$){C.onload=j,C.onerror=$}),C.addEventListener("load",function(){x.loading|=1}),C.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Wr(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:x},o.set(c,g)}}}function v0(e,t){Pi.X(e,t);var n=za;if(n&&e){var l=An(n).hoistableScripts,o=Ba(e),c=l.get(o);c||(c=n.querySelector(Rs(o)),c||(e=v({src:e,async:!0},t),(t=ei.get(o))&&Nu(e,t),c=n.createElement("script"),Tt(c),fn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function x0(e,t){Pi.M(e,t);var n=za;if(n&&e){var l=An(n).hoistableScripts,o=Ba(e),c=l.get(o);c||(c=n.querySelector(Rs(o)),c||(e=v({src:e,async:!0,type:"module"},t),(t=ei.get(o))&&Nu(e,t),c=n.createElement("script"),Tt(c),fn(c,"link",e),n.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},l.set(o,c))}}function Ym(e,t,n,l){var o=(o=F.current)?Qr(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=Oa(n.href),n=An(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=Oa(n.href);var c=An(o).hoistableStyles,g=c.get(e);if(g||(o=o.ownerDocument||o,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,g),(c=o.querySelector(Ls(e)))&&!c._p&&(g.instance=c,g.state.loading=5),ei.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},ei.set(e,n),c||w0(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=Ba(n),n=An(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 Oa(e){return'href="'+on(e)+'"'}function Ls(e){return'link[rel="stylesheet"]['+e+"]"}function Gm(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function w0(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}),fn(t,"link",n),Tt(t),e.head.appendChild(t))}function Ba(e){return'[src="'+on(e)+'"]'}function Rs(e){return"script[async]"+e}function Im(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+on(n.href)+'"]');if(l)return t.instance=l,Tt(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"),Tt(l),fn(l,"style",o),Wr(l,n.precedence,e),t.instance=l;case"stylesheet":o=Oa(n.href);var c=e.querySelector(Ls(o));if(c)return t.state.loading|=4,t.instance=c,Tt(c),c;l=Gm(n),(o=ei.get(o))&&Eu(l,o),c=(e.ownerDocument||e).createElement("link"),Tt(c);var g=c;return g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),fn(c,"link",l),t.state.loading|=4,Wr(c,n.precedence,e),t.instance=c;case"script":return c=Ba(n.src),(o=e.querySelector(Rs(c)))?(t.instance=o,Tt(o),o):(l=n,(o=ei.get(c))&&(l=v({},n),Nu(l,o)),e=e.ownerDocument||e,o=e.createElement("script"),Tt(o),fn(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,Wr(l,n.precedence,e));return t.instance}function Wr(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=l.length?l[l.length-1]:null,c=o,g=0;g<l.length;g++){var x=l[g];if(x.dataset.precedence===t)c=x;else if(c!==o)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Eu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Jr=null;function $m(e,t,n){if(Jr===null){var l=new Map,o=Jr=new Map;o.set(n,l)}else o=Jr,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 c=n[o];if(!(c[Te]||c[Gt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var g=c.getAttribute(t)||"";g=e+g;var x=l.get(g);x?x.push(c):l.set(g,[c])}}return l}function qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function S0(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 Fm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function C0(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=Oa(l.href),c=t.querySelector(Ls(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=eo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=c,Tt(c);return}c=t.ownerDocument||t,l=Gm(l),(o=ei.get(o))&&Eu(l,o),c=c.createElement("link"),Tt(c);var g=c;g._p=new Promise(function(x,C){g.onload=x,g.onerror=C}),fn(c,"link",l),n.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=eo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var ku=0;function T0(e,t){return e.stylesheets&&e.count===0&&no(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&no(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&ku===0&&(ku=62500*l0());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&no(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>ku?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(o)}}:null}function eo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)no(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var to=null;function no(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,to=new Map,t.forEach(M0,e),to=null,eo.call(e))}function M0(e,t){if(!(t.state.loading&4)){var n=to.get(e);if(n)var l=n.get(null);else{n=new Map,to.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<o.length;c++){var g=o[c];(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"),c=n.get(g)||l,c===l&&n.set(null,o),n.set(g,o),this.count++,l=eo.bind(this),o.addEventListener("load",l),o.addEventListener("error",l),c?c.parentNode.insertBefore(o,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var _s={$$typeof:B,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function A0(e,t,n,l,o,c,g,x,C){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=Cn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cn(0),this.hiddenUpdates=Cn(null),this.identifierPrefix=l,this.onUncaughtError=o,this.onCaughtError=c,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function Vm(e,t,n,l,o,c,g,x,C,j,$,P){return e=new A0(e,t,n,g,C,j,$,P,x),t=1,c===!0&&(t|=24),c=Bn(3,null,null,t),e.current=c,c.stateNode=e,t=oc(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:l,isDehydrated:n,cache:t},fc(c),e}function Xm(e){return e?(e=ma,e):ma}function Pm(e,t,n,l,o,c){o=Xm(o),l.context===null?l.context=o:l.pendingContext=o,l=hl(t),l.payload={element:n},c=c===void 0?null:c,c!==null&&(l.callback=c),n=ml(e,l,t),n!==null&&(_n(n,e,t),us(n,e,t))}function Zm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Lu(e,t){Zm(e,t),(e=e.alternate)&&Zm(e,t)}function Qm(e){if(e.tag===13||e.tag===31){var t=Hl(e,67108864);t!==null&&_n(t,e,67108864),Lu(e,67108864)}}function Wm(e){if(e.tag===13||e.tag===31){var t=Gn();t=el(t);var n=Hl(e,t);n!==null&&_n(n,e,t),Lu(e,t)}}var io=!0;function E0(e,t,n,l){var o=L.T;L.T=null;var c=I.p;try{I.p=2,Ru(e,t,n,l)}finally{I.p=c,L.T=o}}function N0(e,t,n,l){var o=L.T;L.T=null;var c=I.p;try{I.p=8,Ru(e,t,n,l)}finally{I.p=c,L.T=o}}function Ru(e,t,n,l){if(io){var o=_u(l);if(o===null)bu(e,t,l,lo,n),ep(e,l);else if(L0(o,e,t,n,l))l.stopPropagation();else if(ep(e,l),t&4&&-1<k0.indexOf(e)){for(;o!==null;){var c=Ft(o);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var g=Sn(c.pendingLanes);if(g!==0){var x=c;for(x.pendingLanes|=2,x.entangledLanes|=2;g;){var C=1<<31-at(g);x.entanglements[1]|=C,g&=~C}Ti(c),(dt&6)===0&&(Kr=oe()+500,As(0))}}break;case 31:case 13:x=Hl(c,2),x!==null&&_n(x,c,2),Gr(),Lu(c,2)}if(c=_u(l),c===null&&bu(e,t,l,lo,n),c===o)break;o=c}o!==null&&l.stopPropagation()}else bu(e,t,l,null,n)}}function _u(e){return e=oa(e),ju(e)}var lo=null;function ju(e){if(lo=null,e=He(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=h(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 lo=e,null}function Jm(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(Ne()){case De:return 2;case ot:return 8;case Yt:case ni:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var Du=!1,Ml=null,Al=null,El=null,js=new Map,Ds=new Map,Nl=[],k0="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 ep(e,t){switch(e){case"focusin":case"focusout":Ml=null;break;case"dragenter":case"dragleave":Al=null;break;case"mouseover":case"mouseout":El=null;break;case"pointerover":case"pointerout":js.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ds.delete(t.pointerId)}}function zs(e,t,n,l,o,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:c,targetContainers:[o]},t!==null&&(t=Ft(t),t!==null&&Qm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function L0(e,t,n,l,o){switch(t){case"focusin":return Ml=zs(Ml,e,t,n,l,o),!0;case"dragenter":return Al=zs(Al,e,t,n,l,o),!0;case"mouseover":return El=zs(El,e,t,n,l,o),!0;case"pointerover":var c=o.pointerId;return js.set(c,zs(js.get(c)||null,e,t,n,l,o)),!0;case"gotpointercapture":return c=o.pointerId,Ds.set(c,zs(Ds.get(c)||null,e,t,n,l,o)),!0}return!1}function tp(e){var t=He(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,_i(e.priority,function(){Wm(n)});return}}else if(t===31){if(t=h(n),t!==null){e.blockedOn=t,_i(e.priority,function(){Wm(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 ao(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_u(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);ra=l,n.target.dispatchEvent(l),ra=null}else return t=Ft(n),t!==null&&Qm(t),e.blockedOn=n,!1;t.shift()}return!0}function np(e,t,n){ao(e)&&n.delete(t)}function R0(){Du=!1,Ml!==null&&ao(Ml)&&(Ml=null),Al!==null&&ao(Al)&&(Al=null),El!==null&&ao(El)&&(El=null),js.forEach(np),Ds.forEach(np)}function so(e,t){e.blockedOn===t&&(e.blockedOn=null,Du||(Du=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,R0)))}var ro=null;function ip(e){ro!==e&&(ro=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){ro===e&&(ro=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(ju(l||n)===null)continue;break}var c=Ft(n);c!==null&&(e.splice(t,3),t-=3,_c(c,{pending:!0,data:o,method:n.method,action:l},l,o))}}))}function Ua(e){function t(C){return so(C,e)}Ml!==null&&so(Ml,e),Al!==null&&so(Al,e),El!==null&&so(El,e),js.forEach(t),Ds.forEach(t);for(var n=0;n<Nl.length;n++){var l=Nl[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Nl.length&&(n=Nl[0],n.blockedOn===null);)tp(n),n.blockedOn===null&&Nl.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var o=n[l],c=n[l+1],g=o[en]||null;if(typeof c=="function")g||ip(n);else if(g){var x=null;if(c&&c.hasAttribute("formAction")){if(o=c,g=c[en]||null)x=g.formAction;else if(ju(o)!==null)continue}else x=g.action;typeof x=="function"?n[l+1]=x:(n.splice(l,3),l-=3),ip(n)}}}function lp(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.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 c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.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 zu(e){this._internalRoot=e}oo.prototype.render=zu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,l=Gn();Pm(n,l,e,t,null,null)},oo.prototype.unmount=zu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pm(e.current,2,null,e,null,null),Gr(),t[yi]=null}};function oo(e){this._internalRoot=e}oo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ri();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nl.length&&t!==0&&t<Nl[n].priority;n++);Nl.splice(n,0,e),n===0&&tp(e)}};var ap=i.version;if(ap!=="19.2.8")throw Error(r(527,ap,"19.2.8"));I.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 _0={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var co=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!co.isDisabled&&co.supportsFiber)try{zt=co.inject(_0),Ct=co}catch{}}return Bs.createRoot=function(e,t){if(!u(e))throw Error(r(299));var n=!1,l="",o=fh,c=hh,g=mh;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&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=Vm(e,1,!1,null,null,n,l,null,o,c,g,lp),e[yi]=t.current,gu(e),new zu(t)},Bs.hydrateRoot=function(e,t,n){if(!u(e))throw Error(r(299));var l=!1,o="",c=fh,g=hh,x=mh,C=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(c=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(C=n.formState)),t=Vm(e,1,!0,t,n??null,l,o,C,c,g,x,lp),t.context=Xm(null),n=t.current,l=Gn(),l=el(l),o=hl(l),o.callback=null,ml(n,o,l),n=l,t.current.lanes=n,Tn(t,n),Ti(t),e[yi]=t.current,gu(e),new oo(t)},Bs.version="19.2.8",Bs}var dp;function I0(){if(dp)return Bu.exports;dp=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(),Bu.exports=G0(),Bu.exports}var $0=I0();const q0=pg($0),ce={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~"},F0=new TextEncoder;function gd(a){return F0.encode(a)}function bg(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 V0(a){return`\x1B${a}`}function fp({ctrl:a,alt:i,shift:s}){return 1+(s?1:0)+(i?2:0)+(a?4:0)}const yg=/^\x1b[[O]([ABCDHF])$/,vg=/^\x1bO([PQRS])$/,xg=/^\x1b\[(\d+)~$/;function To(a,i){const{ctrl:s=!1,alt:r=!1,shift:u=!1}=i;if(!s&&!r&&!u)return a;const d=fp(i),m=r&&!s&&!u,h=yg.exec(a);if(h)return`\x1B[1;${d}${h[1]}`;const p=vg.exec(a);if(p)return`\x1B[1;${d}${p[1]}`;const y=xg.exec(a);if(y)return`\x1B[${y[1]};${d}~`;switch(a){case ce.TAB:return u&&!s&&!r?ce.SHIFT_TAB:m?`\x1B${a}`:`\x1B[9;${d}u`;case ce.SHIFT_TAB:return!s&&!r?a:`\x1B[9;${fp({...i,shift:!0})}u`;case ce.ENTER:return m?`\x1B${a}`:`\x1B[13;${d}u`;case ce.BACKSPACE:return s&&!r&&!u?"\b":m?`\x1B${a}`:`\x1B[127;${d}u`;case ce.ESC:return m?`\x1B${a}`:`\x1B[27;${d}u`}let b=a;return u&&a.length===1&&!s&&(b=a.toUpperCase()),s&&(b=bg(b)),r&&(b=V0(b)),b}function X0(a){return[...a].length===1?!0:yg.test(a)||vg.test(a)||xg.test(a)||a===ce.SHIFT_TAB}const wg=27,Sg=91,P0=60,hp=59,Cg=77,Tg=48,Z0=57,Q0=64,W0=-30,Ku=32,mp=255;function Mg(a){return Number.isInteger(a)&&(a&W0)===Q0}function J0(a){return a>=Tg&&a<=Z0}function Yu(a,i){let s=i,r=0;for(;s<a.length&&J0(a[s]);){if(r=r*10+(a[s]-Tg),r>65535)return null;s+=1}return s===i?null:{value:r,next:s}}function ev(a,i){if(a[i]!==wg||a[i+1]!==Sg||a[i+2]!==P0)return-1;const s=Yu(a,i+3);if(!s||!Mg(s.value)||a[s.next]!==hp)return-1;const r=Yu(a,s.next+1);if(!r||a[r.next]!==hp)return-1;const u=Yu(a,r.next+1);return!u||a[u.next]!==Cg?-1:u.next+1}function tv(a,i){if(a[i]!==wg||a[i+1]!==Sg||a[i+2]!==Cg||i+6>a.length)return-1;const s=a[i+3]-Ku,r=a[i+4],u=a[i+5];return!Mg(s)||r<Ku||r>mp||u<Ku||u>mp?-1:i+6}function Mo(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=ev(i,s);if(r>s){s=r;continue}const u=tv(i,s);if(u>s){s=u;continue}return!1}return!0}const nv=3e3,iv=1e4,lv=1500;class av{constructor(i){X(this,"ws",null);X(this,"config");X(this,"state","disconnected");X(this,"currentRole","viewer");X(this,"controllerId");X(this,"hostId");X(this,"assignedClientId");X(this,"reconnectAttempts",0);X(this,"reconnectTimer",null);X(this,"pingTimer",null);X(this,"pingTimestamp",null);X(this,"lastInboundAt",0);X(this,"pingSentAt",null);X(this,"connectStartedAt",0);X(this,"lastWakeConnectAt",0);X(this,"probeTimer",null);X(this,"rejectedByRelay",!1);X(this,"isManuallyClosed",!1);X(this,"authFailureDetail",null);X(this,"authFailureCode",null);X(this,"temporaryFailureCode",null);X(this,"pendingInputSegments",[]);X(this,"isFlushScheduled",!1);X(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});X(this,"terminalCols",80);X(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(u=>{try{u(...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=u=>{this.isStaleSocket(r)||this.handleMessage(u)},r.onerror=u=>{this.isStaleSocket(r)||this.handleError(u)},r.onclose=u=>{this.isStaleSocket(r)||this.handleClose(u)}}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<lv)return;this.lastWakeConnectAt=s,this.reconnectAttempts=0,this.connect();return}if(r.readyState===WebSocket.CONNECTING){s-this.connectStartedAt>iv&&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")},nv)}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);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);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}}}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})}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=>!Mo(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 u=0;for(let d=0;d<i.length;d++)s.set(i[d],u),u+=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=gd(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:",u=window.location.host,d=i.startsWith("/")?i:`/${i}`;return`${r}//${u}${d}`}return"ws://127.0.0.1:8787/ws/client"}}function sv(a,i=window,s=document){const r=y=>{var b;((b=i.navigator)==null?void 0:b.onLine)!==!1&&a.wake(y)},u=()=>{s.visibilityState==="visible"&&r("visible")},d=()=>r("pageshow"),m=()=>r("online"),h=()=>r("focus"),p=()=>r("resume");return s.addEventListener("visibilitychange",u),s.addEventListener("resume",p),i.addEventListener("pageshow",d),i.addEventListener("online",m),i.addEventListener("focus",h),()=>{s.removeEventListener("visibilitychange",u),s.removeEventListener("resume",p),i.removeEventListener("pageshow",d),i.removeEventListener("online",m),i.removeEventListener("focus",h)}}const rv=10,ov=24,_o=15,bd=13,yd=640;function cv(){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 $a()<yd}function $a(){return typeof window>"u"?1024:window.visualViewport&&typeof window.visualViewport.width=="number"&&window.visualViewport.width>0?window.visualViewport.width:window.innerWidth||1024}function Gu(){return typeof window>"u"?768:window.visualViewport&&typeof window.visualViewport.height=="number"&&window.visualViewport.height>0?window.visualViewport.height:window.innerHeight||768}function Ao(a,i=_o){const s=typeof a=="number"?a:Number(a);return!Number.isFinite(s)||s<=0?i:Math.min(ov,Math.max(rv,Math.round(s)))}function pp(a,i=$a()){if(i<yd){const r=Ao(a,bd);return Math.min(15,Math.max(12,r))}return Ao(a,_o)}const Ag=[{id:"esc",label:"ESC",code:ce.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:ce.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:ce.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:ce.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:ce.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:ce.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:ce.ENTER,type:"key",enabled:!0,title:"Enter / Return"}],uv=[{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:ce.ESC,type:"key",enabled:!0,title:"Escape"},{id:"tab",label:"TAB",code:ce.TAB,type:"key",enabled:!0,title:"Tab"},{id:"shift_tab",label:"⇧TAB",code:ce.SHIFT_TAB,type:"key",enabled:!0,title:"Shift+Tab"},{id:"enter",label:"Enter",code:ce.ENTER,type:"key",enabled:!0,title:"Enter / Return"},{id:"backspace",label:"⌫",code:ce.BACKSPACE,type:"key",enabled:!0,title:"Backspace"},{id:"delete",label:"Del",code:ce.DELETE,type:"key",enabled:!0,title:"Delete"},{id:"left",label:"←",code:ce.LEFT,type:"key",enabled:!0,title:"Arrow Left"},{id:"up",label:"↑",code:ce.UP,type:"key",enabled:!0,title:"Arrow Up"},{id:"down",label:"↓",code:ce.DOWN,type:"key",enabled:!0,title:"Arrow Down"},{id:"right",label:"→",code:ce.RIGHT,type:"key",enabled:!0,title:"Arrow Right"},{id:"home",label:"Home",code:ce.HOME,type:"key",enabled:!0,title:"Home"},{id:"end",label:"End",code:ce.END,type:"key",enabled:!0,title:"End"},{id:"page_up",label:"PgUp",code:ce.PAGE_UP,type:"key",enabled:!0,title:"Page Up"},{id:"page_down",label:"PgDn",code:ce.PAGE_DOWN,type:"key",enabled:!0,title:"Page Down"},{id:"insert",label:"Ins",code:ce.INSERT,type:"key",enabled:!0,title:"Insert"},{id:"ctrl_c",label:"^C",code:ce.CTRL_C,type:"chord",enabled:!0,title:"Ctrl+C (SIGINT)"},{id:"ctrl_d",label:"^D",code:ce.CTRL_D,type:"chord",enabled:!0,title:"Ctrl+D (EOF/Exit)"},{id:"ctrl_z",label:"^Z",code:ce.CTRL_Z,type:"chord",enabled:!0,title:"Ctrl+Z (SIGTSTP)"},{id:"ctrl_l",label:"^L",code:ce.CTRL_L,type:"chord",enabled:!0,title:"Ctrl+L (Clear Screen)"},{id:"ctrl_a",label:"^A",code:ce.CTRL_A,type:"chord",enabled:!0,title:"Ctrl+A (Beginning of Line)"},{id:"ctrl_e",label:"^E",code:ce.CTRL_E,type:"chord",enabled:!0,title:"Ctrl+E (End of Line)"},{id:"ctrl_k",label:"^K",code:ce.CTRL_K,type:"chord",enabled:!0,title:"Ctrl+K (Kill to End)"},{id:"ctrl_r",label:"^R",code:ce.CTRL_R,type:"chord",enabled:!0,title:"Ctrl+R (Reverse Search)"},{id:"f1",label:"F1",code:ce.F1,type:"fn",enabled:!0,title:"F1"},{id:"f2",label:"F2",code:ce.F2,type:"fn",enabled:!0,title:"F2"},{id:"f3",label:"F3",code:ce.F3,type:"fn",enabled:!0,title:"F3"},{id:"f4",label:"F4",code:ce.F4,type:"fn",enabled:!0,title:"F4"},{id:"f5",label:"F5",code:ce.F5,type:"fn",enabled:!0,title:"F5"},{id:"f6",label:"F6",code:ce.F6,type:"fn",enabled:!0,title:"F6"},{id:"f7",label:"F7",code:ce.F7,type:"fn",enabled:!0,title:"F7"},{id:"f8",label:"F8",code:ce.F8,type:"fn",enabled:!0,title:"F8"},{id:"f9",label:"F9",code:ce.F9,type:"fn",enabled:!0,title:"F9"},{id:"f10",label:"F10",code:ce.F10,type:"fn",enabled:!0,title:"F10"},{id:"f11",label:"F11",code:ce.F11,type:"fn",enabled:!0,title:"F11"},{id:"f12",label:"F12",code:ce.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 Zs(){return JSON.parse(JSON.stringify(Ag))}const dv=[["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 fv(a){return dv.some(i=>a.length===i.length&&a.every((s,r)=>s.id===i[r]&&s.enabled!==!1))}function hv(a){if(!Array.isArray(a)||a.length===0)return Zs();const i=a.filter(s=>typeof s=="object"&&s!==null&&typeof s.id=="string"&&typeof s.label=="string"&&typeof s.code=="string");return fv(i)?Zs():i.filter(s=>s.id!=="drawer_agent")}function ad(a,i){if(i){const s=`keyTitles.${a.id}`,r=i(s);if(r&&r!==s)return r}return a.title||a.label}class Ai extends Error{constructor(s,r={}){super(s);X(this,"code");X(this,"params");this.name="KeyComboError",this.code=s,this.params=r}}const mv={escape:"esc",return:"enter",pgup:"pageup",pgdn:"pagedown",backslash:"\\",plus:"+"},gp={esc:ce.ESC,tab:ce.TAB,enter:ce.ENTER,backspace:ce.BACKSPACE,delete:ce.DELETE,left:ce.LEFT,right:ce.RIGHT,up:ce.UP,down:ce.DOWN,home:ce.HOME,end:ce.END,pageup:ce.PAGE_UP,pagedown:ce.PAGE_DOWN,insert:ce.INSERT,space:" ","+":"+"},pv={esc:"ESC",tab:"TAB",enter:"⏎",backspace:"⌫",delete:"DEL",left:"←",right:"→",up:"↑",down:"↓",home:"HOME",end:"END",pageup:"PGUP",pagedown:"PGDN",insert:"INS",space:"SPACE","+":"+"},gv={2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};function Eg(a,i){const s=a.toLowerCase().split("+");if(s.some(p=>!p))throw new Ai("invalidStepSyntax",{step:i+1});const r={};let u;for(const p of s)if(p==="ctrl"||p==="control"){if(r.ctrl)throw new Ai("duplicateModifier",{step:i+1,modifier:"Ctrl"});r.ctrl=!0}else if(p==="alt"||p==="option"){if(r.alt)throw new Ai("duplicateModifier",{step:i+1,modifier:"Alt"});r.alt=!0}else if(p==="shift"){if(r.shift)throw new Ai("duplicateModifier",{step:i+1,modifier:"Shift"});r.shift=!0}else if(u===void 0)u=p;else throw new Ai("multipleKeys",{step:i+1});if(!u)throw new Ai("missingKey",{step:i+1});const d=mv[u]||u,m=/^f(?:[1-9]|1[0-2])$/.exec(d);let h;if(m)h=ce[d.toUpperCase()];else if(Object.hasOwn(gp,d))h=gp[d];else if([...d].length===1&&/^[\x21-\x7e]$/.test(d))h=d;else throw new Ai("unsupportedKey",{step:i+1,key:d});return{key:h,keyName:d,modifiers:r,sequence:yv(h,d,r)}}function bv(a){return 1+(a.shift?1:0)+(a.alt?2:0)+(a.ctrl?4:0)}function bp(a,i){const s=[...a][0].codePointAt(0);return s===void 0?"":`\x1B[${s};${bv(i)}u`}function yv(a,i,s){if(!s.ctrl)return To(a,s);if(i.length===1&&/^[\x20-\x7e]$/.test(i)){const r=i.toLowerCase();if(s.alt||s.shift||r==="m"||r==="i")return bp(r,s);if(r==="-"||r==="/"||r==="_")return"";const u=bg(r);return u!==r?u:bp(r,s)}return To(a,s)}function Ei(a){if(typeof a!="string"||!a.trim())throw new Ai("empty");const i=a.trim().split(/\s+/);if(i.length>8)throw new Ai("tooManySteps",{count:8});return i.map((s,r)=>Eg(s,r).sequence)}function qs(a){const i=a.trim().split(/\s+/);return i.length>1&&i.every(s=>["esc","escape"].includes(s.toLowerCase()))?`ESC${gv[i.length]||` ×${i.length}`}`:i.map((s,r)=>{const{keyName:u,modifiers:d}=Eg(s,r),m=pv[u]||(/^f\d+$/.test(u),u.toUpperCase());return d.ctrl&&d.alt&&d.shift?`Ctrl+Alt+⇧${m}`:d.ctrl&&d.alt?`Ctrl+Alt+${m}`:d.ctrl&&d.shift?`^⇧${m}`:d.ctrl?`^${m}`:d.alt&&d.shift?`Alt+⇧${m}`:d.alt?`Alt+${m}`:d.shift?`⇧${m}`:m}).join(" ")}const sd='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace',vv='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',yp="JetBrains Mono, Menlo, Monaco, Consolas, monospace",qa="herdr_remote_settings_v1",Vs="herdr_remote_session_view_v1",Ng=64,Qs=4096,rd={local:{},session:{}};function Eo(a,i){if(typeof window>"u")return rd[a][i]||null;try{return(a==="local"?window.localStorage:window.sessionStorage).getItem(i)}catch{return rd[a][i]||null}}function ea(a,i,s){if(rd[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)}}function xv(){return`client-${Math.random().toString(36).substring(2,8)}`}function vd(){const a=Math.random().toString(36).substring(2,10);return`profile-${Date.now().toString(36)}-${a}`}function wv(a,i){return(typeof a=="string"?a.trim().slice(0,Ng):"")||i}function No(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):"",u=typeof s.token=="string"?s.token.slice(0,Qs):"",d=typeof s.pairCode=="string"?s.pairCode.trim().toUpperCase().slice(0,32):"";if(!r||!r.startsWith("/")&&!/^(?:wss?|https?):\/\//i.test(r)||!u&&!d)return null;const m=Date.now(),h=typeof s.id=="string"&&s.id.length>0?s.id.slice(0,128):vd(),p=typeof s.hostname=="string"&&s.hostname.trim()?s.hostname.trim().slice(0,Ng):`Herdr ${i+1}`;return{id:h,displayName:wv(s.displayName,p),wsUrl:r,token:u,...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):m,lastUsedAt:Number.isFinite(s.lastUsedAt)?Number(s.lastUsedAt):m}}function vp(a,i=0){const s=No({...a,id:a.id||vd()},i);if(!s)throw new Error("a connection profile requires a relay URL and token or pairing code");return s}function xp(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 kg(){return typeof navigator<"u"&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Lg(){const a=typeof window<"u"&&window.innerWidth<640;return{wsUrl:"/ws/client",token:"",pairCode:"",clientId:xv(),autoReconnect:!0,profiles:[],activeProfileId:"",fontSize:a?bd:_o,fontFamily:sd,toolbarVisible:!0,toolbarPosition:"bottom",vibrateOnKeyPress:!0,predictiveEcho:"auto",agentAlertBadge:!0,agentAlertSound:!1,agentAlertVibrate:!1,agentAlertNotify:!1,language:kg(),virtualKeys:Zs(),agentKeymaps:{},adminToken:"",adminTokens:{}}}const Sv=["wsUrl","token","pairCode","clientId","autoReconnect","language","agentKeymaps"],Cv=["wsUrl","token","pairCode","autoReconnect"],xd=["fontSize","fontFamily","toolbarVisible","toolbarPosition","vibrateOnKeyPress","predictiveEcho","virtualKeys","agentAlertBadge","agentAlertSound","agentAlertVibrate","agentAlertNotify","adminToken","adminTokens"],Tv=xd.filter(a=>a!=="adminToken"&&a!=="adminTokens"),wp=["theme","colorMode"];function od(a){const i=a;if(!wp.some(u=>i[u]!==void 0))return{data:a,changed:!1};const r={...i};for(const u of wp)delete r[u];return{data:r,changed:!0}}function Rg(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,Qs));return i}function _g(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 u=r,d={};if(Array.isArray(u.order)&&(d.order=[...new Set(u.order.filter(m=>typeof m=="string"&&/^[a-zA-Z0-9_-]{1,64}$/.test(m)))].slice(0,256)),u.actions&&typeof u.actions=="object"&&!Array.isArray(u.actions)){const m=Object.create(null);for(const[h,p]of Object.entries(u.actions).slice(0,256)){if(!/^[a-zA-Z0-9_-]{1,64}$/.test(h)||!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{Ei(v),b.keys=v}catch{}}typeof y.hidden=="boolean"&&(b.hidden=y.hidden),Object.keys(b).length>0&&(m[h]=b)}d.actions=m}if(Array.isArray(u.custom)){const m=new Set;d.custom=u.custom.slice(0,64).flatMap(h=>{if(!h||typeof h!="object"||Array.isArray(h))return[];const p=h;if(typeof p.id!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(p.id)||["__proto__","constructor","prototype"].includes(p.id)||m.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{Ei(y)}catch{return[]}return m.add(p.id),[{id:p.id,label:p.label.trim().slice(0,64),keys:y}]})}i[s]=d}return i}function jg(a){var d;const i=[];if((Array.isArray(a.profiles)?a.profiles.slice(0,64):[]).forEach((m,h)=>{const p=No(m,h);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 m=No({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);m&&i.push(m)}const r=typeof a.activeProfileId=="string"?a.activeProfileId:"",u=i.some(m=>m.id===r)?r:((d=i[0])==null?void 0:d.id)||"";return{profiles:i,activeProfileId:u}}function Dg(){const a=Lg();if(typeof window>"u")return a;let i={};const s=Eo("local",qa);if(s)try{i=JSON.parse(s)}catch(se){console.warn("Failed to parse localStorage settings:",se)}const r=od(i);r.changed&&(i=r.data,ea("local",qa,JSON.stringify(i)));let u=null;const d=Eo("session",Vs);if(d)try{u=JSON.parse(d)}catch(se){console.warn("Failed to parse sessionStorage settings:",se)}if(!u){const se={};for(const pe of xd)i[pe]!==void 0&&(se[pe]=i[pe]);u=se,ea("session",Vs,JSON.stringify(u))}let m=u.fontFamily??i.fontFamily??a.fontFamily;(!m||m===yp||m===vv)&&(m=sd);const h=window.innerWidth<640?bd:_o,p=u.fontSize??i.fontSize??a.fontSize,y=Ao(p,h),b=u.virtualKeys??i.virtualKeys??a.virtualKeys,v=hv(b),S=i.language??a.language,T=S==="zh"||S==="en"?S:kg(),E=jg(i),Y=E.profiles.find(se=>se.id===E.activeProfileId),A=od(u);A.changed&&(u=A.data,ea("session",Vs,JSON.stringify(u)));const z=u.toolbarVisible??i.toolbarVisible??a.toolbarVisible,O=u.toolbarPosition??i.toolbarPosition??a.toolbarPosition,B=u.vibrateOnKeyPress??i.vibrateOnKeyPress??a.vibrateOnKeyPress,te=se=>{const pe=u[se]??i[se];return typeof pe=="boolean"?pe:a[se]},ue=(u==null?void 0:u.predictiveEcho)??(i==null?void 0:i.predictiveEcho)??a.predictiveEcho,W=ue==="always"||ue==="off"||ue==="auto"?ue:"auto",G=typeof u.adminToken=="string"?u.adminToken.slice(0,Qs):typeof i.adminToken=="string"?i.adminToken.slice(0,Qs):a.adminToken,U=Rg(u.adminTokens),ie={...a,...i,...u,wsUrl:(Y==null?void 0:Y.wsUrl)||(typeof i.wsUrl=="string"?i.wsUrl:a.wsUrl),token:(Y==null?void 0:Y.token)||"",pairCode:(Y==null?void 0:Y.pairCode)||"",autoReconnect:(Y==null?void 0:Y.autoReconnect)??a.autoReconnect,profiles:E.profiles,activeProfileId:E.activeProfileId,clientId:typeof i.clientId=="string"&&i.clientId.trim()?i.clientId.trim().slice(0,128):a.clientId,fontFamily:m,fontSize:y,toolbarVisible:z,toolbarPosition:O,vibrateOnKeyPress:B,predictiveEcho:W,virtualKeys:v,agentKeymaps:_g(i.agentKeymaps),agentAlertBadge:te("agentAlertBadge"),agentAlertSound:te("agentAlertSound"),agentAlertVibrate:te("agentAlertVibrate"),agentAlertNotify:te("agentAlertNotify"),language:T,adminToken:G,adminTokens:U};return i.fontFamily===yp&&(i.fontFamily=sd,ea("local",qa,JSON.stringify(i))),ie}function Ll(a){var S;const s={...Dg(),...a};s.agentKeymaps=_g(s.agentKeymaps),s.adminTokens=Rg(s.adminTokens),typeof s.adminToken=="string"&&(s.adminToken=s.adminToken.slice(0,Qs)),a.fontSize!==void 0&&(s.fontSize=Ao(a.fontSize)),a.predictiveEcho!==void 0&&(a.predictiveEcho==="auto"||a.predictiveEcho==="always"||a.predictiveEcho==="off"?s.predictiveEcho=a.predictiveEcho:s.predictiveEcho="auto");const r=jg(s);let u=r.profiles,d=r.activeProfileId;if(Cv.some(T=>a[T]!==void 0)){const T=u.findIndex(A=>A.id===d),E=T>=0?{...u[T]}:{id:vd(),displayName:`Herdr ${u.length+1}`,wsUrl:s.wsUrl,token:"",autoReconnect:!0,createdAt:Date.now(),lastUsedAt:Date.now()};E.wsUrl=s.wsUrl,E.token=s.token,E.pairCode=s.pairCode||void 0,E.autoReconnect=s.autoReconnect,E.lastUsedAt=Date.now();const Y=No(E,Math.max(T,0));Y?T>=0?u[T]=Y:(u.push(Y),d=Y.id):T>=0&&(u=u.filter(A=>A.id!==d),d=((S=u[0])==null?void 0:S.id)||"")}u.length>0&&!u.some(T=>T.id===d)&&(d=u[0].id);const h=u.find(T=>T.id===d);s.profiles=u,s.activeProfileId=d,s.wsUrl=(h==null?void 0:h.wsUrl)||s.wsUrl||"/ws/client",s.token=(h==null?void 0:h.token)||"",s.pairCode=(h==null?void 0:h.pairCode)||"",s.autoReconnect=(h==null?void 0:h.autoReconnect)??s.autoReconnect;const p=Eo("local",qa);let y={};if(p)try{y=JSON.parse(p)}catch{}y=od(y).data;for(const T of Sv)s[T]!==void 0&&(y[T]=s[T]);y.profiles=u,y.activeProfileId=d,ea("local",qa,JSON.stringify(y));const b=Eo("session",Vs);let v={};if(b)try{v=JSON.parse(b)}catch{}for(const T of xd)s[T]!==void 0&&(v[T]=s[T]);ea("session",Vs,JSON.stringify(v));for(const T of Tv)s[T]!==void 0&&(y[T]=s[T]);return ea("local",qa,JSON.stringify(y)),s}const Mv={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"},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:",step1CopyPlugin:"Using Herdr Plugin:",step1CopyCli:"Copy CLI Command",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."},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:{system:"System Default",apple:"SF Mono / Menlo",windows:"Consolas",linux:"Liberation Mono",courier:"Courier New",firacode:"Fira Code"},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"}},Av={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:"会话已断开"},onboarding:{title:"配对 Herdr Remote",subtitle:"连接手机或浏览器至本地终端会话",description:"在浏览器或移动设备中控制 Herdr 会话。",firstTimeSetup:"首次配对",authRequired:"需要认证",authRequiredDesc:"使用配对码配对设备,或提供有效访问令牌。",step1Title:"在 Herdr 宿主机生成配对码",step1Desc:"在运行 Herdr 的主机终端执行:",step1CopyPlugin:"使用 Herdr 插件:",step1CopyCli:"复制 CLI 命令",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:"仅调节当前窗口字号,不影响其他窗口。"},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:{system:"系统默认",apple:"Apple SF Mono / Menlo",windows:"Windows Consolas",linux:"Linux Liberation Mono",courier:"Courier New",firacode:"Fira Code"},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:"移除图片"}},Iu={en:Mv,zh:Av};function wd(a,i,s){const r=Iu[a]||Iu.en,u=i.split(".");let d=r;for(const m of u)if(d&&typeof d=="object"&&m in d)d=d[m];else{let h=Iu.en;for(const p of u)if(h&&typeof h=="object"&&p in h)h=h[p];else return i;d=h;break}if(typeof d!="string")return i;if(s){let m=d;for(const[h,p]of Object.entries(s))m=m.replaceAll(`{${h}}`,String(p));return m}return d}const Sp="#11111b",cd=[{id:"system",name:"System Default (Recommended)",font:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "Symbols Nerd Font Mono", monospace'},{id:"apple",name:"Apple SF Mono / Menlo",font:'SFMono-Regular, Menlo, Monaco, "Symbols Nerd Font Mono", monospace'},{id:"windows",name:"Windows Consolas",font:'Consolas, "Lucida Console", "Symbols Nerd Font Mono", monospace'},{id:"linux",name:"Linux Liberation Mono",font:'"Liberation Mono", "DejaVu Sans Mono", "Symbols Nerd Font Mono", monospace'},{id:"courier",name:"Courier New",font:'"Courier New", Courier, "Symbols Nerd Font Mono", monospace'},{id:"firacode",name:"Fira Code (Ligatures)",font:'"Fira Code", "Symbols Nerd Font Mono", monospace'}];function Cp(a){if(!a||typeof a!="string")return cd[0].font;const i=a.trim();if(i.includes("Symbols Nerd Font"))return i;if(/^['"]?monospace['"]?$/i.test(i))return'"Symbols Nerd Font Mono", monospace';const s=/,\s*['"]?monospace['"]?\s*$/i;return s.test(i)?i.replace(s,', "Symbols Nerd Font Mono", monospace'):`${i}, "Symbols Nerd Font Mono", monospace`}function Ev(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 zg(){if(typeof document>"u")return;const a=document.querySelector('meta[name="theme-color"]');document.documentElement.style.colorScheme="dark",a==null||a.setAttribute("content",Sp),document.documentElement.classList.add("dark"),document.documentElement.classList.remove("light"),document.body.classList.add("dark"),document.body.classList.remove("light"),document.body.style.backgroundColor=Sp}const N=(a,i,s,r=!0)=>({id:a,labelKey:i,combo:s,verified:r}),Og={claude:{id:"claude",name:"Claude Code",shortName:"Claude",configHint:"~/.claude/keybindings.json",bar:["mode","rewind","details","model"],actions:[N("mode","mode","shift+tab"),N("rewind","rewind","esc esc"),N("details","details","ctrl+o"),N("model","model","alt+p"),N("thinking","thinking","alt+t"),N("todos","todos","ctrl+t"),N("background","background","ctrl+b"),N("editor","editor","ctrl+g"),N("history","history","ctrl+r"),N("stash","stash","ctrl+s"),N("pasteImage","pasteImage","ctrl+v"),N("newline","newline","ctrl+j"),N("interrupt","interrupt","esc")]},codex:{id:"codex",name:"Codex",shortName:"Codex",configHint:"~/.codex/config.toml [tui.keymap]",bar:["mode","editPrevious","details"],actions:[N("mode","mode","shift+tab"),N("editPrevious","editPrevious","esc esc"),N("details","details","ctrl+t"),N("queue","queue","tab"),N("history","history","ctrl+r"),N("copy","copy","ctrl+o"),N("editor","editor","ctrl+g"),N("newline","newline","ctrl+j"),N("clear","clear","ctrl+l"),N("interrupt","interrupt","esc")]},gemini:{id:"gemini",name:"Gemini CLI",shortName:"Gemini",configHint:"~/.gemini/keybindings.json",bar:["mode","yolo","rewind"],actions:[N("mode","mode","shift+tab"),N("yolo","yolo","ctrl+y"),N("rewind","rewind","esc esc"),N("todos","todos","ctrl+t"),N("expand","expand","ctrl+o"),N("background","background","ctrl+b"),N("editor","editor","ctrl+g"),N("history","history","ctrl+r"),N("undo","undo","ctrl+z"),N("newline","newline","ctrl+j"),N("interrupt","interrupt","esc")]},qwen:{id:"qwen",name:"Qwen Code",shortName:"Qwen",bar:["mode","history"],actions:[N("mode","mode","shift+tab"),N("interrupt","interrupt","esc"),N("history","history","ctrl+r"),N("newline","newline","ctrl+j"),N("todos","todos","ctrl+t",!1),N("rewind","rewind","esc esc",!1)]},opencode:{id:"opencode",name:"OpenCode",shortName:"OpenCode",configHint:"tui.json keybinds",bar:["palette","model","sessions"],actions:[N("agent","agent","tab"),N("agentBack","agentBack","shift+tab"),N("interrupt","interrupt","esc"),N("palette","palette","ctrl+p"),N("model","model","ctrl+x m"),N("recentModel","recentModel","f2"),N("variant","variant","ctrl+t"),N("newSession","newSession","ctrl+x n"),N("sessions","sessions","ctrl+x l"),N("undo","undo","ctrl+x u"),N("editor","editor","ctrl+x e"),N("newline","newline","ctrl+j")]},kilo:{id:"kilo",name:"Kilo Code",shortName:"Kilo",configHint:"~/.config/kilo/tui.jsonc",bar:["palette","model","sessions"],actions:[N("agent","agent","tab",!1),N("agentBack","agentBack","shift+tab",!1),N("interrupt","interrupt","esc"),N("palette","palette","ctrl+p"),N("model","model","ctrl+x m"),N("recentModel","recentModel","f2"),N("variant","variant","ctrl+t"),N("newSession","newSession","ctrl+x n"),N("sessions","sessions","ctrl+x l"),N("undo","undo","ctrl+x u"),N("editor","editor","ctrl+x e"),N("newline","newline","ctrl+j")]},pi:{id:"pi",name:"Pi",shortName:"Pi",configHint:"~/.pi/agent/keybindings.json",bar:["thinkingMode","modelPicker","tools"],actions:[N("thinkingMode","thinkingMode","shift+tab"),N("interrupt","interrupt","esc"),N("nextModel","nextModel","ctrl+p"),N("modelPicker","modelPicker","ctrl+l"),N("tools","tools","ctrl+o"),N("thinkingBlocks","thinkingBlocks","ctrl+t"),N("editor","editor","ctrl+g"),N("followup","followup","alt+enter"),N("dequeue","dequeue","alt+up"),N("newline","newline","shift+enter")]},omp:{id:"omp",name:"Oh My Pi",shortName:"OMP",configHint:"~/.omp/agent/keybindings.yml",bar:["thinkingMode","plan","model"],actions:[N("thinkingMode","thinkingMode","shift+tab"),N("plan","plan","alt+shift+p"),N("model","model","alt+m"),N("temporaryModel","temporaryModel","alt+p"),N("nextModel","nextModel","ctrl+p"),N("tools","tools","ctrl+o"),N("thinking","thinking","ctrl+t"),N("history","history","ctrl+r"),N("editor","editor","ctrl+g"),N("followup","followup","ctrl+enter"),N("interrupt","interrupt","esc")]},copilot:{id:"copilot",name:"GitHub Copilot",shortName:"Copilot",bar:["mode","expand","reasoning"],actions:[N("mode","mode","shift+tab"),N("interrupt","interrupt","esc"),N("expand","expand","ctrl+o"),N("expandAll","expandAll","ctrl+e"),N("reasoning","reasoning","ctrl+t"),N("editor","editor","ctrl+g"),N("clear","clear","ctrl+l")]},cursor:{id:"cursor",name:"Cursor",shortName:"Cursor",bar:["mode","review"],actions:[N("mode","mode","shift+tab"),N("review","review","ctrl+r"),N("newline","newline","ctrl+j"),N("interrupt","interrupt","esc",!1)]},droid:{id:"droid",name:"Factory Droid",shortName:"Droid",configHint:"In-app settings",bar:["specMode","autonomy"],actions:[N("specMode","specMode","shift+tab"),N("autonomy","autonomy","ctrl+l"),N("details","details","ctrl+o",!1),N("queue","queue","ctrl+enter"),N("interrupt","interrupt","esc",!1)]},kimi:{id:"kimi",name:"Kimi Code",shortName:"Kimi",bar:["plan","undoPicker","expand"],actions:[N("plan","plan","shift+tab"),N("interrupt","interrupt","esc"),N("undoPicker","undoPicker","esc esc"),N("expand","expand","ctrl+o"),N("editor","editor","ctrl+g"),N("steer","steer","ctrl+s"),N("undo","undo","ctrl+-"),N("newline","newline","ctrl+j"),N("pasteImage","pasteImage","ctrl+v")]},amp:{id:"amp",name:"Amp",shortName:"Amp",bar:["palette","reasoning","mode"],actions:[N("palette","palette","ctrl+o"),N("reasoning","reasoning","alt+d"),N("mode","mode","ctrl+s",!1),N("editor","editor","ctrl+g"),N("history","history","ctrl+r"),N("sidebar","sidebar","ctrl+backslash"),N("pasteImage","pasteImage","ctrl+v"),N("interrupt","interrupt","esc",!1)]},hermes:{id:"hermes",name:"Hermes",shortName:"Hermes",bar:["interrupt","agents","sessions"],actions:[N("interrupt","interrupt","ctrl+c"),N("newline","newline","ctrl+j"),N("editor","editor","ctrl+g"),N("agents","agents","ctrl+t"),N("sessions","sessions","ctrl+x")]},qodercli:{id:"qodercli",name:"Qoder CLI",shortName:"Qoder",configHint:"/shortcuts in-app",bar:["permissionMode","bypass","tasks","interrupt"],actions:[N("permissionMode","permissionMode","shift+tab"),N("bypass","bypass","ctrl+y"),N("tasks","tasks","ctrl+t"),N("editor","editor","ctrl+x"),N("history","history","ctrl+r"),N("queue","queue","ctrl+enter"),N("newline","newline","ctrl+j"),N("pasteImage","pasteImage","alt+v"),N("interrupt","interrupt","ctrl+c")]},devin:{id:"devin",name:"Devin",shortName:"Devin",configHint:"~/.config/devin/config.json keymap",bar:["mode","thinking","interrupt"],actions:[N("mode","mode","shift+tab"),N("interrupt","interrupt","ctrl+c"),N("thinking","thinking","alt+t"),N("newline","newline","ctrl+j"),N("pasteImage","pasteImage","ctrl+v")]},grok:{id:"grok",name:"Grok CLI",shortName:"Grok",bar:["mode","rewind","interrupt"],actions:[N("mode","mode","shift+tab"),N("interrupt","interrupt","ctrl+c"),N("rewind","rewind","esc esc"),N("interject","interject","ctrl+enter"),N("multiline","multiline","ctrl+m"),N("newline","newline","alt+enter"),N("shortcuts","shortcuts","ctrl+.")]},agy:{id:"agy",name:"Antigravity",shortName:"Antigravity",configHint:"~/.gemini/antigravity-cli/keybindings.json",bar:["mode","approve","interrupt"],actions:[N("mode","mode","shift+tab"),N("interrupt","interrupt","ctrl+c"),N("background","background","ctrl+b"),N("approve","approve","ctrl+k"),N("clear","clear","esc esc")]},mastracode:{id:"mastracode",name:"MastraCode",shortName:"MastraCode",bar:["interrupt","thinking","expand"],actions:[N("interrupt","interrupt","ctrl+c"),N("thinking","thinking","ctrl+t"),N("expand","expand","ctrl+e"),N("followup","followup","ctrl+f")]},letta:{id:"letta",name:"Letta Code",shortName:"Letta",bar:["permissionMode"],actions:[N("permissionMode","permissionMode","shift+tab"),N("interrupt","interrupt","esc",!1)]},kiro:{id:"kiro",name:"Kiro CLI",shortName:"Kiro",configHint:"kiro-cli settings chat.keybindings.*",bar:["agentSwap","details","steer"],actions:[N("agentSwap","agentSwap","shift+tab"),N("interrupt","interrupt","esc"),N("details","details","ctrl+t"),N("steer","steer","ctrl+s"),N("expand","expand","ctrl+o"),N("activity","activity","ctrl+x"),N("newline","newline","ctrl+j")]},cline:{id:"cline",name:"Cline",shortName:"Cline",bar:["autoApprove"],actions:[N("planAct","planAct","tab"),N("autoApprove","autoApprove","shift+tab"),N("interrupt","interrupt","esc",!1)]},maki:{id:"maki",name:"Maki",shortName:"Maki",bar:["rewind","search"],actions:[N("rewind","rewind","esc esc"),N("search","search","ctrl+f"),N("interrupt","interrupt","esc",!1)]},muse:{id:"muse",name:"Muse",shortName:"Muse",configHint:"/keymap in-app",bar:["queue","interruptCtrl"],actions:[N("interrupt","interrupt","esc"),N("queue","queue","alt+enter"),N("interruptCtrl","interrupt","ctrl+c")]},shell:{id:"shell",name:"Shell",shortName:"Shell",actions:[]}},Ia=Og,Nv=Object.keys(Og),Tp={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"},kv=[N("genericCtrlC","interrupt","ctrl+c"),N("genericCtrlD","eof","ctrl+d"),N("genericCtrlZ","suspend","ctrl+z"),N("genericCtrlL","clear","ctrl+l"),N("genericCtrlR","history","ctrl+r"),N("genericCtrlA","startOfLine","ctrl+a"),N("genericCtrlE","endOfLine","ctrl+e"),N("genericCtrlK","killToEnd","ctrl+k")],Lv=["genericCtrlC","genericCtrlD","genericCtrlL","genericCtrlR"],Rv=["genericCtrlC"];function _v(a){return a&&a.trim().toLowerCase().replace(/\\/g,"/").split("/").at(-1)||""}function Mp(a){const i=_v(a);return Tp[i]?Tp[i]:/^muse-bin-\d/.test(i)?"muse":null}function jv(a,i="auto"){return i&&i!=="auto"?Mp(i)||"shell":Mp(a)||"shell"}function Dv(a,i){var u,d;const s=a.map(m=>{var y;const h=(y=i==null?void 0:i.actions)==null?void 0:y[m.id];let p=typeof(h==null?void 0:h.keys)=="string"?h.keys:m.combo;try{Ei(p)}catch{p=m.combo}return{...m,defaultCombo:m.combo,combo:p,hidden:typeof(h==null?void 0:h.hidden)=="boolean"?h.hidden:m.defaultHidden===!0,custom:!1}}),r=new Set(s.map(m=>m.id));for(const m of(i==null?void 0:i.custom)||[]){if(!m||typeof m.id!="string"||r.has(m.id))continue;let h=m.keys;try{Ei(h)}catch{continue}s.push({id:m.id,labelKey:"custom",defaultCombo:h,combo:h,verified:!0,hidden:((d=(u=i==null?void 0:i.actions)==null?void 0:u[m.id])==null?void 0:d.hidden)===!0,custom:!0,customLabel:m.label}),r.add(m.id)}if(Array.isArray(i==null?void 0:i.order)){const m=new Map(i.order.map((h,p)=>[h,p]));s.sort((h,p)=>(m.get(h.id)??Number.MAX_SAFE_INTEGER)-(m.get(p.id)??Number.MAX_SAFE_INTEGER))}return s}function zv(a,i){const s=new Set(a.map(r=>r.combo.trim().toLowerCase()));return i.filter(r=>!s.has(r.combo.trim().toLowerCase()))}const Xs=a=>a.id.startsWith("generic");function Bg(a,i){const s=Ia[a],r=new Set([...s.bar||[],...a==="shell"?Lv:Rv]),u=[...s.actions,...kv].map(d=>({...d,defaultHidden:!r.has(d.id)}));return Dv(u,i)}function Ug(a,i){const s=Bg(a,i),r=s.filter(d=>!Xs(d)),u=new Set(zv(r,s.filter(Xs)));return s.filter(d=>!Xs(d)||u.has(d))}function Ov(a,i){const s=Ug(a,i).filter(r=>!r.hidden);return{agentActions:s.filter(r=>!Xs(r)),genericActions:s.filter(Xs)}}function Bv(a){const i={};for(const[s,r]of Object.entries(a.actions||{})){const u={...r};delete u.hidden,Object.keys(u).length>0&&(i[s]=u)}return{...a,actions:i}}const Hg=1568,Uv=3*1024*1024,Hv=[.85,.7,.55,.4],ui={active:!1,phase:"idle",ratio:0,percent:0,statusText:""};function Kv(a,i,s=Hg){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 u=s/r;return{width:Math.max(1,Math.round(a*u)),height:Math.max(1,Math.round(i*u))}}function Yv(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 Gv(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}async function Iv(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,u=URL.createObjectURL(a);r.onload=()=>{i({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,cleanup:()=>{try{URL.revokeObjectURL(u)}catch{}}})},r.onerror=()=>{try{URL.revokeObjectURL(u)}catch{}s(new Error("Failed to decode image source"))},r.src=u})}async function Kg(a,i=Hg,s=Uv){var u;if(!a||a.size===0||a.type&&!a.type.startsWith("image/"))return null;let r;try{r=await Iv(a)}catch(d){return console.warn("Failed to decode image for paste:",d),null}try{const{width:d,height:m}=Kv(r.width,r.height,i),h=document.createElement("canvas");h.width=d,h.height=m;const p=h.getContext("2d");if(!p)return null;p.drawImage(r.source,0,0,d,m);let y="image/webp";try{h.toDataURL("image/webp",.85).startsWith("data:image/webp")||(y="image/jpeg")}catch{y="image/jpeg"}for(const b of Hv){let v;try{v=h.toDataURL(y,b)}catch{continue}if(!v||!v.startsWith("data:"))continue;const S=v.indexOf(","),T=S!==-1?v.slice(S+1):"",E=Yv(T);if(E<=s)return{mime:y,dataBase64:T,dataUrl:v,byteLength:E,width:d,height:m}}return null}finally{(u=r.cleanup)==null||u.call(r)}}const $v=4e3,qv=3,Fv=4096,Vv=8*1024*1024,uo={ctrl:!1,alt:!1,shift:!1},Yg=w.createContext(null);function Ha(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 Xv=({children:a})=>{const[i,s]=w.useState(Dg),[r,u]=w.useState("disconnected"),[d,m]=w.useState(),[h,p]=w.useState(),[y,b]=w.useState("viewer"),[v,S]=w.useState(),[T,E]=w.useState(),[Y,A]=w.useState(),[z,O]=w.useState(null),[B,te]=w.useState(),[ue,W]=w.useState(null),[G,U]=w.useState(1),[ie,se]=w.useState(0),[pe,Ce]=w.useState(null),[Oe,rt]=w.useState(null),[Fe,L]=w.useState(null),[I,le]=w.useState({cols:80,rows:24}),[je,Q]=w.useState([]),Ze=jv(Oe==null?void 0:Oe.focusedAgent,"auto");w.useEffect(()=>{zg()},[]);const Le=w.useRef(i);Le.current=i;const fe=w.useRef(null),Ge=w.useRef(!1),Re=w.useRef(I);Re.current=I;const F=w.useRef(new Set),Be=w.useRef(new Set),[it,we]=w.useState(ui),Ke=w.useRef(null),gt=w.useRef(0),Ve=w.useRef(null),Qe=w.useCallback((H,q)=>wd(i.language,H,q),[i.language]),lt=w.useRef(Qe);lt.current=Qe;const wt=w.useRef(null),Dt=w.useRef([]),R=w.useRef(0),ve=w.useCallback(H=>{for(Dt.current.push(H),R.current+=H.byteLength;Dt.current.length>Fv||R.current>Vv;){const q=Dt.current.shift();if(!q)break;R.current-=q.byteLength}},[]),ye=w.useCallback(H=>{const q=wt.current;if(q)try{q(H);return}catch(de){console.debug("Terminal output sink threw, buffering chunk instead:",de)}ve(H)},[ve]),We=w.useRef(ye);We.current=ye;const bt=w.useCallback(H=>{wt.current=H;const q=Dt.current;Dt.current=[],R.current=0;for(let de=0;de<q.length;de++)try{H(q[de])}catch(Ee){console.debug("Terminal sink threw while flushing, re-buffering the tail:",Ee);for(let Te=de;Te<q.length;Te++)ve(q[Te]);break}return()=>{wt.current===H&&(wt.current=null)}},[ve]),ft=w.useCallback(()=>Dt.current.length,[]),St=w.useCallback(()=>{Dt.current=[],R.current=0},[]),oe=w.useCallback((H=!0)=>{b("viewer"),S(void 0),E(void 0),A(void 0),O(null),te(void 0),W(null),U(1),Ce(null),St(),H&&se(q=>q+1)},[St]),Ne=w.useRef([]),De=w.useRef(new Map),ot=w.useCallback(H=>{Ne.current=H,Q(H)},[]),Yt=w.useCallback(H=>{const q=De.current.get(H);q&&(clearTimeout(q),De.current.delete(H)),ot(Ne.current.filter(de=>de.id!==H))},[ot]),ni=w.useRef(Yt);ni.current=Yt;const Pe=w.useCallback((H,q)=>{const de=Date.now(),Ee=Ne.current,Te=Ee.find(Nt=>Nt.type===H&&Nt.message===q),ze=Te?Te.id:`${de}-${Math.random().toString(36).substring(2,6)}`;let He;if(Te)He=Ee.map(Nt=>Nt.id===ze?{...Nt,count:Nt.count+1,timestamp:de}:Nt);else for(He=[...Ee,{id:ze,type:H,message:q,timestamp:de,count:1}];He.length>qv;){const[Nt,...An]=He,Tt=De.current.get(Nt.id);Tt&&(clearTimeout(Tt),De.current.delete(Nt.id)),He=An}ot(He);const Ft=De.current.get(ze);Ft&&clearTimeout(Ft),De.current.set(ze,setTimeout(()=>ni.current(ze),$v))},[ot]),pi=w.useCallback(H=>{ni.current(H)},[]),gn=w.useRef(!0);w.useEffect(()=>{y==="controller"&&(gn.current=!0)},[y]);const zt=w.useCallback(()=>{gn.current&&(gn.current=!1,Pe("warning",lt.current("toasts.viewerModeWarning")))},[Pe]);w.useEffect(()=>{const H=De.current;return()=>{for(const q of H.values())clearTimeout(q);H.clear()}},[]);const Ct=w.useCallback(H=>{const q=Ll(H);Le.current=q,s(q)},[]),qt=w.useCallback(H=>{Ct({language:H})},[Ct]),at=w.useCallback(H=>{Le.current=H,s(H)},[]),aa=w.useCallback(H=>{var Te;const q=Le.current,de=vp({...H,wsUrl:H.wsUrl||"/ws/client",token:H.token||"",displayName:H.displayName||`Herdr ${q.profiles.length+1}`,autoReconnect:H.autoReconnect!==!1},q.profiles.length),Ee=Ll({profiles:[...q.profiles,de],activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect});at(Ee),oe(),(Te=fe.current)==null||Te.reconnectWith(Ha(Ee))},[at,oe]),Dn=w.useCallback(H=>{var Te;const q=Le.current,de=q.profiles.find(ze=>ze.id===H);if(!de||de.id===q.activeProfileId)return;const Ee=Ll({activeProfileId:de.id,wsUrl:de.wsUrl,token:de.token,pairCode:de.pairCode||"",autoReconnect:de.autoReconnect,profiles:q.profiles.map(ze=>ze.id===de.id?{...ze,lastUsedAt:Date.now()}:ze)});at(Ee),oe(),(Te=fe.current)==null||Te.reconnectWith(Ha(Ee))},[at,oe]),ii=w.useCallback((H,q)=>{const de=Le.current;if(!de.profiles.find(He=>He.id===H))return;const Te=q.trim().slice(0,64);if(!Te)return;const ze=Ll({profiles:de.profiles.map(He=>He.id===H?{...He,displayName:Te}:He)});at(ze)},[at]),Ni=w.useCallback(H=>{var ze;const q=Le.current;if(!q.profiles.some(He=>He.id===H))return;const de=q.profiles.filter(He=>He.id!==H),Ee=de.find(He=>He.id===q.activeProfileId)||de[0],Te=Ll(Ee?{profiles:de,activeProfileId:Ee.id,wsUrl:Ee.wsUrl,token:Ee.token,pairCode:Ee.pairCode||"",autoReconnect:Ee.autoReconnect}:{profiles:[],activeProfileId:"",wsUrl:"/ws/client",token:"",pairCode:""});at(Te),H===q.activeProfileId&&(oe(),(ze=fe.current)==null||ze.reconnectWith(Ha(Te)))},[at,oe]),rn=w.useCallback(H=>{const q=Le.current,de=q.profiles.find(En=>En.id===q.activeProfileId),Ee=H.hostId?xp({wsUrl:q.wsUrl,hostId:H.hostId}):null,Te=Ee?q.profiles.findIndex(En=>xp(En)===Ee):-1,ze=Te>=0?Te:Math.max(0,q.profiles.findIndex(En=>En.id===q.activeProfileId)),Ft={...q.profiles[ze]||de||vp({wsUrl:q.wsUrl||"/ws/client",token:"",pairCode:q.pairCode||"PENDING",displayName:`Herdr ${q.profiles.length+1}`},q.profiles.length),token:H.token,pairCode:void 0,...H.hostId?{hostId:H.hostId}:{},...H.deviceId?{deviceId:H.deviceId}:{},lastUsedAt:Date.now()};let Nt=[...q.profiles];ze>=0&&ze<Nt.length?Nt[ze]=Ft:Nt.push(Ft);const An=de==null?void 0:de.id;Nt=Nt.filter((En,zl)=>zl===ze||En.id===Ft.id?!0:!(Te>=0&&An&&En.id===An));const Tt=Ll({profiles:Nt,activeProfileId:Ft.id,wsUrl:Ft.wsUrl,token:Ft.token,pairCode:"",autoReconnect:Ft.autoReconnect});return at(Tt),Tt},[at]),gi=w.useCallback(H=>{const q=Le.current,de=q.profiles.find(He=>He.id===q.activeProfileId);if(!de||!H.hostId&&!H.hostname)return;const Ee=/^Herdr \d+$/.test(de.displayName),Te={...de,...H.hostId?{hostId:H.hostId}:{},...H.hostname?{hostname:H.hostname}:{},...H.hostname&&Ee?{displayName:H.hostname}:{}},ze=Ll({profiles:q.profiles.map(He=>He.id===de.id?Te:He)});at(ze)},[at]);if(!fe.current){const H=new av(Ha(i));fe.current=H,H.on("stateChange",(q,de,Ee)=>{u(q),p(Ee);const Te=Ee?`serverErrors.${Ee}`:null,ze=Te?lt.current(Te):null,He=ze&&ze!==Te?ze:de;m(He),q==="connected"?Pe("success",lt.current("toasts.connected")):q==="error"&&Pe("error",He||lt.current("toasts.connectionError")),q!=="connected"&&rt(null)}),H.on("ready",q=>{Ge.current&&(St(),se(de=>de+1)),Ge.current=!0,b(q.role),S(q.controllerId),E(q.hostId),A(q.hostname),gi(q),q.clientId&&te(q.clientId),O(q.terminalPalette||null)}),H.on("hostReconnecting",q=>{p(q||"host_reconnecting"),m(lt.current(`serverErrors.${q||"host_reconnecting"}`)),b("viewer"),S(void 0),A(void 0),O(null),W(null),U(1),Ce(null),St()}),H.on("sessionRestarted",(q,de,Ee,Te)=>{St(),A(Te),gi({hostId:H.getHostId(),hostname:Te}),O(Ee||null),se(ze=>ze+1)}),H.on("roleChange",(q,de,Ee,Te)=>{b(q),S(de),Ee&&E(Ee),Te&&te(Te)}),H.on("controlGranted",()=>{b("controller"),Pe("success",lt.current("toasts.controlGranted"))}),H.on("controlDenied",q=>{Pe("warning",q||lt.current("toasts.controlDenied"))}),H.on("controlRevoked",q=>{b("viewer"),Pe("warning",q||lt.current("toasts.controlRevoked"))}),H.on("paired",q=>{const de=rn(q);Pe("success",lt.current("toasts.pairedSuccess")),L(Date.now()),H.reconnectWith(Ha(de))}),H.on("exit",(q,de)=>{Pe("info",`${lt.current("toasts.sessionEnded")}${de?`: ${de}`:""}${q!==void 0?` (${q})`:""}`)}),H.on("status",q=>{Ce(q)}),H.on("error",q=>{Ke.current!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Ke.current=null,we(ui));const Ee=`serverErrors.${String(q.code)}`,Te=lt.current(Ee),ze=Te&&Te!==Ee?Te:q.message||`[${q.code}]`;Pe("error",ze)}),H.on("pasteFileReady",q=>{const de=Ke.current;de!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),we({active:!0,phase:"completed",ratio:1,percent:100,statusText:lt.current("virtualKeyboard.uploadProgressCompleted")}),setTimeout(()=>{Ke.current===de&&(Ke.current=null,we(ui))},1200));for(const Ee of F.current)try{Ee(q)}catch(Te){console.error("Error in pasteFileReady listener:",Te)}}),H.on("rttUpdate",q=>{W(q)}),H.on("peerCount",q=>{U(Math.max(1,q))}),H.on("sessionReady",()=>{u("connected")}),H.on("agentStatus",q=>{rt(q)}),H.on("binaryData",q=>{We.current(q)})}const Sn=fe.current,ki=i.profiles.find(H=>H.id===i.activeProfileId);w.useEffect(()=>{var H;(H=fe.current)==null||H.updateConfig(Ha(i))},[i]);const bi=w.useCallback(H=>{fe.current&&(H&&fe.current.updateConfig(H),fe.current.connect(Re.current))},[]),Dl=w.useCallback(()=>{fe.current&&fe.current.disconnect()},[]),In=w.useCallback((H=!1)=>{fe.current&&fe.current.claimControl(H)},[]),Cn=w.useCallback(()=>{var H;(H=fe.current)==null||H.releaseControl()},[]),Tn=w.useCallback(H=>{if(y!=="controller"){zt();return}const q=fe.current;if(!q)return;const de=gd(H);for(const Ee of Be.current)try{Ee(de)}catch(Te){console.debug("Key input observer threw:",Te)}q.sendInput(de)},[y,zt]),Li=w.useCallback(H=>(Be.current.add(H),()=>{Be.current.delete(H)}),[]),[sa,Ji]=w.useState(uo),li=w.useRef(uo),el=w.useCallback(H=>{const q={...li.current,[H]:!li.current[H]};li.current=q,Ji(q)},[]),tl=w.useCallback(()=>{const H=li.current;return!H.ctrl&&!H.alt&&!H.shift?null:(li.current=uo,Ji(uo),H)},[]);w.useEffect(()=>{const H=fe.current;return H?sv(H):void 0},[]);const Ri=w.useCallback(H=>{y!=="controller"&&!Mo(H)||fe.current&&fe.current.sendInput(H)},[y]),_i=w.useCallback((H,q)=>{Re.current={cols:H,rows:q},le({cols:H,rows:q}),fe.current&&fe.current.sendResize(H,q)},[]),Mn=w.useCallback((H,q)=>y!=="controller"?(zt(),!1):fe.current?(fe.current.sendPasteFile(H,q),!0):!1,[y,zt]),Gt=w.useCallback(H=>(F.current.add(H),()=>{F.current.delete(H)}),[]),en=w.useCallback(()=>{Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Ke.current=null,we(ui)},[]);w.useEffect(()=>{r!=="connected"&&Ke.current!==null&&(Ve.current&&(clearTimeout(Ve.current),Ve.current=null),Ke.current=null,we(ui))},[r]),w.useEffect(()=>()=>{Ve.current&&clearTimeout(Ve.current)},[]);const yi=w.useCallback(async H=>{if(y!=="controller")return zt(),!1;if(!fe.current||r!=="connected")return Pe("error",Qe("serverErrors.host_offline")),!1;if(Ke.current!==null)return!1;const q=++gt.current;Ke.current=q,Ve.current&&(clearTimeout(Ve.current),Ve.current=null);const de="dataBase64"in H&&typeof H.dataBase64=="string";try{let Ee;if(de)Ee=H;else{const ze=H;if(we({active:!0,phase:"reading",ratio:.1,percent:10,statusText:Qe("virtualKeyboard.uploadProgressReading")}),!ze||ze.size===0)return Pe("error",Qe("clipboard.fileEmpty")),Ke.current=null,we(ui),!1;if(ze.type&&!ze.type.startsWith("image/"))return Pe("error",Qe("clipboard.unsupportedType")),Ke.current=null,we(ui),!1;we({active:!0,phase:"processing",ratio:.35,percent:35,statusText:Qe("virtualKeyboard.uploadProgressProcessing")});const He=await Kg(ze);if(Ke.current!==q)return!1;if(!He)return Pe("error",Qe("clipboard.imageTooLarge")),Ke.current=null,we(ui),!1;Ee=He,we({active:!0,phase:"processing",ratio:.6,percent:60,statusText:Qe("virtualKeyboard.uploadProgressProcessing")})}we({active:!0,phase:"sending",ratio:.75,percent:75,statusText:Qe("virtualKeyboard.uploadProgressSending")});const Te=Mn(Ee.mime,Ee.dataBase64);return Ke.current!==q?!1:Te?(we({active:!0,phase:"waitingHost",ratio:.88,percent:88,statusText:Qe("virtualKeyboard.uploadProgressWaitingHost")}),Ve.current=setTimeout(()=>{Ke.current===q&&(Ke.current=null,Pe("error",Qe("serverErrors.paste_file_write_failed")),we(ui))},3e4),!0):(Ke.current=null,we(ui),!1)}catch(Ee){return console.error("Failed to process/upload image:",Ee),Ke.current===q&&(Ke.current=null,Pe("error",Qe("clipboard.imageTooLarge")),we(ui)),!1}},[y,r,zt,Pe,Qe,Mn]);return f.jsx(Yg.Provider,{value:{connectionState:r,stateDetail:d,stateCode:h,role:y,controllerId:v,hostId:T,hostname:Y,assignedClientId:B,profiles:i.profiles,activeProfileId:i.activeProfileId,activeProfile:ki,isController:y==="controller",sharedWindowCount:G,terminalResetVersion:ie,rttMs:ue,statusPayload:pe,agentStatus:Oe,agentProfile:Ze,lastPairedAt:Fe,settings:i,hostPalette:z,terminalDimensions:I,toasts:je,adapter:Sn,language:i.language,t:Qe,setLanguage:qt,connect:bi,disconnect:Dl,switchProfile:Dn,addProfileAndConnect:aa,renameProfile:ii,removeProfile:Ni,claimControl:In,releaseControl:Cn,sendKey:Tn,observeKeyInput:Li,modifierLatch:sa,toggleModifierLatch:el,consumeModifierLatch:tl,sendBinary:Ri,sendResize:_i,updateSettings:Ct,addToast:Pe,removeToast:pi,warnViewerMode:zt,subscribeToOutput:bt,getPendingOutputChunkCount:ft,sendPasteFile:Mn,subscribeToPasteFileReady:Gt,uploadProgress:it,uploadImage:yi,resetUploadProgress:en},children:a})};function jt(){const a=w.useContext(Yg);if(!a)throw new Error("useTerminal must be used within a TerminalProvider");return a}function Ws(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 Pv(a){return a?a.blocked>0?"blocked":a.done>0?"done":null:null}function Zv(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 Qv(a,i){if(!a||!i)return null;const s=new Map(a.agents.map(m=>[m.paneId,m.status]));let r=null;for(const m of i.agents)if(!(m.status!=="blocked"&&m.status!=="done")&&s.get(m.paneId)!==m.status){if(m.status==="blocked")return"blocked";r="done"}const u=Ws(a),d=Ws(i);return d.blocked>u.blocked?"blocked":(!r&&d.done>u.done&&(r="done"),r)}const Wv={blocked:"%23f9e2af",done:"%23a6e3a1"};function Jv(a){return`<circle cx='19' cy='5' r='4.5' fill='${Wv[a]}' stroke='%2311111b' stroke-width='1.5'/>`}function ex(a,i){return!i||!a.includes("</svg>")?a:a.replace("</svg>",`${Jv(i)}</svg>`)}function Ap(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=ex(s.dataset.baseHref,a);s.getAttribute("href")!==r&&s.setAttribute("href",r)}let hi=null;function tx(){if(typeof window>"u")return null;const a=window;return a.AudioContext??a.webkitAudioContext??null}function Gg(){const a=tx();if(a)try{hi=hi??new a,hi.state==="suspended"&&hi.resume()}catch{hi=null}}function nx(a=window){const i=()=>{Gg(),s()},s=()=>{a.removeEventListener("pointerdown",i),a.removeEventListener("keydown",i)};return a.addEventListener("pointerdown",i),a.addEventListener("keydown",i),s}const ix={blocked:[880,660],done:[660,880]};function Ig(a){if(!(!hi||hi.state!=="running"))try{const i=hi.currentTime;ix[a].forEach((s,r)=>{const u=hi.createOscillator(),d=hi.createGain(),m=i+r*.11;u.type="sine",u.frequency.value=s,d.gain.setValueAtTime(1e-4,m),d.gain.exponentialRampToValueAtTime(.06,m+.01),d.gain.exponentialRampToValueAtTime(1e-4,m+.09),u.connect(d),d.connect(hi.destination),u.start(m),u.stop(m+.1)})}catch{}}const lx=15e3,ax={blocked:[70,50,70],done:[40]};function sx(){const{agentStatus:a,settings:i,t:s}=jt(),r=w.useRef(i);r.current=i;const u=w.useRef(s);u.current=s;const d=w.useRef(null),m=w.useRef(Number.NEGATIVE_INFINITY);w.useEffect(()=>{Ap(i.agentAlertBadge?Pv(Ws(a)):null)},[a,i.agentAlertBadge]),w.useEffect(()=>()=>Ap(null),[]),w.useEffect(()=>{if(!(!i.agentAlertSound||typeof window>"u"))return nx(window)},[i.agentAlertSound]),w.useEffect(()=>{const h=d.current;d.current=a;const p=Qv(h,a);if(!p)return;const y=Date.now();if(y-m.current<lx)return;m.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(ax[p])}catch{}if(b.agentAlertSound&&S&&Ig(p),b.agentAlertNotify&&v&&typeof window<"u"&&window.isSecureContext&&"Notification"in window&&Notification.permission==="granted"){const T=Ws(a),E=p==="blocked"?u.current("agents.notifyBlocked",{count:T.blocked}):u.current("agents.notifyDone",{count:T.done});try{new Notification("Herdr Remote",{body:E,tag:"herdr-agents"})}catch{}}},[a])}function $g(a){var i,s,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(i=0;i<u;i++)a[i]&&(s=$g(a[i]))&&(r&&(r+=" "),r+=s)}else for(s in a)a[s]&&(r&&(r+=" "),r+=s);return r}function rx(){for(var a,i,s=0,r="",u=arguments.length;s<u;s++)(a=arguments[s])&&(i=$g(a))&&(r&&(r+=" "),r+=i);return r}const ox=(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},cx=(a,i)=>({classGroupId:a,validator:i}),qg=(a=new Map,i=null,s)=>({nextPart:a,validators:i,classGroupId:s}),ko="-",Ep=[],ux="arbitrary..",dx=a=>{const i=hx(a),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return fx(m);const h=m.split(ko),p=h[0]===""&&h.length>1?1:0;return Fg(h,p,i)},getConflictingClassGroupIds:(m,h)=>{if(h){const p=r[m],y=s[m];return p?y?ox(y,p):p:y||Ep}return s[m]||Ep}}},Fg=(a,i,s)=>{if(a.length-i===0)return s.classGroupId;const u=a[i],d=s.nextPart.get(u);if(d){const y=Fg(a,i+1,d);if(y)return y}const m=s.validators;if(m===null)return;const h=i===0?a.join(ko):a.slice(i).join(ko),p=m.length;for(let y=0;y<p;y++){const b=m[y];if(b.validator(h))return b.classGroupId}},fx=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?ux+r:void 0})(),hx=a=>{const{theme:i,classGroups:s}=a;return mx(s,i)},mx=(a,i)=>{const s=qg();for(const r in a){const u=a[r];Sd(u,s,r,i)}return s},Sd=(a,i,s,r)=>{const u=a.length;for(let d=0;d<u;d++){const m=a[d];px(m,i,s,r)}},px=(a,i,s,r)=>{if(typeof a=="string"){gx(a,i,s);return}if(typeof a=="function"){bx(a,i,s,r);return}yx(a,i,s,r)},gx=(a,i,s)=>{const r=a===""?i:Vg(i,a);r.classGroupId=s},bx=(a,i,s,r)=>{if(vx(a)){Sd(a(r),i,s,r);return}i.validators===null&&(i.validators=[]),i.validators.push(cx(s,a))},yx=(a,i,s,r)=>{const u=Object.entries(a),d=u.length;for(let m=0;m<d;m++){const[h,p]=u[m];Sd(p,Vg(i,h),s,r)}},Vg=(a,i)=>{let s=a;const r=i.split(ko),u=r.length;for(let d=0;d<u;d++){const m=r[d];let h=s.nextPart.get(m);h||(h=qg(),s.nextPart.set(m,h)),s=h}return s},vx=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,xx=a=>{if(a<1)return{get:()=>{},set:()=>{}};let i=0,s=Object.create(null),r=Object.create(null);const u=(d,m)=>{s[d]=m,i++,i>a&&(i=0,r=s,s=Object.create(null))};return{get(d){let m=s[d];if(m!==void 0)return m;if((m=r[d])!==void 0)return u(d,m),m},set(d,m){d in s?s[d]=m:u(d,m)}}},ud="!",Np=":",wx=[],kp=(a,i,s,r,u)=>({modifiers:a,hasImportantModifier:i,baseClassName:s,maybePostfixModifierPosition:r,isExternal:u}),Sx=a=>{const{prefix:i,experimentalParseClassName:s}=a;let r=u=>{const d=[];let m=0,h=0,p=0,y;const b=u.length;for(let Y=0;Y<b;Y++){const A=u[Y];if(m===0&&h===0){if(A===Np){d.push(u.slice(p,Y)),p=Y+1;continue}if(A==="/"){y=Y;continue}}A==="["?m++:A==="]"?m--:A==="("?h++:A===")"&&h--}const v=d.length===0?u:u.slice(p);let S=v,T=!1;v.endsWith(ud)?(S=v.slice(0,-1),T=!0):v.startsWith(ud)&&(S=v.slice(1),T=!0);const E=y&&y>p?y-p:void 0;return kp(d,T,S,E)};if(i){const u=i+Np,d=r;r=m=>m.startsWith(u)?d(m.slice(u.length)):kp(wx,!1,m,void 0,!0)}if(s){const u=r;r=d=>s({className:d,parseClassName:u})}return r},Cx=a=>{const i=new Map;return a.orderSensitiveModifiers.forEach((s,r)=>{i.set(s,1e6+r)}),s=>{const r=[];let u=[];for(let d=0;d<s.length;d++){const m=s[d],h=m[0]==="[",p=i.has(m);h||p?(u.length>0&&(u.sort(),r.push(...u),u=[]),r.push(m)):u.push(m)}return u.length>0&&(u.sort(),r.push(...u)),r}},Tx=a=>({cache:xx(a.cacheSize),parseClassName:Sx(a),sortModifiers:Cx(a),postfixLookupClassGroupIds:Mx(a),...dx(a)}),Mx=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},Ax=/\s+/,Ex=(a,i)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:u,sortModifiers:d,postfixLookupClassGroupIds:m}=i,h=[],p=a.trim().split(Ax);let y="";for(let b=p.length-1;b>=0;b-=1){const v=p[b],{isExternal:S,modifiers:T,hasImportantModifier:E,baseClassName:Y,maybePostfixModifierPosition:A}=s(v);if(S){y=v+(y.length>0?" "+y:y);continue}let z=!!A,O;if(z){const G=Y.substring(0,A);O=r(G);const U=O&&m[O]?r(Y):void 0;U&&U!==O&&(O=U,z=!1)}else O=r(Y);if(!O){if(!z){y=v+(y.length>0?" "+y:y);continue}if(O=r(Y),!O){y=v+(y.length>0?" "+y:y);continue}z=!1}const B=T.length===0?"":T.length===1?T[0]:d(T).join(":"),te=E?B+ud:B,ue=te+O;if(h.indexOf(ue)>-1)continue;h.push(ue);const W=u(O,z);for(let G=0;G<W.length;++G){const U=W[G];h.push(te+U)}y=v+(y.length>0?" "+y:y)}return y},Nx=(...a)=>{let i=0,s,r,u="";for(;i<a.length;)(s=a[i++])&&(r=Xg(s))&&(u&&(u+=" "),u+=r);return u},Xg=a=>{if(typeof a=="string")return a;let i,s="";for(let r=0;r<a.length;r++)a[r]&&(i=Xg(a[r]))&&(s&&(s+=" "),s+=i);return s},kx=(a,...i)=>{let s,r,u,d;const m=p=>{const y=i.reduce((b,v)=>v(b),a());return s=Tx(y),r=s.cache.get,u=s.cache.set,d=h,h(p)},h=p=>{const y=r(p);if(y)return y;const b=Ex(p,s);return u(p,b),b};return d=m,(...p)=>d(Nx(...p))},Lx=[],Jt=a=>{const i=s=>s[a]||Lx;return i.isThemeGetter=!0,i},Pg=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rx=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_x=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jx=/\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$/,Dx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ox=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rl=a=>Rx.test(a),Xe=a=>!!a&&!Number.isNaN(Number(a)),Mi=a=>!!a&&Number.isInteger(Number(a)),$u=a=>a.endsWith("%")&&Xe(a.slice(0,-1)),Zi=a=>_x.test(a),Qg=()=>!0,Bx=a=>jx.test(a)&&!Dx.test(a),Cd=()=>!1,Ux=a=>zx.test(a),Hx=a=>Ox.test(a),Kx=a=>!me(a)&&!ge(a),Yx=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)),Gx=a=>jl(a,eb,Cd),me=a=>Pg.test(a),Wl=a=>jl(a,tb,Bx),Lp=a=>jl(a,Zx,Xe),Ix=a=>jl(a,ib,Qg),$x=a=>jl(a,nb,Cd),Rp=a=>jl(a,Wg,Cd),qx=a=>jl(a,Jg,Hx),fo=a=>jl(a,lb,Ux),ge=a=>Zg.test(a),Us=a=>la(a,tb),Fx=a=>la(a,nb),_p=a=>la(a,Wg),Vx=a=>la(a,eb),Xx=a=>la(a,Jg),ho=a=>la(a,lb,!0),Px=a=>la(a,ib,!0),jl=(a,i,s)=>{const r=Pg.exec(a);return r?r[1]?i(r[1]):s(r[2]):!1},la=(a,i,s=!1)=>{const r=Zg.exec(a);return r?r[1]?i(r[1]):s:!1},Wg=a=>a==="position"||a==="percentage",Jg=a=>a==="image"||a==="url",eb=a=>a==="length"||a==="size"||a==="bg-size",tb=a=>a==="length",Zx=a=>a==="number",nb=a=>a==="family-name",ib=a=>a==="number"||a==="weight",lb=a=>a==="shadow",Qx=()=>{const a=Jt("color"),i=Jt("font"),s=Jt("text"),r=Jt("font-weight"),u=Jt("tracking"),d=Jt("leading"),m=Jt("breakpoint"),h=Jt("container"),p=Jt("spacing"),y=Jt("radius"),b=Jt("shadow"),v=Jt("inset-shadow"),S=Jt("text-shadow"),T=Jt("drop-shadow"),E=Jt("blur"),Y=Jt("perspective"),A=Jt("aspect"),z=Jt("ease"),O=Jt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ue=()=>[...te(),ge,me],W=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto","contain","none"],U=()=>[ge,me,p],ie=()=>[Rl,"full","auto",...U()],se=()=>[Mi,"none","subgrid",ge,me],pe=()=>["auto",{span:["full",Mi,ge,me]},Mi,ge,me],Ce=()=>[Mi,"auto",ge,me],Oe=()=>["auto","min","max","fr",ge,me],rt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Fe=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...U()],I=()=>[Rl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...U()],le=()=>[Rl,"screen","full","dvw","lvw","svw","min","max","fit",...U()],je=()=>[Rl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...U()],Q=()=>[a,ge,me],Ze=()=>[...te(),_p,Rp,{position:[ge,me]}],Le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",Vx,Gx,{size:[ge,me]}],Ge=()=>[$u,Us,Wl],Re=()=>["","none","full",y,ge,me],F=()=>["",Xe,Us,Wl],Be=()=>["solid","dashed","dotted","double"],it=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Xe,$u,_p,Rp],Ke=()=>["","none",E,ge,me],gt=()=>["none",Xe,ge,me],Ve=()=>["none",Xe,ge,me],Qe=()=>[Xe,ge,me],lt=()=>[Rl,"full",...U()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zi],breakpoint:[Zi],color:[Qg],container:[Zi],"drop-shadow":[Zi],ease:["in","out","in-out"],font:[Kx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zi],shadow:[Zi],spacing:["px",Xe],text:[Zi],"text-shadow":[Zi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rl,me,ge,A]}],container:["container"],"container-type":[{"@container":["","normal","size",ge,me]}],"container-named":[Yx],columns:[{columns:[Xe,me,ge,h]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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:ue()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ie()}],"inset-x":[{"inset-x":ie()}],"inset-y":[{"inset-y":ie()}],start:[{"inset-s":ie(),start:ie()}],end:[{"inset-e":ie(),end:ie()}],"inset-bs":[{"inset-bs":ie()}],"inset-be":[{"inset-be":ie()}],top:[{top:ie()}],right:[{right:ie()}],bottom:[{bottom:ie()}],left:[{left:ie()}],visibility:["visible","invisible","collapse"],z:[{z:[Mi,"auto",ge,me]}],basis:[{basis:[Rl,"full","auto",h,...U()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Xe,Rl,"auto","initial","none",me]}],grow:[{grow:["",Xe,ge,me]}],shrink:[{shrink:["",Xe,ge,me]}],order:[{order:[Mi,"first","last","none",ge,me]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":Ce()}],"col-end":[{"col-end":Ce()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":Ce()}],"row-end":[{"row-end":Ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Oe()}],"auto-rows":[{"auto-rows":Oe()}],gap:[{gap:U()}],"gap-x":[{"gap-x":U()}],"gap-y":[{"gap-y":U()}],"justify-content":[{justify:[...rt(),"normal"]}],"justify-items":[{"justify-items":[...Fe(),"normal"]}],"justify-self":[{"justify-self":["auto",...Fe()]}],"align-content":[{content:["normal",...rt()]}],"align-items":[{items:[...Fe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Fe(),{baseline:["","last"]}]}],"place-content":[{"place-content":rt()}],"place-items":[{"place-items":[...Fe(),"baseline"]}],"place-self":[{"place-self":["auto",...Fe()]}],p:[{p:U()}],px:[{px:U()}],py:[{py:U()}],ps:[{ps:U()}],pe:[{pe:U()}],pbs:[{pbs:U()}],pbe:[{pbe:U()}],pt:[{pt:U()}],pr:[{pr:U()}],pb:[{pb:U()}],pl:[{pl:U()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":U()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":U()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...le()]}],"min-inline-size":[{"min-inline":["auto",...le()]}],"max-inline-size":[{"max-inline":["none",...le()]}],"block-size":[{block:["auto",...je()]}],"min-block-size":[{"min-block":["auto",...je()]}],"max-block-size":[{"max-block":["none",...je()]}],w:[{w:[h,"screen",...I()]}],"min-w":[{"min-w":[h,"screen","none",...I()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[m]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",s,Us,Wl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Px,Ix]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$u,me]}],"font-family":[{font:[Fx,$x,i]}],"font-features":[{"font-features":[me]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[u,ge,me]}],"line-clamp":[{"line-clamp":[Xe,"none",ge,Lp]}],leading:[{leading:[d,...U()]}],"list-image":[{"list-image":["none",ge,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Q()}],"text-color":[{text:Q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Xe,"from-font","auto",ge,Wl]}],"text-decoration-color":[{decoration:Q()}],"underline-offset":[{"underline-offset":[Xe,"auto",ge,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:U()}],"tab-size":[{tab:[Mi,ge,me]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ze()}],"bg-repeat":[{bg:Le()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mi,ge,me],radial:["",ge,me],conic:[Mi,ge,me]},Xx,qx]}],"bg-color":[{bg:Q()}],"gradient-from-pos":[{from:Ge()}],"gradient-via-pos":[{via:Ge()}],"gradient-to-pos":[{to:Ge()}],"gradient-from":[{from:Q()}],"gradient-via":[{via:Q()}],"gradient-to":[{to:Q()}],rounded:[{rounded:Re()}],"rounded-s":[{"rounded-s":Re()}],"rounded-e":[{"rounded-e":Re()}],"rounded-t":[{"rounded-t":Re()}],"rounded-r":[{"rounded-r":Re()}],"rounded-b":[{"rounded-b":Re()}],"rounded-l":[{"rounded-l":Re()}],"rounded-ss":[{"rounded-ss":Re()}],"rounded-se":[{"rounded-se":Re()}],"rounded-ee":[{"rounded-ee":Re()}],"rounded-es":[{"rounded-es":Re()}],"rounded-tl":[{"rounded-tl":Re()}],"rounded-tr":[{"rounded-tr":Re()}],"rounded-br":[{"rounded-br":Re()}],"rounded-bl":[{"rounded-bl":Re()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Be(),"hidden","none"]}],"divide-style":[{divide:[...Be(),"hidden","none"]}],"border-color":[{border:Q()}],"border-color-x":[{"border-x":Q()}],"border-color-y":[{"border-y":Q()}],"border-color-s":[{"border-s":Q()}],"border-color-e":[{"border-e":Q()}],"border-color-bs":[{"border-bs":Q()}],"border-color-be":[{"border-be":Q()}],"border-color-t":[{"border-t":Q()}],"border-color-r":[{"border-r":Q()}],"border-color-b":[{"border-b":Q()}],"border-color-l":[{"border-l":Q()}],"divide-color":[{divide:Q()}],"outline-style":[{outline:[...Be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Xe,ge,me]}],"outline-w":[{outline:["",Xe,Us,Wl]}],"outline-color":[{outline:Q()}],shadow:[{shadow:["","none",b,ho,fo]}],"shadow-color":[{shadow:Q()}],"inset-shadow":[{"inset-shadow":["none",v,ho,fo]}],"inset-shadow-color":[{"inset-shadow":Q()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Q()}],"ring-offset-w":[{"ring-offset":[Xe,Wl]}],"ring-offset-color":[{"ring-offset":Q()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":Q()}],"text-shadow":[{"text-shadow":["none",S,ho,fo]}],"text-shadow-color":[{"text-shadow":Q()}],opacity:[{opacity:[Xe,ge,me]}],"mix-blend":[{"mix-blend":[...it(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":it()}],"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":[Xe]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":Q()}],"mask-image-linear-to-color":[{"mask-linear-to":Q()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":Q()}],"mask-image-t-to-color":[{"mask-t-to":Q()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":Q()}],"mask-image-r-to-color":[{"mask-r-to":Q()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":Q()}],"mask-image-b-to-color":[{"mask-b-to":Q()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":Q()}],"mask-image-l-to-color":[{"mask-l-to":Q()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":Q()}],"mask-image-x-to-color":[{"mask-x-to":Q()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":Q()}],"mask-image-y-to-color":[{"mask-y-to":Q()}],"mask-image-radial":[{"mask-radial":[ge,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":Q()}],"mask-image-radial-to-color":[{"mask-radial-to":Q()}],"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":te()}],"mask-image-conic-pos":[{"mask-conic":[Xe]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":Q()}],"mask-image-conic-to-color":[{"mask-conic-to":Q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ze()}],"mask-repeat":[{mask:Le()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,me]}],filter:[{filter:["","none",ge,me]}],blur:[{blur:Ke()}],brightness:[{brightness:[Xe,ge,me]}],contrast:[{contrast:[Xe,ge,me]}],"drop-shadow":[{"drop-shadow":["","none",T,ho,fo]}],"drop-shadow-color":[{"drop-shadow":Q()}],grayscale:[{grayscale:["",Xe,ge,me]}],"hue-rotate":[{"hue-rotate":[Xe,ge,me]}],invert:[{invert:["",Xe,ge,me]}],saturate:[{saturate:[Xe,ge,me]}],sepia:[{sepia:["",Xe,ge,me]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,me]}],"backdrop-blur":[{"backdrop-blur":Ke()}],"backdrop-brightness":[{"backdrop-brightness":[Xe,ge,me]}],"backdrop-contrast":[{"backdrop-contrast":[Xe,ge,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Xe,ge,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xe,ge,me]}],"backdrop-invert":[{"backdrop-invert":["",Xe,ge,me]}],"backdrop-opacity":[{"backdrop-opacity":[Xe,ge,me]}],"backdrop-saturate":[{"backdrop-saturate":[Xe,ge,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Xe,ge,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":U()}],"border-spacing-x":[{"border-spacing-x":U()}],"border-spacing-y":[{"border-spacing-y":U()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Xe,"initial",ge,me]}],ease:[{ease:["linear","initial",z,ge,me]}],delay:[{delay:[Xe,ge,me]}],animate:[{animate:["none",O,ge,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[Y,ge,me]}],"perspective-origin":[{"perspective-origin":ue()}],rotate:[{rotate:gt()}],"rotate-x":[{"rotate-x":gt()}],"rotate-y":[{"rotate-y":gt()}],"rotate-z":[{"rotate-z":gt()}],scale:[{scale:Ve()}],"scale-x":[{"scale-x":Ve()}],"scale-y":[{"scale-y":Ve()}],"scale-z":[{"scale-z":Ve()}],"scale-3d":["scale-3d"],skew:[{skew:Qe()}],"skew-x":[{"skew-x":Qe()}],"skew-y":[{"skew-y":Qe()}],transform:[{transform:[ge,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:ue()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:lt()}],"translate-x":[{"translate-x":lt()}],"translate-y":[{"translate-y":lt()}],"translate-z":[{"translate-z":lt()}],"translate-none":["translate-none"],zoom:[{zoom:[Mi,ge,me]}],accent:[{accent:Q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Q()}],"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",ge,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":Q()}],"scrollbar-track-color":[{"scrollbar-track":Q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mbs":[{"scroll-mbs":U()}],"scroll-mbe":[{"scroll-mbe":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pbs":[{"scroll-pbs":U()}],"scroll-pbe":[{"scroll-pbe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",ge,me]}],fill:[{fill:["none",...Q()]}],"stroke-w":[{stroke:[Xe,Us,Wl,Lp]}],stroke:[{stroke:["none",...Q()]}],"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"]}},Wx=kx(Qx);function ne(...a){return Wx(rx(a))}var Jx=gg();const qe={cursor:"▸",on:"●",off:"○",dot:"·",check:"✓",cross:"✗",warn:"!",arrowRight:"→",arrowLeft:"←",chevronDown:"▾",chevronRight:"▸",ellipsis:"…",meterFull:"█",meterEmpty:"░",tabDivider:"│"},ti={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"}},er={ok:ti.ok.text,warn:ti.warn.text,bad:ti.bad.text,idle:ti.idle.text,accent:ti.accent.text,alt:ti.alt.text,info:ti.info.text},jn=({level:a,className:i})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none leading-none",er[a],i),children:a==="idle"?qe.off:qe.on}),ab=({className:a})=>f.jsx("span",{"aria-hidden":"true",className:ne("select-none text-tui-faint",a),children:qe.dot}),pn=({title:a,aside:i,tone:s="accent",className:r,bodyClassName:u,children:d,...m})=>f.jsxs("fieldset",{className:ne("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),...m,children:[a?f.jsx("legend",{className:ne("flex items-center gap-2 text-tui font-bold",er[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:ne("min-w-0",u),children:d})]}),di=({label:a,labelWidth:i=16,className:s,children:r})=>f.jsxs("div",{className:ne("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})]}),fi=({className:a,label:i})=>i?f.jsxs("div",{className:ne("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:ne("h-px w-full bg-tui-border-dim",a),"aria-hidden":"true"}),e1={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"},_e=({variant:a="default",brackets:i=!0,glyph:s,block:r=!1,className:u,children:d,type:m="button",...h})=>f.jsxs("button",{type:m,className:ne("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",e1[a],r&&"w-full",u),...h,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]}),jo=({tone:a="accent",dot:i=!1,className:s,children:r})=>f.jsxs("span",{className:ne("inline-flex select-none items-center gap-1 whitespace-nowrap text-tui font-bold uppercase",er[a],s),children:[i?f.jsx(jn,{level:a}):null,r]}),Td=({tabs:a,activeId:i,onSelect:s,ariaLabel:r,className:u,labelClassName:d})=>f.jsx("nav",{className:ne("flex items-center gap-2",u),"aria-label":r,children:a.map((m,h)=>{const p=m.id===i;return f.jsxs(mi.Fragment,{children:[h>0?f.jsx("span",{"aria-hidden":"true",className:"select-none text-tui-border",children:qe.tabDivider}):null,f.jsxs("button",{type:"button",onClick:()=>s(m.id),"aria-current":p?"page":void 0,"aria-label":m.ariaLabel??m.label,title:m.title,className:ne("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:[m.index!==void 0?f.jsx("span",{"aria-hidden":"true",className:ne("text-tui-faint",p&&"text-tui-accent"),children:m.index}):null,f.jsx("span",{"aria-hidden":"true",className:ne("ml-1",d),children:m.label})]})]},m.id)})}),sb=({hints:a,className:i})=>f.jsx("div",{className:ne("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}`))}),xn=({htmlFor:a,hint:i,className:s,children:r})=>f.jsxs("label",{htmlFor:a,className:ne("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]}),wn=mi.forwardRef(({className:a,...i},s)=>f.jsx("input",{ref:s,className:ne("tui-input w-full px-2 py-1 text-tui",a),...i}));wn.displayName="Input";const Lo=mi.forwardRef(({className:a,children:i,...s},r)=>f.jsx("select",{ref:r,className:ne("tui-input w-full px-2 py-1 text-tui",a),...s,children:i}));Lo.displayName="Select";const Jl=({checked:a,onChange:i,disabled:s=!1,label:r,description:u,className:d,id:m})=>f.jsxs("label",{className:ne("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:m,type:"checkbox",className:"sr-only",checked:a,disabled:s,onChange:h=>i(h.target.checked)}),f.jsx("span",{"aria-hidden":"true",className:ne("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:ne("block",a?"text-tui-text":"text-tui-muted"),children:r}),u?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:u}):null]})]}),Hs=({checked:a,onChange:i,name:s,disabled:r=!1,label:u,description:d,className:m})=>f.jsxs("label",{className:ne("group flex cursor-pointer select-none items-start gap-2 py-0.5 text-tui",r&&"cursor-not-allowed opacity-60",m),children:[f.jsx("input",{type:"radio",name:s,className:"sr-only",checked:a,disabled:r,onChange:i}),f.jsx("span",{"aria-hidden":"true",className:ne("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:ne("block",a?"text-tui-text":"text-tui-muted"),children:u}),d?f.jsx("span",{className:"mt-0.5 block text-tui-sm leading-snug text-tui-faint",children:d}):null]})]}),t1=({value:a,width:i=20,tone:s="accent",className:r})=>{const u=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,d=Math.round(u*i);return f.jsxs("span",{className:ne("inline-flex select-none whitespace-pre font-mono leading-none",r),role:"presentation",children:[f.jsx("span",{className:er[s],children:qe.meterFull.repeat(d)}),f.jsx("span",{className:"text-tui-border",children:qe.meterEmpty.repeat(Math.max(0,i-d))})]})},n1={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"},i1=({ratio:a,label:i,tone:s="accent",className:r,...u})=>{const d=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0;return f.jsxs("div",{className:ne("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,...u,children:[f.jsx("div",{className:ne("absolute inset-y-0 left-0",n1[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 Md({columns:a,items:i,rowKey:s,empty:r,className:u}){return i.length===0?f.jsx("div",{className:ne("px-1 py-4 text-center text-tui text-tui-faint",u),children:r}):f.jsx("div",{className:ne("w-full overflow-x-auto",u),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:ne("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,m)=>f.jsx("tr",{className:"border-b border-tui-border-dim last:border-b-0 hover:bg-tui-selection",children:a.map(h=>f.jsx("td",{className:ne("px-2 py-1 align-top text-tui-text",h.align==="right"?"text-right":"text-left",h.className),children:h.render(d,m)},h.key))},s(d,m)))})]})})}const Ad=({isOpen:a,onClose:i,title:s,subtitle:r,closeLabel:u,footer:d,hints:m,size:h="md",className:p,children:y})=>{if(!a)return null;const b=h==="sm"?"max-w-md":h==="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 grid place-items-center overflow-y-auto 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:T=>{T.target===T.currentTarget&&i()},children:f.jsxs("div",{className:ne("flex w-full flex-col border border-tui-border bg-tui-base",b,p),style:{maxHeight:"calc(var(--app-height, 100dvh) - 1.5rem)"},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(_e,{variant:"ghost",onClick:i,"aria-label":u,title:u,children:"esc"})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:y}),d||m?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:[m?f.jsx(sb,{hints:m}):f.jsx("span",{}),d?f.jsx("div",{className:"flex items-center gap-2",children:d}):null]}):null]})});return typeof document>"u"?S:Jx.createPortal(S,document.body)},So=({tone:a="accent",className:i,children:s,action:r})=>{const u=a==="ok"?qe.check:a==="bad"?qe.cross:a==="warn"?qe.warn:"›",d=ti[a].edgeL;return f.jsxs("div",{className:ne("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:ne("shrink-0 font-bold",er[a]),children:u}),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]})},jp=({active:a=!1,className:i,children:s})=>f.jsx("span",{className:ne("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}),Dp=({items:a,className:i})=>{const s=a.filter(Boolean);return f.jsx("span",{className:ne("flex min-w-0 items-center gap-1.5",i),children:s.map((r,u)=>f.jsxs(mi.Fragment,{children:[u>0?f.jsx(ab,{className:"shrink-0"}):null,r]},u))})},rb=({left:a,right:i,className:s})=>f.jsxs("footer",{className:ne("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})]}),l1=({name:a,tagline:i,aside:s,tabs:r,activeTabId:u,onSelectTab:d,tabsAriaLabel:m,hints:h,footerAside:p,bodyClassName:y,className:b,children:v})=>f.jsxs("div",{className:ne("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&&u!==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(Td,{tabs:r,activeId:u,onSelect:d,ariaLabel:m,className:"gap-3"})}):null,f.jsx("div",{className:ne("min-h-0 flex-1 overflow-y-auto p-2",y),children:v}),h||p?f.jsx(rb,{left:h?f.jsx(sb,{hints:h}):null,right:p}):null]}),zp=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],Va=({className:a,label:i})=>{const[s,r]=mi.useState(0);return mi.useEffect(()=>{const u=setInterval(()=>r(d=>(d+1)%zp.length),90);return()=>clearInterval(u)},[]),f.jsxs("span",{className:ne("inline-flex items-center gap-1.5",a),role:"status",children:[f.jsx("span",{"aria-hidden":"true",className:"text-tui-accent",children:zp[s]}),i?f.jsx("span",{children:i}):null]})},mo="tui-focusable select-none border border-transparent px-1.5 text-tui uppercase transition-colors",po="text-tui-muted hover:border-tui-border hover:text-tui-accent",a1="border-tui-accent bg-tui-accent text-tui-crust",s1=({currentView:a,onNavigate:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onToggleVirtualKeyboard:d,isVirtualKeyboardOpen:m})=>{const{addToast:h,language:p,setLanguage:y,t:b}=jt(),v=()=>{const T=p==="zh"?"en":"zh";y(T),h("info",wd(T,"toasts.switchedLanguage",{lang:T==="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(Td,{tabs:S,activeId:a,onSelect:T=>i(T),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:ne(mo,po),title:b("header.languageToggleTitle"),"aria-label":b("header.languageToggleTitle"),children:b("header.languageShort")}),a==="terminal"&&f.jsx("button",{type:"button",onClick:d,className:ne(mo,m?a1:po),title:b("header.virtualKeyboardTitle"),"aria-label":b("header.virtualKeyboardTitle"),children:b("header.actionKeyboard")}),f.jsx("button",{type:"button",onClick:r,className:ne(mo,po),title:b("header.pairingTitle"),"aria-label":b("header.pairingTitle"),children:b("header.actionPairing")}),f.jsx("button",{type:"button",onClick:u,className:ne(mo,po),title:b("header.settingsTitle"),"aria-label":b("header.settingsTitle"),children:b("header.actionSettings")})]})]})})},go=({tone:a,glyph:i,message:s,assertive:r=!1,action:u})=>f.jsxs("aside",{className:ne("flex w-full items-center justify-between gap-3 border-b bg-tui-mantle px-2 py-0.5 text-tui sm:px-3",ti[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:ne("shrink-0",ti[a].text),children:i}),f.jsx("span",{className:"truncate text-tui-text",children:s})]}),u]}),r1=()=>{const{connectionState:a,stateDetail:i,connect:s,settings:r,t:u}=jt();return a==="connected"||!r.token&&!r.pairCode&&a==="disconnected"?null:a==="connecting"?f.jsx(go,{tone:"accent",glyph:f.jsx(Va,{}),message:u("statusBanner.connecting")}):a==="reconnecting"?f.jsx(go,{tone:"warn",glyph:f.jsx(Va,{}),assertive:!0,message:i||u("statusBanner.reconnectingDefault"),action:f.jsx(_e,{variant:"warn",onClick:()=>s(),className:"shrink-0",children:u("statusBanner.reconnectNow")})}):a==="error"?f.jsx(go,{tone:"bad",glyph:qe.cross,assertive:!0,message:i||u("statusBanner.errorDefault"),action:f.jsx(_e,{variant:"danger",onClick:()=>s(),className:"shrink-0",children:u("common.retry")})}):a==="disconnected"?f.jsx(go,{tone:"idle",glyph:qe.off,message:u("statusBanner.disconnected"),action:f.jsx(_e,{variant:"primary",onClick:()=>s(),className:"shrink-0",children:u("common.connect")})}):null};var o1=O0(),c1=B0(),qu={exports:{}},Op;function u1(){return Op||(Op=1,(function(a,i){(function(s,r){a.exports=r()})(self,(()=>(()=>{var s={6:(m,h)=>{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(h,"__esModule",{value:!0}),h.LinkComputer=h.WebLinkProvider=void 0,h.WebLinkProvider=class{constructor(b,v,S,T={}){this._terminal=b,this._regex=v,this._handler=S,this._options=T}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,T)=>{if(this._options.hover){const{range:E}=v;this._options.hover(S,T,E)}},v)))}};class y{static computeLink(v,S,T,E){const Y=new RegExp(S.source,(S.flags||"")+"g"),[A,z]=y._getWindowedLineStrings(v-1,T),O=A.join("");let B;const te=[];for(;B=Y.exec(O);){const ue=B[0];if(!p(ue))continue;const[W,G]=y._mapStrIdx(T,z,0,B.index),[U,ie]=y._mapStrIdx(T,W,G,ue.length);if(W===-1||G===-1||U===-1||ie===-1)continue;const se={start:{x:G+1,y:W+1},end:{x:ie,y:U+1}};te.push({range:se,text:ue,activate:E})}return te}static _getWindowedLineStrings(v,S){let T,E=v,Y=v,A=0,z="";const O=[];if(T=S.buffer.active.getLine(v)){const B=T.translateToString(!0);if(T.isWrapped&&B[0]!==" "){for(A=0;(T=S.buffer.active.getLine(--E))&&A<2048&&(z=T.translateToString(!0),A+=z.length,O.push(z),T.isWrapped&&z.indexOf(" ")===-1););O.reverse()}for(O.push(B),A=0;(T=S.buffer.active.getLine(++Y))&&T.isWrapped&&A<2048&&(z=T.translateToString(!0),A+=z.length,O.push(z),z.indexOf(" ")===-1););}return[O,E]}static _mapStrIdx(v,S,T,E){const Y=v.buffer.active,A=Y.getNullCell();let z=T;for(;E;){const O=Y.getLine(S);if(!O)return[-1,-1];for(let B=z;B<O.length;++B){O.getCell(B,A);const te=A.getChars();if(A.getWidth()&&(E-=te.length||1,B===O.length-1&&te==="")){const ue=Y.getLine(S+1);ue&&ue.isWrapped&&(ue.getCell(0,A),A.getWidth()===2&&(E+=1))}if(E<0)return[S,B]}S++,z=0}return[S,z]}}h.LinkComputer=y}},r={};function u(m){var h=r[m];if(h!==void 0)return h.exports;var p=r[m]={exports:{}};return s[m](p,p.exports,u),p.exports}var d={};return(()=>{var m=d;Object.defineProperty(m,"__esModule",{value:!0}),m.WebLinksAddon=void 0;const h=u(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")}m.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 h.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var b;(b=this._linkProvider)==null||b.dispose()}}})(),d})()))})(qu)),qu.exports}var d1=u1();const ob="\x1B",f1=/^\x1b\[[IO]/,cb=/^\x1b\[<(\d+);\d+;\d+[Mm]/,h1=/^\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\\/],p1=/^\x1b\[1;[2-8]R/;function Bp(a){if(p1.test(a))return 0;const i=f1.exec(a);if(i)return i[0].length;const s=cb.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 u=r.exec(a);if(u)return u[0].length}return 0}function ub(a){if(!a.startsWith(ob))return"keys";if(cb.test(a)||h1.test(a)){let s=a;for(;s.length>0;){const r=Bp(s);if(r===0)return"pointer";s=s.slice(r)}return"passive"}let i=a;for(;i.length>0;){const s=Bp(i);if(s===0)return"keys";i=i.slice(s)}return"passive"}function g1(a){return a===ob}const b1=20,y1=6,v1=500,x1=300,Xa=13,db=.602,fb=1.3;function Wi(a,i){return Number.isFinite(a)&&a>0?a:i}function Up(a,i,s){return Math.min(s,Math.max(i,a))}function Hp(a){const{width:i,height:s,cellWidth:r,cellHeight:u,minCols:d=b1,minRows:m=y1,maxCols:h=v1,maxRows:p=x1}=a,y=Wi(r,Xa*db),b=Wi(u,Xa*fb);return{cols:Up(Math.floor(Wi(i,0)/y),d,h),rows:Up(Math.floor(Wi(s,0)/b),m,p)}}function ta(a,i=Xa){var r,u,d;if(a)try{const m=a._core,h=(d=(u=(r=m==null?void 0:m._renderService)==null?void 0:r.dimensions)==null?void 0:u.css)==null?void 0:d.cell;if(h&&h.width&&h.width>0&&h.height&&h.height>0)return{cellWidth:h.width,cellHeight:h.height,measured:!0}}catch{}const s=Wi(i,Xa);return{cellWidth:Math.round(s*db*100)/100,cellHeight:Math.round(s*fb*100)/100,measured:!1}}function w1(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 Fu(a,i,s){if(!a)return{width:i,height:s};let r=0,u=0;if(typeof a.getBoundingClientRect=="function"){const d=a.getBoundingClientRect();r=(d==null?void 0:d.width)||0,u=(d==null?void 0:d.height)||0}return{width:Wi(r,Wi(a.clientWidth,i)),height:Wi(u,Wi(a.clientHeight,s))}}function hb(a,i,s,r){const u=Number.isFinite(r)&&r>.01?r:1;return{clientX:s.left+(a-s.left)/u,clientY:s.top+(i-s.top)/u}}function Ks(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 u=a._core;if((i=u==null?void 0:u._coreMouseService)!=null&&i.areMouseEventsActive||(s=u==null?void 0:u.coreMouseService)!=null&&s.areMouseEventsActive||u!=null&&u.mouseMode&&u.mouseMode!=="none")return!0}catch{}return!1}function S1(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 Kp(a,i,s){const r=S1(i,s);return a.dispatchEvent(r)}class C1{constructor(i){X(this,"options");X(this,"state","idle");X(this,"startX",0);X(this,"startY",0);X(this,"lastX",0);X(this,"lastY",0);X(this,"activeTarget",null);X(this,"longPressTimer",null);X(this,"capturedPointerId",null);X(this,"captureElement",null);X(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,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null;if(r!==1&&u&&typeof u.getBoundingClientRect=="function"){const d=u.getBoundingClientRect();return hb(i,s,d,r)}return{clientX:i,clientY:s}}getViewportElement(i){var u;const s=this.options.getSurfaceElement?this.options.getSurfaceElement():null;return(s==null?void 0:s.querySelector(".xterm-viewport"))||((u=i.element)==null?void 0:u.querySelector(".xterm-viewport"))||null}isInputLineHit(i,s){var O;const r=(O=s.buffer)==null?void 0:O.active,u=this.options.getSurfaceElement?this.options.getSurfaceElement():null,d=(u==null?void 0:u.querySelector(".xterm-screen"))||s.element||u,m=ta(s);if(!d||typeof d.getBoundingClientRect!="function"||m.cellHeight<=0)return!1;const h=d.getBoundingClientRect(),p=this.getLogicalCoordinates(i.clientX,i.clientY),y=h.width>0&&h.height>0;if(![r==null?void 0:r.cursorY,r==null?void 0:r.viewportY,r==null?void 0:r.baseY].every(B=>typeof B=="number"&&Number.isFinite(B)))return!1;const v=r==null?void 0:r.cursorY,S=r==null?void 0:r.viewportY,E=(r==null?void 0:r.baseY)+v-S,Y=h.top+E*m.cellHeight,A=Y+m.cellHeight,z=Number(s.rows);return E>=0&&(!Number.isFinite(z)||E<z)&&p.clientY>=Y-2&&p.clientY<=A+2&&(!y||p.clientX>=h.left&&p.clientX<=h.right)}resolveDispatchTarget(i,s){var h;const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.querySelector(".xterm-screen")||null,d=((h=u==null?void 0:u.closest)==null?void 0:h.call(u,".xterm"))||null;let m=null;return typeof document<"u"&&typeof document.elementFromPoint=="function"&&(m=document.elementFromPoint(i.clientX,i.clientY)),m&&d&&(m===d||d.contains(m))?m:u||r||s}getMouseReport(i,s){const r=this.options.getSurfaceElement?this.options.getSurfaceElement():null,u=(r==null?void 0:r.querySelector(".xterm-screen"))||s.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const d=u.getBoundingClientRect(),m=this.getLogicalCoordinates(i.clientX,i.clientY),h=ta(s);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,d.width||s.cols*h.cellWidth),y=Math.max(1,d.height||s.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-d.left)),v=Math.max(0,Math.min(y-1,m.clientY-d.top)),S=Math.max(0,Math.min(s.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(s.rows-1,Math.floor(v/h.cellHeight)));return{col:S,row:T,x:Math.floor(b),y:Math.floor(v),button:0,action:0}}getCoreMouseService(i){var r,u;const s=i;return s.coreMouseService||((r=s._core)==null?void 0:r.coreMouseService)||((u=s._core)==null?void 0:u._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,u){const d=this.getWheelDispatchTarget(r);if(!d||typeof WheelEvent>"u"||s===0)return!1;const m=this.getLogicalCoordinates(i.clientX,i.clientY),h=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:m.clientX,clientY:m.clientY,deltaX:0,deltaY:h,deltaMode:1,ctrlKey:!!(u!=null&&u.ctrlKey),altKey:!!(u!=null&&u.altKey),shiftKey:!!(u!=null&&u.shiftKey)});d.dispatchEvent(b),p+=1}catch{return p>0}return p>0}emitWheel(i,s,r,u){if(s===0)return!1;if(this.dispatchWheel(i,s,r,u))return!0;const d=this.getCoreMouseService(r);if(!(d!=null&&d.triggerMouseEvent))return!1;let m=0;for(let h=0;h<Math.abs(s);h+=1){const p=this.getMouseReport(i,r);p&&(p.button=4,p.action=s<0?0:1,p.ctrl=!!(u!=null&&u.ctrlKey),p.alt=!!(u!=null&&u.altKey),p.shift=!!(u!=null&&u.shiftKey),d.triggerMouseEvent(p)&&(m+=1))}return m>0}scrollAlternateBuffer(i,s,r,u){var m;if(s===0)return"none";const d=Ks(r);if(!d&&!this.options.getIsController())return"none";if(this.emitWheel(i,s,r,u))return d?"application-mouse":"application-keys";if(!d){const h=this.getCoreService(r);if(!(h!=null&&h.triggerDataEvent))return"none";const y=`\x1B${!!((m=h.decPrivateModes)!=null&&m.applicationCursorKeys)?"O":"["}${s<0?"A":"B"}`;return h.triggerDataEvent(y.repeat(Math.abs(s)),!0),"application-keys"}return"none"}emitMouse(i,s,r){const u=this.options.getTerminal();if(!u)return;const d=this.getCoreMouseService(u);if(d!=null&&d.triggerMouseEvent){const h=this.getMouseReport(s,u);h&&(h.action=i==="mousedown"?1:i==="mouseup"?0:32,h.ctrl=!!(r!=null&&r.ctrlKey),h.alt=!!(r!=null&&r.altKey),h.shift=!!(r!=null&&r.shiftKey),d.triggerMouseEvent(h));return}if(this.options.allowSyntheticMouseFallback===!1||!this.activeTarget)return;const m=this.getLogicalCoordinates(s.clientX,s.clientY);Kp(this.activeTarget,i,{clientX:m.clientX,clientY:m.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,u;this.state==="pending"&&(this.setGestureState("longpress"),(u=(r=this.options).onLongPress)==null||u.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,u=i.clientY-this.startY,d=Math.hypot(r,u);if(this.state==="scrolling"){this.scrollGesture(i,s);return}const m=this.options.getTerminal(),h=this.options.getIsController(),p=Ks(m);if(!(d<=(this.options.dragThresholdPx||8))){if(this.clearLongPressTimer(),Math.abs(u)>=Math.abs(r)||!p||!h){this.setGestureState("scrolling"),m&&this.blurTerminal(m),this.lastX=i.clientX,this.lastY=this.startY,this.scrollRemainderY=0,this.scrollGesture(i,s);return}if(p&&h){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 E,Y,A;const r=this.options.getTerminal();if(!r)return;const u=i.clientY-this.lastY;this.lastX=i.clientX,this.lastY=i.clientY;const d=ta(r),m=d.measured?d.cellHeight:this.options.scrollLineHeightPx||d.cellHeight||18;this.scrollRemainderY+=u;const h=Math.trunc(this.scrollRemainderY/m),p=-h;let y=!1,b="none";const v=this.getActiveBuffer(r),S=Ks(r);if(p!==0){if((v==null?void 0:v.type)==="alternate")b=this.scrollAlternateBuffer(i,p,r,s),y=b!=="none";else{const z=this.getViewportY(r);r.scrollLines(p);const O=this.getViewportY(r);b="buffer",y=z===null||O===null||z!==O}this.scrollRemainderY-=h*m}const T=this.getViewportElement(r);(Y=(E=this.options).onGestureScroll)==null||Y.call(E,{deltaY:u,lines:p,viewportY:this.getViewportY(r),scrollTop:(T==null?void 0:T.scrollTop)??null,scrollHeight:(T==null?void 0:T.scrollHeight)??null,clientHeight:(T==null?void 0:T.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&&((A=s.preventDefault)==null||A.call(s))}endGesture(i,s){var m,h,p;this.clearLongPressTimer();const r=this.options.getTerminal(),u=this.options.getIsController(),d=Ks(r);if(this.state==="pending"){if(d&&u){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};u&&r&&this.isInputLineHit(y,r)&&((h=(m=this.options).onFocus)==null||h.call(m))}else if(this.state==="dragging"&&d&&u){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=Ks(i);if(this.state==="dragging"&&r&&s&&this.activeTarget){const u=this.getLogicalCoordinates(this.lastX,this.lastY);Kp(this.activeTarget,"mouseup",{clientX:u.clientX,clientY:u.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 an=(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))(an||{}),_t=(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))(_t||{}),sn=(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))(sn||{}),na=(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))(na||{}),Ga=(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))(Ga||{});function T1(){return{content:0,fg:0,bg:0,combinedData:"",extended:void 0}}const mb={fg:0,bg:0,ext:0};function pb(a){return a.bg&268435456&&a.extended?a.extended.ext>>>0:0}function M1(a){return a>>>26&7}function A1(a){return a&67108863}function E1(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 gb(a){const i=a;return!i||typeof i.fg!="number"||typeof i.bg!="number"?null:{fg:i.fg>>>0,bg:i.bg>>>0,ext:pb(i)}}const bo=new Map;function bb(a){let i=bo.get(a);return i===void 0&&(i=`#${(a&_t.RGB_MASK).toString(16).padStart(6,"0")}`,bo.size>4096&&bo.clear(),bo.set(a,i)),i}function yb(a,i,s){var r;switch(a&_t.CM_MASK){case _t.CM_P16:case _t.CM_P256:return((r=i.ansi[a&_t.PCOLOR_MASK])==null?void 0:r.css)??s;case _t.CM_RGB:return bb(a&_t.RGB_MASK);default:return s}}function Yp(a,i,s,r){var v;const u=(a&sn.INVERSE)!==0,d=u?i:a,m=u?a:i;let h;const p=d&_t.CM_MASK;if(p===_t.CM_P16||p===_t.CM_P256){let S=d&_t.PCOLOR_MASK;r&&a&sn.BOLD&&S<8&&(S+=8),h=((v=s.ansi[S])==null?void 0:v.css)??s.foreground.css}else p===_t.CM_RGB?h=bb(d&_t.RGB_MASK):h=u?s.background.css:s.foreground.css;const y=m&_t.CM_MASK,b=y===_t.CM_DEFAULT?u?s.foreground.css:s.background.css:yb(m,s,s.background.css);return{fg:h,bg:b,bgIsDefault:!u&&y===_t.CM_DEFAULT}}function yo(a){return(a&sn.BOLD)!==0}function Vu(a){return(a&na.ITALIC)!==0}function Xu(a){return(a&na.DIM)!==0}function Pu(a){return(a&sn.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 Gp(a){if(!a)throw new Error("value must not be falsy");return a}const N1={"▀":[{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]]},L1={"─":{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`}},Js={"":{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}};Js[""]=Js[""];Js[""]=Js[""];function R1(a,i,s,r,u,d,m,h){const p=N1[i];if(p)return _1(a,p,s,r,u,d),!0;const y=k1[i];if(y)return j1(a,y,s,r,u,d),!0;const b=L1[i];if(b)return D1(a,b,s,r,u,d,h),!0;const v=Js[i];return v?(z1(a,v,s,r,u,d,m,h),!0):!1}function _1(a,i,s,r,u,d){for(let m=0;m<i.length;m++){const h=i[m],p=u/8,y=d/8;a.fillRect(s+h.x*p,r+h.y*y,h.w*p,h.h*y)}}const Ip=new Map;function j1(a,i,s,r,u,d){let m=Ip.get(i);m||(m=new Map,Ip.set(i,m));const h=a.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=m.get(h);if(!p){const y=i[0].length,b=i.length,v=a.canvas.ownerDocument.createElement("canvas");v.width=y,v.height=b;const S=Gp(v.getContext("2d")),T=new ImageData(y,b);let E,Y,A,z;if(h.startsWith("#"))E=parseInt(h.slice(1,3),16),Y=parseInt(h.slice(3,5),16),A=parseInt(h.slice(5,7),16),z=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[E,Y,A,z]=h.substring(5,h.length-1).split(",").map(O=>parseFloat(O));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let O=0;O<b;O++)for(let B=0;B<y;B++)T.data[(O*y+B)*4]=E,T.data[(O*y+B)*4+1]=Y,T.data[(O*y+B)*4+2]=A,T.data[(O*y+B)*4+3]=i[O][B]*(z*255);S.putImageData(T,0,0),p=Gp(a.createPattern(v,null)),m.set(h,p)}a.fillStyle=p,a.fillRect(s,r,u,d)}function D1(a,i,s,r,u,d,m){a.strokeStyle=a.fillStyle;for(const[h,p]of Object.entries(i)){a.beginPath(),a.lineWidth=m*Number.parseInt(h);let y;if(typeof p=="function"){const v=.15/d*u;y=p(.15,v)}else y=p;for(const b of y.split(" ")){const v=b[0],S=vb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,xb(T,u,d,s,r,!0,m))}a.stroke(),a.closePath()}}function z1(a,i,s,r,u,d,m,h){const p=new Path2D;p.rect(s,r,u,d),a.clip(p),a.beginPath();const y=m/12;a.lineWidth=h*y;for(const b of i.d.split(" ")){const v=b[0],S=vb[v];if(!S){console.error(`Could not find drawing instructions for "${v}"`);continue}const T=b.substring(1).split(",");!T[0]||!T[1]||S(a,xb(T,u,d,s,r,!1,h,(i.leftPadding??0)*(y/2),(i.rightPadding??0)*(y/2)))}i.type===1?(a.strokeStyle=a.fillStyle,a.stroke()):a.fill(),a.closePath()}function $p(a,i,s=0){return Math.max(Math.min(a,i),s)}const vb={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 xb(a,i,s,r,u,d,m,h=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-h*m-p*m,d&&y[b]!==0&&(y[b]=$p(Math.round(y[b]+.5)-.5,i,0)),y[b]+=r+h*m;for(let b=1;b<y.length;b+=2)y[b]*=s,d&&y[b]!==0&&(y[b]=$p(Math.round(y[b]+.5)-.5,s,0)),y[b]+=u;return y}const dd=.5,O1=1024,B1=6;function U1(a){return/Firefox\//.test(a)||/Edge\/\d/.test(a)?"bottom":"ideographic"}class H1{constructor(i,s=typeof navigator<"u"?navigator.userAgent:""){X(this,"pages",[]);X(this,"slots",new Map);X(this,"inkCache",new Map);X(this,"metrics",null);X(this,"font",null);X(this,"baseline");X(this,"generation",0);X(this,"scratch");this.document=i,this.baseline=U1(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,u=i?r.fontWeightBold:r.fontWeight;return`${s?"italic ":""}${u} ${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 u=`${s?1:0}${r?1:0}${i}`,d=this.inkCache.get(u);if(d!==void 0)return d;let m=0;const h=this.scratchContext();if(h&&!(this.font.customGlyphs&&wb(i))){h.font=this.fontString(s,r),h.textBaseline=this.baseline;const p=h.measureText(i),y=typeof p.actualBoundingBoxRight=="number"?p.actualBoundingBoxRight:p.width;m=Math.max(0,Math.ceil(this.metrics.charLeft+y-this.metrics.cellWidth))}return this.inkCache.set(u,m),m}get(i){const s=this.metrics,r=this.font;if(!s||!r||s.cellWidth<=0||s.cellHeight<=0)return null;const u=`${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(u);if(d)return d;const m=s.cellWidth*i.cells,h=s.cellHeight,p=this.allocate(m,h);if(!p)return null;const{page:y,x:b,y:v}=p,S=y.ctx;S.save(),S.beginPath(),S.rect(b,v,m,h),S.clip(),S.globalAlpha=1,S.fillStyle=i.bg,S.fillRect(b,v,m,h),S.fillStyle=i.fg,i.dim&&(S.globalAlpha=dd);let T=!1;r.customGlyphs&&(T=R1(S,i.chars,b,v,s.cellWidth,s.cellHeight,r.fontSize,s.dpr)),T||(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 E={source:y.canvas,x:b,y:v,width:m,height:h};return this.slots.set(u,E),E}allocate(i,s){for(const r of this.pages){const u=this.fit(r,i,s);if(u)return u}if(this.pages.length<B1){const r=this.createPage(Math.max(O1,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 u={page:i,x:i.shelfX,y:i.shelfY};return i.shelfX+=s,u}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 wb(a){if(a.length!==1)return!1;const i=a.charCodeAt(0);return i>=9472&&i<=9631||i>=57504&&i<=57558}function K1(a){var s,r,u,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||!((u=i._themeService)!=null&&u.colors)||typeof((d=i._renderService)==null?void 0:d.setRenderer)!="function"?null:i}const Y1=150,G1=600,vo=4294967295;function I1(){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 $1{constructor(){X(this,"listeners",new Set);X(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 Ed{constructor(i,s){X(this,"dimensions",I1());X(this,"redraw",new $1);X(this,"onRequestRedraw",this.redraw.event);X(this,"stats",{frames:0,heldFrames:0,lastPaintMs:0,lastCells:0,lastInputToPaintMs:null});X(this,"canvas");X(this,"ctx");X(this,"decorCanvas");X(this,"decorCtx");X(this,"atlas");X(this,"disposables",[]);X(this,"now");X(this,"maxSyncHoldMs");X(this,"cols",0);X(this,"rows",0);X(this,"painted",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),meta:new Uint32Array(0),combined:[]});X(this,"row",{content:new Uint32Array(0),fg:new Uint32Array(0),bg:new Uint32Array(0),ext:new Uint32Array(0),combined:[]});X(this,"work",T1());X(this,"overlayProvider",null);X(this,"paintedOverlayRows",new Set);X(this,"paintedCursorRow",-1);X(this,"lastYdisp",0);X(this,"holdStartedAt",null);X(this,"held",null);X(this,"holdTimer",null);X(this,"selection",null);X(this,"link",null);X(this,"inputAt",null);X(this,"blinkVisible",!0);X(this,"blinkTimer",null);X(this,"disposed",!1);X(this,"isSynchronizing");X(this,"dprUsed",0);this.core=i,this.now=s.now??(()=>performance.now()),this.maxSyncHoldMs=s.maxSyncHoldMs??Y1,this.isSynchronizing=s.isSynchronizing??(()=>!1);const r=i._coreBrowserService.mainDocument,u=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 m=this.decorCanvas.getContext("2d");if(!m)throw new Error("2D canvas unavailable");this.decorCtx=m,u.appendChild(this.canvas),u.appendChild(this.decorCanvas),this.atlas=new H1(r),this.disposables.push(i._themeService.onChangeColors(()=>{this.atlas.clear(),this.invalidateAll(),this.redrawDecor()}),i.optionsService.onOptionChange(h=>{(h==="cursorBlink"||h==="cursorStyle")&&this.restartBlink()})),i.linkifier&&this.disposables.push(i.linkifier.onShowLinkUnderline(h=>{this.link=h,this.redrawDecor()}),i.linkifier.onHideLinkUnderline(()=>{this.link=null,this.redrawDecor()})),this.observeDevicePixels(),this.observeFonts(r),this.restartBlink()}static install(i,s={}){const r=K1(i);if(!r)return null;const u=new Ed(r,s);return r._renderService.setRenderer(u),r._renderService.handleResize(r._bufferService.cols,r._bufferService.rows),u}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 u of q1(i))s.add(u);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 u=this.core.screenElement;u&&(u.style.width=`${r.css.canvas.width}px`,u.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}paint(i,s){var v;const r=this.now(),d=this.buffer().ydisp;d!==this.lastYdisp&&(this.lastYdisp=d,this.redrawDecor());const m=((v=this.overlayProvider)==null?void 0:v.call(this))??null,h=new Map;for(const S of(m==null?void 0:m.cells)??[]){const T=h.get(S.row);T?T.push(S):h.set(S.row,[S])}const p=this.cursorState(m),y=new Set;for(let S=i;S<=s;S++)y.add(S);for(const S of this.paintedOverlayRows)xo(y,S-d,this.rows);for(const S of h.keys())xo(y,S-d,this.rows);this.paintedCursorRow>=0&&xo(y,this.paintedCursorRow,this.rows),p&&xo(y,p.y,this.rows);let b=0;for(const S of y)this.loadRow(S,d,h.get(S+d)),b+=this.paintRow(S,p);this.paintedOverlayRows=new Set(h.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:u,fg:d,bg:m,ext:h,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),u[v]=b.content,d[v]=b.fg,m[v]=b.bg,h[v]=pb(b),p[v]=b.content&an.IS_COMBINED_MASK?b.combinedData:""):(u[v]=1<<an.WIDTH_SHIFT,d[v]=0,m[v]=0,h[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&&!(u[S]>>>an.WIDTH_SHIFT)&&this.blankAt(S-1);const T=S+v.width;T<this.cols&&!(u[T]>>>an.WIDTH_SHIFT)&&u[T-1]>>>an.WIDTH_SHIFT===2&&this.blankAt(T);const E=E1(v.chars,v.width);u[S]=E.content,p[S]=E.combinedData,d[S]=v.style.fg,m[S]=v.style.bg,h[S]=v.style.ext,v.width===2&&(u[S+1]=0,p[S+1]="",d[S+1]=v.style.fg,m[S+1]=v.style.bg,h[S+1]=v.style.ext)}}blankAt(i){this.row.content[i]=32|1<<an.WIDTH_SHIFT,this.row.combined[i]=""}paintRow(i,s){const r=this.cols,{content:u,fg:d,bg:m,ext:h,combined:p}=this.row,y=this.painted,b=i*r;let v=0,S=-1,T=-1,E="";const Y=()=>{S<0||(this.fillCells(S,i,T-S,E),S=-1)};let A=0;for(;A<r;){let O=u[A]>>>an.WIDTH_SHIFT;O===0&&(O=1),A+O>r&&(O=r-A),O===1&&A+1<r&&this.overflowsInto(A)&&(O=2);const B=s&&s.y===i&&s.x>=A&&s.x<A+O?s.shape:0,te=O|B<<3;let ue=this.differs(b+A,A,te);for(let W=1;W<O;W++)this.differs(b+A+W,A+W,4)&&(ue=!0);if(ue){for(let G=0;G<O;G++){const U=b+A+G;y.content[U]=u[A+G],y.fg[U]=d[A+G],y.bg[U]=m[A+G],y.ext[U]=h[A+G],y.meta[U]=G===0?te:4,y.combined[U]=p[A+G]}v+=O;const W=this.plainFill(A,B);W!==null?S>=0&&T===A&&E===W?T=A+O:(Y(),S=A,T=A+O,E=W):(Y(),this.paintCell(A,i,O,B))}A+=O}return Y(),v}differs(i,s,r){const u=this.painted,d=this.row;return u.meta[i]!==r||u.content[i]!==d.content[s]||u.fg[i]!==d.fg[s]||u.bg[i]!==d.bg[s]||u.ext[i]!==d.ext[s]||u.combined[i]!==d.combined[s]}overflowsInto(i){const{content:s,fg:r,bg:u,ext:d}=this.row,m=s[i];if((m&an.CODEPOINT_MASK)<128&&!(m&an.IS_COMBINED_MASK)||m>>>an.WIDTH_SHIFT!==1||Pu(r[i]))return!1;const p=s[i+1],y=p&an.CODEPOINT_MASK;if(p>>>an.WIDTH_SHIFT!==1||p&an.IS_COMBINED_MASK||y!==0&&y!==32||u[i]!==u[i+1]||d[i+1]!==0||(r[i]&sn.INVERSE)!==(r[i+1]&sn.INVERSE)||r[i]&sn.INVERSE&&r[i]!==r[i+1]||r[i+1]&(sn.UNDERLINE|sn.STRIKETHROUGH)||u[i+1]&na.OVERLINE)return!1;const b=this.charsAt(i);return this.core.optionsService.rawOptions.customGlyphs!==!1&&wb(b)?!1:this.atlas.overflow(b,yo(r[i]),Vu(u[i]))>0}charsAt(i){const s=this.row.content[i];if(s&an.IS_COMBINED_MASK)return this.row.combined[i];const r=s&an.CODEPOINT_MASK;return r?String.fromCodePoint(r):""}plainFill(i,s){if(s!==0)return null;const{content:r,fg:u,bg:d}=this.row,m=r[i],h=m&an.CODEPOINT_MASK,p=!(m&an.IS_COMBINED_MASK)&&(h===0||h===32),y=Pu(u[i]);return!p&&!y||(u[i]&(sn.UNDERLINE|sn.STRIKETHROUGH)||d[i]&na.OVERLINE)&&!y?null:Yp(u[i],d[i],this.colors(),this.boldBright()).bg}paintCell(i,s,r,u){const d=this.ctx,m=this.dimensions.device,h=this.colors(),p=this.row.fg[i],y=this.row.bg[i],b=this.row.ext[i],v=Yp(p,y,h,this.boldBright());let S=v.fg,T=v.bg;u===1&&(T=h.cursor.css,S=h.cursorAccent.css);const E=Pu(p),Y=this.charsAt(i),A=i*m.cell.width,z=s*m.cell.height,O=r*m.cell.width,B=m.cell.height,te=E||Y===""||Y===" ",ue=te?null:this.atlas.get({chars:Y,bold:yo(p),italic:Vu(y),dim:Xu(y),fg:S,bg:T,cells:r});ue?d.drawImage(ue.source,ue.x,ue.y,ue.width,ue.height,A,z,O,B):(d.fillStyle=T,d.fillRect(A,z,O,B),te||(d.save(),d.beginPath(),d.rect(A,z,O,B),d.clip(),d.fillStyle=S,Xu(y)&&(d.globalAlpha=dd),d.font=this.atlas.fontString(yo(p),Vu(y)),d.fillText(Y,A+m.char.left,z+m.char.top+m.char.height),d.restore())),E||this.paintDecorations(A,z,r,p,y,b,S),u!==0&&u!==1&&this.paintCursorShape(A,z,O,u)}paintDecorations(i,s,r,u,d,m,h){const p=(u&sn.UNDERLINE)!==0,y=(u&sn.STRIKETHROUGH)!==0,b=(d&na.OVERLINE)!==0;if(!p&&!y&&!b)return;const v=this.ctx,S=this.dimensions.device,T=this.core.optionsService.rawOptions,E=this.core._coreBrowserService.dpr,Y=r*S.cell.width;v.save(),v.beginPath(),v.rect(i,s,Y,S.cell.height),v.clip(),Xu(d)&&(v.globalAlpha=dd);const A=Math.max(1,Math.floor(T.fontSize*E/15)),z=A%2===1?.5:0;if(p){const O=A1(m);let B=h;if(O){let W=O;this.boldBright()&&yo(u)&&(W&50331648)!==50331648&&(W&255)<8&&(W+=8),B=yb(W,this.colors(),h)}v.strokeStyle=B,v.lineWidth=A;const te=s+S.char.top+Math.ceil(S.char.height)-z-A*2,ue=m?M1(m):Ga.SINGLE;switch(v.beginPath(),ue){case Ga.DOUBLE:v.moveTo(i,te),v.lineTo(i+Y,te),v.moveTo(i,te+A*2),v.lineTo(i+Y,te+A*2);break;case Ga.CURLY:{const W=te+A,G=Math.max(1,A);for(let U=0;U<r;U++){const ie=i+U*S.cell.width,se=ie+S.cell.width/2,pe=ie+S.cell.width;v.moveTo(ie,W),v.bezierCurveTo(ie,W-G,se,W-G,se,W),v.bezierCurveTo(se,W+G,pe,W+G,pe,W)}break}case Ga.DOTTED:v.setLineDash([A,A]),v.moveTo(i,te),v.lineTo(i+Y,te);break;case Ga.DASHED:{const W=Math.floor(.6*S.cell.width),G=Math.floor(.3*S.cell.width);v.setLineDash([W,G,S.cell.width-W-G]),v.moveTo(i,te),v.lineTo(i+Y,te);break}default:v.moveTo(i,te),v.lineTo(i+Y,te)}v.stroke(),v.setLineDash([])}if(b&&(v.strokeStyle=h,v.lineWidth=A,v.beginPath(),v.moveTo(i,s+S.char.top+z),v.lineTo(i+Y,s+S.char.top+z),v.stroke()),y){const O=Math.max(1,Math.floor(T.fontSize*E/10)),B=s+S.char.top+Math.floor(S.char.height/2)-(O%2===1?.5:0);v.strokeStyle=h,v.lineWidth=O,v.beginPath(),v.moveTo(i,B),v.lineTo(i+Y,B),v.stroke()}v.restore()}paintCursorShape(i,s,r,u){const d=this.ctx,m=this.dimensions.device,h=this.core._coreBrowserService.dpr,p=this.colors();switch(d.save(),d.fillStyle=p.cursor.css,d.strokeStyle=p.cursor.css,u){case 2:d.fillRect(i,s,Math.max(1,Math.round(this.core.optionsService.rawOptions.cursorWidth*h)),m.cell.height);break;case 3:d.fillRect(i,s+m.cell.height-Math.max(1,Math.round(h))-1,r,Math.max(1,Math.round(h)));break;case 4:{const y=Math.max(1,Math.round(h));d.lineWidth=y,d.strokeRect(i+y/2,s+y/2,r-y,m.cell.height-y);break}}d.restore()}fillCells(i,s,r,u){const d=this.dimensions.device;this.ctx.fillStyle=u,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 u,d;if(i&&i.cursor!==void 0){if(i.cursor===null)return null;u=i.cursor.row,d=i.cursor.col}else{if(!s.coreService.isCursorInitialized||s.coreService.isCursorHidden)return null;u=r.ybase+r.y,d=r.x}const m=u-r.ydisp;if(m<0||m>=this.rows)return null;const h=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=qp(p.cursorStyle||"block");else{const b=p.cursorInactiveStyle??"outline";y=b==="none"?0:qp(b)}return y===0?null:{x:h,y:m,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()},G1),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(),u=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),m=this.selection;if(m){const y=m.start[1]-u,b=m.end[1]-u,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,m.columnSelectMode)d(m.start[0],v,m.end[0]-m.start[0],S-v+1);else{const T=y===v?m.start[0]:0,E=v===b?m.end[0]:this.cols;d(T,v,E-T,1),d(0,v+1,this.cols,Math.max(S-v-1,0)),v!==S&&d(0,S,b===S?m.end[0]:this.cols,1)}}const h=this.link;if(h){const y=this.core._coreBrowserService.dpr;i.fillStyle=h.fg===257?r.background.css:h.fg!==void 0&&h.fg<256?((p=r.ansi[h.fg])==null?void 0:p.css)??r.foreground.css:r.foreground.css;const b=(v,S,T)=>i.fillRect(v*s.cell.width,(S+1)*s.cell.height-y-1,T*s.cell.width,y);if(h.y1===h.y2)b(h.x1,h.y1,h.x2-h.x1);else{b(h.x1,h.y1,h.cols-h.x1);for(let v=h.y1+1;v<h.y2;v++)b(0,v,h.cols);b(0,h.y2,h.x2)}}}updateDimensions(i,s){const r=this.core._charSizeService;if(!r.hasValidSize)return;const u=this.core._coreBrowserService.dpr,d=this.core.optionsService.rawOptions,m=this.dimensions;m.device.char.width=Math.floor(r.width*u),m.device.char.height=Math.ceil(r.height*u),m.device.cell.height=Math.floor(m.device.char.height*d.lineHeight),m.device.char.top=d.lineHeight===1?0:Math.round((m.device.cell.height-m.device.char.height)/2),m.device.cell.width=m.device.char.width+Math.round(d.letterSpacing),m.device.char.left=Math.floor(d.letterSpacing/2),m.device.canvas.height=s*m.device.cell.height,m.device.canvas.width=i*m.device.cell.width,m.css.canvas.height=Math.round(m.device.canvas.height/u),m.css.canvas.width=Math.round(m.device.canvas.width/u),m.css.cell.height=m.css.canvas.height/s,m.css.cell.width=m.css.canvas.width/i,this.dprUsed=u}resizeGrid(i,s){this.cols=i,this.rows=s;const r=i*s;this.painted={content:new Uint32Array(r).fill(vo),fg:new Uint32Array(r),bg:new Uint32Array(r),ext:new Uint32Array(r),meta:new Uint32Array(r).fill(vo),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(vo),this.painted.meta.fill(vo),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 u=r.find(b=>b.target===this.canvas);if(!u)return;if(!("devicePixelContentBoxSize"in u)||!((y=u.devicePixelContentBoxSize)!=null&&y[0])){s==null||s.disconnect(),s=null;return}const d=u.devicePixelContentBoxSize[0].inlineSize,m=u.devicePixelContentBoxSize[0].blockSize;if(d<=0||m<=0||d===this.canvas.width&&m===this.canvas.height)return;const h=this.core._coreBrowserService.dpr,p=this.dimensions.css.canvas;if(!(Math.abs(d-p.width*h)>2||Math.abs(m-p.height*h)>2)){this.dimensions.device.canvas.width=d,this.dimensions.device.canvas.height=m;for(const b of[this.canvas,this.decorCanvas])b.width=d,b.height=m;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,u=-1/0;for(const d of i){const m=d-s;m<0||m>=this.rows||(r=Math.min(r,m),u=Math.max(u,m))}r<=u&&this.redraw.fire({start:r,end:u})}}function qp(a){switch(a){case"bar":return 2;case"underline":return 3;case"outline":return 4;default:return 1}}function q1(a){if(!a)return[];const i=a.cells.map(s=>s.row);return a.cursor&&i.push(a.cursor.row),i}function xo(a,i,s){i>=0&&i<s&&a.add(i)}const Ps="herdr_remote_renderer_probe_v2",F1=30,wo=1,V1=720*60*60*1e3,fd={};function Sb(){let a=null;if(typeof window>"u")a=fd[Ps]||null;else try{a=window.localStorage?window.localStorage.getItem(Ps):null}catch{a=fd[Ps]||null}if(!a)return{v:wo,ua:{}};try{const i=JSON.parse(a);return typeof i=="object"&&i!==null&&i.v===wo&&typeof i.ua=="object"&&i.ua!==null?i:{v:wo,ua:{}}}catch{return{v:wo,ua:{}}}}function X1(a,i=Date.now()){var u;const s=Sb();s.ua[a]={failedAt:i};const r=JSON.stringify(s);if(fd[Ps]=r,typeof window<"u")try{(u=window.localStorage)==null||u.setItem(Ps,r)}catch(d){console.warn("Failed to write renderer probe result to localStorage:",d)}}function P1(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";if(!s)return!1;const u=Sb().ua[s];return!(!u||typeof u.failedAt!="number"||i-u.failedAt>V1)}function Fp(a,i=Date.now()){const s=typeof navigator<"u"?navigator.userAgent:"";s&&X1(s,i)}function Z1(a){if(a.length<4)return!0;const i=a[0],s=a[1],r=a[2],u=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]!==u)return!1;return!0}function Q1(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(u){return console.debug("Canvas probe inconclusive: failed to acquire 2D context:",u),"inconclusive"}if(!i)return console.debug("Canvas probe inconclusive: 2D context is null"),"inconclusive";const s=Math.min(a.width,640),r=Math.min(a.height,240);if(s<=0||r<=0)return console.debug("Canvas probe inconclusive: calculated sample dimensions are zero"),"inconclusive";try{const u=i.getImageData(0,0,s,r);return Z1(u.data)?"blank":"healthy"}catch(u){return console.debug("Canvas probe inconclusive: getImageData threw exception:",u),"inconclusive"}}function Vp(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 Zu={kind:"dom",canvas:null,dispose:()=>{},verify:async()=>{}};function W1(a,i={}){if(P1())return Zu;let s;try{s=Ed.install(a,{isSynchronizing:i.isSynchronizing})}catch(h){return console.debug("Canvas renderer unavailable, using the DOM renderer:",h),Fp(),Zu}if(!s)return Zu;let r=s,u=null;const d=()=>{var p;if(!r)return;Fp();const h=r;r=null;try{h.uninstall()}catch{}(p=i.onRendererSwapped)==null||p.call(i,"dom")};return{get kind(){return r?"canvas":"dom"},get canvas(){return r},dispose:()=>{const h=r;r=null;try{h==null||h.dispose()}catch{}},verify:async()=>{if(r)return u||(u=(async()=>{try{const h=r.stats.frames;await Vp(2);for(let y=0;y<F1&&r&&r.stats.frames===h;y++)await Vp(1);if(!r)return;const p=Q1(r.textCanvas);p==="blank"?d():p==="inconclusive"&&console.debug("Canvas probe inconclusive; retaining canvas renderer without blacklisting")}catch(h){console.debug("Canvas probe inconclusive: unexpected error during verify():",h)}finally{u=null}})(),u)}}}function Xp(a,i){const s=typeof window<"u"?window:void 0,r=s&&typeof s.devicePixelRatio=="number"&&s.devicePixelRatio>0?s.devicePixelRatio:1,u=s&&s.visualViewport&&typeof s.visualViewport.scale=="number"&&s.visualViewport.scale>0?s.visualViewport.scale:1,d=Math.max(0,a.width),m=Math.max(0,a.height),h=Math.round(d*r*100)/100,p=Math.round(m*r*100)/100;return{dpr:r,scale:u,cssWidth:d,cssHeight:m,physicalWidth:h,physicalHeight:p}}function J1(a){const{lastSnapshot:i,currentSnapshot:s,physicalTolerancePx:r=6}=a;if(!i)return{shouldIgnore:!1,isVisualZoom:!1,reason:"initial"};const u=Math.abs(s.scale-i.scale)>.01,d=Math.abs(s.scale-1)>.01;if(u||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 h=Math.abs(s.cssWidth-i.cssWidth),p=Math.abs(s.cssHeight-i.cssHeight);return h<1&&p<1?{shouldIgnore:!0,isVisualZoom:!1,reason:"no_box_change"}:{shouldIgnore:!1,isVisualZoom:!1,reason:"genuine_resize"}}const ew=" ()[]{}'\"\\`";function Qu(a,i,s,r=1){var A,z;if(!i||!((A=i.buffer)!=null&&A.active)||i.cols<=0||i.rows<=0)return null;const u=s||((z=i.element)==null?void 0:z.querySelector(".xterm-screen"))||i.element;if(!u||typeof u.getBoundingClientRect!="function")return null;const d=u.getBoundingClientRect(),m=hb(a.clientX,a.clientY,d,r),h=ta(i);if(h.cellWidth<=0||h.cellHeight<=0)return null;const p=Math.max(1,d.width||i.cols*h.cellWidth),y=Math.max(1,d.height||i.rows*h.cellHeight),b=Math.max(0,Math.min(p-1,m.clientX-d.left)),v=Math.max(0,Math.min(y-1,m.clientY-d.top)),S=Math.max(0,Math.min(i.cols-1,Math.floor(b/h.cellWidth))),T=Math.max(0,Math.min(i.rows-1,Math.floor(v/h.cellHeight))),Y=(i.buffer.active.viewportY??0)+T;return{col:S,bufferRow:Y}}function tw(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 nw(a,i,s){var S,T;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 u=((T=a.options)==null?void 0:T.wordSeparator)??ew,d=new Array(a.cols).fill(null),m=Math.min(a.cols,r.length);let h=0;for(;h<m;){const E=r.getCell(h);if(!E){d[h]={startCol:h,endCol:h+1,isSeparator:!0},h++;continue}const Y=E.getWidth();if(Y===0){d[h]||(d[h]={startCol:h,endCol:h+1,isSeparator:!0}),h++;continue}const A=E.getChars(),z=tw(A,u),O=Math.min(a.cols,h+Y),B={startCol:h,endCol:O,isSeparator:z};for(let te=h;te<O;te++)d[te]=B;h+=Math.max(1,Y)}for(let E=m;E<a.cols;E++)d[E]||(d[E]={startCol:E,endCol:E+1,isSeparator:!0});const p=d[i];if(!p||p.isSeparator)return null;let y=p.startCol;for(;y>0;){const E=d[y-1];if(E&&!E.isSeparator)y=E.startCol;else break}let b=p.endCol;for(;b<a.cols;){const E=d[b];if(E&&!E.isSeparator)b=E.endCol;else break}const v=b-y;return v<=0?null:{startCol:y,length:v}}function iw(a){var d;if(!a||!((d=a.buffer)!=null&&d.active))return"";const i=a.buffer.active,s=i.viewportY??0,r=a.rows,u=[];for(let m=0;m<r;m++){const h=i.getLine(s+m);u.push(h?h.translateToString(!0):"")}for(;u.length>0&&u[u.length-1]==="";)u.pop();return u.join(`
45
+ `)}const Pp=new Set(["│","┃","╎","╏","┆","┇","┊","┋","║","▏","▕","|"]),lw=.6,aw=new Set(["─","━","═","┄","┅","┈","┉","-"]),sw=.8;function Wu(a,i){if(!a)return!1;let s=0;const r=Math.min(i,a.length);for(let u=0;u<r;u++){const d=a.getCell(u);if(d){const m=d.getChars();m&&aw.has(m)&&s++}}return s>=Math.max(5,Math.min(i*.25,10))}function Ju(a,i,s){var T;if(!a||!((T=a.buffer)!=null&&T.active)||a.cols<=0)return{startCol:0,endCol:0};const r=a.buffer.active,u=a.cols,d=Math.max(0,Math.min(u-1,i)),m=r.viewportY??0,h=a.rows>0?a.rows:1,p=new Int32Array(u);let y=0;for(let E=0;E<h;E++){const Y=r.getLine(m+E);if(y++,!Y)continue;const A=Math.min(u,Y.length);for(let z=0;z<A;z++){const O=Y.getCell(z);if(O){const B=O.getChars();B&&Pp.has(B)&&p[z]++}}}if(y===0)return{startCol:0,endCol:u-1};const b=y*lw,v=E=>p[E]>=b;let S=!1;for(let E=0;E<u;E++)if(v(E)){S=!0;break}if(S){if(v(d))return{startCol:d,endCol:d};let E=-1;for(let A=d-1;A>=0;A--)if(v(A)){E=A;break}let Y=u;for(let A=d+1;A<u;A++)if(v(A)){Y=A;break}return{startCol:E+1,endCol:Y-1}}if(s!==void 0){const E=Math.max(m,Math.min(m+h-1,s)),Y=r.getLine(E);if(!Wu(Y,u)){let A=m;for(let B=E-1;B>=m;B--)if(Wu(r.getLine(B),u)){A=B+1;break}let z=m+h-1;for(let B=E+1;B<=m+h-1;B++)if(Wu(r.getLine(B),u)){z=B-1;break}const O=z-A+1;if(O>=2){const B=new Int32Array(u);for(let G=A;G<=z;G++){const U=r.getLine(G);if(!U)continue;const ie=Math.min(u,U.length);for(let se=0;se<ie;se++){const pe=U.getCell(se);if(pe){const Ce=pe.getChars();Ce&&Pp.has(Ce)&&B[se]++}}}const te=O*sw,ue=G=>B[G]>=te;let W=!1;for(let G=0;G<u;G++)if(ue(G)){W=!0;break}if(W){if(ue(d))return{startCol:d,endCol:d};let G=-1;for(let ie=d-1;ie>=0;ie--)if(ue(ie)){G=ie;break}let U=u;for(let ie=d+1;ie<u;ie++)if(ue(ie)){U=ie;break}return{startCol:G+1,endCol:U-1}}}}}return{startCol:0,endCol:u-1}}function Zp(a,i){const s=Math.min(a.startCol,a.endCol),r=Math.max(a.startCol,a.endCol),u=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:u,endRow:d}}function ed(a,i){var y;if(!a||!((y=a.buffer)!=null&&y.active)||a.cols<=0)return"";const s=a.buffer.active,r=a.cols,u=Math.min(i.startRow,i.endRow),d=Math.max(i.startRow,i.endRow),m=Math.max(0,Math.min(i.startCol,i.endCol)),h=Math.min(r-1,Math.max(i.startCol,i.endCol));if(m>h||u>d)return"";const p=[];for(let b=u;b<=d;b++){const v=s.getLine(b);if(!v){p.push("");continue}const S=v.translateToString(!0,m,h+1);p.push(S.trimEnd())}return p.join(`
46
+ `)}async function ia(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 m=document.createRange();m.selectNodeContents(i),r&&(r.removeAllRanges(),r.addRange(m)),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 rw(){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 ow(){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(u=>u.startsWith("image/"));if(r){const u=await s.getType(r);if(u&&u.size>0)return{ok:!0,blob:u}}}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 Cb(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 u=r.getAsFile();if(u)return u}}return null}function cw(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 td="Herdr Remote",Qp=80,uw=/[\u0000-\u001F\u007F-\u009F]/g;function hd(a){if(typeof a!="string")return"";const i=a.replace(uw," ").replace(/\s+/g," ").trim();return i.length<=Qp?i:`${i.slice(0,Qp-1).trimEnd()}…`}function dw(a,i,s){const r=Zv(s??null),u=r?`${r} `:"",d=hd(a);if(d)return`${u}${d} · ${td}`;const m=hd(i);return m?`${u}${m} · ${td}`:`${u}${td}`}function fw(a,i,s){const r=dw(a,i,s);return typeof document<"u"&&(document.title=r),r}const hw=new Set(["http:","https:","mailto:"]),nd=/(?:https?:\/\/|mailto:|www\.)[^\s"'<>`]+/gi,mw=/[.,;:!?'"]+$/,Wp=8;function Nd(a){return/^www\./i.test(a)?`https://${a}`:a}function pw(a){const i=(u,d)=>u.split(d).length-1;let s=a.replace(mw,"");const r=[["(",")"],["[","]"],["{","}"]];for(const[u,d]of r)for(;s.endsWith(d)&&i(s,d)>i(s,u);)s=s.slice(0,-1);return s}function Tb(a){if(typeof a!="string"||a.length===0)return!1;try{return hw.has(new URL(Nd(a)).protocol)}catch{return!1}}function gw(a,i){if(typeof a!="string"||i<0)return null;nd.lastIndex=0;for(let s=nd.exec(a);s;s=nd.exec(a)){const r=pw(s[0]);if(!r)continue;const u=s.index,d=u+r.length;if(i>=u&&i<d&&Tb(r))return r}return null}function bw(a,i,s){var h;const r=(h=a==null?void 0:a.buffer)==null?void 0:h.active;if(!r||typeof r.getLine!="function"||!r.getLine(s))return null;let u=s;for(let p=0;p<Wp;p+=1){const y=r.getLine(u);if(!(y!=null&&y.isWrapped)||u===0)break;u-=1}let d="",m=-1;for(let p=u;p<u+Wp;p+=1){const y=r.getLine(p);if(!y||p>u&&!y.isWrapped)break;p===s&&(m=d.length+i),d+=y.translateToString(!1)}return m<0?null:{text:d,index:m}}function yw(a,i,s){const r=bw(a,i,s);return r?gw(r.text,r.index):null}function vw(a){try{const i=new URL(Nd(a));return i.host||i.pathname}catch{return""}}function id(a){return!Tb(a)||typeof window>"u"||typeof window.open!="function"?!1:(window.open(Nd(a),"_blank","noopener,noreferrer"),!0)}const Ka="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Ya="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",xw=({anchorPoint:a,hasSelection:i,isController:s,vibrateOnKeyPress:r=!1,linkUrl:u=null,onOpenLink:d,onCopySelection:m,onCopyLine:h,onCopyScreen:p,onPaste:y,onClose:b})=>{const{t:v}=jt(),S=w.useRef(null),[T,E]=w.useState(null);w.useEffect(()=>{if(r&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r]),w.useLayoutEffect(()=>{const O=S.current;if(!O||!O.parentElement)return;const B=O.parentElement.getBoundingClientRect(),te=O.getBoundingClientRect(),ue=te.width||208,W=te.height||220,G=B.width,U=B.height;let ie=a.x-ue/2;ie=Math.max(8,Math.min(Math.max(8,G-ue-8),ie));let se=a.y-W-8;se<8&&(se=a.y+8),se=Math.max(8,Math.min(Math.max(8,U-W-8),se)),E({x:ie,y:se})},[a.x,a.y,i,s,u]);const Y=Math.max(8,a.x-104),A=Math.max(8,a.y-200),z={position:"absolute",left:`${T?T.x:Y}px`,top:`${T?T.y:A}px`,visibility:T?"visible":"hidden"};return f.jsx("div",{ref:S,role:"menu","aria-label":"终端选择操作",className:"z-50 w-52 select-none font-mono",style:z,onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),onPointerDown:O=>O.stopPropagation(),children:f.jsxs(pn,{tone:"accent",className:"border border-tui-border bg-tui-base p-1.5 shadow-lg",bodyClassName:"flex flex-col gap-1",children:[u&&d&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:()=>{d(u),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.openLink")}),f.jsx("span",{className:"ml-auto max-w-[45%] truncate text-tui-faint",children:vw(u)})]}),i&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:()=>{m(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copySelection")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:()=>{h(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyLine")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:()=>{p(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.copyScreen")})]}),s&&f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:()=>{y(),b()},children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.paste")})]}),f.jsxs("button",{type:"button",role:"menuitem",className:ne(Ka,Ya),onClick:b,children:[f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint group-hover:text-tui-accent",children:qe.cursor}),f.jsx("span",{className:"truncate",children:v("clipboard.cancel")})]})]})})},ww=({isOpen:a,onClose:i,onSend:s,onSendImage:r})=>{const{t:u,addToast:d}=jt(),[m,h]=w.useState(""),[p,y]=w.useState(null),[b,v]=w.useState(!1),S=w.useRef(null),T=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{a&&(h(""),y(null),v(!1),S.current&&(S.current.value=""),T.current&&(T.current.value=""))},[a]);const Y=async W=>{if(W.size===0){d("error",u("clipboard.fileEmpty"));return}v(!0);try{const G=await Kg(W);G?(y(G),h("")):d("error",u("clipboard.imageTooLarge"))}catch(G){console.error("Failed to process image:",G),d("error",u("clipboard.imageTooLarge"))}finally{v(!1)}},A=async W=>{const G=Cb(W);G&&(W.preventDefault(),await Y(G))},z=async W=>{const G=cw(W.target.files);W.target.value="",G&&await Y(G)},O=W=>{const G=W.target.value;h(G),G&&p&&y(null)},B=()=>{y(null),S.current&&(S.current.value=""),T.current&&(T.current.value="")},te=()=>{p?(r==null||r(p),i()):m.trim()&&(s(m),i())},ue=!!(m.trim()||p);return f.jsx(Ad,{isOpen:a,onClose:i,title:u("clipboard.pasteTitle"),closeLabel:u("clipboard.cancel"),size:"sm",footer:f.jsxs("div",{className:"flex items-center justify-end gap-2",children:[f.jsx(_e,{variant:"ghost",onClick:i,children:u("clipboard.cancel")}),f.jsx(_e,{variant:"primary",onClick:te,disabled:!ue||b,children:u("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:u("clipboard.pasteHint")}),f.jsx("textarea",{ref:E,id:"paste-fallback-input","data-testid":"paste-fallback-input",rows:4,autoFocus:!0,placeholder:u("clipboard.pasteHint"),value:m,onChange:O,onPaste:A,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:u("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:z}),f.jsx("input",{ref:T,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"paste-fallback-camera-input",onChange:z}),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:u("clipboard.imageCompressedSize",{size:Gv(p.byteLength)})}),f.jsx(_e,{variant:"ghost",onClick:B,"aria-label":u("clipboard.removeImage"),children:u("clipboard.cancel")})]})]}):f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(_e,{variant:"default",onClick:()=>{var W;return(W=S.current)==null?void 0:W.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.chooseImage"),children:u("clipboard.chooseImage")}),f.jsx(_e,{variant:"default",onClick:()=>{var W;return(W=T.current)==null?void 0:W.click()},disabled:b||!!m.trim(),className:"min-h-[44px] px-3 touch-manipulation text-tui-sm font-sans flex-1","aria-label":u("clipboard.takePhoto"),children:u("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:u("clipboard.imageCompressing")})})]})]})})},Sw=[[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 Jp(a){if(a>=32&&a<=126)return 1;if(a<12288)return 0;for(const[i,s]of Sw){if(a<i)return 0;if(a<=s)return 2}return 0}const Cw=2,Tw="?!#",eg=8,Mw=1500,Aw=4e3,Ew=20;function Qi(a){return a===""||a===" "?" ":a}function Nw(a,i,s,r=64){var m;const u=a.buffer.active.getLine(i),d=[];for(let h=s-1;h>=0&&d.length<r;h--){const p=u==null?void 0:u.getCell(h);if(!p)break;((m=p.getWidth)==null?void 0:m.call(p))!==0&&d.unshift(Qi(p.getChars()))}return d}function kw(a,i){for(let s=Math.min(a.length,i.length);s>0;s--){let r=!0;for(let u=0;u<s&&r;u++)r=i[i.length-s+u]===Qi(a[u]);if(r)return s}return 0}function Lw(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 Rw{constructor(i){X(this,"getTerminal");X(this,"getFieldOption");X(this,"charWidth");X(this,"now");X(this,"textDecoder",new TextDecoder("utf-8"));X(this,"confidentKeys",new Set);X(this,"fieldStyles",new Map);X(this,"field",null);X(this,"runStartedEmpty",!1);X(this,"predictions",[]);X(this,"predictedCursor",null);X(this,"srtt",null);X(this,"isSuppressed",!1);X(this,"suppressCursor",null);X(this,"suppressSentAt",0);X(this,"inFlight",[]);X(this,"inFlightUnknown",!1);X(this,"runInFlight",[]);X(this,"probationRun",!1);X(this,"runSent",[]);X(this,"lastSentUndrawn",!1);X(this,"awaitingPrefixCommand",!1);X(this,"mismatches",0);X(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 m;if(this.pruneExpired(),i.length===0)return;const s=this.textDecoder.decode(i,{stream:!1});if(!s)return;const r=ub(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(g1(s)){const h=this.field??((m=this.getFieldOption)==null?void 0:m.call(this))??null;this.freeze("escape",{demote:!h||h.modal!==!1});return}const u=this.getTerminal();if(!u){this.reset("terminal unavailable",!0);return}const d=Array.from(s);for(let h=0;h<d.length;h++){const p=d[h],y=p.codePointAt(0);if(y===void 0)continue;if(y===Cw){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(u))return;continue}if(this.stillSuppressed()){this.inFlight.push(p),this.note("refused: waiting for the caret to move");continue}const b=Jp(y);if(b===0){if(!this.skipUnpredictable(p,y,u)){h<d.length-1&&(this.inFlightUnknown=!0);return}continue}if(!this.handlePrintable(p,b,u)){h<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,m;const r=this.field;if(this.getFieldOption){const h=this.getFieldOption();if(!h||h.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(h.layout!==r.layout){this.predictions=[],this.predictedCursor=null,this.field=h,this.note("layout changed");return}}const u=[];for(const h of this.predictions){const p=(d=i.buffer.active.getLine(h.row))==null?void 0:d.getCell(h.col),y=Qi(p?p.getChars():""),b=h.kind==="char"?y===h.char&&(h.width===1||(((m=p==null?void 0:p.getWidth)==null?void 0:m.call(p))??2)===2):y===" ",v=h.kind==="char"?s.row>h.row||s.row===h.row&&s.col>=h.col+h.width:s.row<h.row||s.row===h.row&&s.col<=h.col,S=h.before.includes(y),T=h.kind==="char"&&y===h.char&&!b;if(!(h.echoed&&!b))if(b&&(v||!S)){if(h.echoed||this.confirm(h,r),v){h.kind==="char"&&r&&!h.frozenFrom&&this.learnStyle(r.key,p);continue}h.echoed=!0,u.push(h)}else if(h.frozenFrom){const E=h.frozenFrom;!v&&s.row===E.row&&s.col>=E.col?u.push(h):v&&h.probation&&(this.inFlightUnknown=!0)}else if(!v&&!T)u.push(h);else if(h.probation){this.note("probation guess dropped"),this.predictions.some(E=>!E.frozenFrom&&E.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(E=>E.frozenFrom),this.predictedCursor=null;return}else{this.mismatch(`cell shows ${JSON.stringify(y)} for ${JSON.stringify(h.char)}`);return}}this.predictions=u,u.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,u=typeof s=="object"&&(s==null?void 0:s.demote)===!0;if(this.note(`reset: ${i??"unspecified"}`),u){const m=this.field??((d=this.getFieldOption)==null?void 0:d.call(this))??null;m&&this.confidentKeys.delete(m.key)}if(this.forgetInFlight(),r){this.isSuppressed=!0,this.suppressSentAt=this.now();const m=this.getTerminal();m?this.suppressCursor={row:m.buffer.active.baseY+m.buffer.active.cursorY,col:m.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,T,E,Y,A;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(z=>{const O={row:z.row,col:z.col,char:z.char,width:z.width,kind:z.kind};return s&&(O.style=s),O}),u=i[i.length-1],d=this.predictedCursor??{row:u.row,col:u.kind==="erase"?u.col:u.col+u.width},m=(z,O)=>r.some(B=>B.row===z&&B.col<=O&&O<B.col+B.width),h=this.getTerminal(),p=h==null?void 0:h.buffer.active,y=this.field;if(p&&y&&this.runStartedEmpty&&y.agentLike&&d.row===y.row){const z=p.getLine(d.row);for(let O=d.col;O<y.endCol;O++){if(m(d.row,O)||Qi(((S=z==null?void 0:z.getCell(O))==null?void 0:S.getChars())??"")===" ")continue;const B={row:d.row,col:O,char:" ",width:1,kind:"erase"};s&&(B.style=s),r.push(B)}}if(p){const z={row:p.baseY+p.cursorY,col:p.cursorX};if(!m(z.row,z.col)&&(z.row!==d.row||z.col!==d.col)){const O=((E=(T=p.getLine(z.row))==null?void 0:T.getCell(z.col))==null?void 0:E.getChars())??"",B={row:z.row,col:z.col,char:Qi(O),width:1,kind:"mask"};s&&(B.style=s),r.push(B)}}const b=r.find(z=>z.row===d.row&&z.col===d.col&&z.kind!=="mask"),v=b?b.char:Qi(((A=(Y=p==null?void 0:p.getLine(d.row))==null?void 0:Y.getCell(d.col))==null?void 0:A.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(),u=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=u??{row:y.row,col:y.col},y.shownWhenFrozen=d&&!y.probation);const m=this.predictedCursor?{...this.predictedCursor}:u,h=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=m,this.forgetInFlight(),this.inFlightUnknown=h}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(Aw,Math.max(Mw,(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 u=this.ensureField(r);if(!u||!this.predictedCursor)return this.note("refused: caret is not in an input field"),!1;const d=this.predictedCursor,m=this.predictions.every(S=>S.frozenFrom)&&d.col===u.caretCol;if(u.agentLike&&u.empty&&m&&Tw.includes(i))return this.freeze("agent mode switch"),!1;if(d.col+s>u.endCol-1)return this.freeze("cursor would reach the edge of the field"),!1;const h=(v=r.buffer.active.getLine(d.row))==null?void 0:v.getCell(d.col),p=[Qi(h?h.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 u=this.ensureField(r),d=this.predictedCursor;if(!u||!d)return this.note("refused: caret is not in an input field"),!1;const m=this.assumedWidth(s);return d.col+m>u.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+=m,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,u,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 m=this.ensureField(i),h=this.predictedCursor;if(m&&h){const p=i.buffer.active.getLine(h.row),y=p==null?void 0:p.getCell(h.col-1),b=y&&((r=y.getWidth)==null?void 0:r.call(y))===0?2:1,v=h.col-b;let S=!0;for(let E=h.col;E<m.endCol&&S;E++)S=this.coveredByPrediction(h.row,E)||Qi(((u=p==null?void 0:p.getCell(E))==null?void 0:u.getChars())??"")===" ";const T=Qi(((d=p==null?void 0:p.getCell(v))==null?void 0:d.getChars())??"");if(v>m.startCol&&S&&T!==" ")return this.predictions=this.predictions.filter(E=>!(E.echoed&&E.row===h.row&&E.col+E.width>v)),this.predictions.push({row:h.row,col:v,char:" ",width:b,kind:"erase",before:[T],sentAt:this.now(),probation:this.probationRun||void 0}),this.lastSentUndrawn=!1,h.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():Lw(i);if(!s)return null;let r=s.caretCol,u=[],d=this.inFlightUnknown;if(this.inFlight.length>0&&!this.inFlightUnknown){u=this.inFlight.slice(kw(this.inFlight,Nw(i,s.row,r)));for(const m of u){const h=m.codePointAt(0)??0;r+=Jp(h)||this.assumedWidth(h)}d=u.length>0}return this.inFlight=[],this.inFlightUnknown=!1,this.field=s,this.runStartedEmpty=s.empty&&u.length===0,this.predictions=this.predictions.filter(m=>m.frozenFrom),this.predictedCursor={row:s.row,col:r},this.runInFlight=u,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=gb(s);if(r)for(this.fieldStyles.delete(i),this.fieldStyles.set(i,r);this.fieldStyles.size>eg;){const u=this.fieldStyles.keys().next().value;if(u===void 0)break;this.fieldStyles.delete(u)}}markConfident(i){for(this.confidentKeys.delete(i),this.confidentKeys.add(i);this.confidentKeys.size>eg;){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>Ew&&this.trace.shift()}pruneExpired(){if(this.predictions.length===0)return;const i=this.now(),s=this.predictionTimeout(),r=this.predictions.filter(u=>i-u.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 _w{constructor(i){X(this,"items",[]);X(this,"target",null);X(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=[],u=this.options.isCursorHidden(),d=s.baseY+s.cursorY,m=s.cursorX,h=md(i,d,m),p=u&&!!h&&Mb(h);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??zw(i,b.row,b.col)});break;case"erase":r.push({row:b.row,col:b.col,chars:" ",width:b.width,style:Dw(b.style??md(i,b.row,b.col)??mb)});break;case"mask":p&&b.row===d&&b.col===m&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:b.style??jw(h)});break;case"caret":u?p&&r.push({row:b.row,col:b.col,chars:b.char,width:1,style:h}):y={row:b.row,col:b.col};break}return y===void 0?{cells:r}:{cells:r,cursor:y}}}function md(a,i,s){var r;return s<0||s>=a.cols?null:gb((r=a.buffer.active.getLine(i))==null?void 0:r.getCell(s))}function Mb(a){return(a.fg&sn.INVERSE)!==0||(a.bg&_t.CM_MASK)!==_t.CM_DEFAULT}function jw(a){return{fg:a.fg&~sn.INVERSE,bg:a.bg&~(_t.CM_MASK|_t.RGB_MASK),ext:a.ext}}function Dw(a){return{fg:a.fg&sn.INVERSE?a.fg&(sn.INVERSE|_t.CM_MASK|_t.RGB_MASK):0,bg:a.bg&(_t.CM_MASK|_t.RGB_MASK),ext:0}}function zw(a,i,s){const r=md(a,i,s-1);return r&&!Mb(r)&&!(r.bg&na.DIM)?r:mb}const Co=new Set(["│","┃","║","▐","▕","▏","▌"]),Ro=new Set(["┌","┐","└","┘","╭","╮","╰","╯","├","┤","┬","┴","┼","┏","┓","┗","┛","╔","╗","╚","╝","╠","╣","╟","╢","╞","╡"]),Ow=new Set(["╭","┌","┏","╔"]),Bw=new Set(["╭","┌","┏","╔","├","┣","┠","┝","╟","╠","┞","┟","┡","┢"]),Uw=new Set(["╮","┐","┓","╗"]),Hw=new Set(["╰","└","┗","╚"]),Kw=new Set(["╯","┘","┛","╝"]),ld=new Set(["─","━","═","╌","┄"]),Yw=new Set(["❯","›",">","!"]),tg=new Set(["$","#","%",">","❯","›","➜","λ","»"]),pd=8,Gw=12,ng=2,ig=1,Iw=4,$w=3,lg=/-- INSERT --/,qw=/-- (?:NORMAL|VISUAL(?: LINE| BLOCK)?|REPLACE) --/,Fw=/Esc to cancel|Enter to (?:confirm|select)|to navigate|Space to (?:change|toggle|select)/i,Vw=/^\s*\d+[.)]\s/;function Fa(a){return a===""||a===" "||a===" "}class Xw{constructor(i){X(this,"cell");X(this,"top");X(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,u;return!!((u=(r=this.at(i,s))==null?void 0:r.isDim)!=null&&u.call(r))}text(i,s,r){var u;return i<this.top||i>this.bottom?"":((u=this.screen.getLine(i))==null?void 0:u.translateToString(!0,s,r))??""}isEdge(i,s){if(!Co.has(this.char(i,s)))return!1;const r=this.char(i-1,s),u=this.char(i+1,s);return Co.has(r)||Ro.has(r)||Co.has(u)||Ro.has(u)}blankOrDim(i,s,r){var u;for(let d=s;d<r;d++){const m=this.at(i,d);if(m&&!Fa(m.getChars())&&!((u=m.isDim)!=null&&u.call(m)))return!1}return!0}}function Pw(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 u=a.cols;for(let d=s+1;d<a.cols;d++)if(a.isEdge(i,d)){u=d;break}return r<u?{start:r,end:u}:null}function ag(a,i,s){if(!ld.has(a.char(i,s.start))||!ld.has(a.char(i,s.end-1))||Ro.has(a.char(i,s.start-1)))return!1;const r=s.end-s.start;let u=0;for(let d=s.start;d<s.end;d++)if(ld.has(a.char(i,d)))u++;else if(d-s.start-u>r*.1)return!1;return u>=r*.9}function Pa(a){return`${a.start}-${a.end}`}function Ab(a,i,s){if(s.start===0)return a.top;for(let r=i-1;r>=a.top;r--)if(Bw.has(a.char(r,s.start-1)))return r;return a.top}function Zw(a,i,s){const r=s.start-1,u=s.end,{row:d}=i;if(r<0||u>=a.cols)return null;const m=a.char(d,r);if(!Co.has(m)||a.char(d,u)!==m)return null;let h=d-1;for(;h>=a.top&&a.char(h,r)===m;)h--;let p=d+1;for(;p<=a.bottom&&a.char(p,r)===m;)p++;if(p-h-1>pd||!Ow.has(a.char(h,r))||!Uw.has(a.char(h,u))||!Hw.has(a.char(p,r))||!Kw.has(a.char(p,u))||a.dim(d,r))return null;const y=s.start+ig,b=s.end-ig;return i.col<y||i.col>=b?null:{kind:"frame",key:`frame:${Pa(s)}`,region:Pa(s),layout:`${h}`,row:d,caretCol:i.col,startCol:y,endCol:b,empty:h+2===p&&i.col===y&&a.blankOrDim(d,y,b),agentLike:!0,vimInsert:null,modal:!1}}function Qw(a,i,s){const{row:r}=i;let u=-1;for(let b=r-1;b>=Math.max(a.top,r-pd);b--)if(ag(a,b,s)){u=b;break}if(u<0)return null;let d=-1;for(let b=r+1;b<=Math.min(a.bottom,r+pd);b++)if(ag(a,b,s)){d=b;break}if(d<0)return null;const m=u+1;let h=-1;for(let b=s.start;b<Math.min(s.end,s.start+3);b++){const v=a.char(m,b);if(!Fa(v)){Yw.has(v)&&Fa(a.char(m,b+1))&&(h=b);break}}if(h<0||a.dim(m,h)||Vw.test(a.text(m,h+1,s.end)))return null;for(let b=m+1;b<d;b++)for(let v=s.start;v<s.start+ng;v++)if(!Fa(a.char(b,v)))return null;let p="";for(let b=d+1;b<=Math.min(a.bottom,d+Gw)&&!Ro.has(a.char(b,s.start-1));b++)p+=`${a.text(b,s.start,s.end)}
47
+ `;if(Fw.test(p)||qw.test(p))return null;const y=r===m?h+2:s.start+ng;return i.col<y||i.col>=s.end?null:{kind:"rule",key:`rule:${Pa(s)}:${Ab(a,u,s)}`,region:Pa(s),layout:`${u}`,row:r,caretCol:i.col,startCol:y,endCol:s.end,empty:d-u===2&&i.col===y&&a.blankOrDim(r,y,s.end),agentLike:!0,vimInsert:lg.test(p),modal:lg.test(p)}}function Ww(a,i,s){if(i.hidden)return null;const{row:r,col:u}=i;for(let d=u-2;d>=s.start;d--)if(!(!tg.has(a.char(r,d))||!Fa(a.char(r,d+1))))return a.dim(r,d)?null:sg(a,i,s,r,d+2,d===s.start);for(let d=r-1;d>=Math.max(a.top,r-$w);d--){let m=s.end-1;for(;m>=s.start&&Fa(a.char(d,m));)m--;if(m>=s.end-1-Iw&&tg.has(a.char(d,m)))return a.dim(d,m)?null:sg(a,i,s,d,s.start,!1);if(m<s.end-1)return null}return null}function sg(a,i,s,r,u,d){const m=i.row===r?u:s.start;return i.col<m||i.col>=s.end?null:{kind:"prompt",key:`prompt:${Pa(s)}:${Ab(a,r,s)}`,region:Pa(s),layout:`${r}`,row:i.row,caretCol:i.col,startCol:m,endCol:s.end,empty:i.row===r&&i.col===m&&a.blankOrDim(i.row,m,s.end),agentLike:d,vimInsert:null,modal:!1}}function Jw(a,i){const s=new Xw(a);if(i.row<s.top||i.row>s.bottom||i.col<0||i.col>=a.cols)return null;const r=Pw(s,i.row,i.col);return r?Zw(s,i,r)??Qw(s,i,r)??Ww(s,i,r):null}class eS{constructor(){X(this,"insertSeen",new Set)}detect(i,s){const r=Jw(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 tS{constructor(i){X(this,"tracker",new eS);X(this,"cached");X(this,"lastComplete",null);X(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(),u=this.options.getCursor();this.cached=r&&u?this.tracker.detect(r,u):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 nS=25,iS=2026,lS=1e3;function aS(a,i=()=>performance.now()){let s=!1,r=null;const u=new Set,d=b=>(u.add(b),{dispose:()=>void u.delete(b)}),m=()=>{s=!1,r=null},h=a.parser;if(!h||typeof h.registerCsiHandler!="function")return{isCursorHidden:()=>!1,isSynchronizing:()=>!1,onSyncEnd:d,reset:m,dispose:()=>{}};const p=b=>v=>{for(const S of v.flat())if(S===nS&&(s=!b),S===iS){const T=!b&&r!==null;if(r=b?i():null,T)for(const E of[...u])E()}return!1},y=[h.registerCsiHandler({prefix:"?",final:"h"},p(!0)),h.registerCsiHandler({prefix:"?",final:"l"},p(!1)),h.registerCsiHandler({intermediates:"!",final:"p"},()=>(m(),!1))];return typeof h.registerEscHandler=="function"&&y.push(h.registerEscHandler({final:"c"},()=>(m(),!1))),{isCursorHidden:()=>s,isSynchronizing:()=>r!==null&&i()-r<lS,onSyncEnd:d,reset:m,dispose:()=>{for(const b of y)b.dispose();u.clear()}}}const sS=40;function rS(a){return a?`${a.kind} row ${a.row} cols ${a.startCol}-${a.endCol} caret ${a.caretCol}`:"none"}function oS(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 cS(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>sS}const uS=250,dS=({onTerminalFocus:a,isActive:i=!0})=>{var Tt,En,zl,vi,ji,tr;const s=w.useRef(null),r=w.useRef(null),u=w.useRef(null),d=w.useRef(null),m=w.useRef(1),h=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}),T=w.useRef(null),E=cv(),Y=E||typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window<"u"&&"ontouchstart"in window,A=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="1",[z,O]=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}),[B,te]=w.useState({framesPerSec:0,bytesPerSec:0}),[ue,W]=w.useState(null),G=w.useRef(null),U=w.useRef(!1),ie=w.useRef(!1),se=w.useRef([]);w.useEffect(()=>{if(!A)return;const J=setInterval(()=>{const Se=performance.now()-1e3,he=se.current;for(;he.length>0&&he[0].time<Se;)he.shift();let Ie=0;for(let ae=0;ae<he.length;ae++)Ie+=he[ae].bytes;te({framesPerSec:he.length,bytesPerSec:Ie})},1e3);return()=>clearInterval(J)},[A]);const{isController:pe,connectionState:Ce,settings:Oe,hostPalette:rt,terminalResetVersion:Fe,sendResize:L,sendBinary:I,observeKeyInput:le,consumeModifierLatch:je,agentStatus:Q,addToast:Ze,warnViewerMode:Le,connect:fe,subscribeToOutput:Ge,subscribeToPasteFileReady:Re,uploadImage:F,profiles:Be,activeProfileId:it,t:we,rttMs:Ke}=jt(),gt=mi.useMemo(()=>Ev(rt),[rt]),Ve=w.useRef(gt);Ve.current=gt;const Qe=w.useRef(pe);Qe.current=pe;const lt=w.useRef(I);lt.current=I;const wt=w.useRef(Ze);wt.current=Ze;const Dt=w.useRef(Le);Dt.current=Le;const R=w.useRef(L);R.current=L;const ve=w.useRef(F);ve.current=F;const ye=w.useRef(i);ye.current=i;const We=w.useRef(Oe);We.current=Oe;const bt=w.useRef(we);bt.current=we;const ft=w.useRef(null),St=w.useRef(null),oe=w.useRef(null),Ne=w.useRef(je);Ne.current=je;const De=w.useRef(()=>{}),ot=w.useRef(J=>{var ee,Se,he,Ie;(ee=ft.current)==null||ee.reset(J),(Se=ft.current)==null||Se.forgetConfidence(),(he=oe.current)==null||he.reset(),(Ie=St.current)==null||Ie.clear()}),[Yt,ni]=w.useState(null),Pe=w.useRef(null),[pi,gn]=w.useState(null),zt=w.useRef(null);zt.current=pi;const[Ct,qt]=w.useState(null),at=w.useRef(null);at.current=Ct;const[aa,Dn]=w.useState(""),ii=w.useRef("");ii.current=aa;const[Ni,rn]=w.useState(!1),gi=w.useRef(!1);gi.current=Ni;const Sn=w.useRef(!1),[ki,bi]=w.useState(0),Dl=w.useRef(0),In=w.useRef(null),Cn=w.useRef(null),Tn=w.useRef(null),Li=w.useRef(null),[sa,Ji]=w.useState(!1),li=w.useCallback(J=>{var Ie;const ee=d.current;if(!ee)return null;const Se=((Ie=u.current)==null?void 0:Ie.querySelector(".xterm-screen"))||u.current,he=Qu(J,ee,Se,m.current);return he?yw(ee,he.col,he.bufferRow):null},[]),el=w.useCallback(J=>{var Ie;const ee=d.current;if(!ee)return;const Se=((Ie=u.current)==null?void 0:Ie.querySelector(".xterm-screen"))||u.current,he=Qu(J,ee,Se,m.current);if(he){Tn.current=he;const ae=Ju(ee,he.col,he.bufferRow);Li.current=ae;const Mt=nw(ee,he.col,he.bufferRow);if(Mt){const Bt={startCol:Mt.startCol,endCol:Mt.startCol+Mt.length-1,startRow:he.bufferRow,endRow:he.bufferRow},tn=Zp(Bt,ae),ht=ed(ee,tn);qt(tn),Dn(ht),rn(!0)}else qt(null),Dn(""),rn(!1),Tn.current=null,Li.current=null}else qt(null),Dn(""),rn(!1),Tn.current=null,Li.current=null;In.current=J,Cn.current=null},[]),tl=w.useCallback(J=>{var ht;const ee=d.current,Se=Tn.current;if(!ee||!Se)return;Cn.current=J;const he=((ht=u.current)==null?void 0:ht.querySelector(".xterm-screen"))||u.current,Ie=Qu(J,ee,he,m.current);if(!Ie)return;const ae=Li.current??Ju(ee,Se.col,Se.bufferRow),Mt={startCol:Math.min(Se.col,Ie.col),endCol:Math.max(Se.col,Ie.col),startRow:Math.min(Se.bufferRow,Ie.bufferRow),endRow:Math.max(Se.bufferRow,Ie.bufferRow)},Bt=Zp(Mt,ae),tn=ed(ee,Bt);qt(Bt),Dn(tn),rn(!0)},[]),Ri=w.useRef(el);Ri.current=el;const _i=w.useRef(tl);_i.current=tl;const Mn=w.useCallback(async()=>{const J=ii.current;if(!J)return;await ia(J)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),Gt=w.useCallback(async()=>{var Bt,tn,ht,$n;const J=d.current;if(!J)return;const ee=(Bt=J.buffer)==null?void 0:Bt.active;if(!ee)return;const Se=((tn=at.current)==null?void 0:tn.startRow)??((ht=Tn.current)==null?void 0:ht.bufferRow)??ee.viewportY,he=Li.current??Ju(J,(($n=Tn.current)==null?void 0:$n.col)??0,Se),Ie={startCol:he.startCol,endCol:he.endCol,startRow:Se,endRow:Se},ae=ed(J,Ie);await ia(ae)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),en=w.useCallback(async()=>{const J=d.current;if(!J)return;const ee=iw(J);await ia(ee)==="failed"?wt.current("error",bt.current("clipboard.copyFailed")):wt.current("success",bt.current("clipboard.copied"))},[]),yi=w.useCallback(async()=>{var ee,Se;const J=d.current;if(J){if(!Qe.current){Dt.current();return}try{const he=await ow();if(he.ok){await ve.current(he.blob);return}}catch{}try{const he=await rw();if(he.ok){(ee=ft.current)==null||ee.reset("paste"),(Se=St.current)==null||Se.clear(),J.paste(he.text),wt.current("success",bt.current("clipboard.pasted"));return}else if(he.reason==="empty"){wt.current("info",bt.current("clipboard.pasteUnavailable"));return}}catch{}Ji(!0)}},[]),H=w.useCallback(J=>{var Se,he;const ee=d.current;if(ee){if(!Qe.current){Dt.current();return}(Se=ft.current)==null||Se.reset("paste"),(he=St.current)==null||he.clear(),ee.paste(J),wt.current("success",bt.current("clipboard.pasted"))}},[]),q=w.useCallback(J=>{if(d.current){if(!Qe.current){Dt.current();return}ve.current(J)}},[]);w.useEffect(()=>Re(ee=>{var he,Ie;const Se=d.current;Se&&((he=ft.current)==null||he.reset("paste"),(Ie=St.current)==null||Ie.clear(),Se.paste(ee),wt.current("success",bt.current("clipboard.pasted")))}),[Re]);const de=w.useCallback((J,ee)=>{!Number.isFinite(J)||!Number.isFinite(ee)||J<=0||ee<=0||J===h.current.cols&&ee===h.current.rows||(p.current={cols:J,rows:ee},!y.current&&(y.current=setTimeout(()=>{y.current=null;const Se=p.current;p.current=null,Se&&(Se.cols===h.current.cols&&Se.rows===h.current.rows||(h.current=Se,R.current(Se.cols,Se.rows),ot.current("resize")))},uS)))},[]),Ee=w.useCallback((J=!1)=>{var nl;const ee=d.current,Se=s.current,he=u.current,Ie=r.current;if(!ee||!Se||!he||!Ie)return;const ae=Fu(Se,$a(),Gu());if(ae.width<=0||ae.height<=0)return;Ie.style.width="100%",Ie.style.height="100%",he.style.width="100%",he.style.height="100%",he.style.transform="none",he.style.transformOrigin="top left",m.current=1;const Mt=Xp(ae),Bt=J1({lastSnapshot:T.current,currentSnapshot:Mt});if(Bt.isVisualZoom&&!J){T.current=Mt;try{ee.refresh(0,Math.max(0,ee.rows-1))}catch{}return}if(Bt.shouldIgnore&&!J)return;T.current=Mt;const tn=ta(ee,Xa),ht=Hp({width:ae.width-w1(he),height:ae.height,cellWidth:tn.cellWidth,cellHeight:tn.cellHeight}),$n=Math.abs(ae.width-S.current.width)>1||Math.abs(ae.height-S.current.height)>1;if(ee.cols!==ht.cols||ee.rows!==ht.rows)try{ee.resize(ht.cols,ht.rows)}catch(on){console.debug("Error resizing terminal grid:",on)}U.current&&!ie.current&&($n||ee.cols!==ht.cols||ee.rows!==ht.rows)&&(ie.current=!0,(nl=G.current)==null||nl.verify());const qn=ht.cols!==h.current.cols||ht.rows!==h.current.rows;ye.current&&($n||J||qn)&&(S.current={width:ae.width,height:ae.height},de(ht.cols,ht.rows));try{ee.refresh(0,Math.max(0,ee.rows-1))}catch{}},[de]),Te=w.useRef(Ee);Te.current=Ee;const ze=w.useCallback(()=>{if(b.current===null){if(typeof requestAnimationFrame!="function"){Te.current();return}b.current=requestAnimationFrame(()=>{b.current=null,Te.current()})}},[]),He=w.useCallback((J=30)=>{v.current!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(v.current),v.current=null);let ee=0;const Se=()=>{v.current=null,ee++;const he=ee>=J;Te.current(!0),!he&&ee<2&&typeof requestAnimationFrame=="function"&&(v.current=requestAnimationFrame(Se))};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(Se):Se()},[]);w.useEffect(()=>{var ca,Qa,sl;if(!s.current||!u.current)return;const J=s.current,ee=Fu(J,$a(),Gu()),Se=ta(null,Xa),he=Hp({width:ee.width,height:ee.height,cellWidth:Se.cellWidth,cellHeight:Se.cellHeight});R.current(he.cols,he.rows),S.current={width:ee.width,height:ee.height},T.current=Xp(ee);const Ie=pp(Oe.fontSize,ee.width),ae=new o1.Terminal({fontSize:Ie,fontFamily:Cp(Oe.fontFamily),lineHeight:1.15,...Ve.current?{theme:{...Ve.current}}:{},allowProposedApi:!0,convertEol:!0,scrollback:5e3,cols:he.cols,rows:he.rows,screenReaderMode:!1,linkHandler:{activate:(Z,re)=>{id(re)}}});try{const Z=new c1.Unicode11Addon;ae.loadAddon(Z),ae.unicode.activeVersion="11"}catch(Z){console.debug("Unicode11 addon unavailable, using default width table:",Z)}try{ae.loadAddon(new d1.WebLinksAddon((Z,re)=>{id(re)}))}catch(Z){console.debug("WebLinks addon unavailable, URLs stay plain text:",Z)}ae.open(u.current),d.current=ae;const Mt=ae.onTitleChange(Z=>{ni(hd(Z)||null)}),Bt=aS(ae),tn=new tS({getScreen:()=>{const Z=d.current;if(!Z)return null;const re=Z.buffer.active;return{cols:Z.cols,rows:Z.rows,baseY:re.baseY,getLine:Ue=>re.getLine(Ue),getNullCell:typeof re.getNullCell=="function"?()=>re.getNullCell():void 0}},getCursor:()=>{var re;const Z=(re=d.current)==null?void 0:re.buffer.active;return Z?{row:Z.baseY+Z.cursorY,col:Z.cursorX,hidden:Bt.isCursorHidden()}:null},isSynchronizing:Bt.isSynchronizing});oe.current=tn;const ht=(ca=ae._core)==null?void 0:ca.unicodeService,$n=new Rw({getTerminal:()=>d.current,getField:tn.detect,charWidth:typeof(ht==null?void 0:ht.wcwidth)=="function"?Z=>ht.wcwidth(Z):void 0});ft.current=$n;const qn=new _w({getTerminal:()=>d.current,isCursorHidden:()=>Bt.isCursorHidden()});St.current=qn;const nl=()=>{const Z=ft.current,re=St.current;if(!Z||!re)return;const Ue=We.current.predictiveEcho,At=Z.getEchoSrttMs();if(!rg(Ue,At)){re.clear();return}re.sync(Z.getOverlayItems())};De.current=nl,E&&ae.textarea&&(ae.textarea.readOnly=!1,ae.textarea.tabIndex=0,ae.textarea.inputMode="text");let on=()=>{};if(A&&ae.textarea){const Z=()=>{O(re=>({...re,focused:document.activeElement===ae.textarea}))};ae.textarea.addEventListener("focus",Z),ae.textarea.addEventListener("blur",Z),on=()=>{var re,Ue;(re=ae.textarea)==null||re.removeEventListener("focus",Z),(Ue=ae.textarea)==null||Ue.removeEventListener("blur",Z)},Z()}const il=async Z=>{var Ue,At;(Ue=ft.current)==null||Ue.reset("paste"),(At=St.current)==null||At.clear();const re=Cb(Z);if(re){if(Z.preventDefault(),Z.stopPropagation(),!Qe.current){Dt.current();return}await ve.current(re)}};(Qa=ae.textarea)==null||Qa.addEventListener("paste",il),J.addEventListener("paste",il);const Di=W1(ae,{isSynchronizing:Bt.isSynchronizing,onRendererSwapped:Z=>{var re;J&&(J.dataset.renderer=Z),W(Z),(re=St.current)==null||re.attach(null);try{ae.refresh(0,Math.max(0,ae.rows-1))}catch{}}});qn.attach(Di.canvas);const Za=Bt.onSyncEnd(()=>{var Z,re;return(re=(Z=G.current)==null?void 0:Z.canvas)==null?void 0:re.flushHeld()});G.current=Di,J&&(J.dataset.renderer=Di.kind),W(Di.kind);const ll=bt.current("terminal.bannerTitle"),nr=bt.current("terminal.bannerSubtitle");if(ae.writeln(" ___ ___ .___ "),ae.writeln(` / | \\ ____ _______| _/______ \x1B[1m${ll}\x1B[0m`),ae.writeln(`/ ~ \\/ __ \\\\_ __ \\ __/ ___/ \x1B[2m${nr}\x1B[0m`),ae.writeln("\\ Y / ___/ | | \\/|_ \\___ \\ "),ae.writeln(" \\___|_ / \\___ >|__| /___/____ >"),ae.writeln(" \\/ \\/ \\/ "),ae.writeln(""),U.current=!0,ae.write("",()=>void Di.verify()),!E)try{ae.focus()}catch{}typeof document<"u"&&"fonts"in document&&typeof((sl=document.fonts)==null?void 0:sl.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{}He(5)}}).catch(()=>{});const ir=ae.onData(Z=>{var At,mn,bn;let re=Z;if(Qe.current&&ub(Z)==="keys"&&X0(Z)){const Me=Ne.current();Me&&(re=To(Z,Me))}const Ue=gd(re);if(!Qe.current&&!Mo(Ue)){Dt.current();return}(At=ft.current)==null||At.handleUserInput(Ue),nl(),(bn=(mn=G.current)==null?void 0:mn.canvas)==null||bn.markInput(),lt.current(Ue)}),al=ae.onBinary(Z=>{const re=new Uint8Array(Z.length);for(let Ue=0;Ue<Z.length;Ue++)re[Ue]=Z.charCodeAt(Ue)&255;!Qe.current&&!Mo(re)||lt.current(re)}),zo=typeof ae.onWriteParsed=="function"?ae.onWriteParsed(()=>{var Z;Sn.current=!0,tn.invalidate(),!Bt.isSynchronizing()&&((Z=ft.current)==null||Z.onServerOutput(),nl())}):{dispose:()=>{}},lr=typeof ae.onRender=="function"?ae.onRender(Z=>{const re=ae.buffer.active.viewportY??0;re!==Dl.current&&(Dl.current=re,bi(re));const Ue=at.current;if(Ue&&gi.current){const At=Ue.startRow-re,mn=Ue.endRow-re;Sn.current&&Z.start<=mn&&Z.end>=At&&(rn(!1),Sn.current=!1)}else Sn.current=!1}):{dispose:()=>{}},ar=typeof ae.onScroll=="function"?ae.onScroll(()=>{var re,Ue;const Z=ae.buffer.active.viewportY??0;Dl.current=Z,bi(Z),(re=ft.current)==null||re.reset("scroll"),(Ue=St.current)==null||Ue.clear()}):{dispose:()=>{}},hn=new C1({getTerminal:()=>d.current,getIsController:()=>Qe.current,getScale:()=>m.current,getSurfaceElement:()=>u.current,allowSyntheticMouseFallback:!1,onFocus:()=>{try{ae.focus()}catch{}A&&O(Z=>({...Z,focused:document.activeElement===ae.textarea})),a==null||a()},onGestureStateChange:Z=>{A&&O(re=>({...re,state:Z}))},onGestureScroll:({deltaY:Z,lines:re,viewportY:Ue,scrollTop:At,scrollHeight:mn,clientHeight:bn,moved:Me,bufferType:nn,baseY:kt,cursorY:zn,hasScrollback:Ut,mouseTracking:yn,scrollMode:Fn})=>{A&&O(rl=>({...rl,deltaY:Z,lines:re,viewportY:Ue,scrollTop:At,scrollHeight:mn,clientHeight:bn,moved:Me,focused:document.activeElement===ae.textarea,bufferType:nn,baseY:kt,cursorY:zn,hasScrollback:Ut,mouseTracking:yn,scrollMode:Fn,scrollCalls:rl.scrollCalls+(re!==0?1:0),lastScrollLines:re}))},longPressDelayMs:500,dragThresholdPx:8,scrollLineHeightPx:18,onLongPress:E?(Z=>{var re;return(re=Ri.current)==null?void 0:re.call(Ri,Z)}):void 0,onSelectionExtend:E?(Z=>{var re;return(re=_i.current)==null?void 0:re.call(_i,Z)}):void 0}),Oo=typeof window<"u"&&"PointerEvent"in window,Bo=typeof TouchEvent<"u",xi=[],Qt=(Z,re=!1)=>{const Ue=Z.target;return Ue instanceof Node&&J.contains(Ue)||re&&hn.getState()!=="idle"};if(Oo){const Z={passive:!1,capture:!0},re=Me=>{A&&O(nn=>({...nn,pointerEvents:nn.pointerEvents+1,lastInputEvent:Me}))},Ue=Me=>{if(!Qt(Me))return;if(re("pointerdown"),zt.current){gn(null),zt.current=null,qt(null),at.current=null,Dn(""),ii.current="",rn(!1),In.current=null,Cn.current=null,Me.cancelable&&Me.preventDefault(),Me.stopPropagation();return}hn.handlePointerDown(Me,J)&&Me.stopPropagation()},At=Me=>{Qt(Me,!0)&&(re("pointermove"),hn.handlePointerMove(Me),Me.pointerType!=="mouse"&&Me.stopPropagation())},mn=Me=>{if(!Qt(Me,!0))return;if(re("pointerup"),hn.getState()==="longpress"&&Pe.current){const kt=Cn.current??In.current;if(kt){const zn=Pe.current.getBoundingClientRect(),Ut=kt.clientX-zn.left,yn=kt.clientY-zn.top,Fn=li(kt);gn({x:Ut,y:yn,link:Fn}),zt.current={x:Ut,y:yn,link:Fn}}}hn.handlePointerUp(Me),Me.pointerType!=="mouse"&&Me.stopPropagation()},bn=Me=>{Qt(Me,!0)&&(re("pointercancel"),gn(null),zt.current=null,qt(null),at.current=null,Dn(""),ii.current="",rn(!1),In.current=null,Cn.current=null,hn.handlePointerCancel(Me),Me.pointerType!=="mouse"&&Me.stopPropagation())};if(document.addEventListener("pointerdown",Ue,Z),document.addEventListener("pointermove",At,Z),document.addEventListener("pointerup",mn,Z),document.addEventListener("pointercancel",bn,Z),xi.push(()=>{document.removeEventListener("pointerdown",Ue,Z),document.removeEventListener("pointermove",At,Z),document.removeEventListener("pointerup",mn,Z),document.removeEventListener("pointercancel",bn,Z)}),Bo){const Me=kt=>{Qt(kt,!0)&&(A&&O(zn=>({...zn,touchEvents:zn.touchEvents+1})),kt.cancelable&&kt.preventDefault(),kt.stopPropagation())},nn=["touchstart","touchmove","touchend","touchcancel"];for(const kt of nn)document.addEventListener(kt,Me,Z);xi.push(()=>{for(const kt of nn)document.removeEventListener(kt,Me,Z)})}}else{const Z={passive:!1,capture:!0},re=Me=>{A&&O(nn=>({...nn,touchEvents:nn.touchEvents+1,lastInputEvent:Me}))},Ue=Me=>{if(Qt(Me)){if(re("touchstart"),zt.current){gn(null),zt.current=null,qt(null),at.current=null,Dn(""),ii.current="",rn(!1),In.current=null,Cn.current=null,Me.cancelable&&Me.preventDefault(),Me.stopPropagation();return}Me.touches.length===1&&Me.stopPropagation(),hn.handleTouchStart(Me,J)}},At=Me=>{Qt(Me,!0)&&(re("touchmove"),Me.touches.length===1&&Me.stopPropagation(),hn.handleTouchMove(Me))},mn=Me=>{if(!Qt(Me,!0))return;if(re("touchend"),hn.getState()==="longpress"&&Pe.current){const kt=Cn.current??In.current;if(kt){const zn=Pe.current.getBoundingClientRect(),Ut=kt.clientX-zn.left,yn=kt.clientY-zn.top,Fn=li(kt);gn({x:Ut,y:yn,link:Fn}),zt.current={x:Ut,y:yn,link:Fn}}}Me.stopPropagation(),hn.handleTouchEnd(Me)},bn=Me=>{Qt(Me,!0)&&(re("touchcancel"),gn(null),zt.current=null,qt(null),at.current=null,Dn(""),ii.current="",rn(!1),In.current=null,Cn.current=null,Me.stopPropagation(),hn.handleTouchCancel())};document.addEventListener("touchstart",Ue,Z),document.addEventListener("touchmove",At,Z),document.addEventListener("touchend",mn,Z),document.addEventListener("touchcancel",bn,Z),xi.push(()=>{document.removeEventListener("touchstart",Ue,Z),document.removeEventListener("touchmove",At,Z),document.removeEventListener("touchend",mn,Z),document.removeEventListener("touchcancel",bn,Z)})}const ra=Z=>{Z.preventDefault()};J.addEventListener("contextmenu",ra),xi.push(()=>{J.removeEventListener("contextmenu",ra)});const oa=new ResizeObserver(()=>{ze()});oa.observe(J);const ai=()=>{ze()},si=()=>{var Z,re;if(document.visibilityState==="visible"){He(10);try{(re=d.current)==null||re.refresh(0,Math.max(0,(((Z=d.current)==null?void 0:Z.rows)||1)-1))}catch{}}};window.addEventListener("resize",ai),window.addEventListener("orientationchange",ai),document.addEventListener("visibilitychange",si),window.addEventListener("pageshow",si);const Ol=()=>{ze()};return typeof window<"u"&&window.visualViewport&&(window.visualViewport.addEventListener("resize",Ol),window.visualViewport.addEventListener("scroll",Ol)),()=>{var Z,re;ir.dispose(),al.dispose(),lr.dispose(),ar.dispose(),zo.dispose(),Mt.dispose(),Za.dispose(),(Z=St.current)==null||Z.dispose(),St.current=null,ft.current=null,oe.current=null,De.current=()=>{},Bt.dispose(),hn.handlePointerCancel();for(const Ue of xi)Ue();oa.disconnect(),window.removeEventListener("resize",ai),window.removeEventListener("orientationchange",ai),document.removeEventListener("visibilitychange",si),window.removeEventListener("pageshow",si),typeof window<"u"&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",Ol),window.visualViewport.removeEventListener("scroll",Ol)),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),on(),(re=ae.textarea)==null||re.removeEventListener("paste",il),J.removeEventListener("paste",il),Di.dispose(),G.current=null,ae.dispose(),d.current=null}},[]);const Ft=mi.useMemo(()=>{var J;return((J=Be.find(ee=>ee.id===it))==null?void 0:J.displayName)??null},[Be,it]);w.useEffect(()=>{Ce!=="connected"&&ni(null)},[Ce]),w.useEffect(()=>{const J=i&&Ce==="connected",ee=Oe.agentAlertBadge?Ws(Q):null;fw(J?Yt:null,Ft,ee)},[i,Ce,Yt,Ft,Q,Oe.agentAlertBadge]),w.useEffect(()=>{const J=d.current;if(!J)return;const ee=Fu(s.current,$a(),Gu());J.options.fontSize=pp(Oe.fontSize,ee.width),J.options.fontFamily=Cp(Oe.fontFamily);try{J.refresh(0,Math.max(0,J.rows-1))}catch{}He(10)},[Oe.fontSize,Oe.fontFamily]),w.useEffect(()=>le(J=>{var ee,Se,he;(ee=ft.current)==null||ee.handleUserInput(J),De.current(),(he=(Se=G.current)==null?void 0:Se.canvas)==null||he.markInput()}),[le]),w.useEffect(()=>{const J=ft.current,ee=St.current;if(!J||!ee)return;const Se=J.getEchoSrttMs();rg(Oe.predictiveEcho,Se)?ee.sync(J.getOverlayItems()):ee.clear()},[Oe.predictiveEcho]);const Nt=w.useRef(Fe);w.useEffect(()=>{var ee;if(Nt.current===Fe)return;Nt.current=Fe,ot.current("resetVersion");const J=d.current;if(J)try{(ee=J.reset)==null||ee.call(J),J.clear(),J.refresh(0,Math.max(0,J.rows-1))}catch{}},[Fe]),w.useEffect(()=>{ot.current("connectionState")},[Ce]),w.useEffect(()=>{const J=d.current;if(!(!J||!gt)){J.options.theme={...gt};try{J.refresh(0,Math.max(0,J.rows-1))}catch{}}},[gt]),w.useEffect(()=>Ge(ee=>{const Se=d.current;if(!Se)throw new Error("terminal not ready");if(Se.write(ee),A){const he=performance.now(),Ie=se.current;Ie.push({time:he,bytes:ee.byteLength});const ae=he-1e3;for(;Ie.length>0&&Ie[0].time<ae;)Ie.shift()}}),[Ge,A]),w.useEffect(()=>{if(!i)return;He(10);const J=d.current;if(J){try{J.refresh(0,Math.max(0,J.rows-1))}catch{}if(!E)try{J.focus()}catch{}}},[i,E,He]),w.useEffect(()=>{Ce==="disconnected"&&fe()},[]);const An=J=>{J.preventDefault()};return f.jsxs("main",{ref:Pe,className:"flex-1 w-full min-w-0 min-h-0 overflow-hidden relative flex flex-col",onContextMenu:An,"aria-label":we("terminal.windowAriaLabel"),children:[f.jsx("div",{id:"terminal-container",ref:s,className:"absolute inset-0 overflow-hidden cursor-text",style:{touchAction:Y?"none":"auto"},tabIndex:0,onContextMenu:An,"aria-label":we("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:u,className:"absolute top-0 left-0",style:{transformOrigin:"top left",width:"100%",height:"100%"}})})}),A&&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: ${z.state}
52
+ `,`deltaY: ${z.deltaY} lines: ${z.lines}
53
+ `,`viewportY: ${z.viewportY??"-"} focus: ${z.focused}
54
+ `,`buffer: ${z.bufferType??"-"} base: ${z.baseY??"-"} cursor: ${z.cursorY??"-"} scrollback: ${z.hasScrollback??"-"}
55
+ `,`scroll: ${z.scrollTop??"-"} / ${z.scrollHeight??"-"} (h ${z.clientHeight??"-"}) moved: ${z.moved}
56
+ `,`mode: ${z.scrollMode} calls: ${z.scrollCalls} lines: ${z.lastScrollLines??"-"} mouse: ${z.mouseTracking}
57
+ `,`event: ${z.lastInputEvent||"-"} pointer: ${z.pointerEvents} touch: ${z.touchEvents}
58
+ `,`rtt: ${Ke!==null?`${Ke}ms`:"-"} frames/s: ${B.framesPerSec} bytes/s: ${B.bytesPerSec} renderer: ${ue??"-"}
59
+ `,`prediction: ${((Tt=ft.current)==null?void 0:Tt.getState())??"-"} mode: ${Oe.predictiveEcho} pending: ${((En=ft.current)==null?void 0:En.getVisiblePredictions().length)??0} srtt: ${((zl=ft.current)==null?void 0:zl.getEchoSrttMs())!==null&&((vi=ft.current)==null?void 0:vi.getEchoSrttMs())!==void 0?`${Math.round(ft.current.getEchoSrttMs())}ms`:"-"}
60
+ `,`field: ${rS(((ji=oe.current)==null?void 0:ji.detect())??null)} mismatches: ${((tr=ft.current)==null?void 0:tr.getMismatchCount())??0}
61
+ `,oS(G.current),cS(ft.current)]}),E&&Ct&&Ni&&(()=>{var qn;const J=d.current;if(!J||!Pe.current)return null;const ee=ta(J);if(ee.cellWidth<=0||ee.cellHeight<=0)return null;const Se=((qn=u.current)==null?void 0:qn.querySelector(".xterm-screen"))||u.current;if(!Se)return null;const he=Se.getBoundingClientRect(),Ie=Pe.current.getBoundingClientRect(),ae=Ct.startRow-ki;if(Ct.endRow-ki<0||ae>=J.rows)return null;const Bt=he.top-Ie.top+ae*ee.cellHeight,tn=he.left-Ie.left+Ct.startCol*ee.cellWidth,ht=(Ct.endCol-Ct.startCol+1)*ee.cellWidth,$n=(Ct.endRow-Ct.startRow+1)*ee.cellHeight;return f.jsx("div",{"data-testid":"terminal-selection-overlay",className:"pointer-events-none absolute z-20 bg-tui-accent/35",style:{top:`${Bt}px`,left:`${tn}px`,width:`${ht}px`,height:`${$n}px`}})})(),E&&pi&&f.jsx(xw,{anchorPoint:pi,hasSelection:!!aa,isController:pe,vibrateOnKeyPress:Oe.vibrateOnKeyPress,linkUrl:pi.link??null,onOpenLink:J=>{id(J)||Ze("warning",we("clipboard.openLinkFailed"))},onCopySelection:Mn,onCopyLine:Gt,onCopyScreen:en,onPaste:yi,onClose:()=>{gn(null),zt.current=null,qt(null),at.current=null,Dn(""),ii.current="",rn(!1)}}),E&&f.jsx(ww,{isOpen:sa,onClose:()=>Ji(!1),onSend:H,onSendImage:q})]})},fS=({onPairedSuccess:a})=>{const{settings:i,updateSettings:s,connect:r,connectionState:u,stateDetail:d,addToast:m,t:h}=jt(),[p,y]=w.useState(""),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,Y]=w.useState(i.wsUrl||"/ws/client"),[A,z]=w.useState(i.token||""),[O,B]=w.useState(i.clientId||""),te="node bin/service.js pair",ue="node bin/config-tui.js",W="herdr plugin pane open --plugin herdr.remote.web --entrypoint config --placement zoomed --focus",G=pe=>{ia(pe).then(Ce=>{if(Ce==="failed"){m("error",h("clipboard.copyFailed"));return}v(pe),m("success",h("toasts.commandCopied")),setTimeout(()=>v(null),2e3)})},U=pe=>{pe.preventDefault();const Ce=p.trim().toUpperCase();if(!Ce&&!A.trim()){m("warning",h("toasts.connectionError"));return}const Oe={pairCode:Ce,wsUrl:E.trim()||"/ws/client",clientId:O.trim()||i.clientId};A.trim()&&(Oe.token=A.trim()),s(Oe),r({pairCode:Ce||void 0,token:A.trim()||void 0,wsUrl:E.trim()||"/ws/client",clientId:O.trim()||i.clientId}),a&&a()},ie=u==="connecting"||u==="reconnecting",se=({n:pe})=>f.jsxs("span",{"aria-hidden":"true",className:"shrink-0 font-bold text-tui-accent",children:["[",pe,"]"]});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:h("onboarding.title")}),f.jsx("span",{className:"text-tui uppercase text-tui-warn",children:h("onboarding.firstTimeSetup")})]}),f.jsx("p",{className:"mt-0.5 text-tui leading-snug text-tui-muted",children:h("onboarding.description")})]}),u==="error"&&f.jsxs(So,{tone:"warn",action:f.jsx(_e,{variant:"warn",onClick:()=>r(),children:h("common.retry")}),children:[f.jsx("span",{className:"block font-bold",children:h("onboarding.authRequired")}),f.jsx("span",{className:"block text-tui-muted",children:d||h("onboarding.authRequiredDesc")})]}),f.jsxs("form",{onSubmit:U,className:"grid gap-3",children:[f.jsx(pn,{title:h("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(se,{n:1}),f.jsx("span",{className:"leading-snug",children:h("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:te}),f.jsx(_e,{onClick:()=>G(te),glyph:b===te?qe.check:"⧉",className:ne("shrink-0",b===te&&"border-tui-ok text-tui-ok"),children:h(b===te?"common.copied":"common.copy")})]}),f.jsxs("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:h("onboarding.step1CopyPlugin")}),f.jsx("button",{type:"button",onClick:()=>G(W),className:"tui-focusable shrink-0 text-tui-accent underline-offset-2 hover:underline",children:h(b===W?"common.copied":"onboarding.step1CopyCli")})]}),f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("span",{className:"truncate text-tui-faint",children:h("onboarding.step1TuiNote")}),f.jsx("code",{onClick:()=>G(ue),className:"shrink-0 cursor-pointer border border-tui-border-dim px-1 text-tui-muted hover:border-tui-accent hover:text-tui-accent",title:h("common.clickToCopy"),children:ue})]})]})]})}),f.jsx(pn,{title:h("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(se,{n:2}),f.jsx(wn,{type:"text",value:p,onChange:pe=>y(pe.target.value.toUpperCase()),placeholder:h("onboarding.step2Placeholder"),maxLength:12,autoFocus:!0,"aria-label":h("onboarding.step2Title"),className:"font-bold uppercase"})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:h("onboarding.step2Note")})]})}),f.jsx(_e,{variant:"primary",type:"submit",block:!0,disabled:ie,className:"py-1.5",children:ie?f.jsx(Va,{label:h("onboarding.connectingAndPairing")}):h("onboarding.connectAndPair")}),f.jsxs("div",{className:"border border-tui-border bg-tui-base",children:[f.jsxs("button",{type:"button",onClick:()=>T(!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?qe.chevronDown:qe.chevronRight}),f.jsx("span",{className:"uppercase",children:h("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(xn,{htmlFor:"onboarding-token",children:h("onboarding.manualTokenLabel")}),f.jsx(wn,{id:"onboarding-token",type:"password",value:A,onChange:pe=>z(pe.target.value),placeholder:h("onboarding.manualTokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"onboarding-ws",children:h("onboarding.wsEndpointLabel")}),f.jsx(wn,{id:"onboarding-ws",type:"text",value:E,onChange:pe=>Y(pe.target.value),placeholder:h("onboarding.wsEndpointPlaceholder")})]}),f.jsx(fi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"onboarding-client-id",children:h("onboarding.clientIdLabel")}),f.jsx(wn,{id:"onboarding-client-id",type:"text",value:O,onChange:pe=>B(pe.target.value)})]})]})]})]})]})})},_l="tui-focusable inline-flex shrink-0 select-none items-center justify-center border text-tui font-medium transition-colors",Fs="border-tui-border bg-tui-surface text-tui-text hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",hS="border-tui-accent bg-tui-accent text-tui-crust font-bold",mS="border-tui-ok bg-transparent text-tui-ok hover:bg-tui-ok hover:text-tui-crust font-bold",og={default:Fs,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"},pS=({compact:a=!1,onCustomize:i})=>{const{sendKey:s,settings:r,updateSettings:u,isController:d,warnViewerMode:m,t:h,uploadProgress:p,uploadImage:y,modifierLatch:b,toggleModifierLatch:v,consumeModifierLatch:S,agentProfile:T}=jt(),E="h-9 min-w-[2.25rem] px-2",Y="h-9 w-9",A="h-9 px-2",z=w.useRef(null),O=w.useRef(null),B=w.useCallback(()=>{if(r.vibrateOnKeyPress&&typeof navigator<"u"&&navigator.vibrate)try{navigator.vibrate(8)}catch{}},[r.vibrateOnKeyPress]),te=w.useCallback(()=>{var F;if(B(),!d){m();return}p.active||(F=z.current)==null||F.click()},[B,d,m,p.active]),ue=w.useCallback(F=>{const Be=F.target.files,it=Be&&Be[0];F.target.value="",it&&y(it)},[y]),W=()=>f.jsxs(f.Fragment,{children:[f.jsx("input",{ref:z,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",className:"hidden","data-testid":"key-toolbar-file-input",onChange:ue}),f.jsx("input",{ref:O,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/*",capture:"environment",className:"hidden","data-testid":"key-toolbar-camera-input",onChange:ue})]}),G=(F=!1)=>p.active?f.jsx("div",{"data-testid":F?"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(i1,{ratio:p.ratio,label:p.statusText,tone:p.phase==="completed"?"ok":p.phase==="error"?"bad":"accent","aria-label":p.statusText})}):null,U=()=>{const F=p.active;return f.jsx("button",{type:"button","data-testid":"image-upload-btn",onClick:te,disabled:F,className:ne(_l,E,F?"border-tui-border-dim bg-tui-surface opacity-60 cursor-not-allowed":Fs),title:F?p.statusText:h("virtualKeyboard.uploadImageTitle"),"aria-label":h("virtualKeyboard.uploadImage"),children:f.jsx("span",{className:"font-medium",children:F?`${p.percent}%`:h("virtualKeyboard.image")})})},[ie,se]=w.useState(!1),[pe,Ce]=w.useState(!1),[Oe,rt]=w.useState(!1),Fe=w.useRef([]);w.useEffect(()=>()=>{Fe.current.forEach(F=>clearTimeout(F)),Fe.current=[]},[]);const L=w.useCallback(F=>{if(B(),!d){m();return}let Be;try{Be=Ei(F)}catch{return}if(S(),Be.length===1){s(Be[0]);return}Be.forEach((it,we)=>{const Ke=setTimeout(()=>{Fe.current=Fe.current.filter(gt=>gt!==Ke),s(it)},we*120);Fe.current.push(Ke)})},[S,d,s,B,m]),I=Ov(T,r.agentKeymaps[T]),le=F=>{let Be="";try{Be=qs(F.combo)}catch{}const it=F.custom?F.customLabel||"":h(`agentActions.${F.labelKey}`),we=F.labelKey==="interrupt"&&F.combo.trim().toLowerCase()==="ctrl+c"?"bad":F.combo.trim().toLowerCase()==="ctrl+z"?"warn":"default";return f.jsxs("button",{type:"button","data-testid":`agent-key-${F.id}`,onClick:()=>L(F.combo),className:ne(_l,"h-8 max-w-[10rem] gap-1 px-1.5",og[we]),title:`${Be} ${it}`.trim(),"aria-label":`${Be} ${it}`.trim(),children:[f.jsx("span",{className:"font-bold",children:Be}),f.jsx("span",{className:"max-w-[5rem] truncate text-tui-sm opacity-70",children:it})]},F.id)},je=()=>{const F=[...I.agentActions,...I.genericActions];return F.length===0&&!i?null:f.jsxs("div",{"data-testid":"agent-key-actions",role:"group","aria-label":`${Ia[T].name} ${h("agentKeymaps.agentGroup")}`,className:"flex shrink-0 items-center gap-1",children:[f.jsx("span",{"aria-hidden":"true",className:"mx-1 h-6 w-px shrink-0 bg-tui-border-dim"}),F.map(le),i&&f.jsx("button",{type:"button","data-testid":"agent-key-customize",onClick:i,className:ne(_l,"h-8 px-1.5 text-tui-sm border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-accent hover:text-tui-accent"),title:h("agentKeymaps.customizeBar"),"aria-label":h("agentKeymaps.customizeBar"),children:h("agentKeymaps.customizeBarShort")})]})},Q=w.useCallback((F,Be=!0)=>{if(B(),!d){m();return}const it=S();s(Be&&it?To(F,it):F)},[d,s,m,B,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:[W(),G(!0),f.jsx("div",{className:"flex items-center justify-center px-2 py-0.5",children:f.jsxs("button",{type:"button",onClick:()=>u({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:h("virtualKeyboard.expandToolbar"),"aria-label":h("virtualKeyboard.expandToolbar"),"aria-expanded":!1,children:[f.jsx("span",{"aria-hidden":"true",children:"▴"}),f.jsx("span",{"aria-hidden":"true",children:h("common.keyBar")})]})})]});const Ze=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys.filter(F=>F.enabled):Ag,Le=F=>F.id==="left"?f.jsx("span",{"aria-hidden":"true",children:"←"}):F.id==="up"?f.jsx("span",{"aria-hidden":"true",children:"↑"}):F.id==="down"?f.jsx("span",{"aria-hidden":"true",children:"↓"}):F.id==="right"?f.jsx("span",{"aria-hidden":"true",children:"→"}):F.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:h("virtualKeyboard.keyEnter")})]}):F.id==="drawer_chords"?f.jsx("span",{children:"^C"}):F.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:ie?"▾":"▴"})]}):f.jsx("span",{children:F.label}),fe=F=>{if(B(),F.type==="modifier"){F.modifierType==="ctrl"||F.modifierType==="alt"||F.modifierType==="shift"?v(F.modifierType):F.modifierType==="meta"&&Q(ce.ESC);return}if(F.type==="drawer"){F.drawerType==="fn"?(se(!ie),Ce(!1),rt(!1)):F.drawerType==="chords"?(rt(!Oe),se(!1),Ce(!1)):F.drawerType==="symbols"&&(Ce(!pe),se(!1),rt(!1));return}Q(F.code,F.type!=="chord")},Ge=F=>{if(F.type==="modifier"){if(F.modifierType==="ctrl")return b.ctrl;if(F.modifierType==="alt")return b.alt;if(F.modifierType==="shift")return b.shift}if(F.type==="drawer"){if(F.drawerType==="fn")return ie;if(F.drawerType==="chords")return Oe;if(F.drawerType==="symbols")return pe}return!1},Re=(F,Be,it,we,Ke="default")=>f.jsxs("button",{type:"button",onClick:()=>Q(F,!1),className:ne(_l,"h-8 gap-1.5 px-2",og[Ke]),title:it,children:[f.jsx("span",{className:"font-bold",children:Be}),f.jsx("span",{className:"text-tui-sm opacity-70",children:we})]});return f.jsxs("div",{"data-testid":"key-toolbar",className:ne("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":h("virtualKeyboard.touchKeyboardShortcuts"),children:[W(),G(!1),ie&&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(F=>{const Be=`F${F}`;return f.jsxs("button",{type:"button",onClick:()=>Q(ce[Be]),className:ne(_l,Fs,"h-8"),children:["F",F]},Be)})}),Oe&&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:[Re(ce.CTRL_C,"^C",h("virtualKeyboard.ctrlCTitle"),h("virtualKeyboard.badgeSigint"),"bad"),Re(ce.CTRL_D,"^D",h("virtualKeyboard.ctrlDTitle"),h("virtualKeyboard.badgeEof")),Re(ce.CTRL_Z,"^Z",h("virtualKeyboard.ctrlZTitle"),h("virtualKeyboard.badgeTstp"),"warn"),Re(ce.CTRL_L,"^L",h("virtualKeyboard.ctrlLTitle"),h("virtualKeyboard.badgeClear")),Re(ce.CTRL_R,"^R",h("virtualKeyboard.ctrlRTitle"),h("virtualKeyboard.badgeSearch")),Re(ce.CTRL_A,"^A",h("virtualKeyboard.ctrlATitle"),h("virtualKeyboard.badgeStart")),Re(ce.CTRL_E,"^E",h("virtualKeyboard.ctrlETitle"),h("virtualKeyboard.badgeEnd")),Re(ce.CTRL_K,"^K",h("virtualKeyboard.ctrlKTitle"),h("virtualKeyboard.badgeKill"))]}),pe&&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(F=>f.jsx("button",{type:"button",onClick:()=>Q(F,!0),className:ne(_l,Fs,"h-8 w-8 font-bold"),children:F},F))}),f.jsxs("div",{"data-testid":"key-toolbar-row",className:ne("scrollbar-none flex flex-nowrap touch-pan-x items-center justify-start gap-1 overflow-x-auto overscroll-x-contain",a?"px-1.5 py-1":"px-2 py-1.5"),children:[f.jsx("button",{type:"button",onClick:()=>u({toolbarVisible:!1}),className:ne(_l,Y,"mr-1 border-tui-border-dim bg-transparent text-tui-faint hover:border-tui-border hover:text-tui-text"),title:h("virtualKeyboard.collapseToolbar"),"aria-label":h("virtualKeyboard.collapseToolbar"),"aria-expanded":!0,children:f.jsx("span",{"aria-hidden":"true",children:"▾"})}),Ze.map(F=>{const Be=Ge(F),it=F.id==="enter",we=["left","up","down","right"].includes(F.id),Ke=F.type==="drawer",gt=ad(F,h),Ve=f.jsx("button",{type:"button",onClick:()=>fe(F),className:ne(_l,we?Y:Ke?A:E,it?mS:Be?hS:Fs),title:gt,"aria-label":gt,"aria-pressed":Be,children:Le(F)},F.id);return it?f.jsxs(mi.Fragment,{children:[je(),U(),Ve]},"enter-with-image"):Ve}),!Ze.some(F=>F.id==="enter")&&f.jsxs(f.Fragment,{children:[je(),U()]})]})]})},gS=["ls -la","clear","git status","pwd","top","exit","cat"],bS=({isOpen:a,onClose:i})=>{const{sendKey:s,isController:r,warnViewerMode:u,t:d}=jt(),[m,h]=w.useState("");if(!a)return null;const p=b=>{if(b&&b.preventDefault(),!r){u();return}m.length>0?(s(m+"\r"),h("")):s("\r")},y=b=>{if(!r){u();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(_e,{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:gS.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(wn,{id:"virtual-keyboard-input",name:"terminal-input",type:"text",value:m,onChange:b=>h(b.target.value),placeholder:d("virtualKeyboard.placeholder"),inputMode:"text",enterKeyHint:"send",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,className:"select-text pr-7"}),m.length>0&&f.jsx("button",{type:"button",onClick:()=>h(""),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:qe.cross})})]}),f.jsx(_e,{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 Do(a,i){const s=(r,u)=>i?i(r):u;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 yS={connected:"ok",connecting:"warn",reconnecting:"warn",error:"bad",disconnected:"idle"},vS=({isOpen:a,onClose:i,isAddMode:s=!1})=>{const{settings:r,updateSettings:u,connect:d,disconnect:m,connectionState:h,hostId:p,addToast:y,t:b,activeProfile:v,activeProfileId:S,addProfileAndConnect:T,renameProfile:E}=jt(),[Y,A]=w.useState(r.wsUrl),[z,O]=w.useState(r.token),[B,te]=w.useState(r.pairCode),[ue,W]=w.useState(r.clientId),[G,U]=w.useState((v==null?void 0:v.displayName)||""),[ie,se]=w.useState(r.autoReconnect),[pe,Ce]=w.useState(!1);if(w.useEffect(()=>{a&&(A(r.wsUrl),O(s?"":r.token),te(s?"":r.pairCode),W(r.clientId),U(s?"":(v==null?void 0:v.displayName)||""),se(r.autoReconnect))},[a,s,r,v]),!a)return null;const Oe=I=>{I.preventDefault();const le={wsUrl:Y.trim()||"/ws/client",token:z.trim(),pairCode:B.trim().toUpperCase(),clientId:ue.trim()||r.clientId,autoReconnect:ie};if(!le.token&&!le.pairCode){y("warning",b("pairing.credentialsRequired"));return}s?T({...le,displayName:G.trim()||void 0}):(u(le),S&&G.trim()&&E(S,G),m(),d({wsUrl:le.wsUrl,token:le.token||void 0,pairCode:le.pairCode||void 0,clientId:le.clientId,autoReconnect:ie})),i()},rt=()=>{const I=`client-${Math.random().toString(36).substring(2,8)}`;W(I)},Fe=()=>{const I=new URL(window.location.href);I.search="",B.trim()&&I.searchParams.set("pairCode",B.trim().toUpperCase()),ia(I.toString()).then(le=>{if(le==="failed"){y("error",b("clipboard.copyFailed"));return}Ce(!0),y("success",b("toasts.pairingLinkCopied")),setTimeout(()=>Ce(!1),2e3)})},L=yS[h]??"idle";return f.jsxs(Ad,{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:[h==="connected"&&f.jsx(_e,{variant:"danger",onClick:()=>{m(),i()},children:b("common.disconnect")}),f.jsx(_e,{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(jn,{level:L}),f.jsx("span",{className:"text-tui-muted",children:b("common.status")}),f.jsx("span",{className:ne(L==="ok"?"text-tui-ok":L==="bad"?"text-tui-bad":L==="warn"?"text-tui-warn":"text-tui-faint"),children:Do(h,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:Oe,className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"pairing-name",children:b("pairing.displayNameLabel")}),f.jsx(wn,{id:"pairing-name",type:"text",value:G,onChange:I=>U(I.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(xn,{htmlFor:"pairing-code",hint:b("pairing.pairCodeNote"),children:b("pairing.pairCodeLabel")}),f.jsx(wn,{id:"pairing-code",type:"text",value:B,onChange:I=>te(I.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(xn,{htmlFor:"pairing-token",hint:b("pairing.tokenNote"),children:b("pairing.tokenLabel")}),f.jsx(wn,{id:"pairing-token",type:"password",value:z,onChange:I=>O(I.target.value),placeholder:b("pairing.tokenPlaceholder")})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"pairing-ws",children:b("pairing.wsUrlLabel")}),f.jsx(wn,{id:"pairing-ws",type:"text",value:Y,onChange:I=>A(I.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(xn,{htmlFor:"pairing-client-id",children:b("pairing.clientIdLabel")}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(wn,{id:"pairing-client-id",type:"text",value:ue,onChange:I=>W(I.target.value),className:"flex-1"}),f.jsx(_e,{onClick:rt,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(Jl,{checked:ie,onChange:se,label:b("pairing.autoReconnectLabel"),description:b("pairing.autoReconnectDesc")})}),f.jsx("div",{className:"border-t border-tui-border-dim pt-2",children:f.jsx(_e,{onClick:Fe,block:!0,glyph:pe?qe.check:"⧉",className:ne(pe&&"border-tui-ok text-tui-ok"),children:b("pairing.copyDirectLink")})})]})]})},xS=["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(" "),wS=({isOpen:a,onClose:i,initialTab:s})=>{const{settings:r,updateSettings:u,addToast:d,language:m,setLanguage:h,t:p,agentProfile:y}=jt(),[b,v]=w.useState("appearance"),[S,T]=w.useState(null),[E,Y]=w.useState({}),A=w.useRef({}),[z,O]=w.useState(""),[B,te]=w.useState(""),[ue,W]=w.useState(!1);if(w.useEffect(()=>{!a||!s||(v(s),T(null))},[a,s]),!a)return null;const G=cd.find(R=>R.font===r.fontFamily),U=r.virtualKeys&&r.virtualKeys.length>0?r.virtualKeys:Zs(),ie=S||y,se=r.agentKeymaps[ie]||{},pe=Bg(ie,se),Ce=Ug(ie,se),Oe=Ce.filter(R=>!R.hidden).length,rt=R=>R.custom?R.customLabel||"":p(`agentActions.${R.labelKey}`),Fe=R=>{try{return qs(R.combo)}catch{return R.combo}},L=R=>{u({agentKeymaps:{...r.agentKeymaps,[ie]:R}})},I=(R,ve)=>{var ye;L({...se,actions:{...se.actions,[R]:{...(ye=se.actions)==null?void 0:ye[R],...ve}}})},le=R=>{I(R.id,{keys:R.defaultCombo})},je=(R,ve)=>{const ye=R+(ve==="up"?-1:1);if(ye<0||ye>=pe.length)return;const We=pe.map(bt=>bt.id);[We[R],We[ye]]=[We[ye],We[R]],L({...se,order:We})},Q=R=>{var ve;L({...se,custom:(se.custom||[]).filter(ye=>ye.id!==R),order:(ve=se.order)==null?void 0:ve.filter(ye=>ye!==R)})},Ze=()=>L(Bv(se)),Le=()=>{const R={...r.agentKeymaps};delete R[ie],u({agentKeymaps:R})},fe=()=>{const R=z.trim();if(!R)return;try{Ei(B)}catch{return}const ve=`custom-${Date.now().toString(36)}`;L({...se,custom:[...se.custom||[],{id:ve,label:R,keys:B.trim()}],order:[...pe.map(ye=>ye.id),ve]}),O(""),te("")},Ge=R=>R instanceof Ai?p(`agentKeymaps.errors.${R.code}`,R.params):String(R),Re=(R,ve)=>`${R}:${ve}`,F=(R,ve)=>{const ye=Re(ie,R);A.current={...A.current,[ye]:ve},Y(A.current);try{Ei(ve),I(R,{keys:ve})}catch{}},Be=R=>{const ve=Re(ie,R),ye=A.current[ve];if(ye!==void 0){delete A.current[ve],Y({...A.current});try{Ei(ye),I(R,{keys:ye})}catch{}}},it=typeof window<"u"&&window.isSecureContext&&"Notification"in window,we=()=>{const R=Lg();u({fontSize:R.fontSize,fontFamily:R.fontFamily,toolbarVisible:R.toolbarVisible,vibrateOnKeyPress:R.vibrateOnKeyPress,predictiveEcho:R.predictiveEcho,agentAlertBadge:R.agentAlertBadge,agentAlertSound:R.agentAlertSound,agentAlertVibrate:R.agentAlertVibrate,agentAlertNotify:R.agentAlertNotify,language:R.language,virtualKeys:R.virtualKeys}),d("info",p("settings.resetDefaultsToast"))},Ke=R=>{const ve=U.map(ye=>ye.id===R?{...ye,enabled:!ye.enabled}:ye);u({virtualKeys:ve})},gt=(R,ve)=>{const ye=ve==="up"?R-1:R+1;if(ye<0||ye>=U.length)return;const We=[...U],bt=We[R];We[R]=We[ye],We[ye]=bt,u({virtualKeys:We})},Ve=R=>{if(U.some(ye=>ye.id===R.id)){const ye=U.map(We=>We.id===R.id?{...We,enabled:!0}:We);u({virtualKeys:ye})}else{const ye=[...U,{...R,enabled:!0}];u({virtualKeys:ye})}W(!1)},Qe=R=>{const ve=U.filter(ye=>ye.id!==R);u({virtualKeys:ve})},lt=()=>{u({virtualKeys:Zs()}),d("info",p("toasts.keyLayoutReset"))},wt=10,Dt=24;return f.jsxs(Ad,{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(_e,{variant:"ghost",onClick:we,children:p("settings.resetDefaults")}),f.jsx(_e,{variant:"primary",onClick:i,children:p("common.done")})]}),children:[f.jsx(Td,{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:b,onSelect:R=>v(R),className:"mb-3 border-b border-tui-border-dim pb-1"}),b==="appearance"&&f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{children:p("settings.languageLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2",children:[f.jsx(Hs,{name:"ui-language",checked:m==="zh",onChange:()=>h("zh"),label:"简体中文"}),f.jsx(Hs,{name:"ui-language",checked:m==="en",onChange:()=>h("en"),label:"English"})]})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"terminal-font-select",children:p("settings.fontFamilyLabel")}),f.jsxs(Lo,{id:"terminal-font-select",value:r.fontFamily,onChange:R=>u({fontFamily:R.target.value}),"aria-label":p("settings.fontFamilyLabel"),children:[!G&&f.jsx("option",{value:r.fontFamily,children:r.fontFamily}),cd.map(R=>f.jsx("option",{value:R.font,children:p(`fontPresets.${R.id}`)||R.name},R.id))]}),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:r.fontFamily,fontSize:`${r.fontSize}px`},children:[f.jsx("span",{className:"text-tui-ok",children:"$"}),' echo "Herdr 0O 1lI ',' [] () -> => !="']})]}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"terminal-font-size",children:p("settings.fontSizeLabel",{size:r.fontSize})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(t1,{value:(r.fontSize-wt)/(Dt-wt),width:24,className:"hidden shrink-0 sm:inline-flex"}),f.jsx("input",{id:"terminal-font-size",type:"range",min:wt,max:Dt,step:1,value:r.fontSize,onChange:R=>u({fontSize:Number(R.target.value)}),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(fi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{children:p("settings.predictiveEchoLabel")}),f.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-3",children:[f.jsx(Hs,{name:"predictive-echo",checked:r.predictiveEcho==="auto",onChange:()=>u({predictiveEcho:"auto"}),label:p("settings.predictiveEchoAuto")}),f.jsx(Hs,{name:"predictive-echo",checked:r.predictiveEcho==="always",onChange:()=>u({predictiveEcho:"always"}),label:p("settings.predictiveEchoAlways")}),f.jsx(Hs,{name:"predictive-echo",checked:r.predictiveEcho==="off",onChange:()=>u({predictiveEcho:"off"}),label:p("settings.predictiveEchoOff")})]}),f.jsx("p",{className:"text-tui-sm leading-snug text-tui-faint",children:p("settings.predictiveEchoDesc")})]}),f.jsx(fi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(Jl,{checked:r.toolbarVisible,onChange:R=>u({toolbarVisible:R}),label:p("settings.touchKeyToolbar"),description:p("settings.touchKeyToolbarDesc")}),f.jsx(Jl,{checked:r.vibrateOnKeyPress,onChange:R=>u({vibrateOnKeyPress:R}),label:p("settings.touchHaptics"),description:p("settings.touchHapticsDesc")})]}),f.jsx(fi,{}),f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{children:p("settings.agentAlertsLabel")}),f.jsx(Jl,{checked:r.agentAlertBadge,onChange:R=>u({agentAlertBadge:R}),label:p("settings.agentAlertBadge"),description:p("settings.agentAlertBadgeDesc")}),f.jsx(Jl,{checked:r.agentAlertVibrate,onChange:R=>u({agentAlertVibrate:R}),label:p("settings.agentAlertVibrate"),description:p("settings.agentAlertVibrateDesc")}),f.jsx(Jl,{checked:r.agentAlertSound,onChange:R=>{u({agentAlertSound:R}),R&&(Gg(),Ig("done"))},label:p("settings.agentAlertSound"),description:p("settings.agentAlertSoundDesc")}),it&&f.jsx(Jl,{checked:r.agentAlertNotify,onChange:R=>{if(R&&Notification.permission!=="granted"){Notification.requestPermission().then(ve=>u({agentAlertNotify:ve==="granted"}));return}u({agentAlertNotify:R})},label:p("settings.agentAlertNotify"),description:p("settings.agentAlertNotifyDesc")})]}),f.jsx(fi,{}),f.jsxs("p",{className:"text-tui-sm leading-snug text-tui-faint",children:[f.jsx("span",{"aria-hidden":"true",className:"mr-1",children:qe.arrowRight}),p("settings.colorPassthroughNote")]})]}),b==="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(_e,{variant:"ghost",onClick:lt,className:"shrink-0",children:p("virtualKeyboard.resetLayout")})]}),f.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:U.map((R,ve)=>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:R.enabled,onChange:()=>Ke(R.id),className:"sr-only",id:`toggle-${R.id}`}),f.jsx("label",{htmlFor:`toggle-${R.id}`,className:ne("shrink-0 cursor-pointer select-none font-bold",R.enabled?"text-tui-ok":"text-tui-faint"),"aria-hidden":"true",children:R.enabled?"[x]":"[ ]"}),f.jsx(jp,{className:ne(!R.enabled&&"opacity-50"),children:R.label}),f.jsx("span",{className:"truncate text-tui-sm text-tui-muted",children:ad(R,p)})]}),f.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[f.jsx(_e,{variant:"ghost",brackets:!1,disabled:ve===0,onClick:()=>gt(ve,"up"),title:p("virtualKeyboard.moveUp"),"aria-label":p("virtualKeyboard.moveUp"),className:"px-1",children:"↑"}),f.jsx(_e,{variant:"ghost",brackets:!1,disabled:ve===U.length-1,onClick:()=>gt(ve,"down"),title:p("virtualKeyboard.moveDown"),"aria-label":p("virtualKeyboard.moveDown"),className:"px-1",children:"↓"}),f.jsx(_e,{variant:"ghost",brackets:!1,onClick:()=>Qe(R.id),title:p("virtualKeyboard.deleteKeyTitle"),"aria-label":p("virtualKeyboard.deleteKeyTitle"),className:"px-1 text-tui-bad hover:text-tui-bad",children:qe.cross})]})]},R.id))}),f.jsx(_e,{block:!0,glyph:"+",onClick:()=>W(!ue),className:"border-dashed",children:p("virtualKeyboard.addKey")}),ue&&f.jsxs("div",{className:"space-y-2 border border-tui-border bg-tui-mantle p-2",children:[f.jsx(fi,{label:p("virtualKeyboard.availableKeys")}),f.jsx("div",{className:"flex max-h-48 flex-wrap gap-1 overflow-y-auto",children:uv.map(R=>{const ve=U.some(ye=>ye.id===R.id);return f.jsxs("button",{type:"button",onClick:()=>Ve(R),title:ad(R,p),className:ne("tui-focusable flex select-none items-center gap-1 border px-1.5 py-0.5 text-tui-sm transition-colors",ve?"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:R.label}),f.jsx("span",{"aria-hidden":"true",className:ve?"text-tui-ok":"text-tui-accent",children:ve?qe.check:"+"})]},R.id)})})]})]}),b==="agentKeymaps"&&f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"agent-keymap-profile",children:p("agentKeymaps.settingsProfileLabel")}),f.jsx(Lo,{id:"agent-keymap-profile","aria-label":p("agentKeymaps.settingsProfileLabel"),value:ie,onChange:R=>T(R.target.value),children:Nv.map(R=>f.jsx("option",{value:R,children:Ia[R].name},R))}),Ia[ie].configHint&&f.jsx("p",{className:"text-tui-sm text-tui-faint",children:p("agentKeymaps.configHint",{path:Ia[ie].configHint})})]}),f.jsx(fi,{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:Ia[ie].name,count:Oe})}),f.jsx("div",{role:"group","aria-label":p("agentKeymaps.barGroup"),"data-testid":"agent-bar-choices",className:"flex flex-wrap gap-1",children:Ce.map(R=>{const ve=rt(R),ye=Fe(R),We=!R.hidden;return f.jsxs("button",{type:"button","data-testid":`agent-bar-toggle-${R.id}`,"aria-pressed":We,onClick:()=>I(R.id,{hidden:We}),title:`${ye} ${ve}`.trim(),className:ne("tui-focusable inline-flex h-8 select-none items-center gap-1 border px-1.5 text-tui-sm transition-colors",We?"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:We?qe.check:"+"}),f.jsx("span",{className:"font-bold",children:ye}),f.jsx("span",{className:We?void 0:"opacity-80",children:ve})]},R.id)})}),f.jsx(_e,{variant:"ghost",onClick:Ze,children:p("agentKeymaps.restoreBar")})]}),f.jsx(fi,{label:p("agentKeymaps.agentGroup")}),f.jsx("div",{className:"max-h-72 overflow-y-auto border border-tui-border bg-tui-mantle",children:pe.map((R,ve)=>{var De,ot;const ye=rt(R),We=p("agentKeymaps.defaultCombo",{combo:qs(R.defaultCombo)}),bt=((ot=(De=se.actions)==null?void 0:De[R.id])==null?void 0:ot.keys)??R.combo,ft=Re(ie,R.id),St=E[ft]??bt;let oe="",Ne=null;try{Ei(St),oe=qs(St)}catch(Yt){Ne=Ge(Yt)}return f.jsxs("div",{"data-testid":`agent-setting-row-${R.id}`,className:xS,children:[f.jsx(jp,{className:"max-w-full justify-self-start overflow-hidden whitespace-nowrap font-bold [grid-area:cap]",children:oe||"—"}),f.jsxs("span",{className:"min-w-0 truncate text-tui-sm text-tui-text [grid-area:label]",title:ye,children:[ye,!R.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-${R.id}`,children:[p("agentKeymaps.shortcutLabel")," ",ye]}),f.jsx(wn,{id:`agent-combo-${R.id}`,"aria-label":`${p("agentKeymaps.shortcutLabel")} ${ye}`,value:St,onChange:Yt=>F(R.id,Yt.target.value),onBlur:()=>Be(R.id),onKeyDown:Yt=>{Yt.key==="Enter"&&Yt.currentTarget.blur()},placeholder:p("agentKeymaps.comboPlaceholder"),"aria-invalid":!!Ne,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:We,children:We}),f.jsxs("div",{className:"flex items-center gap-1 [grid-area:actions]",children:[f.jsx(_e,{variant:"ghost",brackets:!1,className:"px-1",onClick:()=>le(R),title:p("agentKeymaps.resetAction"),"aria-label":`${p("agentKeymaps.resetAction")} ${ye}`,children:"↺"}),f.jsx(_e,{variant:"ghost",brackets:!1,className:"px-1",disabled:ve===0,onClick:()=>je(ve,"up"),title:p("agentKeymaps.moveUp"),"aria-label":`${p("agentKeymaps.moveUp")} ${ye}`,children:"↑"}),f.jsx(_e,{variant:"ghost",brackets:!1,className:"px-1",disabled:ve===pe.length-1,onClick:()=>je(ve,"down"),title:p("agentKeymaps.moveDown"),"aria-label":`${p("agentKeymaps.moveDown")} ${ye}`,children:"↓"}),R.custom&&f.jsx(_e,{variant:"ghost",brackets:!1,className:"px-1 text-tui-bad",onClick:()=>Q(R.id),title:p("agentKeymaps.removeCustom"),"aria-label":`${p("agentKeymaps.removeCustom")} ${ye}`,children:qe.cross})]}),Ne&&f.jsx("p",{className:"col-span-full text-tui-sm text-tui-bad",role:"alert",children:p("agentKeymaps.invalidCombo",{error:Ne})})]},R.id)})}),f.jsx(fi,{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(wn,{value:z,onChange:R=>O(R.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(wn,{value:B,onChange:R=>te(R.target.value)})]}),f.jsx(_e,{onClick:fe,disabled:!z.trim()||!B.trim(),children:p("agentKeymaps.addAction")})]}),B.trim()&&(()=>{try{return Ei(B),f.jsx("p",{className:"text-tui-sm text-tui-faint",children:qs(B)})}catch(R){const ve=Ge(R);return f.jsx("p",{className:"text-tui-sm text-tui-bad",role:"alert",children:ve})}})(),f.jsx(_e,{variant:"ghost",onClick:Le,children:p("agentKeymaps.restoreProfile")})]})]})},SS={success:"ok",warning:"warn",error:"bad",info:"accent"},CS={success:qe.check,warning:qe.warn,error:qe.cross,info:"›"},TS=()=>{const{toasts:a,removeToast:i,t:s}=jt();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 u=SS[r.type];return f.jsxs("div",{className:ne("pointer-events-auto flex items-start gap-2 border border-tui-border border-l-2 bg-tui-base px-2 py-1 text-tui",ti[u].edgeL),role:"alert",children:[f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0 font-bold",ti[u].text),children:CS[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:qe.cross})})]},r.id)})})},MS=[{status:"blocked",level:"warn"},{status:"done",level:"ok"},{status:"working",level:"accent"}],Eb=({className:a,compact:i=!1})=>{const{agentStatus:s,t:r}=jt();if(!s)return null;const u=MS.map(({status:m,level:h})=>{var p;return{status:m,level:h,count:((p=s.counts)==null?void 0:p[m])??0}}).filter(m=>m.count>0),d=i?u.slice(0,1):u;return d.length===0?s.total===0?null:f.jsxs("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-1 px-1 text-tui-muted",a),title:r("agents.title"),children:[f.jsx(jn,{level:"idle"}),f.jsx("span",{className:"text-tui-faint",children:r("agents.allIdle")})]}):f.jsx("span",{"data-testid":"agent-status-chip",className:ne("flex shrink-0 items-center gap-2 px-1",a),title:r("agents.title"),children:d.map(({status:m,level:h,count:p})=>f.jsxs("span",{className:"flex items-center gap-1 text-tui-muted",children:[f.jsx(jn,{level:h}),f.jsx("span",{className:"text-tui-text",children:p}),f.jsx("span",{className:"text-tui-faint",children:r(`agents.${m}`)})]},m))})},kd=({onAddProfile:a,mobile:i=!1,statusBar:s=!1})=>{const{profiles:r,activeProfileId:u,activeProfile:d,connectionState:m,switchProfile:h,renameProfile:p,removeProfile:y,t:b}=jt(),[v,S]=w.useState(!1),[T,E]=w.useState(null),[Y,A]=w.useState(""),z=w.useRef(null);w.useEffect(()=>{if(!v)return;const G=U=>{z.current&&!z.current.contains(U.target)&&S(!1)};return document.addEventListener("pointerdown",G),()=>document.removeEventListener("pointerdown",G)},[v]);const O=(G,U)=>{E(G),A(U)},B=G=>{const U=Y.trim();U&&p(G,U),E(null)},te=G=>{typeof window<"u"&&!window.confirm(b("profiles.removeConfirm"))||(y(G),E(null))},ue=(d==null?void 0:d.displayName)||b("profiles.addHost"),W=m==="connected"?"ok":m==="connecting"||m==="reconnecting"?"warn":m==="error"?"bad":"idle";return f.jsxs("div",{ref:z,className:ne("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(G=>!G),className:ne("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(jn,{level:W}),f.jsx("span",{className:ne("truncate text-tui-text",s&&"min-w-0 flex-1"),children:ue}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-faint",children:v?qe.chevronDown:qe.chevronRight})]}),v&&f.jsxs("div",{role:"menu","aria-label":b("profiles.switcherLabel"),className:ne("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(G=>{const U=G.id===u,ie=G.id===T;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":U?"true":void 0,onClick:()=>{h(G.id),S(!1)},className:ne("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",U?"text-tui-accent":"text-tui-text"),children:[f.jsx("span",{"aria-hidden":"true",className:"w-3 shrink-0",children:U?qe.cursor:""}),f.jsxs("span",{className:"min-w-0 flex-1",children:[f.jsx("span",{className:"block truncate font-bold",children:G.displayName}),f.jsx("span",{className:"block truncate text-tui-sm text-tui-faint",title:G.hostname||G.hostId,children:G.hostname||G.hostId||G.wsUrl})]}),U&&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:()=>O(G.id,G.displayName),className:"tui-focusable min-h-11 min-w-11 px-2 text-tui-muted hover:text-tui-accent",children:qe.ellipsis})]}),ie&&f.jsxs("div",{className:"flex items-center gap-1 px-2 pb-2",children:[f.jsx("input",{autoFocus:!0,value:Y,maxLength:64,onChange:se=>A(se.target.value),onKeyDown:se=>{se.key==="Enter"&&B(G.id),se.key==="Escape"&&E(null)},"aria-label":b("profiles.rename"),className:"tui-input min-w-0 flex-1 px-2 py-1 text-tui"}),f.jsx(_e,{onClick:()=>B(G.id),variant:"primary",className:"min-h-11",children:b("common.save")}),f.jsx(_e,{onClick:()=>te(G.id),variant:"danger",className:"min-h-11",children:b("profiles.remove")})]})]},G.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")})]})]})]})},AS=({onAddProfile:a=()=>{}})=>{const{connectionState:i,role:s,hostId:r,assignedClientId:u,sharedWindowCount:d,settings:m,rttMs:h,t:p}=jt(),y=Do(i,p),b=i==="connected";return f.jsx(rb,{left:f.jsxs(f.Fragment,{children:[f.jsx(kd,{onAddProfile:a}),f.jsx(Dp,{items:[f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx(jn,{level:y.level}),f.jsx("span",{className:"text-tui-text",children:y.label})]},"status"),b?f.jsx(jo,{tone:s==="controller"?"ok":"warn",children:p(s==="controller"?"role.sharedControl":"common.viewer")},"role"):null,b&&d>1?f.jsx("span",{className:"text-tui-muted",children:p("role.sharedWindows",{count:d})},"windows"):null,r?f.jsxs("span",{children:[f.jsxs("span",{className:"text-tui-faint",children:[p("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:p("header.clientIdLabel")})," ",f.jsx("span",{className:"text-tui-text",children:u||m.clientId})]},"client")]})]}),right:f.jsx(Dp,{items:[b?f.jsx(Eb,{},"agents"):null,h!==null?f.jsxs("span",{className:"text-tui-muted",children:[p("header.latencyTitle"),": ",f.jsxs("span",{className:"text-tui-text",children:[h,"ms"]})]},"rtt"):null,f.jsx("span",{className:"hidden text-tui-faint sm:inline",children:p("header.tagline")},"mode")]})})},ES=[[/\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"]],NS=[[/\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 cg(a,i){for(const[s,r]of a)if(s.test(i))return r;return null}function Ld(a){const i=typeof a=="string"?a.trim():"";if(!i)return{label:"",raw:""};const s=cg(ES,i),r=cg(NS,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 ug(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 kS=({clients:a})=>{const{t:i}=jt(),s=[{key:"id",header:i("admin.colClientId"),render:r=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(jn,{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 u=r.role==="controller";return f.jsx(jo,{tone:u?"ok":"warn",children:i(u?"common.controller":"common.viewer")})}},{key:"device",header:i("admin.colDevice"),render:r=>{const u=Ld(r.userAgent);return u.label?f.jsx("span",{className:"text-tui-muted",title:u.raw,children:u.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:ug(r.bytesReceived||0)}),f.jsx("span",{"aria-hidden":"true",className:"mx-1 text-tui-faint",children:"/"}),f.jsx("span",{className:"text-tui-ok",children:ug(r.bytesSent||0)})]})}];return f.jsx(pn,{title:i("admin.connectedClientsTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noClients")})})},dg={online:"ok",busy:"ok",reconnecting:"warn",offline:"idle"};function LS(a=[],i=[]){const s=new Map;for(const d of i){if(!(d!=null&&d.hostId))continue;const m=s.get(d.hostId);m?m.push(d):s.set(d.hostId,[d])}const r=a.map(d=>{const m=s.get(d.id)||[];return{id:d.id,hostname:d.hostname||d.id,status:d.status||"online",connectedDeviceCount:d.connectedDeviceCount??0,pairedDeviceCount:d.pairedDeviceCount??m.length,devices:m,fromRosterOnly:!1}}),u=new Set(r.map(d=>d.id));for(const[d,m]of s)u.has(d)||r.push({id:d,hostname:d,status:"offline",connectedDeviceCount:0,pairedDeviceCount:m.length,devices:m,fromRosterOnly:!0});return r.sort((d,m)=>d.fromRosterOnly!==m.fromRosterOnly?d.fromRosterOnly?1:-1:d.hostname.localeCompare(m.hostname))}const RS=({hosts:a,devices:i})=>{const{t:s}=jt(),r=LS(a,i),u={online:s("admin.hostStatusOnline"),busy:s("admin.hostStatusBusy"),reconnecting:s("admin.hostStatusReconnecting"),offline:s("admin.hostStatusOffline")};return f.jsx(pn,{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(jn,{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(jo,{tone:dg[d.status],children:u[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(m=>{const h=Ld(m.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:h.raw,children:h.label||s("admin.unknownDevice")}),f.jsx("code",{className:"truncate text-tui-sm text-tui-muted",children:m.deviceId}),f.jsx("span",{className:"ml-auto shrink-0 text-tui-sm text-tui-faint",children:m.lastIp||"—"})]},m.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))})},_S=({ptys:a})=>{const{t:i}=jt(),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(pn,{title:i("admin.activePtysTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:s,items:a,rowKey:r=>r.id,empty:i("admin.noPtys")})})};function jS(a){if(!a)return"—";const i=new Date(a);return Number.isNaN(i.getTime())?"—":i.toLocaleString()}const DS=({devices:a,onRevoke:i})=>{const{t:s}=jt(),[r,u]=w.useState(null),[d,m]=w.useState(null),h=async y=>{if(r!==y){u(y);return}m(y);try{await i(y)}finally{m(null),u(null)}},p=[{key:"device",header:s("admin.colDevice"),render:y=>{const b=Ld(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:jS(y.lastSeenAt)})},{key:"actions",header:s("admin.colActions"),align:"right",render:y=>{const b=r===y.deviceId,v=d===y.deviceId;return f.jsx(_e,{variant:"danger",disabled:v,onClick:()=>void h(y.deviceId),onBlur:()=>u(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(Va,{}):s(b?"admin.revokeConfirm":"admin.revokeDevice")})}}];return f.jsx(pn,{title:s("admin.pairedDevicesTitle",{count:a.length}),bodyClassName:"-mx-1",children:f.jsx(Md,{columns:p,items:a,rowKey:y=>y.deviceId,empty:s("admin.noDevices")})})};function Nb(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 Ys(a,i){const s=Nb(a);return s?`${s}${i.startsWith("/")?i:`/${i}`}`:i}const zS=({onBackToTerminal:a,onOpenPairing:i})=>{var Ke,gt,Ve,Qe,lt,wt,Dt,R,ve,ye,We,bt,ft,St;const{settings:s,updateSettings:r,addToast:u,t:d}=jt(),m=Nb(s.wsUrl)||(typeof window<"u"?window.location.origin:"local"),h=((Ke=s.adminTokens)==null?void 0:Ke[m])||(m===(typeof window<"u"?window.location.origin:"local")?s.adminToken:"")||"",[p,y]=w.useState(null),[b,v]=w.useState(null),[S,T]=w.useState(!1),[E,Y]=w.useState(!0),[A,z]=w.useState(null),[O,B]=w.useState(!1),[te,ue]=w.useState(3e3),[W,G]=w.useState(null),[U,ie]=w.useState("overview"),[se,pe]=w.useState(!1),[Ce,Oe]=w.useState(h),[rt,Fe]=w.useState(!!h),L="node bin/service.js pair";w.useEffect(()=>{Oe(h),Fe(!!h),y(null),v(null),T(!1)},[m]);const I=()=>{ia(L).then(oe=>{if(oe==="failed"){u("error",d("clipboard.copyFailed"));return}pe(!0),u("success",d("toasts.commandCopied")),setTimeout(()=>pe(!1),2e3)})};w.useEffect(()=>{let oe=!0;Y(!0);async function Ne(){try{const De=await fetch(Ys(s.wsUrl,"/api/info"),{headers:{Accept:"application/json"}});if(De.ok){const ot=await De.json();oe&&(v(ot),T(!0));return}}catch{}if(oe){const De=!!(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:De?"remote":"local",adminConfigured:!1,adminPath:"/admin",adminStatusPath:"/api/admin/status"}),T(!0)}}return Ne(),()=>{oe=!1}},[s.wsUrl,m]);const le=(b==null?void 0:b.relayMode)==="remote",je=()=>{if(b!=null&&b.adminPath)return b.publicUrl?`${b.publicUrl.replace(/\/$/,"")}${b.adminPath}`:Ys(s.wsUrl,b.adminPath);if(p!=null&&p.remoteAdminUrl)return p.remoteAdminUrl;if(s.wsUrl)try{return Ys(s.wsUrl,"/admin")}catch{}return"/admin"},Q=w.useCallback(async()=>{if(S){if(le){if(!rt&&!Ce){y(null),Y(!1),z(null),B(!1);return}try{Y(!0);const oe=Ys(s.wsUrl,(b==null?void 0:b.adminStatusPath)||"/api/admin/status"),De=await fetch(oe,{headers:{Accept:"application/json","X-Relay-Admin-Token":Ce}});if(De.status===401||De.status===403){B(!0),z(d("admin.relayAdminAuthError")),y(null);return}if(!De.ok)throw new Error(`HTTP ${De.status}: ${De.statusText}`);const ot=await De.json();y(ot),z(null),B(!1),G(new Date)}catch(oe){console.warn("GET /api/admin/status request failed:",oe),B(!1),z(oe instanceof Error?oe.message:"Failed to fetch remote admin status"),y(null)}finally{Y(!1)}return}try{Y(!0);const oe={Accept:"application/json"};s.token&&(oe.Authorization=`Bearer ${s.token}`);const Ne=await fetch("/api/status",{headers:oe});if(Ne.status===401||Ne.status===403){B(!0),z(`Authentication failed (HTTP ${Ne.status}): Access denied. Please configure an authorized token or pair with the host.`),y(null);return}if(!Ne.ok)throw new Error(`HTTP ${Ne.status}: ${Ne.statusText}`);const De=await Ne.json();y(De),z(null),B(!1),G(new Date)}catch(oe){console.warn("GET /api/status request failed:",oe),B(!1),z(oe instanceof Error?oe.message:"Failed to fetch status"),y(null)}finally{Y(!1)}}},[S,le,rt,Ce,b,s.token,s.wsUrl,m,d]),Ze=w.useCallback(async oe=>{try{if(!(await fetch(Ys(s.wsUrl,`/api/admin/devices/${encodeURIComponent(oe)}`),{method:"DELETE",headers:{Accept:"application/json","X-Relay-Admin-Token":Ce}})).ok){z(d("admin.revokeFailed"));return}await Q()}catch{z(d("admin.revokeFailed"))}},[Ce,Q,s.wsUrl,d]);w.useEffect(()=>{if(!S)return;Q();let oe=null;const Ne=()=>{te>0&&!oe&&(oe=setInterval(()=>{document.visibilityState==="visible"&&Q()},te))},De=()=>{oe&&(clearInterval(oe),oe=null)},ot=()=>{document.visibilityState==="visible"?(Q(),Ne()):De()};return Ne(),document.addEventListener("visibilitychange",ot),()=>{De(),document.removeEventListener("visibilitychange",ot)}},[S,Q,te]);const Le=oe=>{oe.preventDefault();const Ne=Ce.trim();r({adminToken:Ne,adminTokens:{...s.adminTokens||{},[m]:Ne}}),Fe(!!Ne)},fe=oe=>{const Ne=Math.max(0,Math.floor(oe)),De=Math.floor(Ne/86400),ot=Math.floor(Ne%86400/3600),Yt=Math.floor(Ne%3600/60),ni=Ne%60,Pe=(pi,gn)=>`${pi}${d(`admin.unit${gn}`)}`;return De>0?[Pe(De,"Day"),Pe(ot,"Hour"),Pe(Yt,"Minute")].join(" "):ot>0?[Pe(ot,"Hour"),Pe(Yt,"Minute"),Pe(ni,"Second")].join(" "):[Pe(Yt,"Minute"),Pe(ni,"Second")].join(" ")},Ge=oe=>{if(!oe||oe===0)return"0 B";const Ne=1024,De=["B","KB","MB","GB"],ot=Math.floor(Math.log(oe)/Math.log(Ne));return`${(oe/Math.pow(Ne,ot)).toFixed(1)} ${De[ot]}`},Re=()=>{const oe=je();window.open(oe,"_blank","noopener,noreferrer")},F=p?p.activeUserCount??((gt=p.clients)==null?void 0:gt.length)??0:0,Be=p?[{id:"overview",label:d("admin.tabOverview"),index:1},{id:"clients",label:d("admin.tabClients",{count:((Ve=p.clients)==null?void 0:Ve.length)||0}),index:2},{id:"ptys",label:d("admin.tabPtys",{count:((Qe=p.ptys)==null?void 0:Qe.length)||0}),index:3},...p.devices?[{id:"devices",label:d("admin.tabDevices",{count:p.devices.length}),index:4}]:[]]:[],it=Be.map(oe=>oe.id);w.useEffect(()=>{const oe=Ne=>{if(Ne.ctrlKey||Ne.altKey||Ne.metaKey)return;const De=Ne.target;if(De instanceof HTMLInputElement||De instanceof HTMLTextAreaElement||De instanceof HTMLSelectElement||De!=null&&De.isContentEditable||document.querySelector('[role="dialog"]'))return;if(Ne.key==="Escape"&&a){Ne.preventDefault(),a();return}if(Ne.key.toLowerCase()==="r"){Ne.preventDefault(),Q();return}const ot=Number.parseInt(Ne.key,10)-1;Number.isInteger(ot)&&ot>=0&&ot<it.length&&(Ne.preventDefault(),ie(it[ot]))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Q,it.join("|")]);const we=f.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a&&f.jsx(_e,{variant:"ghost",onClick:a,title:d("admin.returnToTerminal"),"aria-label":d("admin.returnToTerminal"),glyph:qe.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(jo,{tone:le?"alt":"ok",children:d(le?"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(Lo,{value:te,onChange:oe=>ue(Number(oe.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(_e,{variant:"primary",onClick:Q,disabled:E,title:d("admin.refreshNow"),children:E?f.jsx(Va,{}):d("admin.refreshNow")})]});return f.jsxs(l1,{name:d("admin.title"),tagline:d("admin.subtitle"),aside:we,tabs:Be,activeTabId:U,onSelectTab:oe=>ie(oe),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:W?f.jsx("span",{className:"text-tui-faint",children:d("admin.updatedAt",{time:W.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(Va,{label:d("admin.loadingStatus")})}),S&&le&&!rt&&f.jsxs(pn,{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(di,{label:d("admin.remoteRelayEndpoint"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-accent",children:s.wsUrl})}),f.jsx(di,{label:d("admin.remoteRelayAdminUrl"),labelWidth:18,children:f.jsx("code",{className:"break-all text-tui-ok",children:je()})})]}),f.jsx(fi,{}),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(_e,{onClick:()=>Fe(!0),children:d("admin.relayAdminLoginBtn")}),f.jsx(_e,{variant:"primary",onClick:Re,glyph:qe.arrowRight,children:d("admin.openRemoteAdminBtn")})]})]})]}),S&&le&&rt&&!p&&f.jsxs(pn,{title:d("admin.relayAdminTitle"),bodyClassName:"space-y-2",children:[f.jsx(So,{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:Le,className:"space-y-2",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx(xn,{htmlFor:"relay-admin-token",children:d("admin.relayAdminTokenLabel")}),f.jsx(wn,{id:"relay-admin-token",type:"password",value:Ce,onChange:oe=>Oe(oe.target.value),placeholder:d("admin.relayAdminTokenPlaceholder")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(_e,{variant:"primary",type:"submit",children:d("admin.relayAdminLoginBtn")}),f.jsx(_e,{variant:"ghost",onClick:()=>Fe(!1),children:d("common.cancel")})]})]})]}),S&&!le&&O&&f.jsxs(pn,{title:d("admin.unauthorizedTitle"),tone:"bad",bodyClassName:"space-y-2",children:[f.jsx(So,{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:L}),f.jsx(_e,{onClick:I,glyph:se?qe.check:"⧉",className:ne("shrink-0",se&&"border-tui-ok text-tui-ok"),children:d(se?"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(_e,{variant:"primary",onClick:i,children:d("admin.enterPairCodeBtn")}),f.jsx(_e,{onClick:Q,children:d("admin.retryFetchBtn")})]})]}),S&&A&&!O&&!(!le&&O)&&f.jsx(So,{tone:"warn",action:f.jsx(_e,{variant:"warn",onClick:Q,children:d("common.retry")}),children:d("admin.errorConnecting",{error:A})}),p&&f.jsxs(f.Fragment,{children:[U==="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(pn,{title:d("admin.accessPanel"),aside:fe(p.uptimeSeconds||0),bodyClassName:"space-y-0.5",children:[f.jsx(di,{label:d("admin.connectedHosts"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(jn,{level:(lt=p.hosts)!=null&&lt.length?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:((wt=p.hosts)==null?void 0:wt.length)||0})]})}),f.jsx(di,{label:d("admin.activeUsers"),labelWidth:14,children:f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(jn,{level:F?"ok":"idle"}),f.jsx("span",{className:"font-bold",children:F}),f.jsx("span",{className:"text-tui-faint",children:d("admin.acrossWindows",{count:((Dt=p.clients)==null?void 0:Dt.length)||0})})]})}),f.jsxs(di,{label:d("admin.activePtys"),labelWidth:14,children:[f.jsx("span",{className:"font-bold",children:((R=p.ptys)==null?void 0:R.length)||0}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.terminalShells")})]}),f.jsx(di,{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(pn,{title:d("admin.throughput"),aside:d("admin.perSecond",{value:Ge(((ve=p.throughput)==null?void 0:ve.bytesOutPerSec)||0)}),bodyClassName:"space-y-0.5",children:[f.jsxs(di,{label:d("admin.bytesInTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-accent",children:Ge(((ye=p.throughput)==null?void 0:ye.bytesIn)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:Ge(((We=p.throughput)==null?void 0:We.bytesInPerSec)||0)})})]}),f.jsxs(di,{label:d("admin.bytesOutTotal"),labelWidth:13,children:[f.jsx("span",{className:"font-bold text-tui-ok",children:Ge(((bt=p.throughput)==null?void 0:bt.bytesOut)||0)}),f.jsx("span",{className:"ml-1.5 text-tui-faint",children:d("admin.perSecond",{value:Ge(((ft=p.throughput)==null?void 0:ft.bytesOutPerSec)||0)})})]}),f.jsx(fi,{}),f.jsx(di,{label:d("admin.frameRate"),labelWidth:13,children:f.jsx("span",{className:"font-bold",children:d("admin.framesPerSecond",{count:(((St=p.throughput)==null?void 0:St.framesOutPerSec)||0).toFixed(0)})})})]})]}),f.jsx(RS,{hosts:p.hosts||[],devices:p.devices})]}),U==="clients"&&f.jsx(kS,{clients:p.clients||[]}),U==="ptys"&&f.jsx(_S,{ptys:p.ptys||[]}),U==="devices"&&f.jsx(DS,{devices:p.devices||[],onRevoke:Ze})]})]})},OS=({compact:a=!1})=>{const{role:i,connectionState:s,sharedWindowCount:r,assignedClientId:u,t:d}=jt();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(jn,{level:"idle"}),f.jsx("span",{children:d("common.offline")})]});const h=i==="controller",p=r>1,y=f.jsxs("div",{className:ne("inline-flex min-w-0 select-none items-center gap-1.5 text-tui uppercase",h?"text-tui-ok":"text-tui-warn"),role:"status","aria-label":d(h?"role.controllerMode":"role.viewerMode"),children:[f.jsx(jn,{level:h?"ok":"warn"}),f.jsx("span",{className:"truncate",children:d(h?"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")}),u?f.jsx(di,{label:d("role.thisWindow"),labelWidth:9,className:"text-tui-sm",children:f.jsx("span",{className:"truncate text-tui-muted",children:u})}):null]})},Gs="tui-focusable group flex h-11 w-full select-none items-center gap-2 border px-2 text-left text-tui transition-colors",Is="border-tui-border text-tui-muted hover:border-tui-accent hover:text-tui-accent active:bg-tui-selection",BS="border-tui-accent bg-tui-selection text-tui-accent",$s=({active:a=!1})=>f.jsx("span",{"aria-hidden":"true",className:ne("shrink-0",a?"text-tui-accent":"text-tui-faint group-hover:text-tui-accent"),children:qe.cursor}),US=({onClose:a,onNavigateAdmin:i,showAdminEntry:s=!0,onOpenPairing:r,onOpenSettings:u,onAddProfile:d=()=>{}})=>{const{connectionState:m,stateDetail:h,rttMs:p,hostId:y,settings:b,updateSettings:v,connect:S,addToast:T,language:E,setLanguage:Y,t:A}=jt(),[z,O]=mi.useState(!1),B=Do(m,A),te=G=>()=>{var ie;const U=document.activeElement;(ie=U==null?void 0:U.blur)==null||ie.call(U),G()},ue=()=>{ia(b.clientId).then(G=>{if(G==="failed"){T("error",A("clipboard.copyFailed"));return}O(!0),T("info",A("toasts.clientIdCopied",{id:b.clientId})),setTimeout(()=>O(!1),2e3)})},W=()=>{const G=E==="zh"?"en":"zh";Y(G),T("info",wd(G,"toasts.switchedLanguage",{lang:G==="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:A("mobile.sessionControls")}),f.jsx(_e,{variant:"ghost",onClick:a,"aria-label":A("mobile.closeSessionControls"),children:"esc"})]}),f.jsx(pn,{title:A("profiles.title"),tone:"accent",bodyClassName:"space-y-1",children:f.jsx(kd,{mobile:!0,onAddProfile:d})}),f.jsxs(pn,{title:A("common.status"),tone:B.level==="ok"?"ok":B.level==="bad"?"bad":"warn",bodyClassName:"space-y-1.5",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2","aria-label":A("mobile.connectionStatusAria"),children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(jn,{level:B.level}),f.jsx("span",{className:"truncate text-tui uppercase text-tui-text",children:B.label}),m==="connected"&&p!==null&&f.jsxs("span",{className:"text-tui-sm text-tui-muted",children:[p,"ms"]})]}),B.actionLabel&&f.jsx(_e,{variant:"primary",onClick:()=>S(),className:"shrink-0",children:B.actionLabel})]}),B.needsAttention&&h&&f.jsx("p",{className:"text-tui-sm leading-snug text-tui-muted",children:h}),y&&f.jsx(di,{label:A("common.host"),labelWidth:9,children:y}),f.jsxs("button",{type:"button",onClick:ue,className:"tui-focusable flex w-full items-baseline gap-2 text-left text-tui",title:A("header.copyClientIdTitle"),children:[f.jsx("span",{className:"shrink-0 text-tui-muted",style:{width:"9ch"},children:A("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:ne("shrink-0",z?"text-tui-ok":"text-tui-faint"),children:z?qe.check:"⧉"})]})]}),f.jsx(pn,{title:A("mobile.inputControl"),tone:"accent","aria-label":A("mobile.terminalControlAria"),children:f.jsx(OS,{})}),f.jsxs(pn,{title:A("mobile.menu"),tone:"accent",bodyClassName:"flex flex-col gap-1",children:[f.jsxs("button",{type:"button",onClick:W,className:ne(Gs,Is),"aria-label":A("header.languageToggleTitle"),children:[f.jsx($s,{}),f.jsx("span",{className:"truncate",children:E==="zh"?"English":"中文"})]}),f.jsxs("button",{type:"button",onClick:te(u),className:ne(Gs,Is),"aria-label":A("mobile.settingsAria"),children:[f.jsx($s,{}),f.jsx("span",{className:"truncate",children:A("common.settings")})]}),f.jsxs("button",{type:"button",onClick:te(r),className:ne(Gs,Is),"aria-label":A("mobile.pairingAria"),children:[f.jsx($s,{}),f.jsx("span",{className:"truncate",children:A("common.pairing")})]}),s&&f.jsxs("button",{type:"button",onClick:te(i),className:ne(Gs,Is),"aria-label":A("mobile.adminAria"),children:[f.jsx($s,{}),f.jsx("span",{className:"truncate",children:A("common.admin")})]}),f.jsxs("button",{type:"button",onClick:()=>v({toolbarVisible:!b.toolbarVisible}),className:ne(Gs,b.toolbarVisible?BS:Is),"aria-label":A("mobile.keybarAria"),"aria-pressed":b.toolbarVisible,children:[f.jsx($s,{active:b.toolbarVisible}),f.jsx("span",{className:"truncate",children:A("common.keyBar")}),f.jsx("span",{"aria-hidden":"true",className:"ml-auto shrink-0 text-tui-sm",children:b.toolbarVisible?"[x]":"[ ]"})]})]})]})},HS=({onAddProfile:a})=>{const{rttMs:i,t:s}=jt();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(kd,{statusBar:!0,onAddProfile:a}),f.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-tui-border",children:"│"}),f.jsx(Eb,{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:ne(i===null?"text-tui-faint":"text-tui-text"),children:i===null?"—":`${i}ms`})]})]})},KS=({onNavigateAdmin:a,showAdminEntry:i=!0,onOpenPairing:s,onOpenSettings:r,onAddProfile:u=()=>{}})=>{const{connectionState:d,isController:m,t:h}=jt(),[p,y]=w.useState(!1),b=w.useRef(null),v=w.useCallback(()=>y(!1),[]);w.useEffect(()=>{if(!p)return;const T=E=>{if(!(E.ctrlKey||E.altKey||E.metaKey)&&E.key==="Escape"){const Y=E.target;Y&&typeof Y.closest=="function"&&!!Y.closest("#terminal-container")||(E.stopPropagation(),E.preventDefault(),v())}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[p,v]),w.useEffect(()=>{var T;p&&((T=b.current)==null||T.focus({preventScroll:!0}))},[p]);const S=Do(d,h);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{"data-testid":"mobile-topbar",role:"toolbar","aria-label":h("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(ab,{className:"shrink-0"}),f.jsx(jn,{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":h("mobile.sessionControls"),"aria-expanded":p,"aria-haspopup":"dialog",className:ne("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":m?"border-tui-border text-tui-muted":"border-tui-accent text-tui-accent"),children:[!m&&!S.needsAttention&&f.jsx("span",{className:"max-w-[8rem] truncate",children:h("common.viewer")}),f.jsx("span",{"aria-hidden":"true",className:"text-tui",children:qe.chevronDown}),f.jsx("span",{"aria-hidden":"true",children:h("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":h("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(US,{onClose:v,showAdminEntry:i,onNavigateAdmin:()=>{v(),a()},onOpenPairing:()=>{v(),s()},onOpenSettings:()=>{v(),r()},onAddProfile:()=>{v(),u()}})})]}),f.jsx(HS,{onAddProfile:u})]})},kb="--app-height",Lb="--keyboard-inset",YS=80;function GS(){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>=YS?Math.round(s):0;return{height:Math.round(i.height),keyboardInset:r}}return{height:a,keyboardInset:0}}function fg(a,i=GS()){return a.style.setProperty(kb,`${i.height}px`),a.style.setProperty(Lb,`${i.keyboardInset}px`),i}function IS(a=typeof document<"u"?document.documentElement:null){if(!a||typeof window>"u")return()=>{};let i=null;const s=()=>{i=null,fg(a)},r=()=>{if(i===null){if(typeof requestAnimationFrame!="function"){s();return}i=requestAnimationFrame(s)}};fg(a);const u=window.visualViewport;return u==null||u.addEventListener("resize",r),u==null||u.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),()=>{i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null),u==null||u.removeEventListener("resize",r),u==null||u.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),a.style.removeProperty(kb),a.style.removeProperty(Lb)}}const $S=900;function hg(){if(typeof window>"u")return!1;const a=$a();return a<yd?!0:a<=$S}function qS(){const[a,i]=w.useState(hg);return w.useEffect(()=>{var u,d;const s=()=>{const m=hg();i(h=>h===m?h:m)};s();let r=null;try{r=typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null}catch{r=null}return(u=r==null?void 0:r.addEventListener)==null||u.call(r,"change",s),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),(d=window.visualViewport)==null||d.addEventListener("resize",s),()=>{var m,h;(m=r==null?void 0:r.removeEventListener)==null||m.call(r,"change",s),window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s),(h=window.visualViewport)==null||h.removeEventListener("resize",s)}},[]),a}function FS(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 VS(a,i={}){if(typeof window>"u")return()=>{};const s=r=>{var u;r.ctrlKey||r.altKey||r.metaKey||r.key==="Escape"&&(i.isModalOpen||i.isSheetOpen)&&(FS(r)||(r.preventDefault(),r.stopPropagation(),(u=a.onCloseModals)==null||u.call(a)))};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}}function XS(){const[a,i]=w.useState("terminal"),[s,r]=w.useState(!1),[u,d]=w.useState(!1),[m,h]=w.useState(!1),[p,y]=w.useState(void 0),b=L=>{y(L),h(!0)},[v,S]=w.useState(!1),{updateSettings:T,settings:E,connectionState:Y,stateDetail:A,stateCode:z,lastPairedAt:O}=jt();sx();const B=qS();w.useEffect(()=>IS(),[]);const[te,ue]=w.useState(!0);w.useEffect(()=>{let L=!1;return fetch("/api/info",{headers:{Accept:"application/json"}}).then(I=>I.ok?I.json():null).then(I=>{L||!I||ue(!I.isRemoteRelay)}).catch(()=>{}),()=>{L=!0}},[]),w.useEffect(()=>{zg()},[]),w.useEffect(()=>{const L=s||m||v;if(L)return VS({onCloseModals:()=>{r(!1),h(!1),S(!1)}},{isModalOpen:L})},[s,m,v]),w.useEffect(()=>{const L=()=>{const I=window.location.pathname,le=window.location.hash;i(I==="/admin"||le==="#admin"?"admin":"terminal")};L(),window.addEventListener("popstate",L),window.addEventListener("hashchange",L);try{const I=new URL(window.location.href),le=I.searchParams.get("token"),je=I.searchParams.get("pairCode"),Q=I.searchParams.get("ws")||I.searchParams.get("wsUrl"),Ze={};le&&(Ze.token=le),je&&(Ze.pairCode=je.toUpperCase()),Q&&(Ze.wsUrl=Q),Object.keys(Ze).length>0&&T(Ze);let Le=!1;if(I.searchParams.has("token")&&(I.searchParams.delete("token"),Le=!0),I.searchParams.has("pairCode")&&(I.searchParams.delete("pairCode"),Le=!0),Le){const fe=I.searchParams.toString(),Ge=I.pathname+(fe?`?${fe}`:"")+I.hash;window.history.replaceState({},"",Ge)}}catch(I){console.warn("Failed to parse URL query params:",I)}return()=>{window.removeEventListener("popstate",L),window.removeEventListener("hashchange",L)}},[]);const W=(L=!1)=>{d(L),r(!0)},G=()=>{r(!1),d(!1)},U=L=>{i(L),L==="admin"?window.history.pushState({},"","/admin"):window.history.pushState({},"","/")},ie=!E.token&&!E.pairCode&&Y!=="connected",se=Y==="error"&&(["auth_required","unauthorized","device_revoked"].includes(z||"")||/auth|unauthor|forbidden|permission|token|pair/i.test(A||"")),pe=ie||se,[Ce,Oe]=w.useState(!pe);w.useEffect(()=>{pe||Oe(!0)},[pe]),w.useEffect(()=>{O&&(r(!1),Oe(!0),i("terminal"))},[O]);const rt=a==="terminal"&&!pe,Fe=L=>({visibility:L?"visible":"hidden",opacity:L?1:0,pointerEvents:L?"auto":"none",zIndex:L?1:0});return f.jsxs("div",{"data-testid":"app-shell",style:B?{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:L=>{L.preventDefault(),L.stopPropagation()},children:[!B&&f.jsx(s1,{currentView:a,onNavigate:U,showAdminEntry:te,onOpenPairing:()=>W(!1),onOpenSettings:()=>b(),onToggleVirtualKeyboard:()=>S(!v),isVirtualKeyboardOpen:v}),!B&&!pe&&f.jsx(r1,{}),f.jsxs("div",{className:"flex-1 min-h-0 w-full overflow-hidden relative",children:[Ce&&f.jsxs("div",{"data-testid":"terminal-layer",className:`absolute ${B?"inset-x-0 top-12 bottom-11":"inset-0"} flex flex-col min-h-0 w-full overflow-hidden`,style:Fe(rt),"aria-hidden":!rt,children:[f.jsx(dS,{isActive:rt}),!B&&f.jsx(bS,{isOpen:v,onClose:()=>S(!1)}),f.jsx(pS,{compact:B,onCustomize:()=>b("agentKeymaps")})]}),a==="terminal"&&pe&&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(fS,{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(zS,{onBackToTerminal:()=>U("terminal"),onOpenPairing:()=>W(!1)})}),B&&rt&&f.jsx(KS,{onNavigateAdmin:()=>U("admin"),showAdminEntry:te,onOpenPairing:()=>W(!1),onOpenSettings:()=>b(),onAddProfile:()=>W(!0)})]}),!B&&a!=="admin"&&f.jsx(AS,{onAddProfile:()=>W(!0)}),f.jsx(vS,{isOpen:s,isAddMode:u,onClose:G}),f.jsx(wS,{isOpen:m,initialTab:p,onClose:()=>h(!1)}),f.jsx(TS,{})]})}function PS(){return f.jsx(Xv,{children:f.jsx(XS,{})})}const Rb=document.getElementById("root");if(!Rb)throw new Error("Root element not found");q0.createRoot(Rb).render(f.jsx(mi.StrictMode,{children:f.jsx(PS,{})}));